@developer.notchatbot/webchat 1.0.9 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -612
- package/dist/types.d.ts +21 -0
- package/dist/webchat-bundle.min.js +2641 -2573
- package/dist/webchat-bundle.min.umd.cjs +31 -31
- package/package.json +1 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(be,he){typeof exports=="object"&&typeof module!="undefined"?he(exports):typeof define=="function"&&define.amd?define(["exports"],he):(be=typeof globalThis!="undefined"?globalThis:be||self,he(be.WebChat={}))})(this,function(be){"use strict";var Xg=Object.defineProperty,Yg=Object.defineProperties;var Zg=Object.getOwnPropertyDescriptors;var md=Object.getOwnPropertySymbols;var qg=Object.prototype.hasOwnProperty,em=Object.prototype.propertyIsEnumerable;var
|
|
1
|
+
(function(be,he){typeof exports=="object"&&typeof module!="undefined"?he(exports):typeof define=="function"&&define.amd?define(["exports"],he):(be=typeof globalThis!="undefined"?globalThis:be||self,he(be.WebChat={}))})(this,function(be){"use strict";var Xg=Object.defineProperty,Yg=Object.defineProperties;var Zg=Object.getOwnPropertyDescriptors;var md=Object.getOwnPropertySymbols;var qg=Object.prototype.hasOwnProperty,em=Object.prototype.propertyIsEnumerable;var rl=(be,he,Re)=>he in be?Xg(be,he,{enumerable:!0,configurable:!0,writable:!0,value:Re}):be[he]=Re,me=(be,he)=>{for(var Re in he||(he={}))qg.call(he,Re)&&rl(be,Re,he[Re]);if(md)for(var Re of md(he))em.call(he,Re)&&rl(be,Re,he[Re]);return be},it=(be,he)=>Yg(be,Zg(he));var fe=(be,he,Re)=>rl(be,typeof he!="symbol"?he+"":he,Re);var ot=(be,he,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(be,he)).next())});var el;function he(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re={exports:{}},ie={};/**
|
|
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"),
|
|
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 Cd(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),m=0;m<l;m++)d[m]=arguments[m+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 bd(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(m){return m})):i!=null&&(Io(i)&&(i=bd(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=Cd(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 Xr(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},Yr={transition:null},Ed={ReactCurrentDispatcher:ze,ReactCurrentBatchConfig:Yr,ReactCurrentOwner:Ao};function ml(){throw Error("act(...) is not supported in production builds of React.")}ie.Children={map:Xr,forEach:function(e,t,n){Xr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xr(e,function(){t++}),t},toArray:function(e){return Xr(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 m=0;m<d;m++)l[m]=arguments[m+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=Yr.transition;Yr.transition={};try{e()}finally{Yr.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 ne=Re.exports;const Po=he(ne);var vl={exports:{}},Ze={},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 W=z-1>>>1,G=j[W];if(0<i(G,U))j[W]=U,j[z]=G,z=W;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 W=0,G=j.length,F=G>>>1;W<F;){var O=2*(W+1)-1,D=j[O],B=O+1,_=j[B];if(0>i(D,z))B<G&&0>i(_,D)?(j[W]=_,j[B]=z,W=B):(j[W]=D,j[O]=z,W=O);else if(B<G&&0>i(_,z))j[W]=_,j[B]=z,W=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
|
|
17
|
+
*/(function(e){function t(j,U){var z=j.length;j.push(U);e:for(;0<z;){var W=z-1>>>1,G=j[W];if(0<i(G,U))j[W]=U,j[z]=G,z=W;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 W=0,G=j.length,F=G>>>1;W<F;){var O=2*(W+1)-1,D=j[O],B=O+1,_=j[B];if(0>i(D,z))B<G&&0>i(_,D)?(j[W]=_,j[B]=z,W=B):(j[W]=D,j[O]=z,W=O);else if(B<G&&0>i(_,z))j[W]=_,j[B]=z,W=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=[],m=[],S=1,E=null,y=3,R=!1,f=!1,b=!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 g(j){for(var U=n(m);U!==null;){if(U.callback===null)r(m);else if(U.startTime<=j)r(m),U.sortIndex=U.expirationTime,t(d,U);else break;U=n(m)}}function C(j){if(b=!1,g(j),!f)if(n(d)!==null)f=!0,M(h);else{var U=n(m);U!==null&&A(C,U.startTime-j)}}function h(j,U){f=!1,b&&(b=!1,x(s),s=-1),R=!0;var z=y;try{for(g(U),E=n(d);E!==null&&(!(E.expirationTime>U)||j&&!k());){var W=E.callback;if(typeof W=="function"){E.callback=null,y=E.priorityLevel;var G=W(E.expirationTime<=U);U=e.unstable_now(),typeof G=="function"?E.callback=G:E===n(d)&&r(d),g(U)}else r(d);E=n(d)}if(E!==null)var F=!0;else{var O=n(m);O!==null&&A(C,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 k(){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 W=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?W+z:W):z=W,j){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=z+G,j={id:S++,callback:U,priorityLevel:j,startTime:z,expirationTime:G,sortIndex:-1},z>W?(j.sortIndex=z,t(m,j),n(d)===null&&j===n(m)&&(b?(x(s),s=-1):b=!0,A(C,z-W))):(j.sortIndex=G,t(d,j),f||R||(f=!0,M(h))),j},e.unstable_shouldYield=k,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=ne,qe=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
|
|
26
|
-
`+
|
|
25
|
+
*/var Td=ne,qe=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={},Cl={};function Id(e){return No.call(Cl,e)?!0:No.call(Sl,e)?!1:Ad.test(e)?Cl[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"),bl=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(m){var r=m}Reflect.construct(e,[],t)}else{try{t.call()}catch(m){r=m}e.call(t.prototype)}else{try{throw Error()}catch(m){r=m}e()}}catch(m){if(m&&r&&typeof m.stack=="string"){for(var i=m.stack.split(`
|
|
27
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
|
|
29
|
-
`+i[a].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),h}while(1<=a&&0<=l);break}}}finally{Go=!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=Wo(e.type,!1),e;case 11:return e=Wo(e.type.render,!1),e;case 1:return e=Wo(e.type,!0),e;default:return""}}function $o(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 Uo:return"Profiler";case jo:return"StrictMode";case _o:return"Suspense";case zo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case bl:return(e.displayName||"Context")+".Consumer";case Cl:return(e._context.displayName||"Context")+".Provider";case Bo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ho:return t=e.displayName||null,t!==null?t:$o(e.type)||"Memo";case Ft:t=e._payload,e=e._init;try{return $o(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 $o(t);case 8:return t===jo?"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 El(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Dd(e){var t=El(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 Ol(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=El(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 Vo(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 Tl(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 Al(e,t){t=t.checked,t!=null&&Do(e,"checked",t,!1)}function Qo(e,t){Al(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")?Ko(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ko(e,t.type,Gt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Il(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 Ko(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 Jo(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(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 Pl(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 Nl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Ll(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"?Ll(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ti,Dl=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 jl(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 Ul(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=jl(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 Yo(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 Zo(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 qo=null;function ea(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ta=null,In=null,Mn=null;function Bl(e){if(e=Ar(e)){if(typeof ta!="function")throw Error(J(280));var t=e.stateNode;t&&(t=ki(t),ta(e.stateNode,e.type,t))}}function _l(e){In?Mn?Mn.push(e):Mn=[e]:In=e}function zl(){if(In){var e=In,t=Mn;if(Mn=In=null,Bl(e),t)for(e=0;e<t.length;e++)Bl(t[e])}}function Hl(e,t){return e(t)}function Fl(){}var na=!1;function Gl(e,t,n){if(na)return e(t,n);na=!0;try{return Hl(e,t,n)}finally{na=!1,(In!==null||Mn!==null)&&(Fl(),zl())}}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 ra=!1;if(Tt)try{var ur={};Object.defineProperty(ur,"passive",{get:function(){ra=!0}}),window.addEventListener("test",ur,ur),window.removeEventListener("test",ur,ur)}catch(e){ra=!1}function Bd(e,t,n,r,i,o,a,l,h){var m=Array.prototype.slice.call(arguments,3);try{t.apply(n,m)}catch(S){this.onError(S)}}var cr=!1,ni=null,ri=!1,ia=null,_d={onError:function(e){cr=!0,ni=e}};function zd(e,t,n,r,i,o,a,l,h){cr=!1,ni=null,Bd.apply(_d,arguments)}function Hd(e,t,n,r,i,o,a,l,h){if(zd.apply(this,arguments),cr){if(cr){var m=ni;cr=!1,ni=null}else throw Error(J(198));ri||(ri=!0,ia=m)}}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 Wl(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 $l(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 $l(i),e;if(o===r)return $l(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 Vl(e){return e=Fd(e),e!==null?Ql(e):null}function Ql(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Ql(e);if(t!==null)return t;e=e.sibling}return null}var Kl=qe.unstable_scheduleCallback,Jl=qe.unstable_cancelCallback,Gd=qe.unstable_shouldYield,Wd=qe.unstable_requestPaint,ke=qe.unstable_now,$d=qe.unstable_getCurrentPriorityLevel,oa=qe.unstable_ImmediatePriority,Xl=qe.unstable_UserBlockingPriority,ii=qe.unstable_NormalPriority,Vd=qe.unstable_LowPriority,Yl=qe.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:Xd,Kd=Math.log,Jd=Math.LN2;function Xd(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 Yd(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,h=i[a];h===-1?(!(l&n)||l&r)&&(i[a]=Yd(l,t)):h<=t&&(e.expiredLanes|=l),o&=~l}}function aa(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Zl(){var e=ai;return ai<<=1,!(ai&4194240)&&(ai=64),e}function sa(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 la(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 ql(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var eu,ua,tu,nu,ru,ca=!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 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,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&&ua(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 ou(e){var t=fn(e.target);if(t!==null){var n=cn(t);if(n!==null){if(t=n.tag,t===13){if(t=Wl(n),t!==null){e.blockedOn=t,ru(e.priority,function(){tu(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=da(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qo=r,n.target.dispatchEvent(r),qo=null}else return t=Ar(n),t!==null&&ua(t),e.blockedOn=n,!1;t.shift()}return!0}function au(e,t,n){ci(e)&&n.delete(t)}function nh(){ca=!1,Wt!==null&&ci(Wt)&&(Wt=null),$t!==null&&ci($t)&&($t=null),Vt!==null&&ci(Vt)&&(Vt=null),hr.forEach(au),pr.forEach(au)}function mr(e,t){e.blockedOn===t&&(e.blockedOn=null,ca||(ca=!0,qe.unstable_scheduleCallback(qe.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);)ou(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,fa(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,fa(e,t,n,r)}finally{ue=i,Pn.transition=o}}function fa(e,t,n,r){if(fi){var i=da(e,t,n,r);if(i===null)Aa(e,t,r,di,n),iu(e,r);else if(th(i,e,t,n,r))r.stopPropagation();else if(iu(e,r),t&4&&-1<eh.indexOf(e)){for(;i!==null;){var o=Ar(i);if(o!==null&&eu(o),o=da(e,t,n,r),o===null&&Aa(e,t,r,di,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else Aa(e,t,r,null,n)}}var di=null;function da(e,t,n,r){if(di=null,e=ea(r),e=fn(e),e!==null)if(t=cn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Wl(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 su(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 oa:return 1;case Xl:return 4;case ii:case Vd:return 16;case Yl:return 536870912;default:return 16}default:return 16}}var Kt=null,ha=null,hi=null;function lu(){if(hi)return hi;var e,t=ha,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 uu(){return!1}function et(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:uu,this.isPropagationStopped=uu,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},pa=et(Nn),yr=we({},Nn,{view:0,detail:0}),oh=et(yr),ga,ma,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:ya,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"?(ga=e.screenX-wr.screenX,ma=e.screenY-wr.screenY):ma=ga=0,wr=e),ga)},movementY:function(e){return"movementY"in e?e.movementY:ma}}),cu=et(mi),ah=we({},mi,{dataTransfer:0}),sh=et(ah),lh=we({},yr,{relatedTarget:0}),va=et(lh),uh=we({},Nn,{animationName:0,elapsedTime:0,pseudoElement:0}),ch=et(uh),fh=we({},Nn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),dh=et(fh),hh=we({},Nn,{data:0}),fu=et(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 ya(){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:ya,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=et(yh),xh=we({},mi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),du=et(xh),Sh=we({},yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ya}),Ch=et(Sh),bh=we({},Nn,{propertyName:0,elapsedTime:0,pseudoElement:0}),kh=et(bh),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=et(Rh),Oh=[9,13,27,32],wa=Tt&&"CompositionEvent"in window,xr=null;Tt&&"documentMode"in document&&(xr=document.documentMode);var Th=Tt&&"TextEvent"in window&&!xr,hu=Tt&&(!wa||xr&&8<xr&&11>=xr),pu=" ",gu=!1;function mu(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 vu(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 vu(t);case"keypress":return t.which!==32?null:(gu=!0,pu);case"textInput":return e=t.data,e===pu&&gu?null:e;default:return null}}function Ih(e,t){if(Ln)return e==="compositionend"||!wa&&mu(e,t)?(e=lu(),hi=ha=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 hu&&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 yu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Mh[e.type]:t==="textarea"}function wu(e,t,n,r){_l(r),t=Si(t,"onChange"),0<t.length&&(n=new pa("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Sr=null,Cr=null;function Ph(e){Uu(e,0)}function vi(e){var t=_n(e);if(Ol(t))return e}function Nh(e,t){if(e==="change")return t}var xu=!1;if(Tt){var xa;if(Tt){var Sa="oninput"in document;if(!Sa){var Su=document.createElement("div");Su.setAttribute("oninput","return;"),Sa=typeof Su.oninput=="function"}xa=Sa}else xa=!1;xu=xa&&(!document.documentMode||9<document.documentMode)}function Cu(){Sr&&(Sr.detachEvent("onpropertychange",bu),Cr=Sr=null)}function bu(e){if(e.propertyName==="value"&&vi(Cr)){var t=[];wu(t,Cr,e,ea(e)),Gl(Ph,t)}}function Lh(e,t,n){e==="focusin"?(Cu(),Sr=t,Cr=n,Sr.attachEvent("onpropertychange",bu)):e==="focusout"&&Cu()}function Dh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vi(Cr)}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 br(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(!Po.call(t,i)||!ht(e[i],t[i]))return!1}return!0}function ku(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ru(e,t){var n=ku(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=ku(n)}}function Eu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Eu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ou(){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=Ou(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Eu(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=Ru(n,o);var a=Ru(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,ba=null,kr=null,ka=!1;function Tu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ka||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&&br(kr,r)||(kr=r,r=Si(ba,"onSelect"),0<r.length&&(t=new pa("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")},Ra={},Au={};Tt&&(Au=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(Ra[e])return Ra[e];if(!jn[e])return e;var t=jn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Au)return Ra[e]=t[n];return e}var Iu=wi("animationend"),Mu=wi("animationiteration"),Pu=wi("animationstart"),Nu=wi("transitionend"),Lu=new Map,Du="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){Lu.set(e,t),un(t,[e])}for(var Ea=0;Ea<Du.length;Ea++){var Oa=Du[Ea],Hh=Oa.toLowerCase(),Fh=Oa[0].toUpperCase()+Oa.slice(1);Jt(Hh,"on"+Fh)}Jt(Iu,"onAnimationEnd"),Jt(Mu,"onAnimationIteration"),Jt(Pu,"onAnimationStart"),Jt("dblclick","onDoubleClick"),Jt("focusin","onFocus"),Jt("focusout","onBlur"),Jt(Nu,"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 ju(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Hd(r,t,void 0,e),e.currentTarget=null}function Uu(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],h=l.instance,m=l.currentTarget;if(l=l.listener,h!==o&&i.isPropagationStopped())break e;ju(i,l,m),o=h}else for(a=0;a<r.length;a++){if(l=r[a],h=l.instance,m=l.currentTarget,l=l.listener,h!==o&&i.isPropagationStopped())break e;ju(i,l,m),o=h}}}if(ri)throw e=ia,ri=!1,ia=null,e}function pe(e,t){var n=t[Da];n===void 0&&(n=t[Da]=new Set);var r=e+"__bubble";n.has(r)||(Bu(t,e,2,!1),n.add(r))}function Ta(e,t,n){var r=0;t&&(r|=4),Bu(n,e,r,t)}var xi="_reactListening"+Math.random().toString(36).slice(2);function Er(e){if(!e[xi]){e[xi]=!0,wl.forEach(function(n){n!=="selectionchange"&&(Gh.has(n)||Ta(n,!1,e),Ta(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xi]||(t[xi]=!0,Ta("selectionchange",!1,t))}}function Bu(e,t,n,r){switch(su(t)){case 1:var i=rh;break;case 4:i=ih;break;default:i=fa}n=i.bind(null,t,n,e),i=void 0,!ra||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 Aa(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 h=a.tag;if((h===3||h===4)&&(h=a.stateNode.containerInfo,h===i||h.nodeType===8&&h.parentNode===i))return;a=a.return}for(;l!==null;){if(a=fn(l),a===null)return;if(h=a.tag,h===5||h===6){r=o=a;continue e}l=l.parentNode}}r=r.return}Gl(function(){var m=o,S=ea(n),E=[];e:{var y=Lu.get(e);if(y!==void 0){var R=pa,f=e;switch(e){case"keypress":if(pi(n)===0)break e;case"keydown":case"keyup":R=wh;break;case"focusin":f="focus",R=va;break;case"focusout":f="blur",R=va;break;case"beforeblur":case"afterblur":R=va;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=cu;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=Ch;break;case Iu:case Mu:case Pu:R=ch;break;case Nu: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=du}var b=(t&4)!==0,T=!b&&e==="scroll",x=b?y!==null?y+"Capture":null:y;b=[];for(var p=m,g;p!==null;){g=p;var C=g.stateNode;if(g.tag===5&&C!==null&&(g=C,x!==null&&(C=lr(p,x),C!=null&&b.push(Or(p,C,g)))),T)break;p=p.return}0<b.length&&(y=new R(y,f,null,n,S),E.push({event:y,listeners:b}))}}if(!(t&7)){e:{if(y=e==="mouseover"||e==="pointerover",R=e==="mouseout"||e==="pointerout",y&&n!==qo&&(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=m,f=f?fn(f):null,f!==null&&(T=cn(f),f!==T||f.tag!==5&&f.tag!==6)&&(f=null)):(R=null,f=m),R!==f)){if(b=cu,C="onMouseLeave",x="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(b=du,C="onPointerLeave",x="onPointerEnter",p="pointer"),T=R==null?y:_n(R),g=f==null?y:_n(f),y=new b(C,p+"leave",R,n,S),y.target=T,y.relatedTarget=g,C=null,fn(S)===m&&(b=new b(x,p+"enter",f,n,S),b.target=g,b.relatedTarget=T,C=b),T=C,R&&f)t:{for(b=R,x=f,p=0,g=b;g;g=Un(g))p++;for(g=0,C=x;C;C=Un(C))g++;for(;0<p-g;)b=Un(b),p--;for(;0<g-p;)x=Un(x),g--;for(;p--;){if(b===x||x!==null&&b===x.alternate)break t;b=Un(b),x=Un(x)}b=null}else b=null;R!==null&&_u(E,y,R,b,!1),f!==null&&T!==null&&_u(E,T,f,b,!0)}}e:{if(y=m?_n(m):window,R=y.nodeName&&y.nodeName.toLowerCase(),R==="select"||R==="input"&&y.type==="file")var d=Nh;else if(yu(y))if(xu)d=Uh;else{d=Dh;var c=Lh}else(R=y.nodeName)&&R.toLowerCase()==="input"&&(y.type==="checkbox"||y.type==="radio")&&(d=jh);if(d&&(d=d(e,m))){wu(E,d,n,S);break e}c&&c(e,y,m),e==="focusout"&&(c=y._wrapperState)&&c.controlled&&y.type==="number"&&Ko(y,"number",y.value)}switch(c=m?_n(m):window,e){case"focusin":(yu(c)||c.contentEditable==="true")&&(Dn=c,ba=m,kr=null);break;case"focusout":kr=ba=Dn=null;break;case"mousedown":ka=!0;break;case"contextmenu":case"mouseup":case"dragend":ka=!1,Tu(E,n,S);break;case"selectionchange":if(zh)break;case"keydown":case"keyup":Tu(E,n,S)}var u;if(wa)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?mu(e,n)&&(s="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(s="onCompositionStart");s&&(hu&&n.locale!=="ko"&&(Ln||s!=="onCompositionStart"?s==="onCompositionEnd"&&Ln&&(u=lu()):(Kt=S,ha="value"in Kt?Kt.value:Kt.textContent,Ln=!0)),c=Si(m,s),0<c.length&&(s=new fu(s,e,null,n,S),E.push({event:s,listeners:c}),u?s.data=u:(u=vu(n),u!==null&&(s.data=u)))),(u=Th?Ah(e,n):Ih(e,n))&&(m=Si(m,"onBeforeInput"),0<m.length&&(S=new fu("onBeforeInput","beforeinput",null,n,S),E.push({event:S,listeners:m}),S.data=u))}Uu(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 _u(e,t,n,r,i){for(var o=t._reactName,a=[];n!==null&&n!==r;){var l=n,h=l.alternate,m=l.stateNode;if(h!==null&&h===r)break;l.tag===5&&m!==null&&(l=m,i?(h=lr(n,o),h!=null&&a.unshift(Or(n,h,l))):i||(h=lr(n,o),h!=null&&a.push(Or(n,h,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var Wh=/\r\n?/g,$h=/\u0000|\uFFFD/g;function zu(e){return(typeof e=="string"?e:""+e).replace(Wh,`
|
|
30
|
-
`).replace($h,"")}function Ci(e,t,n){if(t=zu(t),zu(e)!==t&&n)throw Error(J(425))}function bi(){}var Ia=null,Ma=null;function Pa(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 Na=typeof setTimeout=="function"?setTimeout:void 0,Vh=typeof clearTimeout=="function"?clearTimeout:void 0,Hu=typeof Promise=="function"?Promise:void 0,Qh=typeof queueMicrotask=="function"?queueMicrotask:typeof Hu!="undefined"?function(e){return Hu.resolve(null).then(e).catch(Kh)}:Na;function Kh(e){setTimeout(function(){throw e})}function La(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 Xt(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 Fu(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),Ct="__reactFiber$"+Bn,Tr="__reactProps$"+Bn,It="__reactContainer$"+Bn,Da="__reactEvents$"+Bn,Jh="__reactListeners$"+Bn,Xh="__reactHandles$"+Bn;function fn(e){var t=e[Ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[It]||n[Ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Fu(e);e!==null;){if(n=e[Ct])return n;e=Fu(e)}return t}e=n,n=e.parentNode}return null}function Ar(e){return e=e[Ct]||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 ja=[],zn=-1;function Yt(e){return{current:e}}function ge(e){0>zn||(e.current=ja[zn],ja[zn]=null,zn--)}function de(e,t){zn++,ja[zn]=e.current,e.current=t}var Zt={},je=Yt(Zt),Ve=Yt(!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 Qe(e){return e=e.childContextTypes,e!=null}function Ri(){ge(Ve),ge(je)}function Gu(e,t,n){if(je.current!==Zt)throw Error(J(168));de(je,t),de(Ve,n)}function Wu(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,de(je,e),de(Ve,Ve.current),!0}function $u(e,t,n){var r=e.stateNode;if(!r)throw Error(J(169));n?(e=Wu(e,t,dn),r.__reactInternalMemoizedMergedChildContext=e,ge(Ve),ge(je),de(je,e)):ge(Ve),de(Ve,n)}var Mt=null,Oi=!1,Ua=!1;function Vu(e){Mt===null?Mt=[e]:Mt.push(e)}function Yh(e){Oi=!0,Vu(e)}function qt(){if(!Ua&&Mt!==null){Ua=!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)),Kl(oa,qt),i}finally{ue=t,Ua=!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 Qu(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 Ba(e){e.return!==null&&(pn(e,1),Qu(e,1,0))}function _a(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 tt=null,nt=null,ve=!1,pt=null;function Ku(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 Ju(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,tt=e,nt=Xt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,tt=e,nt=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,tt=e,nt=null,!0):!1;default:return!1}}function za(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ha(e){if(ve){var t=nt;if(t){var n=t;if(!Ju(e,t)){if(za(e))throw Error(J(418));t=Xt(n.nextSibling);var r=tt;t&&Ju(e,t)?Ku(r,n):(e.flags=e.flags&-4097|2,ve=!1,tt=e)}}else{if(za(e))throw Error(J(418));e.flags=e.flags&-4097|2,ve=!1,tt=e}}}function Xu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;tt=e}function Ii(e){if(e!==tt)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"&&!Pa(e.type,e.memoizedProps)),t&&(t=nt)){if(za(e))throw Yu(),Error(J(418));for(;t;)Ku(e,t),t=Xt(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){nt=Xt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}nt=null}}else nt=tt?Xt(e.stateNode.nextSibling):null;return!0}function Yu(){for(var e=nt;e;)e=Xt(e.nextSibling)}function Wn(){nt=tt=null,ve=!1}function Fa(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 Zu(e){var t=e._init;return t(e._payload)}function qu(e){function t(x,p){if(e){var g=x.deletions;g===null?(x.deletions=[p],x.flags|=16):g.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,g){return x.index=g,e?(g=x.alternate,g!==null?(g=g.index,g<p?(x.flags|=2,p):g):(x.flags|=2,p)):(x.flags|=1048576,p)}function a(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,p,g,C){return p===null||p.tag!==6?(p=Ns(g,x.mode,C),p.return=x,p):(p=i(p,g),p.return=x,p)}function h(x,p,g,C){var d=g.type;return d===Tn?S(x,p,g.props.children,C,g.key):p!==null&&(p.elementType===d||typeof d=="object"&&d!==null&&d.$$typeof===Ft&&Zu(d)===p.type)?(C=i(p,g.props),C.ref=Ir(x,p,g),C.return=x,C):(C=to(g.type,g.key,g.props,null,x.mode,C),C.ref=Ir(x,p,g),C.return=x,C)}function m(x,p,g,C){return p===null||p.tag!==4||p.stateNode.containerInfo!==g.containerInfo||p.stateNode.implementation!==g.implementation?(p=Ls(g,x.mode,C),p.return=x,p):(p=i(p,g.children||[]),p.return=x,p)}function S(x,p,g,C,d){return p===null||p.tag!==7?(p=Cn(g,x.mode,C,d),p.return=x,p):(p=i(p,g),p.return=x,p)}function E(x,p,g){if(typeof p=="string"&&p!==""||typeof p=="number")return p=Ns(""+p,x.mode,g),p.return=x,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Zr:return g=to(p.type,p.key,p.props,null,x.mode,g),g.ref=Ir(x,null,p),g.return=x,g;case On:return p=Ls(p,x.mode,g),p.return=x,p;case Ft:var C=p._init;return E(x,C(p._payload),g)}if(or(p)||rr(p))return p=Cn(p,x.mode,g,null),p.return=x,p;Mi(x,p)}return null}function y(x,p,g,C){var d=p!==null?p.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return d!==null?null:l(x,p,""+g,C);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Zr:return g.key===d?h(x,p,g,C):null;case On:return g.key===d?m(x,p,g,C):null;case Ft:return d=g._init,y(x,p,d(g._payload),C)}if(or(g)||rr(g))return d!==null?null:S(x,p,g,C,null);Mi(x,g)}return null}function R(x,p,g,C,d){if(typeof C=="string"&&C!==""||typeof C=="number")return x=x.get(g)||null,l(p,x,""+C,d);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Zr:return x=x.get(C.key===null?g:C.key)||null,h(p,x,C,d);case On:return x=x.get(C.key===null?g:C.key)||null,m(p,x,C,d);case Ft:var c=C._init;return R(x,p,g,c(C._payload),d)}if(or(C)||rr(C))return x=x.get(g)||null,S(p,x,C,d,null);Mi(p,C)}return null}function f(x,p,g,C){for(var d=null,c=null,u=p,s=p=0,w=null;u!==null&&s<g.length;s++){u.index>s?(w=u,u=null):w=u.sibling;var v=y(x,u,g[s],C);if(v===null){u===null&&(u=w);break}e&&u&&v.alternate===null&&t(x,u),p=o(v,p,s),c===null?d=v:c.sibling=v,c=v,u=w}if(s===g.length)return n(x,u),ve&&pn(x,s),d;if(u===null){for(;s<g.length;s++)u=E(x,g[s],C),u!==null&&(p=o(u,p,s),c===null?d=u:c.sibling=u,c=u);return ve&&pn(x,s),d}for(u=r(x,u);s<g.length;s++)w=R(u,x,s,g[s],C),w!==null&&(e&&w.alternate!==null&&u.delete(w.key===null?s:w.key),p=o(w,p,s),c===null?d=w:c.sibling=w,c=w);return e&&u.forEach(function(k){return t(x,k)}),ve&&pn(x,s),d}function b(x,p,g,C){var d=rr(g);if(typeof d!="function")throw Error(J(150));if(g=d.call(g),g==null)throw Error(J(151));for(var c=d=null,u=p,s=p=0,w=null,v=g.next();u!==null&&!v.done;s++,v=g.next()){u.index>s?(w=u,u=null):w=u.sibling;var k=y(x,u,v.value,C);if(k===null){u===null&&(u=w);break}e&&u&&k.alternate===null&&t(x,u),p=o(k,p,s),c===null?d=k:c.sibling=k,c=k,u=w}if(v.done)return n(x,u),ve&&pn(x,s),d;if(u===null){for(;!v.done;s++,v=g.next())v=E(x,v.value,C),v!==null&&(p=o(v,p,s),c===null?d=v:c.sibling=v,c=v);return ve&&pn(x,s),d}for(u=r(x,u);!v.done;s++,v=g.next())v=R(u,x,s,v.value,C),v!==null&&(e&&v.alternate!==null&&u.delete(v.key===null?s:v.key),p=o(v,p,s),c===null?d=v:c.sibling=v,c=v);return e&&u.forEach(function(L){return t(x,L)}),ve&&pn(x,s),d}function T(x,p,g,C){if(typeof g=="object"&&g!==null&&g.type===Tn&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Zr:e:{for(var d=g.key,c=p;c!==null;){if(c.key===d){if(d=g.type,d===Tn){if(c.tag===7){n(x,c.sibling),p=i(c,g.props.children),p.return=x,x=p;break e}}else if(c.elementType===d||typeof d=="object"&&d!==null&&d.$$typeof===Ft&&Zu(d)===c.type){n(x,c.sibling),p=i(c,g.props),p.ref=Ir(x,c,g),p.return=x,x=p;break e}n(x,c);break}else t(x,c);c=c.sibling}g.type===Tn?(p=Cn(g.props.children,x.mode,C,g.key),p.return=x,x=p):(C=to(g.type,g.key,g.props,null,x.mode,C),C.ref=Ir(x,p,g),C.return=x,x=C)}return a(x);case On:e:{for(c=g.key;p!==null;){if(p.key===c)if(p.tag===4&&p.stateNode.containerInfo===g.containerInfo&&p.stateNode.implementation===g.implementation){n(x,p.sibling),p=i(p,g.children||[]),p.return=x,x=p;break e}else{n(x,p);break}else t(x,p);p=p.sibling}p=Ls(g,x.mode,C),p.return=x,x=p}return a(x);case Ft:return c=g._init,T(x,p,c(g._payload),C)}if(or(g))return f(x,p,g,C);if(rr(g))return b(x,p,g,C);Mi(x,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,p!==null&&p.tag===6?(n(x,p.sibling),p=i(p,g),p.return=x,x=p):(n(x,p),p=Ns(g,x.mode,C),p.return=x,x=p),a(x)):n(x,p)}return T}var $n=qu(!0),ec=qu(!1),Pi=Yt(null),Ni=null,Vn=null,Ga=null;function Wa(){Ga=Vn=Ni=null}function $a(e){var t=Pi.current;ge(Pi),e._currentValue=t}function Va(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,Ga=Vn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ke=!0),e.firstContext=null)}function lt(e){var t=e._currentValue;if(Ga!==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 Qa(e){gn===null?gn=[e]:gn.push(e)}function tc(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Qa(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 Ka(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nc(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,Qa(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,la(e,n)}}function rc(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 h=l,m=h.next;h.next=null,a===null?o=m:a.next=m,a=h;var S=e.alternate;S!==null&&(S=S.updateQueue,l=S.lastBaseUpdate,l!==a&&(l===null?S.firstBaseUpdate=m:l.next=m,S.lastBaseUpdate=h))}if(o!==null){var E=i.baseState;a=0,S=m=h=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,b=l;switch(y=t,R=n,b.tag){case 1:if(f=b.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=b.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?(m=S=R,h=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&&(h=E),i.baseState=h,i.firstBaseUpdate=m,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 ic(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={},bt=Yt(Mr),Pr=Yt(Mr),Nr=Yt(Mr);function mn(e){if(e===Mr)throw Error(J(174));return e}function Ja(e,t){switch(de(Nr,t),de(Pr,e),de(bt,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)}ge(bt),de(bt,t)}function Kn(){ge(bt),ge(Pr),ge(Nr)}function oc(e){mn(Nr.current);var t=mn(bt.current),n=Xo(t,e.type);t!==n&&(de(Pr,e),de(bt,n))}function Xa(e){Pr.current===e&&(ge(bt),ge(Pr))}var xe=Yt(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 Ya=[];function Za(){for(var e=0;e<Ya.length;e++)Ya[e]._workInProgressVersionPrimary=null;Ya.length=0}var Ui=At.ReactCurrentDispatcher,qa=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 es(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 ts(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 ns(){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 rs(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,h=null,m=o;do{var S=m.lane;if((vn&S)===S)h!==null&&(h=h.next={lane:0,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null}),r=m.hasEagerState?m.eagerState:e(r,m.action);else{var E={lane:S,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null};h===null?(l=h=E,a=r):h=h.next=E,Se.lanes|=S,yn|=S}m=m.next}while(m!==null&&m!==o);h===null?a=r:h.next=l,ht(r,t.memoizedState)||(Ke=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=h,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 is(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)||(Ke=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ac(){}function sc(e,t){var n=Se,r=ut(),i=t(),o=!ht(r.memoizedState,i);if(o&&(r.memoizedState=i,Ke=!0),r=r.queue,os(cc.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||Ie!==null&&Ie.memoizedState.tag&1){if(n.flags|=2048,Ur(9,uc.bind(null,n,r,i,t),void 0,null),Me===null)throw Error(J(349));vn&30||lc(n,t,i)}return i}function lc(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 uc(e,t,n,r){t.value=n,t.getSnapshot=r,fc(t)&&dc(e)}function cc(e,t,n){return n(function(){fc(t)&&dc(e)})}function fc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ht(e,n)}catch(r){return!0}}function dc(e){var t=Lt(e,1);t!==null&&yt(t,e,1,-1)}function hc(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 pc(){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&&es(r,a.deps)){i.memoizedState=Ur(t,n,o,r);return}}Se.flags|=e,i.memoizedState=Ur(1|t,n,o,r)}function gc(e,t){return _i(8390656,8,e,t)}function os(e,t){return zi(2048,8,e,t)}function mc(e,t){return zi(4,2,e,t)}function vc(e,t){return zi(4,4,e,t)}function yc(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 wc(e,t,n){return n=n!=null?n.concat([e]):null,zi(4,4,yc.bind(null,t,e),n)}function as(){}function xc(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&es(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Sc(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&es(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Cc(e,t,n){return vn&21?(ht(n,t)||(n=Zl(),Se.lanes|=n,yn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ke=!0),e.memoizedState=n)}function ep(e,t){var n=ue;ue=n!==0&&4>n?n:4,e(!0);var r=qa.transition;qa.transition={};try{e(!1),t()}finally{ue=n,qa.transition=r}}function bc(){return ut().memoizedState}function tp(e,t,n){var r=an(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},kc(e))Rc(t,n);else if(n=tc(e,t,n,r),n!==null){var i=Ge();yt(n,e,r,i),Ec(n,t,r)}}function np(e,t,n){var r=an(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(kc(e))Rc(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 h=t.interleaved;h===null?(i.next=i,Qa(t)):(i.next=h.next,h.next=i),t.interleaved=i;return}}catch(m){}finally{}n=tc(e,t,i,r),n!==null&&(i=Ge(),yt(n,e,r,i),Ec(n,t,r))}}function kc(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Rc(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 Ec(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,la(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:gc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,_i(4194308,4,yc.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:hc,useDebugValue:as,useDeferredValue:function(e){return kt().memoizedState=e},useTransition:function(){var e=hc(!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||lc(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,gc(cc.bind(null,r,o,e),[e]),r.flags|=2048,Ur(9,uc.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:xc,useContext:lt,useEffect:os,useImperativeHandle:wc,useInsertionEffect:mc,useLayoutEffect:vc,useMemo:Sc,useReducer:rs,useRef:pc,useState:function(){return rs(jr)},useDebugValue:as,useDeferredValue:function(e){var t=ut();return Cc(t,Oe.memoizedState,e)},useTransition:function(){var e=rs(jr)[0],t=ut().memoizedState;return[e,t]},useMutableSource:ac,useSyncExternalStore:sc,useId:bc,unstable_isNewReconciler:!1},op={readContext:lt,useCallback:xc,useContext:lt,useEffect:os,useImperativeHandle:wc,useInsertionEffect:mc,useLayoutEffect:vc,useMemo:Sc,useReducer:is,useRef:pc,useState:function(){return is(jr)},useDebugValue:as,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:ac,useSyncExternalStore:sc,useId:bc,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 ss(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 Oc(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?!br(n,r)||!br(i,o):!0}function Tc(e,t,n){var r=!1,i=Zt,o=t.contextType;return typeof o=="object"&&o!==null?o=lt(o):(i=Qe(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 Ac(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 ls(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Ka(e);var o=t.contextType;typeof o=="object"&&o!==null?i.context=lt(o):(o=Qe(t)?dn:je.current,i.context=Hn(e,o)),i.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(ss(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=`
|
|
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 bl: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 Xo(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 Yo(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 m=Array.prototype.slice.call(arguments,3);try{t.apply(n,m)}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 m=ni;cr=!1,ni=null}else throw Error(J(198));ri||(ri=!0,oa=m)}}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=qe.unstable_scheduleCallback,Xl=qe.unstable_cancelCallback,Gd=qe.unstable_shouldYield,Wd=qe.unstable_requestPaint,ke=qe.unstable_now,$d=qe.unstable_getCurrentPriorityLevel,aa=qe.unstable_ImmediatePriority,Yl=qe.unstable_UserBlockingPriority,ii=qe.unstable_NormalPriority,Vd=qe.unstable_LowPriority,Zl=qe.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:Xd,Kd=Math.log,Jd=Math.LN2;function Xd(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 Yd(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]=Yd(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,qe.unstable_scheduleCallback(qe.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 Yl: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 et(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=et(Nn),yr=we({},Nn,{view:0,detail:0}),oh=et(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=et(mi),ah=we({},mi,{dataTransfer:0}),sh=et(ah),lh=we({},yr,{relatedTarget:0}),ya=et(lh),uh=we({},Nn,{animationName:0,elapsedTime:0,pseudoElement:0}),ch=et(uh),fh=we({},Nn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),dh=et(fh),hh=we({},Nn,{data:0}),du=et(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=et(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=et(xh),Sh=we({},yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wa}),Ch=et(Sh),bh=we({},Nn,{propertyName:0,elapsedTime:0,pseudoElement:0}),kh=et(bh),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=et(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,Cr=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 Ca="oninput"in document;if(!Ca){var Cu=document.createElement("div");Cu.setAttribute("oninput","return;"),Ca=typeof Cu.oninput=="function"}Sa=Ca}else Sa=!1;Su=Sa&&(!document.documentMode||9<document.documentMode)}function bu(){Sr&&(Sr.detachEvent("onpropertychange",ku),Cr=Sr=null)}function ku(e){if(e.propertyName==="value"&&vi(Cr)){var t=[];xu(t,Cr,e,ta(e)),Wl(Ph,t)}}function Lh(e,t,n){e==="focusin"?(bu(),Sr=t,Cr=n,Sr.attachEvent("onpropertychange",ku)):e==="focusout"&&bu()}function Dh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vi(Cr)}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 br(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 ba(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&&ba(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&&ba(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&&br(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,m=l.currentTarget;if(l=l.listener,d!==o&&i.isPropagationStopped())break e;Uu(i,l,m),o=d}else for(a=0;a<r.length;a++){if(l=r[a],d=l.instance,m=l.currentTarget,l=l.listener,d!==o&&i.isPropagationStopped())break e;Uu(i,l,m),o=d}}}if(ri)throw e=oa,ri=!1,oa=null,e}function pe(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 m=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=Ch;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 b=(t&4)!==0,T=!b&&e==="scroll",x=b?y!==null?y+"Capture":null:y;b=[];for(var p=m,g;p!==null;){g=p;var C=g.stateNode;if(g.tag===5&&C!==null&&(g=C,x!==null&&(C=lr(p,x),C!=null&&b.push(Or(p,C,g)))),T)break;p=p.return}0<b.length&&(y=new R(y,f,null,n,S),E.push({event:y,listeners:b}))}}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=m,f=f?fn(f):null,f!==null&&(T=cn(f),f!==T||f.tag!==5&&f.tag!==6)&&(f=null)):(R=null,f=m),R!==f)){if(b=fu,C="onMouseLeave",x="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(b=hu,C="onPointerLeave",x="onPointerEnter",p="pointer"),T=R==null?y:_n(R),g=f==null?y:_n(f),y=new b(C,p+"leave",R,n,S),y.target=T,y.relatedTarget=g,C=null,fn(S)===m&&(b=new b(x,p+"enter",f,n,S),b.target=g,b.relatedTarget=T,C=b),T=C,R&&f)t:{for(b=R,x=f,p=0,g=b;g;g=Un(g))p++;for(g=0,C=x;C;C=Un(C))g++;for(;0<p-g;)b=Un(b),p--;for(;0<g-p;)x=Un(x),g--;for(;p--;){if(b===x||x!==null&&b===x.alternate)break t;b=Un(b),x=Un(x)}b=null}else b=null;R!==null&&zu(E,y,R,b,!1),f!==null&&T!==null&&zu(E,T,f,b,!0)}}e:{if(y=m?_n(m):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,m))){xu(E,h,n,S);break e}c&&c(e,y,m),e==="focusout"&&(c=y._wrapperState)&&c.controlled&&y.type==="number"&&Jo(y,"number",y.value)}switch(c=m?_n(m):window,e){case"focusin":(wu(c)||c.contentEditable==="true")&&(Dn=c,ka=m,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(m,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))&&(m=Si(m,"onBeforeInput"),0<m.length&&(S=new du("onBeforeInput","beforeinput",null,n,S),E.push({event:S,listeners:m}),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,m=l.stateNode;if(d!==null&&d===r)break;l.tag===5&&m!==null&&(l=m,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 Ci(e,t,n){if(t=Hu(t),Hu(e)!==t&&n)throw Error(J(425))}function bi(){}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 Xt(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),Ct="__reactFiber$"+Bn,Tr="__reactProps$"+Bn,It="__reactContainer$"+Bn,ja="__reactEvents$"+Bn,Jh="__reactListeners$"+Bn,Xh="__reactHandles$"+Bn;function fn(e){var t=e[Ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[It]||n[Ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Gu(e);e!==null;){if(n=e[Ct])return n;e=Gu(e)}return t}e=n,n=e.parentNode}return null}function Ar(e){return e=e[Ct]||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 Yt(e){return{current:e}}function ge(e){0>zn||(e.current=Ua[zn],Ua[zn]=null,zn--)}function de(e,t){zn++,Ua[zn]=e.current,e.current=t}var Zt={},je=Yt(Zt),Ve=Yt(!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 Qe(e){return e=e.childContextTypes,e!=null}function Ri(){ge(Ve),ge(je)}function Wu(e,t,n){if(je.current!==Zt)throw Error(J(168));de(je,t),de(Ve,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,de(je,e),de(Ve,Ve.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,ge(Ve),ge(je),de(je,e)):ge(Ve),de(Ve,n)}var Mt=null,Oi=!1,Ba=!1;function Qu(e){Mt===null?Mt=[e]:Mt.push(e)}function Yh(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 tt=null,nt=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 Xu(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,tt=e,nt=Xt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,tt=e,nt=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,tt=e,nt=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=nt;if(t){var n=t;if(!Xu(e,t)){if(Ha(e))throw Error(J(418));t=Xt(n.nextSibling);var r=tt;t&&Xu(e,t)?Ju(r,n):(e.flags=e.flags&-4097|2,ve=!1,tt=e)}}else{if(Ha(e))throw Error(J(418));e.flags=e.flags&-4097|2,ve=!1,tt=e}}}function Yu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;tt=e}function Ii(e){if(e!==tt)return!1;if(!ve)return Yu(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=nt)){if(Ha(e))throw Zu(),Error(J(418));for(;t;)Ju(e,t),t=Xt(t.nextSibling)}if(Yu(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){nt=Xt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}nt=null}}else nt=tt?Xt(e.stateNode.nextSibling):null;return!0}function Zu(){for(var e=nt;e;)e=Xt(e.nextSibling)}function Wn(){nt=tt=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 g=x.deletions;g===null?(x.deletions=[p],x.flags|=16):g.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,g){return x.index=g,e?(g=x.alternate,g!==null?(g=g.index,g<p?(x.flags|=2,p):g):(x.flags|=2,p)):(x.flags|=1048576,p)}function a(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,p,g,C){return p===null||p.tag!==6?(p=Ls(g,x.mode,C),p.return=x,p):(p=i(p,g),p.return=x,p)}function d(x,p,g,C){var h=g.type;return h===Tn?S(x,p,g.props.children,C,g.key):p!==null&&(p.elementType===h||typeof h=="object"&&h!==null&&h.$$typeof===Ft&&qu(h)===p.type)?(C=i(p,g.props),C.ref=Ir(x,p,g),C.return=x,C):(C=to(g.type,g.key,g.props,null,x.mode,C),C.ref=Ir(x,p,g),C.return=x,C)}function m(x,p,g,C){return p===null||p.tag!==4||p.stateNode.containerInfo!==g.containerInfo||p.stateNode.implementation!==g.implementation?(p=Ds(g,x.mode,C),p.return=x,p):(p=i(p,g.children||[]),p.return=x,p)}function S(x,p,g,C,h){return p===null||p.tag!==7?(p=Cn(g,x.mode,C,h),p.return=x,p):(p=i(p,g),p.return=x,p)}function E(x,p,g){if(typeof p=="string"&&p!==""||typeof p=="number")return p=Ls(""+p,x.mode,g),p.return=x,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Zr:return g=to(p.type,p.key,p.props,null,x.mode,g),g.ref=Ir(x,null,p),g.return=x,g;case On:return p=Ds(p,x.mode,g),p.return=x,p;case Ft:var C=p._init;return E(x,C(p._payload),g)}if(or(p)||rr(p))return p=Cn(p,x.mode,g,null),p.return=x,p;Mi(x,p)}return null}function y(x,p,g,C){var h=p!==null?p.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return h!==null?null:l(x,p,""+g,C);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Zr:return g.key===h?d(x,p,g,C):null;case On:return g.key===h?m(x,p,g,C):null;case Ft:return h=g._init,y(x,p,h(g._payload),C)}if(or(g)||rr(g))return h!==null?null:S(x,p,g,C,null);Mi(x,g)}return null}function R(x,p,g,C,h){if(typeof C=="string"&&C!==""||typeof C=="number")return x=x.get(g)||null,l(p,x,""+C,h);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Zr:return x=x.get(C.key===null?g:C.key)||null,d(p,x,C,h);case On:return x=x.get(C.key===null?g:C.key)||null,m(p,x,C,h);case Ft:var c=C._init;return R(x,p,g,c(C._payload),h)}if(or(C)||rr(C))return x=x.get(g)||null,S(p,x,C,h,null);Mi(p,C)}return null}function f(x,p,g,C){for(var h=null,c=null,u=p,s=p=0,w=null;u!==null&&s<g.length;s++){u.index>s?(w=u,u=null):w=u.sibling;var v=y(x,u,g[s],C);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===g.length)return n(x,u),ve&&pn(x,s),h;if(u===null){for(;s<g.length;s++)u=E(x,g[s],C),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<g.length;s++)w=R(u,x,s,g[s],C),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(k){return t(x,k)}),ve&&pn(x,s),h}function b(x,p,g,C){var h=rr(g);if(typeof h!="function")throw Error(J(150));if(g=h.call(g),g==null)throw Error(J(151));for(var c=h=null,u=p,s=p=0,w=null,v=g.next();u!==null&&!v.done;s++,v=g.next()){u.index>s?(w=u,u=null):w=u.sibling;var k=y(x,u,v.value,C);if(k===null){u===null&&(u=w);break}e&&u&&k.alternate===null&&t(x,u),p=o(k,p,s),c===null?h=k:c.sibling=k,c=k,u=w}if(v.done)return n(x,u),ve&&pn(x,s),h;if(u===null){for(;!v.done;s++,v=g.next())v=E(x,v.value,C),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=g.next())v=R(u,x,s,v.value,C),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,g,C){if(typeof g=="object"&&g!==null&&g.type===Tn&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Zr:e:{for(var h=g.key,c=p;c!==null;){if(c.key===h){if(h=g.type,h===Tn){if(c.tag===7){n(x,c.sibling),p=i(c,g.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,g.props),p.ref=Ir(x,c,g),p.return=x,x=p;break e}n(x,c);break}else t(x,c);c=c.sibling}g.type===Tn?(p=Cn(g.props.children,x.mode,C,g.key),p.return=x,x=p):(C=to(g.type,g.key,g.props,null,x.mode,C),C.ref=Ir(x,p,g),C.return=x,x=C)}return a(x);case On:e:{for(c=g.key;p!==null;){if(p.key===c)if(p.tag===4&&p.stateNode.containerInfo===g.containerInfo&&p.stateNode.implementation===g.implementation){n(x,p.sibling),p=i(p,g.children||[]),p.return=x,x=p;break e}else{n(x,p);break}else t(x,p);p=p.sibling}p=Ds(g,x.mode,C),p.return=x,x=p}return a(x);case Ft:return c=g._init,T(x,p,c(g._payload),C)}if(or(g))return f(x,p,g,C);if(rr(g))return b(x,p,g,C);Mi(x,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,p!==null&&p.tag===6?(n(x,p.sibling),p=i(p,g),p.return=x,x=p):(n(x,p),p=Ls(g,x.mode,C),p.return=x,x=p),a(x)):n(x,p)}return T}var $n=ec(!0),tc=ec(!1),Pi=Yt(null),Ni=null,Vn=null,Wa=null;function $a(){Wa=Vn=Ni=null}function Va(e){var t=Pi.current;ge(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&&(Ke=!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,m=d.next;d.next=null,a===null?o=m:a.next=m,a=d;var S=e.alternate;S!==null&&(S=S.updateQueue,l=S.lastBaseUpdate,l!==a&&(l===null?S.firstBaseUpdate=m:l.next=m,S.lastBaseUpdate=d))}if(o!==null){var E=i.baseState;a=0,S=m=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,b=l;switch(y=t,R=n,b.tag){case 1:if(f=b.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=b.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?(m=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=m,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={},bt=Yt(Mr),Pr=Yt(Mr),Nr=Yt(Mr);function mn(e){if(e===Mr)throw Error(J(174));return e}function Xa(e,t){switch(de(Nr,t),de(Pr,e),de(bt,Mr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Yo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Yo(t,e)}ge(bt),de(bt,t)}function Kn(){ge(bt),ge(Pr),ge(Nr)}function ac(e){mn(Nr.current);var t=mn(bt.current),n=Yo(t,e.type);t!==n&&(de(Pr,e),de(bt,n))}function Ya(e){Pr.current===e&&(ge(bt),ge(Pr))}var xe=Yt(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,m=o;do{var S=m.lane;if((vn&S)===S)d!==null&&(d=d.next={lane:0,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null}),r=m.hasEagerState?m.eagerState:e(r,m.action);else{var E={lane:S,action:m.action,hasEagerState:m.hasEagerState,eagerState:m.eagerState,next:null};d===null?(l=d=E,a=r):d=d.next=E,Se.lanes|=S,yn|=S}m=m.next}while(m!==null&&m!==o);d===null?a=r:d.next=l,ht(r,t.memoizedState)||(Ke=!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)||(Ke=!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,Ke=!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 Cc(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 bc(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,Ke=!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(m){}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:Cc,useReducer:is,useRef:gc,useState:function(){return is(jr)},useDebugValue:ss,useDeferredValue:function(e){var t=ut();return bc(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:Cc,useReducer:os,useRef:gc,useState:function(){return os(jr)},useDebugValue:ss,useDeferredValue:function(e){var t=ut();return Oe===null?t.memoizedState=e:bc(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?!br(n,r)||!br(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=Qe(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=Qe(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
31
|
Error generating stack: `+o.message+`
|
|
32
|
-
`+o.stack}return{value:e,source:t,stack:i,digest:null}}function us(e,t,n){return{value:e,source:null,stack:n!=null?n:null,digest:t!=null?t:null}}function cs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ap=typeof WeakMap=="function"?WeakMap:Map;function Ic(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,Rs=r),cs(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 i=t.value;n.payload=function(){return r(i)},n.callback=function(){cs(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){cs(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 Pc(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 Nc(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 Lc(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,Ke=!1;function Fe(e,t,n,r){t.child=e===null?ec(t,null,n,r):$n(t,e.child,n,r)}function Dc(e,t,n,r,i){n=n.render;var o=t.ref;return Qn(t,i),r=ts(e,t,n,r,o,i),n=ns(),e!==null&&!Ke?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,jt(e,t,i)):(ve&&n&&Ba(t),t.flags|=1,Fe(e,t,r,i),t.child)}function jc(e,t,n,r,i){if(e===null){var o=n.type;return typeof o=="function"&&!Ps(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Uc(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:br,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 Uc(e,t,n,r,i){if(e!==null){var o=e.memoizedProps;if(br(o,r)&&e.ref===t.ref)if(Ke=!1,t.pendingProps=r=o,(e.lanes&i)!==0)e.flags&131072&&(Ke=!0);else return t.lanes=e.lanes,jt(e,t,i)}return fs(e,t,n,r,i)}function Bc(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},de(Yn,rt),rt|=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,de(Yn,rt),rt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,de(Yn,rt),rt|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,de(Yn,rt),rt|=r;return Fe(e,t,i,n),t.child}function _c(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function fs(e,t,n,r,i){var o=Qe(n)?dn:je.current;return o=Hn(t,o),Qn(t,i),n=ts(e,t,n,r,o,i),r=ns(),e!==null&&!Ke?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,jt(e,t,i)):(ve&&r&&Ba(t),t.flags|=1,Fe(e,t,n,i),t.child)}function zc(e,t,n,r,i){if(Qe(n)){var o=!0;Ei(t)}else o=!1;if(Qn(t,i),t.stateNode===null)Wi(e,t),Tc(t,n,r),ls(t,n,r,i),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var h=a.context,m=n.contextType;typeof m=="object"&&m!==null?m=lt(m):(m=Qe(n)?dn:je.current,m=Hn(t,m));var S=n.getDerivedStateFromProps,E=typeof S=="function"||typeof a.getSnapshotBeforeUpdate=="function";E||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||h!==m)&&Ac(t,a,r,m),en=!1;var y=t.memoizedState;a.state=y,Di(t,r,a,i),h=t.memoizedState,l!==r||y!==h||Ve.current||en?(typeof S=="function"&&(ss(t,n,S,r),h=t.memoizedState),(l=en||Oc(t,n,l,r,y,h,m))?(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=h),a.props=r,a.state=h,a.context=m,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,nc(e,t),l=t.memoizedProps,m=t.type===t.elementType?l:gt(t.type,l),a.props=m,E=t.pendingProps,y=a.context,h=n.contextType,typeof h=="object"&&h!==null?h=lt(h):(h=Qe(n)?dn:je.current,h=Hn(t,h));var R=n.getDerivedStateFromProps;(S=typeof R=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==E||y!==h)&&Ac(t,a,r,h),en=!1,y=t.memoizedState,a.state=y,Di(t,r,a,i);var f=t.memoizedState;l!==E||y!==f||Ve.current||en?(typeof R=="function"&&(ss(t,n,R,r),f=t.memoizedState),(m=en||Oc(t,n,m,r,y,f,h)||!1)?(S||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,f,h),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,f,h)),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=h,r=m):(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 ds(e,t,n,r,o,i)}function ds(e,t,n,r,i,o){_c(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return i&&$u(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&&$u(t,n,!0),t.child}function Hc(e){var t=e.stateNode;t.pendingContext?Gu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Gu(e,t.context,!1),Ja(e,t.containerInfo)}function Fc(e,t,n,r,i){return Wn(),Fa(i),t.flags|=256,Fe(e,t,n,r),t.child}var hs={dehydrated:null,treeContext:null,retryLane:0};function ps(e){return{baseLanes:e,cachePool:null,transitions:null}}function Gc(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),de(xe,i&1),e===null)return Ha(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=Cn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=ps(n),t.memoizedState=hs,e):gs(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 h={mode:"hidden",children:r.children};return!(a&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=h,t.deletions=null):(r=ln(i,h),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?o=ln(l,o):(o=Cn(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?ps(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=hs,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 gs(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&&Fa(r),$n(t,e.child,null,n),e=gs(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=us(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=Cn(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=ps(a),t.memoizedState=hs,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=us(o,r,void 0),Gi(e,t,a,r)}if(l=(a&e.childLanes)!==0,Ke||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 Ms(),r=us(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,nt=Xt(i.nextSibling),tt=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=gs(t,r.children),t.flags|=4096,t)}function Wc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Va(e.return,t,n)}function ms(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 $c(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&&Wc(e,n,t);else if(e.tag===19)Wc(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(de(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),ms(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}ms(t,!0,n,null,o);break;case"together":ms(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:Hc(t),Wn();break;case 5:oc(t);break;case 1:Qe(t.type)&&Ei(t);break;case 4:Ja(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;de(Pi,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(de(xe,xe.current&1),t.flags|=128,null):n&t.child.childLanes?Gc(e,t,n):(de(xe,xe.current&1),e=jt(e,t,n),e!==null?e.sibling:null);de(xe,xe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $c(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),de(xe,xe.current),r)break;return null;case 22:case 23:return t.lanes=0,Bc(e,t,n)}return jt(e,t,n)}var Vc,vs,Qc,Kc;Vc=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}},vs=function(){},Qc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,mn(bt.current);var o=null;switch(n){case"input":i=Vo(e,i),r=Vo(e,r),o=[];break;case"select":i=we({},i,{value:void 0}),r=we({},r,{value:void 0}),o=[];break;case"textarea":i=Jo(e,i),r=Jo(e,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=bi)}Yo(n,r);var a;n=null;for(m in i)if(!r.hasOwnProperty(m)&&i.hasOwnProperty(m)&&i[m]!=null)if(m==="style"){var l=i[m];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else m!=="dangerouslySetInnerHTML"&&m!=="children"&&m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(nr.hasOwnProperty(m)?o||(o=[]):(o=o||[]).push(m,null));for(m in r){var h=r[m];if(l=i!=null?i[m]:void 0,r.hasOwnProperty(m)&&h!==l&&(h!=null||l!=null))if(m==="style")if(l){for(a in l)!l.hasOwnProperty(a)||h&&h.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in h)h.hasOwnProperty(a)&&l[a]!==h[a]&&(n||(n={}),n[a]=h[a])}else n||(o||(o=[]),o.push(m,n)),n=h;else m==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,l=l?l.__html:void 0,h!=null&&l!==h&&(o=o||[]).push(m,h)):m==="children"?typeof h!="string"&&typeof h!="number"||(o=o||[]).push(m,""+h):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&(nr.hasOwnProperty(m)?(h!=null&&m==="onScroll"&&pe("scroll",e),o||l===h||(o=[])):(o=o||[]).push(m,h))}n&&(o=o||[]).push("style",n);var m=o;(t.updateQueue=m)&&(t.flags|=4)}},Kc=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(_a(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 Qe(t.type)&&Ri(),Be(t),null;case 3:return r=t.stateNode,Kn(),ge(Ve),ge(je),Za(),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&&(Ts(pt),pt=null))),vs(e,t),Be(t),null;case 5:Xa(t);var i=mn(Nr.current);if(n=t.type,e!==null&&t.stateNode!=null)Qc(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(bt.current),Ii(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Ct]=t,r[Tr]=o,e=(t.mode&1)!==0,n){case"dialog":pe("cancel",r),pe("close",r);break;case"iframe":case"object":case"embed":pe("load",r);break;case"video":case"audio":for(i=0;i<Rr.length;i++)pe(Rr[i],r);break;case"source":pe("error",r);break;case"img":case"image":case"link":pe("error",r),pe("load",r);break;case"details":pe("toggle",r);break;case"input":Tl(r,o),pe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},pe("invalid",r);break;case"textarea":Ml(r,o),pe("invalid",r)}Yo(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&&Ci(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Ci(r.textContent,l,e),i=["children",""+l]):nr.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&pe("scroll",r)}switch(n){case"input":qr(r),Il(r,o,!0);break;case"textarea":qr(r),Nl(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=bi)}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=Ll(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[Ct]=t,e[Tr]=r,Vc(e,t,!1,!1),t.stateNode=e;e:{switch(a=Zo(n,r),n){case"dialog":pe("cancel",e),pe("close",e),i=r;break;case"iframe":case"object":case"embed":pe("load",e),i=r;break;case"video":case"audio":for(i=0;i<Rr.length;i++)pe(Rr[i],e);i=r;break;case"source":pe("error",e),i=r;break;case"img":case"image":case"link":pe("error",e),pe("load",e),i=r;break;case"details":pe("toggle",e),i=r;break;case"input":Tl(e,r),i=Vo(e,r),pe("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=we({},r,{value:void 0}),pe("invalid",e);break;case"textarea":Ml(e,r),i=Jo(e,r),pe("invalid",e);break;default:i=r}Yo(n,i),l=i;for(o in l)if(l.hasOwnProperty(o)){var h=l[o];o==="style"?Ul(e,h):o==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,h!=null&&Dl(e,h)):o==="children"?typeof h=="string"?(n!=="textarea"||h!=="")&&ar(e,h):typeof h=="number"&&ar(e,""+h):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(nr.hasOwnProperty(o)?h!=null&&o==="onScroll"&&pe("scroll",e):h!=null&&Do(e,o,h,a))}switch(n){case"input":qr(e),Il(e,r,!1);break;case"textarea":qr(e),Nl(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=bi)}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)Kc(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(J(166));if(n=mn(Nr.current),mn(bt.current),Ii(t)){if(r=t.stateNode,n=t.memoizedProps,r[Ct]=t,(o=r.nodeValue!==n)&&(e=tt,e!==null))switch(e.tag){case 3:Ci(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ci(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ct]=t,t.stateNode=r}return Be(t),null;case 13:if(ge(xe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ve&&nt!==null&&t.mode&1&&!(t.flags&128))Yu(),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[Ct]=t}else Wn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Be(t),o=!1}else pt!==null&&(Ts(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):Ms())),t.updateQueue!==null&&(t.flags|=4),Be(t),null);case 4:return Kn(),vs(e,t),e===null&&Er(t.stateNode.containerInfo),Be(t),null;case 10:return $a(t.type._context),Be(t),null;case 17:return Qe(t.type)&&Ri(),Be(t),null;case 19:if(ge(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 de(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,de(xe,r?n&1|2:n&1),t):(Be(t),null);case 22:case 23:return Is(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?rt&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(_a(t),t.tag){case 1:return Qe(t.type)&&Ri(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(),ge(Ve),ge(je),Za(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xa(t),null;case 13:if(ge(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 ge(xe),null;case 4:return Kn(),null;case 10:return $a(t.type._context),null;case 22:case 23:return Is(),null;case 24:return null;default:return null}}var $i=!1,_e=!1,dp=typeof WeakSet=="function"?WeakSet:Set,q=null;function Xn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ce(e,t,r)}else n.current=null}function ys(e,t,n){try{n()}catch(r){Ce(e,t,r)}}var Jc=!1;function hp(e,t){if(Ia=fi,e=Ou(),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(C){n=null;break e}var a=0,l=-1,h=-1,m=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||(h=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&&++m===i&&(l=a),y===o&&++S===r&&(h=a),(R=E.nextSibling)!==null)break;E=y,y=E.parentNode}E=R}n=l===-1||h===-1?null:{start:l,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ma={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 b=f.memoizedProps,T=f.memoizedState,x=t.stateNode,p=x.getSnapshotBeforeUpdate(t.elementType===t.type?b:gt(t.type,b),T);x.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(C){Ce(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return f=Jc,Jc=!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&&ys(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 ws(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[Ct],delete t[Tr],delete t[Da],delete t[Jh],delete t[Xh])),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 Yc(e){return e.tag===5||e.tag===3||e.tag===4}function Zc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(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 xs(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=bi));else if(r!==4&&(e=e.child,e!==null))for(xs(e,t,n),e=e.sibling;e!==null;)xs(e,t,n),e=e.sibling}function Ss(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(Ss(e,t,n),e=e.sibling;e!==null;)Ss(e,t,n),e=e.sibling}var Ne=null,mt=!1;function nn(e,t,n){for(n=n.child;n!==null;)qc(e,t,n),n=n.sibling}function qc(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(oi,n)}catch(l){}switch(n.tag){case 5:_e||Xn(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?La(e.parentNode,n):e.nodeType===1&&La(e,n),vr(e)):La(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)&&ys(n,t,a),i=i.next}while(i!==r)}nn(e,t,n);break;case 1:if(!_e&&(Xn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Ce(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 ef(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=Cp.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));qc(o,a,i),Ne=null,mt=!1;var h=i.alternate;h!==null&&(h.return=null),i.return=null}catch(m){Ce(i,t,m)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)tf(t,e),t=t.sibling}function tf(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(b){Ce(e,e.return,b)}try{_r(5,e,e.return)}catch(b){Ce(e,e.return,b)}}break;case 1:vt(t,e),Rt(e),r&512&&n!==null&&Xn(n,n.return);break;case 5:if(vt(t,e),Rt(e),r&512&&n!==null&&Xn(n,n.return),e.flags&32){var i=e.stateNode;try{ar(i,"")}catch(b){Ce(e,e.return,b)}}if(r&4&&(i=e.stateNode,i!=null)){var o=e.memoizedProps,a=n!==null?n.memoizedProps:o,l=e.type,h=e.updateQueue;if(e.updateQueue=null,h!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&Al(i,o),Zo(l,a);var m=Zo(l,o);for(a=0;a<h.length;a+=2){var S=h[a],E=h[a+1];S==="style"?Ul(i,E):S==="dangerouslySetInnerHTML"?Dl(i,E):S==="children"?ar(i,E):Do(i,S,E,m)}switch(l){case"input":Qo(i,o);break;case"textarea":Pl(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(b){Ce(e,e.return,b)}}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(b){Ce(e,e.return,b)}}break;case 3:if(vt(t,e),Rt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{vr(t.containerInfo)}catch(b){Ce(e,e.return,b)}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||(ks=ke())),r&4&&ef(e);break;case 22:if(S=n!==null&&n.memoizedState!==null,e.mode&1?(_e=(m=_e)||S,vt(t,e),_e=m):vt(t,e),Rt(e),r&8192){if(m=e.memoizedState!==null,(e.stateNode.isHidden=m)&&!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:Xn(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(b){Ce(r,n,b)}}break;case 5:Xn(y,y.return);break;case 22:if(y.memoizedState!==null){of(E);continue}}R!==null?(R.return=y,q=R):of(E)}S=S.sibling}e:for(S=null,E=e;;){if(E.tag===5){if(S===null){S=E;try{i=E.stateNode,m?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=E.stateNode,h=E.memoizedProps.style,a=h!=null&&h.hasOwnProperty("display")?h.display:null,l.style.display=jl("display",a))}catch(b){Ce(e,e.return,b)}}}else if(E.tag===6){if(S===null)try{E.stateNode.nodeValue=m?"":E.memoizedProps}catch(b){Ce(e,e.return,b)}}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&&ef(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(Yc(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=Zc(e);Ss(e,o,i);break;case 3:case 4:var a=r.stateNode.containerInfo,l=Zc(e);xs(e,l,a);break;default:throw Error(J(161))}}catch(h){Ce(e,e.return,h)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pp(e,t,n){q=e,nf(e)}function nf(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,h=l!==null&&l.memoizedState!==null||_e;l=$i;var m=_e;if($i=a,(_e=h)&&!m)for(q=i;q!==null;)a=q,h=a.child,a.tag===22&&a.memoizedState!==null?af(i):h!==null?(h.return=a,q=h):af(i);for(;o!==null;)q=o,nf(o),o=o.sibling;q=i,$i=l,_e=m}rf(e)}else i.subtreeFlags&8772&&o!==null?(o.return=i,q=o):rf(e)}}function rf(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&&ic(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}ic(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var h=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":h.autoFocus&&n.focus();break;case"img":h.src&&(n.src=h.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var m=t.alternate;if(m!==null){var S=m.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&&ws(t)}catch(y){Ce(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 of(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 af(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(h){Ce(t,n,h)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(h){Ce(t,i,h)}}var o=t.return;try{ws(t)}catch(h){Ce(t,o,h)}break;case 5:var a=t.return;try{ws(t)}catch(h){Ce(t,a,h)}}}catch(h){Ce(t,t.return,h)}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,rt=0,Yn=Yt(0),Te=0,zr=null,yn=0,Ki=0,bs=0,Hr=null,Je=null,ks=0,Zn=1/0,Ut=null,Ji=!1,Rs=null,rn=null,Xi=!1,on=null,Yi=0,Fr=0,Es=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=Zl()),qi):(e=ue,e!==0||(e=window.event,e=e===void 0?16:su(e.type)),e):1}function yt(e,t,n,r){if(50<Fr)throw Fr=0,Es=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&&Jl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Jl(n),t===1)e.tag===0?Yh(lf.bind(null,e)):Vu(lf.bind(null,e)),Qh(function(){!(ae&6)&&qt()}),n=null;else{switch(ql(r)){case 1:n=oa;break;case 4:n=Xl;break;case 16:n=ii;break;case 536870912:n=Yl;break;default:n=ii}n=mf(n,sf.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function sf(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=cf();(Me!==e||Le!==t)&&(Ut=null,Zn=ke()+500,xn(e,t));do try{yp();break}catch(l){uf(e,l)}while(!0);Wa(),Qi.current=o,ae=i,Ee!==null?t=0:(Me=null,Le=0,t=Te)}if(t!==0){if(t===2&&(i=aa(e),i!==0&&(r=i,t=Os(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=aa(e),o!==0&&(r=o,t=Os(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,Je,Ut);break;case 3:if(sn(e,r),(r&130023424)===r&&(t=ks+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=Na(Sn.bind(null,e,Je,Ut),t);break}Sn(e,Je,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=Na(Sn.bind(null,e,Je,Ut),r);break}Sn(e,Je,Ut);break;case 5:Sn(e,Je,Ut);break;default:throw Error(J(329))}}}return Xe(e,ke()),e.callbackNode===n?sf.bind(null,e):null}function Os(e,t){var n=Hr;return e.current.memoizedState.isDehydrated&&(xn(e,t).flags|=256),e=eo(e,t),e!==2&&(t=Je,Je=n,t!==null&&Ts(t)),e}function Ts(e){Je===null?Je=e:Je.push.apply(Je,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&=~bs,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 lf(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=aa(e);r!==0&&(t=r,n=Os(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,Je,Ut),Xe(e,ke()),null}function As(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 Is(){rt=Yn.current,ge(Yn)}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(_a(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ri();break;case 3:Kn(),ge(Ve),ge(je),Za();break;case 5:Xa(r);break;case 4:Kn();break;case 13:ge(xe);break;case 19:ge(xe);break;case 10:$a(r.type._context);break;case 22:case 23:Is()}n=n.return}if(Me=e,Ee=e=ln(e.current,null),Le=rt=t,Te=0,zr=null,bs=Ki=yn=0,Je=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 uf(e,t){do{var n=Ee;try{if(Wa(),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,h=t;if(t=Le,l.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){var m=h,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=Nc(a);if(R!==null){R.flags&=-257,Lc(R,a,l,o,t),R.mode&1&&Pc(o,m,t),t=R,h=m;var f=t.updateQueue;if(f===null){var b=new Set;b.add(h),t.updateQueue=b}else f.add(h);break e}else{if(!(t&1)){Pc(o,m,t),Ms();break e}h=Error(J(426))}}else if(ve&&l.mode&1){var T=Nc(a);if(T!==null){!(T.flags&65536)&&(T.flags|=256),Lc(T,a,l,o,t),Fa(Jn(h,l));break e}}o=h=Jn(h,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=Ic(o,h,t);rc(o,x);break e;case 1:l=h;var p=o.type,g=o.stateNode;if(!(o.flags&128)&&(typeof p.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(rn===null||!rn.has(g)))){o.flags|=65536,t&=-t,o.lanes|=t;var C=Mc(o,l,t);rc(o,C);break e}}o=o.return}while(o!==null)}df(n)}catch(d){t=d,Ee===n&&n!==null&&(Ee=n=n.return);continue}break}while(!0)}function cf(){var e=Qi.current;return Qi.current=Hi,e===null?Hi:e}function Ms(){(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=cf();(Me!==e||Le!==t)&&(Ut=null,xn(e,t));do try{vp();break}catch(i){uf(e,i)}while(!0);if(Wa(),ae=n,Qi.current=r,Ee!==null)throw Error(J(261));return Me=null,Le=0,Te}function vp(){for(;Ee!==null;)ff(Ee)}function yp(){for(;Ee!==null&&!Gd();)ff(Ee)}function ff(e){var t=gf(e.alternate,e,rt);e.memoizedProps=e.pendingProps,t===null?df(e):Ee=t,Cs.current=null}function df(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,rt),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)||Xi||(Xi=!0,mf(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),tf(n,e),_h(Ma),fi=!!Ia,Ma=Ia=null,e.current=n,pp(n),Wd(),ae=l,ue=a,ct.transition=o}else e.current=n;if(Xi&&(Xi=!1,on=e,Yi=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=Rs,Rs=null,e;return Yi&1&&e.tag!==0&&qn(),o=e.pendingLanes,o&1?e===Es?Fr++:(Fr=0,Es=e):Fr=0,qt(),null}function qn(){if(on!==null){var e=ql(Yi),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,Yi=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 h=0;h<l.length;h++){var m=l[h];for(q=m;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===m){q=null;break}if(y!==null){y.return=R,q=y;break}q=R}}}var f=o.alternate;if(f!==null){var b=f.child;if(b!==null){f.child=null;do{var T=b.sibling;b.sibling=null,b=T}while(b!==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 g=a.child;if(a.subtreeFlags&2064&&g!==null)g.return=a,q=g;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(d){Ce(l,l.return,d)}if(l===a){q=null;break e}var C=l.sibling;if(C!==null){C.return=l.return,q=C;break e}q=l.return}}if(ae=i,qt(),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(oi,e)}catch(d){}r=!0}return r}finally{ue=n,ct.transition=t}}return!1}function hf(e,t,n){t=Jn(n,t),t=Ic(e,t,1),e=tn(e,t,1),t=Ge(),e!==null&&(dr(e,1,t),Xe(e,t))}function Ce(e,t,n){if(e.tag===3)hf(e,e,n);else for(;t!==null;){if(t.tag===3){hf(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,Me===e&&(Le&n)===n&&(Te===4||Te===3&&(Le&130023424)===Le&&500>ke()-ks?xn(e,0):bs|=n),Xe(e,t)}function pf(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),pf(e,n)}function Cp(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),pf(e,n)}var gf;gf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ve.current)Ke=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ke=!1,up(e,t,n);Ke=!!(e.flags&131072)}else Ke=!1,ve&&t.flags&1048576&&Qu(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=ts(null,t,r,e,i,n);var o=ns();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,Qe(r)?(o=!0,Ei(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ka(t),i.updater=Fi,t.stateNode=i,i._reactInternals=t,ls(t,r,e,n),t=ds(null,t,r,!0,o,n)):(t.tag=0,ve&&o&&Ba(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=fs(null,t,r,e,n);break e;case 1:t=zc(null,t,r,e,n);break e;case 11:t=Dc(null,t,r,e,n);break e;case 14:t=jc(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),fs(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gt(r,i),zc(e,t,r,i,n);case 3:e:{if(Hc(t),e===null)throw Error(J(387));r=t.pendingProps,o=t.memoizedState,i=o.element,nc(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=Fc(e,t,r,n,i);break e}else if(r!==i){i=Jn(Error(J(424)),t),t=Fc(e,t,r,n,i);break e}else for(nt=Xt(t.stateNode.containerInfo.firstChild),tt=t,ve=!0,pt=null,n=ec(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 oc(t),e===null&&Ha(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,Pa(r,i)?a=null:o!==null&&Pa(r,o)&&(t.flags|=32),_c(e,t),Fe(e,t,a,n),t.child;case 6:return e===null&&Ha(t),null;case 13:return Gc(e,t,n);case 4:return Ja(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),Dc(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,de(Pi,r._currentValue),r._currentValue=a,o!==null)if(ht(o.value,a)){if(o.children===i.children&&!Ve.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 h=l.firstContext;h!==null;){if(h.context===r){if(o.tag===1){h=Dt(-1,n&-n),h.tag=2;var m=o.updateQueue;if(m!==null){m=m.shared;var S=m.pending;S===null?h.next=h:(h.next=S.next,S.next=h),m.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),Va(o.return,n,t),l.lanes|=n;break}h=h.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),Va(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),jc(e,t,r,i,n);case 15:return Uc(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,Qe(r)?(e=!0,Ei(t)):e=!1,Qn(t,n),Tc(t,r,i),ls(t,r,i,n),ds(null,t,r,!0,e,n);case 19:return $c(e,t,n);case 22:return Bc(e,t,n)}throw Error(J(156,t.tag))};function mf(e,t){return Kl(e,t)}function bp(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 bp(e,t,n,r)}function Ps(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kp(e){if(typeof e=="function")return Ps(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Bo)return 11;if(e===Ho)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")Ps(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Tn:return Cn(n.children,i,o,t);case jo:a=8,i|=8;break;case Uo:return e=ft(12,n,t,i|2),e.elementType=Uo,e.lanes=o,e;case _o:return e=ft(13,n,t,i),e.elementType=_o,e.lanes=o,e;case zo:return e=ft(19,n,t,i),e.elementType=zo,e.lanes=o,e;case kl:return no(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Cl:a=10;break e;case bl:a=9;break e;case Bo:a=11;break e;case Ho: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 Cn(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=kl,e.lanes=n,e.stateNode={isHidden:!1},e}function Ns(e,t,n){return e=ft(6,e,null,t),e.lanes=n,e}function Ls(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=sa(0),this.expirationTimes=sa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sa(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ds(e,t,n,r,i,o,a,l,h){return e=new Rp(e,t,n,l,h),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},Ka(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 vf(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(Qe(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(Qe(n))return Wu(e,n,t)}return t}function yf(e,t,n,r,i,o,a,l,h){return e=Ds(n,r,!0,e,i,o,a,l,h),e.context=vf(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=vf(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 wf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function js(e,t){wf(e,t),(e=e.alternate)&&wf(e,t)}function Op(){return null}var xf=typeof reportError=="function"?reportError:function(e){console.error(e)};function Us(e){this._internalRoot=e}oo.prototype.render=Us.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(J(409));ro(e,t,null,null)},oo.prototype.unmount=Us.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=nu();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&&ou(e)}};function Bs(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 Sf(){}function Tp(e,t,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var m=io(a);o.call(m)}}var a=yf(t,r,e,0,null,!1,!1,"",Sf);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 m=io(h);l.call(m)}}var h=Ds(e,0,!1,null,null,!1,!1,"",Sf);return e._reactRootContainer=h,e[It]=h.current,Er(e.nodeType===8?e.parentNode:e),wn(function(){ro(t,h,n,r)}),h}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 h=io(a);l.call(h)}}ro(t,a,e,i)}else a=Tp(n,t,e,i,r);return io(a)}eu=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=fr(t.pendingLanes);n!==0&&(la(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)}}),js(e,1)}},ua=function(e){if(e.tag===13){var t=Lt(e,134217728);if(t!==null){var n=Ge();yt(t,e,134217728,n)}js(e,134217728)}},tu=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)}js(e,t)}},nu=function(){return ue},ru=function(e,t){var n=ue;try{return ue=e,t()}finally{ue=n}},ta=function(e,t,n){switch(t){case"input":if(Qo(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));Ol(r),Qo(r,i)}}}break;case"textarea":Pl(e,n);break;case"select":t=n.value,t!=null&&An(e,!!n.multiple,t,!1)}},Hl=As,Fl=wn;var Ap={usingClientEntryPoint:!1,Events:[Ar,_n,ki,_l,zl,As]},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=Vl(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){}}Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ap,Ze.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bs(t))throw Error(J(200));return Ep(e,t,null,n)},Ze.createRoot=function(e,t){if(!Bs(e))throw Error(J(299));var n=!1,r="",i=xf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Ds(e,1,!1,null,null,n,!1,r,i),e[It]=t.current,Er(e.nodeType===8?e.parentNode:e),new Us(t)},Ze.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=Vl(t),e=e===null?null:e.stateNode,e},Ze.flushSync=function(e){return wn(e)},Ze.hydrate=function(e,t,n){if(!ao(t))throw Error(J(200));return so(null,e,t,!0,n)},Ze.hydrateRoot=function(e,t,n){if(!Bs(e))throw Error(J(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",a=xf;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=yf(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)},Ze.render=function(e,t,n){if(!ao(t))throw Error(J(200));return so(null,e,t,!1,n)},Ze.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},Ze.unstable_batchedUpdates=As,Ze.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)},Ze.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(),ml.exports=Ze;var Mp=ml.exports,_s,bf=Mp;_s=bf.createRoot,bf.hydrateRoot;var kf={exports:{}},uo={};/**
|
|
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,Ke=!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&&!Ke?(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:br,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(br(o,r)&&e.ref===t.ref)if(Ke=!1,t.pendingProps=r=o,(e.lanes&i)!==0)e.flags&131072&&(Ke=!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},de(Yn,rt),rt|=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,de(Yn,rt),rt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,de(Yn,rt),rt|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,de(Yn,rt),rt|=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=Qe(n)?dn:je.current;return o=Hn(t,o),Qn(t,i),n=ns(e,t,n,r,o,i),r=rs(),e!==null&&!Ke?(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(Qe(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,m=n.contextType;typeof m=="object"&&m!==null?m=lt(m):(m=Qe(n)?dn:je.current,m=Hn(t,m));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!==m)&&Ic(t,a,r,m),en=!1;var y=t.memoizedState;a.state=y,Di(t,r,a,i),d=t.memoizedState,l!==r||y!==d||Ve.current||en?(typeof S=="function"&&(ls(t,n,S,r),d=t.memoizedState),(l=en||Tc(t,n,l,r,y,d,m))?(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=m,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,rc(e,t),l=t.memoizedProps,m=t.type===t.elementType?l:gt(t.type,l),a.props=m,E=t.pendingProps,y=a.context,d=n.contextType,typeof d=="object"&&d!==null?d=lt(d):(d=Qe(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||Ve.current||en?(typeof R=="function"&&(ls(t,n,R,r),f=t.memoizedState),(m=en||Tc(t,n,m,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=m):(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),Xa(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),de(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=Cn(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=Cn(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=Cn(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,Ke||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,nt=Xt(i.nextSibling),tt=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(de(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:Qe(t.type)&&Ei(t);break;case 4:Xa(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;de(Pi,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(de(xe,xe.current&1),t.flags|=128,null):n&t.child.childLanes?Wc(e,t,n):(de(xe,xe.current&1),e=jt(e,t,n),e!==null?e.sibling:null);de(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),de(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(bt.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=Xo(e,i),r=Xo(e,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=bi)}Zo(n,r);var a;n=null;for(m in i)if(!r.hasOwnProperty(m)&&i.hasOwnProperty(m)&&i[m]!=null)if(m==="style"){var l=i[m];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else m!=="dangerouslySetInnerHTML"&&m!=="children"&&m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(nr.hasOwnProperty(m)?o||(o=[]):(o=o||[]).push(m,null));for(m in r){var d=r[m];if(l=i!=null?i[m]:void 0,r.hasOwnProperty(m)&&d!==l&&(d!=null||l!=null))if(m==="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(m,n)),n=d;else m==="dangerouslySetInnerHTML"?(d=d?d.__html:void 0,l=l?l.__html:void 0,d!=null&&l!==d&&(o=o||[]).push(m,d)):m==="children"?typeof d!="string"&&typeof d!="number"||(o=o||[]).push(m,""+d):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&(nr.hasOwnProperty(m)?(d!=null&&m==="onScroll"&&pe("scroll",e),o||l===d||(o=[])):(o=o||[]).push(m,d))}n&&(o=o||[]).push("style",n);var m=o;(t.updateQueue=m)&&(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 Qe(t.type)&&Ri(),Be(t),null;case 3:return r=t.stateNode,Kn(),ge(Ve),ge(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:Ya(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(bt.current),Ii(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Ct]=t,r[Tr]=o,e=(t.mode&1)!==0,n){case"dialog":pe("cancel",r),pe("close",r);break;case"iframe":case"object":case"embed":pe("load",r);break;case"video":case"audio":for(i=0;i<Rr.length;i++)pe(Rr[i],r);break;case"source":pe("error",r);break;case"img":case"image":case"link":pe("error",r),pe("load",r);break;case"details":pe("toggle",r);break;case"input":Al(r,o),pe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},pe("invalid",r);break;case"textarea":Pl(r,o),pe("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&&Ci(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Ci(r.textContent,l,e),i=["children",""+l]):nr.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&pe("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=bi)}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[Ct]=t,e[Tr]=r,Qc(e,t,!1,!1),t.stateNode=e;e:{switch(a=qo(n,r),n){case"dialog":pe("cancel",e),pe("close",e),i=r;break;case"iframe":case"object":case"embed":pe("load",e),i=r;break;case"video":case"audio":for(i=0;i<Rr.length;i++)pe(Rr[i],e);i=r;break;case"source":pe("error",e),i=r;break;case"img":case"image":case"link":pe("error",e),pe("load",e),i=r;break;case"details":pe("toggle",e),i=r;break;case"input":Al(e,r),i=Qo(e,r),pe("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=we({},r,{value:void 0}),pe("invalid",e);break;case"textarea":Pl(e,r),i=Xo(e,r),pe("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"&&pe("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=bi)}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(bt.current),Ii(t)){if(r=t.stateNode,n=t.memoizedProps,r[Ct]=t,(o=r.nodeValue!==n)&&(e=tt,e!==null))switch(e.tag){case 3:Ci(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ci(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ct]=t,t.stateNode=r}return Be(t),null;case 13:if(ge(xe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ve&&nt!==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[Ct]=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 Qe(t.type)&&Ri(),Be(t),null;case 19:if(ge(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 de(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,de(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?rt&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 Qe(t.type)&&Ri(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(),ge(Ve),ge(je),qa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ya(t),null;case 13:if(ge(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 ge(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 Xn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ce(e,t,r)}else n.current=null}function ws(e,t,n){try{n()}catch(r){Ce(e,t,r)}}var Xc=!1;function hp(e,t){if(Ma=fi,e=Tu(),ba(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(C){n=null;break e}var a=0,l=-1,d=-1,m=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&&++m===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 b=f.memoizedProps,T=f.memoizedState,x=t.stateNode,p=x.getSnapshotBeforeUpdate(t.elementType===t.type?b:gt(t.type,b),T);x.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(C){Ce(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return f=Xc,Xc=!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 Yc(e){var t=e.alternate;t!==null&&(e.alternate=null,Yc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ct],delete t[Tr],delete t[ja],delete t[Jh],delete t[Xh])),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=bi));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 Cs(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(Cs(e,t,n),e=e.sibling;e!==null;)Cs(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||Xn(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&&(Xn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Ce(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=Cp.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(m){Ce(i,t,m)}}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(b){Ce(e,e.return,b)}try{_r(5,e,e.return)}catch(b){Ce(e,e.return,b)}}break;case 1:vt(t,e),Rt(e),r&512&&n!==null&&Xn(n,n.return);break;case 5:if(vt(t,e),Rt(e),r&512&&n!==null&&Xn(n,n.return),e.flags&32){var i=e.stateNode;try{ar(i,"")}catch(b){Ce(e,e.return,b)}}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 m=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,m)}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(b){Ce(e,e.return,b)}}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(b){Ce(e,e.return,b)}}break;case 3:if(vt(t,e),Rt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{vr(t.containerInfo)}catch(b){Ce(e,e.return,b)}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=(m=_e)||S,vt(t,e),_e=m):vt(t,e),Rt(e),r&8192){if(m=e.memoizedState!==null,(e.stateNode.isHidden=m)&&!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:Xn(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(b){Ce(r,n,b)}}break;case 5:Xn(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,m?(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(b){Ce(e,e.return,b)}}}else if(E.tag===6){if(S===null)try{E.stateNode.nodeValue=m?"":E.memoizedProps}catch(b){Ce(e,e.return,b)}}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);Cs(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){Ce(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 m=_e;if($i=a,(_e=d)&&!m)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=m}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 m=t.alternate;if(m!==null){var S=m.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){Ce(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){Ce(t,n,d)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(d){Ce(t,i,d)}}var o=t.return;try{xs(t)}catch(d){Ce(t,o,d)}break;case 5:var a=t.return;try{xs(t)}catch(d){Ce(t,a,d)}}}catch(d){Ce(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,bs=At.ReactCurrentOwner,ct=At.ReactCurrentBatchConfig,ae=0,Me=null,Ee=null,Le=0,rt=0,Yn=Yt(0),Te=0,zr=null,yn=0,Ki=0,ks=0,Hr=null,Je=null,Rs=0,Zn=1/0,Ut=null,Ji=!1,Es=null,rn=null,Xi=!1,on=null,Yi=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&&Xl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Xl(n),t===1)e.tag===0?Yh(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=Yl;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,Je,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,Je,Ut),t);break}Sn(e,Je,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,Je,Ut),r);break}Sn(e,Je,Ut);break;case 5:Sn(e,Je,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=Je,Je=n,t!==null&&As(t)),e}function As(e){Je===null?Je=e:Je.push.apply(Je,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,Je,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(){rt=Yn.current,ge(Yn)}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(),ge(Ve),ge(je),qa();break;case 5:Ya(r);break;case 4:Kn();break;case 13:ge(xe);break;case 19:ge(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=rt=t,Te=0,zr=null,ks=Ki=yn=0,Je=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,bs.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 m=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,m,t),t=R,d=m;var f=t.updateQueue;if(f===null){var b=new Set;b.add(d),t.updateQueue=b}else f.add(d);break e}else{if(!(t&1)){Nc(o,m,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,g=o.stateNode;if(!(o.flags&128)&&(typeof p.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(rn===null||!rn.has(g)))){o.flags|=65536,t&=-t,o.lanes|=t;var C=Pc(o,l,t);ic(o,C);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,rt);e.memoizedProps=e.pendingProps,t===null?hf(e):Ee=t,bs.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,rt),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)||Xi||(Xi=!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,bs.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(Xi&&(Xi=!1,on=e,Yi=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 Yi&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(Yi),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,Yi=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 m=l[d];for(q=m;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(Yc(S),S===m){q=null;break}if(y!==null){y.return=R,q=y;break}q=R}}}var f=o.alternate;if(f!==null){var b=f.child;if(b!==null){f.child=null;do{var T=b.sibling;b.sibling=null,b=T}while(b!==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 g=a.child;if(a.subtreeFlags&2064&&g!==null)g.return=a,q=g;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){Ce(l,l.return,h)}if(l===a){q=null;break e}var C=l.sibling;if(C!==null){C.return=l.return,q=C;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 Ce(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 Cp(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||Ve.current)Ke=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ke=!1,up(e,t,n);Ke=!!(e.flags&131072)}else Ke=!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,Qe(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(nt=Xt(t.stateNode.containerInfo.firstChild),tt=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 Xa(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,de(Pi,r._currentValue),r._currentValue=a,o!==null)if(ht(o.value,a)){if(o.children===i.children&&!Ve.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 m=o.updateQueue;if(m!==null){m=m.shared;var S=m.pending;S===null?d.next=d:(d.next=S.next,S.next=d),m.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,Qe(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 bp(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 bp(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 Cn(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 bl: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 Cn(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(Qe(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(Qe(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 Cf(){}function Tp(e,t,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var m=io(a);o.call(m)}}var a=wf(t,r,e,0,null,!1,!1,"",Cf);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 m=io(d);l.call(m)}}var d=js(e,0,!1,null,null,!1,!1,"",Cf);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){}}Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ap,Ze.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)},Ze.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)},Ze.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},Ze.flushSync=function(e){return wn(e)},Ze.hydrate=function(e,t,n){if(!ao(t))throw Error(J(200));return so(null,e,t,!0,n)},Ze.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)},Ze.render=function(e,t,n){if(!ao(t))throw Error(J(200));return so(null,e,t,!1,n)},Ze.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},Ze.unstable_batchedUpdates=Is,Ze.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)},Ze.version="18.3.1-next-f1338f8080-20240426";function bf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bf)}catch(e){console.error(e)}}bf(),vl.exports=Ze;var Mp=vl.exports,zs,kf=Mp;zs=kf.createRoot,kf.hydrateRoot;var Rf={exports:{}},uo={};/**
|
|
33
33
|
* @license React
|
|
34
34
|
* react-jsx-runtime.production.min.js
|
|
35
35
|
*
|
|
@@ -37,14 +37,14 @@ 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=ne,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 Rf(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=Rf,uo.jsxs=Rf,kf.exports=uo;var V=kf.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 h=()=>{const S={backgroundColor:n,zIndex:2147483647,bottom:`${i}px`};return r==="bottom-left"?it(me({},S),{left:`${o}px`}):it(me({},S),{right:`${o}px`})},m=()=>{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 V.jsxs("button",{onClick:t,className:m(),style:h(),"aria-label":e?"Close chat":"Open chat",children:[a&&!e&&V.jsxs(V.Fragment,{children:[V.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"}),V.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:V.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-white nbc-rounded-full"})})]}),e?V.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):V.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.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 V.jsx("span",{className:"nbc-text-sm nbc-font-bold nbc-leading-none",children:o});case"custom":return a?a.startsWith("<svg")?V.jsx("div",{className:"nbc-w-5 nbc-h-5 nbc-flex nbc-items-center nbc-justify-center",dangerouslySetInnerHTML:{__html:a}}):V.jsx("img",{src:a,alt:"Close",className:"nbc-w-5 nbc-h-5"}):V.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});default:return V.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}};return V.jsxs("div",{className:"nbc-p-2 nbc-text-white nbc-flex nbc-justify-between nbc-items-center nbc-font-medium",style:{backgroundColor:n},children:[V.jsxs("div",{className:"nbc-flex nbc-items-center nbc-space-x-3 nbc-text-black",children:[r?V.jsx("img",{src:r,alt:"Avatar",className:"nbc-w-10 nbc-h-10 nbc-rounded-full nbc-object-cover"}):V.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:[V.jsx("path",{d:"M12 6V2H8"}),V.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"}),V.jsx("path",{d:"M2 12h2"}),V.jsx("path",{d:"M9 11v2"}),V.jsx("path",{d:"M15 11v2"}),V.jsx("path",{d:"M20 12h2"})]}),V.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]}),V.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 zs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var bn=zs();function Ef(e){bn=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+|$)/,Hs=/(?:[*+-]|\d{1,9}[.)])/,Of=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Tf=le(Of).replace(/bull/g,Hs).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(Of).replace(/bull/g,Hs).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(),Fs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$p=/^[^\n]+/,Gs=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Vp=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Gs).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Qp=le(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Hs).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",Ws=/<!--(?:-?>|[\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",Ws).replace("tag",co).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Af=le(Fs).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",Af).getRegex(),$s={blockquote:Jp,code:Hp,def:Vp,fences:Fp,heading:Gp,hr:$r,html:Kp,lheading:Tf,list:Qp,newline:zp,paragraph:Af,table:Wr,text:$p},If=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(),Xp=it(me({},$s),{lheading:Wp,table:If,paragraph:le(Fs).replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",If).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()}),Yp=it(me({},$s),{html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ws).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(Fs).replace("hr",$r).replace("heading",` *#{1,6} *[^
|
|
41
|
-
]`).replace("lheading",
|
|
40
|
+
*/var Pp=ne,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 V=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"?it(me({},S),{left:`${o}px`}):it(me({},S),{right:`${o}px`})},m=()=>{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 V.jsxs("button",{onClick:t,className:m(),style:d(),"aria-label":e?"Close chat":"Open chat",children:[a&&!e&&V.jsxs(V.Fragment,{children:[V.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"}),V.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:V.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-white nbc-rounded-full"})})]}),e?V.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):V.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.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 V.jsx("span",{className:"nbc-text-sm nbc-font-bold nbc-leading-none",children:o});case"custom":return a?a.startsWith("<svg")?V.jsx("div",{className:"nbc-w-5 nbc-h-5 nbc-flex nbc-items-center nbc-justify-center",dangerouslySetInnerHTML:{__html:a}}):V.jsx("img",{src:a,alt:"Close",className:"nbc-w-5 nbc-h-5"}):V.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});default:return V.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}};return V.jsxs("div",{className:"nbc-p-2 nbc-text-white nbc-flex nbc-justify-between nbc-items-center nbc-font-medium",style:{backgroundColor:n},children:[V.jsxs("div",{className:"nbc-flex nbc-items-center nbc-space-x-3 nbc-text-black",children:[r?V.jsx("img",{src:r,alt:"Avatar",className:"nbc-w-10 nbc-h-10 nbc-rounded-full nbc-object-cover"}):V.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:[V.jsx("path",{d:"M12 6V2H8"}),V.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"}),V.jsx("path",{d:"M2 12h2"}),V.jsx("path",{d:"M9 11v2"}),V.jsx("path",{d:"M15 11v2"}),V.jsx("path",{d:"M20 12h2"})]}),V.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]}),V.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 bn=Hs();function Of(e){bn=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(),Xp=it(me({},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()}),Yp=it(me({},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=it(me({},Ks),{link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",ho).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ho).getRegex()}),Js=it(me({},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=it(me({},Js),{br:le(Pf).replace("{2,}","*").getRegex(),text:le(Js.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),po={normal:Vs,gfm:Xp,pedantic:Yp},Vr={normal:Ks,gfm:Js,breaks:vg,pedantic:mg},yg={"&":"&","<":"<",">":">",'"':""","'":"'"},_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 m=!1,S=l;for(;--S>=0&&d[S]==="\\";)m=!m;return m?"|":" |"}),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
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
43
|
`)}var go=class{constructor(e){fe(this,"options");fe(this,"rules");fe(this,"lexer");this.options=e||bn}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
|
|
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 m=l.join(`
|
|
48
48
|
`),S=m.replace(this.rules.other.blockquoteSetextReplace,`
|
|
49
49
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
50
50
|
${m}`:m,i=i?`${i}
|
|
@@ -53,26 +53,26 @@ ${S}`:S;const E=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
|
|
|
53
53
|
`),b=this.blockquote(f);o[o.length-1]=b,r=r.substring(0,r.length-R.raw.length)+b.raw,i=i.substring(0,i.length-R.text.length)+b.text;break}else if((y==null?void 0:y.type)==="list"){const R=y,f=R.raw+`
|
|
54
54
|
`+n.join(`
|
|
55
55
|
`),b=this.list(f);o[o.length-1]=b,r=r.substring(0,r.length-y.raw.length)+b.raw,i=i.substring(0,i.length-R.raw.length)+b.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
|
|
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,m="",S="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;m=t[0],e=e.substring(m.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)&&(m+=y+`
|
|
59
|
-
`,e=e.substring(y.length+1),
|
|
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," "),g.test(y)||C.test(y)||
|
|
59
|
+
`,e=e.substring(y.length+1),d=!0),!d){const x=this.rules.other.nextBulletRegex(f),p=this.rules.other.hrRegex(f),g=this.rules.other.fencesBeginRegex(f),C=this.rules.other.headingBeginRegex(f),h=this.rules.other.htmlBeginRegex(f);for(;e;){const c=e.split(`
|
|
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," "),g.test(y)||C.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||g.test(E)||C.test(E)||p.test(E))break;S+=`
|
|
62
62
|
`+y}!R&&!y.trim()&&(R=!0),m+=c+`
|
|
63
|
-
`,e=e.substring(c.length+1),E=u.slice(f)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(a=!0));let b=null,T;this.options.gfm&&(b=this.rules.other.listIsTask.exec(S),b&&(T=b[0]!=="[ ] ",S=S.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:m,task:!!b,checked:T,loose:!1,text:S,tokens:[]}),i.raw+=m}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
|
|
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(
|
|
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)),
|
|
63
|
+
`,e=e.substring(c.length+1),E=u.slice(f)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(a=!0));let b=null,T;this.options.gfm&&(b=this.rules.other.listIsTask.exec(S),b&&(T=b[0]!=="[ ] ",S=S.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:m,task:!!b,checked:T,loose:!1,text:S,tokens:[]}),i.raw+=m}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 m=i.items[d].tokens.filter(E=>E.type==="space"),S=m.length>0&&m.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,m)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:o.align[m]})));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,m=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)){m+=l;continue}if(d-=l,d>0)continue;l=Math.min(l,l+d+m);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){fe(this,"tokens");fe(this,"options");fe(this,"state");fe(this,"tokenizer");fe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||bn,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
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(m=>(l=m.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 m=n.at(-1);l.raw.length===1&&m!==void 0?m.raw+=`
|
|
67
67
|
`:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);const m=n.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
68
68
|
`+l.raw,m.text+=`
|
|
69
69
|
`+l.text,this.inlineQueue.at(-1).src=m.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 m=n.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
70
70
|
`+l.raw,m.text+=`
|
|
71
|
-
`+l.raw,this.inlineQueue.at(-1).src=m.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title});continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),n.push(l);continue}let
|
|
71
|
+
`+l.raw,this.inlineQueue.at(-1).src=m.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title});continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),n.push(l);continue}let d=t;if((a=this.options.extensions)!=null&&a.startBlock){let m=1/0;const S=t.slice(1);let E;this.options.extensions.startBlock.forEach(y=>{E=y.call({lexer:this},S),typeof E=="number"&&E>=0&&(m=Math.min(m,E))}),m<1/0&&m>=0&&(d=t.substring(0,m+1))}if(this.state.top&&(l=this.tokenizer.paragraph(d))){const m=n.at(-1);r&&(m==null?void 0:m.type)==="paragraph"?(m.raw+=`
|
|
72
72
|
`+l.raw,m.text+=`
|
|
73
|
-
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):n.push(l),r=
|
|
73
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.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 m=n.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
74
74
|
`+l.raw,m.text+=`
|
|
75
|
-
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):n.push(l);continue}if(t){const m="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var l,
|
|
75
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):n.push(l);continue}if(t){const m="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var l,d,m;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((m=this.options.extensions)!=null&&m.startInline){let y=1/0;const R=t.slice(1);let f;this.options.extensions.startInline.forEach(b=>{f=b.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){fe(this,"options");fe(this,"parser");this.options=e||bn}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
76
|
`;return r?'<pre><code class="language-'+Et(r)+'">'+(n?i:Et(i,!0))+`</code></pre>
|
|
77
77
|
`:"<pre><code>"+(n?i:Et(i,!0))+`</code></pre>
|
|
78
78
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
@@ -90,9 +90,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
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=
|
|
94
|
-
`+this.renderer.text(m);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 m='Token with "'+
|
|
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,
|
|
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)}},Xs=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){fe(this,"options");fe(this,"renderer");fe(this,"textRenderer");this.options=t||bn,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 Xs}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 m=l,S=this.options.extensions.renderers[m.type].call({parser:this},m);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.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 m=d,S=this.renderer.text(m);for(;a+1<t.length&&t[a+1].type==="text";)m=t[++a],S+=`
|
|
94
|
+
`+this.renderer.text(m);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 m='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}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 m=this.options.extensions.renderers[l.type].call({parser:this},l);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=m||"";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 m='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return r}},vo=(el=class{constructor(e){fe(this,"options");fe(this,"block");this.options=e||bn}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}},fe(el,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),el),Sg=class{constructor(...e){fe(this,"defaults",Hs());fe(this,"options",this.setOptions);fe(this,"parse",this.parseMarkdown(!0));fe(this,"parseInline",this.parseMarkdown(!1));fe(this,"Parser",_t);fe(this,"Renderer",mo);fe(this,"TextRenderer",Xs);fe(this,"Lexer",Bt);fe(this,"Tokenizer",go);fe(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=me({},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]=(...m)=>{let S=l.apply(i,m);return S===!1&&(S=d.apply(i,m)),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]=(...m)=>{let S=l.apply(i,m);return S===!1&&(S=d.apply(i,m)),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]=m=>{if(this.defaults.async)return Promise.resolve(l.call(i,m)).then(E=>d.call(i,E));const S=l.call(i,m);return d.call(i,S)}:i[a]=(...m)=>{let S=l.apply(i,m);return S===!1&&(S=d.apply(i,m)),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=me(me({},this.defaults),r)}),this}setOptions(e){return this.defaults=me(me({},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=me({},r),o=me(me({},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(m=>l(m,o)).then(m=>o.hooks?o.hooks.processAllTokens(m):m).then(m=>o.walkTokens?Promise.all(this.walkTokens(m,o.walkTokens)).then(()=>m):m).then(m=>d(m,o)).then(m=>o.hooks?o.hooks.postprocess(m):m).catch(a);try{o.hooks&&(n=o.hooks.preprocess(n));let m=l(n,o);o.hooks&&(m=o.hooks.processAllTokens(m)),o.walkTokens&&this.walkTokens(m,o.walkTokens);let S=d(m,o);return o.hooks&&(S=o.hooks.postprocess(S)),S}catch(m){return a(m)}}}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=bn,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=Xs,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 Cg=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=Cg(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 bg=({message:e,avatar:t,textColor:n,bubbleUserColor:r})=>e.sender==="user"?V.jsx("div",{className:"nbc-w-full nbc-flex nbc-justify-end nbc-mb-4",children:V.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:[V.jsx("div",{className:"nbc-break-words",style:{overflowWrap:"anywhere",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:se(e.text,{renderer:yo})}}),V.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)})]})}):V.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:V.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[V.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3 nbc-text-black",children:[t?V.jsx("img",{src:t,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}):V.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:[V.jsx("path",{d:"M12 6V2H8"}),V.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"}),V.jsx("path",{d:"M2 12h2"}),V.jsx("path",{d:"M9 11v2"}),V.jsx("path",{d:"M15 11v2"}),V.jsx("path",{d:"M20 12h2"})]}),V.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)})]}),V.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:V.jsx("div",{className:"nbc-break-words",style:{overflowWrap:"anywhere",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:se(e.text,{renderer:yo})}})})]})}),kg=({avatar:e})=>V.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:V.jsxs("div",{className:"nbc-flex nbc-items-start nbc-space-x-3",children:[V.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3 nbc-text-black",children:[e?V.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}):V.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:[V.jsx("path",{d:"M12 6V2H8"}),V.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"}),V.jsx("path",{d:"M2 12h2"}),V.jsx("path",{d:"M9 11v2"}),V.jsx("path",{d:"M15 11v2"}),V.jsx("path",{d:"M20 12h2"})]}),V.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",children:" "})]}),V.jsx("div",{className:"nbc-bg-white nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-rounded-bl-md nbc-shadow-sm",children:V.jsxs("div",{className:"nbc-flex nbc-space-x-1",children:[V.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"0ms"}}),V.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"150ms"}}),V.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=ne.useRef(null),a=ne.useRef(null),l=()=>{a.current&&requestAnimationFrame(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)})};return ne.useEffect(()=>{const d=setTimeout(()=>{l()},50);return()=>clearTimeout(d)},[e,t]),V.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:[V.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(o=>V.jsx(bg,{message:o,avatar:n},o.id)),t&&V.jsx(kg,{avatar:n}),V.jsx("div",{ref:r})]})},Wf=({onSendMessage:e,placeholder:t="Escribe un mensaje...",disabled:n=!1})=>{const[r,i]=ne.useState(""),o=l=>{l.preventDefault(),r.trim()&&!n&&(e(r.trim()),i(""))},a=l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),r.trim()&&!n&&(e(r.trim()),i("")))};return V.jsx("form",{onSubmit:o,className:"nbc-bg-white nbc-border-t nbc-border-gray-100",children:V.jsxs("div",{className:"nbc-relative",children:[V.jsx("input",{type:"text",value:r,onChange:l=>i(l.target.value),onKeyPress:a,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"}}),V.jsx("button",{type:"submit",disabled:!r.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",children:V.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:[V.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),V.jsx("path",{d:"M22 2 11 13"})]})})]})})},$f=({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 V.jsxs("div",{className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-space-y-4 nbc-p-4",children:[t.map((n,r)=>V.jsx("div",{className:`nbc-flex ${n.type==="user"?"nbc-justify-end":"nbc-justify-start"} nbc-mb-4`,children:n.type==="user"?V.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((i,o)=>V.jsx("div",{className:`nbc-h-4 nbc-bg-gray-100 nbc-rounded nbc-animate-pulse ${i}`},o))}):V.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[V.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e?V.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"}):V.jsx("div",{className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-bg-gray-300 nbc-animate-pulse"}),V.jsx("div",{className:"nbc-w-10 nbc-h-3 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse nbc-mt-1"})]}),V.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((i,o)=>V.jsx("div",{className:`nbc-h-4 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse ${i}`},o))})]})},r)),V.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:h,marginSide:m,isMobile:S=!1,apiKeyMissing:E=!1})=>{const[y,R]=ne.useState(!1),[f,b]=ne.useState(!1),T=c=>{i(c)};if(ne.useEffect(()=>{e?(b(!0),setTimeout(()=>R(!0),10)):(R(!1),setTimeout(()=>b(!1),300))},[e]),!f)return null;const x=()=>{const c=l||n.position||"bottom-right",u=h||n.marginBottom||16,s=m||n.marginSide||16,k={width:"400px",height:"580px",zIndex:2147483647,bottom:`${u+64+10}px`};return c==="bottom-left"?it(me({},k),{left:`${s}px`}):it(me({},k),{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"}`,g=()=>S?{zIndex:2147483647}:x(),d=`https://notchatbot.com?utm_source=${typeof window!="undefined"?encodeURIComponent(window.location.hostname):"unknown"}&utm_medium=widget&utm_campaign=WebChat`;return V.jsxs("div",{className:p(),style:g(),children:[V.jsx(_p,{title:n.title||"Chat",onClose:t,primaryColor:n.primaryColor,avatar:n.avatar,closeButtonIcon:n.closeButtonIcon,closeButtonText:n.closeButtonText,closeButtonCustomIcon:n.closeButtonCustomIcon}),E?V.jsx("div",{className:"nbc-flex-1 nbc-flex nbc-items-center nbc-justify-center nbc-min-h-[220px]",children:V.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:[V.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:[V.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"none"}),V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4m0 4h.01"})]}),"Falta la API Key"]})}):o?V.jsx($f,{avatar:n.avatar}):V.jsx(Gf,{messages:r,isTyping:a,avatar:n.avatar}),V.jsxs("div",{className:"nbc-mb-1 nbc-flex nbc-items-end nbc-justify-center nbc-text-xs nbc-text-black",children:[V.jsx("span",{children:"Powered by"})," ",V.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-bold nbc-text-black",children:"NotChatbot"})]}),V.jsx(Wf,{onSendMessage:T,placeholder:n.placeholder||"Escribe un mensaje...",disabled:a||E})]})};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 Vf(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:h="lax"}=n;let m=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;r&&(m+=`; expires=${r.toUTCString()}`),i!==void 0&&(m+=`; max-age=${i}`),o&&(m+=`; domain=${o}`),m+=`; path=${a}`,l&&(m+="; secure"),m+=`; samesite=${h}`,document.cookie=m}function Qf(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 Eg(e,t={}){Xs(e,"",it(me({},t),{expires:new Date(0)}))}function Kf(){try{const e="__webchat_test__";Xs(e,"test");const t=Qf(e)==="test";return Eg(e),t}catch(e){return!1}}const Jf="notchatbot",Og=24;function Ys(){if(!Kf())return console.warn("WebChat: Cookies not supported, using session-only data"),{conversationId:wt(),conversationStarted:!1};const e=Qf(Jf);if(e)try{const n=JSON.parse(e);if(n&&typeof n=="object"&&typeof n.conversationId=="string"&&typeof n.conversationStarted=="boolean"&&Vf(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(!Kf()){console.warn("WebChat: Cookies not supported, cannot save data");return}if(!e||!Vf(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=Og*60*60;Xs(Jf,JSON.stringify(e),{maxAge:t,secure:window.location.protocol==="https:",sameSite:"lax",path:"/"})}function Tg(e){const t=Ys(),n=it(me({},t),{conversationStarted:e});return Xf(n),n}function Yf(){return Ys().conversationId}function Zf(){return Ys().conversationStarted}const Ag=()=>{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},Zs=()=>Ag()?"mobile":"desktop",Ig=e=>{if(typeof window=="undefined")return()=>{};let t=Zs();const n=()=>{const r=Zs();r!==t&&(t=r,e(r))};return window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},wo=e=>{const t=Zs(),n=it(me({},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},Mg=e=>{const t=wo(e);return{position:t.position,marginBottom:t.marginBottom,marginSide:t.marginSide}},qf=()=>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 Pg(){return typeof window=="undefined"?!1:window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")}function ed(){return Pg()?{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 Ng(){return ed().chatEndpoint}function td(){return ed().conversationEndpoint}const Lg=(e,t)=>ot(this,null,function*(){try{const n=td(),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}}),Dg=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}}),jg=(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 nd={exports:{}};/*!
|
|
117
|
+
`}),e.map(d=>V.jsx(bg,{message:d,avatar:n,textColor:r,bubbleUserColor:i},d.id)),t&&V.jsx(kg,{avatar:n}),V.jsx("div",{ref:o})]})},$f=({onSendMessage:e,placeholder:t="Escribe un mensaje...",disabled:n=!1,input:r})=>{const[i,o]=ne.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 V.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:V.jsxs("div",{className:"nbc-relative",children:[V.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}}),V.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:V.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:[V.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),V.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 V.jsxs("div",{className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-space-y-4 nbc-p-4",children:[t.map((n,r)=>V.jsx("div",{className:`nbc-flex ${n.type==="user"?"nbc-justify-end":"nbc-justify-start"} nbc-mb-4`,children:n.type==="user"?V.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((i,o)=>V.jsx("div",{className:`nbc-h-4 nbc-bg-gray-100 nbc-rounded nbc-animate-pulse ${i}`},o))}):V.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[V.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e?V.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"}):V.jsx("div",{className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-bg-gray-300 nbc-animate-pulse"}),V.jsx("div",{className:"nbc-w-10 nbc-h-3 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse nbc-mt-1"})]}),V.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((i,o)=>V.jsx("div",{className:`nbc-h-4 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse ${i}`},o))})]})},r)),V.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:m,isMobile:S=!1,apiKeyMissing:E=!1})=>{const[y,R]=ne.useState(!1),[f,b]=ne.useState(!1),T=c=>{i(c)};if(ne.useEffect(()=>{e?(b(!0),setTimeout(()=>R(!0),10)):(R(!1),setTimeout(()=>b(!1),300))},[e]),!f)return null;const x=()=>{const c=l||n.position||"bottom-right",u=d||n.marginBottom||16,s=m||n.marginSide||16,k={width:"400px",height:"580px",zIndex:2147483647,bottom:`${u+64+10}px`};return c==="bottom-left"?it(me({},k),{left:`${s}px`}):it(me({},k),{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"}`,g=()=>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 V.jsxs("div",{className:p(),style:g(),children:[V.jsx(_p,{title:n.title||"Chat",onClose:t,primaryColor:n.primaryColor,avatar:n.avatar,closeButtonIcon:n.closeButtonIcon,closeButtonText:n.closeButtonText,closeButtonCustomIcon:n.closeButtonCustomIcon}),E?V.jsx("div",{className:"nbc-flex-1 nbc-flex nbc-items-center nbc-justify-center nbc-min-h-[220px]",children:V.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:[V.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:[V.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"none"}),V.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4m0 4h.01"})]}),"Falta la API Key"]})}):o?V.jsx(Vf,{avatar:n.avatar}):V.jsx(Wf,{messages:r,isTyping:a,avatar:n.avatar}),V.jsxs("div",{className:"nbc-mb-1 nbc-flex nbc-items-end nbc-justify-center nbc-text-xs nbc-text-black",children:[V.jsx("span",{children:"Powered by"})," ",V.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-bold nbc-text-black",children:"NotChatbot"})]}),V.jsx($f,{onSendMessage:T,placeholder:n.placeholder||"Escribe un mensaje...",disabled:a||E})]})};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 Ys(e,t,n={}){const{expires:r,maxAge:i,domain:o,path:a="/",secure:l=window.location.protocol==="https:",sameSite:d="lax"}=n;let m=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;r&&(m+=`; expires=${r.toUTCString()}`),i!==void 0&&(m+=`; max-age=${i}`),o&&(m+=`; domain=${o}`),m+=`; path=${a}`,l&&(m+="; secure"),m+=`; samesite=${d}`,document.cookie=m}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 Eg(e,t={}){Ys(e,"",it(me({},t),{expires:new Date(0)}))}function Jf(){try{const e="__webchat_test__";Ys(e,"test");const t=Kf(e)==="test";return Eg(e),t}catch(e){return!1}}const Xf="notchatbot",Og=24;function Zs(){if(!Jf())return console.warn("WebChat: Cookies not supported, using session-only data"),{conversationId:wt(),conversationStarted:!1};const e=Kf(Xf);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 Yf(t),t}function Yf(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=Og*60*60;Ys(Xf,JSON.stringify(e),{maxAge:t,secure:window.location.protocol==="https:",sameSite:"lax",path:"/"})}function Tg(e){const t=Zs(),n=it(me({},t),{conversationStarted:e});return Yf(n),n}function Zf(){return Zs().conversationId}function qf(){return Zs().conversationStarted}const Ag=()=>{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=()=>Ag()?"mobile":"desktop",Ig=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=it(me({},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},Mg=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 Pg(){return typeof window=="undefined"?!1:window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")}function td(){return Pg()?{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 Ng(){return td().chatEndpoint}function nd(){return td().conversationEndpoint}const Lg=(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}}),Dg=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}}),jg=(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
|
|
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(m){return o[m]}.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 m}),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 b}),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 g}),i.d(r,"__spreadArray",function(){return C}),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 k}),i.d(r,"__importDefault",function(){return L}),i.d(r,"__classPrivateFieldGet",function(){return N}),i.d(r,"__classPrivateFieldSet",function(){return P});/*! *****************************************************************************
|
|
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 h(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 m(I,M,A,j){var U=arguments.length,z=U<3?M:j===null?j=Object.getOwnPropertyDescriptor(M,A):j,W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(I,M,A,j);else for(var G=I.length-1;G>=0;G--)(W=I[G])&&(z=(U<3?W(z):U>3?W(M,A,z):W(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(W){W(z)})}return new(A||(A=Promise))(function(z,W){function G(D){try{O(j.next(D))}catch(B){W(B)}}function F(D){try{O(j.throw(D))}catch(B){W(B)}}function O(D){D.done?z(D.value):U(D.value).then(G,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,W;return W={next:G(0),throw:G(1),return:G(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function G(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 b(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=[],W;try{for(;(M===void 0||M-- >0)&&!(U=j.next()).done;)z.push(U.value)}catch(G){W={error:G}}finally{try{U&&!U.done&&(A=j.return)&&A.call(j)}finally{if(W)throw W.error}}return z}function p(){for(var I=[],M=0;M<arguments.length;M++)I=I.concat(x(arguments[M]));return I}function g(){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],W=0,G=z.length;W<G;W++,U++)j[U]=z[W];return j}function C(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 d(I){return this instanceof d?(this.v=I,this):new d(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={},W("next"),W("throw"),W("return"),U[Symbol.asyncIterator]=function(){return this},U;function W(_){j[_]&&(U[_]=function($){return new Promise(function(X,Y){z.push([_,$,X,Y])>1||G(_,$)})})}function G(_,$){try{F(j[_]($))}catch(X){B(z[0][3],X)}}function F(_){_.value instanceof d?Promise.resolve(_.value.v).then(O,D):B(z[0][2],_)}function O(_){G("next",_)}function D(_){G("throw",_)}function B(_,$){_($),z.shift(),z.length&&G(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(W){return(A=!A)?{value:d(I[U](W)),done:U==="return"}:z?z(W):W}: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(W){return new Promise(function(G,F){W=I[z](W),U(G,F,W.done,W.value)})}}function U(z,W,G,F){Promise.resolve(F).then(function(O){z({value:O,done:G})},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 k(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)),h=a.__importStar(i(8)),m=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 Ye=Object.prototype.hasOwnProperty;for(var Kr in oe)(!Ye||Ye.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 b(H){return g(H)?[]:(0,r.isArray)(H)?H:[H]}r.ensureArray=b;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 g(H){return H==null}r.isEmptyArg=g;function C(H){var Q=new Object;for(var K in H)Q[K]=H[K];return Q}r.shallowClone=C;function d(H,Q){var K=function(){function oe(){}return oe}();K.prototype=H;var ee=new K;return Q&&R(ee,Q),ee}r.prototypicalClone=d;var c=function(H,Q){if(l.default.Config.inherits){l.default.Config.inherits(H,Q);return}H.super_=Q,H.prototype=d(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 k(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=k,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 W(H,Q){var K=z[Q||ye.json];return{accept:K,"X-Ably-Version":h.default.protocolVersion.toString(),"Ably-Agent":(0,h.getAgentString)(H)}}r.defaultGetHeaders=W;function G(H,Q){var K,ee=K=z[Q||ye.json];return{accept:ee,"content-type":K,"X-Ably-Version":h.default.protocolVersion.toString(),"Ably-Agent":(0,h.getAgentString)(H)}}r.defaultPostHeaders=G;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 $(H){return l.default.BufferUtils.isBuffer(H)?H.toString():typeof H=="string"?H:l.default.Config.inspect(H)}r.inspectBody=$;function X(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=X;function Y(){return String(Math.random()).substr(2)}r.cheapRandStr=Y;var te=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="",Ye=0;Ye<ee;Ye++)oe+=K[y(K)];return oe};r.randomString=te;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="",Ye=0;Ye<ee;Ye++)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=[],Ye=0;Ye<K;Ye++)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(Ye,Kr){Ye?oe(Ye):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 bo(H,Q){return H*Co(Q)*xt()}r.getRetryTime=bo;function el(){return o||(typeof window!="undefined"?window:self)}r.getGlobalObject=el;function tl(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=tl;function Qg(H){var Q=/^(\[([^?]*)(?:(.*))\])?(.+)$/,K=H.match(Q);if(!K||!K.length||K.length<5)throw new m.default("regex match failed",400,40010);if(K[2])throw new m.default("cannot use a derived option with a ".concat(K[2]," channel"),400,40010);return{qualifierParam:K[3]||"",channelName:K[4]}}r.matchDerivedChannel=Qg;function Kg(H){return l.default.Config.createHmac?Buffer.from(H,"ascii").toString("base64"):(0,S.stringify)((0,E.parse)(H))}r.toBase64=Kg;function Jg(H,Q){return H.length===Q.length&&(0,r.arrEvery)(H,function(K,ee){return K===Q[ee]})}r.arrEquals=Jg}).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)),h=o||(typeof window!="undefined"?window:self),m;(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"})(m||(m={}));function S(f,b){return"".concat(f).padStart(b?3:2,"0")}function E(f){return l.default.Config.logTimestamps?function(b){var T=new Date;f(S(T.getHours())+":"+S(T.getMinutes())+":"+S(T.getSeconds())+"."+S(T.getMilliseconds(),1)+" "+b)}:f}var y=function(){var f,b,T,x;return typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"||typeof((b=(f=h==null?void 0:h.console)===null||f===void 0?void 0:f.log)===null||b===void 0?void 0:b.apply)=="function"?(T=function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];console.log.apply(console,p)},x=console.warn?function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];console.warn.apply(console,p)}:T):h!=null&&h.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 b=y(),T=b[0],x=b[1];this.logHandler=T,this.logErrorHandler=x},f.renamedClientOption=function(b,T){f.deprecationWarning("The `".concat(b,"` client option has been renamed to `").concat(T,"`. Please update your code to use `").concat(T,"` instead. `").concat(b,"` will be removed in a future version."))},f.renamedMethod=function(b,T,x){f.deprecationWarning("`".concat(b,"`’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(b){f.shouldLog(m.Error)&&f.logErrorHandler("Ably: Deprecation warning - ".concat(b))},f.logLevel=m.Error,f.LOG_NONE=m.None,f.LOG_ERROR=m.Error,f.LOG_MAJOR=m.Major,f.LOG_MINOR=m.Minor,f.LOG_MICRO=m.Micro,f.LOG_DEFAULT=m.Error,f.LOG_DEBUG=m.Micro,f.logAction=function(b,T,x){f.shouldLog(b)&&(b===m.Error?f.logErrorHandler:f.logHandler)("Ably: "+T+": "+x)},f.deprecated=function(b,T){f.deprecationWarning("".concat(b," is deprecated and will be removed in a future version. ").concat(T))},f.shouldLog=function(b){return b<=f.logLevel},f.setLog=function(b,T){b!==void 0&&(f.logLevel=b),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 h(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 m=function(E){o.__extends(y,E);function y(R,f,b,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=b,x.cause=T,x}return y.prototype.toString=function(){return h(this)},y.fromValues=function(R){var f=R,b=f.message,T=f.code,x=f.statusCode;if(typeof b!="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(b,T,x),R);return p.code&&!p.href&&(p.href="https://help.ably.io/error/"+p.code),p},y}(Error);r.default=m;var S=function(E){o.__extends(y,E);function y(R,f,b,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=b,x.cause=T,x}return y.prototype.toString=function(){return h(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,h=l.WordArray,m=h.init,S=h.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;m.call(this,R,y)}else m.apply(this,arguments)};S.prototype=h}}(),o.lib.WordArray})},function(n,r,i){(function(o){(function(a,l){n.exports=l()})(this,function(){var a=a||function(l,h){var m;if(typeof window!="undefined"&&window.crypto&&(m=window.crypto),!m&&typeof window!="undefined"&&window.msCrypto&&(m=window.msCrypto),!m&&typeof o!="undefined"&&o.crypto&&(m=o.crypto),!m)try{m=i(44)}catch(c){}var S=function(){if(m){if(typeof m.getRandomValues=="function")try{return m.getRandomValues(new Uint32Array(1))[0]}catch(c){}if(typeof m.randomBytes=="function")try{return m.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)}}}(),b=R.WordArray=f.extend({init:function(c,u){c=this.words=c||[],u!=h?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 k=0;k<v;k++){var L=s[k>>>2]>>>24-k%4*8&255;u[w+k>>>2]|=L<<24-(w+k)%4*8}else for(var k=0;k<v;k+=4)u[w+k>>>2]=s[k>>>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 b.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 k=u[v>>>2]>>>24-v%4*8&255;w.push((k>>>4).toString(16)),w.push((k&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 b.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 k=u[v>>>2]>>>24-v%4*8&255;w.push(String.fromCharCode(k))}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 b.init(s,u)}},g=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)))}},C=R.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new b.init,this._nDataBytes=0},_append:function(c){typeof c=="string"&&(c=g.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes},_process:function(c){var u,s=this._data,w=s.words,v=s.sigBytes,k=this.blockSize,L=k*4,N=v/L;c?N=l.ceil(N):N=l.max((N|0)-this._minBufferSize,0);var P=N*k,I=l.min(P*4,v);if(P){for(var M=0;M<P;M+=k)this._doProcessBlock(w,M);u=w.splice(0,P),s.sigBytes-=I}return new b.init(u,I)},clone:function(){var c=f.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});R.Hasher=C.extend({cfg:f.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset()},reset:function(){C.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 d.HMAC.init(c,s).finalize(u)}}});var d=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)),h=o.__importDefault(i(3));function m(y,R,f){try{R.apply(y,f)}catch(b){l.default.logAction(l.default.LOG_ERROR,"EventEmitter.emit()","Unexpected listener exception: "+b+"; stack = "+(b&&b.stack))}}function S(y,R,f){for(var b,T,x,p=0;p<y.length;p++)if(b=y[p],f&&(b=b[f]),a.isArray(b)){for(;(T=a.arrIndexOf(b,R))!==-1;)b.splice(T,1);f&&b.length===0&&delete y[p][f]}else if(a.isObject(b))for(x in b)Object.prototype.hasOwnProperty.call(b,x)&&a.isArray(b[x])&&S([b],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=[],b=0;b<arguments.length;b++)f[b]=arguments[b];if(f.length===1){var T=f[0];if(typeof T=="function")this.any.push(T);else throw new Error("EventListener.on(): Invalid arguments: "+h.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: "+h.default.Config.inspect(f));if(a.isEmptyArg(x))this.any.push(p);else if(a.isArray(x))x.forEach(function(C){R.on(C,p)});else{if(typeof x!="string")throw new Error("EventListener.on(): Invalid arguments: "+h.default.Config.inspect(f));var g=this.events[x]||(this.events[x]=[]);g.push(p)}}},y.prototype.off=function(){for(var R,f=this,b=[],T=0;T<arguments.length;T++)b[T]=arguments[T];if(b.length==0||a.isEmptyArg(b[0])&&a.isEmptyArg(b[1])){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null);return}var x=b[0],p=b[1],g=null,C=null;if(b.length===1||!p)typeof x=="function"?g=x:C=x;else{if(typeof p!="function")throw new Error("EventEmitter.off(): invalid arguments:"+h.default.Config.inspect(b));R=[x,p],C=R[0],g=R[1]}if(g&&a.isEmptyArg(C)){S([this.any,this.events,this.anyOnce,this.eventsOnce],g);return}if(a.isArray(C)){C.forEach(function(d){f.off(d,g)});return}if(typeof C!="string")throw new Error("EventEmitter.off(): invalid arguments:"+h.default.Config.inspect(b));g?S([this.events,this.eventsOnce],g,C):(delete this.events[C],delete this.eventsOnce[C])},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=[],b=1;b<arguments.length;b++)f[b-1]=arguments[b];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 g=this.events[R];g&&Array.prototype.push.apply(x,g),a.arrForEach(x,function(C){m(T,C,f)})},y.prototype.once=function(){for(var R=this,f=[],b=0;b<arguments.length;b++)f[b]=arguments[b];var T=f.length;if((T===0||T===1&&typeof f[0]!="function")&&h.default.Config.Promise){var x=f[0];return new h.default.Config.Promise(function(u){R.once(x,u)})}var p=f[0],g=f[1];if(f.length===1&&typeof p=="function")this.anyOnce.push(p);else if(a.isEmptyArg(p)){if(typeof g!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+h.default.Config.inspect(f));this.anyOnce.push(g)}else if(a.isArray(p)){var C=this,d=function(){var u=Array.prototype.slice.call(arguments);if(a.arrForEach(p,function(s){C.off(s,d)}),typeof g!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+h.default.Config.inspect(f));g.apply(this,u)};a.arrForEach(p,function(u){C.on(u,d)})}else{if(typeof p!="string")throw new Error("EventEmitter.once(): Invalid arguments:"+h.default.Config.inspect(f));var c=this.eventsOnce[p]||(this.eventsOnce[p]=[]);if(g){if(typeof g!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+h.default.Config.inspect(f));c.push(g)}}},y.prototype.whenState=function(R,f,b){for(var T=this,x=[],p=3;p<arguments.length;p++)x[p-3]=arguments[p];var g={event:R};if(typeof R!="string"||typeof f!="string")throw"whenState requires a valid event String argument";if(typeof b!="function"&&h.default.Config.Promise)return new h.default.Config.Promise(function(C){y.prototype.whenState.apply(T,[R,f,C].concat(x))});R===f?m(g,b,x):this.once(R,b)},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)),h=o.__importDefault(i(2)),m=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:b,environmentFallbackHosts:T,getFallbackHosts:x,getHosts:p,checkHost:g,objectifyOptions:u,normaliseOptions:s};function R(v,k,L){return L?k=k==v.restHost&&v.realtimeHost||k||v.realtimeHost:k=k||v.restHost,k}r.getHost=R;function f(v,k){return k||v.tls?v.tlsPort:v.port}r.getPort=f;function b(v){return v.tls?"https://":"http://"}r.getHttpScheme=b;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 k=v.fallbackHosts,L=typeof v.httpMaxRetryCount!="undefined"?v.httpMaxRetryCount:y.httpMaxRetryCount;return k?l.arrChooseN(k,L):[]}r.getFallbackHosts=x;function p(v){return[v.restHost].concat(x(v))}r.getHosts=p;function g(v){if(typeof v!="string")throw new m.default("host must be a string; was a "+typeof v,4e4,400);if(!v.length)throw new m.default("host must not be zero-length",4e4,400)}function C(v,k,L){return v.realtimeHost?v.realtimeHost:v.restHost?(h.default.logAction(h.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):k?y.REALTIME_HOST:L+"-"+y.REALTIME_HOST}function d(v){var k={};for(var L in y.TIMEOUTS)k[L]=v[L]||y.TIMEOUTS[L];return k}function c(v){var k=y.agent;if(v.agents)for(var L in v.agents)k+=" "+L+"/"+v.agents[L];return k}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&&(h.default.renamedClientOption("host","restHost"),v.restHost=v.host),v.wsHost&&(h.default.renamedClientOption("wsHost","realtimeHost"),v.realtimeHost=v.wsHost),v.queueEvents&&(h.default.renamedClientOption("queueEvents","queueMessages"),v.queueMessages=v.queueEvents),v.headers&&h.default.deprecated("the `headers` client option",""),v.fallbackHostsUseDefault){if(v.fallbackHosts){var k="fallbackHosts and fallbackHostsUseDefault cannot both be set";throw h.default.logAction(h.default.LOG_ERROR,"Defaults.normaliseOptions",k),new m.default(k,4e4,400)}if(v.port||v.tlsPort){var k="fallbackHostsUseDefault cannot be set when port or tlsPort are set";throw h.default.logAction(h.default.LOG_ERROR,"Defaults.normaliseOptions",k),new m.default(k,4e4,400)}v.environment?h.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."):h.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&&(h.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&&(h.default.logAction(h.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")&&(h.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=C(v,N,L);l.arrForEach((v.fallbackHosts||[]).concat(P,I),g),v.port=v.port||y.PORT,v.tlsPort=v.tlsPort||y.TLS_PORT,"tls"in v||(v.tls=!0);var M=d(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&&(h.default.logAction(h.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("?"),W=z[0],G=z[1];j=G?l.parseQueryString(G):{},W.indexOf("://")===-1&&(W="https://"+W),U=W}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)),h=o.__importDefault(i(4)),m=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 b=a.default.Crypto.getCipher(f.cipher);return{cipher:b.cipherParams,channelCipher:b.cipher}}return f!=null?f:{}}function y(f){var b=0;return f.name&&(b+=f.name.length),f.clientId&&(b+=f.clientId.length),f.extras&&(b+=JSON.stringify(f.extras).length),f.data&&(b+=m.dataSizeBytes(f.data)),b}var R=function(){function f(){}return f.prototype.toJSON=function(){var b=this.encoding,T=this.data;return T&&a.default.BufferUtils.isBuffer(T)&&(arguments.length>0?(b=b?b+"/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:b,data:T}},f.prototype.toString=function(){var b="[Message";return this.name&&(b+="; name="+this.name),this.id&&(b+="; id="+this.id),this.timestamp&&(b+="; timestamp="+this.timestamp),this.clientId&&(b+="; clientId="+this.clientId),this.connectionId&&(b+="; connectionId="+this.connectionId),this.encoding&&(b+="; encoding="+this.encoding),this.extras&&(b+="; extras ="+JSON.stringify(this.extras)),this.data&&(typeof this.data=="string"?b+="; data="+this.data:a.default.BufferUtils.isBuffer(this.data)?b+="; data (buffer)="+a.default.BufferUtils.base64Encode(this.data):b+="; data (json)="+JSON.stringify(this.data)),this.extras&&(b+="; extras="+JSON.stringify(this.extras)),b+="]",b},f.encrypt=function(b,T,x){var p=b.data,g=b.encoding,C=T.channelCipher;g=g?g+"/":"",a.default.BufferUtils.isBuffer(p)||(p=a.default.BufferUtils.utf8Encode(String(p)),g=g+"utf-8/"),C.encrypt(p,function(d,c){if(d){x(d);return}b.data=c,b.encoding=g+"cipher+"+C.algorithm,x(null,b)})},f.encode=function(b,T,x){var p=b.data,g=typeof p=="string"||a.default.BufferUtils.isBuffer(p)||p===null||p===void 0;if(!g)if(m.isObject(p)||m.isArray(p))b.data=JSON.stringify(p),b.encoding=b.encoding?b.encoding+"/json":"json";else throw new h.default("Data type is unsupported",40013,400);T!=null&&T.cipher?f.encrypt(b,T,x):x(null,b)},f.encodeArray=function(b,T,x){for(var p=0,g=0;g<b.length;g++)f.encode(b[g],T,function(C){if(C){x(C);return}p++,p==b.length&&x(null,b)})},f.decode=function(b,T){var x=S(T),p=b.data,g=b.encoding;if(g){var C=g.split("/"),d=void 0,c=C.length,u=b.data,s="";try{for(;(d=c)>0;){var w=C[--c].match(/([-\w]+)(\+([\w-]+))?/);if(!w)break;switch(s=w[1],s){case"base64":u=a.default.BufferUtils.base64Decode(String(u)),d==C.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],k=x.channelOptions.channelCipher;if(v!=k.algorithm)throw new Error("Unable to decrypt message with given cipher; incompatible cipher params");u=k.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 h.default("Missing Vcdiff decoder (https://github.com/ably-forks/vcdiff-decoder)",40019,400);if(typeof Uint8Array=="undefined")throw new h.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 h.default("Vcdiff delta decode failed with "+P,40018,400)}continue;default:throw new Error("Unknown encoding")}}}catch(P){var N=P;throw new h.default("Error processing the "+s+" encoding, decoder returned ‘"+N.message+"’",N.code||40013,400)}finally{b.encoding=d<=0?null:C.slice(0,d).join("/"),b.data=u}}x.baseEncodedPreviousPayload=p},f.fromResponseBody=function(b,T,x){x&&(b=m.decodeBody(b,x));for(var p=0;p<b.length;p++){var g=b[p]=f.fromValues(b[p]);try{f.decode(g,T)}catch(C){l.default.logAction(l.default.LOG_ERROR,"Message.fromResponseBody()",C.toString())}}return b},f.fromValues=function(b){return Object.assign(new f,b)},f.fromValuesArray=function(b){for(var T=b.length,x=new Array(T),p=0;p<T;p++)x[p]=f.fromValues(b[p]);return x},f.fromEncoded=function(b,T){var x=f.fromValues(b),p=E(T!=null?T:null);try{f.decode(x,p)}catch(g){l.default.logAction(l.default.LOG_ERROR,"Message.fromEncoded()",g.toString())}return x},f.fromEncodedArray=function(b,T){return b.map(function(x){return f.fromEncoded(x,T)})},f.getMessagesSize=function(b){for(var T,x=0,p=0;p<b.length;p++)T=b[p],x+=T.size||(T.size=y(T));return x},f.serialize=m.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)),h=o.__importDefault(i(9)),m=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 g=0;g<x.length;g++)p.push(x[g].toString());return"[ "+p.join(", ")+" ]"}var b="id channel channelSerial connectionId count msgSerial timestamp".split(" "),T=function(){function x(){var p=this;this.hasFlag=function(g){return(p.flags&y[g])>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 g=this;p.forEach(function(C){return g.setFlag(C)})},x.prototype.decodeModesFromFlags=function(){var p=this,g=[];return x.channelModes.forEach(function(C){p.hasFlag(C)&&g.push(C)}),g.length>0?g: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,g){var C=a.decodeBody(p,g);return x.fromDeserialized(C)},x.fromDeserialized=function(p){var g=p.error;g&&(p.error=l.default.fromValues(g));var C=p.messages;if(C)for(var d=0;d<C.length;d++)C[d]=h.default.fromValues(C[d]);var c=p.presence;if(c)for(var d=0;d<c.length;d++)c[d]=m.default.fromValues(c[d],!0);return Object.assign(new x,p)},x.stringify=function(p){var g="[ProtocolMessage";p.action!==void 0&&(g+="; action="+x.ActionName[p.action]||!1);for(var C,d=0;d<b.length;d++)C=b[d],p[C]!==void 0&&(g+="; "+C+"="+p[C]);if(p.messages&&(g+="; messages="+f(h.default.fromValuesArray(p.messages))),p.presence&&(g+="; presence="+f(m.default.fromValuesArray(p.presence))),p.error&&(g+="; error="+l.default.fromValues(p.error).toString()),p.auth&&p.auth.accessToken&&(g+="; token="+p.auth.accessToken),p.flags&&(g+="; 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&&(g+="; params=["+c+"]")}return g+="]",g},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,h=l.WordArray,m=a.enc;m.Base64={stringify:function(E){var y=E.words,R=E.sigBytes,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";E.clamp();for(var b=[],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,g=y[T+2>>>2]>>>24-(T+2)%4*8&255,C=x<<16|p<<8|g,d=0;d<4&&T+d*.75<R;d++)b.push(f.charAt(C>>>6*(3-d)&63));var c=f.charAt(64);if(c)for(;b.length%4;)b.push(c);return b.join("")},parse:function(E){var y=E.length,R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var b=0;b<R.length;b++)f[R.charCodeAt(b)]=b}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=[],b=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,g=x|p;f[b>>>2]|=g<<24-b%4*8,b++}return h.create(f,b)}}(),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)),h=o.__importDefault(i(26)),m=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)),b=o.__importDefault(i(3));function T(g){var C=[80015,80017,80030];return g.code?y.default.isTokenErr(g)?!1:a.arrIn(C,g.code)?!0:g.code>=4e4&&g.code<5e4:!1}function x(g){return T(g)?[l.default.fromValues({action:l.default.Action.ERROR,error:g})]:[l.default.fromValues({action:l.default.Action.DISCONNECTED,error:g})]}var p=function(g){o.__extends(C,g);function C(d,c,u){var s=g.call(this,d,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 C.prototype.connect=function(){var d=this;m.default.logAction(m.default.LOG_MINOR,"CometTransport.connect()","starting"),h.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 k=this.baseUri+"connect";m.default.logAction(m.default.LOG_MINOR,"CometTransport.connect()","uri: "+k),this.auth.getAuthParams(function(L,N){if(L){d.disconnect(L);return}if(!d.isDisposed){d.authParams=N;var P=d.params.getConnectParams(N);"stream"in P&&(d.stream=P.stream),m.default.logAction(m.default.LOG_MINOR,"CometTransport.connect()","connectParams:"+a.toQueryString(P));var I=!1,M=d.recvRequest=d.createRequest(k,null,P,null,d.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV);M.on("data",function(A){d.recvRequest&&(I||(I=!0,d.emit("preconnect")),d.onData(A))}),M.on("complete",function(A){if(d.recvRequest||(A=A||new R.default("Request cancelled",80003,400)),d.recvRequest=null,!I&&!A&&(I=!0,d.emit("preconnect")),d.onActivity(),A){A.code?d.onData(x(A)):d.disconnect(A);return}b.default.Config.nextTick(function(){d.recv()})}),M.exec()}})},C.prototype.requestClose=function(){m.default.logAction(m.default.LOG_MINOR,"CometTransport.requestClose()"),this._requestCloseOrDisconnect(!0)},C.prototype.requestDisconnect=function(){m.default.logAction(m.default.LOG_MINOR,"CometTransport.requestDisconnect()"),this._requestCloseOrDisconnect(!1)},C.prototype._requestCloseOrDisconnect=function(d){var c=this,u=d?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&&(m.default.logAction(m.default.LOG_ERROR,"CometTransport.request"+(d?"Close()":"Disconnect()"),"request returned err = "+a.inspectError(w)),c.finish("disconnected",w))}),s.exec()}},C.prototype.dispose=function(){var d=this;m.default.logAction(m.default.LOG_MINOR,"CometTransport.dispose()",""),this.isDisposed||(this.isDisposed=!0,this.recvRequest&&(m.default.logAction(m.default.LOG_MINOR,"CometTransport.dispose()","aborting recv request"),this.recvRequest.abort(),this.recvRequest=null),this.finish("disconnected",E.default.disconnected()),b.default.Config.nextTick(function(){d.emit("disposed")}))},C.prototype.onConnect=function(d){var c;if(!this.isDisposed){var u=(c=d.connectionDetails)===null||c===void 0?void 0:c.connectionKey;h.default.prototype.onConnect.call(this,d);var s=this.baseUri+u;m.default.logAction(m.default.LOG_MICRO,"CometTransport.onConnect()","baseUri = "+s),this.sendUri=s+"/send",this.recvUri=s+"/recv",this.closeUri=s+"/close",this.disconnectUri=s+"/disconnect"}},C.prototype.send=function(d){if(this.sendRequest){this.pendingItems=this.pendingItems||[],this.pendingItems.push(d);return}var c=this.pendingItems||[];c.push(d),this.pendingItems=null,this.sendItems(c)},C.prototype.sendAnyPending=function(){var d=this.pendingItems;d&&(this.pendingItems=null,this.sendItems(d))},C.prototype.sendItems=function(d){var c=this,u=this.sendRequest=this.createRequest(this.sendUri,null,this.authParams,this.encodeRequest(d),f.default.REQ_SEND);u.on("complete",function(s,w){if(s&&m.default.logAction(m.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&&b.default.Config.nextTick(function(){c.sendRequest||c.sendAnyPending()})}),u.exec()},C.prototype.recv=function(){var d=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){d.onData(u)}),c.on("complete",function(u){if(d.recvRequest=null,d.onActivity(),u){u.code?d.onData(x(u)):d.disconnect(u);return}b.default.Config.nextTick(function(){d.recv()})}),c.exec()}},C.prototype.onData=function(d){try{var c=this.decodeResponse(d);if(c&&c.length)for(var u=0;u<c.length;u++)this.onProtocolMessage(l.default.fromDeserialized(c[u]))}catch(s){m.default.logAction(m.default.LOG_ERROR,"CometTransport.onData()","Unexpected exception handing channel event: "+s.stack)}},C.prototype.encodeRequest=function(d){return JSON.stringify(d)},C.prototype.decodeResponse=function(d){return typeof d=="string"?JSON.parse(d):d},C}(h.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)),h=o.__importDefault(i(2)),m=o.__importDefault(i(18)),S=o.__importDefault(i(19)),E=i(4),y=o.__importDefault(i(14));function R(g,C,d,c,u){g.http.supportsAuthHeaders?g.auth.getAuthHeaders(function(s,w){s?c(s):u(l.mixin(w,C),d)}):g.auth.getAuthParams(function(s,w){s?c(s):u(C,l.mixin(w,d))})}function f(g,C){return function(d,c,u,s,w){if(d&&!c){g(d);return}if(w===y.default.NoContent){g(d,[],u,!0,w);return}if(!s)try{c=l.decodeBody(c,C)}catch(I){l.isErrorInfoOrPartialErrorInfo(I)?g(I):g(new E.PartialErrorInfo(l.inspectError(I),null));return}if(!c){g(new E.PartialErrorInfo("unenvelope(): Response body is missing",null));return}var v=c,k=v.statusCode,L=v.response,N=v.headers;if(k===void 0){g(d,c,u,!0,w);return}if(k<200||k>=300){var P=L&&L.error||d;P||(P=new Error("Error in unenveloping "+c),P.statusCode=k),g(P,L,N,!0,k);return}g(d,L,N,!0,k)}}function b(g){var C=[];if(g)for(var d in g)C.push(d+"="+g[d]);return C.join("&")}function T(g,C){return g+(C?"?":"")+b(C)}function x(g,C,d,c){return function(u,s,w,v,k){u?h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Received Error; "+T(d,c)+"; Error: "+l.inspectError(u)):h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Received; "+T(d,c)+"; Headers: "+b(w)+"; StatusCode: "+k+"; Body: "+(a.default.BufferUtils.isBuffer(s)?s.toString():s)),g&&g(u,s,w,v,k)}}var p=function(){function g(){}return g.get=function(C,d,c,u,s,w){g.do(S.default.Get,C,d,null,c,u,s,w)},g.delete=function(C,d,c,u,s,w){g.do(S.default.Delete,C,d,null,c,u,s,w)},g.post=function(C,d,c,u,s,w,v){g.do(S.default.Post,C,d,c,u,s,w,v)},g.patch=function(C,d,c,u,s,w,v){g.do(S.default.Patch,C,d,c,u,s,w,v)},g.put=function(C,d,c,u,s,w,v){g.do(S.default.Put,C,d,c,u,s,w,v)},g.do=function(C,d,c,u,s,w,v,k){h.default.shouldLog(h.default.LOG_MICRO)&&(k=x(k,C,c,w)),v&&(k=k&&f(k,v),(w=w||{}).envelope=v);function L(N,P){var I;if(h.default.shouldLog(h.default.LOG_MICRO)&&h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Sending; "+T(c,P)),h.default.shouldLog(h.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){h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Sending MsgPack Decoding Error: "+l.inspectError(A))}h.default.logAction(h.default.LOG_MICRO,"Resource."+C+"()","Sending; "+T(c,P)+"; Body: "+M)}d.http.do(C,d,c,N,u,P,function(A,j,U,z,W){if(A&&m.default.isTokenErr(A)){d.auth.authorize(null,null,function(G){if(G){k(G);return}R(d,N,P,k,L)});return}k(A,j,U,z,W)})}R(d,s,w,k,L)},g}();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)),h=o.__importDefault(i(9)),m=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,b){var T=[];b&&(R=m.decodeBody(R,b));for(var x=0;x<R.length;x++){var p=T[x]=y.fromValues(R[x],!0);try{y.decode(p,f)}catch(g){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromResponseBody()",g.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,b=new Array(f),T=0;T<f;T++)b[T]=y.fromValues(R[T]);return b},y.fromEncoded=function(R,f){var b=y.fromValues(R,!0);try{y.decode(b,f!=null?f:{})}catch(T){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromEncoded()",T.toString())}return b},y.fromEncodedArray=function(R,f){return R.map(function(b){return y.fromEncoded(b,f)})},y.fromData=function(R){return R instanceof y?R:y.fromValues({data:R})},y.Actions=["absent","present","enter","leave","update"],y.encode=h.default.encode,y.decode=h.default.decode,y.getMessagesSize=h.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)),h=a.__importDefault(i(7)),m=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,k){return l.arrIn(l.allToLowerCase(l.keysArray(k)),"x-ably-errorcode")}function b(v,k){if(f(v,k))return v.error&&m.default.fromValues(v.error)}var T=function(){},x=0,p={},g=typeof o!="undefined"&&o.XDomainRequest;function C(){var v=navigator.userAgent.toString().match(/MSIE\s([\d.]+)/);return v&&Number(v[1])}function d(){var v;return g&&(v=C())&&v===10}function c(v,k){return v.getResponseHeader&&v.getResponseHeader(k)}function u(v){return v.getResponseHeader&&(v.getResponseHeader("transfer-encoding")||!v.getResponseHeader("content-length"))}function s(v){for(var k=l.trim(v.getAllResponseHeaders()).split(`\r
|
|
138
|
-
`),L={},N=0;N<k.length;N++){var P=k[N].split(":").map(l.trim);L[P[0].toLowerCase()]=P[1]}return L}var w=function(v){a.__extends(k,v);function k(L,N,P,I,M,A,j){var U=v.call(this)||this;return P=P||{},P.rnd=l.cheapRandStr(),
|
|
139
|
-
`,_))>-1;)$e=Z.slice(_,De),_=De+1,re($e)}var re=function(Z){try{Z=JSON.parse(Z)}catch(ye){L.complete(new m.PartialErrorInfo("Malformed response body from server: "+ye.message,null,400));return}L.emit("data",Z)},ce=function(){te(),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),X()),Z==3&&O?te():Z==4&&(O?ce():Y()))},A.send(U)},k.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]},k}(h.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)),h=o.__importDefault(i(24)),m=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)),b=o.__importDefault(i(15)),T=Math.pow(2,17);function x(){}function p(){return("000000"+Math.floor(Math.random()*1e16)).slice(-16)}function g(P){return!!P.connection}function C(P){return l.isErrorInfoOrPartialErrorInfo(P)?(P.code||(P.statusCode===403?P.code=40300:(P.code=40170,P.statusCode=401)),P):new m.default(l.inspectError(P),P.code||40170,P.statusCode||401)}var d=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 k=0;function L(){return k++}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&&!d){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 m.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 m.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,W){if(z){j.client.connection&&z.statusCode===R.default.Forbidden&&j.client.connection.connectionManager.actOnErrorFromAuthorize(z),A==null||A(z);return}g(j.client)?j.client.connection.connectionManager.onAuthUpdated(W,A||x):A==null||A(null,W)})},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,W=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(_,$){var X=l.mixin({accept:"application/json, text/plain"},M.authHeaders),Y=M.authMethod&&M.authMethod.toLowerCase()==="post",te,re=M.authUrl.indexOf("?");re>-1&&(te=l.parseQueryString(M.authUrl.slice(re)),M.authUrl=M.authUrl.slice(0,re),Y||(M.authParams=l.mixin(te,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 $($e,Ae);if(f.default.BufferUtils.isBuffer(Ae)&&(Ae=Ae.toString()),!xt){$(new m.default("authUrl response is missing a content-type header",40170,401));return}var bo=xt.indexOf("application/json")>-1,el=xt.indexOf("text/plain")>-1||xt.indexOf("application/jwt")>-1;if(!bo&&!el){$(new m.default("authUrl responded with unacceptable content-type "+xt+", should be either text/plain, application/jwt or application/json",40170,401));return}if(bo){if(Ae.length>T){$(new m.default("authUrl response exceeded max permitted length",40170,401));return}try{Ae=JSON.parse(Ae)}catch(tl){$(new m.default("Unexpected error processing authURL response; err = "+tl.message,40170,401));return}}$(null,Ae,xt)};if(a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Requesting token from "+M.authUrl+"; Params: "+JSON.stringify(ce)+"; method: "+(Y?"POST":"GET")),Y){var ye=X||{};ye["content-type"]="application/x-www-form-urlencoded";var De=l.toQueryString(ce).slice(1);j.client.http.doUri(y.default.Post,W,M.authUrl,ye,De,te,Z)}else j.client.http.doUri(y.default.Get,W,M.authUrl,X||{},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(_,$){j.createTokenRequest(_,M,$)};else{var G="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 m.default(G,40171,403));return}"capability"in I&&(I.capability=c(I.capability));var F=function(_,$){var X=_.keyName,Y="/keys/"+X+"/requestToken",te=function(ce){return W.baseUri(ce)+Y},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 "+Y+"; Token params: "+JSON.stringify(_)),j.client.http.do(y.default.Post,W,te,re,JSON.stringify(_),null,$)},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 m.default(_,40170,401))},D);z(I,function(_,$,X){if(!O){if(clearTimeout(B),_){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request signing call returned error; err = "+l.inspectError(_)),U(C(_));return}if(typeof $=="string"){$.length===0?U(new m.default("Token string is empty",40170,401)):$.length>T?U(new m.default("Token string exceeded max permitted length (was "+$.length+" bytes)",40170,401)):$==="undefined"||$==="null"?U(new m.default("Token string was literal null/undefined",40170,401)):$[0]==="{"&&!(X&&X.indexOf("application/jwt")>-1)?U(new m.default("Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details",40170,401)):U(null,{token:$});return}if(typeof $!="object"){var Y="Expected token request callback to call back with a token string or token request/details object, but got a "+typeof $;a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",Y),U(new m.default(Y,40170,401));return}var te=JSON.stringify($).length;if(te>T&&!M.suppressMaxLengthCheck){U(new m.default("Token request/details object exceeded max permitted stringified size (was "+te+" bytes)",40170,401));return}if("issued"in $){U(null,$);return}if(!("keyName"in $)){var Y="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()",Y),U(new m.default(Y,40170,401));return}F($,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(C(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 m.default("No key specified",40101,403));return}var z=U.split(":"),W=z[0],G=z[1];if(!G){A(new m.default("Invalid key specified",40101,403));return}if(I.clientId===""){A(new m.default("clientId can’t be an empty string",40012,400));return}"capability"in I&&(I.capability=c(I.capability));var F=l.mixin({keyName:W},I),O=I.clientId||"",D=I.ttl||"",B=I.capability||"";(function(_){if(F.timestamp){_();return}j.getTimestamp(M&&M.queryTime,function($,X){if($){A($);return}F.timestamp=X,_()})})(function(){var _=F.nonce||(F.nonce=p()),$=F.timestamp,X=F.keyName+`
|
|
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 m(I,M,A,j){var U=arguments.length,z=U<3?M:j===null?j=Object.getOwnPropertyDescriptor(M,A):j,W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(I,M,A,j);else for(var G=I.length-1;G>=0;G--)(W=I[G])&&(z=(U<3?W(z):U>3?W(M,A,z):W(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(W){W(z)})}return new(A||(A=Promise))(function(z,W){function G(D){try{O(j.next(D))}catch(B){W(B)}}function F(D){try{O(j.throw(D))}catch(B){W(B)}}function O(D){D.done?z(D.value):U(D.value).then(G,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,W;return W={next:G(0),throw:G(1),return:G(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function G(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 b(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=[],W;try{for(;(M===void 0||M-- >0)&&!(U=j.next()).done;)z.push(U.value)}catch(G){W={error:G}}finally{try{U&&!U.done&&(A=j.return)&&A.call(j)}finally{if(W)throw W.error}}return z}function p(){for(var I=[],M=0;M<arguments.length;M++)I=I.concat(x(arguments[M]));return I}function g(){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],W=0,G=z.length;W<G;W++,U++)j[U]=z[W];return j}function C(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={},W("next"),W("throw"),W("return"),U[Symbol.asyncIterator]=function(){return this},U;function W(_){j[_]&&(U[_]=function($){return new Promise(function(X,Y){z.push([_,$,X,Y])>1||G(_,$)})})}function G(_,$){try{F(j[_]($))}catch(X){B(z[0][3],X)}}function F(_){_.value instanceof h?Promise.resolve(_.value.v).then(O,D):B(z[0][2],_)}function O(_){G("next",_)}function D(_){G("throw",_)}function B(_,$){_($),z.shift(),z.length&&G(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(W){return(A=!A)?{value:h(I[U](W)),done:U==="return"}:z?z(W):W}: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(W){return new Promise(function(G,F){W=I[z](W),U(G,F,W.done,W.value)})}}function U(z,W,G,F){Promise.resolve(F).then(function(O){z({value:O,done:G})},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 k(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)),m=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 Ye=Object.prototype.hasOwnProperty;for(var Kr in oe)(!Ye||Ye.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 b(H){return g(H)?[]:(0,r.isArray)(H)?H:[H]}r.ensureArray=b;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 g(H){return H==null}r.isEmptyArg=g;function C(H){var Q=new Object;for(var K in H)Q[K]=H[K];return Q}r.shallowClone=C;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 k(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=k,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 W(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=W;function G(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=G;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 $(H){return l.default.BufferUtils.isBuffer(H)?H.toString():typeof H=="string"?H:l.default.Config.inspect(H)}r.inspectBody=$;function X(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=X;function Y(){return String(Math.random()).substr(2)}r.cheapRandStr=Y;var te=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="",Ye=0;Ye<ee;Ye++)oe+=K[y(K)];return oe};r.randomString=te;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="",Ye=0;Ye<ee;Ye++)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=[],Ye=0;Ye<K;Ye++)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(Ye,Kr){Ye?oe(Ye):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 bo(H){return Math.min((H+2)/3,2)}r.getBackoffCoefficient=bo;function xt(){return 1-Math.random()*.2}r.getJitterCoefficient=xt;function ko(H,Q){return H*bo(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 Qg(H){var Q=/^(\[([^?]*)(?:(.*))\])?(.+)$/,K=H.match(Q);if(!K||!K.length||K.length<5)throw new m.default("regex match failed",400,40010);if(K[2])throw new m.default("cannot use a derived option with a ".concat(K[2]," channel"),400,40010);return{qualifierParam:K[3]||"",channelName:K[4]}}r.matchDerivedChannel=Qg;function Kg(H){return l.default.Config.createHmac?Buffer.from(H,"ascii").toString("base64"):(0,S.stringify)((0,E.parse)(H))}r.toBase64=Kg;function Jg(H,Q){return H.length===Q.length&&(0,r.arrEvery)(H,function(K,ee){return K===Q[ee]})}r.arrEquals=Jg}).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),m;(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"})(m||(m={}));function S(f,b){return"".concat(f).padStart(b?3:2,"0")}function E(f){return l.default.Config.logTimestamps?function(b){var T=new Date;f(S(T.getHours())+":"+S(T.getMinutes())+":"+S(T.getSeconds())+"."+S(T.getMilliseconds(),1)+" "+b)}:f}var y=function(){var f,b,T,x;return typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"||typeof((b=(f=d==null?void 0:d.console)===null||f===void 0?void 0:f.log)===null||b===void 0?void 0:b.apply)=="function"?(T=function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];console.log.apply(console,p)},x=console.warn?function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];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 b=y(),T=b[0],x=b[1];this.logHandler=T,this.logErrorHandler=x},f.renamedClientOption=function(b,T){f.deprecationWarning("The `".concat(b,"` client option has been renamed to `").concat(T,"`. Please update your code to use `").concat(T,"` instead. `").concat(b,"` will be removed in a future version."))},f.renamedMethod=function(b,T,x){f.deprecationWarning("`".concat(b,"`’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(b){f.shouldLog(m.Error)&&f.logErrorHandler("Ably: Deprecation warning - ".concat(b))},f.logLevel=m.Error,f.LOG_NONE=m.None,f.LOG_ERROR=m.Error,f.LOG_MAJOR=m.Major,f.LOG_MINOR=m.Minor,f.LOG_MICRO=m.Micro,f.LOG_DEFAULT=m.Error,f.LOG_DEBUG=m.Micro,f.logAction=function(b,T,x){f.shouldLog(b)&&(b===m.Error?f.logErrorHandler:f.logHandler)("Ably: "+T+": "+x)},f.deprecated=function(b,T){f.deprecationWarning("".concat(b," is deprecated and will be removed in a future version. ").concat(T))},f.shouldLog=function(b){return b<=f.logLevel},f.setLog=function(b,T){b!==void 0&&(f.logLevel=b),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 m=function(E){o.__extends(y,E);function y(R,f,b,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=b,x.cause=T,x}return y.prototype.toString=function(){return d(this)},y.fromValues=function(R){var f=R,b=f.message,T=f.code,x=f.statusCode;if(typeof b!="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(b,T,x),R);return p.code&&!p.href&&(p.href="https://help.ably.io/error/"+p.code),p},y}(Error);r.default=m;var S=function(E){o.__extends(y,E);function y(R,f,b,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=b,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,m=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;m.call(this,R,y)}else m.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 m;if(typeof window!="undefined"&&window.crypto&&(m=window.crypto),!m&&typeof window!="undefined"&&window.msCrypto&&(m=window.msCrypto),!m&&typeof o!="undefined"&&o.crypto&&(m=o.crypto),!m)try{m=i(44)}catch(c){}var S=function(){if(m){if(typeof m.getRandomValues=="function")try{return m.getRandomValues(new Uint32Array(1))[0]}catch(c){}if(typeof m.randomBytes=="function")try{return m.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)}}}(),b=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 k=0;k<v;k++){var L=s[k>>>2]>>>24-k%4*8&255;u[w+k>>>2]|=L<<24-(w+k)%4*8}else for(var k=0;k<v;k+=4)u[w+k>>>2]=s[k>>>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 b.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 k=u[v>>>2]>>>24-v%4*8&255;w.push((k>>>4).toString(16)),w.push((k&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 b.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 k=u[v>>>2]>>>24-v%4*8&255;w.push(String.fromCharCode(k))}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 b.init(s,u)}},g=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)))}},C=R.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new b.init,this._nDataBytes=0},_append:function(c){typeof c=="string"&&(c=g.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes},_process:function(c){var u,s=this._data,w=s.words,v=s.sigBytes,k=this.blockSize,L=k*4,N=v/L;c?N=l.ceil(N):N=l.max((N|0)-this._minBufferSize,0);var P=N*k,I=l.min(P*4,v);if(P){for(var M=0;M<P;M+=k)this._doProcessBlock(w,M);u=w.splice(0,P),s.sigBytes-=I}return new b.init(u,I)},clone:function(){var c=f.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});R.Hasher=C.extend({cfg:f.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset()},reset:function(){C.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 m(y,R,f){try{R.apply(y,f)}catch(b){l.default.logAction(l.default.LOG_ERROR,"EventEmitter.emit()","Unexpected listener exception: "+b+"; stack = "+(b&&b.stack))}}function S(y,R,f){for(var b,T,x,p=0;p<y.length;p++)if(b=y[p],f&&(b=b[f]),a.isArray(b)){for(;(T=a.arrIndexOf(b,R))!==-1;)b.splice(T,1);f&&b.length===0&&delete y[p][f]}else if(a.isObject(b))for(x in b)Object.prototype.hasOwnProperty.call(b,x)&&a.isArray(b[x])&&S([b],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=[],b=0;b<arguments.length;b++)f[b]=arguments[b];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(C){R.on(C,p)});else{if(typeof x!="string")throw new Error("EventListener.on(): Invalid arguments: "+d.default.Config.inspect(f));var g=this.events[x]||(this.events[x]=[]);g.push(p)}}},y.prototype.off=function(){for(var R,f=this,b=[],T=0;T<arguments.length;T++)b[T]=arguments[T];if(b.length==0||a.isEmptyArg(b[0])&&a.isEmptyArg(b[1])){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null);return}var x=b[0],p=b[1],g=null,C=null;if(b.length===1||!p)typeof x=="function"?g=x:C=x;else{if(typeof p!="function")throw new Error("EventEmitter.off(): invalid arguments:"+d.default.Config.inspect(b));R=[x,p],C=R[0],g=R[1]}if(g&&a.isEmptyArg(C)){S([this.any,this.events,this.anyOnce,this.eventsOnce],g);return}if(a.isArray(C)){C.forEach(function(h){f.off(h,g)});return}if(typeof C!="string")throw new Error("EventEmitter.off(): invalid arguments:"+d.default.Config.inspect(b));g?S([this.events,this.eventsOnce],g,C):(delete this.events[C],delete this.eventsOnce[C])},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=[],b=1;b<arguments.length;b++)f[b-1]=arguments[b];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 g=this.events[R];g&&Array.prototype.push.apply(x,g),a.arrForEach(x,function(C){m(T,C,f)})},y.prototype.once=function(){for(var R=this,f=[],b=0;b<arguments.length;b++)f[b]=arguments[b];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],g=f[1];if(f.length===1&&typeof p=="function")this.anyOnce.push(p);else if(a.isEmptyArg(p)){if(typeof g!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));this.anyOnce.push(g)}else if(a.isArray(p)){var C=this,h=function(){var u=Array.prototype.slice.call(arguments);if(a.arrForEach(p,function(s){C.off(s,h)}),typeof g!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));g.apply(this,u)};a.arrForEach(p,function(u){C.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(g){if(typeof g!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));c.push(g)}}},y.prototype.whenState=function(R,f,b){for(var T=this,x=[],p=3;p<arguments.length;p++)x[p-3]=arguments[p];var g={event:R};if(typeof R!="string"||typeof f!="string")throw"whenState requires a valid event String argument";if(typeof b!="function"&&d.default.Config.Promise)return new d.default.Config.Promise(function(C){y.prototype.whenState.apply(T,[R,f,C].concat(x))});R===f?m(g,b,x):this.once(R,b)},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)),m=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:b,environmentFallbackHosts:T,getFallbackHosts:x,getHosts:p,checkHost:g,objectifyOptions:u,normaliseOptions:s};function R(v,k,L){return L?k=k==v.restHost&&v.realtimeHost||k||v.realtimeHost:k=k||v.restHost,k}r.getHost=R;function f(v,k){return k||v.tls?v.tlsPort:v.port}r.getPort=f;function b(v){return v.tls?"https://":"http://"}r.getHttpScheme=b;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 k=v.fallbackHosts,L=typeof v.httpMaxRetryCount!="undefined"?v.httpMaxRetryCount:y.httpMaxRetryCount;return k?l.arrChooseN(k,L):[]}r.getFallbackHosts=x;function p(v){return[v.restHost].concat(x(v))}r.getHosts=p;function g(v){if(typeof v!="string")throw new m.default("host must be a string; was a "+typeof v,4e4,400);if(!v.length)throw new m.default("host must not be zero-length",4e4,400)}function C(v,k,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):k?y.REALTIME_HOST:L+"-"+y.REALTIME_HOST}function h(v){var k={};for(var L in y.TIMEOUTS)k[L]=v[L]||y.TIMEOUTS[L];return k}function c(v){var k=y.agent;if(v.agents)for(var L in v.agents)k+=" "+L+"/"+v.agents[L];return k}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 k="fallbackHosts and fallbackHostsUseDefault cannot both be set";throw d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions",k),new m.default(k,4e4,400)}if(v.port||v.tlsPort){var k="fallbackHostsUseDefault cannot be set when port or tlsPort are set";throw d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions",k),new m.default(k,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=C(v,N,L);l.arrForEach((v.fallbackHosts||[]).concat(P,I),g),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("?"),W=z[0],G=z[1];j=G?l.parseQueryString(G):{},W.indexOf("://")===-1&&(W="https://"+W),U=W}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)),m=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 b=a.default.Crypto.getCipher(f.cipher);return{cipher:b.cipherParams,channelCipher:b.cipher}}return f!=null?f:{}}function y(f){var b=0;return f.name&&(b+=f.name.length),f.clientId&&(b+=f.clientId.length),f.extras&&(b+=JSON.stringify(f.extras).length),f.data&&(b+=m.dataSizeBytes(f.data)),b}var R=function(){function f(){}return f.prototype.toJSON=function(){var b=this.encoding,T=this.data;return T&&a.default.BufferUtils.isBuffer(T)&&(arguments.length>0?(b=b?b+"/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:b,data:T}},f.prototype.toString=function(){var b="[Message";return this.name&&(b+="; name="+this.name),this.id&&(b+="; id="+this.id),this.timestamp&&(b+="; timestamp="+this.timestamp),this.clientId&&(b+="; clientId="+this.clientId),this.connectionId&&(b+="; connectionId="+this.connectionId),this.encoding&&(b+="; encoding="+this.encoding),this.extras&&(b+="; extras ="+JSON.stringify(this.extras)),this.data&&(typeof this.data=="string"?b+="; data="+this.data:a.default.BufferUtils.isBuffer(this.data)?b+="; data (buffer)="+a.default.BufferUtils.base64Encode(this.data):b+="; data (json)="+JSON.stringify(this.data)),this.extras&&(b+="; extras="+JSON.stringify(this.extras)),b+="]",b},f.encrypt=function(b,T,x){var p=b.data,g=b.encoding,C=T.channelCipher;g=g?g+"/":"",a.default.BufferUtils.isBuffer(p)||(p=a.default.BufferUtils.utf8Encode(String(p)),g=g+"utf-8/"),C.encrypt(p,function(h,c){if(h){x(h);return}b.data=c,b.encoding=g+"cipher+"+C.algorithm,x(null,b)})},f.encode=function(b,T,x){var p=b.data,g=typeof p=="string"||a.default.BufferUtils.isBuffer(p)||p===null||p===void 0;if(!g)if(m.isObject(p)||m.isArray(p))b.data=JSON.stringify(p),b.encoding=b.encoding?b.encoding+"/json":"json";else throw new d.default("Data type is unsupported",40013,400);T!=null&&T.cipher?f.encrypt(b,T,x):x(null,b)},f.encodeArray=function(b,T,x){for(var p=0,g=0;g<b.length;g++)f.encode(b[g],T,function(C){if(C){x(C);return}p++,p==b.length&&x(null,b)})},f.decode=function(b,T){var x=S(T),p=b.data,g=b.encoding;if(g){var C=g.split("/"),h=void 0,c=C.length,u=b.data,s="";try{for(;(h=c)>0;){var w=C[--c].match(/([-\w]+)(\+([\w-]+))?/);if(!w)break;switch(s=w[1],s){case"base64":u=a.default.BufferUtils.base64Decode(String(u)),h==C.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],k=x.channelOptions.channelCipher;if(v!=k.algorithm)throw new Error("Unable to decrypt message with given cipher; incompatible cipher params");u=k.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{b.encoding=h<=0?null:C.slice(0,h).join("/"),b.data=u}}x.baseEncodedPreviousPayload=p},f.fromResponseBody=function(b,T,x){x&&(b=m.decodeBody(b,x));for(var p=0;p<b.length;p++){var g=b[p]=f.fromValues(b[p]);try{f.decode(g,T)}catch(C){l.default.logAction(l.default.LOG_ERROR,"Message.fromResponseBody()",C.toString())}}return b},f.fromValues=function(b){return Object.assign(new f,b)},f.fromValuesArray=function(b){for(var T=b.length,x=new Array(T),p=0;p<T;p++)x[p]=f.fromValues(b[p]);return x},f.fromEncoded=function(b,T){var x=f.fromValues(b),p=E(T!=null?T:null);try{f.decode(x,p)}catch(g){l.default.logAction(l.default.LOG_ERROR,"Message.fromEncoded()",g.toString())}return x},f.fromEncodedArray=function(b,T){return b.map(function(x){return f.fromEncoded(x,T)})},f.getMessagesSize=function(b){for(var T,x=0,p=0;p<b.length;p++)T=b[p],x+=T.size||(T.size=y(T));return x},f.serialize=m.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)),m=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 g=0;g<x.length;g++)p.push(x[g].toString());return"[ "+p.join(", ")+" ]"}var b="id channel channelSerial connectionId count msgSerial timestamp".split(" "),T=function(){function x(){var p=this;this.hasFlag=function(g){return(p.flags&y[g])>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 g=this;p.forEach(function(C){return g.setFlag(C)})},x.prototype.decodeModesFromFlags=function(){var p=this,g=[];return x.channelModes.forEach(function(C){p.hasFlag(C)&&g.push(C)}),g.length>0?g: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,g){var C=a.decodeBody(p,g);return x.fromDeserialized(C)},x.fromDeserialized=function(p){var g=p.error;g&&(p.error=l.default.fromValues(g));var C=p.messages;if(C)for(var h=0;h<C.length;h++)C[h]=d.default.fromValues(C[h]);var c=p.presence;if(c)for(var h=0;h<c.length;h++)c[h]=m.default.fromValues(c[h],!0);return Object.assign(new x,p)},x.stringify=function(p){var g="[ProtocolMessage";p.action!==void 0&&(g+="; action="+x.ActionName[p.action]||!1);for(var C,h=0;h<b.length;h++)C=b[h],p[C]!==void 0&&(g+="; "+C+"="+p[C]);if(p.messages&&(g+="; messages="+f(d.default.fromValuesArray(p.messages))),p.presence&&(g+="; presence="+f(m.default.fromValuesArray(p.presence))),p.error&&(g+="; error="+l.default.fromValues(p.error).toString()),p.auth&&p.auth.accessToken&&(g+="; token="+p.auth.accessToken),p.flags&&(g+="; 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&&(g+="; params=["+c+"]")}return g+="]",g},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,m=a.enc;m.Base64={stringify:function(E){var y=E.words,R=E.sigBytes,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";E.clamp();for(var b=[],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,g=y[T+2>>>2]>>>24-(T+2)%4*8&255,C=x<<16|p<<8|g,h=0;h<4&&T+h*.75<R;h++)b.push(f.charAt(C>>>6*(3-h)&63));var c=f.charAt(64);if(c)for(;b.length%4;)b.push(c);return b.join("")},parse:function(E){var y=E.length,R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var b=0;b<R.length;b++)f[R.charCodeAt(b)]=b}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=[],b=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,g=x|p;f[b>>>2]|=g<<24-b%4*8,b++}return d.create(f,b)}}(),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)),m=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)),b=o.__importDefault(i(3));function T(g){var C=[80015,80017,80030];return g.code?y.default.isTokenErr(g)?!1:a.arrIn(C,g.code)?!0:g.code>=4e4&&g.code<5e4:!1}function x(g){return T(g)?[l.default.fromValues({action:l.default.Action.ERROR,error:g})]:[l.default.fromValues({action:l.default.Action.DISCONNECTED,error:g})]}var p=function(g){o.__extends(C,g);function C(h,c,u){var s=g.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 C.prototype.connect=function(){var h=this;m.default.logAction(m.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 k=this.baseUri+"connect";m.default.logAction(m.default.LOG_MINOR,"CometTransport.connect()","uri: "+k),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),m.default.logAction(m.default.LOG_MINOR,"CometTransport.connect()","connectParams:"+a.toQueryString(P));var I=!1,M=h.recvRequest=h.createRequest(k,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}b.default.Config.nextTick(function(){h.recv()})}),M.exec()}})},C.prototype.requestClose=function(){m.default.logAction(m.default.LOG_MINOR,"CometTransport.requestClose()"),this._requestCloseOrDisconnect(!0)},C.prototype.requestDisconnect=function(){m.default.logAction(m.default.LOG_MINOR,"CometTransport.requestDisconnect()"),this._requestCloseOrDisconnect(!1)},C.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&&(m.default.logAction(m.default.LOG_ERROR,"CometTransport.request"+(h?"Close()":"Disconnect()"),"request returned err = "+a.inspectError(w)),c.finish("disconnected",w))}),s.exec()}},C.prototype.dispose=function(){var h=this;m.default.logAction(m.default.LOG_MINOR,"CometTransport.dispose()",""),this.isDisposed||(this.isDisposed=!0,this.recvRequest&&(m.default.logAction(m.default.LOG_MINOR,"CometTransport.dispose()","aborting recv request"),this.recvRequest.abort(),this.recvRequest=null),this.finish("disconnected",E.default.disconnected()),b.default.Config.nextTick(function(){h.emit("disposed")}))},C.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;m.default.logAction(m.default.LOG_MICRO,"CometTransport.onConnect()","baseUri = "+s),this.sendUri=s+"/send",this.recvUri=s+"/recv",this.closeUri=s+"/close",this.disconnectUri=s+"/disconnect"}},C.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)},C.prototype.sendAnyPending=function(){var h=this.pendingItems;h&&(this.pendingItems=null,this.sendItems(h))},C.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&&m.default.logAction(m.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&&b.default.Config.nextTick(function(){c.sendRequest||c.sendAnyPending()})}),u.exec()},C.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}b.default.Config.nextTick(function(){h.recv()})}),c.exec()}},C.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){m.default.logAction(m.default.LOG_ERROR,"CometTransport.onData()","Unexpected exception handing channel event: "+s.stack)}},C.prototype.encodeRequest=function(h){return JSON.stringify(h)},C.prototype.decodeResponse=function(h){return typeof h=="string"?JSON.parse(h):h},C}(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)),m=o.__importDefault(i(18)),S=o.__importDefault(i(19)),E=i(4),y=o.__importDefault(i(14));function R(g,C,h,c,u){g.http.supportsAuthHeaders?g.auth.getAuthHeaders(function(s,w){s?c(s):u(l.mixin(w,C),h)}):g.auth.getAuthParams(function(s,w){s?c(s):u(C,l.mixin(w,h))})}function f(g,C){return function(h,c,u,s,w){if(h&&!c){g(h);return}if(w===y.default.NoContent){g(h,[],u,!0,w);return}if(!s)try{c=l.decodeBody(c,C)}catch(I){l.isErrorInfoOrPartialErrorInfo(I)?g(I):g(new E.PartialErrorInfo(l.inspectError(I),null));return}if(!c){g(new E.PartialErrorInfo("unenvelope(): Response body is missing",null));return}var v=c,k=v.statusCode,L=v.response,N=v.headers;if(k===void 0){g(h,c,u,!0,w);return}if(k<200||k>=300){var P=L&&L.error||h;P||(P=new Error("Error in unenveloping "+c),P.statusCode=k),g(P,L,N,!0,k);return}g(h,L,N,!0,k)}}function b(g){var C=[];if(g)for(var h in g)C.push(h+"="+g[h]);return C.join("&")}function T(g,C){return g+(C?"?":"")+b(C)}function x(g,C,h,c){return function(u,s,w,v,k){u?d.default.logAction(d.default.LOG_MICRO,"Resource."+C+"()","Received Error; "+T(h,c)+"; Error: "+l.inspectError(u)):d.default.logAction(d.default.LOG_MICRO,"Resource."+C+"()","Received; "+T(h,c)+"; Headers: "+b(w)+"; StatusCode: "+k+"; Body: "+(a.default.BufferUtils.isBuffer(s)?s.toString():s)),g&&g(u,s,w,v,k)}}var p=function(){function g(){}return g.get=function(C,h,c,u,s,w){g.do(S.default.Get,C,h,null,c,u,s,w)},g.delete=function(C,h,c,u,s,w){g.do(S.default.Delete,C,h,null,c,u,s,w)},g.post=function(C,h,c,u,s,w,v){g.do(S.default.Post,C,h,c,u,s,w,v)},g.patch=function(C,h,c,u,s,w,v){g.do(S.default.Patch,C,h,c,u,s,w,v)},g.put=function(C,h,c,u,s,w,v){g.do(S.default.Put,C,h,c,u,s,w,v)},g.do=function(C,h,c,u,s,w,v,k){d.default.shouldLog(d.default.LOG_MICRO)&&(k=x(k,C,c,w)),v&&(k=k&&f(k,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."+C+"()","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."+C+"()","Sending MsgPack Decoding Error: "+l.inspectError(A))}d.default.logAction(d.default.LOG_MICRO,"Resource."+C+"()","Sending; "+T(c,P)+"; Body: "+M)}h.http.do(C,h,c,N,u,P,function(A,j,U,z,W){if(A&&m.default.isTokenErr(A)){h.auth.authorize(null,null,function(G){if(G){k(G);return}R(h,N,P,k,L)});return}k(A,j,U,z,W)})}R(h,s,w,k,L)},g}();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)),m=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,b){var T=[];b&&(R=m.decodeBody(R,b));for(var x=0;x<R.length;x++){var p=T[x]=y.fromValues(R[x],!0);try{y.decode(p,f)}catch(g){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromResponseBody()",g.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,b=new Array(f),T=0;T<f;T++)b[T]=y.fromValues(R[T]);return b},y.fromEncoded=function(R,f){var b=y.fromValues(R,!0);try{y.decode(b,f!=null?f:{})}catch(T){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromEncoded()",T.toString())}return b},y.fromEncodedArray=function(R,f){return R.map(function(b){return y.fromEncoded(b,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)),m=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,k){return l.arrIn(l.allToLowerCase(l.keysArray(k)),"x-ably-errorcode")}function b(v,k){if(f(v,k))return v.error&&m.default.fromValues(v.error)}var T=function(){},x=0,p={},g=typeof o!="undefined"&&o.XDomainRequest;function C(){var v=navigator.userAgent.toString().match(/MSIE\s([\d.]+)/);return v&&Number(v[1])}function h(){var v;return g&&(v=C())&&v===10}function c(v,k){return v.getResponseHeader&&v.getResponseHeader(k)}function u(v){return v.getResponseHeader&&(v.getResponseHeader("transfer-encoding")||!v.getResponseHeader("content-length"))}function s(v){for(var k=l.trim(v.getAllResponseHeaders()).split(`\r
|
|
138
|
+
`),L={},N=0;N<k.length;N++){var P=k[N].split(":").map(l.trim);L[P[0].toLowerCase()]=P[1]}return L}var w=function(v){a.__extends(k,v);function k(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 k.createRequest=function(L,N,P,I,M,A,j){var U=A||E.default.TIMEOUTS;return new k(L,N,l.copy(P),I,M,U,j)},k.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())},k.prototype.abort=function(){this.dispose()},k.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 W=N["content-type"]||(N["content-type"]="application/json");W.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 G in N)A.setRequestHeader(G,N[G]);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 m.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,$=!1,X=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)},Y=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,$=!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 m.PartialErrorInfo("Malformed response body from server: "+zt.message,null,400));return}if(B||l.isArray(Z)){L.complete(null,Z,N,$,D);return}var Ae=b(Z,N);Ae||(Ae=new m.PartialErrorInfo("Error response received from server: "+D+" body was: "+R.default.Config.inspect(Z),null,D)),L.complete(Ae,Z,N,$,D)};function te(){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 m.PartialErrorInfo("Malformed response body from server: "+ye.message,null,400));return}L.emit("data",Z)},ce=function(){te(),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),X()),Z==3&&O?te():Z==4&&(O?ce():Y()))},A.send(U)},k.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]},k}(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)),m=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)),b=o.__importDefault(i(15)),T=Math.pow(2,17);function x(){}function p(){return("000000"+Math.floor(Math.random()*1e16)).slice(-16)}function g(P){return!!P.connection}function C(P){return l.isErrorInfoOrPartialErrorInfo(P)?(P.code||(P.statusCode===403?P.code=40300:(P.code=40170,P.statusCode=401)),P):new m.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 k=0;function L(){return k++}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 m.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 m.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,W){if(z){j.client.connection&&z.statusCode===R.default.Forbidden&&j.client.connection.connectionManager.actOnErrorFromAuthorize(z),A==null||A(z);return}g(j.client)?j.client.connection.connectionManager.onAuthUpdated(W,A||x):A==null||A(null,W)})},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,W=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(_,$){var X=l.mixin({accept:"application/json, text/plain"},M.authHeaders),Y=M.authMethod&&M.authMethod.toLowerCase()==="post",te,re=M.authUrl.indexOf("?");re>-1&&(te=l.parseQueryString(M.authUrl.slice(re)),M.authUrl=M.authUrl.slice(0,re),Y||(M.authParams=l.mixin(te,M.authParams)));var ce=l.mixin({},M.authParams||{},_),Z=function($e,Ae,zt,bo){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||bo)return $($e,Ae);if(f.default.BufferUtils.isBuffer(Ae)&&(Ae=Ae.toString()),!xt){$(new m.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){$(new m.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){$(new m.default("authUrl response exceeded max permitted length",40170,401));return}try{Ae=JSON.parse(Ae)}catch(nl){$(new m.default("Unexpected error processing authURL response; err = "+nl.message,40170,401));return}}$(null,Ae,xt)};if(a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Requesting token from "+M.authUrl+"; Params: "+JSON.stringify(ce)+"; method: "+(Y?"POST":"GET")),Y){var ye=X||{};ye["content-type"]="application/x-www-form-urlencoded";var De=l.toQueryString(ce).slice(1);j.client.http.doUri(y.default.Post,W,M.authUrl,ye,De,te,Z)}else j.client.http.doUri(y.default.Get,W,M.authUrl,X||{},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(_,$){j.createTokenRequest(_,M,$)};else{var G="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 m.default(G,40171,403));return}"capability"in I&&(I.capability=c(I.capability));var F=function(_,$){var X=_.keyName,Y="/keys/"+X+"/requestToken",te=function(ce){return W.baseUri(ce)+Y},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 "+Y+"; Token params: "+JSON.stringify(_)),j.client.http.do(y.default.Post,W,te,re,JSON.stringify(_),null,$)},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 m.default(_,40170,401))},D);z(I,function(_,$,X){if(!O){if(clearTimeout(B),_){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request signing call returned error; err = "+l.inspectError(_)),U(C(_));return}if(typeof $=="string"){$.length===0?U(new m.default("Token string is empty",40170,401)):$.length>T?U(new m.default("Token string exceeded max permitted length (was "+$.length+" bytes)",40170,401)):$==="undefined"||$==="null"?U(new m.default("Token string was literal null/undefined",40170,401)):$[0]==="{"&&!(X&&X.indexOf("application/jwt")>-1)?U(new m.default("Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details",40170,401)):U(null,{token:$});return}if(typeof $!="object"){var Y="Expected token request callback to call back with a token string or token request/details object, but got a "+typeof $;a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",Y),U(new m.default(Y,40170,401));return}var te=JSON.stringify($).length;if(te>T&&!M.suppressMaxLengthCheck){U(new m.default("Token request/details object exceeded max permitted stringified size (was "+te+" bytes)",40170,401));return}if("issued"in $){U(null,$);return}if(!("keyName"in $)){var Y="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()",Y),U(new m.default(Y,40170,401));return}F($,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(C(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 m.default("No key specified",40101,403));return}var z=U.split(":"),W=z[0],G=z[1];if(!G){A(new m.default("Invalid key specified",40101,403));return}if(I.clientId===""){A(new m.default("clientId can’t be an empty string",40012,400));return}"capability"in I&&(I.capability=c(I.capability));var F=l.mixin({keyName:W},I),O=I.clientId||"",D=I.ttl||"",B=I.capability||"";(function(_){if(F.timestamp){_();return}j.getTimestamp(M&&M.queryTime,function($,X){if($){A($);return}F.timestamp=X,_()})})(function(){var _=F.nonce||(F.nonce=p()),$=F.timestamp,X=F.keyName+`
|
|
140
140
|
`+D+`
|
|
141
141
|
`+B+`
|
|
142
142
|
`+O+`
|
|
143
143
|
`+$+`
|
|
144
144
|
`+_+`
|
|
145
|
-
`;F.mac=F.mac||d(X,G),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 m.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=h.default.create())).push(M),!(this.currentTokenRequestId!==null&&!I)){var U=this.currentTokenRequestId=L();this.requestToken(this.tokenParams,this.authOptions,function(z,W){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 G=A.waitingForTokenRequest||x;if(A.waitingForTokenRequest=null,z){G(z);return}G(null,A.tokenDetails=W)})}},P.prototype._userSetClientId=function(I){if(typeof I=="string"||I===null){if(I==="*")throw new m.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 m.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 m.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 m.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,W=o.__assign({targets:I.map(function(D){return"".concat(D.type,":").concat(D.value)})},U),G=this.client.options.useBinaryProtocol?l.Format.msgpack:l.Format.json,F=l.defaultPostHeaders(this.client.options,G);this.client.options.headers&&l.mixin(F,this.client.options.headers);var O=l.encodeBody(W,G);b.default.post(this.client,"/keys/".concat(j,"/revokeTokens"),O,F,{newBatchResponse:"true"},null,function(D,B,_,$){if(D){z(D);return}var X=$?B:l.decodeBody(B,G);z(null,X)})},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)),h=o.__importDefault(i(15)),m=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 g=T[p].match(/^\s*<(.+)>;\s*rel="(\w+)"$/);if(g){var C=S(g[1]);C&&(x[g[2]]=C)}}return x}function y(T,x,p){return!(p&&(x||typeof T.code=="number"))}var R=function(){function T(x,p,g,C,d,c){this.rest=x,this.path=p,this.headers=g,this.envelope=C!=null?C:null,this.bodyHandler=d,this.useHttpPaginatedResponse=c||!1}return T.prototype.get=function(x,p){var g=this;h.default.get(this.rest,this.path,this.headers,x,this.envelope,function(C,d,c,u,s){g.handlePage(C,d,c,u,s,p)})},T.prototype.delete=function(x,p){var g=this;h.default.delete(this.rest,this.path,this.headers,x,this.envelope,function(C,d,c,u,s){g.handlePage(C,d,c,u,s,p)})},T.prototype.post=function(x,p,g){var C=this;h.default.post(this.rest,this.path,p,this.headers,x,this.envelope,function(d,c,u,s,w){g&&C.handlePage(d,c,u,s,w,g)})},T.prototype.put=function(x,p,g){var C=this;h.default.put(this.rest,this.path,p,this.headers,x,this.envelope,function(d,c,u,s,w){g&&C.handlePage(d,c,u,s,w,g)})},T.prototype.patch=function(x,p,g){var C=this;h.default.patch(this.rest,this.path,p,this.headers,x,this.envelope,function(d,c,u,s,w){g&&C.handlePage(d,c,u,s,w,g)})},T.prototype.handlePage=function(x,p,g,C,d,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=d==m.default.NoContent?[]:this.bodyHandler(p,g||{},C)}catch(v){c==null||c(x||v);return}g&&(s=g.Link||g.link)&&(w=E(s)),this.useHttpPaginatedResponse?c(null,new b(this,u,g||{},d,w,x)):c(null,new f(this,u,w))},T}(),f=function(){function T(x,p,g){var C=this;this.resource=x,this.items=p;var d=this;g&&("first"in g&&(this.first=function(c){if(!c&&d.resource.rest.options.promises)return a.promisify(d,"first",[]);d.get(g.first,c)}),"current"in g&&(this.current=function(c){if(!c&&d.resource.rest.options.promises)return a.promisify(d,"current",[]);d.get(g.current,c)}),this.next=function(c){if(!c&&d.resource.rest.options.promises)return a.promisify(d,"next",[]);"next"in g?d.get(g.next,c):c(null,null)},this.hasNext=function(){return"next"in g},this.isLast=function(){var c;return!(!((c=C.hasNext)===null||c===void 0)&&c.call(C))})}return T.prototype.get=function(x,p){var g=this.resource;h.default.get(g.rest,g.path,g.headers,x,g.envelope,function(C,d,c,u,s){g.handlePage(C,d,c,u,s,p)})},T}();r.PaginatedResult=f;var b=function(T){o.__extends(x,T);function x(p,g,C,d,c,u){var s=T.call(this,p,g,c)||this;return s.statusCode=d,s.success=d<300&&d>=200,s.headers=C,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=b,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},h={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 m(S){return!S.statusCode||!S.code||S.statusCode>=500?!0:Object.values(l).includes(S.code)}r.isRetriable=m,r.default=h},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 h(m){this.members=m||[]}return h.prototype.call=function(){for(var m=[],S=0;S<arguments.length;S++)m[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,m)}catch(f){a.default.logAction(a.default.LOG_ERROR,"Multicaster multiple callback handler","Unexpected exception: "+f+"; stack = "+f.stack)}}},h.prototype.push=function(){for(var m,S=[],E=0;E<arguments.length;E++)S[E]=arguments[E];(m=this.members).push.apply(m,S)},h.create=function(m){var S=new h(m);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)}})},h}();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,h=l.Base,m=a.enc,S=m.Utf8,E=a.algo;E.HMAC=h.extend({init:function(y,R){y=this._hasher=new y.init,typeof R=="string"&&(R=S.parse(R));var f=y.blockSize,b=f*4;R.sigBytes>b&&(R=y.finalize(R)),R.clamp();for(var T=this._oKey=R.clone(),x=this._iKey=R.clone(),p=T.words,g=x.words,C=0;C<f;C++)p[C]^=1549556828,g[C]^=909522486;T.sigBytes=x.sigBytes=b,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 b=R.finalize(this._oKey.clone().concat(f));return b}})})()})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(10)),l=o.__importStar(i(1)),h=o.__importDefault(i(7)),m=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}),b=a.default.fromValues({action:R.DISCONNECT}),T=function(x){o.__extends(p,x);function p(g,C,d,c){var u=x.call(this)||this;return c&&(d.format=void 0,d.heartbeats=!0),u.connectionManager=g,g.registerProposedTransport(u),u.auth=C,u.params=d,u.timeouts=d.options.timeouts,u.format=d.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(g){this.isConnected&&this.requestDisconnect(),this.finish("disconnected",g||S.default.disconnected())},p.prototype.fail=function(g){this.isConnected&&this.requestDisconnect(),this.finish("failed",g||S.default.failed())},p.prototype.finish=function(g,C){var d;this.isFinished||(this.isFinished=!0,this.isConnected=!1,this.maxIdleInterval=null,clearTimeout((d=this.idleTimer)!==null&&d!==void 0?d:void 0),this.idleTimer=null,this.emit(g,C),this.dispose())},p.prototype.onProtocolMessage=function(g){switch(m.default.shouldLog(m.default.LOG_MICRO)&&m.default.logAction(m.default.LOG_MICRO,"Transport.onProtocolMessage()","received on "+this.shortName+": "+a.default.stringify(g)+"; connectionId = "+this.connectionManager.connectionId),this.onActivity(),g.action){case R.HEARTBEAT:m.default.logAction(m.default.LOG_MICRO,"Transport.onProtocolMessage()",this.shortName+" heartbeat; connectionId = "+this.connectionManager.connectionId),this.emit("heartbeat",g.id);break;case R.CONNECTED:this.onConnect(g),this.emit("connected",g.error,g.connectionId,g.connectionDetails,g);break;case R.CLOSED:this.onClose(g);break;case R.DISCONNECTED:this.onDisconnect(g);break;case R.ACK:this.emit("ack",g.msgSerial,g.count);break;case R.NACK:this.emit("nack",g.msgSerial,g.count,g.error);break;case R.SYNC:this.connectionManager.onChannelMessage(g,this);break;case R.ACTIVATE:break;case R.AUTH:this.auth.authorize(function(C){C&&m.default.logAction(m.default.LOG_ERROR,"Transport.onProtocolMessage()","Ably requested re-authentication, but unable to obtain a new token: "+l.inspectError(C))});break;case R.ERROR:if(m.default.logAction(m.default.LOG_MINOR,"Transport.onProtocolMessage()","received error action; connectionId = "+this.connectionManager.connectionId+"; err = "+y.default.Config.inspect(g.error)+(g.channel?", channel: "+g.channel:"")),g.channel===void 0){this.onFatalError(g);break}this.connectionManager.onChannelMessage(g,this);break;default:this.connectionManager.onChannelMessage(g,this)}},p.prototype.onConnect=function(g){if(this.isConnected=!0,!g.connectionDetails)throw new Error("Transport.onConnect(): Connect message recieved without connectionDetails");var C=g.connectionDetails.maxIdleInterval;C&&(this.maxIdleInterval=C+this.timeouts.realtimeRequestTimeout,this.onActivity())},p.prototype.onDisconnect=function(g){var C=g&&g.error;m.default.logAction(m.default.LOG_MINOR,"Transport.onDisconnect()","err = "+l.inspectError(C)),this.finish("disconnected",C)},p.prototype.onFatalError=function(g){var C=g&&g.error;m.default.logAction(m.default.LOG_MINOR,"Transport.onFatalError()","err = "+l.inspectError(C)),this.finish("failed",C)},p.prototype.onClose=function(g){var C=g&&g.error;m.default.logAction(m.default.LOG_MINOR,"Transport.onClose()","err = "+l.inspectError(C)),this.finish("closed",C)},p.prototype.requestClose=function(){m.default.logAction(m.default.LOG_MINOR,"Transport.requestClose()",""),this.send(f)},p.prototype.requestDisconnect=function(){m.default.logAction(m.default.LOG_MINOR,"Transport.requestDisconnect()",""),this.send(b)},p.prototype.ping=function(g){var C={action:a.default.Action.HEARTBEAT};g&&(C.id=g),this.send(a.default.fromValues(C))},p.prototype.dispose=function(){m.default.logAction(m.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(g){var C=this;this.idleTimer||(this.idleTimer=setTimeout(function(){C.onIdleTimerExpire()},g))},p.prototype.onIdleTimerExpire=function(){if(!this.lastActivity||!this.maxIdleInterval)throw new Error("Transport.onIdleTimerExpire(): lastActivity/maxIdleInterval not set");this.idleTimer=null;var g=l.now()-this.lastActivity,C=this.maxIdleInterval-g;if(C<=0){var d="No activity seen from realtime in "+g+"ms; assuming connection has dropped";m.default.logAction(m.default.LOG_ERROR,"Transport.onIdleTimerExpire()",d),this.disconnect(new E.default(d,80003,408))}else this.setIdleTimer(C+100)},p.tryConnect=function(g,C,d,c,u){var s=new g(C,d,c),w,v=function(L){clearTimeout(w),u({event:this.event,error:L})},k=C.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))},k),s.on(["failed","disconnected"],v),s.on("preconnect",function(){m.default.logAction(m.default.LOG_MINOR,"Transport.tryConnect()","viable transport "+s),clearTimeout(w),s.off(["failed","disconnected"],v),u(null,s)}),s.connect()},p}(h.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,h=l.Base,m=l.WordArray,S=a.algo,E=S.MD5,y=S.EvpKDF=h.extend({cfg:h.extend({keySize:128/32,hasher:E,iterations:1}),init:function(R){this.cfg=this.cfg.extend(R)},compute:function(R,f){for(var b,T=this.cfg,x=T.hasher.create(),p=m.create(),g=p.words,C=T.keySize,d=T.iterations;g.length<C;){b&&x.update(b),b=x.update(R).finalize(f),x.reset();for(var c=1;c<d;c++)b=x.finalize(b),x.reset();p.concat(b)}return p.sigBytes=C*4,p}});a.EvpKDF=function(R,f,b){return y.create(b).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,h=l.lib,m=h.Base,S=h.WordArray,E=h.BufferedBlockAlgorithm,y=l.enc;y.Utf8;var R=y.Base64,f=l.algo,b=f.EvpKDF,T=h.Cipher=E.extend({cfg:m.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)}}}}()});h.StreamCipher=T.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1});var x=l.mode={},p=h.BlockCipherMode=m.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}}),g=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}(),C=l.pad={},d=C.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}};h.BlockCipher=T.extend({cfg:T.cfg.extend({mode:g,padding:d}),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=h.CipherParams=m.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=h.SerializableCipher=m.extend({cfg:m.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={},k=v.OpenSSL={execute:function(N,P,I,M){M||(M=S.random(64/8));var A=b.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=h.PasswordBasedCipher=w.extend({cfg:w.cfg.extend({kdf:k}),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)),h=o.__importDefault(i(3)),m=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(),b=function(){},T=f._ablyjs_jsonp={};T._=function(u){return T["_"+u]||b};var x=1,p="jsonp";function g(u,s,w,v,k,L,N){return L=L||E.default.TIMEOUTS,new d(void 0,u,s,a.copy(w),v,k,L,N)}r.createRequest=g;var C=function(u){o.__extends(s,u);function s(w,v,k){var L=u.call(this,w,v,k)||this;return L.shortName=p,k.stream=!1,L}return s.isAvailable=function(){return h.default.Config.jsonpSupported&&h.default.Config.allowComet},s.prototype.toString=function(){return"JSONPTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},s.prototype.createRequest=function(w,v,k,L,N,P,I){return P=(this===null||this===void 0?void 0:this.timeouts)||P||E.default.TIMEOUTS,g(w,v,k,L,N,P,I)},s}(l.default),d=function(u){o.__extends(s,u);function s(w,v,k,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(),k&&(k["X-Ably-Version"]&&(A.params.v=k["X-Ably-Version"]),k["X-Ably-Lib"]&&(A.params.lib=k["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,k=this.body,L=this.method,N=this.uri,P=this.params;P.callback="_ablyjs_jsonp._("+v+")",P.envelope="jsonp",k&&(P.body=k),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: "+h.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 W=z.error||new S.PartialErrorInfo("Error response received from server",null,U.statusCode);w.complete(W)}}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,k,L){if(k=k||{},!this.requestComplete){this.requestComplete=!0;var N=void 0;v&&(N=typeof v=="string"?"text/plain":"application/json",k["content-type"]=N,this.emit("data",v)),this.emit("complete",w,v,k,!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}(m.default);r.Request=d;function c(u){return f.JSONPTransport=C,C.isAvailable()&&(u.supportedTransports[p]=C),C}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)),h=o.__importDefault(i(8)),m=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)),b=o.__importDefault(i(19)),T=o.__importDefault(i(3)),x=o.__importDefault(i(9)),p=o.__importDefault(i(16)),g=o.__importDefault(i(15)),C=function(){},d=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=h.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 k=this.options=h.default.normaliseOptions(v);if(k.key){var L=k.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)}k.keyName=L[1],k.keySecret=L[2]}if("clientId"in k)if(typeof k.clientId=="string"||k.clientId===null){if(k.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 = "+h.default.version),this.baseUri=this.authority=function(N){return h.default.getHttpScheme(k)+N+":"+h.default.getPort(k,!1)},this._currentFallback=null,this.serverTimeOffset=null,this.http=new T.default.Http(k),this.auth=new m.default(this,k),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=C}var v=a.defaultGetHeaders(this.options),k=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=this.http.supportsLinkHeaders?void 0:k;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 k=w||C,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(b.default.Get,this,N,L,null,s,function(P,I,M,A){if(P){k(P);return}A||(I=JSON.parse(I));var j=I[0];if(!j){k(new R.default("Internal error (unexpected result type from GET /time)",5e4,500));return}v.serverTimeOffset=j-a.now(),k(null,j)})},u.prototype.request=function(s,w,v,k,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,k,L]);N=C}typeof k!="string"&&(k=I(k)),this.options.headers&&a.mixin(z,this.options.headers),L&&a.mixin(z,L);var W=new E.default(this,w,z,j,function(G,F,O){return a.ensureArray(O?G:M(G))},!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)?W[U](v,k,N):W[U](v,N)},u.prototype.batchPublish=function(s,w){if(w===void 0){if(this.options.promises)return a.promisify(this,"batchPublish",[s]);w=C}var v=w,k,L;a.isArray(s)?(k=s,L=!1):(k=[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(k,N);g.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=C}var v=w,k=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=a.defaultPostHeaders(this.options,k);this.options.headers&&a.mixin(L,this.options.headers);var N=s.join(",");g.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,k);v(null,j)})},u.prototype.setLog=function(s){l.default.setLog(s.level,s.handler)},u.Promise=function(s){return s=h.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=d},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,h=l.lib,m=h.WordArray,S=h.Hasher,E=l.algo,y=[],R=[];(function(){function T(C){for(var d=a.sqrt(C),c=2;c<=d;c++)if(!(C%c))return!1;return!0}function x(C){return(C-(C|0))*4294967296|0}for(var p=2,g=0;g<64;)T(p)&&(g<8&&(y[g]=x(a.pow(p,1/2))),R[g]=x(a.pow(p,1/3)),g++),p++})();var f=[],b=E.SHA256=S.extend({_doReset:function(){this._hash=new m.init(y.slice(0))},_doProcessBlock:function(T,x){for(var p=this._hash.words,g=p[0],C=p[1],d=p[2],c=p[3],u=p[4],s=p[5],w=p[6],v=p[7],k=0;k<64;k++){if(k<16)f[k]=T[x+k]|0;else{var L=f[k-15],N=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,P=f[k-2],I=(P<<15|P>>>17)^(P<<13|P>>>19)^P>>>10;f[k]=N+f[k-7]+I+f[k-16]}var M=u&s^~u&w,A=g&C^g&d^C&d,j=(g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22),U=(u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25),z=v+U+M+R[k]+f[k],W=j+A;v=w,w=s,s=u,u=c+z|0,c=d,d=C,C=g,g=z+W|0}p[0]=p[0]+g|0,p[1]=p[1]+C|0,p[2]=p[2]+d|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,g=T.sigBytes*8;return x[g>>>5]|=128<<24-g%32,x[(g+64>>>9<<4)+14]=a.floor(p/4294967296),x[(g+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(b),l.HmacSHA256=S._createHmacHelper(b)}(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)),h=o.__importDefault(i(2)),m=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 b(){}var T=9;function x(C){return a.arrEvery(C,function(d){return!d.id})}function p(C){var d=C||{};if(d.cipher){if(!f.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var c=f.default.Crypto.getCipher(d.cipher);d.cipher=c.cipherParams,d.channelCipher=c.cipher}else"cipher"in d&&(d.cipher=void 0,d.channelCipher=null);return d}var g=function(C){o.__extends(d,C);function d(c,u,s){var w=C.call(this)||this;return h.default.logAction(h.default.LOG_MINOR,"Channel()","started; name = "+u),w.rest=c,w.name=u,w.basePath="/channels/"+encodeURIComponent(u),w.presence=new m.default(w),w.channelOptions=p(s),w}return d.prototype.setOptions=function(c){this.channelOptions=p(c)},d.prototype.history=function(c,u){if(h.default.logAction(h.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=b}this._history(c,u)},d.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,k=a.defaultGetHeaders(s.options,w);s.options.headers&&a.mixin(k,s.options.headers);var L=this.channelOptions;new y.default(s,this.basePath+"/messages",k,v,function(N,P,I){return S.default.fromResponseBody(N,L,I?void 0:w)}).get(c,u)},d.prototype.publish=function(){var c=this,u=arguments.length,s=arguments[0],w=arguments[1],v=arguments[u-1],k,L;if(typeof v!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);v=b}if(typeof s=="string"||s===null)k=[S.default.fromValues({name:s,data:w})],L=arguments[2];else if(a.isObject(s))k=[S.default.fromValues(s)],L=arguments[1];else if(a.isArray(s))k=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(k)){var j=a.randomString(T);a.arrForEach(k,function(U,z){U.id=j+":"+z.toString()})}S.default.encodeArray(k,this.channelOptions,function(U){if(U){v(U);return}var z=S.default.getMessagesSize(k),W=P.maxMessageSize;if(z>W){v(new E.default("Maximum size of messages that can be published at once exceeded ( was "+z+" bytes; limit is "+W+" bytes)",40009,400));return}c._publish(S.default.serialize(k,I),A,L,v)})},d.prototype._publish=function(c,u,s,w){R.default.post(this.rest,this.basePath+"/messages",c,u,s,null,w)},d.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||b)},d}(l.default);r.default=g},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(7)),h=o.__importDefault(i(2)),m=o.__importDefault(i(20)),S=o.__importDefault(i(16));function E(){}var y=function(R){o.__extends(f,R);function f(b){var T=R.call(this)||this;return T.channel=b,T.basePath=b.basePath+"/presence",T}return f.prototype.get=function(b,T){if(h.default.logAction(h.default.LOG_MICRO,"Presence.get()","channel = "+this.channel.name),T===void 0)if(typeof b=="function")T=b,b=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,g=this.channel.rest.http.supportsLinkHeaders?void 0:p,C=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(C,x.options.headers);var d=this.channel.channelOptions;new m.default(x,this.basePath,C,g,function(c,u,s){return S.default.fromResponseBody(c,d,s?void 0:p)}).get(b,T)},f.prototype.history=function(b,T){return h.default.logAction(h.default.LOG_MICRO,"Presence.history()","channel = "+this.channel.name),this._history(b,T)},f.prototype._history=function(b,T){if(T===void 0)if(typeof b=="function")T=b,b=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"_history",[b]);T=E}var x=this.channel.rest,p=x.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,g=this.channel.rest.http.supportsLinkHeaders?void 0:p,C=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(C,x.options.headers);var d=this.channel.channelOptions;new m.default(x,this.basePath+"/history",C,g,function(c,u,s){return S.default.fromResponseBody(c,d,s?void 0:p)}).get(b,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)),h=a.__importStar(i(1)),m=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)),b=a.__importDefault(i(37)),T=a.__importStar(i(21)),x=a.__importStar(i(4)),p=a.__importDefault(i(18)),g=a.__importDefault(i(9)),C=a.__importDefault(i(24)),d=a.__importDefault(i(53)),c=a.__importDefault(i(26)),u=a.__importDefault(i(14)),s=function(){var G;return typeof E.default.WebStorage!="undefined"&&((G=E.default.WebStorage)===null||G===void 0?void 0:G.localSupported)},w=function(){var G;return typeof E.default.WebStorage!="undefined"&&((G=E.default.WebStorage)===null||G===void 0?void 0:G.sessionSupported)},v=l.default.Action,k=function(){},L="ably-transport-preference",N="ably-connection-recovery";function P(){var G,F;return w()&&((F=(G=E.default.WebStorage)===null||G===void 0?void 0:G.getSession)===null||F===void 0?void 0:F.call(G,N))}function I(G){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,G))}function M(){var G,F;return w()&&((F=(G=E.default.WebStorage)===null||G===void 0?void 0:G.removeSession)===null||F===void 0?void 0:F.call(G,N))}function A(G,F){return h.arrIndexOf(E.default.Defaults.transportPreferenceOrder,G.shortName)>h.arrIndexOf(E.default.Defaults.transportPreferenceOrder,F.shortName)}function j(G,F,O){var D;if(G.channel!==F.channel||(D=G.action)!==v.PRESENCE&&D!==v.MESSAGE||D!==F.action)return!1;var B=D===v.PRESENCE?"presence":"messages",_=G[B].concat(F[B]),$=g.default.getMessagesSize(_);return $>O||!h.allSame(_,"clientId")||!h.arrEvery(_,function(X){return!X.id})?!1:(G[B]=_,!0)}function U(G){try{return JSON.parse(G)}catch(F){return null}}var z=function(){function G(F,O,D,B){this.options=F,this.host=O,this.mode=D,this.connectionKey=B,this.format=F.useBinaryProtocol?h.Format.msgpack:h.Format.json}return G.prototype.getConnectParams=function(F){var O=F?h.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&&h.mixin(O,D.transportParams),O},G.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},G}();r.TransportParams=z;var W=function(G){a.__extends(F,G);function F(O,D){var B=G.call(this)||this;B.disconnectedRetryCount=0,F.initTransports(),B.realtime=O,B.options=D;var _=D.timeouts,$=_.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:$,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=h.intersect(D.transports||S.default.defaultTransports,F.supportedTransports),B.baseTransport=h.intersect(S.default.baseTransportOrder,B.transports)[0],B.upgradeTransports=h.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 X="no requested transports available";throw f.default.logAction(f.default.LOG_ERROR,"realtime.ConnectionManager()",X),new Error(X)}var Y=E.default.Config.addEventListener;return Y&&(w()&&typeof D.recover=="function"&&Y("beforeunload",B.persistConnection.bind(B)),D.closeOnUnload===!0&&Y("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"})}),Y("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(te){te.off()}),B.disconnectAllTransports(),B.startConnect())}),Y("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,d.default)(F),h.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 $=D.options.recover,X=P();if(X&&typeof $=="function"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Calling clientOptions-provided recover function with last session data"),$(X,function(Y){Y?(D.options.recover=X.recoveryKey,_("recover")):_("clean")});return}_("clean")};B(function(_){var $=D.createTransportParams(null,_);if(_==="recover"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport recovery mode = recover; recoveryKey = "+D.options.recover);var X=U(D.options.recover);X&&(D.msgSerial=X.msgSerial)}else f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport params = "+$.toString());O($)})},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($,X){var Y=_.state;if(Y==_.states.closing||Y==_.states.closed||Y==_.states.failed){X&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","connection "+Y.state+" while we were attempting the transport; closing "+X),X.close()),B(!0);return}if($){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","transport "+D+" "+$.event+", err: "+$.error.toString()),p.default.isTokenErr($.error)&&!(_.errorReason&&p.default.isTokenErr(_.errorReason))?(_.errorReason=$.error,_.realtime.auth._forceNewToken(null,null,function(te){if(te){_.actOnErrorFromAuthorize(te);return}_.tryATransport(O,D,B)})):$.event==="failed"?(_.notifyState({state:"failed",error:$.error}),B(!0)):$.event==="disconnected"&&((0,T.isRetriable)($.error)?B(!1):(_.notifyState({state:_.states.connecting.failState,error:$.error}),B(!0)));return}f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","viable transport "+D+"; setting pending"),_.setTransportPending(X,O),B(null,X)})},F.prototype.setTransportPending=function(O,D){var B=this,_=D.mode;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setTransportPending()","transport = "+O+"; mode = "+_),h.arrDeleteValue(this.proposedTransports,O),this.pendingTransports.push(O);var $=E.default.Defaults.transportPreferenceOrder[E.default.Defaults.transportPreferenceOrder.length-1];O.once("connected",function(Y,te,re){_=="upgrade"&&B.activeProtocol?O.shortName!==$&&h.arrIn(B.getUpgradePossibilities(),$)&&B.activeProtocol?setTimeout(function(){B.scheduleTransportActivation(Y,O,te,re)},B.options.timeouts.parallelUpgradeDelay):B.scheduleTransportActivation(Y,O,te,re):(B.activateTransport(Y,O,te,re),E.default.Config.nextTick(function(){B.connectImpl(D)})),_==="recover"&&B.options.recover&&(B.options.recover=null,B.unpersistConnection())});var X=this;O.on(["disconnected","closed","failed"],function(Y){X.deactivateTransport(O,this.event,Y)}),this.emit("transport.pending",O)},F.prototype.scheduleTransportActivation=function(O,D,B,_){var $=this,X=this.activeProtocol&&this.activeProtocol.getTransport(),Y=function(){D.disconnect(),h.arrDeleteValue($.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),Y();return}if(X&&!A(D,X)){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+" is no better than current active transport "+X.shortName+" - abandoning upgrade"),Y();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Scheduling transport upgrade; transport = "+D);var te=null;if(!D.isConnected){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+"is no longer connected; abandoning upgrade"),Y();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,te=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),Y();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})),$.activateTransport(O,D,B,_),$.state===$.states.synchronizing?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = "+D),$.state=$.states.connected):f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, but state is now "+$.state.state+", so leaving unchanged"),$.state.sendEvents&&$.sendQueuedMessages()};te?te.onceIdle(re):re()},F.prototype.activateTransport=function(O,D,B,_){var $=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 X=this.state,Y=this.states.connected.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","current state = "+X.state),X.state==this.states.closing.state||X.state==this.states.closed.state||X.state==this.states.failed.state)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Disconnecting transport and abandoning"),D.disconnect(),!1;if(h.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 te=this.activeProtocol;this.activeProtocol=new m.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){$.onConnectionDetailsUpdate(De,D),$.emit("update",new b.default(Y,Y,null,Z))})}),X.state===this.states.connected.state?O&&(this.errorReason=this.realtime.connection.errorReason=O,this.emit("update",new b.default(Y,Y,null,O))):(this.notifyState({state:"connected",error:O}),this.errorReason=this.realtime.connection.errorReason=O||null),this.emit("transport.active",D),te)if(te.messageQueue.count()>0&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Previous active protocol (for transport "+te.transport.shortName+", new one is "+D.shortName+") finishing with "+te.messageQueue.count()+" messages still pending"),te.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 te.finish();return h.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),h.arrDeleteValue($.pendingTransports,D)}else Z.disconnect()}),h.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),h.arrDeleteValue($.proposedTransports,D)):Z.dispose()}),!0},F.prototype.deactivateTransport=function(O,D,B){var _=this.activeProtocol,$=_&&_.getTransport()===O,X=h.arrDeleteValue(this.pendingTransports,O),Y=h.arrDeleteValue(this.proposedTransports,O),te=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+($?"; was active":X?"; was pending":Y?"; was proposed":"")+(te?"":"; another transport is scheduled for activation")),B&&B.message&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","reason = "+B.message),$&&(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),$&&te||$&&D==="failed"||D==="closed"||_===null&&X&&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}$&&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 h.isEmpty(this.pendingTransports)||this.pendingTransports.every(function(O){return!O.isConnected})},F.prototype.setConnection=function(O,D,B){var _=this.connectionId,$=_&&_!==O,X=!_&&B;($||X)&&(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=h.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:h.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,_,$=O.state,X=$==="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: "+$+(X?"; will retry connection immediately":"")),$!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(O.state),($==="suspended"||$==="connected")&&(this.disconnectedRetryCount=0),!this.state.terminal)){var Y=this.states[O.state],te=Y.retryDelay;Y.state==="disconnected"&&(this.disconnectedRetryCount++,te=h.getRetryTime(Y.retryDelay,this.disconnectedRetryCount));var re=new b.default(this.state.state,Y.state,te,O.error||((_=(B=T.default)[Y.state])===null||_===void 0?void 0:_.call(B)));if(X){var ce=function(){D.state===D.states.disconnected&&(D.lastAutoReconnectAttempt=h.now(),D.requestState({state:"connecting"}))},Z=this.lastAutoReconnectAttempt&&h.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($==="disconnected"||$==="suspended")&&this.startRetryTimer(te);($==="disconnected"&&!X||$==="suspended"||Y.terminal)&&E.default.Config.nextTick(function(){D.disconnectAllTransports()}),$=="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($,re.reason),this.failQueuedMessages(re.reason))}},F.prototype.requestState=function(O){var D=this,B,_,$=O.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.requestState()","requested state: "+$+"; current state: "+this.state.state),$!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer($),!($=="connecting"&&this.state.state=="connected")&&!($=="closing"&&this.state.state=="closed"))){var X=this.states[$],Y=new b.default(this.state.state,X.state,null,O.error||((_=(B=T.default)[X.state])===null||_===void 0?void 0:_.call(B)));this.enactStateChange(Y),$=="connecting"&&E.default.Config.nextTick(function(){D.startConnect()}),$=="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(X){if(X.mode==="recover"&&X.options.recover){var Y=U(X.options.recover);Y&&O.realtime.channels.recoverChannels(Y.channelSerials)}B===O.connectCounter&&O.connectImpl(X,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 $=function(X){B===O.connectCounter&&(X?O.actOnErrorFromAuthorize(X):_())};this.errorReason&&p.default.isTokenErr(this.errorReason)?D._forceNewToken(null,null,$):D._ensureValidAuthCredentials(!1,$)}},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(),$=!1;h.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 X=setTimeout(function(){$=!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(Y,te){clearTimeout(X),$&&te?(te.off(),te.disconnect(),h.arrDeleteValue(B.pendingTransports,te)):!te&&!Y&&(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})},$=this.httpHosts.slice(),X=function(re,ce){D===B.connectCounter&&!ce&&!re&&te()};f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectBase()","Trying to connect with base transport "+this.baseTransport);var Y=$.shift();if(!Y){_(new x.default("Unable to connect (no available host)",80003,404));return}O.host=Y;var te=function(){if(!$.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=h.arrPopRandomElement($),B.tryATransport(O,B.baseTransport,X)}})};if(this.forceFallbackHost&&$.length){this.forceFallbackHost=!1,te();return}this.tryATransport(O,this.baseTransport,X)},F.prototype.getUpgradePossibilities=function(){var O=this.activeProtocol.getTransport().shortName,D=h.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&&h.arrForEach(B,function(_){var $=D.createTransportParams(O.host,"upgrade");D.tryATransport($,_,k)})},F.prototype.closeImpl=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.closeImpl()","closing connection"),this.cancelSuspendTimer(),this.startTransitionTimer(this.states.closing),h.safeArrForEach(this.pendingTransports,function(O){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing pending transport: "+O),O&&O.close()}),h.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 $=this.activeProtocol.getTransport().params;E.default.Config.nextTick(function(){B.state.state==="connected"&&B.upgradeIfNeeded($)})}var X=(_=this.activeProtocol)===null||_===void 0?void 0:_.getTransport();X&&X.onAuthUpdated&&X.onAuthUpdated(O);var Y=l.default.fromValues({action:v.AUTH,auth:{accessToken:O.token}});this.send(Y);var te=function(){B.off(re),D(null,O)},re=function(Z){Z.current==="failed"&&(B.off(te),B.off(re),D(Z.reason||B.getStateError()))};this.once("connectiondetails",te),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++,h.safeArrForEach(this.pendingTransports,function(D){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting pending transport: "+D),D&&D.disconnect()}),this.pendingTransports=[],h.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||k;var _=this.state;if(_.sendEvents){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","sending event"),this.sendImpl(new m.PendingMessage(O,B));return}var $=D&&_.queueEvents||_.forceQueueEvents;if(!$){var X="rejecting event, queueEvent was "+D+", state was "+_.state;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()",X),B(this.errorReason||new x.default(X,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=C.default.create([B.callback]),B.merged=!0),B.callback.push(D)):this.queuedMessages.push(new m.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 = "+h.inspectError(O)),this.queuedMessages.completeAllMessages(O))},F.prototype.onChannelMessage=function(O,D){var B=this.activeProtocol&&D===this.activeProtocol.getTransport(),_=h.arrIn(this.pendingTransports,D)&&this.state==this.states.synchronizing;B||_?this.realtime.channels.onChannelMessage(O):h.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",Y),D(new x.default("Timeout waiting for heartbeat response",5e4,500))},$=h.now(),X=h.cheapRandStr(),Y=function(ye){if(ye===X){O.off("heartbeat",Y),clearTimeout(te);var De=h.now()-$;D(null,De)}},te=setTimeout(_,this.options.timeouts.realtimeRequestTimeout);O.on("heartbeat",Y),O.ping(X);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;h.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 $=O.connectionStateTtl;$&&(this.connectionStateTtl=$),this.maxIdleInterval=O.maxIdleInterval,this.emit("connectiondetails",O)}},F.supportedTransports={},F}(y.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(7)),l=o.__importDefault(i(2)),h=function(m){o.__extends(S,m);function S(){var E=m.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 b=f[0];if(b){var T=b.message.msgSerial,x=E+y;if(x>T)for(var p=f.splice(0,x-T),g=0,C=p;g<C.length;g++){var d=C[g];d.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=h},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function a(l,h,m,S){this.previous=l,this.current=h,m&&(this.retryIn=m),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)),h=o.__importStar(i(1)),m=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)),b=o.__importDefault(i(16)),T=o.__importDefault(i(21)),x=a.default.Action,p=function(){};function g(c){if(c&&"params"in c&&!h.isObject(c.params))return new f.default("options.params must be an object",4e4,400);if(c&&"modes"in c){if(!h.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"||!h.arrIn(a.default.channelModes,String.prototype.toUpperCase.call(s)))return new f.default("Invalid channel mode: "+s,4e4,400)}}}var C=function(c){o.__extends(u,c);function u(s,w,v){var k=c.call(this,s,w,v)||this;return k.retryCount=0,k.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 h.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}m.default.prototype._history.call(this,L,N)},k.whenState=function(L,N){return l.default.prototype.whenState.call(k,L,k.state,N)},S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel()","started; name = "+w),k.realtime=s,k.presence=new E.default(k),k.connectionManager=s.connection.connectionManager,k.state="initialized",k.subscriptions=new l.default,k.syncChannelSerial=void 0,k.properties={attachSerial:void 0,channelSerial:void 0},k.setOptions(v),k.errorReason=null,k._requestedFlags=null,k._mode=null,k._attachResume=!1,k._decodingContext={channelOptions:k.channelOptions,plugins:s.options.plugins||{},baseEncodedPreviousPayload:void 0},k._lastPayload={messageId:null,protocolMessageChannelSerial:null,decodeFailureRecoveryInProgress:null},k._allChannelChanges=new l.default,k}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 h.promisify(this,"setOptions",arguments);var k=w||function(N){N&&S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.setOptions()","Set options failed: "+N.toString())},L=g(s);if(L){k(L);return}m.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":k==null||k(null);return;default:k==null||k(N.reason);return}})):k()},u.prototype._shouldReattachToSetOptions=function(s,w){if(!(this.state==="attached"||this.state==="attaching"))return!1;if(s!=null&&s.params){var v=d(s.params),k=d(w.params);if(Object.keys(v).length!==Object.keys(k).length||!h.shallowEquals(k,v))return!0}return!!(s!=null&&s.modes&&(!w.modes||!h.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 k=w[0],L=w.length,N=w[L-1];if(typeof N!="function"){if(this.realtime.options.promises)return h.promisify(this,"publish",arguments);N=p,++L}if(!this.connectionManager.activeState()){N(this.connectionManager.getError());return}if(L==2)if(h.isObject(k))k=[y.default.fromValues(k)];else if(h.isArray(k))k=y.default.fromValuesArray(k);else throw new f.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);else k=[y.default.fromValues({name:w[0],data:w[1]})];var P=this.realtime.options.maxMessageSize;y.default.encodeArray(k,this.channelOptions,function(I){if(I){N(I);return}var M=y.default.getMessagesSize(k);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(k,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 k=new a.default;k.action=x.MESSAGE,k.channel=this.name,k.messages=s,this.sendMessage(k,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 k=s[v];w.emit(k.name,k)}},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 h.promisify(this,"attach",arguments);w=function(k){k&&S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.attach()","Channel attach failed: "+k.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 k=this.connectionManager;if(!k.activeState()){v(k.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||k.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(h.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 h.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),k=v[0],L=v[1],N=v[2];if(!N&&this.realtime.options.promises)return h.promisify(this,"subscribe",[k,L]);if(this.state==="failed"){N==null||N(f.default.fromValues(this.invalidStateError()));return}return k&&typeof k=="object"&&!Array.isArray(k)?this._subscribeFilter(k,L):this.subscriptions.on(k,L),this.attach(N||p)},u.prototype._subscribeFilter=function(s,w){var v=function(k){var L,N,P,I,M,A,j={name:k.name,refTimeserial:(N=(L=k.extras)===null||L===void 0?void 0:L.ref)===null||N===void 0?void 0:N.timeserial,refType:(I=(P=k.extras)===null||P===void 0?void 0:P.ref)===null||I===void 0?void 0:I.type,isRef:!!(!((A=(M=k.extras)===null||M===void 0?void 0:M.ref)===null||A===void 0)&&A.timeserial),clientId:k.clientId};Object.entries(s).find(function(U){var z=U[0],W=U[1];return W!==void 0?j[z]!==W:!1})||w(k)};this._addFilteredSubscription(s,w,v),this.subscriptions.on(v)},u.prototype._addFilteredSubscription=function(s,w,v){var k;if(this.filteredSubscriptions||(this.filteredSubscriptions=new Map),this.filteredSubscriptions.has(w)){var L=this.filteredSubscriptions.get(w);L.set(s,((k=L==null?void 0:L.get(s))===null||k===void 0?void 0:k.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 k=this.filteredSubscriptions.get(w);if(!s){var L=Array.from(k.values()).reduce(function(P,I){return P.concat.apply(P,I)},[]);return this.filteredSubscriptions.delete(w),L}var N=k.get(s);return k.delete(s),N||[]},u.prototype.unsubscribe=function(){for(var s=this,w,v=[],k=0;k<arguments.length;k++)v[k]=arguments[k];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:h.isArray(s)?b.default.fromValuesArray(s):[b.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 k=s.decodeModesFromFlags();this.modes=k&&h.allToLowerCase(k)||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,W=this.channelOptions,G=void 0,F=0;F<A.length;F++)try{G=A[F],b.default.decode(G,W),G.connectionId||(G.connectionId=U),G.timestamp||(G.timestamp=z),G.id||(G.id=j+":"+F)}catch(X){S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",X.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 $=s.error;$&&$.code==80016?this.checkPendingState():this.notifyState("failed",f.default.fromValues($));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,k,L){if(S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.notifyState","name = "+this.name+", current state = "+this.state+", notifying state "+s),this.clearStateTimer(),h.arrIn(["detached","suspended","failed"],s)&&(this.properties.channelSerial=null),s!==this.state){this.presence.actOnChannelState(s,k,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=h.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}(m.default);function d(c){var u=c||{};u.agent;var s=o.__rest(u,["agent"]);return s}r.default=C},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function a(l,h,m,S,E){this.previous=l,this.current=h,h==="attached"&&(this.resumed=m,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,h=l.WordArray,m=l.Hasher,S=a.algo,E=[],y=S.SHA1=m.extend({_doReset:function(){this._hash=new h.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(R,f){for(var b=this._hash.words,T=b[0],x=b[1],p=b[2],g=b[3],C=b[4],d=0;d<80;d++){if(d<16)E[d]=R[f+d]|0;else{var c=E[d-3]^E[d-8]^E[d-14]^E[d-16];E[d]=c<<1|c>>>31}var u=(T<<5|T>>>27)+C+E[d];d<20?u+=(x&p|~x&g)+1518500249:d<40?u+=(x^p^g)+1859775393:d<60?u+=(x&p|x&g|p&g)-1894007588:u+=(x^p^g)-899497514,C=g,g=p,p=x<<30|x>>>2,x=T,T=u}b[0]=b[0]+T|0,b[1]=b[1]+x|0,b[2]=b[2]+p|0,b[3]=b[3]+g|0,b[4]=b[4]+C|0},_doFinalize:function(){var R=this._data,f=R.words,b=this._nDataBytes*8,T=R.sigBytes*8;return f[T>>>5]|=128<<24-T%32,f[(T+64>>>9<<4)+14]=Math.floor(b/4294967296),f[(T+64>>>9<<4)+15]=b,R.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var R=m.clone.call(this);return R._hash=this._hash.clone(),R}});a.SHA1=m._createHelper(y),a.HmacSHA1=m._createHmacHelper(y)}(),o.SHA1})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});function o(d){if(d===void 0)return"undefined";var c,u;if(d instanceof ArrayBuffer?(u="ArrayBuffer",c=new DataView(d)):d instanceof DataView&&(u="DataView",c=d),!c)return JSON.stringify(d);for(var s=[],w=0;w<d.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(d,c,u){for(var s=0,w=u.length;s<w;s++){var v=u.charCodeAt(s);if(v<128){d.setUint8(c++,v>>>0&127|0);continue}if(v<2048){d.setUint8(c++,v>>>6&31|192),d.setUint8(c++,v>>>0&63|128);continue}if(v<65536){d.setUint8(c++,v>>>12&15|224),d.setUint8(c++,v>>>6&63|128),d.setUint8(c++,v>>>0&63|128);continue}if(v<1114112){d.setUint8(c++,v>>>18&7|240),d.setUint8(c++,v>>>12&63|128),d.setUint8(c++,v>>>6&63|128),d.setUint8(c++,v>>>0&63|128);continue}throw new Error("bad codepoint "+v)}}function l(d,c,u){for(var s="",w=c,v=c+u;w<v;w++){var k=d.getUint8(w);if(!(k&128)){s+=String.fromCharCode(k);continue}if((k&224)===192){s+=String.fromCharCode((k&15)<<6|d.getUint8(++w)&63);continue}if((k&240)===224){s+=String.fromCharCode((k&15)<<12|(d.getUint8(++w)&63)<<6|(d.getUint8(++w)&63)<<0);continue}if((k&248)===240){s+=String.fromCharCode((k&7)<<18|(d.getUint8(++w)&63)<<12|(d.getUint8(++w)&63)<<6|(d.getUint8(++w)&63)<<0);continue}throw new Error("Invalid byte "+k.toString(16))}return s}function h(d){for(var c=0,u=0,s=d.length;u<s;u++){var w=d.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 m(d,c){var u=C(d,c);if(u!==0){var s=new ArrayBuffer(u),w=new DataView(s);return g(d,w,0,c),s}}var S=65536*65536,E=1/S;function y(d,c){return c=c||0,d.getInt32(c)*S+d.getUint32(c+4)}function R(d,c){return c=c||0,d.getUint32(c)*S+d.getUint32(c+4)}function f(d,c,u){u<9223372036854776e3?(d.setInt32(c,Math.floor(u*E)),d.setInt32(c+4,u&-1)):(d.setUint32(c,2147483647),d.setUint32(c+4,2147483647))}function b(d,c,u){u<18446744073709552e3?(d.setUint32(c,Math.floor(u*E)),d.setInt32(c+4,u&-1)):(d.setUint32(c,4294967295),d.setUint32(c+4,4294967295))}var T=function(){function d(c,u){var s=this;this.map=function(w){for(var v={},k=0;k<w;k++){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),k=0;k<w;k++)v[k]=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,k;if(!(w&128))return s.offset++,w;if((w&240)===128)return k=w&15,s.offset++,s.map(k);if((w&240)===144)return k=w&15,s.offset++,s.array(k);if((w&224)===160)return k=w&31,s.offset++,s.str(k);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 k=s.view.getUint8(s.offset+1),s.offset+=2,s.bin(k);case 197:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.bin(k);case 198:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.bin(k);case 199:return k=s.view.getUint8(s.offset+1),s.offset+=2,s.ext(k);case 200:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.ext(k);case 201:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.ext(k);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 k=1,s.offset++,s.ext(k);case 213:return k=2,s.offset++,s.ext(k);case 214:return k=4,s.offset++,s.ext(k);case 215:return k=8,s.offset++,s.ext(k);case 216:return k=16,s.offset++,s.ext(k);case 217:return k=s.view.getUint8(s.offset+1),s.offset+=2,s.str(k);case 218:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.str(k);case 219:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.str(k);case 220:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.array(k);case 221:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.array(k);case 222:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.map(k);case 223:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.map(k)}throw new Error("Unknown type 0x"+w.toString(16))},this.offset=u||0,this.view=c}return d}();function x(d){var c=new DataView(d),u=new T(c),s=u.parse();if(u.offset!==d.byteLength)throw new Error(d.byteLength-u.offset+" trailing bytes");return s}function p(d,c){return Object.keys(d).filter(function(u){var s=d[u],w=typeof s;return(!c||s!=null)&&(w!=="function"||!!s.toJSON)})}function g(d,c,u,s){var w=typeof d;if(typeof d=="string"){var v=h(d);if(v<32)return c.setUint8(u,v|160),a(c,u+1,d),1+v;if(v<256)return c.setUint8(u,217),c.setUint8(u+1,v),a(c,u+2,d),2+v;if(v<65536)return c.setUint8(u,218),c.setUint16(u+1,v),a(c,u+3,d),3+v;if(v<4294967296)return c.setUint8(u,219),c.setUint32(u+1,v),a(c,u+5,d),5+v}if(ArrayBuffer.isView&&ArrayBuffer.isView(d)&&(d=d.buffer),d instanceof ArrayBuffer){var k=d.byteLength;if(k<256)return c.setUint8(u,196),c.setUint8(u+1,k),new Uint8Array(c.buffer).set(new Uint8Array(d),u+2),2+k;if(k<65536)return c.setUint8(u,197),c.setUint16(u+1,k),new Uint8Array(c.buffer).set(new Uint8Array(d),u+3),3+k;if(k<4294967296)return c.setUint8(u,198),c.setUint32(u+1,k),new Uint8Array(c.buffer).set(new Uint8Array(d),u+5),5+k}if(typeof d=="number"){if(Math.floor(d)!==d)return c.setUint8(u,203),c.setFloat64(u+1,d),9;if(d>=0){if(d<128)return c.setUint8(u,d),1;if(d<256)return c.setUint8(u,204),c.setUint8(u+1,d),2;if(d<65536)return c.setUint8(u,205),c.setUint16(u+1,d),3;if(d<4294967296)return c.setUint8(u,206),c.setUint32(u+1,d),5;if(d<18446744073709552e3)return c.setUint8(u,207),b(c,u+1,d),9;throw new Error("Number too big 0x"+d.toString(16))}if(d>=-32)return c.setInt8(u,d),1;if(d>=-128)return c.setUint8(u,208),c.setInt8(u+1,d),2;if(d>=-32768)return c.setUint8(u,209),c.setInt16(u+1,d),3;if(d>=-2147483648)return c.setUint8(u,210),c.setInt32(u+1,d),5;if(d>=-9223372036854776e3)return c.setUint8(u,211),f(c,u+1,d),9;throw new Error("Number too small -0x"+(-d).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(d===null)return s?0:(c.setUint8(u,192),1);if(w==="boolean")return c.setUint8(u,d?195:194),1;if(typeof d.toJSON=="function")return g(d.toJSON(),c,u,s);if(w==="object"){var L,N=0,P=void 0,I=Array.isArray(d);if(I?L=d.length:(P=p(d,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+=g(d[M],c,u+N,s);else if(P)for(var M=0;M<L;M++){var A=P[M];N+=g(A,c,u+N),N+=g(d[A],c,u+N,s)}return N}if(w==="function")return 0;throw new Error("Unknown type "+w)}function C(d,c){var u=typeof d;if(u==="string"){var s=h(d);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(d)&&(d=d.buffer),d instanceof ArrayBuffer){var w=d.byteLength;if(w<256)return 2+w;if(w<65536)return 3+w;if(w<4294967296)return 5+w}if(typeof d=="number"){if(Math.floor(d)!==d)return 9;if(d>=0){if(d<128)return 1;if(d<256)return 2;if(d<65536)return 3;if(d<4294967296)return 5;if(d<18446744073709552e3)return 9;throw new Error("Number too big 0x"+d.toString(16))}if(d>=-32)return 1;if(d>=-128)return 2;if(d>=-32768)return 3;if(d>=-2147483648)return 5;if(d>=-9223372036854776e3)return 9;throw new Error("Number too small -0x"+d.toString(16).substr(1))}if(u==="boolean")return 1;if(d===null)return c?0:1;if(d===void 0)return c?0:3;if(typeof d.toJSON=="function")return C(d.toJSON(),c);if(u==="object"){var v,k=0;if(Array.isArray(d)){v=d.length;for(var L=0;L<v;L++)k+=C(d[L],c)}else{var N=p(d,c);v=N.length;for(var L=0;L<v;L++){var P=N[L];k+=C(P)+C(d[P],c)}}if(v<16)return 1+k;if(v<65536)return 3+k;if(v<4294967296)return 5+k;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:m,decode:x,inspect:o,utf8Write:a,utf8Read:l,utf8ByteCount:h}},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(30)),l=o.__importDefault(i(50)),h=o.__importDefault(i(3)),m=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)),b=o.__importDefault(i(2)),T=i(8),x=o.__importDefault(i(65)),p=o.__importDefault(i(66)),g=o.__importDefault(i(41)),C=(0,E.default)(R.default,S.default);h.default.Crypto=C,h.default.BufferUtils=S.default,h.default.Http=y.default,h.default.Config=R.default,h.default.Transports=f.default,h.default.WebStorage=x.default,a.default.Crypto=C,l.default.Crypto=C,b.default.initLogHandlers(),h.default.Defaults=(0,T.getDefaults)(p.default),h.default.Config.agent&&(h.default.Defaults.agent+=" "+h.default.Config.agent),h.default.Config.noUpgrade&&(h.default.Defaults.upgradeTransports=[]),r.default={ErrorInfo:m.default,Rest:a.default,Realtime:l.default,msgpack:g.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)),h=o.__importDefault(i(15)),m=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 b(p),this.channelSubscriptions=new T(p)}return x.prototype.publish=function(p,g,C){var d=this.rest,c=d.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(d.options,c),s={},w=a.mixin({recipient:p},g);if(typeof C!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);C=y}d.options.headers&&a.mixin(u,d.options.headers),d.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var v=a.encodeBody(w,c);h.default.post(d,"/push/publish",v,u,s,null,function(k){return C(k)})},x}(),b=function(){function x(p){this.rest=p}return x.prototype.save=function(p,g){var C=this.rest,d=l.default.fromValues(p),c=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(C.options,c),s={};if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),C.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(d,c);h.default.put(C,"/push/deviceRegistrations/"+encodeURIComponent(p.id),w,u,s,null,function(v,k,L,N){g(v,v?void 0:l.default.fromResponseBody(k,N?void 0:c))})},x.prototype.get=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,d),u=p.id||p;if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"get",arguments);g=y}if(typeof u!="string"||!u.length){g(new S.default("First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails",4e4,400));return}C.options.headers&&a.mixin(c,C.options.headers),h.default.get(C,"/push/deviceRegistrations/"+encodeURIComponent(u),c,{},null,function(s,w,v,k){g(s,s?void 0:l.default.fromResponseBody(w,k?void 0:d))})},x.prototype.list=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:d,u=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),new m.default(C,"/push/deviceRegistrations",u,c,function(s,w,v){return l.default.fromResponseBody(s,v?void 0:d)}).get(p,g)},x.prototype.remove=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,d),u={},s=p.id||p;if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"remove",arguments);g=y}if(typeof s!="string"||!s.length){g(new S.default("First argument to DeviceRegistrations#remove must be a deviceId string or DeviceDetails",4e4,400));return}C.options.headers&&a.mixin(c,C.options.headers),C.options.pushFullWait&&a.mixin(u,{fullWait:"true"}),h.default.delete(C,"/push/deviceRegistrations/"+encodeURIComponent(s),c,u,null,function(w){return g(w)})},x.prototype.removeWhere=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);g=y}C.options.headers&&a.mixin(c,C.options.headers),C.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),h.default.delete(C,"/push/deviceRegistrations",c,p,null,function(u){return g(u)})},x}(),T=function(){function x(p){this.remove=x.prototype.removeWhere,this.rest=p}return x.prototype.save=function(p,g){var C=this.rest,d=E.default.fromValues(p),c=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(C.options,c),s={};if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),C.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(d,c);h.default.post(C,"/push/channelSubscriptions",w,u,s,null,function(v,k,L,N){g(v,!v&&E.default.fromResponseBody(k,N?void 0:c))})},x.prototype.list=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:d,u=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),new m.default(C,"/push/channelSubscriptions",u,c,function(s,w,v){return E.default.fromResponseBody(s,v?void 0:d)}).get(p,g)},x.prototype.removeWhere=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);g=y}C.options.headers&&a.mixin(c,C.options.headers),C.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),h.default.delete(C,"/push/channelSubscriptions",c,p,null,function(u){return g(u)})},x.prototype.listChannels=function(p,g){var C=this.rest,d=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:d,u=a.defaultGetHeaders(C.options,d);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"listChannels",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),C.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),new m.default(C,"/push/channels",u,c,function(s,w,v){for(var k=!v&&d?a.decodeBody(s,d):s,L=0;L<k.length;L++)k[L]=String(k[L]);return k}).get(p,g)},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)),h;(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"})(h||(h={}));var m;(function(E){E.Android="android",E.IOS="ios",E.Browser="browser"})(m||(m={}));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,b,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)),!((b=this.push)===null||b===void 0)&&b.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),b=0;b<R;b++)f[b]=E.fromValues(y[b]);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 h(){}return h.prototype.toJSON=function(){return{channel:this.channel,deviceId:this.deviceId,clientId:this.clientId}},h.prototype.toString=function(){var m="[PushChannelSubscription";return this.channel&&(m+="; channel="+this.channel),this.deviceId&&(m+="; deviceId="+this.deviceId),this.clientId&&(m+="; clientId="+this.clientId),m+="]",m},h.fromResponseBody=function(m,S){return S&&(m=a.decodeBody(m,S)),a.isArray(m)?h.fromValuesArray(m):h.fromValues(m)},h.fromValues=function(m){return Object.assign(new h,m)},h.fromValuesArray=function(m){for(var S=m.length,E=new Array(S),y=0;y<S;y++)E[y]=h.fromValues(m[y]);return E},h.toRequestBody=a.encodeBody,h}();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 C(d){this.count=d&&d.count||0,this.data=d&&d.data||0,this.uncompressedData=d&&d.uncompressedData||0,this.failed=d&&d.failed||0,this.refused=d&&d.refused||0}return C}(),h=function(C){o.__extends(d,C);function d(c){var u=C.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 d}(l),m=function(){function C(d){this.peak=d&&d.peak||0,this.min=d&&d.min||0,this.mean=d&&d.mean||0,this.opened=d&&d.opened||0,this.refused=d&&d.refused||0}return C}(),S=function(){function C(d){this.succeeded=d&&d.succeeded||0,this.failed=d&&d.failed||0,this.refused=d&&d.refused||0}return C}(),E=function(){function C(d){this.plain=new m(d&&d.plain),this.tls=new m(d&&d.tls),this.all=new m(d&&d.all)}return C}(),y=function(){function C(d){this.messages=new h(d&&d.messages),this.presence=new h(d&&d.presence),this.all=new h(d&&d.all)}return C}(),R=function(){function C(d){this.realtime=new y(d&&d.realtime),this.rest=new y(d&&d.rest),this.webhook=new y(d&&d.webhook),this.sharedQueue=new y(d&&d.sharedQueue),this.externalQueue=new y(d&&d.externalQueue),this.httpEvent=new y(d&&d.httpEvent),this.push=new y(d&&d.push),this.all=new y(d&&d.all)}return C}(),f=function(){function C(d){this.all=new y(d&&d.all),this.inbound=new R(d&&d.inbound),this.outbound=new R(d&&d.outbound)}return C}(),b=function(){function C(d){this.all=new y(d&&d.all),this.producerPaid=new f(d&&d.producerPaid),this.consumerPaid=new f(d&&d.consumerPaid)}return C}(),T=function(){function C(d){this.messages=d&&d.messages||0;var c=d&&d.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=d&&d.directPublishes||0}return C}(),x=function(){function C(d){this.succeeded=d&&d.succeeded||0,this.skipped=d&&d.skipped||0,this.failed=d&&d.failed||0}return C}(),p=function(){function C(d){var c=this;this.delta=void 0,d&&d.delta&&(this.delta={},a.forInOwnNonNullProperties(d.delta,function(u){c.delta[u]=new x(d.delta[u])}))}return C}(),g=function(C){o.__extends(d,C);function d(c){var u=C.call(this,c)||this;return u.persisted=new y(c&&c.persisted),u.connections=new E(c&&c.connections),u.channels=new m(c&&c.channels),u.apiRequests=new S(c&&c.apiRequests),u.tokenRequests=new S(c&&c.tokenRequests),u.xchgProducer=new b(c&&c.xchgProducer),u.xchgConsumer=new b(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 d.fromValues=function(c){return new d(c)},d}(f);r.default=g},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(30)),h=o.__importDefault(i(7)),m=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)),b=o.__importDefault(i(35)),T=o.__importDefault(i(3)),x=o.__importDefault(i(9)),p=function(C){o.__extends(d,C);function d(c){var u=C.call(this,c)||this;return m.default.logAction(m.default.LOG_MINOR,"Realtime()",""),u.connection=new S.default(u,u.options),u.channels=new g(u),c.autoConnect!==!1&&u.connect(),u}return d.prototype.connect=function(){m.default.logAction(m.default.LOG_MINOR,"Realtime.connect()",""),this.connection.connect()},d.prototype.close=function(){m.default.logAction(m.default.LOG_MINOR,"Realtime.close()",""),this.connection.close()},d.Promise=function(c){return c=y.default.objectifyOptions(c),c.promises=!0,new d(c)},d.Callbacks=d,d.Utils=a,d.ConnectionManager=b.default,d.Platform=T.default,d.ProtocolMessage=f.default,d.Message=x.default,d}(l.default),g=function(C){o.__extends(d,C);function d(c){var u=C.call(this)||this;return u.realtime=c,u.all=Object.create(null),c.connection.connectionManager.on("transport.active",function(){u.onTransportActive()}),u}return d.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},d.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]}},d.prototype.onChannelMessage=function(c){var u=c.channel;if(u===void 0){m.default.logAction(m.default.LOG_ERROR,"Channels.onChannelMessage()","received event unspecified channel, action = "+c.action);return}var s=this.all[u];if(!s){m.default.logAction(m.default.LOG_ERROR,"Channels.onChannelMessage()","received event for non-existent channel: "+u);return}s.onMessage(c)},d.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")}},d.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 k in this.all){var L=this.all[k];a.arrIn(w,L.state)&&L.notifyState(v,u)}},d.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},d.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)},d.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]}},d}(h.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)),h=o.__importDefault(i(35)),m=o.__importDefault(i(2)),S=o.__importDefault(i(37)),E=o.__importDefault(i(3));function y(){}var R=function(f){o.__extends(b,f);function b(T,x){var p=f.call(this)||this;return p.whenState=function(g,C){return l.default.prototype.whenState.call(p,g,p.state,C,new S.default(void 0,g))},p.ably=T,p.connectionManager=new h.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(g){var C=p.state=g.current;E.default.Config.nextTick(function(){p.emit(C,g)})}),p.connectionManager.on("update",function(g){E.default.Config.nextTick(function(){p.emit("update",g)})}),p}return b.prototype.connect=function(){m.default.logAction(m.default.LOG_MINOR,"Connection.connect()",""),this.connectionManager.requestState({state:"connecting"})},b.prototype.ping=function(T){if(m.default.logAction(m.default.LOG_MINOR,"Connection.ping()",""),!T){if(this.ably.options.promises)return a.promisify(this,"ping",arguments);T=y}this.connectionManager.ping(null,T)},b.prototype.close=function(){m.default.logAction(m.default.LOG_MINOR,"Connection.close()","connectionKey = "+this.key),this.connectionManager.requestState({state:"closing"})},Object.defineProperty(b.prototype,"recoveryKey",{get:function(){return this.createRecoveryKey()},enumerable:!1,configurable:!0}),b.prototype.createRecoveryKey=function(){return this.connectionManager.createRecoveryKey()},b}(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)),h=o.__importDefault(i(7)),m=o.__importDefault(i(2)),S=o.__importDefault(i(36)),E=o.__importDefault(i(4)),y=a.default.Action,R=function(){function b(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 b}();r.PendingMessage=R;var f=function(b){o.__extends(T,b);function T(x){var p=b.call(this)||this;return p.transport=x,p.messageQueue=new S.default,x.on("ack",function(g,C){p.onAck(g,C)}),x.on("nack",function(g,C,d){p.onNack(g,C,d)}),p}return T.prototype.onAck=function(x,p){m.default.logAction(m.default.LOG_MICRO,"Protocol.onAck()","serial = "+x+"; count = "+p),this.messageQueue.completeMessages(x,p)},T.prototype.onNack=function(x,p,g){m.default.logAction(m.default.LOG_ERROR,"Protocol.onNack()","serial = "+x+"; count = "+p+"; err = "+l.inspectError(g)),g||(g=new E.default("Unable to send message; channel not responding",50001,500)),this.messageQueue.completeMessages(x,p,g)},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),m.default.shouldLog(m.default.LOG_MICRO)&&m.default.logAction(m.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}(h.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)),h=o.__importDefault(i(26)),m=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 b=function(x){o.__extends(p,x);function p(g,C,d){var c=x.call(this,g,C,d)||this;return c.shortName=R,d.heartbeats=a.default.Config.useProtocolHeartbeats,c.wsHost=m.default.getHost(d.options,d.host,!0),c}return p.isAvailable=function(){return!!a.default.Config.WebSocket},p.prototype.createWebSocket=function(g,C){return this.uri=g+l.toQueryString(C),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"),h.default.prototype.connect.call(this);var g=this,C=this.params,d=C.options,c=d.tls?"wss://":"ws://",u=c+this.wsHost+":"+m.default.getPort(d)+"/";S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","uri: "+u),this.auth.getAuthParams(function(s,w){if(!g.isDisposed){var v="";for(var k in w)v+=" "+k+": "+w[k]+";";if(S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","authParams:"+v+" err: "+s),s){g.disconnect(s);return}var L=C.getConnectParams(w);try{var N=g.wsConnection=g.createWebSocket(u,L);N.binaryType=a.default.Config.binaryType,N.onopen=function(){g.onWsOpen()},N.onclose=function(P){g.onWsClose(P)},N.onmessage=function(P){g.onWsData(P.data)},N.onerror=function(P){g.onWsError(P)},f(N)&&N.on("ping",function(){g.onActivity()})}catch(P){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.connect()","Unexpected exception creating websocket: err = "+(P.stack||P.message)),g.disconnect(P)}}})},p.prototype.send=function(g){var C=this.wsConnection;if(!C){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.send()","No socket connection");return}try{C.send(E.default.serialize(g,this.params.format))}catch(c){var d="Exception from ws connection when trying to send: "+l.inspectError(c);S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.send()",d),this.finish("disconnected",new y.default(d,5e4,500))}},p.prototype.onWsData=function(g){S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.onWsData()","data received; length = "+g.length+"; type = "+typeof g);try{this.onProtocolMessage(E.default.deserialize(g,this.format))}catch(C){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.onWsData()","Unexpected exception handing channel message: "+C.stack)}},p.prototype.onWsOpen=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsOpen()","opened WebSocket"),this.emit("preconnect")},p.prototype.onWsClose=function(g){var C,d;if(typeof g=="object"?(d=g.code,C=g.wasClean||d===1e3):(d=g,C=d==1e3),delete this.wsConnection,C){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 = "+d,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(g){var C=this;S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onError()","Error from WebSocket: "+g.message),a.default.Config.nextTick(function(){C.disconnect(Error(g.message))})},p.prototype.dispose=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.dispose()",""),this.isDisposed=!0;var g=this.wsConnection;g&&(g.onmessage=function(){},delete this.wsConnection,a.default.Config.nextTick(function(){if(S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.dispose()","closing websocket"),!g)throw new Error("WebSocketTransport.dispose(): wsConnection is not defined");g.close()}))},p}(h.default);function T(x){return b.isAvailable()&&(x.supportedTransports[R]=b),b}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)),h=o.__importDefault(i(7)),m=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)),b=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 g(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 C=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 d(w,function(v){return v.clientId+":"+v.connectionId}),w._myMembers=new d(w,function(v){return v.clientId}),w.subscriptions=new h.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,k,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,k]);L=b}var P=this.channel;if(!P.connectionManager.activeState()){L(P.connectionManager.getError());return}m.default.logAction(m.default.LOG_MICRO,"RealtimePresence."+k+"Client()","channel = "+P.name+", id = "+s+", client = "+(w||"(implicit) "+T(this)));var I=S.default.fromData(v);I.action=k,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 "+k+" 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=b}var k=this.channel;if(!k.connectionManager.activeState()){v==null||v(k.connectionManager.getError());return}m.default.logAction(m.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),k.state){case"attached":k.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(k.invalidStateError())}},u.prototype.get=function(s,w){var v=this,k=Array.prototype.slice.call(arguments);k.length==1&&typeof k[0]=="function"&&k.unshift(null),s=k[0],w=k[1];var L=!s||("waitForSync"in s?s.waitForSync:!0);if(!w){if(this.channel.realtime.options.promises)return a.promisify(this,"get",k);w=b}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(m.default.logAction(m.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=b}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){m.default.logAction(m.default.LOG_MICRO,"RealtimePresence.setPresence()","received presence for "+s.length+" participants; syncChannelSerial = "+v);var k,L,N=this.members,P=this._myMembers,I=[],M=this.channel.connectionManager.connectionId;w&&(this.members.startSync(),v&&(L=v.match(/^[\w-]+:(.*)$/))&&(k=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&&!k&&(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){m.default.logAction(m.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 k=[],L=R.default.create();m.default.logAction(m.default.LOG_MICRO,"RealtimePresence.onAttached","sending "+v+" queued presence messages");for(var N=0;N<v;N++){var P=w[N];k.push(P.presence),L.push(P.callback)}this.channel.sendPresence(k,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){m.default.logAction(m.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);m.default.logAction(m.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 k in w.map){var L=w.map[k];m.default.logAction(m.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 k=S.default.fromValues({action:"leave",connectionId:v.connectionId,clientId:v.clientId,data:v.data,encoding:v.encoding,timestamp:a.now()});w.emit("leave",k)})},u.prototype.on=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];m.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];m.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),k=v[0],L=v[1],N=v[2],P=this.channel;if(!N){if(this.channel.realtime.options.promises)return a.promisify(this,"subscribe",[k,L]);N=b}if(P.state==="failed"){N(E.default.fromValues(P.invalidStateError()));return}this.subscriptions.on(k,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),k=v[0],L=v[1];this.subscriptions.off(k,L)},u}(l.default),d=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 k in w){var L=w[k];L.clientId==s&&L.action!="absent"&&v.push(L)}return v},u.prototype.list=function(s){var w=this.map,v=s&&s.clientId,k=s&&s.connectionId,L=[];for(var N in w){var P=w[N];P.action!=="absent"&&(v&&v!=P.clientId||k&&k!=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 k=w[v];return k&&!g(s,k)?!1:(w[v]=s,!0)},u.prototype.values=function(){var s=this.map,w=[];for(var v in s){var k=s[v];k.action!="absent"&&w.push(k)}return w},u.prototype.remove=function(s){var w=this.map,v=this.memberKey(s),k=w[v];return k&&!g(s,k)?!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;m.default.logAction(m.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(m.default.logAction(m.default.LOG_MINOR,"PresenceMap.endSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),w){for(var v in s){var k=s[v];k.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(m.default.logAction(m.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){m.default.logAction(m.default.LOG_MICRO,"PresenceMap.setInProgress()","inProgress = "+s),this.syncInProgress=s,this.presence.syncComplete=!s},u}(h.default);r.default=C},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=i(56),l=i(31),h=i(11),m=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="",b=this.base64CharSet,T=R.byteLength,x=T%3,p=T-x,g,C,d,c,u,s=0;s<p;s=s+3)u=R[s]<<16|R[s+1]<<8|R[s+2],g=(u&16515072)>>18,C=(u&258048)>>12,d=(u&4032)>>6,c=u&63,f+=b[g]+b[C]+b[d]+b[c];return x==1?(u=R[p],g=(u&252)>>2,C=(u&3)<<4,f+=b[g]+b[C]+"=="):x==2&&(u=R[p]<<8|R[p+1],g=(u&64512)>>10,C=(u&1008)>>4,d=(u&15)<<2,f+=b[g]+b[C]+b[d]+"="),f},y.prototype.base64ToArrayBuffer=function(R){for(var f=atob==null?void 0:atob(R),b=f.length,T=new Uint8Array(b),x=0;x<b;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),b=new Uint8Array(f),T=0;T<R.sigBytes;T++)b[T]=R.words[T>>>2]>>>24-T%4*8&255;return b}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:m.default.create(R)},y.prototype.base64Encode=function(R){return this.isWordArray(R)?(0,h.stringify)(R):this.uint8ViewToBase64(this.toBuffer(R))},y.prototype.base64Decode=function(R){return ArrayBuffer&&S.default.Config.atob?this.base64ToArrayBuffer(R):(0,h.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 b=this.toWordArray(R),T=this.toWordArray(f);b.clamp(),T.clamp();var x=b.sigBytes-T.sigBytes;if(x!=0)return x;for(var p=b.words,g=T.words,C=0;C<p.length;C++)if(x=p[C]-g[C],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),h=i(23),m=i.n(h),S=i(2),E=i.n(S),y=i(4),R=i.n(y),f=function(b,T){var x="aes",p=256,g="cbc",C=16,d=4,c=4294967296,u=2147483648,s;if(b.getRandomWordArray)s=b.getRandomWordArray;else if(typeof Uint32Array!="undefined"&&b.getRandomValues){var w=new Uint32Array(d);s=function(A,j){var U=A/4,z=U==d?w:new Uint32Array(U);b.getRandomValues(z,function(W){typeof j!="undefined"&&j(W,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),W=0;W<U;W++)z[W]=Math.floor(Math.random()*c)-u;j(null,a.a.create(z))};function v(A){return A+C&-16}function k(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||g,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 k(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,d,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),W=this,G=function(){W.getIv(function(F,O){if(F){j(F);return}var D=W.encryptCipher.process(A.concat(N[z-U])),B=O.concat(D);j(null,B)})};this.encryptCipher?G():this.iv?(this.encryptCipher=m.a.algo[this.cjsAlgorithm].createEncryptor(this.key,{iv:this.iv}),G()):s(C,function(F,O){if(F){j(F);return}W.encryptCipher=m.a.algo[W.cjsAlgorithm].createEncryptor(W.key,{iv:O}),W.iv=O,G()})},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)),W=a.a.create(U.slice(j)),G=m.a.algo[this.cjsAlgorithm].createDecryptor(this.key,{iv:z}),F=G.process(W),O=G.finalize();return G.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(C,function(z,W){if(z){A(z);return}A(null,U.encryptCipher.process(W))})},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,h=l.WordArray,m=a.enc;m.Utf16=m.Utf16BE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],b=0;b<R;b+=2){var T=y[b>>>2]>>>16-b%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 h.create(R,y*2)}},m.Utf16LE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],b=0;b<R;b+=2){var T=S(y[b>>>2]>>>16-b%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 h.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,h=l.lib,m=h.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 m.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,h=l.BlockCipher,m=a.algo,S=[],E=[],y=[],R=[],f=[],b=[],T=[],x=[],p=[],g=[];(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 k=c[s],L=c[k],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,b[s]=P;var P=N*16843009^L*65537^k*257^s*16843008;T[v]=P<<24|P>>>8,x[v]=P<<16|P>>>16,p[v]=P<<8|P>>>24,g[v]=P,s?(s=k^c[c[c[N^k]]],w^=c[c[w]]):s=w=1}})();var C=[0,1,2,4,8,16,32,64,128,27,54],d=m.AES=h.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,k=(v+1)*4,L=this._keySchedule=[],N=0;N<k;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^=C[N/w|0]<<24),L[N]=L[N-w]^c);for(var P=this._invKeySchedule=[],I=0;I<k;I++){var N=k-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]]^g[S[c&255]]}}},encryptBlock:function(c,u){this._doCryptBlock(c,u,this._keySchedule,y,R,f,b,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,g,E);var s=c[u+1];c[u+1]=c[u+3],c[u+3]=s},_doCryptBlock:function(c,u,s,w,v,k,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=w[I>>>24]^v[M>>>16&255]^k[A>>>8&255]^L[j&255]^s[U++],G=w[M>>>24]^v[A>>>16&255]^k[j>>>8&255]^L[I&255]^s[U++],F=w[A>>>24]^v[j>>>16&255]^k[I>>>8&255]^L[M&255]^s[U++],O=w[j>>>24]^v[I>>>16&255]^k[M>>>8&255]^L[A&255]^s[U++];I=W,M=G,A=F,j=O}var W=(N[I>>>24]<<24|N[M>>>16&255]<<16|N[A>>>8&255]<<8|N[j&255])^s[U++],G=(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]=W,c[u+1]=G,c[u+2]=F,c[u+3]=O},keySize:256/32});a.AES=h._createHelper(d)}(),o.AES})},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(a){var l=o,h=l.lib,m=h.WordArray,S=h.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 m.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,g){for(var C=0;C<16;C++){var d=g+C,c=p[d];p[d]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360}var u=this._hash.words,s=p[g+0],w=p[g+1],v=p[g+2],k=p[g+3],L=p[g+4],N=p[g+5],P=p[g+6],I=p[g+7],M=p[g+8],A=p[g+9],j=p[g+10],U=p[g+11],z=p[g+12],W=p[g+13],G=p[g+14],F=p[g+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,k,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,W,12,y[13]),B=f(B,_,O,D,G,17,y[14]),D=f(D,B,_,O,F,22,y[15]),O=b(O,D,B,_,w,5,y[16]),_=b(_,O,D,B,P,9,y[17]),B=b(B,_,O,D,U,14,y[18]),D=b(D,B,_,O,s,20,y[19]),O=b(O,D,B,_,N,5,y[20]),_=b(_,O,D,B,j,9,y[21]),B=b(B,_,O,D,F,14,y[22]),D=b(D,B,_,O,L,20,y[23]),O=b(O,D,B,_,A,5,y[24]),_=b(_,O,D,B,G,9,y[25]),B=b(B,_,O,D,k,14,y[26]),D=b(D,B,_,O,M,20,y[27]),O=b(O,D,B,_,W,5,y[28]),_=b(_,O,D,B,v,9,y[29]),B=b(B,_,O,D,I,14,y[30]),D=b(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,G,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,_,W,4,y[40]),_=T(_,O,D,B,s,11,y[41]),B=T(B,_,O,D,k,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,G,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,k,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,W,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,g=p.words,C=this._nDataBytes*8,d=p.sigBytes*8;g[d>>>5]|=128<<24-d%32;var c=a.floor(C/4294967296),u=C;g[(d+64>>>9<<4)+15]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,g[(d+64>>>9<<4)+14]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360,p.sigBytes=(g.length+1)*4,this._process();for(var s=this._hash,w=s.words,v=0;v<4;v++){var k=w[v];w[v]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}return s},clone:function(){var p=S.clone.call(this);return p._hash=this._hash.clone(),p}});function f(p,g,C,d,c,u,s){var w=p+(g&C|~g&d)+c+s;return(w<<u|w>>>32-u)+g}function b(p,g,C,d,c,u,s){var w=p+(g&d|C&~d)+c+s;return(w<<u|w>>>32-u)+g}function T(p,g,C,d,c,u,s){var w=p+(g^C^d)+c+s;return(w<<u|w>>>32-u)+g}function x(p,g,C,d,c,u,s){var w=p+(C^(g|~d))+c+s;return(w<<u|w>>>32-u)+g}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)),h=a.__importStar(i(1)),m=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)),b=i(29),T=a.__importDefault(i(63)),x=i(14);function p(d){var c=d.statusCode;return c===408&&!d.code||c===400&&!d.code||c>=500&&c<=504}function g(d){var c=d.connection,u=c&&c.connectionManager.host;return u?[u].concat(m.default.getFallbackHosts(d.options)):m.default.getHosts(d.options)}var C=(o=function(){function d(c){this.checksInProgress=null,this.checkConnectivity=void 0,this.supportsAuthHeaders=!1,this.supportsLinkHeaders=!1,this._getHosts=g,this.options=c||{};var u=this.options.connectivityCheckUrl||m.default.connectivityCheckUrl,s=this.options.connectivityCheckParams,w=!this.options.connectivityCheckUrl;l.default.Config.xhrSupported?(this.supportsAuthHeaders=!0,this.Request=function(v,k,L,N,P,I,M){var A=y.default.createRequest(L,N,P,I,R.default.REQ_SEND,k&&k.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(k,L,N,P,I){var M=!1;w?M=!k&&(L==null?void 0:L.replace(/\n/,""))=="yes":M=!k&&(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,k,L,N,P,I,M){var A=(0,b.createRequest)(L,N,P,I,R.default.REQ_SEND,k&&k.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 k=this,L=m.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 b.Request("isTheInternetUp",L,null,null,null,R.default.REQ_SEND,m.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<k.checksInProgress.length;A++)k.checksInProgress[A](null,M);k.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(k,L){var N=!k&&(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,k,L,N,P,I,M){M(new S.PartialErrorInfo("no supported HTTP transports available",null,400),null)}}return d.prototype.do=function(c,u,s,w,v,k,L){var N=this,P=typeof s=="function"?s:function(j){return u.baseUri(j)+s},I=u._currentFallback;if(I)if(I.validUntil>h.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,k,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,k,L);return}L==null||L.apply(void 0,a.__spreadArray([j],U,!1))});return}else u._currentFallback=null;var M=g(u);if(M.length===1){this.doUri(c,u,P(M[0]),w,v,k,L);return}var A=function(j,U){var z=j.shift();N.doUri(c,u,P(z),w,v,k,function(W){for(var G=[],F=1;F<arguments.length;F++)G[F-1]=arguments[F];if(W&&p(W)&&j.length){A(j,!0);return}U&&(u._currentFallback={host:z,validUntil:h.now()+u.options.timeouts.fallbackRetryTimeout}),L==null||L.apply(void 0,a.__spreadArray([W],G,!1))})};A(M)},d.prototype.doUri=function(c,u,s,w,v,k,L){if(!this.Request){L(new S.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(c,u,s,w,k,v,L)},d}(),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=C},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(4)),l=o.__importDefault(i(3)),h=o.__importDefault(i(8)),m=o.__importStar(i(1)),S=i(1);function E(f,b){return!!b.get("x-ably-errorcode")}function y(f,b){if(E(f,b))return f.error&&a.default.fromValues(f.error)}function R(f,b,T,x,p,g,C){var d=new Headers(x||{}),c=f?f.toUpperCase():m.isEmptyArg(g)?"GET":"POST",u=new AbortController,s=setTimeout(function(){u.abort(),C(new a.PartialErrorInfo("Request timed out",null,408))},b?b.options.timeouts.httpRequestTimeout:h.default.TIMEOUTS.httpRequestTimeout),w={method:c,headers:d,body:g};l.default.Config.isWebworker||(w.credentials=d.has("authorization")?"include":"same-origin"),(0,S.getGlobalObject)().fetch(T+"?"+new URLSearchParams(p||{}),w).then(function(v){clearTimeout(s);var k=v.headers.get("Content-Type"),L;k&&k.indexOf("application/x-msgpack")>-1?L=v.arrayBuffer():k&&k.indexOf("application/json")>-1?L=v.json():L=v.text(),L.then(function(N){var P=!!k&&k.indexOf("application/x-msgpack")===-1;if(v.ok)C(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);C(I,N,v.headers,P,v.status)}})}).catch(function(v){clearTimeout(s),C(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)),h=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 m(){var R=h.location;return!h.WebSocket||!R||!R.origin||R.origin.indexOf("http")>-1}var S=h.navigator&&h.navigator.userAgent.toString(),E=h.location&&h.location.href,y={agent:"browser",logTimestamps:!0,userAgent:S,currentUrl:E,noUpgrade:S&&!!S.match(/MSIE\s8\.0/),binaryType:"arraybuffer",WebSocket:h.WebSocket,fetchSupported:!!h.fetch,xhrSupported:h.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,jsonpSupported:typeof document!="undefined",allowComet:m(),streamingSupported:!0,useProtocolHeartbeats:!0,createHmac:null,msgpack:a.default,supportsBinary:!!h.TextDecoder,preferBinary:!1,ArrayBuffer:h.ArrayBuffer,atob:h.atob,nextTick:typeof h.setImmediate!="undefined"?h.setImmediate.bind(h):function(R){setTimeout(R,0)},addEventListener:h.addEventListener,inspect:JSON.stringify,stringByteSize:function(R){return h.TextDecoder&&new h.TextEncoder().encode(R).length||R.length},TextEncoder:h.TextEncoder,TextDecoder:h.TextDecoder,Promise:h.Promise,getRandomValues:function(R){if(R!==void 0)return function(f,b){R.getRandomValues(f),b&&b(null)}}(h.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)),h="ablyjs-storage-test",m=function(){function S(){try{o.sessionStorage.setItem(h,h),o.sessionStorage.removeItem(h),this.sessionSupported=!0}catch(E){this.sessionSupported=!1}try{o.localStorage.setItem(h,h),o.localStorage.removeItem(h),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 b={value:y};return R&&(b.expires=l.now()+R),this.storageInterface(f).setItem(E,JSON.stringify(b))},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 m}).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),h=i(3),m=i.n(h),S=i(12),E=i.n(S),y=i(17),R=i.n(y),f=function(p){var g="xhr_polling";function C(d,c,u){u.stream=!1,E.a.call(this,d,c,u),this.shortName=g}return l.inherits(C,E.a),C.isAvailable=function(){return m.a.Config.xhrSupported&&m.a.Config.allowComet},C.prototype.toString=function(){return"XHRPollingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},C.prototype.createRequest=function(d,c,u,s,w){return R.a.createRequest(d,c,u,s,w,this.timeouts)},typeof p!="undefined"&&C.isAvailable()&&(p.supportedTransports[g]=C),C},b=f,T=function(p){var g="xhr_streaming";function C(d,c,u){E.a.call(this,d,c,u),this.shortName=g}return l.inherits(C,E.a),C.isAvailable=function(){return m.a.Config.xhrSupported&&m.a.Config.streamingSupported&&m.a.Config.allowComet},C.prototype.toString=function(){return"XHRStreamingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},C.prototype.createRequest=function(d,c,u,s,w){return R.a.createRequest(d,c,u,s,w,this.timeouts)},typeof p!="undefined"&&C.isAvailable()&&(p.supportedTransports[g]=C),C},x=T;r.default=[a.a,b,x]}]).default})})(nd);var Ug=nd.exports;const Bg=he(Ug),xo=(e,t,n,r,i)=>ot(this,null,function*(){try{const o=new Bg.Realtime({token:e.token,clientId:e.clientId});o.connection.on("connected",()=>{i==null||i("connected")}),o.connection.on("failed",h=>{console.error("[❌ ABLY CONNECTION FAILED]",h),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",h=>{var m;try{const S=(m=h.data)==null?void 0:m.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}}),_g=(e,t)=>ot(this,null,function*(){try{const n=td(),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}}),rd=e=>{e&&e.close()},id=()=>({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=jg(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=Ng(),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},zg=e=>`¡Hola! Soy ${e||"tu asistente"}, ¿En qué te puedo ayudar?
|
|
145
|
+
`;F.mac=F.mac||h(X,G),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 m.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,W){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 G=A.waitingForTokenRequest||x;if(A.waitingForTokenRequest=null,z){G(z);return}G(null,A.tokenDetails=W)})}},P.prototype._userSetClientId=function(I){if(typeof I=="string"||I===null){if(I==="*")throw new m.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 m.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 m.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 m.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,W=o.__assign({targets:I.map(function(D){return"".concat(D.type,":").concat(D.value)})},U),G=this.client.options.useBinaryProtocol?l.Format.msgpack:l.Format.json,F=l.defaultPostHeaders(this.client.options,G);this.client.options.headers&&l.mixin(F,this.client.options.headers);var O=l.encodeBody(W,G);b.default.post(this.client,"/keys/".concat(j,"/revokeTokens"),O,F,{newBatchResponse:"true"},null,function(D,B,_,$){if(D){z(D);return}var X=$?B:l.decodeBody(B,G);z(null,X)})},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)),m=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 g=T[p].match(/^\s*<(.+)>;\s*rel="(\w+)"$/);if(g){var C=S(g[1]);C&&(x[g[2]]=C)}}return x}function y(T,x,p){return!(p&&(x||typeof T.code=="number"))}var R=function(){function T(x,p,g,C,h,c){this.rest=x,this.path=p,this.headers=g,this.envelope=C!=null?C:null,this.bodyHandler=h,this.useHttpPaginatedResponse=c||!1}return T.prototype.get=function(x,p){var g=this;d.default.get(this.rest,this.path,this.headers,x,this.envelope,function(C,h,c,u,s){g.handlePage(C,h,c,u,s,p)})},T.prototype.delete=function(x,p){var g=this;d.default.delete(this.rest,this.path,this.headers,x,this.envelope,function(C,h,c,u,s){g.handlePage(C,h,c,u,s,p)})},T.prototype.post=function(x,p,g){var C=this;d.default.post(this.rest,this.path,p,this.headers,x,this.envelope,function(h,c,u,s,w){g&&C.handlePage(h,c,u,s,w,g)})},T.prototype.put=function(x,p,g){var C=this;d.default.put(this.rest,this.path,p,this.headers,x,this.envelope,function(h,c,u,s,w){g&&C.handlePage(h,c,u,s,w,g)})},T.prototype.patch=function(x,p,g){var C=this;d.default.patch(this.rest,this.path,p,this.headers,x,this.envelope,function(h,c,u,s,w){g&&C.handlePage(h,c,u,s,w,g)})},T.prototype.handlePage=function(x,p,g,C,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==m.default.NoContent?[]:this.bodyHandler(p,g||{},C)}catch(v){c==null||c(x||v);return}g&&(s=g.Link||g.link)&&(w=E(s)),this.useHttpPaginatedResponse?c(null,new b(this,u,g||{},h,w,x)):c(null,new f(this,u,w))},T}(),f=function(){function T(x,p,g){var C=this;this.resource=x,this.items=p;var h=this;g&&("first"in g&&(this.first=function(c){if(!c&&h.resource.rest.options.promises)return a.promisify(h,"first",[]);h.get(g.first,c)}),"current"in g&&(this.current=function(c){if(!c&&h.resource.rest.options.promises)return a.promisify(h,"current",[]);h.get(g.current,c)}),this.next=function(c){if(!c&&h.resource.rest.options.promises)return a.promisify(h,"next",[]);"next"in g?h.get(g.next,c):c(null,null)},this.hasNext=function(){return"next"in g},this.isLast=function(){var c;return!(!((c=C.hasNext)===null||c===void 0)&&c.call(C))})}return T.prototype.get=function(x,p){var g=this.resource;d.default.get(g.rest,g.path,g.headers,x,g.envelope,function(C,h,c,u,s){g.handlePage(C,h,c,u,s,p)})},T}();r.PaginatedResult=f;var b=function(T){o.__extends(x,T);function x(p,g,C,h,c,u){var s=T.call(this,p,g,c)||this;return s.statusCode=h,s.success=h<300&&h>=200,s.headers=C,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=b,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 m(S){return!S.statusCode||!S.code||S.statusCode>=500?!0:Object.values(l).includes(S.code)}r.isRetriable=m,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(m){this.members=m||[]}return d.prototype.call=function(){for(var m=[],S=0;S<arguments.length;S++)m[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,m)}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 m,S=[],E=0;E<arguments.length;E++)S[E]=arguments[E];(m=this.members).push.apply(m,S)},d.create=function(m){var S=new d(m);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,m=a.enc,S=m.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,b=f*4;R.sigBytes>b&&(R=y.finalize(R)),R.clamp();for(var T=this._oKey=R.clone(),x=this._iKey=R.clone(),p=T.words,g=x.words,C=0;C<f;C++)p[C]^=1549556828,g[C]^=909522486;T.sigBytes=x.sigBytes=b,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 b=R.finalize(this._oKey.clone().concat(f));return b}})})()})},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)),m=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}),b=a.default.fromValues({action:R.DISCONNECT}),T=function(x){o.__extends(p,x);function p(g,C,h,c){var u=x.call(this)||this;return c&&(h.format=void 0,h.heartbeats=!0),u.connectionManager=g,g.registerProposedTransport(u),u.auth=C,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(g){this.isConnected&&this.requestDisconnect(),this.finish("disconnected",g||S.default.disconnected())},p.prototype.fail=function(g){this.isConnected&&this.requestDisconnect(),this.finish("failed",g||S.default.failed())},p.prototype.finish=function(g,C){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(g,C),this.dispose())},p.prototype.onProtocolMessage=function(g){switch(m.default.shouldLog(m.default.LOG_MICRO)&&m.default.logAction(m.default.LOG_MICRO,"Transport.onProtocolMessage()","received on "+this.shortName+": "+a.default.stringify(g)+"; connectionId = "+this.connectionManager.connectionId),this.onActivity(),g.action){case R.HEARTBEAT:m.default.logAction(m.default.LOG_MICRO,"Transport.onProtocolMessage()",this.shortName+" heartbeat; connectionId = "+this.connectionManager.connectionId),this.emit("heartbeat",g.id);break;case R.CONNECTED:this.onConnect(g),this.emit("connected",g.error,g.connectionId,g.connectionDetails,g);break;case R.CLOSED:this.onClose(g);break;case R.DISCONNECTED:this.onDisconnect(g);break;case R.ACK:this.emit("ack",g.msgSerial,g.count);break;case R.NACK:this.emit("nack",g.msgSerial,g.count,g.error);break;case R.SYNC:this.connectionManager.onChannelMessage(g,this);break;case R.ACTIVATE:break;case R.AUTH:this.auth.authorize(function(C){C&&m.default.logAction(m.default.LOG_ERROR,"Transport.onProtocolMessage()","Ably requested re-authentication, but unable to obtain a new token: "+l.inspectError(C))});break;case R.ERROR:if(m.default.logAction(m.default.LOG_MINOR,"Transport.onProtocolMessage()","received error action; connectionId = "+this.connectionManager.connectionId+"; err = "+y.default.Config.inspect(g.error)+(g.channel?", channel: "+g.channel:"")),g.channel===void 0){this.onFatalError(g);break}this.connectionManager.onChannelMessage(g,this);break;default:this.connectionManager.onChannelMessage(g,this)}},p.prototype.onConnect=function(g){if(this.isConnected=!0,!g.connectionDetails)throw new Error("Transport.onConnect(): Connect message recieved without connectionDetails");var C=g.connectionDetails.maxIdleInterval;C&&(this.maxIdleInterval=C+this.timeouts.realtimeRequestTimeout,this.onActivity())},p.prototype.onDisconnect=function(g){var C=g&&g.error;m.default.logAction(m.default.LOG_MINOR,"Transport.onDisconnect()","err = "+l.inspectError(C)),this.finish("disconnected",C)},p.prototype.onFatalError=function(g){var C=g&&g.error;m.default.logAction(m.default.LOG_MINOR,"Transport.onFatalError()","err = "+l.inspectError(C)),this.finish("failed",C)},p.prototype.onClose=function(g){var C=g&&g.error;m.default.logAction(m.default.LOG_MINOR,"Transport.onClose()","err = "+l.inspectError(C)),this.finish("closed",C)},p.prototype.requestClose=function(){m.default.logAction(m.default.LOG_MINOR,"Transport.requestClose()",""),this.send(f)},p.prototype.requestDisconnect=function(){m.default.logAction(m.default.LOG_MINOR,"Transport.requestDisconnect()",""),this.send(b)},p.prototype.ping=function(g){var C={action:a.default.Action.HEARTBEAT};g&&(C.id=g),this.send(a.default.fromValues(C))},p.prototype.dispose=function(){m.default.logAction(m.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(g){var C=this;this.idleTimer||(this.idleTimer=setTimeout(function(){C.onIdleTimerExpire()},g))},p.prototype.onIdleTimerExpire=function(){if(!this.lastActivity||!this.maxIdleInterval)throw new Error("Transport.onIdleTimerExpire(): lastActivity/maxIdleInterval not set");this.idleTimer=null;var g=l.now()-this.lastActivity,C=this.maxIdleInterval-g;if(C<=0){var h="No activity seen from realtime in "+g+"ms; assuming connection has dropped";m.default.logAction(m.default.LOG_ERROR,"Transport.onIdleTimerExpire()",h),this.disconnect(new E.default(h,80003,408))}else this.setIdleTimer(C+100)},p.tryConnect=function(g,C,h,c,u){var s=new g(C,h,c),w,v=function(L){clearTimeout(w),u({event:this.event,error:L})},k=C.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))},k),s.on(["failed","disconnected"],v),s.on("preconnect",function(){m.default.logAction(m.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,m=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 b,T=this.cfg,x=T.hasher.create(),p=m.create(),g=p.words,C=T.keySize,h=T.iterations;g.length<C;){b&&x.update(b),b=x.update(R).finalize(f),x.reset();for(var c=1;c<h;c++)b=x.finalize(b),x.reset();p.concat(b)}return p.sigBytes=C*4,p}});a.EvpKDF=function(R,f,b){return y.create(b).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,m=d.Base,S=d.WordArray,E=d.BufferedBlockAlgorithm,y=l.enc;y.Utf8;var R=y.Base64,f=l.algo,b=f.EvpKDF,T=d.Cipher=E.extend({cfg:m.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=m.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}}),g=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}(),C=l.pad={},h=C.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:g,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=m.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=m.extend({cfg:m.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={},k=v.OpenSSL={execute:function(N,P,I,M){M||(M=S.random(64/8));var A=b.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:k}),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)),m=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(),b=function(){},T=f._ablyjs_jsonp={};T._=function(u){return T["_"+u]||b};var x=1,p="jsonp";function g(u,s,w,v,k,L,N){return L=L||E.default.TIMEOUTS,new h(void 0,u,s,a.copy(w),v,k,L,N)}r.createRequest=g;var C=function(u){o.__extends(s,u);function s(w,v,k){var L=u.call(this,w,v,k)||this;return L.shortName=p,k.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,k,L,N,P,I){return P=(this===null||this===void 0?void 0:this.timeouts)||P||E.default.TIMEOUTS,g(w,v,k,L,N,P,I)},s}(l.default),h=function(u){o.__extends(s,u);function s(w,v,k,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(),k&&(k["X-Ably-Version"]&&(A.params.v=k["X-Ably-Version"]),k["X-Ably-Lib"]&&(A.params.lib=k["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,k=this.body,L=this.method,N=this.uri,P=this.params;P.callback="_ablyjs_jsonp._("+v+")",P.envelope="jsonp",k&&(P.body=k),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 W=z.error||new S.PartialErrorInfo("Error response received from server",null,U.statusCode);w.complete(W)}}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,k,L){if(k=k||{},!this.requestComplete){this.requestComplete=!0;var N=void 0;v&&(N=typeof v=="string"?"text/plain":"application/json",k["content-type"]=N,this.emit("data",v)),this.emit("complete",w,v,k,!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}(m.default);r.Request=h;function c(u){return f.JSONPTransport=C,C.isAvailable()&&(u.supportedTransports[p]=C),C}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)),m=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)),b=o.__importDefault(i(19)),T=o.__importDefault(i(3)),x=o.__importDefault(i(9)),p=o.__importDefault(i(16)),g=o.__importDefault(i(15)),C=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 k=this.options=d.default.normaliseOptions(v);if(k.key){var L=k.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)}k.keyName=L[1],k.keySecret=L[2]}if("clientId"in k)if(typeof k.clientId=="string"||k.clientId===null){if(k.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(k)+N+":"+d.default.getPort(k,!1)},this._currentFallback=null,this.serverTimeOffset=null,this.http=new T.default.Http(k),this.auth=new m.default(this,k),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=C}var v=a.defaultGetHeaders(this.options),k=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=this.http.supportsLinkHeaders?void 0:k;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 k=w||C,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(b.default.Get,this,N,L,null,s,function(P,I,M,A){if(P){k(P);return}A||(I=JSON.parse(I));var j=I[0];if(!j){k(new R.default("Internal error (unexpected result type from GET /time)",5e4,500));return}v.serverTimeOffset=j-a.now(),k(null,j)})},u.prototype.request=function(s,w,v,k,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,k,L]);N=C}typeof k!="string"&&(k=I(k)),this.options.headers&&a.mixin(z,this.options.headers),L&&a.mixin(z,L);var W=new E.default(this,w,z,j,function(G,F,O){return a.ensureArray(O?G:M(G))},!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)?W[U](v,k,N):W[U](v,N)},u.prototype.batchPublish=function(s,w){if(w===void 0){if(this.options.promises)return a.promisify(this,"batchPublish",[s]);w=C}var v=w,k,L;a.isArray(s)?(k=s,L=!1):(k=[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(k,N);g.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=C}var v=w,k=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=a.defaultPostHeaders(this.options,k);this.options.headers&&a.mixin(L,this.options.headers);var N=s.join(",");g.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,k);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,m=d.WordArray,S=d.Hasher,E=l.algo,y=[],R=[];(function(){function T(C){for(var h=a.sqrt(C),c=2;c<=h;c++)if(!(C%c))return!1;return!0}function x(C){return(C-(C|0))*4294967296|0}for(var p=2,g=0;g<64;)T(p)&&(g<8&&(y[g]=x(a.pow(p,1/2))),R[g]=x(a.pow(p,1/3)),g++),p++})();var f=[],b=E.SHA256=S.extend({_doReset:function(){this._hash=new m.init(y.slice(0))},_doProcessBlock:function(T,x){for(var p=this._hash.words,g=p[0],C=p[1],h=p[2],c=p[3],u=p[4],s=p[5],w=p[6],v=p[7],k=0;k<64;k++){if(k<16)f[k]=T[x+k]|0;else{var L=f[k-15],N=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,P=f[k-2],I=(P<<15|P>>>17)^(P<<13|P>>>19)^P>>>10;f[k]=N+f[k-7]+I+f[k-16]}var M=u&s^~u&w,A=g&C^g&h^C&h,j=(g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22),U=(u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25),z=v+U+M+R[k]+f[k],W=j+A;v=w,w=s,s=u,u=c+z|0,c=h,h=C,C=g,g=z+W|0}p[0]=p[0]+g|0,p[1]=p[1]+C|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,g=T.sigBytes*8;return x[g>>>5]|=128<<24-g%32,x[(g+64>>>9<<4)+14]=a.floor(p/4294967296),x[(g+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(b),l.HmacSHA256=S._createHmacHelper(b)}(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)),m=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 b(){}var T=9;function x(C){return a.arrEvery(C,function(h){return!h.id})}function p(C){var h=C||{};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 g=function(C){o.__extends(h,C);function h(c,u,s){var w=C.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 m.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=b}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,k=a.defaultGetHeaders(s.options,w);s.options.headers&&a.mixin(k,s.options.headers);var L=this.channelOptions;new y.default(s,this.basePath+"/messages",k,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],k,L;if(typeof v!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);v=b}if(typeof s=="string"||s===null)k=[S.default.fromValues({name:s,data:w})],L=arguments[2];else if(a.isObject(s))k=[S.default.fromValues(s)],L=arguments[1];else if(a.isArray(s))k=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(k)){var j=a.randomString(T);a.arrForEach(k,function(U,z){U.id=j+":"+z.toString()})}S.default.encodeArray(k,this.channelOptions,function(U){if(U){v(U);return}var z=S.default.getMessagesSize(k),W=P.maxMessageSize;if(z>W){v(new E.default("Maximum size of messages that can be published at once exceeded ( was "+z+" bytes; limit is "+W+" bytes)",40009,400));return}c._publish(S.default.serialize(k,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||b)},h}(l.default);r.default=g},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)),m=o.__importDefault(i(20)),S=o.__importDefault(i(16));function E(){}var y=function(R){o.__extends(f,R);function f(b){var T=R.call(this)||this;return T.channel=b,T.basePath=b.basePath+"/presence",T}return f.prototype.get=function(b,T){if(d.default.logAction(d.default.LOG_MICRO,"Presence.get()","channel = "+this.channel.name),T===void 0)if(typeof b=="function")T=b,b=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,g=this.channel.rest.http.supportsLinkHeaders?void 0:p,C=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(C,x.options.headers);var h=this.channel.channelOptions;new m.default(x,this.basePath,C,g,function(c,u,s){return S.default.fromResponseBody(c,h,s?void 0:p)}).get(b,T)},f.prototype.history=function(b,T){return d.default.logAction(d.default.LOG_MICRO,"Presence.history()","channel = "+this.channel.name),this._history(b,T)},f.prototype._history=function(b,T){if(T===void 0)if(typeof b=="function")T=b,b=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"_history",[b]);T=E}var x=this.channel.rest,p=x.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,g=this.channel.rest.http.supportsLinkHeaders?void 0:p,C=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(C,x.options.headers);var h=this.channel.channelOptions;new m.default(x,this.basePath+"/history",C,g,function(c,u,s){return S.default.fromResponseBody(c,h,s?void 0:p)}).get(b,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)),m=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)),b=a.__importDefault(i(37)),T=a.__importStar(i(21)),x=a.__importStar(i(4)),p=a.__importDefault(i(18)),g=a.__importDefault(i(9)),C=a.__importDefault(i(24)),h=a.__importDefault(i(53)),c=a.__importDefault(i(26)),u=a.__importDefault(i(14)),s=function(){var G;return typeof E.default.WebStorage!="undefined"&&((G=E.default.WebStorage)===null||G===void 0?void 0:G.localSupported)},w=function(){var G;return typeof E.default.WebStorage!="undefined"&&((G=E.default.WebStorage)===null||G===void 0?void 0:G.sessionSupported)},v=l.default.Action,k=function(){},L="ably-transport-preference",N="ably-connection-recovery";function P(){var G,F;return w()&&((F=(G=E.default.WebStorage)===null||G===void 0?void 0:G.getSession)===null||F===void 0?void 0:F.call(G,N))}function I(G){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,G))}function M(){var G,F;return w()&&((F=(G=E.default.WebStorage)===null||G===void 0?void 0:G.removeSession)===null||F===void 0?void 0:F.call(G,N))}function A(G,F){return d.arrIndexOf(E.default.Defaults.transportPreferenceOrder,G.shortName)>d.arrIndexOf(E.default.Defaults.transportPreferenceOrder,F.shortName)}function j(G,F,O){var D;if(G.channel!==F.channel||(D=G.action)!==v.PRESENCE&&D!==v.MESSAGE||D!==F.action)return!1;var B=D===v.PRESENCE?"presence":"messages",_=G[B].concat(F[B]),$=g.default.getMessagesSize(_);return $>O||!d.allSame(_,"clientId")||!d.arrEvery(_,function(X){return!X.id})?!1:(G[B]=_,!0)}function U(G){try{return JSON.parse(G)}catch(F){return null}}var z=function(){function G(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 G.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},G.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},G}();r.TransportParams=z;var W=function(G){a.__extends(F,G);function F(O,D){var B=G.call(this)||this;B.disconnectedRetryCount=0,F.initTransports(),B.realtime=O,B.options=D;var _=D.timeouts,$=_.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:$,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 X="no requested transports available";throw f.default.logAction(f.default.LOG_ERROR,"realtime.ConnectionManager()",X),new Error(X)}var Y=E.default.Config.addEventListener;return Y&&(w()&&typeof D.recover=="function"&&Y("beforeunload",B.persistConnection.bind(B)),D.closeOnUnload===!0&&Y("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"})}),Y("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(te){te.off()}),B.disconnectAllTransports(),B.startConnect())}),Y("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 $=D.options.recover,X=P();if(X&&typeof $=="function"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Calling clientOptions-provided recover function with last session data"),$(X,function(Y){Y?(D.options.recover=X.recoveryKey,_("recover")):_("clean")});return}_("clean")};B(function(_){var $=D.createTransportParams(null,_);if(_==="recover"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport recovery mode = recover; recoveryKey = "+D.options.recover);var X=U(D.options.recover);X&&(D.msgSerial=X.msgSerial)}else f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport params = "+$.toString());O($)})},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($,X){var Y=_.state;if(Y==_.states.closing||Y==_.states.closed||Y==_.states.failed){X&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","connection "+Y.state+" while we were attempting the transport; closing "+X),X.close()),B(!0);return}if($){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","transport "+D+" "+$.event+", err: "+$.error.toString()),p.default.isTokenErr($.error)&&!(_.errorReason&&p.default.isTokenErr(_.errorReason))?(_.errorReason=$.error,_.realtime.auth._forceNewToken(null,null,function(te){if(te){_.actOnErrorFromAuthorize(te);return}_.tryATransport(O,D,B)})):$.event==="failed"?(_.notifyState({state:"failed",error:$.error}),B(!0)):$.event==="disconnected"&&((0,T.isRetriable)($.error)?B(!1):(_.notifyState({state:_.states.connecting.failState,error:$.error}),B(!0)));return}f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","viable transport "+D+"; setting pending"),_.setTransportPending(X,O),B(null,X)})},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 $=E.default.Defaults.transportPreferenceOrder[E.default.Defaults.transportPreferenceOrder.length-1];O.once("connected",function(Y,te,re){_=="upgrade"&&B.activeProtocol?O.shortName!==$&&d.arrIn(B.getUpgradePossibilities(),$)&&B.activeProtocol?setTimeout(function(){B.scheduleTransportActivation(Y,O,te,re)},B.options.timeouts.parallelUpgradeDelay):B.scheduleTransportActivation(Y,O,te,re):(B.activateTransport(Y,O,te,re),E.default.Config.nextTick(function(){B.connectImpl(D)})),_==="recover"&&B.options.recover&&(B.options.recover=null,B.unpersistConnection())});var X=this;O.on(["disconnected","closed","failed"],function(Y){X.deactivateTransport(O,this.event,Y)}),this.emit("transport.pending",O)},F.prototype.scheduleTransportActivation=function(O,D,B,_){var $=this,X=this.activeProtocol&&this.activeProtocol.getTransport(),Y=function(){D.disconnect(),d.arrDeleteValue($.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),Y();return}if(X&&!A(D,X)){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+" is no better than current active transport "+X.shortName+" - abandoning upgrade"),Y();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Scheduling transport upgrade; transport = "+D);var te=null;if(!D.isConnected){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+"is no longer connected; abandoning upgrade"),Y();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,te=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),Y();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})),$.activateTransport(O,D,B,_),$.state===$.states.synchronizing?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = "+D),$.state=$.states.connected):f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, but state is now "+$.state.state+", so leaving unchanged"),$.state.sendEvents&&$.sendQueuedMessages()};te?te.onceIdle(re):re()},F.prototype.activateTransport=function(O,D,B,_){var $=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 X=this.state,Y=this.states.connected.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","current state = "+X.state),X.state==this.states.closing.state||X.state==this.states.closed.state||X.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 te=this.activeProtocol;this.activeProtocol=new m.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){$.onConnectionDetailsUpdate(De,D),$.emit("update",new b.default(Y,Y,null,Z))})}),X.state===this.states.connected.state?O&&(this.errorReason=this.realtime.connection.errorReason=O,this.emit("update",new b.default(Y,Y,null,O))):(this.notifyState({state:"connected",error:O}),this.errorReason=this.realtime.connection.errorReason=O||null),this.emit("transport.active",D),te)if(te.messageQueue.count()>0&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Previous active protocol (for transport "+te.transport.shortName+", new one is "+D.shortName+") finishing with "+te.messageQueue.count()+" messages still pending"),te.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 te.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($.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($.proposedTransports,D)):Z.dispose()}),!0},F.prototype.deactivateTransport=function(O,D,B){var _=this.activeProtocol,$=_&&_.getTransport()===O,X=d.arrDeleteValue(this.pendingTransports,O),Y=d.arrDeleteValue(this.proposedTransports,O),te=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+($?"; was active":X?"; was pending":Y?"; was proposed":"")+(te?"":"; another transport is scheduled for activation")),B&&B.message&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","reason = "+B.message),$&&(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),$&&te||$&&D==="failed"||D==="closed"||_===null&&X&&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}$&&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,$=_&&_!==O,X=!_&&B;($||X)&&(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,_,$=O.state,X=$==="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: "+$+(X?"; will retry connection immediately":"")),$!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(O.state),($==="suspended"||$==="connected")&&(this.disconnectedRetryCount=0),!this.state.terminal)){var Y=this.states[O.state],te=Y.retryDelay;Y.state==="disconnected"&&(this.disconnectedRetryCount++,te=d.getRetryTime(Y.retryDelay,this.disconnectedRetryCount));var re=new b.default(this.state.state,Y.state,te,O.error||((_=(B=T.default)[Y.state])===null||_===void 0?void 0:_.call(B)));if(X){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($==="disconnected"||$==="suspended")&&this.startRetryTimer(te);($==="disconnected"&&!X||$==="suspended"||Y.terminal)&&E.default.Config.nextTick(function(){D.disconnectAllTransports()}),$=="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($,re.reason),this.failQueuedMessages(re.reason))}},F.prototype.requestState=function(O){var D=this,B,_,$=O.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.requestState()","requested state: "+$+"; current state: "+this.state.state),$!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer($),!($=="connecting"&&this.state.state=="connected")&&!($=="closing"&&this.state.state=="closed"))){var X=this.states[$],Y=new b.default(this.state.state,X.state,null,O.error||((_=(B=T.default)[X.state])===null||_===void 0?void 0:_.call(B)));this.enactStateChange(Y),$=="connecting"&&E.default.Config.nextTick(function(){D.startConnect()}),$=="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(X){if(X.mode==="recover"&&X.options.recover){var Y=U(X.options.recover);Y&&O.realtime.channels.recoverChannels(Y.channelSerials)}B===O.connectCounter&&O.connectImpl(X,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 $=function(X){B===O.connectCounter&&(X?O.actOnErrorFromAuthorize(X):_())};this.errorReason&&p.default.isTokenErr(this.errorReason)?D._forceNewToken(null,null,$):D._ensureValidAuthCredentials(!1,$)}},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(),$=!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 X=setTimeout(function(){$=!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(Y,te){clearTimeout(X),$&&te?(te.off(),te.disconnect(),d.arrDeleteValue(B.pendingTransports,te)):!te&&!Y&&(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})},$=this.httpHosts.slice(),X=function(re,ce){D===B.connectCounter&&!ce&&!re&&te()};f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectBase()","Trying to connect with base transport "+this.baseTransport);var Y=$.shift();if(!Y){_(new x.default("Unable to connect (no available host)",80003,404));return}O.host=Y;var te=function(){if(!$.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($),B.tryATransport(O,B.baseTransport,X)}})};if(this.forceFallbackHost&&$.length){this.forceFallbackHost=!1,te();return}this.tryATransport(O,this.baseTransport,X)},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 $=D.createTransportParams(O.host,"upgrade");D.tryATransport($,_,k)})},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 $=this.activeProtocol.getTransport().params;E.default.Config.nextTick(function(){B.state.state==="connected"&&B.upgradeIfNeeded($)})}var X=(_=this.activeProtocol)===null||_===void 0?void 0:_.getTransport();X&&X.onAuthUpdated&&X.onAuthUpdated(O);var Y=l.default.fromValues({action:v.AUTH,auth:{accessToken:O.token}});this.send(Y);var te=function(){B.off(re),D(null,O)},re=function(Z){Z.current==="failed"&&(B.off(te),B.off(re),D(Z.reason||B.getStateError()))};this.once("connectiondetails",te),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||k;var _=this.state;if(_.sendEvents){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","sending event"),this.sendImpl(new m.PendingMessage(O,B));return}var $=D&&_.queueEvents||_.forceQueueEvents;if(!$){var X="rejecting event, queueEvent was "+D+", state was "+_.state;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()",X),B(this.errorReason||new x.default(X,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=C.default.create([B.callback]),B.merged=!0),B.callback.push(D)):this.queuedMessages.push(new m.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",Y),D(new x.default("Timeout waiting for heartbeat response",5e4,500))},$=d.now(),X=d.cheapRandStr(),Y=function(ye){if(ye===X){O.off("heartbeat",Y),clearTimeout(te);var De=d.now()-$;D(null,De)}},te=setTimeout(_,this.options.timeouts.realtimeRequestTimeout);O.on("heartbeat",Y),O.ping(X);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 $=O.connectionStateTtl;$&&(this.connectionStateTtl=$),this.maxIdleInterval=O.maxIdleInterval,this.emit("connectiondetails",O)}},F.supportedTransports={},F}(y.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(7)),l=o.__importDefault(i(2)),d=function(m){o.__extends(S,m);function S(){var E=m.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 b=f[0];if(b){var T=b.message.msgSerial,x=E+y;if(x>T)for(var p=f.splice(0,x-T),g=0,C=p;g<C.length;g++){var h=C[g];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,m,S){this.previous=l,this.current=d,m&&(this.retryIn=m),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)),m=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)),b=o.__importDefault(i(16)),T=o.__importDefault(i(21)),x=a.default.Action,p=function(){};function g(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 C=function(c){o.__extends(u,c);function u(s,w,v){var k=c.call(this,s,w,v)||this;return k.retryCount=0,k.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}m.default.prototype._history.call(this,L,N)},k.whenState=function(L,N){return l.default.prototype.whenState.call(k,L,k.state,N)},S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel()","started; name = "+w),k.realtime=s,k.presence=new E.default(k),k.connectionManager=s.connection.connectionManager,k.state="initialized",k.subscriptions=new l.default,k.syncChannelSerial=void 0,k.properties={attachSerial:void 0,channelSerial:void 0},k.setOptions(v),k.errorReason=null,k._requestedFlags=null,k._mode=null,k._attachResume=!1,k._decodingContext={channelOptions:k.channelOptions,plugins:s.options.plugins||{},baseEncodedPreviousPayload:void 0},k._lastPayload={messageId:null,protocolMessageChannelSerial:null,decodeFailureRecoveryInProgress:null},k._allChannelChanges=new l.default,k}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 k=w||function(N){N&&S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.setOptions()","Set options failed: "+N.toString())},L=g(s);if(L){k(L);return}m.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":k==null||k(null);return;default:k==null||k(N.reason);return}})):k()},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),k=h(w.params);if(Object.keys(v).length!==Object.keys(k).length||!d.shallowEquals(k,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 k=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(k))k=[y.default.fromValues(k)];else if(d.isArray(k))k=y.default.fromValuesArray(k);else throw new f.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);else k=[y.default.fromValues({name:w[0],data:w[1]})];var P=this.realtime.options.maxMessageSize;y.default.encodeArray(k,this.channelOptions,function(I){if(I){N(I);return}var M=y.default.getMessagesSize(k);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(k,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 k=new a.default;k.action=x.MESSAGE,k.channel=this.name,k.messages=s,this.sendMessage(k,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 k=s[v];w.emit(k.name,k)}},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(k){k&&S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.attach()","Channel attach failed: "+k.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 k=this.connectionManager;if(!k.activeState()){v(k.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||k.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),k=v[0],L=v[1],N=v[2];if(!N&&this.realtime.options.promises)return d.promisify(this,"subscribe",[k,L]);if(this.state==="failed"){N==null||N(f.default.fromValues(this.invalidStateError()));return}return k&&typeof k=="object"&&!Array.isArray(k)?this._subscribeFilter(k,L):this.subscriptions.on(k,L),this.attach(N||p)},u.prototype._subscribeFilter=function(s,w){var v=function(k){var L,N,P,I,M,A,j={name:k.name,refTimeserial:(N=(L=k.extras)===null||L===void 0?void 0:L.ref)===null||N===void 0?void 0:N.timeserial,refType:(I=(P=k.extras)===null||P===void 0?void 0:P.ref)===null||I===void 0?void 0:I.type,isRef:!!(!((A=(M=k.extras)===null||M===void 0?void 0:M.ref)===null||A===void 0)&&A.timeserial),clientId:k.clientId};Object.entries(s).find(function(U){var z=U[0],W=U[1];return W!==void 0?j[z]!==W:!1})||w(k)};this._addFilteredSubscription(s,w,v),this.subscriptions.on(v)},u.prototype._addFilteredSubscription=function(s,w,v){var k;if(this.filteredSubscriptions||(this.filteredSubscriptions=new Map),this.filteredSubscriptions.has(w)){var L=this.filteredSubscriptions.get(w);L.set(s,((k=L==null?void 0:L.get(s))===null||k===void 0?void 0:k.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 k=this.filteredSubscriptions.get(w);if(!s){var L=Array.from(k.values()).reduce(function(P,I){return P.concat.apply(P,I)},[]);return this.filteredSubscriptions.delete(w),L}var N=k.get(s);return k.delete(s),N||[]},u.prototype.unsubscribe=function(){for(var s=this,w,v=[],k=0;k<arguments.length;k++)v[k]=arguments[k];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)?b.default.fromValuesArray(s):[b.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 k=s.decodeModesFromFlags();this.modes=k&&d.allToLowerCase(k)||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,W=this.channelOptions,G=void 0,F=0;F<A.length;F++)try{G=A[F],b.default.decode(G,W),G.connectionId||(G.connectionId=U),G.timestamp||(G.timestamp=z),G.id||(G.id=j+":"+F)}catch(X){S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",X.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 $=s.error;$&&$.code==80016?this.checkPendingState():this.notifyState("failed",f.default.fromValues($));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,k,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,k,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}(m.default);function h(c){var u=c||{};u.agent;var s=o.__rest(u,["agent"]);return s}r.default=C},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function a(l,d,m,S,E){this.previous=l,this.current=d,d==="attached"&&(this.resumed=m,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,m=l.Hasher,S=a.algo,E=[],y=S.SHA1=m.extend({_doReset:function(){this._hash=new d.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(R,f){for(var b=this._hash.words,T=b[0],x=b[1],p=b[2],g=b[3],C=b[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)+C+E[h];h<20?u+=(x&p|~x&g)+1518500249:h<40?u+=(x^p^g)+1859775393:h<60?u+=(x&p|x&g|p&g)-1894007588:u+=(x^p^g)-899497514,C=g,g=p,p=x<<30|x>>>2,x=T,T=u}b[0]=b[0]+T|0,b[1]=b[1]+x|0,b[2]=b[2]+p|0,b[3]=b[3]+g|0,b[4]=b[4]+C|0},_doFinalize:function(){var R=this._data,f=R.words,b=this._nDataBytes*8,T=R.sigBytes*8;return f[T>>>5]|=128<<24-T%32,f[(T+64>>>9<<4)+14]=Math.floor(b/4294967296),f[(T+64>>>9<<4)+15]=b,R.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var R=m.clone.call(this);return R._hash=this._hash.clone(),R}});a.SHA1=m._createHelper(y),a.HmacSHA1=m._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 k=h.getUint8(w);if(!(k&128)){s+=String.fromCharCode(k);continue}if((k&224)===192){s+=String.fromCharCode((k&15)<<6|h.getUint8(++w)&63);continue}if((k&240)===224){s+=String.fromCharCode((k&15)<<12|(h.getUint8(++w)&63)<<6|(h.getUint8(++w)&63)<<0);continue}if((k&248)===240){s+=String.fromCharCode((k&7)<<18|(h.getUint8(++w)&63)<<12|(h.getUint8(++w)&63)<<6|(h.getUint8(++w)&63)<<0);continue}throw new Error("Invalid byte "+k.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 m(h,c){var u=C(h,c);if(u!==0){var s=new ArrayBuffer(u),w=new DataView(s);return g(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 b(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={},k=0;k<w;k++){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),k=0;k<w;k++)v[k]=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,k;if(!(w&128))return s.offset++,w;if((w&240)===128)return k=w&15,s.offset++,s.map(k);if((w&240)===144)return k=w&15,s.offset++,s.array(k);if((w&224)===160)return k=w&31,s.offset++,s.str(k);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 k=s.view.getUint8(s.offset+1),s.offset+=2,s.bin(k);case 197:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.bin(k);case 198:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.bin(k);case 199:return k=s.view.getUint8(s.offset+1),s.offset+=2,s.ext(k);case 200:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.ext(k);case 201:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.ext(k);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 k=1,s.offset++,s.ext(k);case 213:return k=2,s.offset++,s.ext(k);case 214:return k=4,s.offset++,s.ext(k);case 215:return k=8,s.offset++,s.ext(k);case 216:return k=16,s.offset++,s.ext(k);case 217:return k=s.view.getUint8(s.offset+1),s.offset+=2,s.str(k);case 218:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.str(k);case 219:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.str(k);case 220:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.array(k);case 221:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.array(k);case 222:return k=s.view.getUint16(s.offset+1),s.offset+=3,s.map(k);case 223:return k=s.view.getUint32(s.offset+1),s.offset+=5,s.map(k)}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 g(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 k=h.byteLength;if(k<256)return c.setUint8(u,196),c.setUint8(u+1,k),new Uint8Array(c.buffer).set(new Uint8Array(h),u+2),2+k;if(k<65536)return c.setUint8(u,197),c.setUint16(u+1,k),new Uint8Array(c.buffer).set(new Uint8Array(h),u+3),3+k;if(k<4294967296)return c.setUint8(u,198),c.setUint32(u+1,k),new Uint8Array(c.buffer).set(new Uint8Array(h),u+5),5+k}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),b(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 g(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+=g(h[M],c,u+N,s);else if(P)for(var M=0;M<L;M++){var A=P[M];N+=g(A,c,u+N),N+=g(h[A],c,u+N,s)}return N}if(w==="function")return 0;throw new Error("Unknown type "+w)}function C(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 C(h.toJSON(),c);if(u==="object"){var v,k=0;if(Array.isArray(h)){v=h.length;for(var L=0;L<v;L++)k+=C(h[L],c)}else{var N=p(h,c);v=N.length;for(var L=0;L<v;L++){var P=N[L];k+=C(P)+C(h[P],c)}}if(v<16)return 1+k;if(v<65536)return 3+k;if(v<4294967296)return 5+k;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:m,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)),m=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)),b=o.__importDefault(i(2)),T=i(8),x=o.__importDefault(i(65)),p=o.__importDefault(i(66)),g=o.__importDefault(i(41)),C=(0,E.default)(R.default,S.default);d.default.Crypto=C,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=C,l.default.Crypto=C,b.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:m.default,Rest:a.default,Realtime:l.default,msgpack:g.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)),m=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 b(p),this.channelSubscriptions=new T(p)}return x.prototype.publish=function(p,g,C){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},g);if(typeof C!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);C=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(k){return C(k)})},x}(),b=function(){function x(p){this.rest=p}return x.prototype.save=function(p,g){var C=this.rest,h=l.default.fromValues(p),c=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(C.options,c),s={};if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),C.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(h,c);d.default.put(C,"/push/deviceRegistrations/"+encodeURIComponent(p.id),w,u,s,null,function(v,k,L,N){g(v,v?void 0:l.default.fromResponseBody(k,N?void 0:c))})},x.prototype.get=function(p,g){var C=this.rest,h=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,h),u=p.id||p;if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"get",arguments);g=y}if(typeof u!="string"||!u.length){g(new S.default("First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails",4e4,400));return}C.options.headers&&a.mixin(c,C.options.headers),d.default.get(C,"/push/deviceRegistrations/"+encodeURIComponent(u),c,{},null,function(s,w,v,k){g(s,s?void 0:l.default.fromResponseBody(w,k?void 0:h))})},x.prototype.list=function(p,g){var C=this.rest,h=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:h,u=a.defaultGetHeaders(C.options,h);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),new m.default(C,"/push/deviceRegistrations",u,c,function(s,w,v){return l.default.fromResponseBody(s,v?void 0:h)}).get(p,g)},x.prototype.remove=function(p,g){var C=this.rest,h=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,h),u={},s=p.id||p;if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"remove",arguments);g=y}if(typeof s!="string"||!s.length){g(new S.default("First argument to DeviceRegistrations#remove must be a deviceId string or DeviceDetails",4e4,400));return}C.options.headers&&a.mixin(c,C.options.headers),C.options.pushFullWait&&a.mixin(u,{fullWait:"true"}),d.default.delete(C,"/push/deviceRegistrations/"+encodeURIComponent(s),c,u,null,function(w){return g(w)})},x.prototype.removeWhere=function(p,g){var C=this.rest,h=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,h);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);g=y}C.options.headers&&a.mixin(c,C.options.headers),C.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),d.default.delete(C,"/push/deviceRegistrations",c,p,null,function(u){return g(u)})},x}(),T=function(){function x(p){this.remove=x.prototype.removeWhere,this.rest=p}return x.prototype.save=function(p,g){var C=this.rest,h=E.default.fromValues(p),c=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(C.options,c),s={};if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),C.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(h,c);d.default.post(C,"/push/channelSubscriptions",w,u,s,null,function(v,k,L,N){g(v,!v&&E.default.fromResponseBody(k,N?void 0:c))})},x.prototype.list=function(p,g){var C=this.rest,h=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:h,u=a.defaultGetHeaders(C.options,h);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),new m.default(C,"/push/channelSubscriptions",u,c,function(s,w,v){return E.default.fromResponseBody(s,v?void 0:h)}).get(p,g)},x.prototype.removeWhere=function(p,g){var C=this.rest,h=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(C.options,h);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);g=y}C.options.headers&&a.mixin(c,C.options.headers),C.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),d.default.delete(C,"/push/channelSubscriptions",c,p,null,function(u){return g(u)})},x.prototype.listChannels=function(p,g){var C=this.rest,h=C.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:h,u=a.defaultGetHeaders(C.options,h);if(typeof g!="function"){if(this.rest.options.promises)return a.promisify(this,"listChannels",arguments);g=y}C.options.headers&&a.mixin(u,C.options.headers),C.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),new m.default(C,"/push/channels",u,c,function(s,w,v){for(var k=!v&&h?a.decodeBody(s,h):s,L=0;L<k.length;L++)k[L]=String(k[L]);return k}).get(p,g)},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 m;(function(E){E.Android="android",E.IOS="ios",E.Browser="browser"})(m||(m={}));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,b,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)),!((b=this.push)===null||b===void 0)&&b.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),b=0;b<R;b++)f[b]=E.fromValues(y[b]);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 m="[PushChannelSubscription";return this.channel&&(m+="; channel="+this.channel),this.deviceId&&(m+="; deviceId="+this.deviceId),this.clientId&&(m+="; clientId="+this.clientId),m+="]",m},d.fromResponseBody=function(m,S){return S&&(m=a.decodeBody(m,S)),a.isArray(m)?d.fromValuesArray(m):d.fromValues(m)},d.fromValues=function(m){return Object.assign(new d,m)},d.fromValuesArray=function(m){for(var S=m.length,E=new Array(S),y=0;y<S;y++)E[y]=d.fromValues(m[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 C(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 C}(),d=function(C){o.__extends(h,C);function h(c){var u=C.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),m=function(){function C(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 C}(),S=function(){function C(h){this.succeeded=h&&h.succeeded||0,this.failed=h&&h.failed||0,this.refused=h&&h.refused||0}return C}(),E=function(){function C(h){this.plain=new m(h&&h.plain),this.tls=new m(h&&h.tls),this.all=new m(h&&h.all)}return C}(),y=function(){function C(h){this.messages=new d(h&&h.messages),this.presence=new d(h&&h.presence),this.all=new d(h&&h.all)}return C}(),R=function(){function C(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 C}(),f=function(){function C(h){this.all=new y(h&&h.all),this.inbound=new R(h&&h.inbound),this.outbound=new R(h&&h.outbound)}return C}(),b=function(){function C(h){this.all=new y(h&&h.all),this.producerPaid=new f(h&&h.producerPaid),this.consumerPaid=new f(h&&h.consumerPaid)}return C}(),T=function(){function C(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 C}(),x=function(){function C(h){this.succeeded=h&&h.succeeded||0,this.skipped=h&&h.skipped||0,this.failed=h&&h.failed||0}return C}(),p=function(){function C(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 C}(),g=function(C){o.__extends(h,C);function h(c){var u=C.call(this,c)||this;return u.persisted=new y(c&&c.persisted),u.connections=new E(c&&c.connections),u.channels=new m(c&&c.channels),u.apiRequests=new S(c&&c.apiRequests),u.tokenRequests=new S(c&&c.tokenRequests),u.xchgProducer=new b(c&&c.xchgProducer),u.xchgConsumer=new b(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=g},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)),m=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)),b=o.__importDefault(i(35)),T=o.__importDefault(i(3)),x=o.__importDefault(i(9)),p=function(C){o.__extends(h,C);function h(c){var u=C.call(this,c)||this;return m.default.logAction(m.default.LOG_MINOR,"Realtime()",""),u.connection=new S.default(u,u.options),u.channels=new g(u),c.autoConnect!==!1&&u.connect(),u}return h.prototype.connect=function(){m.default.logAction(m.default.LOG_MINOR,"Realtime.connect()",""),this.connection.connect()},h.prototype.close=function(){m.default.logAction(m.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=b.default,h.Platform=T.default,h.ProtocolMessage=f.default,h.Message=x.default,h}(l.default),g=function(C){o.__extends(h,C);function h(c){var u=C.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){m.default.logAction(m.default.LOG_ERROR,"Channels.onChannelMessage()","received event unspecified channel, action = "+c.action);return}var s=this.all[u];if(!s){m.default.logAction(m.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 k in this.all){var L=this.all[k];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)),m=o.__importDefault(i(2)),S=o.__importDefault(i(37)),E=o.__importDefault(i(3));function y(){}var R=function(f){o.__extends(b,f);function b(T,x){var p=f.call(this)||this;return p.whenState=function(g,C){return l.default.prototype.whenState.call(p,g,p.state,C,new S.default(void 0,g))},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(g){var C=p.state=g.current;E.default.Config.nextTick(function(){p.emit(C,g)})}),p.connectionManager.on("update",function(g){E.default.Config.nextTick(function(){p.emit("update",g)})}),p}return b.prototype.connect=function(){m.default.logAction(m.default.LOG_MINOR,"Connection.connect()",""),this.connectionManager.requestState({state:"connecting"})},b.prototype.ping=function(T){if(m.default.logAction(m.default.LOG_MINOR,"Connection.ping()",""),!T){if(this.ably.options.promises)return a.promisify(this,"ping",arguments);T=y}this.connectionManager.ping(null,T)},b.prototype.close=function(){m.default.logAction(m.default.LOG_MINOR,"Connection.close()","connectionKey = "+this.key),this.connectionManager.requestState({state:"closing"})},Object.defineProperty(b.prototype,"recoveryKey",{get:function(){return this.createRecoveryKey()},enumerable:!1,configurable:!0}),b.prototype.createRecoveryKey=function(){return this.connectionManager.createRecoveryKey()},b}(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)),m=o.__importDefault(i(2)),S=o.__importDefault(i(36)),E=o.__importDefault(i(4)),y=a.default.Action,R=function(){function b(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 b}();r.PendingMessage=R;var f=function(b){o.__extends(T,b);function T(x){var p=b.call(this)||this;return p.transport=x,p.messageQueue=new S.default,x.on("ack",function(g,C){p.onAck(g,C)}),x.on("nack",function(g,C,h){p.onNack(g,C,h)}),p}return T.prototype.onAck=function(x,p){m.default.logAction(m.default.LOG_MICRO,"Protocol.onAck()","serial = "+x+"; count = "+p),this.messageQueue.completeMessages(x,p)},T.prototype.onNack=function(x,p,g){m.default.logAction(m.default.LOG_ERROR,"Protocol.onNack()","serial = "+x+"; count = "+p+"; err = "+l.inspectError(g)),g||(g=new E.default("Unable to send message; channel not responding",50001,500)),this.messageQueue.completeMessages(x,p,g)},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),m.default.shouldLog(m.default.LOG_MICRO)&&m.default.logAction(m.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)),m=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 b=function(x){o.__extends(p,x);function p(g,C,h){var c=x.call(this,g,C,h)||this;return c.shortName=R,h.heartbeats=a.default.Config.useProtocolHeartbeats,c.wsHost=m.default.getHost(h.options,h.host,!0),c}return p.isAvailable=function(){return!!a.default.Config.WebSocket},p.prototype.createWebSocket=function(g,C){return this.uri=g+l.toQueryString(C),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 g=this,C=this.params,h=C.options,c=h.tls?"wss://":"ws://",u=c+this.wsHost+":"+m.default.getPort(h)+"/";S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","uri: "+u),this.auth.getAuthParams(function(s,w){if(!g.isDisposed){var v="";for(var k in w)v+=" "+k+": "+w[k]+";";if(S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","authParams:"+v+" err: "+s),s){g.disconnect(s);return}var L=C.getConnectParams(w);try{var N=g.wsConnection=g.createWebSocket(u,L);N.binaryType=a.default.Config.binaryType,N.onopen=function(){g.onWsOpen()},N.onclose=function(P){g.onWsClose(P)},N.onmessage=function(P){g.onWsData(P.data)},N.onerror=function(P){g.onWsError(P)},f(N)&&N.on("ping",function(){g.onActivity()})}catch(P){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.connect()","Unexpected exception creating websocket: err = "+(P.stack||P.message)),g.disconnect(P)}}})},p.prototype.send=function(g){var C=this.wsConnection;if(!C){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.send()","No socket connection");return}try{C.send(E.default.serialize(g,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(g){S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.onWsData()","data received; length = "+g.length+"; type = "+typeof g);try{this.onProtocolMessage(E.default.deserialize(g,this.format))}catch(C){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.onWsData()","Unexpected exception handing channel message: "+C.stack)}},p.prototype.onWsOpen=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsOpen()","opened WebSocket"),this.emit("preconnect")},p.prototype.onWsClose=function(g){var C,h;if(typeof g=="object"?(h=g.code,C=g.wasClean||h===1e3):(h=g,C=h==1e3),delete this.wsConnection,C){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(g){var C=this;S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onError()","Error from WebSocket: "+g.message),a.default.Config.nextTick(function(){C.disconnect(Error(g.message))})},p.prototype.dispose=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.dispose()",""),this.isDisposed=!0;var g=this.wsConnection;g&&(g.onmessage=function(){},delete this.wsConnection,a.default.Config.nextTick(function(){if(S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.dispose()","closing websocket"),!g)throw new Error("WebSocketTransport.dispose(): wsConnection is not defined");g.close()}))},p}(d.default);function T(x){return b.isAvailable()&&(x.supportedTransports[R]=b),b}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)),m=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)),b=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 g(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 C=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,k,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,k]);L=b}var P=this.channel;if(!P.connectionManager.activeState()){L(P.connectionManager.getError());return}m.default.logAction(m.default.LOG_MICRO,"RealtimePresence."+k+"Client()","channel = "+P.name+", id = "+s+", client = "+(w||"(implicit) "+T(this)));var I=S.default.fromData(v);I.action=k,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 "+k+" 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=b}var k=this.channel;if(!k.connectionManager.activeState()){v==null||v(k.connectionManager.getError());return}m.default.logAction(m.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),k.state){case"attached":k.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(k.invalidStateError())}},u.prototype.get=function(s,w){var v=this,k=Array.prototype.slice.call(arguments);k.length==1&&typeof k[0]=="function"&&k.unshift(null),s=k[0],w=k[1];var L=!s||("waitForSync"in s?s.waitForSync:!0);if(!w){if(this.channel.realtime.options.promises)return a.promisify(this,"get",k);w=b}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(m.default.logAction(m.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=b}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){m.default.logAction(m.default.LOG_MICRO,"RealtimePresence.setPresence()","received presence for "+s.length+" participants; syncChannelSerial = "+v);var k,L,N=this.members,P=this._myMembers,I=[],M=this.channel.connectionManager.connectionId;w&&(this.members.startSync(),v&&(L=v.match(/^[\w-]+:(.*)$/))&&(k=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&&!k&&(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){m.default.logAction(m.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 k=[],L=R.default.create();m.default.logAction(m.default.LOG_MICRO,"RealtimePresence.onAttached","sending "+v+" queued presence messages");for(var N=0;N<v;N++){var P=w[N];k.push(P.presence),L.push(P.callback)}this.channel.sendPresence(k,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){m.default.logAction(m.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);m.default.logAction(m.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 k in w.map){var L=w.map[k];m.default.logAction(m.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 k=S.default.fromValues({action:"leave",connectionId:v.connectionId,clientId:v.clientId,data:v.data,encoding:v.encoding,timestamp:a.now()});w.emit("leave",k)})},u.prototype.on=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];m.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];m.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),k=v[0],L=v[1],N=v[2],P=this.channel;if(!N){if(this.channel.realtime.options.promises)return a.promisify(this,"subscribe",[k,L]);N=b}if(P.state==="failed"){N(E.default.fromValues(P.invalidStateError()));return}this.subscriptions.on(k,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),k=v[0],L=v[1];this.subscriptions.off(k,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 k in w){var L=w[k];L.clientId==s&&L.action!="absent"&&v.push(L)}return v},u.prototype.list=function(s){var w=this.map,v=s&&s.clientId,k=s&&s.connectionId,L=[];for(var N in w){var P=w[N];P.action!=="absent"&&(v&&v!=P.clientId||k&&k!=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 k=w[v];return k&&!g(s,k)?!1:(w[v]=s,!0)},u.prototype.values=function(){var s=this.map,w=[];for(var v in s){var k=s[v];k.action!="absent"&&w.push(k)}return w},u.prototype.remove=function(s){var w=this.map,v=this.memberKey(s),k=w[v];return k&&!g(s,k)?!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;m.default.logAction(m.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(m.default.logAction(m.default.LOG_MINOR,"PresenceMap.endSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),w){for(var v in s){var k=s[v];k.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(m.default.logAction(m.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){m.default.logAction(m.default.LOG_MICRO,"PresenceMap.setInProgress()","inProgress = "+s),this.syncInProgress=s,this.presence.syncComplete=!s},u}(d.default);r.default=C},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=i(56),l=i(31),d=i(11),m=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="",b=this.base64CharSet,T=R.byteLength,x=T%3,p=T-x,g,C,h,c,u,s=0;s<p;s=s+3)u=R[s]<<16|R[s+1]<<8|R[s+2],g=(u&16515072)>>18,C=(u&258048)>>12,h=(u&4032)>>6,c=u&63,f+=b[g]+b[C]+b[h]+b[c];return x==1?(u=R[p],g=(u&252)>>2,C=(u&3)<<4,f+=b[g]+b[C]+"=="):x==2&&(u=R[p]<<8|R[p+1],g=(u&64512)>>10,C=(u&1008)>>4,h=(u&15)<<2,f+=b[g]+b[C]+b[h]+"="),f},y.prototype.base64ToArrayBuffer=function(R){for(var f=atob==null?void 0:atob(R),b=f.length,T=new Uint8Array(b),x=0;x<b;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),b=new Uint8Array(f),T=0;T<R.sigBytes;T++)b[T]=R.words[T>>>2]>>>24-T%4*8&255;return b}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:m.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 b=this.toWordArray(R),T=this.toWordArray(f);b.clamp(),T.clamp();var x=b.sigBytes-T.sigBytes;if(x!=0)return x;for(var p=b.words,g=T.words,C=0;C<p.length;C++)if(x=p[C]-g[C],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),m=i.n(d),S=i(2),E=i.n(S),y=i(4),R=i.n(y),f=function(b,T){var x="aes",p=256,g="cbc",C=16,h=4,c=4294967296,u=2147483648,s;if(b.getRandomWordArray)s=b.getRandomWordArray;else if(typeof Uint32Array!="undefined"&&b.getRandomValues){var w=new Uint32Array(h);s=function(A,j){var U=A/4,z=U==h?w:new Uint32Array(U);b.getRandomValues(z,function(W){typeof j!="undefined"&&j(W,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),W=0;W<U;W++)z[W]=Math.floor(Math.random()*c)-u;j(null,a.a.create(z))};function v(A){return A+C&-16}function k(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||g,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 k(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),W=this,G=function(){W.getIv(function(F,O){if(F){j(F);return}var D=W.encryptCipher.process(A.concat(N[z-U])),B=O.concat(D);j(null,B)})};this.encryptCipher?G():this.iv?(this.encryptCipher=m.a.algo[this.cjsAlgorithm].createEncryptor(this.key,{iv:this.iv}),G()):s(C,function(F,O){if(F){j(F);return}W.encryptCipher=m.a.algo[W.cjsAlgorithm].createEncryptor(W.key,{iv:O}),W.iv=O,G()})},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)),W=a.a.create(U.slice(j)),G=m.a.algo[this.cjsAlgorithm].createDecryptor(this.key,{iv:z}),F=G.process(W),O=G.finalize();return G.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(C,function(z,W){if(z){A(z);return}A(null,U.encryptCipher.process(W))})},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,m=a.enc;m.Utf16=m.Utf16BE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],b=0;b<R;b+=2){var T=y[b>>>2]>>>16-b%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)}},m.Utf16LE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],b=0;b<R;b+=2){var T=S(y[b>>>2]>>>16-b%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,m=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 m.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,m=a.algo,S=[],E=[],y=[],R=[],f=[],b=[],T=[],x=[],p=[],g=[];(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 k=c[s],L=c[k],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,b[s]=P;var P=N*16843009^L*65537^k*257^s*16843008;T[v]=P<<24|P>>>8,x[v]=P<<16|P>>>16,p[v]=P<<8|P>>>24,g[v]=P,s?(s=k^c[c[c[N^k]]],w^=c[c[w]]):s=w=1}})();var C=[0,1,2,4,8,16,32,64,128,27,54],h=m.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,k=(v+1)*4,L=this._keySchedule=[],N=0;N<k;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^=C[N/w|0]<<24),L[N]=L[N-w]^c);for(var P=this._invKeySchedule=[],I=0;I<k;I++){var N=k-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]]^g[S[c&255]]}}},encryptBlock:function(c,u){this._doCryptBlock(c,u,this._keySchedule,y,R,f,b,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,g,E);var s=c[u+1];c[u+1]=c[u+3],c[u+3]=s},_doCryptBlock:function(c,u,s,w,v,k,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=w[I>>>24]^v[M>>>16&255]^k[A>>>8&255]^L[j&255]^s[U++],G=w[M>>>24]^v[A>>>16&255]^k[j>>>8&255]^L[I&255]^s[U++],F=w[A>>>24]^v[j>>>16&255]^k[I>>>8&255]^L[M&255]^s[U++],O=w[j>>>24]^v[I>>>16&255]^k[M>>>8&255]^L[A&255]^s[U++];I=W,M=G,A=F,j=O}var W=(N[I>>>24]<<24|N[M>>>16&255]<<16|N[A>>>8&255]<<8|N[j&255])^s[U++],G=(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]=W,c[u+1]=G,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,m=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 m.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,g){for(var C=0;C<16;C++){var h=g+C,c=p[h];p[h]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360}var u=this._hash.words,s=p[g+0],w=p[g+1],v=p[g+2],k=p[g+3],L=p[g+4],N=p[g+5],P=p[g+6],I=p[g+7],M=p[g+8],A=p[g+9],j=p[g+10],U=p[g+11],z=p[g+12],W=p[g+13],G=p[g+14],F=p[g+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,k,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,W,12,y[13]),B=f(B,_,O,D,G,17,y[14]),D=f(D,B,_,O,F,22,y[15]),O=b(O,D,B,_,w,5,y[16]),_=b(_,O,D,B,P,9,y[17]),B=b(B,_,O,D,U,14,y[18]),D=b(D,B,_,O,s,20,y[19]),O=b(O,D,B,_,N,5,y[20]),_=b(_,O,D,B,j,9,y[21]),B=b(B,_,O,D,F,14,y[22]),D=b(D,B,_,O,L,20,y[23]),O=b(O,D,B,_,A,5,y[24]),_=b(_,O,D,B,G,9,y[25]),B=b(B,_,O,D,k,14,y[26]),D=b(D,B,_,O,M,20,y[27]),O=b(O,D,B,_,W,5,y[28]),_=b(_,O,D,B,v,9,y[29]),B=b(B,_,O,D,I,14,y[30]),D=b(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,G,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,_,W,4,y[40]),_=T(_,O,D,B,s,11,y[41]),B=T(B,_,O,D,k,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,G,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,k,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,W,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,g=p.words,C=this._nDataBytes*8,h=p.sigBytes*8;g[h>>>5]|=128<<24-h%32;var c=a.floor(C/4294967296),u=C;g[(h+64>>>9<<4)+15]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,g[(h+64>>>9<<4)+14]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360,p.sigBytes=(g.length+1)*4,this._process();for(var s=this._hash,w=s.words,v=0;v<4;v++){var k=w[v];w[v]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}return s},clone:function(){var p=S.clone.call(this);return p._hash=this._hash.clone(),p}});function f(p,g,C,h,c,u,s){var w=p+(g&C|~g&h)+c+s;return(w<<u|w>>>32-u)+g}function b(p,g,C,h,c,u,s){var w=p+(g&h|C&~h)+c+s;return(w<<u|w>>>32-u)+g}function T(p,g,C,h,c,u,s){var w=p+(g^C^h)+c+s;return(w<<u|w>>>32-u)+g}function x(p,g,C,h,c,u,s){var w=p+(C^(g|~h))+c+s;return(w<<u|w>>>32-u)+g}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)),m=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)),b=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 g(h){var c=h.connection,u=c&&c.connectionManager.host;return u?[u].concat(m.default.getFallbackHosts(h.options)):m.default.getHosts(h.options)}var C=(o=function(){function h(c){this.checksInProgress=null,this.checkConnectivity=void 0,this.supportsAuthHeaders=!1,this.supportsLinkHeaders=!1,this._getHosts=g,this.options=c||{};var u=this.options.connectivityCheckUrl||m.default.connectivityCheckUrl,s=this.options.connectivityCheckParams,w=!this.options.connectivityCheckUrl;l.default.Config.xhrSupported?(this.supportsAuthHeaders=!0,this.Request=function(v,k,L,N,P,I,M){var A=y.default.createRequest(L,N,P,I,R.default.REQ_SEND,k&&k.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(k,L,N,P,I){var M=!1;w?M=!k&&(L==null?void 0:L.replace(/\n/,""))=="yes":M=!k&&(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,k,L,N,P,I,M){var A=(0,b.createRequest)(L,N,P,I,R.default.REQ_SEND,k&&k.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 k=this,L=m.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 b.Request("isTheInternetUp",L,null,null,null,R.default.REQ_SEND,m.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<k.checksInProgress.length;A++)k.checksInProgress[A](null,M);k.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(k,L){var N=!k&&(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,k,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,k,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,k,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,k,L);return}L==null||L.apply(void 0,a.__spreadArray([j],U,!1))});return}else u._currentFallback=null;var M=g(u);if(M.length===1){this.doUri(c,u,P(M[0]),w,v,k,L);return}var A=function(j,U){var z=j.shift();N.doUri(c,u,P(z),w,v,k,function(W){for(var G=[],F=1;F<arguments.length;F++)G[F-1]=arguments[F];if(W&&p(W)&&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],G,!1))})};A(M)},h.prototype.doUri=function(c,u,s,w,v,k,L){if(!this.Request){L(new S.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(c,u,s,w,k,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=C},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)),m=o.__importStar(i(1)),S=i(1);function E(f,b){return!!b.get("x-ably-errorcode")}function y(f,b){if(E(f,b))return f.error&&a.default.fromValues(f.error)}function R(f,b,T,x,p,g,C){var h=new Headers(x||{}),c=f?f.toUpperCase():m.isEmptyArg(g)?"GET":"POST",u=new AbortController,s=setTimeout(function(){u.abort(),C(new a.PartialErrorInfo("Request timed out",null,408))},b?b.options.timeouts.httpRequestTimeout:d.default.TIMEOUTS.httpRequestTimeout),w={method:c,headers:h,body:g};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 k=v.headers.get("Content-Type"),L;k&&k.indexOf("application/x-msgpack")>-1?L=v.arrayBuffer():k&&k.indexOf("application/json")>-1?L=v.json():L=v.text(),L.then(function(N){var P=!!k&&k.indexOf("application/x-msgpack")===-1;if(v.ok)C(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);C(I,N,v.headers,P,v.status)}})}).catch(function(v){clearTimeout(s),C(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 m(){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:m(),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,b){R.getRandomValues(f),b&&b(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",m=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 b={value:y};return R&&(b.expires=l.now()+R),this.storageInterface(f).setItem(E,JSON.stringify(b))},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 m}).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),m=i.n(d),S=i(12),E=i.n(S),y=i(17),R=i.n(y),f=function(p){var g="xhr_polling";function C(h,c,u){u.stream=!1,E.a.call(this,h,c,u),this.shortName=g}return l.inherits(C,E.a),C.isAvailable=function(){return m.a.Config.xhrSupported&&m.a.Config.allowComet},C.prototype.toString=function(){return"XHRPollingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},C.prototype.createRequest=function(h,c,u,s,w){return R.a.createRequest(h,c,u,s,w,this.timeouts)},typeof p!="undefined"&&C.isAvailable()&&(p.supportedTransports[g]=C),C},b=f,T=function(p){var g="xhr_streaming";function C(h,c,u){E.a.call(this,h,c,u),this.shortName=g}return l.inherits(C,E.a),C.isAvailable=function(){return m.a.Config.xhrSupported&&m.a.Config.streamingSupported&&m.a.Config.allowComet},C.prototype.toString=function(){return"XHRStreamingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},C.prototype.createRequest=function(h,c,u,s,w){return R.a.createRequest(h,c,u,s,w,this.timeouts)},typeof p!="undefined"&&C.isAvailable()&&(p.supportedTransports[g]=C),C},x=T;r.default=[a.a,b,x]}]).default})})(rd);var Ug=rd.exports;const Bg=he(Ug),xo=(e,t,n,r,i)=>ot(this,null,function*(){try{const o=new Bg.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 m;try{const S=(m=d.data)==null?void 0:m.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}}),_g=(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=jg(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=Ng(),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},zg=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:zg(e),sender:"bot",timestamp:new Date().toISOString(),type:"text"}),ud=()=>typeof window!="undefined"&&window.innerWidth<640,Hg=({config:e})=>{if(!e.apiKey)return console.warn("WebChat: apiKey is required but not provided in config"),null;const[t,n]=ne.useState(()=>wo(e)),[r,i]=ne.useState(!1),[o,a]=ne.useState(()=>ud()),[l,h]=ne.useState(""),[m,S]=ne.useState(!1),[E,y]=ne.useState(!1),[R,f]=ne.useState(!1),[b,T]=ne.useState(""),[,x]=ne.useState(null),p=ne.useRef(null),[g,C]=ne.useState(!1),[d,c]=ne.useState(!1),[u,s]=ne.useState(""),[w,v]=ne.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),k=ne.useCallback((U,z="bot")=>{v(W=>[...W,U]),!r&&(U.sender==="bot"||z==="bot")&&U.id!==u&&C(!0)},[r,u]);ne.useEffect(()=>{const U=()=>{const z=ud();a(z)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),ne.useEffect(()=>Ig(()=>{n(wo(e))}),[e]),ne.useEffect(()=>{n(wo(e))},[e]),ne.useEffect(()=>{ot(this,null,function*(){const z=Yf();h(z);const W=yield qf();T(W)})},[]),ne.useEffect(()=>{if(w.length>0){const U=w[w.length-1];U.sender==="bot"&&s(U.id)}},[]);const L=ne.useCallback(U=>{k(U,"ably")},[k]),N=ne.useCallback(U=>ot(this,null,function*(){if(!(d||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)}}),[d,l,L]),P=ne.useCallback(()=>ot(this,null,function*(){if(!(d||p.current))try{const U=yield _g(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)}}),[d,l,e.apiKey,L]),I=ne.useCallback(()=>ot(this,null,function*(){var z,W;const U=r;if(i(G=>!G),!U){C(!1);const G=w.filter(F=>F.sender==="bot").slice(-1)[0];G&&s(G.id)}if(!U&&!m&&l&&Zf()&&!d){y(!0);const G=yield Lg(l,e.apiKey||"");if(((W=(z=G==null?void 0:G.conversation)==null?void 0:z.messages)==null?void 0:W.length)>0){const F=Dg(G.conversation.messages);v(F);const O=F.filter(D=>D.sender==="bot").slice(-1)[0];O&&s(O.id),yield N(G)}else console.warn("WebChat: No conversation history found, showing initial message");y(!1),S(!0)}else!U&&Zf()&&!d?yield P():U||console.warn("WebChat: Chat opened - no existing conversation to fetch")}),[r,l,m,d,e.apiKey,N,P,w]),M=ne.useCallback(()=>{i(!1)},[]),A=ne.useCallback(U=>ot(this,null,function*(){const z=new Date().toISOString(),W={id:wt(),text:U,sender:"user",timestamp:z,type:"text"};v(F=>[...F,W]),f(!0);const G=[...w,W];try{const F=od(l,G,{apiKey:e.apiKey||""},b),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&&k(D,"bot")}else{setTimeout(()=>{const D=id();k(D,"bot"),f(!1)},1e3);return}}catch(F){console.error("WebChat: Error in message handling:",F),setTimeout(()=>{const O=id();k(O,"bot"),f(!1)},1e3);return}f(!1),Tg(!0)}),[l,w,e.apiKey,b,L,k]),j=Mg(e);return ne.useEffect(()=>()=>{rd(p.current),p.current=null},[]),V.jsxs("div",{className:"nbc-font-sans",style:{zIndex:2147483647},children:[V.jsx(Bp,{isOpen:r,onClick:I,primaryColor:t.primaryColor,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,hasNewMessages:g,isMobile:o}),V.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-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-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-flex{display:flex}.nbc-hidden{display:none}.nbc-h-10{height:2.5rem}.nbc-h-16{height:4rem}.nbc-h-2{height:.5rem}.nbc-h-3{height:.75rem}.nbc-h-4{height:1rem}.nbc-h-5{height:1.25rem}.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-10{width:2.5rem}.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-7{width:1.75rem}.nbc-w-8{width:2rem}.nbc-w-auto{width:auto}.nbc-w-full{width:100%}.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-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-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-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.nbc-border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / 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-px-2{padding-left:.5rem;padding-right:.5rem}.nbc-px-4{padding-left:1rem;padding-right:1rem}.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-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-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-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-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}',Fg={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:""},Gg=({title:e,primaryColor:t="#3b82f6",avatar:n})=>{const r={backgroundColor:t};return V.jsxs("div",{style:r,className:"nbc-flex nbc-items-center nbc-p-4",children:[V.jsx("div",{className:"nbc-flex nbc-items-center nbc-mr-3 nbc-text-black",children:n?V.jsx("img",{src:n,alt:"Avatar",className:"nbc-w-8 nbc-h-8 nbc-rounded-full nbc-object-cover"}):V.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:[V.jsx("path",{d:"M12 6V2H8"}),V.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"}),V.jsx("path",{d:"M2 12h2"}),V.jsx("path",{d:"M9 11v2"}),V.jsx("path",{d:"M15 11v2"}),V.jsx("path",{d:"M20 12h2"})]})}),V.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]})},Wg=({footerText:e,primaryColor:t="#3b82f6"})=>{if(!e)return null;const n=r=>{const i=/(https?:\/\/[^\s]+)/g;return r.split(i).map((a,l)=>i.test(a)?V.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-medium nbc-no-underline",style:{color:t},children:a},l):a)};return V.jsx("div",{className:"nbc-py-3 nbc-px-4 nbc-bg-gray-50 nbc-border-t nbc-border-gray-200 nbc-text-xs nbc-text-gray-500 nbc-text-center nbc-leading-relaxed",children:n(e)})},$g=({config:e,messages:t,onSendMessage:n,isLoading:r,isAiTyping:i})=>{const o=(l,h="auto")=>l===void 0?h:typeof l=="number"?`${l}px`:l,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:"#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",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'};return V.jsxs("div",{style:a,children:[e.showHeader!==!1&&V.jsx(Gg,{title:e.title||"Chat",primaryColor:e.primaryColor,avatar:e.avatar}),V.jsxs("div",{className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-min-h-0",children:[r?V.jsx("div",{className:"nbc-flex-1 nbc-p-4",children:V.jsx($f,{})}):V.jsx("div",{className:"nbc-flex-1 nbc-overflow-y-auto",children:V.jsx(Gf,{messages:t,isTyping:i||!1,avatar:e.avatar})}),V.jsx("div",{className:"nbc-p-4 nbc-border-t nbc-border-gray-200 nbc-bg-gray-50",children:V.jsx(Wf,{onSendMessage:n,placeholder:e.placeholder||"Escribe un mensaje...",primaryColor:e.primaryColor,disabled:r})})]}),e.showFooter!==!1&&e.footerText&&V.jsx(Wg,{footerText:e.footerText,primaryColor:e.primaryColor})]})},fd=({config:e})=>{if(!e.apiKey)return console.warn("EmbedChat: apiKey is required but not provided in config"),null;const[t,n]=ne.useState(""),[r,i]=ne.useState(!1),[o,a]=ne.useState(""),[,l]=ne.useState(null),h=ne.useRef(null),[,m]=ne.useState(!1),[S,E]=ne.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),y=ne.useCallback(b=>{E(T=>[...T,b])},[]);ne.useEffect(()=>{ot(this,null,function*(){const T=yield qf();a(T)})},[]);const R=ne.useCallback(b=>{y(b)},[y]),f=ne.useCallback(b=>ot(this,null,function*(){if(!b.trim())return;let T=t;T||(T=wt(),n(T));const x={id:wt(),text:b,sender:"user",timestamp:new Date().toISOString(),conversationId:T,type:"text"};y(x),i(!0);const p=[...S,x];try{const g=od(T,p,{apiKey:e.apiKey||""},o),C=yield ad(g);if(C){if(C.response.tokenDetails&&!h.current){const c=yield xo(C.response.tokenDetails,e.apiKey||"",T,R);l(c),h.current=c.client,m(!0)}const d=sd(C.response.message);d&&y(d)}i(!1)}catch(g){console.error("EmbedChat: Error sending message:",g),i(!1)}}),[t,o,e.apiKey,y,R,S]);return ne.useEffect(()=>()=>{h.current&&rd(h.current)},[]),V.jsx($g,{config:e,messages:S,onSendMessage:f,isLoading:!1,isAiTyping:r})};let dd=!1,So=null;const hd=e=>{try{e&&(dd=!0),So&&(So.destroy(),So=null);const t=me(me({elementId:"webchat-notchatbot"},Fg),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=_s(o);return a.render(Mo.createElement(Hg,{config:t})),{root:a,destroy:()=>{a.unmount(),So=null},getConversationId:()=>Yf()}}catch(t){return console.error("WebChat: Failed to initialize",t),null}},Vg=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");r.textContent=cd,n.appendChild(r);const i=document.createElement("div");n.appendChild(i);const o=_s(i);return o.render(Mo.createElement(fd,{config:e})),{destroy:()=>{o.unmount()},updateConfig:a=>{const l=me(me({},e),a);o.render(Mo.createElement(fd,{config:l}))}}}catch(t){return console.error("EmbedChat: Failed to initialize",t),null}},pd={initialize:hd},gd={initialize:Vg};if(typeof window!="undefined"){window.WebChat=pd,window.EmbedChat=gd;const e=()=>{if(!dd){let n=document.getElementById("webchat-notchatbot");n||(n=document.createElement("div"),n.id="webchat-notchatbot",document.body.appendChild(n)),hd()}const t=new CustomEvent("WebChatReady");document.dispatchEvent(t)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,0)}be.EmbedChatAPI=gd,be.WebChat=pd,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})});
|
|
149
|
+
También puedes pedir hablar con nuestro equipo de los sueños!`,ld=e=>({id:wt(),text:zg(e),sender:"bot",timestamp:new Date().toISOString(),type:"text"}),ud=()=>typeof window!="undefined"&&window.innerWidth<640,Hg=({config:e})=>{if(!e.apiKey)return console.warn("WebChat: apiKey is required but not provided in config"),null;const[t,n]=ne.useState(()=>wo(e)),[r,i]=ne.useState(!1),[o,a]=ne.useState(()=>ud()),[l,d]=ne.useState(""),[m,S]=ne.useState(!1),[E,y]=ne.useState(!1),[R,f]=ne.useState(!1),[b,T]=ne.useState(""),[,x]=ne.useState(null),p=ne.useRef(null),[g,C]=ne.useState(!1),[h,c]=ne.useState(!1),[u,s]=ne.useState(""),[w,v]=ne.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),k=ne.useCallback((U,z="bot")=>{v(W=>[...W,U]),!r&&(U.sender==="bot"||z==="bot")&&U.id!==u&&C(!0)},[r,u]);ne.useEffect(()=>{const U=()=>{const z=ud();a(z)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),ne.useEffect(()=>Ig(()=>{n(wo(e))}),[e]),ne.useEffect(()=>{n(wo(e))},[e]),ne.useEffect(()=>{ot(this,null,function*(){const z=Zf();d(z);const W=yield ed();T(W)})},[]),ne.useEffect(()=>{if(w.length>0){const U=w[w.length-1];U.sender==="bot"&&s(U.id)}},[]);const L=ne.useCallback(U=>{k(U,"ably")},[k]),N=ne.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=ne.useCallback(()=>ot(this,null,function*(){if(!(h||p.current))try{const U=yield _g(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=ne.useCallback(()=>ot(this,null,function*(){var z,W;const U=r;if(i(G=>!G),!U){C(!1);const G=w.filter(F=>F.sender==="bot").slice(-1)[0];G&&s(G.id)}if(!U&&!m&&l&&qf()&&!h){y(!0);const G=yield Lg(l,e.apiKey||"");if(((W=(z=G==null?void 0:G.conversation)==null?void 0:z.messages)==null?void 0:W.length)>0){const F=Dg(G.conversation.messages);v(F);const O=F.filter(D=>D.sender==="bot").slice(-1)[0];O&&s(O.id),yield N(G)}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,m,h,e.apiKey,N,P,w]),M=ne.useCallback(()=>{i(!1)},[]),A=ne.useCallback(U=>ot(this,null,function*(){const z=new Date().toISOString(),W={id:wt(),text:U,sender:"user",timestamp:z,type:"text"};v(F=>[...F,W]),f(!0);const G=[...w,W];try{const F=od(l,G,{apiKey:e.apiKey||""},b),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&&k(D,"bot")}else{setTimeout(()=>{const D=So();k(D,"bot"),f(!1)},1e3);return}}catch(F){console.error("WebChat: Error in message handling:",F),setTimeout(()=>{const O=So();k(O,"bot"),f(!1)},1e3);return}f(!1),Tg(!0)}),[l,w,e.apiKey,b,L,k]),j=Mg(e);return ne.useEffect(()=>()=>{id(p.current),p.current=null},[]),V.jsxs("div",{className:"nbc-font-sans",style:{zIndex:2147483647},children:[V.jsx(Bp,{isOpen:r,onClick:I,primaryColor:t.primaryColor,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,hasNewMessages:g,isMobile:o}),V.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-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-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-flex{display:flex}.nbc-hidden{display:none}.nbc-h-10{height:2.5rem}.nbc-h-16{height:4rem}.nbc-h-2{height:.5rem}.nbc-h-3{height:.75rem}.nbc-h-4{height:1rem}.nbc-h-5{height:1.25rem}.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-10{width:2.5rem}.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-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-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-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-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-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-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}',Fg={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:""},Gg=({title:e,primaryColor:t="#3b82f6",avatar:n})=>{const r={backgroundColor:t};return V.jsxs("div",{id:"notchatbot-embed-chat-header",style:r,className:"nbc-flex nbc-items-center nbc-p-4",children:[V.jsx("div",{className:"nbc-flex nbc-items-center nbc-mr-3 nbc-text-black",children:n?V.jsx("img",{src:n,alt:"Avatar",className:"nbc-w-8 nbc-h-8 nbc-rounded-full nbc-object-cover"}):V.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:[V.jsx("path",{d:"M12 6V2H8"}),V.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"}),V.jsx("path",{d:"M2 12h2"}),V.jsx("path",{d:"M9 11v2"}),V.jsx("path",{d:"M15 11v2"}),V.jsx("path",{d:"M20 12h2"})]})}),V.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]})},Wg=({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)?V.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-medium nbc-no-underline",style:{color:t},children:l},d):l)};return V.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)})},$g=({config:e,messages:t,onSendMessage:n,isLoading:r,isAiTyping:i})=>{var l;const o=(d,m="auto")=>d===void 0?m: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 V.jsxs("div",{id:"notchatbot-embed-chat",className:"nbc-font-sans",style:a,children:[e.showHeader!==!1&&V.jsx(Gg,{title:e.title||"Chat",primaryColor:e.primaryColor,avatar:e.avatar}),V.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?V.jsx("div",{className:"nbc-flex-1 nbc-p-4",children:V.jsx(Vf,{})}):V.jsx(Wf,{messages:t,isTyping:i||!1,avatar:e.avatar,textColor:e.textColor,bubbleUserColor:e.bubbleUserColor}),V.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:V.jsx($f,{onSendMessage:n,placeholder:e.placeholder||"Escribe un mensaje...",primaryColor:e.primaryColor,disabled:r,input:e.input})})]}),e.showFooter!==!1&&e.footerText&&V.jsx(Wg,{footerText:e.footerText,primaryColor:e.primaryColor,footerColor:e.footerColor})]})},fd=({config:e})=>{if(!e.apiKey)return console.warn("EmbedChat: apiKey is required but not provided in config"),null;const[t,n]=ne.useState(""),[r,i]=ne.useState(!1),[o,a]=ne.useState(""),[,l]=ne.useState(null),d=ne.useRef(null),[,m]=ne.useState(!1),[S,E]=ne.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),y=ne.useCallback(b=>{E(T=>[...T,b])},[]);ne.useEffect(()=>{ot(this,null,function*(){const T=yield ed();a(T)})},[]);const R=ne.useCallback(b=>{y(b)},[y]),f=ne.useCallback(b=>ot(this,null,function*(){if(!b.trim())return;let T=t;T||(T=wt(),n(T));const x={id:wt(),text:b,sender:"user",timestamp:new Date().toISOString(),conversationId:T,type:"text"};y(x),i(!0);const p=[...S,x];try{const g=od(T,p,{apiKey:e.apiKey||""},o),C=yield ad(g);if(C){if(C.response.tokenDetails&&!d.current){const c=yield xo(C.response.tokenDetails,e.apiKey||"",T,R);l(c),d.current=c.client,m(!0)}const h=sd(C.response.message);h&&y(h)}else{setTimeout(()=>{const h=So();y(h),i(!1)},1e3);return}i(!1)}catch(g){console.error("EmbedChat: Error sending message:",g),setTimeout(()=>{const C=So();y(C),i(!1)},1e3);return}}),[t,o,e.apiKey,y,R,S]);return ne.useEffect(()=>()=>{d.current&&id(d.current)},[]),V.jsx($g,{config:e,messages:S,onSendMessage:f,isLoading:!1,isAiTyping:r})};let dd=!1,Co=null;const hd=e=>{try{e&&(dd=!0),Co&&(Co.destroy(),Co=null);const t=me(me({elementId:"webchat-notchatbot"},Fg),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(Hg,{config:t})),{root:a,destroy:()=>{a.unmount(),Co=null},getConversationId:()=>Zf()}}catch(t){return console.error("WebChat: Failed to initialize",t),null}},Vg=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=me(me({},e),a);if(a.customCSS!==void 0){const d=n.querySelector("style[data-custom]");if(d&&d.remove(),l.customCSS){const m=document.createElement("style");m.setAttribute("data-custom","true"),m.textContent=l.customCSS,n.appendChild(m)}}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:Vg};if(typeof window!="undefined"){window.WebChat=pd,window.EmbedChat=gd;const e=()=>{if(!dd){let n=document.getElementById("webchat-notchatbot");n||(n=document.createElement("div"),n.id="webchat-notchatbot",document.body.appendChild(n)),hd()}const t=new CustomEvent("WebChatReady");document.dispatchEvent(t)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,0)}be.EmbedChatAPI=gd,be.WebChat=pd,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})});
|