").addClass("dx-gesture-cover").css("pointerEvents","none");return Dt.subscribeGlobal(t,"dxmousewheel",(function(e){e.preventDefault()})),xh((function(){t.appendTo("body")})),function(e,n){t.css("pointerEvents",e?"all":"none"),e&&t.css("cursor",n)}})),kh=$c.inherit({gesture:!0,configure:function(e){this.getElement().css("msTouchAction",e.immediate?"pinch-zoom":""),this.callBase(e)},allowInterruptionByMouseWheel:function(){return 2!==this._stage},getDirection:function(){return this.direction},_cancel:function(){this.callBase.apply(this,arguments),this._toggleGestureCover(!1),this._stage=0},start:function(e){e._needSkipEvent||ls(e)?this._cancel(e):(this._startEvent=cs(e),this._startEventData=os(e),this._stage=1,this._init(e),this._setupImmediateTimer())},_setupImmediateTimer:function(){var e;clearTimeout(this._immediateTimer),this._immediateAccepted=!1,this.immediate&&(0!==this.immediateTimeout?this._immediateTimer=setTimeout(function(){this._immediateAccepted=!0}.bind(this),null!==(e=this.immediateTimeout)&&void 0!==e?e:180):this._immediateAccepted=!0)},move:function(e){if(1===this._stage&&this._directionConfirmed(e)){if(this._stage=2,this._resetActiveElement(),this._toggleGestureCover(!0),this._clearSelection(e),this._adjustStartEvent(e),this._start(this._startEvent),0===this._stage)return;this._requestAccept(e),this._move(e),this._forgetAccept()}else 2===this._stage&&(this._clearSelection(e),this._move(e))},_directionConfirmed:function(e){var t=this._getTouchBoundary(e),n=ss(this._startEventData,os(e)),i=Eh(n.x),r=Eh(n.y),o=this._validateMove(t,i,r),s=this._validateMove(t,r,i),a=this.getDirection(e);return"both"===a&&(o||s)||"horizontal"===a&&o||"vertical"===a&&s||this._immediateAccepted},_validateMove:function(e,t,n){return t&&t>=e&&(!this.immediate||t>=n)},_getTouchBoundary:function(e){return this.immediate||is(e)?0:Ih},_adjustStartEvent:function(e){var t=this._getTouchBoundary(e),n=ss(this._startEventData,os(e));this._startEvent.pageX+=ti(n.x)*t,this._startEvent.pageY+=ti(n.y)*t},_resetActiveElement:function(){"ios"===aa.real().platform&&this.getElement().find(":focus").length&&Sa()},_toggleGestureCover:function(e){this._toggleGestureCoverImpl(e)},_toggleGestureCoverImpl:function(e){2===this._stage&&function(e,t){Th()(e,t)}(e,this.getElement().css("cursor"))},_clearSelection:function(e){is(e)||rs(e)||(()=>{var t=Ca.getSelection();if(t&&"Caret"!==t.type)if(t.empty)t.empty();else if(t.removeAllRanges)try{t.removeAllRanges()}catch(e){}})()},end:function(e){this._toggleGestureCover(!1),2===this._stage?this._end(e):1===this._stage&&this._stop(e),this._stage=0},dispose:function(){clearTimeout(this._immediateTimer),this.callBase.apply(this,arguments),this._toggleGestureCover(!1)},_init:Pe,_start:Pe,_move:Pe,_stop:Pe,_end:Pe});kh.initialTouchBoundary=Ih,kh.touchBoundary=function(e){if(!l(e))return Ih;Ih=e};const Dh=kh;var Oh=B.abstract,Ah=aa.real(),Rh="scroll",Ph="dxscrollinit",Nh="dxscrollstart",Mh="dxscroll",Lh="dxscrollend",Fh="dxscrollstop",Bh="dxscrollcancel",Vh=B.inherit(function(){var e=ds(Rh,"dxScrollEmitter");return{ctor:function(t){this._element=t,this._locked=!1,this._proxiedScroll=e=>{this._disposed||this._scroll(e)},Dt.on(this._element,e,this._proxiedScroll)},_scroll:Oh,check:function(e,t){this._locked&&t()},dispose:function(){this._disposed=!0,Dt.off(this._element,e,this._proxiedScroll)}}}()),Hh=Vh.inherit({ctor:function(e,t){this.callBase(e),this._timeout=t},_scroll:function(){this._prepare(),this._forget()},_prepare:function(){this._timer&&this._clearTimer(),this._locked=!0},_clearTimer:function(){clearTimeout(this._timer),this._locked=!1,this._timer=null},_forget:function(){var e=this;this._timer=setTimeout((function(){e._clearTimer()}),this._timeout)},dispose:function(){this.callBase(),this._clearTimer()}}),Uh=Hh.inherit({ctor:function(e){this.callBase(e,400),this._lastWheelDirection=null},check:function(e,t){this._checkDirectionChanged(e),this.callBase(e,t)},_checkDirectionChanged:function(e){if(is(e)){var t=e.shiftKey||!1,n=null!==this._lastWheelDirection&&t!==this._lastWheelDirection;this._lastWheelDirection=t,this._locked=this._locked&&!n}else this._lastWheelDirection=null}}),zh=Hh.inherit({ctor:function(e){this.callBase(e,400)}});!function(){var{ios:e,android:t}=Ah;(e||t)&&(zh=Vh.inherit({_scroll:function(){this._locked=!0;var e=this;sc(this._scrollFrame),this._scrollFrame=oc((function(){e._locked=!1}))},check:function(e,t){sc(this._scrollFrame),sc(this._checkFrame);var n=this,i=this.callBase;this._checkFrame=oc((function(){i.call(n,e,t),n._locked=!1}))},dispose:function(){this.callBase(),sc(this._scrollFrame),sc(this._checkFrame)}}))}();var jh=Dh.inherit(function(){var e=Math.round(1e3/60);return{ctor:function(e){this.callBase.apply(this,arguments),this.direction="both",this._pointerLocker=new zh(e),this._wheelLocker=new Uh(e)},validate:function(){return!0},configure:function(e){e.scrollTarget&&(this._pointerLocker.dispose(),this._wheelLocker.dispose(),this._pointerLocker=new zh(e.scrollTarget),this._wheelLocker=new Uh(e.scrollTarget)),this.callBase(e)},_init:function(e){this._wheelLocker.check(e,function(){is(e)&&this._accept(e)}.bind(this)),this._pointerLocker.check(e,function(){var t=this.isNative&&ns(e);is(e)||t||this._accept(e)}.bind(this)),this._fireEvent(Ph,e),this._prevEventData=os(e)},move:function(e){this.callBase.apply(this,arguments),e.isScrollingEvent=this.isNative||e.isScrollingEvent},_start:function(e){this._savedEventData=os(e),this._fireEvent(Nh,e),this._prevEventData=os(e)},_move:function(e){var t=os(e);this._fireEvent(Mh,e,{delta:ss(this._prevEventData,t)}),ss(this._savedEventData,t).time>200&&(this._savedEventData=this._prevEventData),this._prevEventData=os(e)},_end:function(t){var n=ss(this._prevEventData,os(t)),i={x:0,y:0};if(!is(t)&&n.time<100){var r=ss(this._savedEventData,this._prevEventData),o=e/r.time;i={x:r.x*o,y:r.y*o}}this._fireEvent(Lh,t,{velocity:i})},_stop:function(e){this._fireEvent(Fh,e)},cancel:function(e){this.callBase.apply(this,arguments),this._fireEvent(Bh,e)},dispose:function(){this.callBase.apply(this,arguments),this._pointerLocker.dispose(),this._wheelLocker.dispose()},_clearSelection:function(){if(!this.isNative)return this.callBase.apply(this,arguments)},_toggleGestureCover:function(){if(!this.isNative)return this.callBase.apply(this,arguments)}}}());Zc({emitter:jh,events:[Ph,Nh,Mh,Lh,Fh,Bh]});const $h=Ph,Wh=Nh,Gh=Mh,Kh=Lh,qh=Fh,Qh=Bh,Xh=Rh;function Yh(e){return(t,n,i,r)=>{var o=r?ds(e,r):e;if(n)return Dt.on(t,o,i,n),()=>{Dt.off(t,o,n)}}}Yh(eu),Yh(Xh),Yh($h),Yh(Wh),Yh(Gh),Yh(Kh),Yh(qh),Yh(Qh),Yh(zc.down),Yh(zc.up),Yh(zc.move),Yh("mouseenter"),Yh("mouseleave"),Yh("keydown");var Jh=Yh("dxactive"),Zh=Yh("dxinactive"),ed=Yh("dxhoverstart"),td=Yh("dxhoverend"),nd=Yh("focusin"),id=Yh("focusout"),rd={className:"",activeStateEnabled:!1,disabled:!1,focusStateEnabled:!1,hoverStateEnabled:!1,tabIndex:0,visible:!0},od=function(e){const t=xs++;return{id:t,defaultValue:e,Provider:class extends jo{getChildContext(){return Object.assign(Object.assign({},this.context),{[t]:this.props.value||e})}render(){return this.props.children}}}}(void 0),sd=["children","rtlEnabled"];class ad extends ws{constructor(e){super(e),this.state={},this.__getterCache={}}getChildContext(){return H({},this.context,{[od.id]:this.config||od.defaultValue})}get config(){return void 0!==this.__getterCache.config?this.__getterCache.config:this.__getterCache.config=(()=>({rtlEnabled:this.props.rtlEnabled}))()}get restAttributes(){return ql(this.props,sd)}componentWillUpdate(e,t,n){this.props.rtlEnabled!==e.rtlEnabled&&(this.__getterCache.config=void 0)}render(){var e=this.props;return{props:H({},e),config:this.config,restAttributes:this.restAttributes}.props.children}}ad.defaultProps={};var ld=["_feedbackHideTimeout","_feedbackShowTimeout","accessKey","activeStateEnabled","activeStateUnit","addWidgetClass","aria","children","className","classes","cssText","disabled","focusStateEnabled","height","hint","hoverStateEnabled","name","onActive","onClick","onDimensionChanged","onFocusIn","onFocusOut","onHoverEnd","onHoverStart","onInactive","onKeyDown","onRootElementRendered","onVisibilityChange","rootElementRef","rtlEnabled","tabIndex","visible","width"],cd=Object.create(Object.prototype,H(Object.getOwnPropertyDescriptors(rd),Object.getOwnPropertyDescriptors({_feedbackHideTimeout:400,_feedbackShowTimeout:30,cssText:"",aria:Object.freeze({}),classes:"",name:"",addWidgetClass:!0})));class ud extends Ss{constructor(e){super(e),this.widgetElementRef={current:null},this.state={active:!1,focused:!1,hovered:!1},this.setRootElementRef=this.setRootElementRef.bind(this),this.activeEffect=this.activeEffect.bind(this),this.inactiveEffect=this.inactiveEffect.bind(this),this.clickEffect=this.clickEffect.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.activate=this.activate.bind(this),this.deactivate=this.deactivate.bind(this),this.focusInEffect=this.focusInEffect.bind(this),this.focusOutEffect=this.focusOutEffect.bind(this),this.hoverStartEffect=this.hoverStartEffect.bind(this),this.hoverEndEffect=this.hoverEndEffect.bind(this),this.keyboardEffect=this.keyboardEffect.bind(this),this.resizeEffect=this.resizeEffect.bind(this),this.windowResizeEffect=this.windowResizeEffect.bind(this),this.visibilityEffect=this.visibilityEffect.bind(this),this.checkDeprecation=this.checkDeprecation.bind(this),this.applyCssTextEffect=this.applyCssTextEffect.bind(this)}get config(){return this.context[od.id]?this.context[od.id]:od.defaultValue}createEffects(){return[new Es(this.setRootElementRef,[]),new Es(this.activeEffect,[this.props._feedbackShowTimeout,this.props.activeStateEnabled,this.props.activeStateUnit,this.props.disabled,this.props.onActive]),new Es(this.inactiveEffect,[this.props._feedbackHideTimeout,this.props.activeStateEnabled,this.props.activeStateUnit,this.props.onInactive,this.state.active]),new Es(this.clickEffect,[this.props.disabled,this.props.name,this.props.onClick]),new Es(this.focusInEffect,[this.props.disabled,this.props.focusStateEnabled,this.props.name,this.props.onFocusIn]),new Es(this.focusOutEffect,[this.props.focusStateEnabled,this.props.name,this.props.onFocusOut,this.state.focused]),new Es(this.hoverStartEffect,[this.props.activeStateUnit,this.props.disabled,this.props.hoverStateEnabled,this.props.onHoverStart,this.state.active]),new Es(this.hoverEndEffect,[this.props.activeStateUnit,this.props.hoverStateEnabled,this.props.onHoverEnd,this.state.hovered]),new Es(this.keyboardEffect,[this.props.focusStateEnabled,this.props.onKeyDown]),new Es(this.resizeEffect,[this.props.name,this.props.onDimensionChanged]),new Es(this.windowResizeEffect,[this.props.onDimensionChanged]),new Es(this.visibilityEffect,[this.props.name,this.props.onVisibilityChange]),new Es(this.checkDeprecation,[this.props.height,this.props.width]),new Es(this.applyCssTextEffect,[this.props.cssText]),Is()]}updateEffects(){var e,t,n,i,r,o,s,a,l,c,u,h,d;null===(e=this._effects[1])||void 0===e||e.update([this.props._feedbackShowTimeout,this.props.activeStateEnabled,this.props.activeStateUnit,this.props.disabled,this.props.onActive]),null===(t=this._effects[2])||void 0===t||t.update([this.props._feedbackHideTimeout,this.props.activeStateEnabled,this.props.activeStateUnit,this.props.onInactive,this.state.active]),null===(n=this._effects[3])||void 0===n||n.update([this.props.disabled,this.props.name,this.props.onClick]),null===(i=this._effects[4])||void 0===i||i.update([this.props.disabled,this.props.focusStateEnabled,this.props.name,this.props.onFocusIn]),null===(r=this._effects[5])||void 0===r||r.update([this.props.focusStateEnabled,this.props.name,this.props.onFocusOut,this.state.focused]),null===(o=this._effects[6])||void 0===o||o.update([this.props.activeStateUnit,this.props.disabled,this.props.hoverStateEnabled,this.props.onHoverStart,this.state.active]),null===(s=this._effects[7])||void 0===s||s.update([this.props.activeStateUnit,this.props.hoverStateEnabled,this.props.onHoverEnd,this.state.hovered]),null===(a=this._effects[8])||void 0===a||a.update([this.props.focusStateEnabled,this.props.onKeyDown]),null===(l=this._effects[9])||void 0===l||l.update([this.props.name,this.props.onDimensionChanged]),null===(c=this._effects[10])||void 0===c||c.update([this.props.onDimensionChanged]),null===(u=this._effects[11])||void 0===u||u.update([this.props.name,this.props.onVisibilityChange]),null===(h=this._effects[12])||void 0===h||h.update([this.props.height,this.props.width]),null===(d=this._effects[13])||void 0===d||d.update([this.props.cssText])}setRootElementRef(){var{onRootElementRendered:e,rootElementRef:t}=this.props;t&&(t.current=this.widgetElementRef.current),null===e||void 0===e||e(this.widgetElementRef.current)}activeEffect(){var{_feedbackShowTimeout:e,activeStateEnabled:t,activeStateUnit:n,disabled:i,onActive:r}=this.props,o=n;if(t&&!i)return Jh(this.widgetElementRef.current,(e=>{this.setState((e=>({active:!0}))),null===r||void 0===r||r(e)}),{timeout:e,selector:o},"UIFeedback")}inactiveEffect(){var{_feedbackHideTimeout:e,activeStateEnabled:t,activeStateUnit:n,onInactive:i}=this.props,r=n;if(t)return Zh(this.widgetElementRef.current,(e=>{this.state.active&&(this.setState((e=>({active:!1}))),null===i||void 0===i||i(e))}),{timeout:e,selector:r},"UIFeedback")}clickEffect(){var{disabled:e,name:t,onClick:n}=this.props,i=t;if(n&&!e)return dl(this.widgetElementRef.current,n,{namespace:i}),()=>pl(this.widgetElementRef.current,{namespace:i})}focusInEffect(){var{disabled:e,focusStateEnabled:t,name:n,onFocusIn:i}=this.props,r="".concat(n,"Focus");if(t&&!e)return nd(this.widgetElementRef.current,(e=>{e.isDefaultPrevented()||(this.setState((e=>({focused:!0}))),null===i||void 0===i||i(e))}),null,r)}focusOutEffect(){var{focusStateEnabled:e,name:t,onFocusOut:n}=this.props,i="".concat(t,"Focus");if(e)return id(this.widgetElementRef.current,(e=>{!e.isDefaultPrevented()&&this.state.focused&&(this.setState((e=>({focused:!1}))),null===n||void 0===n||n(e))}),null,i)}hoverStartEffect(){var{activeStateUnit:e,disabled:t,hoverStateEnabled:n,onHoverStart:i}=this.props,r=e;if(n&&!t)return ed(this.widgetElementRef.current,(e=>{!this.state.active&&this.setState((e=>({hovered:!0}))),null===i||void 0===i||i(e)}),{selector:r},"UIFeedback")}hoverEndEffect(){var{activeStateUnit:e,hoverStateEnabled:t,onHoverEnd:n}=this.props,i=e;if(t)return td(this.widgetElementRef.current,(e=>{this.state.hovered&&(this.setState((e=>({hovered:!1}))),null===n||void 0===n||n(e))}),{selector:i},"UIFeedback")}keyboardEffect(){var{focusStateEnabled:e,onKeyDown:t}=this.props;if(e&&t){var n=_l(this.widgetElementRef.current,this.widgetElementRef.current,(e=>t(e)));return()=>yl(n)}}resizeEffect(){var e="".concat(this.props.name,"VisibilityChange"),{onDimensionChanged:t}=this.props;if(t)return il(this.widgetElementRef.current,t,{namespace:e}),()=>rl(this.widgetElementRef.current,{namespace:e})}windowResizeEffect(){var{onDimensionChanged:e}=this.props;if(e)return Ks.add(e),()=>{Ks.remove(e)}}visibilityEffect(){var{name:e,onVisibilityChange:t}=this.props,n="".concat(e,"VisibilityChange");if(t)return al(this.widgetElementRef.current,(()=>t(!0)),(()=>t(!1)),{namespace:n}),()=>ll(this.widgetElementRef.current,{namespace:n})}checkDeprecation(){var{height:e,width:t}=this.props;c(t)&&O.log("W0017","width"),c(e)&&O.log("W0017","height")}applyCssTextEffect(){var{cssText:e}=this.props;""!==e&&(this.widgetElementRef.current.style.cssText=e)}get shouldRenderConfigProvider(){var{rtlEnabled:e}=this.props;return function(e,t){var n=l(e),i=l(W().rtlEnabled)&&!n&&!l(null===t||void 0===t?void 0:t.rtlEnabled);return n&&e!==(null===t||void 0===t?void 0:t.rtlEnabled)||i}(e,this.config)}get rtlEnabled(){var{rtlEnabled:e}=this.props;return function(e,t){return void 0!==e?e:void 0!==(null===t||void 0===t?void 0:t.rtlEnabled)?t.rtlEnabled:W().rtlEnabled}(e,this.config)}get attributes(){var e,{aria:t,disabled:n,focusStateEnabled:i,visible:r}=this.props,o=i&&!n&&this.props.accessKey;return H({},y({},o&&{accessKey:o}),(e=H({},t,{disabled:n,hidden:!r}),Object.keys(e).reduce(((t,n)=>e[n]?H({},t,{["role"===n||"id"===n?n:"aria-".concat(n)]:String(e[n])}):t),{})),y({},this.restAttributes))}get styles(){var{height:e,width:t}=this.props,n=this.restAttributes.style||{},i=Xt("width",c(t)?t():t),r=Xt("height",c(e)?e():e);return H({},n,{height:null!==r&&void 0!==r?r:n.height,width:null!==i&&void 0!==i?i:n.width})}get cssClasses(){var{activeStateEnabled:e,addWidgetClass:t,className:n,classes:i,disabled:r,focusStateEnabled:o,hoverStateEnabled:s,onVisibilityChange:a,visible:l}=this.props,c=!!o&&!r,u=!!s&&!r,h=!!e&&!r;return sh({"dx-widget":!!t,[String(i)]:!!i,[String(n)]:!!n,"dx-state-disabled":!!r,"dx-state-invisible":!l,"dx-state-focused":!!this.state.focused&&c,"dx-state-active":!!this.state.active&&h,"dx-state-hover":!!this.state.hovered&&u&&!this.state.active,"dx-rtl":!!this.rtlEnabled,"dx-visibility-change-handler":!!a})}get tabIndex(){var{disabled:e,focusStateEnabled:t,tabIndex:n}=this.props;return t&&!e?n:void 0}get restAttributes(){return ql(this.props,ld)}focus(){hl(this.widgetElementRef.current)}blur(){var e=We.getActiveElement(this.widgetElementRef.current);this.widgetElementRef.current===e&&e.blur()}activate(){this.setState((e=>({active:!0})))}deactivate(){this.setState((e=>({active:!1})))}render(){return(e=>{var t=Ir(Cr(1,"div",e.cssClasses,e.props.children,0,H({},e.attributes,{tabIndex:e.tabIndex,title:e.props.hint,style:Vs(e.styles)}),null,e.widgetElementRef));return e.shouldRenderConfigProvider?Sr(2,ad,{rtlEnabled:e.rtlEnabled,children:t}):t})({props:H({},this.props),active:this.state.active,focused:this.state.focused,hovered:this.state.hovered,widgetElementRef:this.widgetElementRef,config:this.config,shouldRenderConfigProvider:this.shouldRenderConfigProvider,rtlEnabled:this.rtlEnabled,attributes:this.attributes,styles:this.styles,cssClasses:this.cssClasses,tabIndex:this.tabIndex,restAttributes:this.restAttributes})}}ud.defaultProps=cd;var hd=["accessKey","activeStateEnabled","children","className","disabled","focusStateEnabled","height","hint","hoverStateEnabled","icon","iconPosition","iconTemplate","onClick","onKeyDown","onSubmit","pressed","rtlEnabled","stylingMode","tabIndex","template","templateData","text","type","useInkRipple","useSubmitBehavior","visible","width"],dd=["outlined","text","contained"],pd=Object.create(Object.prototype,H(Object.getOwnPropertyDescriptors(rd),Object.getOwnPropertyDescriptors({activeStateEnabled:!0,hoverStateEnabled:!0,icon:"",iconPosition:"left",stylingMode:"contained",text:"",type:"normal",useInkRipple:!1,useSubmitBehavior:!1,templateData:Object.freeze({})}))),fd=function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]}([{device:()=>"desktop"===aa.real().deviceType&&!aa.isSimulator(),options:{focusStateEnabled:!0}},{device:()=>eh(Qu()),options:{useInkRipple:!0}}]),md=e=>e&&(e.defaultProps?t=>Ir(Sr(2,e,H({},t))):e);class gd extends Ss{constructor(e){super(e),this.state={},this.contentRef={current:null},this.inkRippleRef={current:null},this.submitInputRef={current:null},this.widgetRef={current:null},this.__getterCache={},this.focus=this.focus.bind(this),this.activate=this.activate.bind(this),this.deactivate=this.deactivate.bind(this),this.submitEffect=this.submitEffect.bind(this),this.onActive=this.onActive.bind(this),this.onInactive=this.onInactive.bind(this),this.onWidgetClick=this.onWidgetClick.bind(this),this.keyDown=this.keyDown.bind(this),this.emitClickEvent=this.emitClickEvent.bind(this)}createEffects(){return[new Es(this.submitEffect,[this.props.onSubmit,this.props.useSubmitBehavior]),Is()]}updateEffects(){var e;null===(e=this._effects[0])||void 0===e||e.update([this.props.onSubmit,this.props.useSubmitBehavior])}submitEffect(){var{onSubmit:e,useSubmitBehavior:t}=this.props;if(t&&e)return fl(this.submitInputRef.current,(t=>e({event:t,submitInput:this.submitInputRef.current})),{namespace:"UIFeedback"}),()=>ml(this.submitInputRef.current,{namespace:"UIFeedback"})}onActive(e){var{useInkRipple:t}=this.props;t&&this.inkRippleRef.current.showWave({element:this.contentRef.current,event:e})}onInactive(e){var{useInkRipple:t}=this.props;t&&this.inkRippleRef.current.hideWave({element:this.contentRef.current,event:e})}onWidgetClick(e){var{onClick:t,useSubmitBehavior:n}=this.props;null===t||void 0===t||t({event:e}),n&&this.submitInputRef.current.click()}keyDown(e){var{onKeyDown:t}=this.props,{keyName:n,originalEvent:i,which:r}=e,o=null===t||void 0===t?void 0:t(e);if(null!==o&&void 0!==o&&o.cancel)return o;"space"!==n&&"space"!==r&&"enter"!==n&&"enter"!==r||(i.preventDefault(),this.emitClickEvent())}emitClickEvent(){this.contentRef.current.click()}get aria(){var{icon:e,text:t}=this.props,n=null!==t&&void 0!==t?t:"";if(!t&&e)switch(Su(e)){case"image":n=!e.includes("base64")&&/^(?!(?:https?:\/\/)|(?:ftp:\/\/)|(?:www\.))[^\s]+$/.test(e)?e.replace(/.+\/([^.]+)\..+$/,"$1"):"";break;case"dxIcon":n=Li.format(zt(e,!0))||e;break;case"fontIcon":n=e;break;case"svg":var i,r;n=null!==(i=null===(r=/
(.*?)<\/title>/.exec(e))||void 0===r?void 0:r[1])&&void 0!==i?i:""}return H({role:"button"},n?{label:n}:{})}get cssClasses(){return(e=>{var{icon:t,iconPosition:n,stylingMode:i,text:r,type:o}=e,s=i&&dd.includes(i);return sh({"dx-button":!0,["dx-button-mode-".concat(s?i:"contained")]:!0,["dx-button-".concat(null!==o&&void 0!==o?o:"normal")]:!0,"dx-button-has-text":!!r,"dx-button-has-icon":!!t,"dx-button-icon-right":"left"!==n})})(this.props)}get iconSource(){var{icon:e}=this.props;return null!==e&&void 0!==e?e:""}get inkRippleConfig(){return void 0!==this.__getterCache.inkRippleConfig?this.__getterCache.inkRippleConfig:this.__getterCache.inkRippleConfig=(()=>{var{icon:e,text:t}=this.props;return!t&&e?{isCentered:!0,useHoldAnimation:!1,waveSizeCoefficient:1}:{}})()}get buttonTemplateData(){var{icon:e,templateData:t,text:n}=this.props;return H({icon:e,text:n},t)}get restAttributes(){return ql(this.props,hd)}focus(){this.widgetRef.current.focus()}activate(){this.widgetRef.current.activate()}deactivate(){this.widgetRef.current.deactivate()}componentWillUpdate(e,t,n){super.componentWillUpdate(),this.props.icon===e.icon&&this.props.text===e.text||(this.__getterCache.inkRippleConfig=void 0)}render(){var e=this.props;return(e=>{var{children:t,iconPosition:n,iconTemplate:i,template:r,text:o}=e.props,s=!e.props.template&&!t&&""!==o,a="left"===n,l=!e.props.template&&!t&&(e.iconSource||e.props.iconTemplate)&&Sr(2,lh,{source:e.iconSource,position:n,iconTemplate:i});return Ir(Sr(2,ud,H({accessKey:e.props.accessKey,activeStateEnabled:e.props.activeStateEnabled,aria:e.aria,className:e.props.className,classes:e.cssClasses,disabled:e.props.disabled,focusStateEnabled:e.props.focusStateEnabled,height:e.props.height,hint:e.props.hint,hoverStateEnabled:e.props.hoverStateEnabled,onActive:e.onActive,onClick:e.onWidgetClick,onInactive:e.onInactive,onKeyDown:e.keyDown,rtlEnabled:e.props.rtlEnabled,tabIndex:e.props.tabIndex,visible:e.props.visible,width:e.props.width},e.restAttributes,{children:Cr(1,"div","dx-button-content",[e.props.template&&r({data:e.buttonTemplateData}),!e.props.template&&t,a&&l,s&&Cr(1,"span","dx-button-text",o,0),!a&&l,e.props.useSubmitBehavior&&Cr(64,"input","dx-button-submit-input",null,1,{type:"submit",tabIndex:-1},null,e.submitInputRef),e.props.useInkRipple&&Sr(2,Sh,{config:e.inkRippleConfig},null,e.inkRippleRef)],0,null,null,e.contentRef)}),null,e.widgetRef))})({props:H({},e,{template:md(e.template),iconTemplate:md(e.iconTemplate)}),contentRef:this.contentRef,submitInputRef:this.submitInputRef,inkRippleRef:this.inkRippleRef,widgetRef:this.widgetRef,onActive:this.onActive,onInactive:this.onInactive,onWidgetClick:this.onWidgetClick,keyDown:this.keyDown,emitClickEvent:this.emitClickEvent,aria:this.aria,cssClasses:this.cssClasses,iconSource:this.iconSource,inkRippleConfig:this.inkRippleConfig,buttonTemplateData:this.buttonTemplateData,restAttributes:this.restAttributes})}}gd.defaultProps=Object.create(Object.prototype,H(Object.getOwnPropertyDescriptors(pd),Object.getOwnPropertyDescriptors(H({},ca(fd)))));var vd=[];class _d extends xu{getProps(){var e=super.getProps();return e.onKeyDown=this._wrapKeyDownHandler(e.onKeyDown),e}focus(){var e;return null===(e=this.viewRef)||void 0===e?void 0:e.focus(...arguments)}activate(){var e;return null===(e=this.viewRef)||void 0===e?void 0:e.activate(...arguments)}deactivate(){var e;return null===(e=this.viewRef)||void 0===e?void 0:e.deactivate(...arguments)}_getActionConfigs(){return{onClick:{excludeValidators:["readOnly"]},onSubmit:{}}}get _propsInfo(){return{twoWay:[],allowNull:[],elements:["onSubmit"],templates:["template","iconTemplate"],props:["activeStateEnabled","hoverStateEnabled","icon","iconPosition","onClick","onSubmit","pressed","stylingMode","template","iconTemplate","text","type","useInkRipple","useSubmitBehavior","templateData","className","accessKey","disabled","focusStateEnabled","height","hint","onKeyDown","rtlEnabled","tabIndex","visible","width"]}}get _viewComponent(){return gd}}Zn("dxButton",_d),_d.defaultOptions=function(e){vd.push(e),gd.defaultProps=Object.create(Object.prototype,H(Object.getOwnPropertyDescriptors(gd.defaultProps),Object.getOwnPropertyDescriptors(ca(fd)),Object.getOwnPropertyDescriptors(ca(vd))))};const yd=_d;var bd=n(7),wd=Dt.on,Cd=(Dt.one,Dt.off),Sd=(Dt.trigger,Dt.triggerHandler),xd=(Dt.Event,n(164)),Ed=n.t(xd,2),Id=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!==typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Td=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Dd=function(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(D){r={error:D}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s},Od=(0,t.createContext)({lock:function(){},unlock:function(){}});function Ad(){return Math.random().toString(36).substring(2)}var Rd=function(){function e(){this._map=new Map}return e.prototype.set=function(e,t){var n=e.key1,i=e.key2,r=this._map.get(n);r||(r=new Map,this._map.set(n,r)),r.set(i,t)},e.prototype.get=function(e){var t=e.key1,n=e.key2,i=this._map.get(t);return i?i.get(n):void 0},e.prototype.delete=function(e){var t=e.key1,n=e.key2,i=this._map.get(t);i&&(i.delete(n),0===i.size&&this._map.delete(t))},Object.defineProperty(e.prototype,"empty",{get:function(){return 0===this._map.size},enumerable:!1,configurable:!0}),e.prototype.shallowCopy=function(){var t=new e;return t._map=this._map,t},e.prototype[Symbol.iterator]=function(){var e,t,n,i,r,o,s,a,l,c,u,h,d,p,f,m;return Td(this,(function(g){switch(g.label){case 0:g.trys.push([0,11,12,13]),e=kd(this._map),t=e.next(),g.label=1;case 1:if(t.done)return[3,10];n=Dd(t.value,2),i=n[0],r=n[1],g.label=2;case 2:g.trys.push([2,7,8,9]),f=void 0,o=kd(r),s=o.next(),g.label=3;case 3:return s.done?[3,6]:(a=Dd(s.value,2),l=a[0],c=a[1],[4,[{key1:i,key2:l},c]]);case 4:g.sent(),g.label=5;case 5:return s=o.next(),[3,3];case 6:return[3,9];case 7:return u=g.sent(),f={error:u},[3,9];case 8:try{s&&!s.done&&(m=o.return)&&m.call(o)}finally{if(f)throw f.error}return[7];case 9:return t=e.next(),[3,1];case 10:return[3,13];case 11:return h=g.sent(),d={error:h},[3,13];case 12:try{t&&!t.done&&(p=e.return)&&p.call(e)}finally{if(d)throw d.error}return[7];case 13:return[2]}}))},e}(),Pd=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Id(t,e),t}(Rd);var Nd=function(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(D){r={error:D}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s},Md=function(e,n,i){var r={display:"none"};switch(e){case"TABLE":return t.createElement("tbody",{style:r,ref:n});case"TBODY":return t.createElement("tr",{style:r,ref:n});default:return t.createElement(i,{style:r,ref:n})}},Ld=(0,t.memo)((function(e){var n=e.templateFactory,i=e.data,r=e.index,o=e.container,s=e.onRemoved,a=e.onRendered,l=Nd((0,t.useState)(!1),2),c=l[0],u=l[1],h=(0,t.useRef)(!1),d=(0,t.useMemo)((function(){return{lock:function(){h.current=!0},unlock:function(){h.current=!1}}}),[]),p=(0,t.useRef)(),f=(0,t.useRef)(),m=(0,t.useRef)(),g=(0,t.useCallback)((function(e,t){(null===t||void 0===t?void 0:t.isUnmounting)||h.current||(p.current&&Cd(p.current,bp,g),m.current&&Cd(m.current,bp,g),s())}),[s]);(0,t.useLayoutEffect)((function(){var e=p.current;return e&&e.nodeType===Node.ELEMENT_NODE?(Cd(e,bp,g),wd(e,bp,g)):c?m.current&&(Cd(m.current,bp,g),wd(m.current,bp,g)):u(!0),function(){p.current&&o.appendChild(p.current),f.current&&o.appendChild(f.current),m.current&&o.appendChild(m.current),e&&Cd(e,bp,g)}}),[g,c,o]),(0,t.useEffect)((function(){a()}),[a]);var v=Md(null===o||void 0===o?void 0:o.nodeName,(function(e){f.current=e,p.current=null===e||void 0===e?void 0:e.previousSibling}),"div"),_=c?Md(null===o||void 0===o?void 0:o.nodeName,(function(e){m.current=e}),"span"):void 0;return(0,xd.createPortal)(t.createElement(t.Fragment,null,t.createElement(Od.Provider,{value:d},n({data:i,index:r,onRendered:a}),v,_)),o)})),Fd={useLegacyTemplateEngine:!1};var Bd=function(){return Bd=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0)&&!(i=o.next()).done;)s.push(i.value)}catch(D){r={error:D}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s};function Hd(e){if(Fd["useLegacyTemplateEngine"]){var t=e.data;return t&&Object.prototype.hasOwnProperty.call(t,"key")&&(t.dxkey=t.key),t}return e}var Ud=function(e){var n=e.init,i=Vd((0,t.useState)(new Pd),2),r=i[0],o=i[1],s=Vd((0,t.useState)(),2),a=s[0],l=s[1],c=(0,t.useRef)(""),u=(0,t.useRef)({}),h=(0,t.useCallback)((function(e,t){e.nodeType===Node.ELEMENT_NODE&&wd(e,bp,t)}),[]),d=(0,t.useCallback)((function(e,t){e.nodeType===Node.ELEMENT_NODE&&Cd(e,bp,t)}),[]),p=(0,t.useCallback)((function(e,t){return{key1:e,key2:t}}),[]),f=(0,t.useCallback)((function(){return""+Ad()+Ad()+Ad()}),[]),m=(0,t.useCallback)((function(e){return function(t){var n=t.model,i=t.index,r=t.container,s=t.onRendered,a=p(n,r),l=function(){o((function(e){return e.get(a)?(e.delete(a),e.shallowCopy()):e}))},u=c.current;return o((function(t){return t.set(a,{templateKey:e,index:i,componentKey:f(),onRendered:function(){d(r,l),u===c.current&&(null===s||void 0===s||s())},onRemoved:l}),t.shallowCopy()})),r}}),[d,p]);return(0,t.useMemo)((function(){n({createDXTemplates:function(e){var n=Object.entries(e).reduce((function(e,n){var i,r=Vd(n,2),o=r[0],s=r[1];return Bd(Bd({},e),((i={})[o]=function(e){switch(e.type){case"children":return function(){return e.content};case"render":return function(t){return Hd(t),e.content(t.data,t.index)};case"component":return function(n){return n=Hd(n),t.createElement.bind(null,e.content)(n)};default:return function(){return t.createElement(t.Fragment)}}}(s),i))}),{});u.current=n;var i=Object.keys(n).reduce((function(e,t){return e[t]={render:m(t)},e}),{});return i},clearInstantiationModels:function(){c.current=f(),o(new Pd)},updateTemplates:function(e){l({onUpdated:e})}})}),[n,m]),(0,t.useEffect)((function(){a&&a.onUpdated()}),[a]),r.empty?null:t.createElement(t.Fragment,null,Array.from(r).map((function(e){var n=Vd(e,2),i=n[0],r=i.key1,o=i.key2,s=n[1],a=s.index,l=s.templateKey,c=s.componentKey,d=s.onRendered,p=s.onRemoved;return h(o,p),t.createElement(Ld,{key:c,templateFactory:u.current[l],data:r,index:a,container:o,onRemoved:p,onRendered:d})})))};function zd(){for(var e=[],t=0;t0)&&!(i=o.next()).done;)s.push(i.value)}catch(D){r={error:D}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s},Jd=function(e,t){for(var n=0,i=t.length,r=e.length;n0&&this.setValue("integrationOptions",{templates:t}),Object.keys(o.options).forEach((function(e){n.setValue(e,o.options[e])})),this.isUpdating=!1,this.instance.off("optionChanged",r),this.currentConfig=e,i.forEach((function(t){var i=Yd(t,2),r=i[0],o=i[1],s=e.options[r];Object.prototype.hasOwnProperty.call(e.options,r)&&s!==o&&n.setValue(r,s)})),this.instance.endUpdate())},e.prototype.onOptionChanged=function(e){var t,n=this;if(!this.isUpdating){var i=qd(this.currentConfig,e.fullName.split("."));if(i&&i.value===e.value||this.callOptionChangeHandler(e.fullName,e.value),i=qd(this.currentConfig,e.fullName.split("."))){var r,o,s=i.value,a=i.type;if(s instanceof Array&&a===jd.Array){for(var l=0;l0&&o.hasTranscludedContent);i&&o.templates.push(i)})),{fullName:i,predefinedOptions:e.descriptor.predefinedValuesProps,initialOptions:r.defaults,options:r.options,templates:o.templates,configCollections:o.configCollections,configs:o.configs}}var gp=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!==typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),vp=function(){return vp=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0)&&!(i=o.next()).done;)s.push(i.value)}catch(D){r={error:D}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s},yp=function(e,t){for(var n=0,i=t.length,r=e.length;n0||r>0}()?{width:"100%",height:"100%",padding:0,margin:0}:{display:"contents"}},n.prototype.componentDidMount=function(){var e,t,n=this.props.style;(null===(t=this._childNodes)||void 0===t?void 0:t.length)?(e=this._element).append.apply(e,yp([],_p(this._childNodes))):this._element.childNodes.length&&(this._childNodes=Array.from(this._element.childNodes)),this._updateCssClasses(null,this.props),n&&this._setInlineStyles(n)},n.prototype.componentDidUpdate=function(e){var t;this._updateCssClasses(e,this.props);var n=this._getConfig(),i=this._optionsManager.getTemplateOptions(n),r=(null===(t=this._createDXTemplates)||void 0===t?void 0:t.call(this,i))||{};this._optionsManager.update(n,r),this._scheduleTemplatesUpdate()},n.prototype.componentWillUnmount=function(){var e;if(this._lockParentOnRemoved(),this._instance){null===(e=this._childNodes)||void 0===e||e.forEach((function(e){var t;return null===(t=e.parentNode)||void 0===t?void 0:t.removeChild(e)})),Sd(this._element,bp,{isUnmounting:!0}),this._instance.dispose()}this._optionsManager.dispose(),this._unlockParentOnRemoved()},n.prototype._createWidget=function(e){var t,n;e=e||this._element;var i=this._getConfig(),r=vp({templatesRenderAsynchronously:!0},this._optionsManager.getInitialOptions(i)),o=this._optionsManager.getTemplateOptions(i),s=null===(t=this._createDXTemplates)||void 0===t?void 0:t.call(this,o);s&&Object.keys(s).length&&(r=vp(vp({},r),{integrationOptions:{templates:s}})),null===(n=this._clearInstantiationModels)||void 0===n||n.call(this),this._instance=new this._WidgetClass(e,r),this.useRequestAnimationFrameFlag||(this.useDeferUpdateForTemplates=this._instance.option("integrationOptions.useDeferUpdateForTemplates")),this._optionsManager.setInstance(this._instance,i,this.subscribableOptions,this.independentEvents),this._instance.on("optionChanged",this._optionsManager.onOptionChanged)},n.prototype._scheduleTemplatesUpdate=function(){var e=this;this.guardsUpdateScheduled||(this.guardsUpdateScheduled=!0,(this.useDeferUpdateForTemplates?xe:oc)((function(){var t;e.guardsUpdateScheduled=!1,null===(t=e._updateTemplates)||void 0===t||t.call(e,(function(){return np()}))})),tp())},n.prototype._getConfig=function(){return e={templates:this._templateProps,initialValuesProps:this._defaults,predefinedValuesProps:{},expectedChildren:this._expectedChildren},t=this.props,mp({type:cp.Option,descriptor:fp({name:"",isCollection:!1},e),props:t},"");var e,t},n.prototype._getElementProps=function(){var e=this,t={ref:function(t){e._element=t}};return rp.forEach((function(n){var i=e.props;n in i&&(t[n]=i[n])})),t},n.prototype._setInlineStyles=function(e){var t=this;Object.entries(e).forEach((function(e){var n=_p(e,2),i=n[0],r=n[1];t._element.style[i]=r}))},n.prototype._updateCssClasses=function(e,t){var n,i,r=e?lp(e):void 0,o=lp(t);if(r!==o){var s;if(r)(s=r.split(" ").filter((function(e){return e}))).length&&(n=this._element.classList).remove.apply(n,yp([],_p(s)));if(o)(s=o.split(" ").filter((function(e){return e}))).length&&(i=this._element.classList).add.apply(i,yp([],_p(s)))}},n.prototype._lockParentOnRemoved=function(){var e;null===(e=this.context)||void 0===e||e.lock()},n.prototype._unlockParentOnRemoved=function(){var e;null===(e=this.context)||void 0===e||e.unlock()},n.prototype._setTemplateManagerHooks=function(e){var t=e.createDXTemplates,n=e.clearInstantiationModels,i=e.updateTemplates;this._createDXTemplates=t,this._clearInstantiationModels=n,this._updateTemplates=i},n.prototype.renderChildren=function(){return this.props.children},n.prototype.renderContent=function(){var e=this,i=this.props.children;return this.isPortalComponent&&i?t.createElement("div",{ref:function(t){t&&e.portalContainer!==t&&(e.portalContainer=t,e.forceUpdate())},style:n.displayContentsStyle()}):this.renderChildren()},n.prototype.renderPortal=function(){return this.portalContainer&&(0,xd.createPortal)(this.renderChildren(),this.portalContainer)},n.prototype.render=function(){return t.createElement(t.Fragment,{},t.createElement("div",this._getElementProps(),this.renderContent(),t.createElement(Ud,{init:this._setTemplateManagerHooks})),this.isPortalComponent&&this.renderPortal())},n.contextType=Od,n}(t.PureComponent),Cp=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!==typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Sp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Cp(t,e),t.prototype.componentDidMount=function(){var e=this.props.onMounted;e?e(this._createWidget):this._createWidget()},t}(wp),xp=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!==typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ep=function(e){function n(t){var n=e.call(this,t)||this;return n._extensionCreators=[],n._registerExtension=n._registerExtension.bind(n),n}return xp(n,e),n.prototype.componentDidMount=function(){e.prototype.componentDidMount.call(this),this._createWidget(),this._createExtensions()},n.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this),this.clearExtensions()},n.prototype.clearExtensions=function(){this._extensionCreators=[]},n.prototype.renderChildren=function(){var e=this;return t.Children.map(this.props.children,(function(n){return n&&Object.prototype.isPrototypeOf.call(Sp,n.type)?t.cloneElement(n,{onMounted:e._registerExtension}):n}))},n.prototype._registerExtension=function(e){this._extensionCreators.push(e)},n.prototype._createExtensions=function(){var e=this;this._extensionCreators.forEach((function(t){return t(e._element)}))},n}(wp),Ip=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!==typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Tp=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._WidgetClass=yd,t.independentEvents=["onClick","onContentReady","onDisposing","onInitialized"],t._templateProps=[{tmplOption:"template",render:"render",component:"component",keyFn:"keyFn"}],t}return Ip(t,e),Object.defineProperty(t.prototype,"instance",{get:function(){return this._instance},enumerable:!1,configurable:!0}),t}(Ep);Tp.propTypes={accessKey:bd.string,activeStateEnabled:bd.bool,disabled:bd.bool,elementAttr:bd.object,focusStateEnabled:bd.bool,height:bd.oneOfType([bd.func,bd.number,bd.string]),hint:bd.string,hoverStateEnabled:bd.bool,icon:bd.string,onClick:bd.func,onContentReady:bd.func,onDisposing:bd.func,onInitialized:bd.func,onOptionChanged:bd.func,rtlEnabled:bd.bool,stylingMode:bd.oneOfType([bd.string,bd.oneOf(["text","outlined","contained"])]),tabIndex:bd.number,text:bd.string,type:bd.oneOfType([bd.string,bd.oneOf(["danger","default","normal","success"])]),useSubmitBehavior:bd.bool,validationGroup:bd.string,visible:bd.bool,width:bd.oneOfType([bd.func,bd.number,bd.string])};const kp=Tp;function Dp(e,t,n){function i(e){return"string"===typeof e?e.split("."):"number"===typeof e?[e]:e}e=i(e),t=i(t);var r=Math.max(e.length,t.length);isFinite(n)&&(r=Math.min(r,n));for(var o=0;oa)return 1}return 0}function Op(e,t,n){e="role"===e||"id"===e?e:"aria-".concat(e),t=l(t)?t.toString():null,n.attr(e,t)}var Ap=Kl.inherit({_feedbackHideTimeout:400,_feedbackShowTimeout:30,_supportedKeys:()=>({}),_getDefaultOptions(){return y(this.callBase(),{hoveredElement:null,isActive:!1,disabled:!1,visible:!0,hint:void 0,activeStateEnabled:!1,onContentReady:null,hoverStateEnabled:!1,focusStateEnabled:!1,tabIndex:0,accessKey:void 0,onFocusIn:null,onFocusOut:null,onKeyboardHandled:null,ignoreParentReadOnly:!1,useResizeObserver:!0})},_defaultOptionsRules:function(){return this.callBase().concat([{device:function(){var e=aa.real(),t=e.platform,n=e.version;return"ios"===t&&Dp(n,"13.3")<=0},options:{useResizeObserver:!1}}])},_init(){this.callBase(),this._initContentReadyAction()},_innerWidgetOptionChanged:function(e,t){var n=Ap.getOptionsFromContainer(t);e&&e.option(n),this._options.cache(t.name,n)},_bindInnerWidgetOptions(e,t){var n=()=>this._options.silent(t,y({},e.option()));n(),e.on("optionChanged",n)},_getAriaTarget(){return this._focusTarget()},_initContentReadyAction(){this._contentReadyAction=this._createActionByOption("onContentReady",{excludeValidators:["disabled","readOnly"]})},_initMarkup(){var{disabled:e,visible:t}=this.option();this.$element().addClass("dx-widget"),this._toggleDisabledState(e),this._toggleVisibility(t),this._renderHint(),this._isFocusable()&&this._renderFocusTarget(),this.callBase()},_render(){this.callBase(),this._renderContent(),this._renderFocusState(),this._attachFeedbackEvents(),this._attachHoverEvents(),this._toggleIndependentState()},_renderHint(){var{hint:e}=this.option();this.$element().attr("title",e||null)},_renderContent(){Se((()=>this._disposed?void 0:this._renderContentImpl())).done((()=>this._disposed?void 0:this._fireContentReadyAction()))},_renderContentImpl:Pe,_fireContentReadyAction:Ee((function(){return this._contentReadyAction()})),_dispose(){this._contentReadyAction=null,this._detachKeyboardEvents(),this.callBase()},_resetActiveState(){this._toggleActiveState(this._eventBindingTarget(),!1)},_clean(){this._cleanFocusState(),this._resetActiveState(),this.callBase(),this.$element().empty()},_toggleVisibility(e){this.$element().toggleClass("dx-state-invisible",!e)},_renderFocusState(){this._attachKeyboardEvents(),this._isFocusable()&&(this._renderFocusTarget(),this._attachFocusEvents(),this._renderAccessKey())},_renderAccessKey(){var e=this._focusTarget(),{accessKey:t}=this.option();e.attr("accesskey",t)},_isFocusable(){var{focusStateEnabled:e,disabled:t}=this.option();return e&&!t},_eventBindingTarget(){return this.$element()},_focusTarget(){return this._getActiveElement()},_isFocusTarget:function(e){return Un(this._focusTarget()).toArray().includes(e)},_findActiveTarget(e){return e.find(this._activeStateUnit).not(".dx-state-disabled")},_getActiveElement(){var e=this._eventBindingTarget();return this._activeStateUnit?this._findActiveTarget(e):e},_renderFocusTarget(){var{tabIndex:e}=this.option();this._focusTarget().attr("tabIndex",e)},_keyboardEventBindingTarget(){return this._eventBindingTarget()},_refreshFocusEvent(){this._detachFocusEvents(),this._attachFocusEvents()},_focusEventTarget(){return this._focusTarget()},_focusInHandler(e){e.isDefaultPrevented()||this._createActionByOption("onFocusIn",{beforeExecute:()=>this._updateFocusState(e,!0),excludeValidators:["readOnly"]})({event:e})},_focusOutHandler(e){e.isDefaultPrevented()||this._createActionByOption("onFocusOut",{beforeExecute:()=>this._updateFocusState(e,!1),excludeValidators:["readOnly","disabled"]})({event:e})},_updateFocusState(e,t){var{target:n}=e;this._isFocusTarget(n)&&this._toggleFocusClass(t,Un(n))},_toggleFocusClass(e,t){(t&&t.length?t:this._focusTarget()).toggleClass("dx-state-focused",e)},_hasFocusClass(e){return Un(e||this._focusTarget()).hasClass("dx-state-focused")},_isFocused(){return this._hasFocusClass()},_getKeyboardListeners:()=>[],_attachKeyboardEvents(){this._detachKeyboardEvents();var{focusStateEnabled:e,onKeyboardHandled:t}=this.option(),n=this._getKeyboardListeners().length;(e||n||!!t)&&(this._keyboardListenerId=_l(this._keyboardEventBindingTarget(),this._focusTarget(),(e=>this._keyboardHandler(e))))},_keyboardHandler(e,t){if(!t){var{originalEvent:n,keyName:i,which:r}=e,o=this._supportedKeys(n),s=o[i]||o[r];if(void 0!==s)if(!s.bind(this)(n,e))return!1}var a=this._getKeyboardListeners(),{onKeyboardHandled:l}=this.option();return a.forEach((t=>t&&t._keyboardHandler(e))),l&&l(e),!0},_refreshFocusState(){this._cleanFocusState(),this._renderFocusState()},_cleanFocusState(){this._focusTarget().removeAttr("tabIndex"),this._toggleFocusClass(!1),this._detachFocusEvents(),this._detachKeyboardEvents()},_detachKeyboardEvents(){yl(this._keyboardListenerId),this._keyboardListenerId=null},_attachHoverEvents(){var{hoverStateEnabled:e}=this.option(),t=this._activeStateUnit,n=this._eventBindingTarget();sl(n,{selector:t,namespace:"UIFeedback"}),e&&ol(n,new va((e=>{var{event:t,element:n}=e;this._hoverStartHandler(t),this.option("hoveredElement",Un(n))}),{excludeValidators:["readOnly"]}),(e=>{this.option("hoveredElement",null),this._hoverEndHandler(e)}),{selector:t,namespace:"UIFeedback"})},_attachFeedbackEvents(){var{activeStateEnabled:e}=this.option(),t=this._activeStateUnit,n=this._eventBindingTarget();nl(n,{namespace:"UIFeedback",selector:t}),e&&tl(n,new va((e=>{var{event:t,element:n}=e;return this._toggleActiveState(Un(n),!0,t)})),new va((e=>{var{event:t,element:n}=e;return this._toggleActiveState(Un(n),!1,t)}),{excludeValidators:["disabled","readOnly"]}),{showTimeout:this._feedbackShowTimeout,hideTimeout:this._feedbackHideTimeout,selector:t,namespace:"UIFeedback"})},_detachFocusEvents(){var e=this._focusEventTarget();ul(e,{namespace:"".concat(this.NAME,"Focus")})},_attachFocusEvents(){var e=this._focusEventTarget();cl(e,(e=>this._focusInHandler(e)),(e=>this._focusOutHandler(e)),{namespace:"".concat(this.NAME,"Focus"),isFocusable:(e,t)=>Un(t).is(Go)})},_hoverStartHandler:Pe,_hoverEndHandler:Pe,_toggleActiveState(e,t){this.option("isActive",t),e.toggleClass("dx-state-active",t)},_updatedHover(){var e=this._options.silent("hoveredElement");this._hover(e,e)},_findHoverTarget(e){return e&&e.closest(this._activeStateUnit||this._eventBindingTarget())},_hover(e,t){var{hoverStateEnabled:n,disabled:i,isActive:r}=this.option();if((t=this._findHoverTarget(t))&&t.toggleClass("dx-state-hover",!1),e&&n&&!i&&!r){var o=this._findHoverTarget(e);o&&o.toggleClass("dx-state-hover",!0)}},_toggleDisabledState(e){this.$element().toggleClass("dx-state-disabled",Boolean(e)),this.setAria("disabled",e||void 0)},_toggleIndependentState(){this.$element().toggleClass("dx-state-independent",this.option("ignoreParentReadOnly"))},_setWidgetOption(e,t){if(this[e])if(f(t[0]))w(t[0],((t,n)=>this._setWidgetOption(e,[t,n])));else{var n=t[0],i=t[1];1===t.length&&(i=this.option(n));var r=this["".concat(e,"OptionMap")];this[e].option(r?r(n):n,i)}},_optionChanged(e){var{name:t,value:n,previousValue:i}=e;switch(t){case"disabled":this._toggleDisabledState(n),this._updatedHover(),this._refreshFocusState();break;case"hint":this._renderHint();break;case"ignoreParentReadOnly":this._toggleIndependentState();break;case"activeStateEnabled":this._attachFeedbackEvents();break;case"hoverStateEnabled":this._attachHoverEvents(),this._updatedHover();break;case"tabIndex":case"focusStateEnabled":this._refreshFocusState();break;case"onFocusIn":case"onFocusOut":case"useResizeObserver":break;case"accessKey":this._renderAccessKey();break;case"hoveredElement":this._hover(n,i);break;case"isActive":this._updatedHover();break;case"visible":this._toggleVisibility(n),this._isVisibilityChangeSupported()&&this._checkVisibilityChanged(n?"shown":"hiding");break;case"onKeyboardHandled":this._attachKeyboardEvents();break;case"onContentReady":this._initContentReadyAction();break;default:this.callBase(e)}},_isVisible(){var{visible:e}=this.option();return this.callBase()&&e},beginUpdate(){this._ready(!1),this.callBase()},endUpdate(){this.callBase(),this._initialized&&this._ready(!0)},_ready(e){if(0===arguments.length)return this._isReady;this._isReady=e},setAria(){if(f(arguments.length<=0?void 0:arguments[0])){var e=(arguments.length<=1?void 0:arguments[1])||this._getAriaTarget();w(arguments.length<=0?void 0:arguments[0],((t,n)=>Op(t,n,e)))}else Op(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],(arguments.length<=2?void 0:arguments[2])||this._getAriaTarget())},isReady(){return this._ready()},repaint(){this._refresh()},focus(){hl(this._focusTarget())},registerKeyHandler(e,t){var n=this._supportedKeys();this._supportedKeys=()=>y(n,{[e]:t})}});Ap.getOptionsFromContainer=e=>{var{name:t,fullName:n,value:i}=e,r={};t===n?r=i:r[n.split(".").pop()]=i;return r};const Rp=Ap;var Pp=Ze(),Np="dx-loadindicator-segment",Mp=Rp.inherit({_getDefaultOptions:function(){return y(this.callBase(),{indicatorSrc:"",activeStateEnabled:!1,hoverStateEnabled:!1,_animatingSegmentCount:1,_animatingSegmentInner:!1})},_defaultOptionsRules:function(){var e=Qu();return this.callBase().concat([{device:function(){return"android"===aa.real().platform&&!/chrome/i.test(Pp.userAgent)},options:{viaImage:!0}},{device:function(){return Zu(e)},options:{_animatingSegmentCount:2,_animatingSegmentInner:!0}},{device:function(){return nh(e)},options:{_animatingSegmentCount:7}}])},_useTemplates:function(){return!1},_init:function(){this.callBase(),this.$element().addClass("dx-loadindicator")},_initMarkup:function(){this.callBase(),this._renderWrapper(),this._renderIndicatorContent(),this._renderMarkup()},_renderWrapper:function(){this._$wrapper=Un("").addClass("dx-loadindicator-wrapper"),this.$element().append(this._$wrapper)},_renderIndicatorContent:function(){this._$content=Un("
").addClass("dx-loadindicator-content"),this._$wrapper.append(this._$content)},_renderMarkup:function(){var{viaImage:e,indicatorSrc:t}=this.option();!vc()||e||t?this._renderMarkupForImage():this._renderMarkupForAnimation()},_renderMarkupForAnimation:function(){var e=this.option("_animatingSegmentInner");this._$indicator=Un("
").addClass("dx-loadindicator-icon"),this._$content.append(this._$indicator);for(var t=this.option("_animatingSegmentCount");t>=0;--t){var n=Un("
").addClass(Np).addClass(Np+t);e&&n.append(Un("
").addClass("dx-loadindicator-segment-inner")),this._$indicator.append(n)}},_renderMarkupForImage:function(){var{indicatorSrc:e}=this.option();e?(this._$wrapper.addClass("dx-loadindicator-image"),this._$wrapper.css("backgroundImage","url("+e+")")):vc()&&this._renderMarkupForAnimation()},_renderDimensions:function(){this.callBase(),this._updateContentSizeForAnimation()},_updateContentSizeForAnimation:function(){if(this._$indicator){var e=this.option("width"),t=this.option("height");if(e||t){e=yn(this.$element()),t=bn(this.$element());var n=Math.min(t,e);this._$wrapper.css({height:n,width:n,fontSize:n})}}},_clean:function(){this.callBase(),this._removeMarkupForAnimation(),this._removeMarkupForImage()},_removeMarkupForAnimation:function(){this._$indicator&&(this._$indicator.remove(),delete this._$indicator)},_removeMarkupForImage:function(){this._$wrapper.css("backgroundImage","none")},_optionChanged:function(e){switch(e.name){case"_animatingSegmentCount":case"_animatingSegmentInner":case"indicatorSrc":this._invalidate();break;default:this.callBase(e)}}});Zn("dxLoadIndicator",Mp);const Lp=Mp;var Fp="dxTranslator",Bp=/matrix(3d)?\((.+?)\)/,Vp=/translate(?:3d)?\((.+?)\)/,Hp=function(e){e=Un(e);var t=Wp(e);return{left:t.x,top:t.y}};function Up(e){return"string"===s(e)&&"%"===e[e.length-1]}function zp(e,t){e.length&&Mt(e.get(0),Fp,t)}var jp=function(e){e.length&&Lt(e.get(0),Fp)},$p=function(e){return e.x=e.x||0,e.y=e.y||0,"translate("+(Up(e.x)?e.x:e.x+"px")+", "+(Up(e.y)?e.y:e.y+"px")+")"},Wp=function(e){var t=e.length?Mt(e.get(0),Fp):null;if(!t){var n=(e.css("transform")||$p({x:0,y:0})).match(Bp),i=n&&n[1];n?(n=n[2].split(","),"3d"===i?n=n.slice(12,15):(n.push(0),n=n.slice(4,7))):n=[0,0,0],zp(e,t={x:parseFloat(n[0]),y:parseFloat(n[1]),z:parseFloat(n[2])})}return t},Gp=function(e,t){e=Un(e);var n,i=t.left,r=t.top;void 0===i?(n=Wp(e)).y=r||0:void 0===r?(n=Wp(e)).x=i||0:zp(e,n={x:i||0,y:r||0,z:0}),e.css({transform:$p(n)}),(Up(i)||Up(r))&&jp(e)},Kp=function(e,t){var n;e=Un(e);var i={left:0,top:0,transform:"none"};t&&(n=e.css("transition"),i.transition="none"),e.css(i),jp(e),t&&(e.get(0).offsetHeight,e.css("transition",n))},qp=/cubic-bezier\((\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\)/,Qp={linear:"cubic-bezier(0, 0, 1, 1)",swing:"cubic-bezier(0.445, 0.05, 0.55, 0.95)",ease:"cubic-bezier(0.25, 0.1, 0.25, 1)","ease-in":"cubic-bezier(0.42, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.58, 1)","ease-in-out":"cubic-bezier(0.42, 0, 0.58, 1)"},Xp={},Yp=function(e){var t,n=(e=Qp[e]||e).match(qp);n||(n=Qp[t="linear"].match(qp)),n=n.slice(1,5);for(var i=0;i
m(e)?{width:e.outerWidth,height:e.outerHeight}:e.getBoundingClientRect(),ef=Ye(),tf=/left|right/,nf=/top|bottom/,rf=/fit|flip|none/,of=/scale\(.+?\)/,sf=Sc.safari,af=function(e){var t={h:"center",v:"center"},n=De(e);return n&&w(n,(function(){var e=String(this).toLowerCase();tf.test(e)?t.h=e:nf.test(e)&&(t.v=e)})),t},lf=function(e,t){return Oe(e,t)},cf=function(e){switch(e){case"center":return.5;case"right":case"bottom":return 1;default:return 0}},uf=function(e){switch(e){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top";default:return e}},hf=function(e,t){var n=0;return e.myLocationt.max&&(n+=e.myLocation-t.max),n},df=function(e,t,n){return t.myLocationn.max?"h"===e?"right":"bottom":"none"},pf=function(e){e.myLocation=e.atLocation+cf(e.atAlign)*e.atSize-cf(e.myAlign)*e.mySize+e.offset},ff={fit:function(e,t){var n=!1;e.myLocation>t.max&&(e.myLocation=t.max,n=!0),e.myLocationt.max)){var n=y({},e,{myAlign:uf(e.myAlign),atAlign:uf(e.atAlign),offset:-e.offset});pf(n),n.oversize=hf(n,t),(n.myLocation>=t.min&&n.myLocation<=t.max||e.oversize>n.oversize)&&(e.myLocation=n.myLocation,e.oversize=n.oversize,e.flip=!0)}},flipfit:function(e,t){this.flip(e,t),this.fit(e,t)},none:function(e){e.oversize=0}},mf=function(){var e=Un("").css({width:100,height:100,overflow:"scroll",position:"absolute",top:-9999}).appendTo(Un("body")),t=e.get(0).offsetWidth-e.get(0).clientWidth;e.remove(),Jp=t},gf={h:{location:0,flip:!1,fit:!1,oversize:0},v:{location:0,flip:!1,fit:!1,oversize:0}},vf=function(e,t){var n=Un(e),i=n.offset(),r=y(!0,{},gf,{h:{location:i.left},v:{location:i.top}});if(!t)return r;var o=af(t.my),s=af(t.at),a=Un(t.of).length&&t.of||ef,l=lf(t.offset,t.precise),c=function(e){var t=De(e),n=String(t&&t[0]).toLowerCase(),i=String(t&&t[1]).toLowerCase();return rf.test(n)||(n="none"),rf.test(i)||(i=n),{h:n,v:i}}(t.collision),u=t.boundary,h=lf(t.boundaryOffset,t.precise),d={mySize:wn(n),myAlign:o.h,atAlign:s.h,offset:l.h,collision:c.h,boundaryOffset:h.h},p={mySize:Cn(n),myAlign:o.v,atAlign:s.v,offset:l.v,collision:c.v,boundaryOffset:h.v};if(a.preventDefault)d.atLocation=a.pageX,p.atLocation=a.pageY,d.atSize=0,p.atSize=0;else if(a=Un(a),m(a[0]))d.atLocation=a.scrollLeft(),p.atLocation=a.scrollTop(),"phone"===aa.real().deviceType&&a[0].visualViewport?(d.atLocation=Math.max(d.atLocation,a[0].visualViewport.offsetLeft),p.atLocation=Math.max(p.atLocation,a[0].visualViewport.offsetTop),d.atSize=a[0].visualViewport.width,p.atSize=a[0].visualViewport.height):(d.atSize=a[0].innerWidth>a[0].outerWidth?a[0].innerWidth:yn(a),p.atSize=a[0].innerHeight>a[0].outerHeight||sf?a[0].innerHeight:bn(a));else if(9===a[0].nodeType)d.atLocation=0,p.atLocation=0,d.atSize=yn(a),p.atSize=bn(a);else{var f=Zp(a.get(0)),g=yf(a);d.atLocation=g.left,p.atLocation=g.top,d.atSize=Math.max(f.width,wn(a)),p.atSize=Math.max(f.height,Cn(a))}pf(d),pf(p);var v=function(){var e=Un(ef),t=yn(e),n=bn(e),i=e.scrollLeft(),r=e.scrollTop(),o=We.getDocumentElement(),s=fc?o.clientWidth/t:1,a=fc?o.clientHeight/n:1;void 0===Jp&&mf();var l=t,c=n;if(u&&!m(u)){var h=Un(u),f=h.offset();i=f.left,r=f.top,l=yn(h),c=bn(h)}return{h:{min:i+d.boundaryOffset,max:i+l/s-d.mySize-d.boundaryOffset},v:{min:r+p.boundaryOffset,max:r+c/a-p.mySize-p.boundaryOffset}}}();d.oversize=hf(d,v.h),p.oversize=hf(p,v.v),d.collisionSide=df("h",d,v.h),p.collisionSide=df("v",p,v.v),ff[d.collision]&&ff[d.collision](d,v.h),ff[p.collision]&&ff[p.collision](p,v.v);var _=function(e){return t.precise?e:Math.round(e)};return y(!0,r,{h:{location:_(d.myLocation),oversize:_(d.oversize),fit:d.fit,flip:d.flip,collisionSide:d.collisionSide},v:{location:_(p.myLocation),oversize:_(p.oversize),fit:p.fit,flip:p.flip,collisionSide:p.collisionSide},precise:t.precise}),r},_f=function(e,t,n,i){var r=l(e.style)&&!We.isNode(e.style),o=i?n.replace(t,""):n;if(r)!function(e,t){arguments.length>2&&void 0!==arguments[2]&&!arguments[2]||[].slice.call(e.style).forEach((t=>{e.style.removeProperty(t)})),t.split(";").forEach((t=>{var n=t.split(":").map((e=>e.trim()));if(2===n.length){var[i,r]=n;e.style[i]=r}}))}(e,o,!1);else{var s=We.createAttribute("style");s.value=o,e.setAttributeNode(s)}},yf=function e(t){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,o=r.get(0);if(!o)return t.offset();var s,a=(null===(n=o.getAttribute)||void 0===n?void 0:n.call(o,"style"))||"",l=null===(i=a.match(of))||void 0===i?void 0:i[0];return l?(_f(o,l,a,!0),s=e(t,r.parent()),_f(o,l,a,!1)):s=e(t,r.parent()),s},bf=function(e,t){var n=Un(e);if(!t)return n.offset();Kp(n,!0);var i=yf(n),r=t.h&&t.v?t:vf(n,t),o=function(e){return t.precise?e:Math.round(e)};return Gp(n,{left:r.h.location-o(i.left),top:r.v.location-o(i.top)}),r};bf.inverseAlign||(bf.inverseAlign=uf),bf.normalizeAlign||(bf.normalizeAlign=af);const wf={calculateScrollbarWidth:mf,calculate:vf,setup:bf,offset:function(e){return e=Un(e).get(0),m(e)?null:e&&"pageY"in e&&"pageX"in e?{top:e.pageY,left:e.pageX}:Un(e).offset()}};var Cf=Ye(),Sf=ds(Wn,"dxFX"),xf=/^([+-])=(.*)/i,Ef="dxAnimData",If="dxAnimQueue",Tf="transform",kf={initAnimation:function(e,t){e.css({transitionProperty:"none"}),"string"===typeof t.from?e.addClass(t.from):Qf(e,t.from);var n=this,i=new ee,r=t.cleanupWhen;t.transitionAnimation={deferred:i,finish:function(){n._finishTransition(e),r?te(i,r).always((function(){n._cleanup(e,t)})):n._cleanup(e,t),i.resolveWith(e,[t,e])}},this._completeAnimationCallback(e,t).done((function(){t.transitionAnimation.finish()})).fail((function(){i.rejectWith(e,[t,e])})),t.duration||t.transitionAnimation.finish(),e.css("transform")},animate:function(e,t){return this._startAnimation(e,t),t.transitionAnimation.deferred.promise()},_completeAnimationCallback:function(e,t){var n,i=this,r=Date.now()+t.delay,o=new ee,s=new ee,a=new ee,l=gc()+".dxFX";t.transitionAnimation.cleanup=function(){clearTimeout(n),clearTimeout(c),Dt.off(e,l),Dt.off(e,Sf)},Dt.one(e,l,(function(){Date.now()-r>=t.duration&&s.reject()})),Dt.off(e,Sf),Dt.on(e,Sf,(function(){i.stop(e,t),o.reject()}));var c=setTimeout((function(){n=setTimeout((function(){a.reject()}),t.duration+t.delay+Xf._simulatedTransitionEndDelay),te(s,a).fail(function(){o.resolve()}.bind(this))}));return o.promise()},_startAnimation:function(e,t){e.css({transitionProperty:"all",transitionDelay:t.delay+"ms",transitionDuration:t.duration+"ms",transitionTimingFunction:t.easing}),"string"===typeof t.to?e[0].className+=" "+t.to:t.to&&Qf(e,t.to)},_finishTransition:function(e){e.css("transition","none")},_cleanup:function(e,t){t.transitionAnimation.cleanup(),"string"===typeof t.from&&(e.removeClass(t.from),e.removeClass(t.to))},stop:function(e,t,n){t&&(n?t.transitionAnimation.finish():(f(t.to)&&w(t.to,(function(t){e.css(t,e.css(t))})),this._finishTransition(e),this._cleanup(e,t)))}},Df={initAnimation:function(e,t){Qf(e,t.from)},animate:function(e,t){var n=new ee,i=this;return t?(w(t.to,(function(n){void 0===t.from[n]&&(t.from[n]=i._normalizeValue(e.css(n)))})),t.to[Tf]&&(t.from[Tf]=i._parseTransform(t.from[Tf]),t.to[Tf]=i._parseTransform(t.to[Tf])),t.frameAnimation={to:t.to,from:t.from,currentValue:t.from,easing:Yp(t.easing),duration:t.duration,startTime:(new Date).valueOf(),finish:function(){this.currentValue=this.to,this.draw(),sc(t.frameAnimation.animationFrameId),n.resolve()},draw:function(){if(t.draw)t.draw(this.currentValue);else{var n=y({},this.currentValue);n[Tf]&&(n[Tf]=b(n[Tf],(function(e,t){return"translate"===t?$p(e):"scale"===t?"scale("+e+")":"rotate"===t.substr(0,t.length-1)?t+"("+e+"deg)":void 0})).join(" ")),e.css(n)}}},t.delay?(t.frameAnimation.startTime+=t.delay,t.frameAnimation.delayTimeout=setTimeout((function(){i._startAnimation(e,t)}),t.delay)):i._startAnimation(e,t),n.promise()):n.reject().promise()},_startAnimation:function(e,t){Dt.off(e,Sf),Dt.on(e,Sf,(function(){t.frameAnimation&&sc(t.frameAnimation.animationFrameId)})),this._animationStep(e,t)},_parseTransform:function(e){var t={};return w(e.match(/\w+\d*\w*\([^)]*\)\s*/g),(function(e,n){var i=function(e){var t=e.match(Vp);if(t&&t[1])return t=t[1].split(","),{x:parseFloat(t[0]),y:parseFloat(t[1]),z:parseFloat(t[2])}}(n),r=n.match(/scale\((.+?)\)/),o=n.match(/(rotate.)\((.+)deg\)/);i&&(t.translate=i),r&&r[1]&&(t.scale=parseFloat(r[1])),o&&o[1]&&(t[o[1]]=parseFloat(o[2]))})),t},stop:function(e,t,n){var i=t&&t.frameAnimation;i&&(sc(i.animationFrameId),clearTimeout(i.delayTimeout),n&&i.finish(),delete t.frameAnimation)},_animationStep:function(e,t){var n=t&&t.frameAnimation;if(n){var i=(new Date).valueOf();if(i>=n.startTime+n.duration)n.finish();else{n.currentValue=this._calcStepValue(n,i-n.startTime),n.draw();var r=this;n.animationFrameId=oc((function(){r._animationStep(e,t)}))}}},_calcStepValue:function(e,t){return function n(i,r){var o=Array.isArray(r)?[]:{};return w(r,(function(s,a){if("string"===typeof a&&!1===parseFloat(a))return!0;o[s]="object"===typeof a?n(i[s],a):function(n){var o=t/e.duration,s=t,a=1*i[n],l=r[n]-i[n],c=e.duration;return function(e){return Xp[e]}(e.easing)(o,s,a,l,c)}(s)})),o}(e.from,e.to)},_normalizeValue:function(e){var t=parseFloat(e);return!1===t?e:t}},Of={initAnimation:function(){},animate:function(){return(new ee).resolve().promise()},stop:Pe,isSynchronous:!0},Af=function(e,t,n,i){w(["from","to"],(function(){if(!n(e[this]))throw O.Error("E0010",t,this,i)}))},Rf=function(e,t){return Af(e,t,(function(e){return f(e)}),"a plain object")},Pf={top:{my:"bottom center",at:"top center"},bottom:{my:"top center",at:"bottom center"},right:{my:"left center",at:"right center"},left:{my:"right center",at:"left center"}},Nf={validateConfig:function(e){Rf(e,"slide")},setup:function(e,t){var n=Hp(e);if("slide"!==t.type){var i="slideIn"===t.type?t.from:t.to;i.position=y({of:Cf},Pf[t.direction]),qf(e,i)}this._setUpConfig(n,t.from),this._setUpConfig(n,t.to),jp(e)},_setUpConfig:function(e,t){t.left="left"in t?t.left:"+=0",t.top="top"in t?t.top:"+=0",this._initNewPosition(e,t)},_initNewPosition:function(e,t){var n={left:t.left,top:t.top};delete t.left,delete t.top;var i=this._getRelativeValue(n.left);void 0!==i?n.left=i+e.left:t.left=0,void 0!==(i=this._getRelativeValue(n.top))?n.top=i+e.top:t.top=0,t[Tf]=$p({x:n.left,y:n.top})},_getRelativeValue:function(e){var t;if("string"===typeof e&&(t=xf.exec(e)))return parseInt(t[1]+"1")*t[2]}},Mf={setup:function(e,t){var n,i,r=t.from,o=t.to,s="fadeOut"===t.type?1:0,a="fadeOut"===t.type?0:1,l=f(r)?String(null!==(n=r.opacity)&&void 0!==n?n:s):String(r),c=f(o)?String(null!==(i=o.opacity)&&void 0!==i?i:a):String(o);switch(t.skipElementInitialStyles||(l=e.css("opacity")),t.type){case"fadeIn":c=1;break;case"fadeOut":c=0}t.from={visibility:"visible",opacity:l},t.to={opacity:c}}},Lf={custom:{setup:function(){}},slide:Nf,slideIn:Nf,slideOut:Nf,fade:Mf,fadeIn:Mf,fadeOut:Mf,pop:{validateConfig:function(e){Rf(e,"pop")},setup:function(e,t){var n=t.from,i=t.to,r="opacity"in n?n.opacity:e.css("opacity"),o="opacity"in i?i.opacity:1,s="scale"in n?n.scale:0,a="scale"in i?i.scale:1;t.from={opacity:r};var l=Wp(e);t.from[Tf]=this._getCssTransform(l,s),t.to={opacity:o},t.to[Tf]=this._getCssTransform(l,a)},_getCssTransform:function(e,t){return $p(e)+"scale("+t+")"}},css:{validateConfig:function(e){!function(e,t){Af(e,t,(function(e){return"string"===typeof e}),"a string")}(e,"css")},setup:function(){}}},Ff={type:"custom",from:{},to:{},duration:400,start:Pe,complete:Pe,easing:"ease",delay:0},Bf={duration:400,easing:"ease",delay:0};function Vf(){var e=this.element,t=this.config;if(qf(e,t.from),qf(e,t.to),this.configurator.setup(e,t),e.data(Ef,this),Xf.off&&(t.duration=0,t.delay=0),this.strategy.initAnimation(e,t),t.start){var n=La(e);t.start.apply(this,[n,t])}}var Hf=function(){var e=this,t=e.element,n=e.config;return e.isStarted=!0,e.strategy.animate(t,n).done((function(){!function(e){var t=e.element,n=e.config;if(t.removeData(Ef),n.complete){var i=La(t);n.complete.apply(this,[i,n])}e.deferred.resolveWith(this,[t,n])}(e)})).fail((function(){e.deferred.rejectWith(this,[t,n])}))},Uf=function(e){var t=this.element,n=this.config;clearTimeout(this.startTimeout),this.isStarted||this.start(),this.strategy.stop(t,n,e)},zf=ds(Wn,"dxFXStartAnimation"),jf=function(e,t){var n="css"===t.type?Bf:Ff,i=y(!0,{},n,t),r=function(e){var t=Lf[e.type];if(!t)throw O.Error("E0011",e.type);return t}(i),o=function(e){e=e||{};var t={transition:mc()?kf:Df,frame:Df,noAnimation:Of},n=e.strategy||"transition";return"css"!==e.type||mc()||(n="noAnimation"),t[n]}(i),s={element:Un(e),config:i,configurator:r,strategy:o,isSynchronous:o.isSynchronous,setup:Vf,start:Hf,stop:Uf,deferred:new ee};return c(r.validateConfig)&&r.validateConfig(i),function(e){Dt.off(e.element,zf),Dt.on(e.element,zf,(function(){Xf.stop(e.element)})),e.deferred.always((function(){Dt.off(e.element,zf)}))}(s),s};function $f(e){return e.data(If)||[]}var Wf=function(e){e.removeData(If)};function Gf(e){return!!e.data(Ef)}function Kf(e,t){if((t=$f(e)).length){var n=t.shift();0===t.length&&Wf(e),function(e){e.setup(),Xf.off||e.isSynchronous?e.start():e.startTimeout=setTimeout((function(){e.start()}));return e.deferred.promise()}(n).done((function(){Gf(e)||Kf(e)}))}}function qf(e,t){if(t&&t.position){var n=Un(Cf),i=0,r=0,o=wf.calculate(e,t.position),s=e.offset(),a=e.position();a.top>s.top&&(r=n.scrollTop()),a.left>s.left&&(i=n.scrollLeft()),y(t,{left:o.h.location-s.left+a.left-i,top:o.v.location-s.top+a.top-r}),delete t.position}}function Qf(e,t){w(t,(function(t,n){try{e.css(t,c(n)?n():n)}catch(i){}}))}var Xf={off:!1,animationTypes:Lf,animate:function(e,t){var n=Un(e);if(!n.length)return(new ee).resolve().promise();var i=jf(n,t);return function(e,t){var n=$f(e);(function(e,t){e.data(If,t)})(e,n),n.push(t),Gf(e)||Kf(e,n)}(n,i),i.deferred.promise()},createAnimation:jf,isAnimating:Gf,stop:function(e,t){var n=Un(e),i=$f(n);w(i,(function(e,t){t.config.delay=0,t.config.duration=0,t.isSynchronous=!0})),Gf(n)||Kf(n,i);var r=n.data(Ef);r&&r.stop(t),n.removeData(Ef),Wf(n)},_simulatedTransitionEndDelay:100};const Yf=Xf;var Jf="dxdragstart",Zf="dxdrag",em="dxdragend",tm="dxdragenter",nm="dxdragleave",im="dxdrop",rm="dxDragEventsCount",om=[],sm=[],am=[],lm={setup:function(e,t){om.includes(e)||(om.push(e),sm.push([]),am.push(t||{}))},add:function(e,t){var n=om.indexOf(e);this.updateEventsCounter(e,t.type,1);var i=t.selector;sm[n].includes(i)||sm[n].push(i)},updateEventsCounter:function(e,t,n){if([tm,nm,im].indexOf(t)>-1){var i=Mt(e,rm)||0;Mt(e,rm,Math.max(0,i+n))}},remove:function(e,t){this.updateEventsCounter(e,t.type,-1)},teardown:function(e){if(!Mt(e,rm)){var t=om.indexOf(e);om.splice(t,1),sm.splice(t,1),am.splice(t,1),Lt(e,rm)}}};$n(tm,lm),$n(nm,lm),$n(im,lm);var cm=Dh.inherit({ctor:function(e){this.callBase(e),this.direction="both"},_init:function(e){this._initEvent=e},_start:function(e){if(e=this._fireEvent(Jf,this._initEvent),this._maxLeftOffset=e.maxLeftOffset,this._maxRightOffset=e.maxRightOffset,this._maxTopOffset=e.maxTopOffset,this._maxBottomOffset=e.maxBottomOffset,e.targetElements||null===e.targetElements){var t=function(e){return Array.isArray(e)?e:[e]}(e.targetElements||[]);this._dropTargets=b(t,(function(e){return Un(e).get(0)}))}else this._dropTargets=om},_move:function(e){var t=os(e),n=this._calculateOffset(t);e=this._fireEvent(Zf,e,{offset:n}),this._processDropTargets(e),e._cancelPreventDefault||e.preventDefault()},_calculateOffset:function(e){return{x:this._calculateXOffset(e),y:this._calculateYOffset(e)}},_calculateXOffset:function(e){if("vertical"!==this.direction){var t=e.x-this._startEventData.x;return this._fitOffset(t,this._maxLeftOffset,this._maxRightOffset)}return 0},_calculateYOffset:function(e){if("horizontal"!==this.direction){var t=e.y-this._startEventData.y;return this._fitOffset(t,this._maxTopOffset,this._maxBottomOffset)}return 0},_fitOffset:function(e,t,n){return null!=t&&(e=Math.max(e,-t)),null!=n&&(e=Math.min(e,n)),e},_processDropTargets:function(e){var t=this._findDropTarget(e);t===this._currentDropTarget||(this._fireDropTargetEvent(e,nm),this._currentDropTarget=t,this._fireDropTargetEvent(e,tm))},_fireDropTargetEvent:function(e,t){if(this._currentDropTarget){var n={type:t,originalEvent:e,draggingElement:this._$element.get(0),target:this._currentDropTarget};us(n)}},_findDropTarget:function(e){var t,n=this;return w(om,(function(i,r){if(n._checkDropTargetActive(r)){var o=Un(r);w(function(e){var t=om.indexOf(e.get(0)),n=sm[t].filter((e=>e)),i=e.find(n.join(", "));return sm[t].includes(void 0)&&(i=i.add(e)),i}(o),(function(i,r){var s=Un(r);n._checkDropTarget(function(e){var t=om.indexOf(e.get(0));return am[t]}(o),s,Un(t),e)&&(t=r)}))}})),t},_checkDropTargetActive:function(e){var t=!1;return w(this._dropTargets,(function(n,i){return!(t=t||i===e||Ea(i,e))})),t},_checkDropTarget:function(e,t,n,i){if(t.get(0)===Un(i.target).get(0))return!1;var r,o,s=(o=t,(r=e).itemPositionFunc?r.itemPositionFunc(o):o.offset());if(i.pageX
s.left+a.width)&&(!(i.pageY>s.top+a.height)&&((!n.length||!n.closest(t).length)&&(!(e.checkDropTarget&&!e.checkDropTarget(t,i))&&t)))},_end:function(e){var t=os(e);this._fireEvent(em,e,{offset:this._calculateOffset(t)}),this._fireDropTargetEvent(e,im),delete this._currentDropTarget}});Zc({emitter:cm,events:[Jf,Zf,em]});var um=function(){var e=[];return{add:function(t){e.includes(t)||e.push(t)},remove:function(t){var n=e.indexOf(t);-1!==n&&e.splice(n,1)},fire:function(){var t=e.pop(),n=!!t;return n&&t(),n},hasCallback:function(){return e.length>0}}}(),hm=1500,dm=[],pm=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hm,t=dm.length,n=(t?dm[t-1]:e)+1;return dm.push(n),n},fm=e=>{var t=dm.indexOf(e);t>=0&&dm.splice(t,1)},mm="dx-swatch-";const gm=e=>{var t=Un(e).closest('[class^="'.concat(mm,'"], [class*=" ').concat(mm,'"]')),n=Js();if(!t.length)return n;var i=new RegExp("(\\s|^)(".concat(mm,".*?)(\\s|$)")),r=t[0].className.match(i)[2],o=n.children("."+r);return o.length||(o=Un("").addClass(r).appendTo(n)),o};var vm=Ye(),_m={top:{my:"top center",at:"top center"},bottom:{my:"bottom center",at:"bottom center"},right:{my:"right center",at:"right center"},left:{my:"left center",at:"left center"},center:{my:"center",at:"center"},"right bottom":{my:"right bottom",at:"right bottom"},"right top":{my:"right top",at:"right top"},"left bottom":{my:"left bottom",at:"left bottom"},"left top":{my:"left top",at:"left top"}},ym={h:0,v:0};class bm{constructor(e){var{position:t,container:n,visualContainer:i,$root:r,$content:o,$wrapper:s,onPositioned:a,onVisualPositionChanged:l,restorePosition:c,_fixWrapperPosition:u}=e;this._props={position:t,container:n,visualContainer:i,restorePosition:c,onPositioned:a,onVisualPositionChanged:l,_fixWrapperPosition:u},this._$root=r,this._$content=o,this._$wrapper=s,this._$markupContainer=void 0,this._$visualContainer=void 0,this._shouldRenderContentInitialPosition=!0,this._visualPosition=void 0,this._initialPosition=void 0,this._previousVisualPosition=void 0,this.updateContainer(n),this.updatePosition(t),this.updateVisualContainer(i)}get $container(){return this.updateContainer(),this._$markupContainer}get $visualContainer(){return this._$visualContainer}get position(){return this._position}set fixWrapperPosition(e){this._props._fixWrapperPosition=e,this.styleWrapperPosition()}set restorePosition(e){this._props.restorePosition=e}restorePositionOnNextRender(e){this._shouldRenderContentInitialPosition=e||!this._visualPosition}openingHandled(){var e=this._props.restorePosition;this.restorePositionOnNextRender(e)}updatePosition(e){this._props.position=e,this._position=this._normalizePosition(e),this.updateVisualContainer()}updateContainer(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._props.container;this._props.container=e,this._$markupContainer=e?Un(e):gm(this._$root),this.updateVisualContainer(this._props.visualContainer)}updateVisualContainer(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._props.visualContainer;this._props.visualContainer=e,this._$visualContainer=this._getVisualContainer()}detectVisualPositionChange(e){this._updateVisualPositionValue(),this._raisePositionedEvents(e)}positionContent(){this._shouldRenderContentInitialPosition?this._renderContentInitialPosition():(Gp(this._$content,this._visualPosition),this.detectVisualPositionChange())}positionWrapper(){this._$visualContainer&&wf.setup(this._$wrapper,{my:"top left",at:"top left",of:this._$visualContainer})}styleWrapperPosition(){var e=m(this.$visualContainer.get(0))||this._props._fixWrapperPosition?"fixed":"absolute";this._$wrapper.css("position",e)}_updateVisualPositionValue(){this._previousVisualPosition=this._visualPosition,this._visualPosition=Hp(this._$content)}_renderContentInitialPosition(){this._renderBoundaryOffset(),Kp(this._$content);var e=this._$wrapper.css("overflow");this._$wrapper.css("overflow","hidden");var t=wf.setup(this._$content,this._position);this._$wrapper.css("overflow",e),this._initialPosition=t,this.detectVisualPositionChange()}_raisePositionedEvents(e){var t=this._previousVisualPosition,n=this._visualPosition;((null===t||void 0===t?void 0:t.top)!==n.top||(null===t||void 0===t?void 0:t.left)!==n.left)&&this._props.onVisualPositionChanged({previousPosition:t,position:n,event:e}),this._props.onPositioned({position:this._initialPosition})}_renderBoundaryOffset(){var e,t=null!==(e=this._position)&&void 0!==e?e:{boundaryOffset:ym};this._$content.css("margin","".concat(t.v,"px ").concat(t.h,"px"))}_getVisualContainer(){var e,t,n,i=this._props.container,r=this._props.visualContainer,o=(n=null===(e=this._props.position)||void 0===e?void 0:e.of)&&n.preventDefault?this._props.position.of.target:null===(t=this._props.position)||void 0===t?void 0:t.of;return Un(r||(i||(o||vm)))}_normalizePosition(e){var t={boundaryOffset:ym};return l(e)?y(!0,{},t,this._positionToObject(e)):t}_positionToObject(e){return u(e)?y({},_m[e]):e}}var wm=Ws.add,Cm=Ye(),Sm=Xs,xm="dx-inner-overlay",Em="dx-state-invisible",Im=[],Tm="dx-prevent-safari-scrolling";wm((()=>{Dt.subscribeGlobal(We.getDocument(),zc.down,(e=>{for(var t=Im.length-1;t>=0;t--)if(!Im[t]._proxiedDocumentDownHandler(e))return}))}));var km=Rp.inherit({_supportedKeys:function(){return y(this.callBase(),{escape:function(){this.hide()}})},_getDefaultOptions:function(){return y(this.callBase(),{activeStateEnabled:!1,visible:!1,deferRendering:!0,shading:!0,shadingColor:"",wrapperAttr:{},position:y({},_m.center),width:"80vw",minWidth:null,maxWidth:null,height:"80vh",minHeight:null,maxHeight:null,animation:{show:{type:"pop",duration:300,from:{scale:.55}},hide:{type:"pop",duration:300,from:{opacity:1,scale:1},to:{opacity:0,scale:.55}}},closeOnOutsideClick:!1,hideOnOutsideClick:!1,copyRootClassesToWrapper:!1,_ignoreCopyRootClassesToWrapperDeprecation:!1,_ignoreElementAttrDeprecation:!1,_ignorePreventScrollEventsDeprecation:!1,onShowing:null,onShown:null,onHiding:null,onHidden:null,contentTemplate:"content",innerOverlay:!1,restorePosition:!0,container:void 0,visualContainer:void 0,hideTopOverlayHandler:()=>{this.hide()},hideOnParentScroll:!1,preventScrollEvents:!0,onPositioned:null,propagateOutsideClick:!1,ignoreChildEvents:!0,_checkParentVisibility:!0,_fixWrapperPosition:!1})},_defaultOptionsRules:function(){return this.callBase().concat([{device:function(){return!Qe()},options:{width:null,height:null,animation:null,_checkParentVisibility:!1}}])},_setOptionsByReference:function(){this.callBase(),y(this._optionsByReference,{animation:!0})},$wrapper:function(){return this._$wrapper},_eventBindingTarget:function(){return this._$content},_setDeprecatedOptions(){this.callBase(),y(this._deprecatedOptions,{closeOnOutsideClick:{since:"22.1",alias:"hideOnOutsideClick"}})},ctor:function(e,t){this.callBase(e,t),t&&(t.copyRootClassesToWrapper&&!t._ignoreCopyRootClassesToWrapperDeprecation&&this._logDeprecatedOptionWarning("copyRootClassesToWrapper",{since:"21.2",message:'Use the "wrapperAttr" option instead'}),t.elementAttr&&!t._ignoreElementAttrDeprecation&&this._logDeprecatedOptionWarning("elementAttr",{since:"21.2",message:'Use the "wrapperAttr" option instead'}),"preventScrollEvents"in t&&!t._ignorePreventScrollEventsDeprecation&&this._logDeprecatedPreventScrollEventsInfo())},_logDeprecatedPreventScrollEventsInfo(){this._logDeprecatedOptionWarning("preventScrollEvents",{since:"23.1",message:"If you enable this option, end-users may experience scrolling issues."})},_init:function(){this.callBase(),this._initActions(),this._initHideOnOutsideClickHandler(),this._initTabTerminatorHandler(),this._customWrapperClass=null,this._$wrapper=Un("
").addClass("dx-overlay-wrapper"),this._$content=Un("
").addClass("dx-overlay-content"),this._initInnerOverlayClass();var e=this.$element();this.option("copyRootClassesToWrapper")&&this._$wrapper.addClass(e.attr("class")),e.addClass("dx-overlay"),this._$wrapper.attr("data-bind","dxControlsDescendantBindings: true"),this._toggleViewPortSubscription(!0),this._initHideTopOverlayHandler(this.option("hideTopOverlayHandler")),this._parentsScrollSubscriptionInfo={handler:e=>{this._hideOnParentsScrollHandler(e)}},this.warnPositionAsFunction()},warnPositionAsFunction(){c(this.option("position"))&&O.log("W0018")},_initInnerOverlayClass:function(){this._$content.toggleClass(xm,this.option("innerOverlay"))},_initHideTopOverlayHandler:function(e){this._hideTopOverlayHandler=e},_getActionsList:function(){return["onShowing","onShown","onHiding","onHidden","onPositioned","onVisualPositionChanged"]},_initActions:function(){this._actions={};var e=this._getActionsList();w(e,((e,t)=>{this._actions[t]=this._createActionByOption(t,{excludeValidators:["disabled","readOnly"]})||Pe}))},_initHideOnOutsideClickHandler:function(){var e=this;this._proxiedDocumentDownHandler=function(){return e._documentDownHandler(...arguments)}},_initMarkup(){this.callBase(),this._renderWrapperAttributes(),this._initPositionController()},_documentDownHandler:function(e){this._showAnimationProcessing&&this._stopAnimation();var t=Un(Cm.document).is(e.target)||Ea(Cm.document,e.target),n=Un(e.target).closest(".".concat(xm)).length;return t&&!n&&!(this._$content.is(e.target)||Ea(this._$content.get(0),e.target))&&this._shouldHideOnOutsideClick(e)&&this._outsideClickHandler(e),this.option("propagateOutsideClick")},_shouldHideOnOutsideClick:function(e){var{hideOnOutsideClick:t}=this.option();return c(t)?t(e):t},_outsideClickHandler(e){this.option("shading")&&e.preventDefault(),this.hide()},_getAnonymousTemplateName:function(){return"content"},_initTemplates:function(){this._templateManager.addDefaultTemplates({content:new Na}),this.callBase()},_isTopOverlay:function(){for(var e=this._overlayStack(),t=e.length-1;t>=0;t--){var n=e[t]._findTabbableBounds();if(n.first||n.last)return e[t]===this}return!1},_overlayStack:function(){return Im},_zIndexInitValue:function(){return km.baseZIndex()},_toggleViewPortSubscription:function(e){var t=this;Sm.remove(this._viewPortChangeHandle),e&&(this._viewPortChangeHandle=function(){t._viewPortChangeHandler(...arguments)},Sm.add(this._viewPortChangeHandle))},_viewPortChangeHandler:function(){this._positionController.updateContainer(this.option("container")),this._refresh()},_renderWrapperAttributes(){var{wrapperAttr:e}=this.option(),t=y({},e),n=t.class;delete t.class,this.$wrapper().attr(t).removeClass(this._customWrapperClass).addClass(n),this._customWrapperClass=n},_renderVisibilityAnimate:function(e){return this._stopAnimation(),e?this._show():this._hide()},_getAnimationConfig:function(){return this._getOptionValue("animation",this)},_toggleBodyScroll:Pe,_animateShowing:function(){var e,t,n,i=this,r=null!==(e=this._getAnimationConfig())&&void 0!==e?e:{},o=this._normalizeAnimation(r.show,"to"),s=null!==(t=null===o||void 0===o?void 0:o.start)&&void 0!==t?t:Pe,a=null!==(n=null===o||void 0===o?void 0:o.complete)&&void 0!==n?n:Pe;this._animate(o,(function(){if(!i._isAnimationPaused){i.option("focusStateEnabled")&&Dt.trigger(i._focusTarget(),"focus");for(var e=arguments.length,t=new Array(e),n=0;n
{e?n():t()})).catch((()=>t())):e?n():t()},_show:function(){if(this._showingDeferred=new ee,this._parentHidden=this._isParentHidden(),this._showingDeferred.done((()=>{delete this._parentHidden})),this._parentHidden)return this._isHidden=!0,this._showingDeferred.resolve();if(this._currentVisible)return(new ee).resolve().promise();if(this._currentVisible=!0,this._isHidingActionCanceled)delete this._isHidingActionCanceled,this._showingDeferred.reject();else{var e=()=>{this._toggleBodyScroll(this.option("enableBodyScroll")),this._stopAnimation(),this._toggleVisibility(!0),this._$content.css("visibility","hidden"),this._$content.toggleClass(Em,!1),this._updateZIndexStackPosition(!0),this._positionController.openingHandled(),this._renderContent();var e={cancel:!1};this._actions.onShowing(e),this._processShowingHidingCancel(e.cancel,(()=>{this._$content.css("visibility",""),this._renderVisibility(!0),this._animateShowing()}),(()=>{this._toggleVisibility(!1),this._$content.css("visibility",""),this._$content.toggleClass(Em,!0),this._isShowingActionCanceled=!0,this._moveFromContainer(),this.option("visible",!1),this._showingDeferred.resolve()}))};this.option("templatesRenderAsynchronously")?(this._stopShowTimer(),this._asyncShowTimeout=setTimeout(e)):e()}return this._showingDeferred.promise()},_normalizeAnimation:function(e,t){return e&&(e=y({type:"slide",skipElementInitialStyles:!0},e),d(e[t])&&y(e[t],{position:this._positionController.position})),e},_animateHiding:function(){var e,t,n,i=this,r=null!==(e=this._getAnimationConfig())&&void 0!==e?e:{},o=this._normalizeAnimation(r.hide,"from"),s=null!==(t=null===o||void 0===o?void 0:o.start)&&void 0!==t?t:Pe,a=null!==(n=null===o||void 0===o?void 0:o.complete)&&void 0!==n?n:Pe;this._animate(o,(function(){var e;i._$content.css("pointerEvents",""),i._renderVisibility(!1);for(var t=arguments.length,n=new Array(t),r=0;r{this._forceFocusLost(),this._toggleShading(!1),this._toggleSubscriptions(!1),this._stopShowTimer(),this._animateHiding()}),(()=>{this._isHidingActionCanceled=!0,this.option("visible",!0),this._hidingDeferred.resolve()}))),this._hidingDeferred.promise()},_forceFocusLost:function(){var e=We.getActiveElement();!!this._$content.find(e).length&&Sa()},_animate:function(e,t,n){e?(n=n||e.start||Pe,Yf.animate(this._$content,y({},e,{start:n,complete:t}))):t()},_stopAnimation:function(){Yf.stop(this._$content,!0)},_renderVisibility:function(e){e&&this._isParentHidden()||(this._currentVisible=e,this._stopAnimation(),e||Da(this._$content),e?(this._checkContainerExists(),this._moveToContainer(),this._renderGeometry(),ka(this._$content),Oa(this._$content)):(this._toggleVisibility(e),this._$content.toggleClass(Em,!e),this._updateZIndexStackPosition(e),this._moveFromContainer()),this._toggleShading(e),this._toggleSubscriptions(e))},_updateZIndexStackPosition:function(e){var t=this._overlayStack(),n=t.indexOf(this);e?(-1===n&&(this._zIndex=pm(this._zIndexInitValue()),t.push(this)),this._$wrapper.css("zIndex",this._zIndex),this._$content.css("zIndex",this._zIndex)):-1!==n&&(t.splice(n,1),fm(this._zIndex))},_toggleShading:function(e){this._$wrapper.toggleClass("dx-overlay-shader",e&&this.option("shading")),this._$wrapper.css("backgroundColor",this.option("shading")?this.option("shadingColor"):""),this._toggleTabTerminator(e&&this.option("shading"))},_initTabTerminatorHandler:function(){var e=this;this._proxiedTabTerminatorHandler=function(){e._tabKeyHandler(...arguments)}},_toggleTabTerminator:function(e){var t=ds("keydown",this.NAME);e?Dt.on(We.getDocument(),t,this._proxiedTabTerminatorHandler):Dt.off(We.getDocument(),t,this._proxiedTabTerminatorHandler)},_findTabbableBounds:function(){for(var e=this._$wrapper.find("*"),t=e.length-1,n={first:null,last:null},i=0;i<=t&&(!n.first&&e.eq(i).is(Ko)&&(n.first=e.eq(i)),!n.last&&e.eq(t-i).is(Ko)&&(n.last=e.eq(t-i)),!n.first||!n.last);i++);return n},_tabKeyHandler:function(e){if("tab"===hs(e)&&this._isTopOverlay()){var t=this._findTabbableBounds(),n=t.first,i=t.last,r=!e.shiftKey&&e.target===i.get(0),o=e.shiftKey&&e.target===n.get(0),s=0===t.length,a=!Ea(this._$wrapper.get(0),e.target);if(r||o||s||a){e.preventDefault();var l=e.shiftKey?i:n;Dt.trigger(l,"focusin"),Dt.trigger(l,"focus")}}},_toggleSubscriptions:function(e){Qe()&&(this._toggleHideTopOverlayCallback(e),this._toggleHideOnParentsScrollSubscription(e))},_toggleHideTopOverlayCallback:function(e){this._hideTopOverlayHandler&&(e?um.add(this._hideTopOverlayHandler):um.remove(this._hideTopOverlayHandler))},_toggleHideOnParentsScrollSubscription:function(e){var t,n=ds("scroll",this.NAME),{prevTargets:i,handler:r}=null!==(t=this._parentsScrollSubscriptionInfo)&&void 0!==t?t:{};Dt.off(i,n,r);var o=this.option("hideOnParentScroll");if(e&&o){var s=this._hideOnParentScrollTarget().parents();"desktop"===aa.real().deviceType&&(s=s.add(Cm)),Dt.on(s,n,r),this._parentsScrollSubscriptionInfo.prevTargets=s}},_hideOnParentsScrollHandler:function(e){var t=!1,n=this.option("hideOnParentScroll");c(n)&&(t=n(e)),t||this._showAnimationProcessing||this.hide()},_hideOnParentScrollTarget:function(){return this._$wrapper},_render:function(){this.callBase(),this._appendContentToElement(),this._renderVisibilityAnimate(this.option("visible"))},_appendContentToElement:function(){this._$content.parent().is(this.$element())||this._$content.appendTo(this.$element())},_renderContent:function(){var e=!this._currentVisible&&this.option("deferRendering");this.option("visible")&&this._isParentHidden()?this._isHidden=!0:this._contentAlreadyRendered||e||(this._contentAlreadyRendered=!0,this._appendContentToElement(),this.callBase())},_isParentHidden:function(){if(!this.option("_checkParentVisibility"))return!1;if(void 0!==this._parentHidden)return this._parentHidden;var e=this.$element().parent();if(e.is(":visible"))return!1;var t=!1;return e.add(e.parents()).each((function(){if("none"===Un(this).css("display"))return t=!0,!1})),t||!We.getBody().contains(e.get(0))},_renderContentImpl:function(){var e=new ee,t=this.option("contentTemplate"),n=this._getTemplate(t),i=this._templateManager.anonymousTemplateName===t;return n&&n.render({container:La(this.$content()),noModel:!0,transclude:i,onRendered:()=>{e.resolve(),this.option("templatesRenderAsynchronously")&&this._dimensionChanged()}}),this._toggleWrapperScrollEventsSubscription(this.option("preventScrollEvents")),e.done((()=>{this.option("visible")&&this._moveToContainer()})),e.promise()},_getPositionControllerConfig(){var{container:e,visualContainer:t,_fixWrapperPosition:n,restorePosition:i}=this.option();return{container:e,visualContainer:t,$root:this.$element(),$content:this._$content,$wrapper:this._$wrapper,onPositioned:this._actions.onPositioned,onVisualPositionChanged:this._actions.onVisualPositionChanged,restorePosition:i,_fixWrapperPosition:n}},_initPositionController(){this._positionController=new bm(this._getPositionControllerConfig())},_toggleWrapperScrollEventsSubscription:function(e){var t=ds(Zf,this.NAME);Dt.off(this._$wrapper,t),e&&Dt.on(this._$wrapper,t,{validate:function(){return!0},getDirection:function(){return"both"},_toggleGestureCover:function(e){e||this._toggleGestureCoverImpl(e)},_clearSelection:Pe,isNative:!0},(e=>{var t=e.originalEvent.originalEvent,{type:n}=t||{},i="wheel"===n,r="mousemove"===n,o=i&&!ps(e);e._cancelPreventDefault=!0,t&&!1!==e.cancelable&&(!r&&!i||o)&&e.preventDefault()}))},_moveFromContainer:function(){this._$content.appendTo(this.$element()),this._$wrapper.detach()},_checkContainerExists(){var e=this._positionController.$container;void 0!==e&&(e.length>0||Iu.log("W1021",this.NAME))},_moveToContainer:function(){var e=this._positionController.$container;this._$wrapper.appendTo(e),this._$content.appendTo(this._$wrapper)},_renderGeometry:function(e){var{visible:t}=this.option();t&&Qe()&&(this._stopAnimation(),this._renderGeometryImpl())},_renderGeometryImpl:function(){this._positionController.updatePosition(this._getOptionValue("position")),this._renderWrapper(),this._renderDimensions(),this._renderPosition()},_renderPosition(){this._positionController.positionContent()},_isAllWindowCovered:function(){return m(this._positionController.$visualContainer.get(0))&&this.option("shading")},_toggleSafariScrolling:function(){var e=this.option("visible"),t=Un(We.getBody()),n="ios"===aa.real().platform&&Sc.safari,i=this._isAllWindowCovered(),r=t.hasClass(Tm),o=!r&&e&&i,s=r&&(!e||!i||this._disposed);n&&(s?(t.removeClass(Tm),Cm.scrollTo(0,this._cachedBodyScrollTop),this._cachedBodyScrollTop=void 0):o&&(this._cachedBodyScrollTop=Cm.pageYOffset,t.addClass(Tm)))},_renderWrapper:function(){this._positionController.styleWrapperPosition(),this._renderWrapperDimensions(),this._positionController.positionWrapper()},_renderWrapperDimensions:function(){var e=this._positionController.$visualContainer,t=We.getDocumentElement(),n=m(e.get(0)),i=n?t.clientWidth:wn(e),r=n?Cm.innerHeight:Cn(e);this._$wrapper.css({width:i,height:r})},_renderDimensions:function(){var e=this._$content.get(0);this._$content.css({minWidth:this._getOptionValue("minWidth",e),maxWidth:this._getOptionValue("maxWidth",e),minHeight:this._getOptionValue("minHeight",e),maxHeight:this._getOptionValue("maxHeight",e),width:this._getOptionValue("width",e),height:this._getOptionValue("height",e)})},_focusTarget:function(){return this._$content},_attachKeyboardEvents:function(){this._keyboardListenerId=_l(this._$content,null,(e=>this._keyboardHandler(e)))},_keyboardHandler:function(e){var t=e.originalEvent;!Un(t.target).is(this._$content)&&this.option("ignoreChildEvents")||this.callBase(...arguments)},_isVisible:function(){return this.option("visible")},_visibilityChanged:function(e){e?this.option("visible")&&this._renderVisibilityAnimate(e):this._renderVisibilityAnimate(e)},_dimensionChanged:function(){this._renderGeometry()},_clean:function(){var e=this.option();this._contentAlreadyRendered||e.isRenovated||this.$content().empty(),this._renderVisibility(!1),this._stopShowTimer(),this._cleanFocusState()},_stopShowTimer(){this._asyncShowTimeout&&clearTimeout(this._asyncShowTimeout),this._asyncShowTimeout=null},_dispose:function(){Yf.stop(this._$content,!1),clearTimeout(this._deferShowTimer),this._toggleViewPortSubscription(!1),this._toggleSubscriptions(!1),this._updateZIndexStackPosition(!1),this._toggleTabTerminator(!1),this._actions=null,this._parentsScrollSubscriptionInfo=null,this.callBase(),this._toggleSafariScrolling(),this.option("visible")&&fm(this._zIndex),this._$wrapper.remove(),this._$content.remove()},_toggleRTLDirection:function(e){this._$content.toggleClass("dx-rtl",e)},_optionChanged:function(e){var{value:t,name:n}=e;if(this._getActionsList().includes(n))this._initActions();else switch(n){case"animation":case"closeOnOutsideClick":case"hideOnOutsideClick":case"propagateOutsideClick":break;case"shading":this._toggleShading(this.option("visible")),this._toggleSafariScrolling();break;case"shadingColor":this._toggleShading(this.option("visible"));break;case"width":case"height":case"minWidth":case"maxWidth":case"minHeight":case"maxHeight":this._renderGeometry();break;case"position":this._positionController.updatePosition(this.option("position")),this._positionController.restorePositionOnNextRender(!0),this._renderGeometry(),this._toggleSafariScrolling();break;case"visible":this._renderVisibilityAnimate(t).done((()=>{var e;return null===(e=this._animateDeferred)||void 0===e?void 0:e.resolveWith(this)})).fail((()=>{var e;return null===(e=this._animateDeferred)||void 0===e?void 0:e.reject()}));break;case"container":this._positionController.updateContainer(t),this._invalidate(),this._toggleSafariScrolling();break;case"visualContainer":this._positionController.updateVisualContainer(t),this._renderWrapper(),this._toggleSafariScrolling();break;case"innerOverlay":this._initInnerOverlayClass();break;case"deferRendering":case"contentTemplate":this._contentAlreadyRendered=!1,this._clean(),this._invalidate();break;case"hideTopOverlayHandler":this._toggleHideTopOverlayCallback(!1),this._initHideTopOverlayHandler(t),this._toggleHideTopOverlayCallback(this.option("visible"));break;case"hideOnParentScroll":this._toggleHideOnParentsScrollSubscription(this.option("visible"));break;case"rtlEnabled":this._contentAlreadyRendered=!1,this.callBase(e);break;case"_fixWrapperPosition":this._positionController.fixWrapperPosition=t;break;case"wrapperAttr":this._renderWrapperAttributes();break;case"restorePosition":this._positionController.restorePosition=t;break;case"preventScrollEvents":this._logDeprecatedPreventScrollEventsInfo(),this._toggleWrapperScrollEventsSubscription(t);break;default:this.callBase(e)}},toggle:function(e){e=void 0===e?!this.option("visible"):e;var t=new ee;if(e===this.option("visible"))return t.resolveWith(this,[e]).promise();var n=new ee;return this._animateDeferred=n,this.option("visible",e),n.promise().done((()=>{delete this._animateDeferred,t.resolveWith(this,[this.option("visible")])})).fail((()=>{delete this._animateDeferred,t.reject()})),t.promise()},$content:function(){return this._$content},show:function(){return this.toggle(!0)},hide:function(){return this.toggle(!1)},content:function(){return La(this._$content)},repaint:function(){this._contentAlreadyRendered?(this._positionController.restorePositionOnNextRender(!0),this._renderGeometry({forceStopAnimation:!0}),Oa(this._$content)):this.callBase()}});km.baseZIndex=e=>hm=ve(e,hm),Zn("dxOverlay",km);const Dm=km;var Om="dx-loadpanel-indicator",Am="dx-loadpanel-message",Rm=Dm.inherit({_supportedKeys:function(){return y(this.callBase(),{escape:Pe})},_getDefaultOptions:function(){return y(this.callBase(),{message:Li.format("Loading"),width:222,height:90,animation:null,showIndicator:!0,indicatorSrc:"",showPane:!0,delay:0,templatesRenderAsynchronously:!1,hideTopOverlayHandler:null,focusStateEnabled:!1,propagateOutsideClick:!0,preventScrollEvents:!1})},_defaultOptionsRules:function(){return this.callBase().concat([{device:{platform:"generic"},options:{shadingColor:"transparent"}},{device:function(){return eh()},options:{message:"",width:60,height:60,maxHeight:60,maxWidth:60}},{device:function(){return th()},options:{width:"auto",height:"auto"}}])},_init:function(){this.callBase.apply(this,arguments)},_render:function(){this.callBase(),this.$element().addClass("dx-loadpanel"),this.$wrapper().addClass("dx-loadpanel-wrapper"),this._setWrapperAria()},_setWrapperAria(){var{message:e}=this.option(),t=Zu()?e:null,n={role:"alert",label:e?t:Li.format("Loading")};this.setAria(n,this.$wrapper())},_renderContentImpl:function(){this.callBase(),this.$content().addClass("dx-loadpanel-content"),this._$loadPanelContentWrapper=Un("").addClass("dx-loadpanel-content-wrapper"),this._$loadPanelContentWrapper.appendTo(this.$content()),this._togglePaneVisible(),this._cleanPreviousContent(),this._renderLoadIndicator(),this._renderMessage()},_show:function(){var e=this.option("delay");if(!e)return this.callBase();var t=new ee,n=this.callBase.bind(this);return this._clearShowTimeout(),this._showTimeout=setTimeout((function(){n().done((function(){t.resolve()}))}),e),t.promise()},_hide:function(){return this._clearShowTimeout(),this.callBase()},_clearShowTimeout:function(){clearTimeout(this._showTimeout)},_renderMessage:function(){if(this._$loadPanelContentWrapper){var e=this.option("message");if(e){var t=Un("
").addClass(Am).text(e);this._$loadPanelContentWrapper.append(t)}}},_renderLoadIndicator:function(){this._$loadPanelContentWrapper&&this.option("showIndicator")&&(this._$indicator||(this._$indicator=Un("
").addClass(Om).appendTo(this._$loadPanelContentWrapper)),this._createComponent(this._$indicator,Lp,{indicatorSrc:this.option("indicatorSrc")}))},_cleanPreviousContent:function(){this.$content().find("."+Am).remove(),this.$content().find("."+Om).remove(),delete this._$indicator},_togglePaneVisible:function(){this.$content().toggleClass("dx-loadpanel-pane-hidden",!this.option("showPane"))},_optionChanged:function(e){switch(e.name){case"delay":break;case"message":case"showIndicator":this._cleanPreviousContent(),this._renderLoadIndicator(),this._renderMessage(),this._setWrapperAria();break;case"showPane":this._togglePaneVisible();break;case"indicatorSrc":this._renderLoadIndicator();break;default:this.callBase(e)}},_dispose:function(){this._clearShowTimeout(),this.callBase()}});Zn("dxLoadPanel",Rm);const Pm=Rm;var Nm=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!==typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Mm=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return Nm(n,e),n.prototype.render=function(){var e=this.props.children,n=t.Children.map(e,(function(e){return pp(e).type===cp.Option?e:null}));return t.createElement(t.Fragment,{},n)},n}(t.PureComponent);const Lm=Mm;var Fm=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!==typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Bm=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._WidgetClass=Pm,t.isPortalComponent=!0,t.subscribableOptions=["position","visible"],t.independentEvents=["onContentReady","onDisposing","onHidden","onHiding","onInitialized","onShowing","onShown"],t._defaults={defaultPosition:"position",defaultVisible:"visible"},t._expectedChildren={animation:{optionName:"animation",isCollectionItem:!1},position:{optionName:"position",isCollectionItem:!1}},t}return Fm(t,e),Object.defineProperty(t.prototype,"instance",{get:function(){return this._instance},enumerable:!1,configurable:!0}),t}(Ep);Bm.propTypes={animation:bd.object,closeOnOutsideClick:bd.oneOfType([bd.bool,bd.func]),copyRootClassesToWrapper:bd.bool,deferRendering:bd.bool,delay:bd.number,focusStateEnabled:bd.bool,height:bd.oneOfType([bd.func,bd.number,bd.string]),hideOnOutsideClick:bd.oneOfType([bd.bool,bd.func]),hideOnParentScroll:bd.bool,hint:bd.string,hoverStateEnabled:bd.bool,indicatorSrc:bd.string,maxHeight:bd.oneOfType([bd.func,bd.number,bd.string]),maxWidth:bd.oneOfType([bd.func,bd.number,bd.string]),message:bd.string,minHeight:bd.oneOfType([bd.func,bd.number,bd.string]),minWidth:bd.oneOfType([bd.func,bd.number,bd.string]),onContentReady:bd.func,onDisposing:bd.func,onHidden:bd.func,onHiding:bd.func,onInitialized:bd.func,onOptionChanged:bd.func,onShowing:bd.func,onShown:bd.func,position:bd.oneOfType([bd.func,bd.object,bd.oneOfType([bd.string,bd.oneOf(["bottom","center","left","left bottom","left top","right","right bottom","right top","top"])])]),rtlEnabled:bd.bool,shading:bd.bool,shadingColor:bd.string,showIndicator:bd.bool,showPane:bd.bool,visible:bd.bool,width:bd.oneOfType([bd.func,bd.number,bd.string])};(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="animation",t.ExpectedChildren={hide:{optionName:"hide",isCollectionItem:!1},show:{optionName:"show",isCollectionItem:!1}}})(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="at"}(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="boundaryOffset"}(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="collision"}(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="from",t.ExpectedChildren={position:{optionName:"position",isCollectionItem:!1}}}(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="hide",t.ExpectedChildren={from:{optionName:"from",isCollectionItem:!1},to:{optionName:"to",isCollectionItem:!1}}}(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="my"}(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="offset"}(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="position"}(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="show"}(Lm),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Fm(t,e),t.OptionName="to"}(Lm);var Vm=n(184);const Hm=e=>(0,Vm.jsx)(Vm.Fragment,{children:(0,Vm.jsx)(Bm,{shadingColor:"rgba(0.4,0.4,0.4,0.4)",visible:e.visible,showIndicator:!0,shading:!0,showPane:!1,hideOnOutsideClick:!1,indicatorSrc:"https://js.devexpress.com/Content/data/loadingIcons/rolling.svg"})}),Um=(0,t.createContext)(),zm=e=>{let{children:n}=e;const[i,r]=(0,t.useState)(!0);return(0,Vm.jsx)(Um.Provider,{value:{loading:i,setLoading:r},children:n})};function jm(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t
"number"==typeof e&&!isNaN(e),Gm=e=>"string"==typeof e,Km=e=>"function"==typeof e,qm=e=>Gm(e)||Km(e)?e:null,Qm=e=>(0,t.isValidElement)(e)||Gm(e)||Km(e)||Wm(e);function Xm(e){let{enter:n,exit:i,appendPosition:r=!1,collapse:o=!0,collapseDuration:s=300}=e;return function(e){let{children:a,position:l,preventExitTransition:c,done:u,nodeRef:h,isIn:d}=e;const p=r?"".concat(n,"--").concat(l):n,f=r?"".concat(i,"--").concat(l):i,m=(0,t.useRef)(0);return(0,t.useLayoutEffect)((()=>{const e=h.current,t=p.split(" "),n=i=>{i.target===h.current&&(e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",n),e.removeEventListener("animationcancel",n),0===m.current&&"animationcancel"!==i.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)}),[]),(0,t.useEffect)((()=>{const e=h.current,t=()=>{e.removeEventListener("animationend",t),o?function(e,t,n){void 0===n&&(n=300);const{scrollHeight:i,style:r}=e;requestAnimationFrame((()=>{r.minHeight="initial",r.height=i+"px",r.transition="all ".concat(n,"ms"),requestAnimationFrame((()=>{r.height="0",r.padding="0",r.margin="0",setTimeout(t,n)}))}))}(e,u,s):u()};d||(c?t():(m.current=1,e.className+=" ".concat(f),e.addEventListener("animationend",t)))}),[d]),t.createElement(t.Fragment,null,a)}}function Ym(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const Jm={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const n=this.list.get(e).filter((e=>e!==t));return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach((t=>{const n=setTimeout((()=>{t(...[].slice.call(arguments,1))}),0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)}))}},Zm=e=>{let{theme:n,type:i,...r}=e;return t.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===n?"currentColor":"var(--toastify-icon-color-".concat(i,")"),...r})},eg={info:function(e){return t.createElement(Zm,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return t.createElement(Zm,{...e},t.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return t.createElement(Zm,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return t.createElement(Zm,{...e},t.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return t.createElement("div",{className:"Toastify__spinner"})}};function tg(e){const[,n]=(0,t.useReducer)((e=>e+1),0),[i,r]=(0,t.useState)([]),o=(0,t.useRef)(null),s=(0,t.useRef)(new Map).current,a=e=>-1!==i.indexOf(e),l=(0,t.useRef)({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:a,getToast:e=>s.get(e)}).current;function c(e){let{containerId:t}=e;const{limit:n}=l.props;!n||t&&l.containerId!==t||(l.count-=l.queue.length,l.queue=[])}function u(e){r((t=>null==e?[]:t.filter((t=>t!==e))))}function h(){const{toastContent:e,toastProps:t,staleId:n}=l.queue.shift();p(e,t,n)}function d(e,i){let{delay:r,staleId:a,...c}=i;if(!Qm(e)||function(e){return!o.current||l.props.enableMultiContainer&&e.containerId!==l.props.containerId||s.has(e.toastId)&&null==e.updateId}(c))return;const{toastId:d,updateId:f,data:m}=c,{props:g}=l,v=()=>u(d),_=null==f;_&&l.count++;const y={...g,style:g.toastStyle,key:l.toastKey++,...Object.fromEntries(Object.entries(c).filter((e=>{let[t,n]=e;return null!=n}))),toastId:d,updateId:f,data:m,closeToast:v,isIn:!1,className:qm(c.className||g.toastClassName),bodyClassName:qm(c.bodyClassName||g.bodyClassName),progressClassName:qm(c.progressClassName||g.progressClassName),autoClose:!c.isLoading&&(b=c.autoClose,w=g.autoClose,!1===b||Wm(b)&&b>0?b:w),deleteToast(){const e=Ym(s.get(d),"removed");s.delete(d),Jm.emit(4,e);const t=l.queue.length;if(l.count=null==d?l.count-l.displayedToast:l.count-1,l.count<0&&(l.count=0),t>0){const e=null==d?l.props.limit:1;if(1===t||1===e)l.displayedToast++,h();else{const n=e>t?t:e;l.displayedToast=n;for(let e=0;ee in eg)(i)&&(s=eg[i](a))),s}(y),Km(c.onOpen)&&(y.onOpen=c.onOpen),Km(c.onClose)&&(y.onClose=c.onClose),y.closeButton=g.closeButton,!1===c.closeButton||Qm(c.closeButton)?y.closeButton=c.closeButton:!0===c.closeButton&&(y.closeButton=!Qm(g.closeButton)||g.closeButton);let C=e;(0,t.isValidElement)(e)&&!Gm(e.type)?C=(0,t.cloneElement)(e,{closeToast:v,toastProps:y,data:m}):Km(e)&&(C=e({closeToast:v,toastProps:y,data:m})),g.limit&&g.limit>0&&l.count>g.limit&&_?l.queue.push({toastContent:C,toastProps:y,staleId:a}):Wm(r)?setTimeout((()=>{p(C,y,a)}),r):p(C,y,a)}function p(e,t,n){const{toastId:i}=t;n&&s.delete(n);const o={content:e,props:t};s.set(i,o),r((e=>[...e,i].filter((e=>e!==n)))),Jm.emit(4,Ym(o,null==o.props.updateId?"added":"updated"))}return(0,t.useEffect)((()=>(l.containerId=e.containerId,Jm.cancelEmit(3).on(0,d).on(1,(e=>o.current&&u(e))).on(5,c).emit(2,l),()=>{s.clear(),Jm.emit(3,l)})),[]),(0,t.useEffect)((()=>{l.props=e,l.isToastActive=a,l.displayedToast=i.length})),{getToastToRender:function(t){const n=new Map,i=Array.from(s.values());return e.newestOnTop&&i.reverse(),i.forEach((e=>{const{position:t}=e.props;n.has(t)||n.set(t,[]),n.get(t).push(e)})),Array.from(n,(e=>t(e[0],e[1])))},containerRef:o,isToastActive:a}}function ng(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function ig(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function rg(e){const[n,i]=(0,t.useState)(!1),[r,o]=(0,t.useState)(!1),s=(0,t.useRef)(null),a=(0,t.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,l=(0,t.useRef)(e),{autoClose:c,pauseOnHover:u,closeToast:h,onClick:d,closeOnClick:p}=e;function f(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),a.didMove=!1,document.addEventListener("mousemove",_),document.addEventListener("mouseup",y),document.addEventListener("touchmove",_),document.addEventListener("touchend",y);const n=s.current;a.canCloseOnClick=!0,a.canDrag=!0,a.boundingRect=n.getBoundingClientRect(),n.style.transition="",a.x=ng(t.nativeEvent),a.y=ig(t.nativeEvent),"x"===e.draggableDirection?(a.start=a.x,a.removalDistance=n.offsetWidth*(e.draggablePercent/100)):(a.start=a.y,a.removalDistance=n.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function m(t){if(a.boundingRect){const{top:n,bottom:i,left:r,right:o}=a.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&a.x>=r&&a.x<=o&&a.y>=n&&a.y<=i?v():g()}}function g(){i(!0)}function v(){i(!1)}function _(t){const i=s.current;a.canDrag&&i&&(a.didMove=!0,n&&v(),a.x=ng(t),a.y=ig(t),a.delta="x"===e.draggableDirection?a.x-a.start:a.y-a.start,a.start!==a.x&&(a.canCloseOnClick=!1),i.style.transform="translate".concat(e.draggableDirection,"(").concat(a.delta,"px)"),i.style.opacity=""+(1-Math.abs(a.delta/a.removalDistance)))}function y(){document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",y),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",y);const t=s.current;if(a.canDrag&&a.didMove&&t){if(a.canDrag=!1,Math.abs(a.delta)>a.removalDistance)return o(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform="translate".concat(e.draggableDirection,"(0)"),t.style.opacity="1"}}(0,t.useEffect)((()=>{l.current=e})),(0,t.useEffect)((()=>(s.current&&s.current.addEventListener("d",g,{once:!0}),Km(e.onOpen)&&e.onOpen((0,t.isValidElement)(e.children)&&e.children.props),()=>{const e=l.current;Km(e.onClose)&&e.onClose((0,t.isValidElement)(e.children)&&e.children.props)})),[]),(0,t.useEffect)((()=>(e.pauseOnFocusLoss&&(document.hasFocus()||v(),window.addEventListener("focus",g),window.addEventListener("blur",v)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",g),window.removeEventListener("blur",v))})),[e.pauseOnFocusLoss]);const b={onMouseDown:f,onTouchStart:f,onMouseUp:m,onTouchEnd:m};return c&&u&&(b.onMouseEnter=v,b.onMouseLeave=g),p&&(b.onClick=e=>{d&&d(e),a.canCloseOnClick&&h()}),{playToast:g,pauseToast:v,isRunning:n,preventExitTransition:r,toastRef:s,eventHandlers:b}}function og(e){let{closeToast:n,theme:i,ariaLabel:r="close"}=e;return t.createElement("button",{className:"Toastify__close-button Toastify__close-button--".concat(i),type:"button",onClick:e=>{e.stopPropagation(),n(e)},"aria-label":r},t.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function sg(e){let{delay:n,isRunning:i,closeToast:r,type:o="default",hide:s,className:a,style:l,controlledProgress:c,progress:u,rtl:h,isIn:d,theme:p}=e;const f=s||c&&0===u,m={...l,animationDuration:"".concat(n,"ms"),animationPlayState:i?"running":"paused",opacity:f?0:1};c&&(m.transform="scaleX(".concat(u,")"));const g=$m("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated","Toastify__progress-bar-theme--".concat(p),"Toastify__progress-bar--".concat(o),{"Toastify__progress-bar--rtl":h}),v=Km(a)?a({rtl:h,type:o,defaultClassName:g}):$m(g,a);return t.createElement("div",{role:"progressbar","aria-hidden":f?"true":"false","aria-label":"notification timer",className:v,style:m,[c&&u>=1?"onTransitionEnd":"onAnimationEnd"]:c&&u<1?null:()=>{d&&r()}})}const ag=e=>{const{isRunning:n,preventExitTransition:i,toastRef:r,eventHandlers:o}=rg(e),{closeButton:s,children:a,autoClose:l,onClick:c,type:u,hideProgressBar:h,closeToast:d,transition:p,position:f,className:m,style:g,bodyClassName:v,bodyStyle:_,progressClassName:y,progressStyle:b,updateId:w,role:C,progress:S,rtl:x,toastId:E,deleteToast:I,isIn:T,isLoading:k,iconOut:D,closeOnClick:O,theme:A}=e,R=$m("Toastify__toast","Toastify__toast-theme--".concat(A),"Toastify__toast--".concat(u),{"Toastify__toast--rtl":x},{"Toastify__toast--close-on-click":O}),P=Km(m)?m({rtl:x,position:f,type:u,defaultClassName:R}):$m(R,m),N=!!S||!l,M={closeToast:d,type:u,theme:A};let L=null;return!1===s||(L=Km(s)?s(M):(0,t.isValidElement)(s)?(0,t.cloneElement)(s,M):og(M)),t.createElement(p,{isIn:T,done:I,position:f,preventExitTransition:i,nodeRef:r},t.createElement("div",{id:E,onClick:c,className:P,...o,style:g,ref:r},t.createElement("div",{...T&&{role:C},className:Km(v)?v({type:u}):$m("Toastify__toast-body",v),style:_},null!=D&&t.createElement("div",{className:$m("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!k})},D),t.createElement("div",null,a)),L,t.createElement(sg,{...w&&!N?{key:"pb-".concat(w)}:{},rtl:x,theme:A,delay:l,isRunning:n,isIn:T,closeToast:d,hide:h,type:u,style:b,className:y,controlledProgress:N,progress:S||0})))},lg=function(e,t){return void 0===t&&(t=!1),{enter:"Toastify--animate Toastify__".concat(e,"-enter"),exit:"Toastify--animate Toastify__".concat(e,"-exit"),appendPosition:t}},cg=Xm(lg("bounce",!0)),ug=(Xm(lg("slide",!0)),Xm(lg("zoom")),Xm(lg("flip")),(0,t.forwardRef)(((e,n)=>{const{getToastToRender:i,containerRef:r,isToastActive:o}=tg(e),{className:s,style:a,rtl:l,containerId:c}=e;function u(e){const t=$m("Toastify__toast-container","Toastify__toast-container--".concat(e),{"Toastify__toast-container--rtl":l});return Km(s)?s({position:e,rtl:l,defaultClassName:t}):$m(t,qm(s))}return(0,t.useEffect)((()=>{n&&(n.current=r.current)}),[]),t.createElement("div",{ref:r,className:"Toastify",id:c},i(((e,n)=>{const i=n.length?{...a}:{...a,pointerEvents:"none"};return t.createElement("div",{className:u(e),style:i,key:"container-".concat(e)},n.map(((e,i)=>{let{content:r,props:s}=e;return t.createElement(ag,{...s,isIn:o(s.toastId),style:{...s.style,"--nth":i+1,"--len":n.length},key:"toast-".concat(s.key)},r)})))})))})));ug.displayName="ToastContainer",ug.defaultProps={position:"top-right",transition:cg,autoClose:5e3,closeButton:og,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let hg,dg=new Map,pg=[],fg=1;function mg(){return""+fg++}function gg(e){return e&&(Gm(e.toastId)||Wm(e.toastId))?e.toastId:mg()}function vg(e,t){return dg.size>0?Jm.emit(0,e,t):pg.push({content:e,options:t}),t.toastId}function _g(e,t){return{...t,type:t&&t.type||e,toastId:gg(t)}}function yg(e){return(t,n)=>vg(t,_g(e,n))}function bg(e,t){return vg(e,_g("default",t))}function wg(){return wg=Object.assign?Object.assign.bind():function(e){for(var t=1;tvg(e,_g("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),bg.promise=function(e,t,n){let i,{pending:r,error:o,success:s}=t;r&&(i=Gm(r)?bg.loading(r,n):bg.loading(r.render,{...n,...r}));const a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(e,t,r)=>{if(null==t)return void bg.dismiss(i);const o={type:e,...a,...n,data:r},s=Gm(t)?{render:t}:t;return i?bg.update(i,{...o,...s}):bg(s.render,{...o,...s}),r},c=Km(e)?e():e;return c.then((e=>l("success",s,e))).catch((e=>l("error",o,e))),c},bg.success=yg("success"),bg.info=yg("info"),bg.error=yg("error"),bg.warning=yg("warning"),bg.warn=bg.warning,bg.dark=(e,t)=>vg(e,_g("default",{theme:"dark",...t})),bg.dismiss=e=>{dg.size>0?Jm.emit(1,e):pg=pg.filter((t=>null!=e&&t.options.toastId!==e))},bg.clearWaitingQueue=function(e){return void 0===e&&(e={}),Jm.emit(5,e)},bg.isActive=e=>{let t=!1;return dg.forEach((n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)})),t},bg.update=function(e,t){void 0===t&&(t={}),setTimeout((()=>{const n=function(e,t){let{containerId:n}=t;const i=dg.get(n||hg);return i&&i.getToast(e)}(e,t);if(n){const{props:i,content:r}=n,o={delay:100,...i,...t,toastId:t.toastId||e,updateId:mg()};o.toastId!==e&&(o.staleId=e);const s=o.render||r;delete o.render,vg(s,o)}}),0)},bg.done=e=>{bg.update(e,{progress:1})},bg.onChange=e=>(Jm.on(4,e),()=>{Jm.off(4,e)}),bg.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},bg.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Jm.on(2,(e=>{hg=e.containerId||e,dg.set(hg,e),pg.forEach((e=>{Jm.emit(0,e.content,e.options)})),pg=[]})).on(3,(e=>{dg.delete(e.containerId||e),0===dg.size&&Jm.off(0).off(1).off(5)})),function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(Cg||(Cg={}));const Sg="popstate";function xg(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}function Eg(e,t){if(!e){"undefined"!==typeof console&&console.warn(t);try{throw new Error(t)}catch(n){}}}function Ig(e,t){return{usr:e.state,key:e.key,idx:t}}function Tg(e,t,n,i){return void 0===n&&(n=null),wg({pathname:"string"===typeof e?e:e.pathname,search:"",hash:""},"string"===typeof t?Dg(t):t,{state:n,key:t&&t.key||i||Math.random().toString(36).substr(2,8)})}function kg(e){let{pathname:t="/",search:n="",hash:i=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),i&&"#"!==i&&(t+="#"===i.charAt(0)?i:"#"+i),t}function Dg(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let i=e.indexOf("?");i>=0&&(t.search=e.substr(i),e=e.substr(0,i)),e&&(t.pathname=e)}return t}function Og(e,t,n,i){void 0===i&&(i={});let{window:r=document.defaultView,v5Compat:o=!1}=i,s=r.history,a=Cg.Pop,l=null,c=u();function u(){return(s.state||{idx:null}).idx}function h(){a=Cg.Pop;let e=u(),t=null==e?null:e-c;c=e,l&&l({action:a,location:p.location,delta:t})}function d(e){let t="null"!==r.location.origin?r.location.origin:r.location.href,n="string"===typeof e?e:kg(e);return xg(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==c&&(c=0,s.replaceState(wg({},s.state,{idx:c}),""));let p={get action(){return a},get location(){return e(r,s)},listen(e){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(Sg,h),l=e,()=>{r.removeEventListener(Sg,h),l=null}},createHref:e=>t(r,e),createURL:d,encodeLocation(e){let t=d(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){a=Cg.Push;let i=Tg(p.location,e,t);n&&n(i,e),c=u()+1;let h=Ig(i,c),d=p.createHref(i);try{s.pushState(h,"",d)}catch(D){if(D instanceof DOMException&&"DataCloneError"===D.name)throw D;r.location.assign(d)}o&&l&&l({action:a,location:p.location,delta:1})},replace:function(e,t){a=Cg.Replace;let i=Tg(p.location,e,t);n&&n(i,e),c=u();let r=Ig(i,c),h=p.createHref(i);s.replaceState(r,"",h),o&&l&&l({action:a,location:p.location,delta:0})},go:e=>s.go(e)};return p}var Ag;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Ag||(Ag={}));new Set(["lazy","caseSensitive","path","id","index","children"]);function Rg(e,t,n){void 0===n&&(n="/");let i=Gg(("string"===typeof t?Dg(t):t).pathname||"/",n);if(null==i)return null;let r=Pg(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(r);let o=null;for(let s=0;null==o&&s{let s={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:r,route:e};s.relativePath.startsWith("/")&&(xg(s.relativePath.startsWith(i),'Absolute route path "'+s.relativePath+'" nested under path "'+i+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(i.length));let a=Yg([i,s.relativePath]),l=n.concat(s);e.children&&e.children.length>0&&(xg(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+a+'".'),Pg(e.children,t,l,a)),(null!=e.path||e.index)&&t.push({path:a,score:zg(a,e.index),routesMeta:l})};return e.forEach(((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let i of Ng(e.path))r(e,t,i);else r(e,t)})),t}function Ng(e){let t=e.split("/");if(0===t.length)return[];let[n,...i]=t,r=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===i.length)return r?[o,""]:[o];let s=Ng(i.join("/")),a=[];return a.push(...s.map((e=>""===e?o:[o,e].join("/")))),r&&a.push(...s),a.map((t=>e.startsWith("/")&&""===t?"/":t))}const Mg=/^:\w+$/,Lg=3,Fg=2,Bg=1,Vg=10,Hg=-2,Ug=e=>"*"===e;function zg(e,t){let n=e.split("/"),i=n.length;return n.some(Ug)&&(i+=Hg),t&&(i+=Fg),n.filter((e=>!Ug(e))).reduce(((e,t)=>e+(Mg.test(t)?Lg:""===t?Bg:Vg)),i)}function jg(e,t){let{routesMeta:n}=e,i={},r="/",o=[];for(let s=0;s(i.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(i.push({paramName:"*"}),r+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":""!==e&&"/"!==e&&(r+="(?:(?=\\/|$))");let o=new RegExp(r,t?void 0:"i");return[o,i]}(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let o=r[0],s=o.replace(/(.)\/+$/,"$1"),a=r.slice(1),l=i.reduce(((e,t,n)=>{let{paramName:i,isOptional:r}=t;if("*"===i){let e=a[n]||"";s=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const l=a[n];return e[i]=r&&!l?void 0:function(e,t){try{return decodeURIComponent(e)}catch(D){return Eg(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+D+")."),e}}(l||"",i),e}),{});return{params:l,pathname:o,pathnameBase:s,pattern:e}}function Wg(e){try{return decodeURI(e)}catch(D){return Eg(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+D+")."),e}}function Gg(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,i=e.charAt(n);return i&&"/"!==i?null:e.slice(n)||"/"}function Kg(e,t,n,i){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(i)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in and the router will parse it for you.'}function qg(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function Qg(e,t){let n=qg(e);return t?n.map(((t,n)=>n===e.length-1?t.pathname:t.pathnameBase)):n.map((e=>e.pathnameBase))}function Xg(e,t,n,i){let r;void 0===i&&(i=!1),"string"===typeof e?r=Dg(e):(r=wg({},e),xg(!r.pathname||!r.pathname.includes("?"),Kg("?","pathname","search",r)),xg(!r.pathname||!r.pathname.includes("#"),Kg("#","pathname","hash",r)),xg(!r.search||!r.search.includes("#"),Kg("#","search","hash",r)));let o,s=""===e||""===r.pathname,a=s?"/":r.pathname;if(null==a)o=n;else{let e=t.length-1;if(!i&&a.startsWith("..")){let t=a.split("/");for(;".."===t[0];)t.shift(),e-=1;r.pathname=t.join("/")}o=e>=0?t[e]:"/"}let l=function(e,t){void 0===t&&(t="/");let{pathname:n,search:i="",hash:r=""}="string"===typeof e?Dg(e):e,o=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:o,search:Zg(i),hash:ev(r)}}(r,o),c=a&&"/"!==a&&a.endsWith("/"),u=(s||"."===a)&&n.endsWith("/");return l.pathname.endsWith("/")||!c&&!u||(l.pathname+="/"),l}const Yg=e=>e.join("/").replace(/\/\/+/g,"/"),Jg=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Zg=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",ev=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;function tv(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"boolean"===typeof e.internal&&"data"in e}const nv=["post","put","patch","delete"],iv=(new Set(nv),["get",...nv]);new Set(iv),new Set([301,302,303,307,308]),new Set([307,308]);Symbol("deferred");function rv(){return rv=Object.assign?Object.assign.bind():function(e){for(var t=1;t{i.current=!0}));let r=t.useCallback((function(t,r){void 0===r&&(r={}),i.current&&("number"===typeof t?e.navigate(t):e.navigate(t,rv({fromRouteId:n},r)))}),[e,n]);return r}():function(){hv()||xg(!1);let e=t.useContext(ov),{basename:n,future:i,navigator:r}=t.useContext(av),{matches:o}=t.useContext(cv),{pathname:s}=dv(),a=JSON.stringify(Qg(o,i.v7_relativeSplatPath)),l=t.useRef(!1);pv((()=>{l.current=!0}));let c=t.useCallback((function(t,i){if(void 0===i&&(i={}),!l.current)return;if("number"===typeof t)return void r.go(t);let o=Xg(t,JSON.parse(a),s,"path"===i.relative);null==e&&"/"!==n&&(o.pathname="/"===o.pathname?n:Yg([n,o.pathname])),(i.replace?r.replace:r.push)(o,i.state,i)}),[n,r,a,s,e]);return c}()}function mv(e,n,i,r){hv()||xg(!1);let{navigator:o}=t.useContext(av),{matches:s}=t.useContext(cv),a=s[s.length-1],l=a?a.params:{},c=(a&&a.pathname,a?a.pathnameBase:"/");a&&a.route;let u,h=dv();if(n){var d;let e="string"===typeof n?Dg(n):n;"/"===c||(null==(d=e.pathname)?void 0:d.startsWith(c))||xg(!1),u=e}else u=h;let p=u.pathname||"/",f=Rg(e,{pathname:"/"===c?p:p.slice(c.length)||"/"});let m=bv(f&&f.map((e=>Object.assign({},e,{params:Object.assign({},l,e.params),pathname:Yg([c,o.encodeLocation?o.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?c:Yg([c,o.encodeLocation?o.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),s,i,r);return n&&m?t.createElement(lv.Provider,{value:{location:rv({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:Cg.Pop}},m):m}function gv(){let e=function(){var e;let n=t.useContext(uv),i=xv(Cv.UseRouteError),r=Ev(Cv.UseRouteError);if(void 0!==n)return n;return null==(e=i.errors)?void 0:e[r]}(),n=tv(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r};return t.createElement(t.Fragment,null,t.createElement("h2",null,"Unexpected Application Error!"),t.createElement("h3",{style:{fontStyle:"italic"}},n),i?t.createElement("pre",{style:o},i):null,null)}const vv=t.createElement(gv,null);class _v extends t.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?t.createElement(cv.Provider,{value:this.props.routeContext},t.createElement(uv.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function yv(e){let{routeContext:n,match:i,children:r}=e,o=t.useContext(ov);return o&&o.static&&o.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=i.route.id),t.createElement(cv.Provider,{value:n},r)}function bv(e,n,i,r){var o;if(void 0===n&&(n=[]),void 0===i&&(i=null),void 0===r&&(r=null),null==e){var s;if(null==(s=i)||!s.errors)return null;e=i.matches}let a=e,l=null==(o=i)?void 0:o.errors;if(null!=l){let e=a.findIndex((e=>e.route.id&&(null==l?void 0:l[e.route.id])));e>=0||xg(!1),a=a.slice(0,Math.min(a.length,e+1))}let c=!1,u=-1;if(i&&r&&r.v7_partialHydration)for(let t=0;t=0?a.slice(0,u+1):[a[0]];break}}}return a.reduceRight(((e,r,o)=>{let s,h=!1,d=null,p=null;var f;i&&(s=l&&r.route.id?l[r.route.id]:void 0,d=r.route.errorElement||vv,c&&(u<0&&0===o?(f="route-fallback",!1||Iv[f]||(Iv[f]=!0),h=!0,p=null):u===o&&(h=!0,p=r.route.hydrateFallbackElement||null)));let m=n.concat(a.slice(0,o+1)),g=()=>{let n;return n=s?d:h?p:r.route.Component?t.createElement(r.route.Component,null):r.route.element?r.route.element:e,t.createElement(yv,{match:r,routeContext:{outlet:e,matches:m,isDataRoute:null!=i},children:n})};return i&&(r.route.ErrorBoundary||r.route.errorElement||0===o)?t.createElement(_v,{location:i.location,revalidation:i.revalidation,component:d,error:s,children:g(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):g()}),null)}var wv=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(wv||{}),Cv=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Cv||{});function Sv(e){let n=t.useContext(ov);return n||xg(!1),n}function xv(e){let n=t.useContext(sv);return n||xg(!1),n}function Ev(e){let n=function(e){let n=t.useContext(cv);return n||xg(!1),n}(),i=n.matches[n.matches.length-1];return i.route.id||xg(!1),i.route.id}const Iv={};i.startTransition;function Tv(e){xg(!1)}function kv(e){let{basename:n="/",children:i=null,location:r,navigationType:o=Cg.Pop,navigator:s,static:a=!1,future:l}=e;hv()&&xg(!1);let c=n.replace(/^\/*/,"/"),u=t.useMemo((()=>({basename:c,navigator:s,static:a,future:rv({v7_relativeSplatPath:!1},l)})),[c,l,s,a]);"string"===typeof r&&(r=Dg(r));let{pathname:h="/",search:d="",hash:p="",state:f=null,key:m="default"}=r,g=t.useMemo((()=>{let e=Gg(h,c);return null==e?null:{location:{pathname:e,search:d,hash:p,state:f,key:m},navigationType:o}}),[c,h,d,p,f,m,o]);return null==g?null:t.createElement(av.Provider,{value:u},t.createElement(lv.Provider,{children:i,value:g}))}function Dv(e){let{children:t,location:n}=e;return mv(Ov(t),n)}new Promise((()=>{}));t.Component;function Ov(e,n){void 0===n&&(n=[]);let i=[];return t.Children.forEach(e,((e,r)=>{if(!t.isValidElement(e))return;let o=[...n,r];if(e.type===t.Fragment)return void i.push.apply(i,Ov(e.props.children,o));e.type!==Tv&&xg(!1),e.props.index&&e.props.children&&xg(!1);let s={id:e.props.id||o.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(s.children=Ov(e.props.children,o)),i.push(s)})),i}const Av=function(e){const t=[];let n=0;for(let i=0;i>6|192,t[n++]=63&r|128):55296===(64512&r)&&i+1>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128)}return t},Rv={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"===typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let r=0;r>2,u=(3&t)<<4|s>>4;let h=(15&s)<<2|l>>6,d=63&l;a||(d=64,o||(h=64)),i.push(n[c],n[u],n[h],n[d])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Av(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,i=0;for(;n191&&r<224){const o=e[n++];t[i++]=String.fromCharCode((31&r)<<6|63&o)}else if(r>239&&r<365){const o=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[i++]=String.fromCharCode(55296+(o>>10)),t[i++]=String.fromCharCode(56320+(1023&o))}else{const o=e[n++],s=e[n++];t[i++]=String.fromCharCode((15&r)<<12|(63&o)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let r=0;r>4;if(i.push(l),64!==s){const e=o<<4&240|s>>2;if(i.push(e),64!==a){const e=s<<6&192|a;i.push(e)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class Pv extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Nv=function(e){return function(e){const t=Av(e);return Rv.encodeByteArray(t,!0)}(e).replace(/\./g,"")},Mv=function(e){try{return Rv.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};const Lv=()=>function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,Fv=()=>{try{return Lv()||(()=>{if("undefined"===typeof process)return;const e={NODE_ENV:"production",PUBLIC_URL:"/D-Drive/Login",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_API_KEY:"AIzaSyAjxXsW1c9uIjoay8fx2Ycp7wC5CxRn2y0",REACT_APP_AUTH_DOMAIN:"drive-e2df5.firebaseapp.com",REACT_APP_PROJECT_ID:"drive-e2df5",REACT_APP_STORAGE_BUCKET:"drive-e2df5.appspot.com",REACT_APP_MSG_ID:"246736099441",REACT_APP_APP_ID:"1:246736099441:web:a9f6b34333f463955da3d0"}.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"===typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(n){return}const t=e&&Mv(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e))}},Bv=e=>{var t,n;return null===(n=null===(t=Fv())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},Vv=e=>{const t=Bv(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error("Invalid host ".concat(t," with no separate hostname and port!"));const i=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),i]:[t.substring(0,n),i]},Hv=()=>{var e;return null===(e=Fv())||void 0===e?void 0:e.config},Uv=e=>{var t;return null===(t=Fv())||void 0===t?void 0:t["_".concat(e)]};class zv{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"===typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function jv(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",i=e.iat||0,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:"https://securetoken.google.com/".concat(n),aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[Nv(JSON.stringify({alg:"none",type:"JWT"})),Nv(JSON.stringify(o)),""].join(".")}function $v(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""}class Wv extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,Wv.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Gv.prototype.create)}}class Gv{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e){const t=(arguments.length<=1?void 0:arguments[1])||{},n="".concat(this.service,"/").concat(e),i=this.errors[e],r=i?function(e,t){return e.replace(Kv,((e,n)=>{const i=t[n];return null!=i?String(i):"<".concat(n,"?>")}))}(i,t):"Error",o="".concat(this.serviceName,": ").concat(r," (").concat(n,").");return new Wv(n,o,t)}}const Kv=/\{\$([^}]+)}/g;function qv(e,t){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);for(const r of n){if(!i.includes(r))return!1;const n=e[r],o=t[r];if(Qv(n)&&Qv(o)){if(!qv(n,o))return!1}else if(n!==o)return!1}for(const r of i)if(!n.includes(r))return!1;return!0}function Qv(e){return null!==e&&"object"===typeof e}function Xv(e){const t=[];for(const[n,i]of Object.entries(e))Array.isArray(i)?i.forEach((e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return t.length?"&"+t.join("&"):""}function Yv(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[n,i]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(i)}})),t}function Jv(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class Zv{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,n){let i;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");i=function(e,t){if("object"!==typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"===typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===i.next&&(i.next=e_),void 0===i.error&&(i.error=e_),void 0===i.complete&&(i.complete=e_);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(e){}})),this.observers.push(i),r}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(n){"undefined"!==typeof console&&console.error&&console.error(n)}}))}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function e_(){}function t_(e){return e&&e._delegate?e._delegate:e}class n_{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const i_="[DEFAULT]";class r_{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new zv;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(n){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null===e||void 0===e?void 0:e.identifier),i=null!==(t=null===e||void 0===e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(i)return null;throw Error("Service ".concat(this.name," is not available"))}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(r){if(i)return null;throw r}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error("Mismatching Component ".concat(e.name," for Provider ").concat(this.name,"."));if(this.component)throw Error("Component for ".concat(this.name," has already been provided"));if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:i_})}catch(t){}for(const[e,n]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:i});n.resolve(e)}catch(t){}}}}clearInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i_;this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i_;return this.instances.has(e)}getOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i_;return this.instancesOptions.get(e)||{}}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error("".concat(this.name,"(").concat(n,") has already been initialized"));if(!this.isComponentSet())throw Error("Component ".concat(this.name," has not been registered yet"));const i=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[r,o]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(r)&&o.resolve(i)}return i}onInit(e,t){var n;const i=this.normalizeInstanceIdentifier(t),r=null!==(n=this.onInitCallbacks.get(i))&&void 0!==n?n:new Set;r.add(e),this.onInitCallbacks.set(i,r);const o=this.instances.get(i);return o&&e(o,i),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch(i){}}getOrInitializeService(e){let{instanceIdentifier:t,options:n={}}=e,i=this.instances.get(t);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:(r=t,r===i_?void 0:r),options:n}),this.instances.set(t,i),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(i,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,i)}catch(o){}var r;return i||null}normalizeInstanceIdentifier(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i_;return this.component?this.component.multipleInstances?e:i_:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class o_{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component ".concat(e.name," has already been registered with ").concat(this.name));t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new r_(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const s_=[];var a_;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(a_||(a_={}));const l_={debug:a_.DEBUG,verbose:a_.VERBOSE,info:a_.INFO,warn:a_.WARN,error:a_.ERROR,silent:a_.SILENT},c_=a_.INFO,u_={[a_.DEBUG]:"log",[a_.VERBOSE]:"log",[a_.INFO]:"info",[a_.WARN]:"warn",[a_.ERROR]:"error"},h_=function(e,t){if(t2?r-2:0),s=2;st.some((t=>e instanceof t));let f_,m_;const g_=new WeakMap,v_=new WeakMap,__=new WeakMap,y_=new WeakMap,b_=new WeakMap;let w_={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return v_.get(e);if("objectStoreNames"===t)return e.objectStoreNames||__.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return x_(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function C_(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(m_||(m_=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(){for(var t=arguments.length,n=new Array(t),i=0;i1?n-1:0),r=1;r{const i=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",o),e.removeEventListener("abort",o)},r=()=>{t(),i()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",r),e.addEventListener("error",o),e.addEventListener("abort",o)}));v_.set(e,t)}(e),p_(e,f_||(f_=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,w_):e)}function x_(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("success",r),e.removeEventListener("error",o)},r=()=>{t(x_(e.result)),i()},o=()=>{n(e.error),i()};e.addEventListener("success",r),e.addEventListener("error",o)}));return t.then((t=>{t instanceof IDBCursor&&g_.set(t,e)})).catch((()=>{})),b_.set(t,e),t}(e);if(y_.has(e))return y_.get(e);const t=S_(e);return t!==e&&(y_.set(e,t),b_.set(t,e)),t}const E_=e=>b_.get(e);const I_=["get","getKey","getAll","getAllKeys","count"],T_=["put","add","delete","clear"],k_=new Map;function D_(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!==typeof t)return;if(k_.get(t))return k_.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,r=T_.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!r&&!I_.includes(n))return;const o=async function(e){const t=this.transaction(e,r?"readwrite":"readonly");let o=t.store;for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l({...e,get:(t,n,i)=>D_(t,n)||e.get(t,n,i),has:(t,n)=>!!D_(t,n)||e.has(t,n)})));class O_{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null===t||void 0===t?void 0:t.type)}(e)){const t=e.getImmediate();return"".concat(t.library,"/").concat(t.version)}return null})).filter((e=>e)).join(" ")}}const A_="@firebase/app",R_="0.9.25",P_=new d_("@firebase/app"),N_="[DEFAULT]",M_={[A_]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},L_=new Map,F_=new Map;function B_(e,t){try{e.container.addComponent(t)}catch(n){P_.debug("Component ".concat(t.name," failed to register with FirebaseApp ").concat(e.name),n)}}function V_(e){const t=e.name;if(F_.has(t))return P_.debug("There were multiple attempts to register component ".concat(t,".")),!1;F_.set(t,e);for(const n of L_.values())B_(n,e);return!0}function H_(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}const U_=new Gv("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class z_{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new n_("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw U_.create("app-deleted",{appName:this._name})}}const j_="10.7.1";function $_(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;if("object"!==typeof t){t={name:t}}const i=Object.assign({name:N_,automaticDataCollectionEnabled:!1},t),r=i.name;if("string"!==typeof r||!r)throw U_.create("bad-app-name",{appName:String(r)});if(n||(n=Hv()),!n)throw U_.create("no-options");const o=L_.get(r);if(o){if(qv(n,o.options)&&qv(i,o.config))return o;throw U_.create("duplicate-app",{appName:r})}const s=new o_(r);for(const l of F_.values())s.addComponent(l);const a=new z_(n,i,s);return L_.set(r,a),a}function W_(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:N_;const t=L_.get(e);if(!t&&e===N_&&Hv())return $_();if(!t)throw U_.create("no-app",{appName:e});return t}function G_(e,t,n){var i;let r=null!==(i=M_[e])&&void 0!==i?i:e;n&&(r+="-".concat(n));const o=r.match(/\s|\//),s=t.match(/\s|\//);if(o||s){const e=['Unable to register library "'.concat(r,'" with version "').concat(t,'":')];return o&&e.push('library name "'.concat(r,'" contains illegal characters (whitespace or "/")')),o&&s&&e.push("and"),s&&e.push('version name "'.concat(t,'" contains illegal characters (whitespace or "/")')),void P_.warn(e.join(" "))}V_(new n_("".concat(r,"-version"),(()=>({library:r,version:t})),"VERSION"))}const K_="firebase-heartbeat-database",q_=1,Q_="firebase-heartbeat-store";let X_=null;function Y_(){return X_||(X_=function(e,t){let{blocked:n,upgrade:i,blocking:r,terminated:o}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=indexedDB.open(e,t),a=x_(s);return i&&s.addEventListener("upgradeneeded",(e=>{i(x_(s.result),e.oldVersion,e.newVersion,x_(s.transaction),e)})),n&&s.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{o&&e.addEventListener("close",(()=>o())),r&&e.addEventListener("versionchange",(e=>r(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}(K_,q_,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(Q_)}}).catch((e=>{throw U_.create("idb-open",{originalErrorMessage:e.message})}))),X_}async function J_(e,t){try{const n=(await Y_()).transaction(Q_,"readwrite"),i=n.objectStore(Q_);await i.put(t,Z_(e)),await n.done}catch(n){if(n instanceof Wv)P_.warn(n.message);else{const e=U_.create("idb-set",{originalErrorMessage:null===n||void 0===n?void 0:n.message});P_.warn(e.message)}}}function Z_(e){return"".concat(e.name,"!").concat(e.options.appId)}class ey{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ny(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t;const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=ty();if((null!=(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||(this._heartbeatsCache=await this._heartbeatsCachePromise,null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))&&this._heartbeatsCache.lastSentHeartbeatDate!==i&&!this._heartbeatsCache.heartbeats.some((e=>e.date===i)))return this._heartbeatsCache.heartbeats.push({date:i,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var e;if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=ty(),{heartbeatsToSend:n,unsentEntries:i}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024;const n=[];let i=e.slice();for(const r of e){const e=n.find((e=>e.agent===r.agent));if(e){if(e.dates.push(r.date),iy(n)>t){e.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),iy(n)>t){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),r=Nv(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}}function ty(){return(new Date).toISOString().substring(0,10)}class ny{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"===typeof indexedDB}catch(e){return!1}}()&&new Promise(((e,t)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var e;t((null===(e=r.error)||void 0===e?void 0:e.message)||"")}}catch(D){t(D)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=await Y_();return await t.transaction(Q_).objectStore(Q_).get(Z_(e))}catch(t){if(t instanceof Wv)P_.warn(t.message);else{const e=U_.create("idb-get",{originalErrorMessage:null===t||void 0===t?void 0:t.message});P_.warn(e.message)}}}(this.app);return(null===e||void 0===e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return J_(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return J_(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function iy(e){return Nv(JSON.stringify({version:2,heartbeats:e})).length}var ry;ry="",V_(new n_("platform-logger",(e=>new O_(e)),"PRIVATE")),V_(new n_("heartbeat",(e=>new ey(e)),"PRIVATE")),G_(A_,R_,ry),G_(A_,R_,"esm2017"),G_("fire-js","");function oy(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i2?n-2:0),r=2;re,"Short delay should be less than long delay!"),this.isMobile="undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test($v())||"object"===typeof navigator&&"ReactNative"===navigator.product}get(){return wy()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Sy(e,t){vy(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?"".concat(n).concat(t.startsWith("/")?t.slice(1):t):n}class xy{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!==typeof self&&"fetch"in self?self.fetch:"undefined"!==typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!==typeof fetch?fetch:void gy("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!==typeof self&&"Headers"in self?self.Headers:"undefined"!==typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!==typeof Headers?Headers:void gy("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!==typeof self&&"Response"in self?self.Response:"undefined"!==typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!==typeof Response?Response:void gy("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Ey={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Iy=new Cy(3e4,6e4);function Ty(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function ky(e,t,n,i){return Dy(e,arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},(async()=>{let r={},o={};i&&("GET"===t?o=i:r={body:JSON.stringify(i)});const s=Xv(Object.assign({key:e.config.apiKey},o)).slice(1),a=await e._getAdditionalHeaders();return a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode),xy.fetch()(Ay(e,e.config.apiHost,n,s),Object.assign({method:t,headers:a,referrerPolicy:"no-referrer"},r))}))}async function Dy(e,t,n){e._canInitEmulator=!1;const i=Object.assign(Object.assign({},Ey),t);try{const t=new Py(e),r=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const o=await r.json();if("needConfirmation"in o)throw Ny(e,"account-exists-with-different-credential",o);if(r.ok&&!("errorMessage"in o))return o;{const t=r.ok?o.errorMessage:o.error.message,[n,s]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Ny(e,"credential-already-in-use",o);if("EMAIL_EXISTS"===n)throw Ny(e,"email-already-in-use",o);if("USER_DISABLED"===n)throw Ny(e,"user-disabled",o);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(s)throw py(e,a,s);hy(e,a)}}catch(r){if(r instanceof Wv)throw r;hy(e,"network-request-failed",{message:String(r)})}}async function Oy(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const o=await ky(e,t,n,i,r);return"mfaPendingCredential"in o&&hy(e,"multi-factor-auth-required",{_serverResponse:o}),o}function Ay(e,t,n,i){const r="".concat(t).concat(n,"?").concat(i);return e.config.emulator?Sy(e.config,r):"".concat(e.config.apiScheme,"://").concat(r)}function Ry(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Py{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(dy(this.auth,"network-request-failed"))),Iy.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Ny(e,t,n){const i={appName:e.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const r=dy(e,t,i);return r.customData._tokenResponse=n,r}function My(e){return void 0!==e&&void 0!==e.enterprise}class Ly{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return Ry(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}}async function Fy(e,t){return ky(e,"GET","/v2/recaptchaConfig",Ty(e,t))}function By(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(t){}}function Vy(e){return 1e3*Number(e)}function Hy(e){const[t,n,i]=e.split(".");if(void 0===t||void 0===n||void 0===i)return uy("JWT malformed, contained fewer than 3 sections"),null;try{const e=Mv(n);return e?JSON.parse(e):(uy("Failed to decode base64 JWT payload"),null)}catch(r){return uy("Caught error parsing JWT payload as JSON",null===r||void 0===r?void 0:r.toString()),null}}async function Uy(e,t){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2])return t;try{return await t}catch(n){throw n instanceof Wv&&function(e){let{code:t}=e;return t==="auth/".concat("user-disabled")||t==="auth/".concat("user-token-expired")}(n)&&e.auth.currentUser===e&&await e.auth.signOut(),n}}class zy{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout((async()=>{await this.iteration()}),t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void((null===e||void 0===e?void 0:e.code)==="auth/".concat("network-request-failed")&&this.schedule(!0))}this.schedule()}}class jy{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=By(this.lastLoginAt),this.creationTime=By(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function $y(e){var t;const n=e.auth,i=await e.getIdToken(),r=await Uy(e,async function(e,t){return ky(e,"POST","/v1/accounts:lookup",t)}(n,{idToken:i}));my(null===r||void 0===r?void 0:r.users.length,n,"internal-error");const o=r.users[0];e._notifyReloadListener(o);const s=(null===(t=o.providerUserInfo)||void 0===t?void 0:t.length)?o.providerUserInfo.map((e=>{var{providerId:t}=e,n=oy(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=(l=e.providerData,c=s,[...l.filter((e=>!c.some((t=>t.providerId===e.providerId)))),...c]);var l,c;const u=e.isAnonymous,h=!(e.email&&o.passwordHash)&&!(null===a||void 0===a?void 0:a.length),d=!!u&&h,p={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:a,metadata:new jy(o.createdAt,o.lastLoginAt),isAnonymous:d};Object.assign(e,p)}class Wy{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){my(e.idToken,"internal-error"),my("undefined"!==typeof e.idToken,"internal-error"),my("undefined"!==typeof e.refreshToken,"internal-error");const t="expiresIn"in e&&"undefined"!==typeof e.expiresIn?Number(e.expiresIn):function(e){const t=Hy(e);return my(t,"internal-error"),my("undefined"!==typeof t.exp,"internal-error"),my("undefined"!==typeof t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return my(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:i,expiresIn:r}=await async function(e,t){const n=await Dy(e,{},(async()=>{const n=Xv({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:r}=e.config,o=Ay(e,i,"/v1/token","key=".concat(r)),s=await e._getAdditionalHeaders();return s["Content-Type"]="application/x-www-form-urlencoded",xy.fetch()(o,{method:"POST",headers:s,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,i,Number(r))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:i,expirationTime:r}=t,o=new Wy;return n&&(my("string"===typeof n,"internal-error",{appName:e}),o.refreshToken=n),i&&(my("string"===typeof i,"internal-error",{appName:e}),o.accessToken=i),r&&(my("number"===typeof r,"internal-error",{appName:e}),o.expirationTime=r),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Wy,this.toJSON())}_performRefresh(){return gy("not implemented")}}function Gy(e,t){my("string"===typeof e||"undefined"===typeof e,"internal-error",{appName:t})}class Ky{constructor(e){var{uid:t,auth:n,stsTokenManager:i}=e,r=oy(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new zy(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new jy(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await Uy(this,this.stsTokenManager.getToken(this.auth,e));return my(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=t_(e),i=await n.getIdToken(t),r=Hy(i);my(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const o="object"===typeof r.firebase?r.firebase:void 0,s=null===o||void 0===o?void 0:o.sign_in_provider;return{claims:r,token:i,authTime:By(Vy(r.auth_time)),issuedAtTime:By(Vy(r.iat)),expirationTime:By(Vy(r.exp)),signInProvider:s||null,signInSecondFactor:(null===o||void 0===o?void 0:o.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=t_(e);await $y(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(my(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map((e=>Object.assign({},e))),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new Ky(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){my(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await $y(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await Uy(this,async function(e,t){return ky(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((e=>Object.assign({},e))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var n,i,r,o,s,a,l,c;const u=null!==(n=t.displayName)&&void 0!==n?n:void 0,h=null!==(i=t.email)&&void 0!==i?i:void 0,d=null!==(r=t.phoneNumber)&&void 0!==r?r:void 0,p=null!==(o=t.photoURL)&&void 0!==o?o:void 0,f=null!==(s=t.tenantId)&&void 0!==s?s:void 0,m=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,g=null!==(l=t.createdAt)&&void 0!==l?l:void 0,v=null!==(c=t.lastLoginAt)&&void 0!==c?c:void 0,{uid:_,emailVerified:y,isAnonymous:b,providerData:w,stsTokenManager:C}=t;my(_&&C,e,"internal-error");const S=Wy.fromJSON(this.name,C);my("string"===typeof _,e,"internal-error"),Gy(u,e.name),Gy(h,e.name),my("boolean"===typeof y,e,"internal-error"),my("boolean"===typeof b,e,"internal-error"),Gy(d,e.name),Gy(p,e.name),Gy(f,e.name),Gy(m,e.name),Gy(g,e.name),Gy(v,e.name);const x=new Ky({uid:_,auth:e,email:h,emailVerified:y,displayName:u,isAnonymous:b,photoURL:p,phoneNumber:d,tenantId:f,stsTokenManager:S,createdAt:g,lastLoginAt:v});return w&&Array.isArray(w)&&(x.providerData=w.map((e=>Object.assign({},e)))),m&&(x._redirectEventId=m),x}static async _fromIdTokenResponse(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=new Wy;i.updateFromServerResponse(t);const r=new Ky({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:n});return await $y(r),r}}const qy=new Map;function Qy(e){vy(e instanceof Function,"Expected a class definition");let t=qy.get(e);return t?(vy(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,qy.set(e,t),t)}class Xy{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Xy.type="NONE";const Yy=Xy;function Jy(e,t,n){return"firebase".concat(":",e,":").concat(t,":").concat(n)}class Zy{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:i,name:r}=this.auth;this.fullUserKey=Jy(this.userKey,i.apiKey,r),this.fullPersistenceKey=Jy("persistence",i.apiKey,r),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?Ky._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"authUser";if(!t.length)return new Zy(Qy(Yy),e,n);const i=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let r=i[0]||Qy(Yy);const o=Jy(n,e.config.apiKey,e.name);let s=null;for(const c of t)try{const t=await c._get(o);if(t){const n=Ky._fromJSON(e,t);c!==r&&(s=n),r=c;break}}catch(l){}const a=i.filter((e=>e._shouldAllowMigration));return r._shouldAllowMigration&&a.length?(r=a[0],s&&await r._set(o,s.toJSON()),await Promise.all(t.map((async e=>{if(e!==r)try{await e._remove(o)}catch(l){}}))),new Zy(r,e,n)):new Zy(r,e,n)}}function eb(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(rb(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(tb(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(sb(t))return"Blackberry";if(ab(t))return"Webos";if(nb(t))return"Safari";if((t.includes("chrome/")||ib(t))&&!t.includes("edge/"))return"Chrome";if(ob(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null===n||void 0===n?void 0:n.length))return n[1]}return"Other"}function tb(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v();return/firefox\//i.test(e)}function nb(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v()).toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ib(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v();return/crios\//i.test(e)}function rb(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v();return/iemobile/i.test(e)}function ob(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v();return/android/i.test(e)}function sb(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v();return/blackberry/i.test(e)}function ab(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v();return/webos/i.test(e)}function lb(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v();return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function cb(){return function(){const e=$v();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function ub(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v();return lb(e)||ob(e)||ab(e)||sb(e)||/windows phone/i.test(e)||rb(e)}function hb(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case"Browser":t=eb($v());break;case"Worker":t="".concat(eb($v()),"-").concat(e);break;default:t=e}const i=n.length?n.join(","):"FirebaseCore-web";return"".concat(t,"/","JsCore","/").concat(j_,"/").concat(i)}class db{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise(((n,i)=>{try{n(e(t))}catch(r){i(r)}}));n.onAbort=t,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(n){t.reverse();for(const e of t)try{e()}catch(rg){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===n||void 0===n?void 0:n.message})}}}class pb{constructor(e){var t,n,i,r;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=o.minPasswordLength)&&void 0!==t?t:6,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),void 0!==o.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),void 0!==o.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),void 0!==o.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),void 0!==o.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(r=e.forceUpgradeOnSignin)&&void 0!==r&&r,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,i,r,o,s;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null===(t=a.meetsMinPasswordLength)||void 0===t||t),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(i=a.containsLowercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(r=a.containsUppercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(o=a.containsNumericCharacter)||void 0===o||o),a.isValid&&(a.isValid=null===(s=a.containsNonAlphanumericCharacter)||void 0===s||s),a}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let i=0;i="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,i,r){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=r))}}class fb{constructor(e,t,n,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new gb(this),this.idTokenSubscription=new gb(this),this.beforeStateQueue=new db(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ly,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=Qy(t)),this._initializationPromise=this.queue((async()=>{var n,i;if(!this._deleted&&(this.persistenceManager=await Zy.create(this,e),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(r){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(i=this.currentUser)||void 0===i?void 0:i.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUser(e){var t;const n=await this.assertedPersistence.getCurrentUser();let i=n,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,o=null===i||void 0===i?void 0:i._redirectEventId,s=await this.tryRedirectSignIn(e);n&&n!==o||!(null===s||void 0===s?void 0:s.user)||(i=s.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(o)))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return my(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(n){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await $y(e)}catch(t){if((null===t||void 0===t?void 0:t.code)!=="auth/".concat("network-request-failed"))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"===typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?t_(e):null;return t&&my(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this._deleted)return e&&my(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue((async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Qy(e))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e){return ky(e,"GET","/v2/passwordPolicy",Ty(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}(this),t=new pb(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new Gv("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise(((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged((()=>{n(),e()}),t)}}))}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return ky(e,"POST","/v2/accounts:revokeToken",Ty(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&Qy(e)||this._popupRedirectResolver;my(t,this,"argument-error"),this.redirectPersistenceManager=await Zy.create(this,[Qy(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(e)))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return"".concat(this.config.authDomain,":").concat(this.config.apiKey,":").concat(this.name)}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,i){if(this._deleted)return()=>{};const r="function"===typeof t?t:t.next.bind(t);let o=!1;const s=this._isInitialized?Promise.resolve():this._initializationPromise;if(my(s,this,"internal-error"),s.then((()=>{o||r(this.currentUser)})),"function"===typeof t){const r=e.addObserver(t,n,i);return()=>{o=!0,r()}}{const n=e.addObserver(t);return()=>{o=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return my(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=hb(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null===t||void 0===t?void 0:t.error)&&function(e){if(cy.logLevel<=a_.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;ithis.observer=e))}get next(){return my(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function vb(e){return new Promise(((t,n)=>{const i=document.createElement("script");i.setAttribute("src",e),i.onload=t,i.onerror=e=>{const t=dy("internal-error");t.customData=e,n(t)},i.type="text/javascript",i.charset="UTF-8",function(){var e,t;return null!==(t=null===(e=document.getElementsByTagName("head"))||void 0===e?void 0:e[0])&&void 0!==t?t:document}().appendChild(i)}))}function _b(e){return"__".concat(e).concat(Math.floor(1e6*Math.random()))}class yb{constructor(e){this.type="recaptcha-enterprise",this.auth=mb(e)}async verify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"verify",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function n(t,n,i){const r=window.grecaptcha;My(r)?r.enterprise.ready((()=>{r.enterprise.execute(t,{action:e}).then((e=>{n(e)})).catch((()=>{n("NO_RECAPTCHA")}))})):i(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((e,i)=>{(async function(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise((async(t,n)=>{Fy(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((i=>{if(void 0!==i.recaptchaKey){const n=new Ly(i);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((e=>{n(e)}))}))})(this.auth).then((r=>{if(!t&&My(window.grecaptcha))n(r,e,i);else{if("undefined"===typeof window)return void i(new Error("RecaptchaVerifier is only supported in browser"));vb("https://www.google.com/recaptcha/enterprise.js?render="+r).then((()=>{n(r,e,i)})).catch((e=>{i(e)}))}})).catch((e=>{i(e)}))}))}}async function bb(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=new yb(e);let o;try{o=await r.verify(n)}catch(D){o=await r.verify(n,!0)}const s=Object.assign({},t);return i?Object.assign(s,{captchaResp:o}):Object.assign(s,{captchaResponse:o}),Object.assign(s,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(s,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),s}async function wb(e,t,n,i){var r;if(null===(r=e._getRecaptchaConfig())||void 0===r?void 0:r.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await bb(e,t,n,"getOobCode"===n);return i(e,r)}return i(e,t).catch((async r=>{if(r.code==="auth/".concat("missing-recaptcha-token")){console.log("".concat(n," is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow."));const r=await bb(e,t,n,"getOobCode"===n);return i(e,r)}return Promise.reject(r)}))}function Cb(e,t,n){const i=mb(e);my(i._canInitEmulator,i,"emulator-config-failed"),my(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");const r=!!(null===n||void 0===n?void 0:n.disableWarnings),o=Sb(t),{host:s,port:a}=function(e){const t=Sb(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const e=r[1];return{host:e,port:xb(i.substr(e.length+1))}}{const[e,t]=i.split(":");return{host:e,port:xb(t)}}}(t),l=null===a?"":":".concat(a);i.config.emulator={url:"".concat(o,"//").concat(s).concat(l,"/")},i.settings.appVerificationDisabledForTesting=!0,i.emulatorConfig=Object.freeze({host:s,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:r})}),r||function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!==typeof console&&"function"===typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!==typeof window&&"undefined"!==typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function Sb(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function xb(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class Eb{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return gy("not implemented")}_getIdTokenResponse(e){return gy("not implemented")}_linkToIdToken(e,t){return gy("not implemented")}_getReauthenticationResolver(e){return gy("not implemented")}}async function Ib(e,t){return ky(e,"POST","/v1/accounts:signUp",t)}async function Tb(e,t){return Oy(e,"POST","/v1/accounts:signInWithPassword",Ty(e,t))}async function kb(e,t){return ky(e,"POST","/v1/accounts:sendOobCode",Ty(e,t))}async function Db(e,t){return kb(e,t)}class Ob extends Eb{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super("password",n),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new Ob(e,t,"password")}static _fromEmailAndCode(e,t){return new Ob(e,t,"emailLink",arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"===typeof e?JSON.parse(e):e;if((null===t||void 0===t?void 0:t.email)&&(null===t||void 0===t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return wb(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Tb);case"emailLink":return async function(e,t){return Oy(e,"POST","/v1/accounts:signInWithEmailLink",Ty(e,t))}(e,{email:this._email,oobCode:this._password});default:hy(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return wb(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Ib);case"emailLink":return async function(e,t){return Oy(e,"POST","/v1/accounts:signInWithEmailLink",Ty(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:hy(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Ab(e,t){return Oy(e,"POST","/v1/accounts:signInWithIdp",Ty(e,t))}class Rb extends Eb{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Rb(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):hy("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"===typeof e?JSON.parse(e):e,{providerId:n,signInMethod:i}=t,r=oy(t,["providerId","signInMethod"]);if(!n||!i)return null;const o=new Rb(n,i);return o.idToken=r.idToken||void 0,o.accessToken=r.accessToken||void 0,o.secret=r.secret,o.nonce=r.nonce,o.pendingToken=r.pendingToken||null,o}_getIdTokenResponse(e){return Ab(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,Ab(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Ab(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=Xv(t)}return e}}const Pb={USER_NOT_FOUND:"user-not-found"};class Nb extends Eb{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new Nb({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new Nb({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return Oy(e,"POST","/v1/accounts:signInWithPhoneNumber",Ty(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const n=await Oy(e,"POST","/v1/accounts:signInWithPhoneNumber",Ty(e,t));if(n.temporaryProof)throw Ny(e,"account-exists-with-different-credential",n);return n}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return Oy(e,"POST","/v1/accounts:signInWithPhoneNumber",Ty(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),Pb)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:i}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:i}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"===typeof e&&(e=JSON.parse(e));const{verificationId:t,verificationCode:n,phoneNumber:i,temporaryProof:r}=e;return n||t||i||r?new Nb({verificationId:t,verificationCode:n,phoneNumber:i,temporaryProof:r}):null}}class Mb{constructor(e){var t,n,i,r,o,s;const a=Yv(Jv(e)),l=null!==(t=a.apiKey)&&void 0!==t?t:null,c=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(i=a.mode)&&void 0!==i?i:null);my(l&&c&&u,"argument-error"),this.apiKey=l,this.operation=u,this.code=c,this.continueUrl=null!==(r=a.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(o=a.languageCode)&&void 0!==o?o:null,this.tenantId=null!==(s=a.tenantId)&&void 0!==s?s:null}static parseLink(e){const t=function(e){const t=Yv(Jv(e)).link,n=t?Yv(Jv(t)).deep_link_id:null,i=Yv(Jv(e)).deep_link_id;return(i?Yv(Jv(i)).link:null)||i||n||t||e}(e);try{return new Mb(t)}catch(n){return null}}}class Lb{constructor(){this.providerId=Lb.PROVIDER_ID}static credential(e,t){return Ob._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=Mb.parseLink(t);return my(n,"argument-error"),Ob._fromEmailAndCode(e,n.code,n.tenantId)}}Lb.PROVIDER_ID="password",Lb.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Lb.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Fb{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class Bb extends Fb{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Vb extends Bb{constructor(){super("facebook.com")}static credential(e){return Rb._fromParams({providerId:Vb.PROVIDER_ID,signInMethod:Vb.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Vb.credentialFromTaggedObject(e)}static credentialFromError(e){return Vb.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Vb.credential(t.oauthAccessToken)}catch(n){return null}}}Vb.FACEBOOK_SIGN_IN_METHOD="facebook.com",Vb.PROVIDER_ID="facebook.com";class Hb extends Bb{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Rb._fromParams({providerId:Hb.PROVIDER_ID,signInMethod:Hb.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return Hb.credentialFromTaggedObject(e)}static credentialFromError(e){return Hb.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{oauthIdToken:n,oauthAccessToken:i}=t;if(!n&&!i)return null;try{return Hb.credential(n,i)}catch(r){return null}}}Hb.GOOGLE_SIGN_IN_METHOD="google.com",Hb.PROVIDER_ID="google.com";class Ub extends Bb{constructor(){super("github.com")}static credential(e){return Rb._fromParams({providerId:Ub.PROVIDER_ID,signInMethod:Ub.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Ub.credentialFromTaggedObject(e)}static credentialFromError(e){return Ub.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Ub.credential(t.oauthAccessToken)}catch(n){return null}}}Ub.GITHUB_SIGN_IN_METHOD="github.com",Ub.PROVIDER_ID="github.com";class zb extends Bb{constructor(){super("twitter.com")}static credential(e,t){return Rb._fromParams({providerId:zb.PROVIDER_ID,signInMethod:zb.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return zb.credentialFromTaggedObject(e)}static credentialFromError(e){return zb.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:i}=t;if(!n||!i)return null;try{return zb.credential(n,i)}catch(r){return null}}}async function jb(e,t){return Oy(e,"POST","/v1/accounts:signUp",Ty(e,t))}zb.TWITTER_SIGN_IN_METHOD="twitter.com",zb.PROVIDER_ID="twitter.com";class $b{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=await Ky._fromIdTokenResponse(e,n,i),o=Wb(n);return new $b({user:r,providerId:o,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const i=Wb(n);return new $b({user:e,providerId:i,_tokenResponse:n,operationType:t})}}function Wb(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class Gb extends Wv{constructor(e,t,n,i){var r;super(t.code,t.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,Gb.prototype),this.customData={appName:e.name,tenantId:null!==(r=e.tenantId)&&void 0!==r?r:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,i){return new Gb(e,t,n,i)}}function Kb(e,t,n,i){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((n=>{if(n.code==="auth/".concat("multi-factor-auth-required"))throw Gb._fromErrorAndOperation(e,n,t,i);throw n}))}async function qb(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=await Uy(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return $b._forOperation(e,"link",i)}async function Qb(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{auth:i}=e,r="reauthenticate";try{const o=await Uy(e,Kb(i,r,t,e),n);my(o.idToken,i,"internal-error");const s=Hy(o.idToken);my(s,i,"internal-error");const{sub:a}=s;return my(e.uid===a,i,"user-mismatch"),$b._forOperation(e,r,o)}catch(o){throw(null===o||void 0===o?void 0:o.code)==="auth/".concat("user-not-found")&&hy(i,"user-mismatch"),o}}async function Xb(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i="signIn",r=await Kb(e,i,t),o=await $b._fromIdTokenResponse(e,i,r);return n||await e._updateCurrentUser(o.user),o}async function Yb(e,t){return Xb(mb(e),t)}function Jb(e,t,n){var i;my((null===(i=n.url)||void 0===i?void 0:i.length)>0,e,"invalid-continue-uri"),my("undefined"===typeof n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(my(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(my(n.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}async function Zb(e){const t=mb(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function ew(e,t){const n=t_(e),i={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()};t&&Jb(n.auth,i,t);const{email:r}=await async function(e,t){return kb(e,t)}(n.auth,i);r!==e.email&&await e.reload()}async function tw(e,t,n){const{auth:i}=e,r={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(r.email=t),n&&(r.password=n);const o=await Uy(e,async function(e,t){return ky(e,"POST","/v1/accounts:update",t)}(i,r));await e._updateTokensIfNecessary(o,!0)}new WeakMap;const nw="__sak";class iw{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(nw,"1"),this.storage.removeItem(nw),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class rw extends iw{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const e=$v();return nb(e)||lb(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=ub(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),i=this.localCache[t];n!==i&&e(t,i,n)}}onStorageEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e.key)return void this.forAllChangedKeys(((e,t,n)=>{this.notifyListeners(e,n)}));const n=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const i=this.storage.getItem(n);if(e.newValue!==i)null!==e.newValue?this.storage.setItem(n,e.newValue):this.storage.removeItem(n);else if(this.localCache[n]===e.newValue&&!t)return}const i=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},r=this.storage.getItem(n);cb()&&r!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,10):i()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const i of Array.from(n))i(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}rw.type="LOCAL";const ow=rw;class sw extends iw{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}sw.type="SESSION";const aw=sw;class lw{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find((t=>t.isListeningto(e)));if(t)return t;const n=new lw(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:i,data:r}=t.data,o=this.handlersMap[i];if(!(null===o||void 0===o?void 0:o.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const s=Array.from(o).map((async e=>e(t.origin,r))),a=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}})))}(s);t.ports[0].postMessage({status:"done",eventId:n,eventType:i,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function cw(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n="";for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:50;const i="undefined"!==typeof MessageChannel?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let r,o;return new Promise(((s,a)=>{const l=cw("",20);i.port1.start();const c=setTimeout((()=>{a(new Error("unsupported_event"))}),n);o={messageChannel:i,onMessage(e){const t=e;if(t.data.eventId===l)switch(t.data.status){case"ack":clearTimeout(c),r=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(r),s(t.data.response);break;default:clearTimeout(c),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[i.port2])})).finally((()=>{o&&this.removeMessageHandler(o)}))}}function hw(){return window}function dw(){return"undefined"!==typeof hw().WorkerGlobalScope&&"function"===typeof hw().importScripts}const pw="firebaseLocalStorageDb",fw="firebaseLocalStorage",mw="fbase_key";class gw{constructor(e){this.request=e}toPromise(){return new Promise(((e,t)=>{this.request.addEventListener("success",(()=>{e(this.request.result)})),this.request.addEventListener("error",(()=>{t(this.request.error)}))}))}}function vw(e,t){return e.transaction([fw],t?"readwrite":"readonly").objectStore(fw)}function _w(){const e=indexedDB.open(pw,1);return new Promise(((t,n)=>{e.addEventListener("error",(()=>{n(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(fw,{keyPath:mw})}catch(i){n(i)}})),e.addEventListener("success",(async()=>{const n=e.result;n.objectStoreNames.contains(fw)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(pw);return new gw(e).toPromise()}(),t(await _w()))}))}))}async function yw(e,t,n){const i=vw(e,!0).put({[mw]:t,value:n});return new gw(i).toPromise()}function bw(e,t){const n=vw(e,!0).delete(t);return new gw(n).toPromise()}class ww{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await _w()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(n){if(t++>3)throw n;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return dw()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=lw._getInstance(dw()?self:null),this.receiver._subscribe("keyChanged",(async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)}))),this.receiver._subscribe("ping",(async(e,t)=>["keyChanged"]))}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new uw(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&function(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await _w();return await yw(e,nw,"1"),await bw(e,nw),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite((async()=>(await this._withRetries((n=>yw(n,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async _get(e){const t=await this._withRetries((t=>async function(e,t){const n=vw(e,!1).get(t),i=await new gw(n).toPromise();return void 0===i?null:i.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>bw(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=vw(e,!1).getAll();return new gw(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:i,value:r}of e)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),t.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!n.has(i)&&(this.notifyListeners(i,null),t.push(i));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const i of Array.from(n))i(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}ww.type="LOCAL";const Cw=ww;_b("rcb"),new Cy(3e4,6e4);const Sw="recaptcha";async function xw(e,t,n){var i;const r=await n.verify();try{let o;if(my("string"===typeof r,e,"argument-error"),my(n.type===Sw,e,"argument-error"),o="string"===typeof t?{phoneNumber:t}:t,"session"in o){const t=o.session;if("phoneNumber"in o){my("enroll"===t.type,e,"internal-error");const n=await function(e,t){return ky(e,"POST","/v2/accounts/mfaEnrollment:start",Ty(e,t))}(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:o.phoneNumber,recaptchaToken:r}});return n.phoneSessionInfo.sessionInfo}{my("signin"===t.type,e,"internal-error");const n=(null===(i=o.multiFactorHint)||void 0===i?void 0:i.uid)||o.multiFactorUid;my(n,e,"missing-multi-factor-info");const s=await function(e,t){return ky(e,"POST","/v2/accounts/mfaSignIn:start",Ty(e,t))}(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:r}});return s.phoneResponseInfo.sessionInfo}}{const{sessionInfo:t}=await async function(e,t){return ky(e,"POST","/v1/accounts:sendVerificationCode",Ty(e,t))}(e,{phoneNumber:o.phoneNumber,recaptchaToken:r});return t}}finally{n._reset()}}class Ew{constructor(e){this.providerId=Ew.PROVIDER_ID,this.auth=mb(e)}verifyPhoneNumber(e,t){return xw(this.auth,e,t_(t))}static credential(e,t){return Nb._fromVerification(e,t)}static credentialFromResult(e){const t=e;return Ew.credentialFromTaggedObject(t)}static credentialFromError(e){return Ew.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{phoneNumber:n,temporaryProof:i}=t;return n&&i?Nb._fromTokenResponse(n,i):null}}function Iw(e,t){return t?Qy(t):(my(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}Ew.PROVIDER_ID="phone",Ew.PHONE_SIGN_IN_METHOD="phone";class Tw extends Eb{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Ab(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Ab(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Ab(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function kw(e){return Xb(e.auth,new Tw(e),e.bypassAuthState)}function Dw(e){const{auth:t,user:n}=e;return my(n,t,"internal-error"),Qb(n,new Tw(e),e.bypassAuthState)}async function Ow(e){const{auth:t,user:n}=e;return my(n,t,"internal-error"),qb(n,new Tw(e),e.bypassAuthState)}class Aw{constructor(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.auth=e,this.resolver=n,this.user=i,this.bypassAuthState=r,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(n){this.reject(n)}}))}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:i,tenantId:r,error:o,type:s}=e;if(o)return void this.reject(o);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:r||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(s)(a))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return kw;case"linkViaPopup":case"linkViaRedirect":return Ow;case"reauthViaPopup":case"reauthViaRedirect":return Dw;default:hy(this.auth,"internal-error")}}resolve(e){vy(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){vy(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const Rw=new Cy(2e3,1e4);class Pw extends Aw{constructor(e,t,n,i,r){super(e,t,i,r),this.provider=n,this.authWindow=null,this.pollId=null,Pw.currentPopupAction&&Pw.currentPopupAction.cancel(),Pw.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return my(e,this.auth,"internal-error"),e}async onExecution(){vy(1===this.filter.length,"Popup operations only handle one event");const e=cw();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch((e=>{this.reject(e)})),this.resolver._isIframeWebStorageSupported(this.auth,(e=>{e||this.reject(dy(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(dy(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Pw.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(dy(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(e,Rw.get())};e()}}Pw.currentPopupAction=null;const Nw="pendingRedirect",Mw=new Map;class Lw extends Aw{constructor(e,t){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,arguments.length>2&&void 0!==arguments[2]&&arguments[2]),this.eventId=null}async execute(){let e=Mw.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=Vw(t),i=Bw(e);if(!await i._isAvailable())return!1;const r="true"===await i._get(n);return await i._remove(n),r}(this.resolver,this.auth),n=t?await super.execute():null;e=()=>Promise.resolve(n)}catch(t){e=()=>Promise.reject(t)}Mw.set(this.auth._key(),e)}return this.bypassAuthState||Mw.set(this.auth._key(),(()=>Promise.resolve(null))),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Fw(e,t){Mw.set(e._key(),t)}function Bw(e){return Qy(e._redirectPersistence)}function Vw(e){return Jy(Nw,e.config.apiKey,e.name)}async function Hw(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=mb(e),r=Iw(i,t),o=new Lw(i,r,n),s=await o.execute();return s&&!n&&(delete s.user._redirectEventId,await i._persistUserIfCurrent(s.user),await i._setRedirectUser(null,t)),s}class Uw{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return jw(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!jw(e)){const i=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(dy(this.auth,i))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(zw(e))}saveEventToCache(e){this.cachedEventUids.add(zw(e)),this.lastProcessedEventTime=Date.now()}}function zw(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function jw(e){let{type:t,error:n}=e;return"unknown"===t&&(null===n||void 0===n?void 0:n.code)==="auth/".concat("no-auth-event")}const $w=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ww=/^https?/;async function Gw(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e){return ky(e,"GET","/v1/projects",arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}(e);for(const i of t)try{if(Kw(i))return}catch(n){}hy(e,"unauthorized-domain")}function Kw(e){const t=_y(),{protocol:n,hostname:i}=new URL(t);if(e.startsWith("chrome-extension://")){const r=new URL(e);return""===r.hostname&&""===i?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===i}if(!Ww.test(n))return!1;if($w.test(e))return i===e;const r=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}const qw=new Cy(3e4,6e4);function Qw(){const e=hw().___jsl;if(null===e||void 0===e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let n=0;n{var i,r,o;function s(){Qw(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Qw(),n(dy(e,"network-request-failed"))},timeout:qw.get()})}if(null===(r=null===(i=hw().gapi)||void 0===i?void 0:i.iframes)||void 0===r?void 0:r.Iframe)t(gapi.iframes.getContext());else{if(!(null===(o=hw().gapi)||void 0===o?void 0:o.load)){const t=_b("iframefcb");return hw()[t]=()=>{gapi.load?s():n(dy(e,"network-request-failed"))},vb("https://apis.google.com/js/api.js?onload=".concat(t)).catch((e=>n(e)))}s()}})).catch((e=>{throw Xw=null,e}))}(e),Xw}const Jw=new Cy(5e3,15e3),Zw="__/auth/iframe",eC="emulator/auth/iframe",tC={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},nC=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function iC(e){const t=e.config;my(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Sy(t,eC):"https://".concat(e.config.authDomain,"/").concat(Zw),i={apiKey:t.apiKey,appName:e.name,v:j_},r=nC.get(e.config.apiHost);r&&(i.eid=r);const o=e._getFrameworks();return o.length&&(i.fw=o.join(",")),"".concat(n,"?").concat(Xv(i).slice(1))}const rC={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class oC{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function sC(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:600;const o=Math.max((window.screen.availHeight-r)/2,0).toString(),s=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const l=Object.assign(Object.assign({},rC),{width:i.toString(),height:r.toString(),top:o,left:s}),c=$v().toLowerCase();n&&(a=ib(c)?"_blank":n),tb(c)&&(t=t||"http://localhost",l.scrollbars="yes");const u=Object.entries(l).reduce(((e,t)=>{let[n,i]=t;return"".concat(e).concat(n,"=").concat(i,",")}),"");if(function(){var e;return lb(arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v())&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(c)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}(t||"",a),new oC(null);const h=window.open(t||"",a,u);my(h,e,"popup-blocked");try{h.focus()}catch(d){}return new oC(h)}const aC="__/auth/handler",lC="emulator/auth/handler",cC=encodeURIComponent("fac");async function uC(e,t,n,i,r,o){my(e.config.authDomain,e,"auth-domain-config-required"),my(e.config.apiKey,e,"invalid-api-key");const s={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:i,v:j_,eventId:r};if(t instanceof Fb){t.setDefaultLanguage(e.languageCode),s.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(s.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(o||{}))s[e]=t}if(t instanceof Bb){const e=t.getScopes().filter((e=>""!==e));e.length>0&&(s.scopes=e.join(","))}e.tenantId&&(s.tid=e.tenantId);const a=s;for(const u of Object.keys(a))void 0===a[u]&&delete a[u];const l=await e._getAppCheckToken(),c=l?"#".concat(cC,"=").concat(encodeURIComponent(l)):"";return"".concat(function(e){let{config:t}=e;if(!t.emulator)return"https://".concat(t.authDomain,"/").concat(aC);return Sy(t,lC)}(e),"?").concat(Xv(a).slice(1)).concat(c)}const hC="webStorageSupport";const dC=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=aw,this._completeRedirectFn=Hw,this._overrideRedirectResult=Fw}async _openPopup(e,t,n,i){var r;vy(null===(r=this.eventManagers[e._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return sC(e,await uC(e,t,n,_y(),i),cw())}async _openRedirect(e,t,n,i){await this._originValidation(e);return function(e){hw().location.href=e}(await uC(e,t,n,_y(),i)),new Promise((()=>{}))}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(vy(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch((()=>{delete this.eventManagers[t]})),n}async initAndGetManager(e){const t=await async function(e){const t=await Yw(e),n=hw().gapi;return my(n,e,"internal-error"),t.open({where:document.body,url:iC(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:tC,dontclear:!0},(t=>new Promise((async(n,i)=>{await t.restyle({setHideOnLeave:!1});const r=dy(e,"network-request-failed"),o=hw().setTimeout((()=>{i(r)}),Jw.get());function s(){hw().clearTimeout(o),n(t)}t.ping(s).then(s,(()=>{i(r)}))}))))}(e),n=new Uw(e);return t.register("authEvent",(t=>{my(null===t||void 0===t?void 0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(hC,{type:hC},(n=>{var i;const r=null===(i=null===n||void 0===n?void 0:n[0])||void 0===i?void 0:i[hC];void 0!==r&&t(!!r),hy(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Gw(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return ub()||nb()||lb()}};var pC="@firebase/auth",fC="1.5.1";class mC{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged((t=>{e((null===t||void 0===t?void 0:t.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){my(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const gC=Uv("authIdTokenMaxAge")||300;let vC=null;var _C;_C="Browser",V_(new n_("auth",((e,t)=>{let{options:n}=t;const i=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:s,authDomain:a}=i.options;my(s&&!s.includes(":"),"invalid-api-key",{appName:i.name});const l={apiKey:s,authDomain:a,clientPlatform:_C,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:hb(_C)},c=new fb(i,r,o,l);return function(e,t){const n=(null===t||void 0===t?void 0:t.persistence)||[],i=(Array.isArray(n)?n:[n]).map(Qy);(null===t||void 0===t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(i,null===t||void 0===t?void 0:t.popupRedirectResolver)}(c,n),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,n)=>{e.getProvider("auth-internal").initialize()}))),V_(new n_("auth-internal",(e=>(e=>new mC(e))(mb(e.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),G_(pC,fC,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(_C)),G_(pC,fC,"esm2017");G_("firebase","10.7.1","app");var yC,bC="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{},wC={},CC=CC||{},SC=bC||self;function xC(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function EC(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var IC="closure_uid_"+(1e9*Math.random()>>>0),TC=0;function kC(e,t,n){return e.call.apply(e.bind,arguments)}function DC(e,t,n){if(!e)throw Error();if(2{};SC.addEventListener("test",e,t),SC.removeEventListener("test",e,t)}catch(n){}return e}();function VC(e){return/^[\s\xa0]*$/.test(e)}function HC(){var e=SC.navigator;return e&&(e=e.userAgent)?e:""}function UC(e){return-1!=HC().indexOf(e)}function zC(e){return zC[" "](e),e}zC[" "]=function(){};var jC,$C,WC=UC("Opera"),GC=UC("Trident")||UC("MSIE"),KC=UC("Edge"),qC=KC||GC,QC=UC("Gecko")&&!(-1!=HC().toLowerCase().indexOf("webkit")&&!UC("Edge"))&&!(UC("Trident")||UC("MSIE"))&&!UC("Edge"),XC=-1!=HC().toLowerCase().indexOf("webkit")&&!UC("Edge");function YC(){var e=SC.document;return e?e.documentMode:void 0}e:{var JC="",ZC=function(){var e=HC();return QC?/rv:([^\);]+)(\)|;)/.exec(e):KC?/Edge\/([\d\.]+)/.exec(e):GC?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):XC?/WebKit\/(\S+)/.exec(e):WC?/(?:Version)[ \/]?(\S+)/.exec(e):void 0}();if(ZC&&(JC=ZC?ZC[1]:""),GC){var eS=YC();if(null!=eS&&eS>parseFloat(JC)){jC=String(eS);break e}}jC=JC}if(SC.document&&GC){var tS=YC();$C=tS||(parseInt(jC,10)||void 0)}else $C=void 0;var nS=$C;function iS(e,t){if(FC.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(QC){e:{try{zC(t.nodeName);var r=!0;break e}catch(Qm){}r=!1}r||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"===typeof e.pointerType?e.pointerType:rS[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&iS.$.h.call(this)}}RC(iS,FC);var rS={2:"touch",3:"pen",4:"mouse"};iS.prototype.h=function(){iS.$.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var oS="closure_listenable_"+(1e6*Math.random()|0),sS=0;function aS(e,t,n,i,r){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!i,this.la=r,this.key=++sS,this.fa=this.ia=!1}function lS(e){e.fa=!0,e.listener=null,e.proxy=null,e.src=null,e.la=null}function cS(e,t,n){for(const i in e)t.call(n,e[i],i,e)}function uS(e){const t={};for(const n in e)t[n]=e[n];return t}const hS="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function dS(e,t){let n,i;for(let r=1;r>>0);function TS(e){return"function"===typeof e?e:(e[IS]||(e[IS]=function(t){return e.handleEvent(t)}),e[IS])}function kS(){PC.call(this),this.i=new pS(this),this.S=this,this.J=null}function DS(e,t){var n,i=e.J;if(i)for(n=[];i;i=i.J)n.push(i);if(e=e.S,i=t.type||t,"string"===typeof t)t=new FC(t,e);else if(t instanceof FC)t.target=t.target||e;else{var r=t;dS(t=new FC(i,e),r)}if(r=!0,n)for(var o=n.length-1;0<=o;o--){var s=t.g=n[o];r=OS(s,i,!0,t)&&r}if(r=OS(s=t.g=e,i,!0,t)&&r,r=OS(s,i,!1,t)&&r,n)for(o=0;onew NS),(e=>e.reset()));class NS{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}function MS(e){var t=1;e=e.split(":");const n=[];for(;0{throw e}),0)}let FS,BS=!1,VS=new class{constructor(){this.h=this.g=null}add(e,t){const n=PS.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},HS=()=>{const e=SC.Promise.resolve(void 0);FS=()=>{e.then(US)}};var US=()=>{for(var e;e=RS();){try{e.h.call(e.g)}catch(n){LS(n)}var t=PS;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}BS=!1};function zS(e,t){kS.call(this),this.h=e||1,this.g=t||SC,this.j=OC(this.qb,this),this.l=Date.now()}function jS(e){e.ga=!1,e.T&&(e.g.clearTimeout(e.T),e.T=null)}function $S(e,t,n){if("function"===typeof e)n&&(e=OC(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=OC(e.handleEvent,e)}return 2147483647{e.g=null,e.i&&(e.i=!1,WS(e))}),e.j);const t=e.h;e.h=null,e.m.apply(null,t)}RC(zS,kS),(yC=zS.prototype).ga=!1,yC.T=null,yC.qb=function(){if(this.ga){var e=Date.now()-this.l;0i.length)){var r=i[1];if(Array.isArray(r)&&!(1>r.length)){var o=r[0];if("noop"!=o&&"stop"!=o&&"close"!=o)for(var s=1;st.length?Cx:(t=t.slice(i,i+n),e.o=i+n,t))}function kx(e){e.Y=Date.now()+e.P,Dx(e,e.P)}function Dx(e,t){if(null!=e.C)throw Error("WatchDog timer not null");e.C=ax(OC(e.lb,e),t)}function Ox(e){e.C&&(SC.clearTimeout(e.C),e.C=null)}function Ax(e){0==e.l.H||e.J||YE(e.l,e)}function Rx(e){Ox(e);var t=e.M;t&&"function"==typeof t.sa&&t.sa(),e.M=null,jS(e.V),XS(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.sa())}function Px(e,t){try{var n=e.l;if(0!=n.H&&(n.g==e||lE(n.i,e)))if(!e.K&&lE(n.i,e)&&3==n.H){try{var i=n.Ja.g.parse(t)}catch(qm){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){e:if(!n.u){if(n.g){if(!(n.g.G+3e3r[2]&&n.G&&0==n.A&&!n.v&&(n.v=ax(OC(n.ib,n),6e3));if(1>=aE(n.i)&&n.oa){try{n.oa()}catch(qm){}n.oa=void 0}}else ZE(n,11)}else if((e.K||n.g==e)&&XE(n),!VC(t))for(r=n.Ja.g.parse(t),t=0;tu)&&(3!=u||qC||this.g&&(this.h.h||this.g.ja()||NE(this.g)))){this.J||4!=u||7==t||ix(),Ox(this);var n=this.g.da();this.ca=n;t:if(Ex(this)){var i=NE(this.g);e="";var r=i.length,o=4==PE(this.g);if(!this.h.i){if("undefined"===typeof TextDecoder){Rx(this),Ax(this);var s="";break t}this.h.i=new SC.TextDecoder}for(t=0;tt)throw Error("Bad port number "+t);e.m=t}else e.m=null}function Hx(e,t,n){t instanceof Yx?(e.i=t,function(e,t){t&&!e.j&&(Jx(e),e.i=null,e.g.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(Zx(this,t),tE(this,n,e))}),e)),e.j=t}(e.i,e.h)):(n||(t=$x(t,Qx)),e.i=new Yx(t,e.h))}function Ux(e,t,n){e.i.set(t,n)}function zx(e){return Ux(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function jx(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function $x(e,t,n){return"string"===typeof e?(e=encodeURI(e).replace(t,Wx),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Wx(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Lx.prototype.toString=function(){var e=[],t=this.j;t&&e.push($x(t,Gx,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push($x(t,Gx,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push($x(n,"/"==n.charAt(0)?qx:Kx,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",$x(n,Xx)),e.join("")};var Gx=/[#\/\?@]/g,Kx=/[#\?:]/g,qx=/[#\?]/g,Qx=/[#\?@]/g,Xx=/#/g;function Yx(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Jx(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n=e.j}function aE(e){return e.h?1:e.g?e.g.size:0}function lE(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function cE(e,t){e.g?e.g.add(t):e.h=t}function uE(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function hE(e){if(null!=e.h)return e.i.concat(e.h.F);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.F);return t}return MC(e.i)}rE.prototype.cancel=function(){if(this.i=hE(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var dE,pE=class{stringify(e){return SC.JSON.stringify(e,void 0)}parse(e){return SC.JSON.parse(e,void 0)}};function fE(){this.g=new pE}function mE(e,t,n){const i=n||"";try{Nx(e,(function(e,n){let r=e;EC(e)&&(r=AS(e)),t.push(i+n+"="+encodeURIComponent(r))}))}catch(r){throw t.push(i+"type="+encodeURIComponent("_badmap")),r}}function gE(e,t,n,i,r){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,r(i)}catch(Qm){}}function vE(e){this.l=e.ec||null,this.j=e.ob||!1}function _E(e,t){kS.call(this),this.F=e,this.u=t,this.m=void 0,this.readyState=yE,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}RC(vE,ux),vE.prototype.g=function(){return new _E(this.l,this.j)},vE.prototype.i=(dE={},function(){return dE}),RC(_E,kS);var yE=0;function bE(e){e.j.read().then(e.Xa.bind(e)).catch(e.ka.bind(e))}function wE(e){e.readyState=4,e.l=null,e.j=null,e.A=null,CE(e)}function CE(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(yC=_E.prototype).open=function(e,t){if(this.readyState!=yE)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,CE(this)},yC.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.F||SC).fetch(new Request(this.B,t)).then(this.$a.bind(this),this.ka.bind(this))},yC.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((()=>{})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,wE(this)),this.readyState=yE},yC.$a=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,CE(this)),this.g&&(this.readyState=3,CE(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if("undefined"!==typeof SC.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;bE(this)}else e.text().then(this.Za.bind(this),this.ka.bind(this))},yC.Xa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?wE(this):CE(this),3==this.readyState&&bE(this)}},yC.Za=function(e){this.g&&(this.response=this.responseText=e,wE(this))},yC.Ya=function(e){this.g&&(this.response=e,wE(this))},yC.ka=function(){this.g&&wE(this)},yC.setRequestHeader=function(e,t){this.v.append(e,t)},yC.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},yC.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(_E.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var SE=SC.JSON.parse;function xE(e){kS.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=EE,this.L=this.M=!1}RC(xE,kS);var EE="",IE=/^https?$/i,TE=["POST","PUT"];function kE(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,DE(e),AE(e)}function DE(e){e.F||(e.F=!0,DS(e,"complete"),DS(e,"error"))}function OE(e){if(e.h&&"undefined"!=typeof CC&&(!e.C[1]||4!=PE(e)||2!=e.da()))if(e.v&&4==PE(e))$S(e.La,0,e);else if(DS(e,"readystatechange"),4==PE(e)){e.h=!1;try{const a=e.da();e:switch(a){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var i;if(i=0===a){var r=String(e.I).match(Mx)[1]||null;!r&&SC.self&&SC.self.location&&(r=SC.self.location.protocol.slice(0,-1)),i=!IE.test(r?r.toLowerCase():"")}n=i}if(n)DS(e,"complete"),DS(e,"success");else{e.m=6;try{var o=2{}:null;e.g=null,e.C=null,t||DS(e,"ready");try{i.onreadystatechange=r}catch(n){}}}function RE(e){e.g&&e.L&&(e.g.ontimeout=null),e.A&&(SC.clearTimeout(e.A),e.A=null)}function PE(e){return e.g?e.g.readyState:0}function NE(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.K){case EE:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(ng){return null}}function ME(e){let t="";return cS(e,(function(e,n){t+=n,t+=":",t+=e,t+="\r\n"})),t}function LE(e,t,n){e:{for(i in n){var i=!1;break e}i=!0}i||(n=ME(n),"string"===typeof e?null!=n&&encodeURIComponent(String(n)):Ux(e,t,n))}function FE(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function BE(e){this.Ga=0,this.j=[],this.l=new YS,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=FE("failFast",!1,e),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=FE("baseRetryDelayMs",5e3,e),this.hb=FE("retryDelaySeedMs",1e4,e),this.eb=FE("forwardChannelMaxRetries",2,e),this.xa=FE("forwardChannelRequestTimeoutMs",2e4,e),this.va=e&&e.xmlHttpFactory||void 0,this.Ha=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.i=new rE(e&&e.concurrentRequestLimit),this.Ja=new fE,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=e&&e.bc||!1,e&&e.Ea&&this.l.Ea(),e&&e.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&e&&e.detectBufferingProxy||!1,this.qa=void 0,e&&e.longPollingTimeout&&0n)t=Math.max(0,r[s].g-100),o=!1;else try{mE(a,e,"req"+n+"_")}catch(og){i&&i(a)}}if(o){i=e.join("&");break e}}}return e=e.j.splice(0,n),t.F=e,i}function GE(e){if(!e.g&&!e.u){e.ba=1;var t=e.Ma;FS||HS(),BS||(FS(),BS=!0),VS.add(t,e),e.A=0}}function KE(e){return!(e.g||e.u||3<=e.A)&&(e.ba++,e.u=ax(OC(e.Ma,e),JE(e,e.A)),e.A++,!0)}function qE(e){null!=e.B&&(SC.clearTimeout(e.B),e.B=null)}function QE(e){e.g=new _x(e,e.l,"rpc",e.ba),null===e.o&&(e.g.I=e.s),e.g.O=0;var t=Fx(e.wa);Ux(t,"RID","rpc"),Ux(t,"SID",e.K),Ux(t,"AID",e.V),Ux(t,"CI",e.G?"0":"1"),!e.G&&e.qa&&Ux(t,"TO",e.qa),Ux(t,"TYPE","xmlhttp"),$E(e,t),e.o&&e.s&&LE(t,e.o,e.s),e.L&&e.g.setTimeout(e.L);var n=e.g;e=e.pa,n.L=1,n.A=zx(Fx(t)),n.u=null,n.S=!0,xx(n,e)}function XE(e){null!=e.v&&(SC.clearTimeout(e.v),e.v=null)}function YE(e,t){var n=null;if(e.g==t){XE(e),qE(e),e.g=null;var i=2}else{if(!lE(e.i,t))return;n=t.F,uE(e.i,t),i=1}if(0!=e.H)if(t.i)if(1==i){n=t.u?t.u.length:0,t=Date.now()-t.G;var r=e.C;DS(i=tx(),new sx(i,n)),zE(e)}else GE(e);else if(3==(r=t.s)||0==r&&0=e.i.j-(e.m?1:0))&&(e.m?(e.j=t.F.concat(e.j),!0):!(1==e.H||2==e.H||e.C>=(e.cb?0:e.eb))&&(e.m=ax(OC(e.Na,e,t),JE(e,e.C)),e.C++,!0))}(e,t)||2==i&&KE(e)))switch(n&&0r;++r)i[r]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(r=0;16>r;++r)i[r]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],r=e.g[2];var o=e.g[3],s=t+(o^n&(r^o))+i[0]+3614090360&4294967295;s=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=(n=(r=(o=(t=n+(s<<7&4294967295|s>>>25))+((s=o+(r^t&(n^r))+i[1]+3905402710&4294967295)<<12&4294967295|s>>>20))+((s=r+(n^o&(t^n))+i[2]+606105819&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^r&(o^t))+i[3]+3250441966&4294967295)<<22&4294967295|s>>>10))+((s=t+(o^n&(r^o))+i[4]+4118548399&4294967295)<<7&4294967295|s>>>25))+((s=o+(r^t&(n^r))+i[5]+1200080426&4294967295)<<12&4294967295|s>>>20))+((s=r+(n^o&(t^n))+i[6]+2821735955&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^r&(o^t))+i[7]+4249261313&4294967295)<<22&4294967295|s>>>10))+((s=t+(o^n&(r^o))+i[8]+1770035416&4294967295)<<7&4294967295|s>>>25))+((s=o+(r^t&(n^r))+i[9]+2336552879&4294967295)<<12&4294967295|s>>>20))+((s=r+(n^o&(t^n))+i[10]+4294925233&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^r&(o^t))+i[11]+2304563134&4294967295)<<22&4294967295|s>>>10))+((s=t+(o^n&(r^o))+i[12]+1804603682&4294967295)<<7&4294967295|s>>>25))+((s=o+(r^t&(n^r))+i[13]+4254626195&4294967295)<<12&4294967295|s>>>20))+((s=r+(n^o&(t^n))+i[14]+2792965006&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^r&(o^t))+i[15]+1236535329&4294967295)<<22&4294967295|s>>>10))+((s=t+(r^o&(n^r))+i[1]+4129170786&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^r&(t^n))+i[6]+3225465664&4294967295)<<9&4294967295|s>>>23))+((s=r+(t^n&(o^t))+i[11]+643717713&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(r^o))+i[0]+3921069994&4294967295)<<20&4294967295|s>>>12))+((s=t+(r^o&(n^r))+i[5]+3593408605&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^r&(t^n))+i[10]+38016083&4294967295)<<9&4294967295|s>>>23))+((s=r+(t^n&(o^t))+i[15]+3634488961&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(r^o))+i[4]+3889429448&4294967295)<<20&4294967295|s>>>12))+((s=t+(r^o&(n^r))+i[9]+568446438&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^r&(t^n))+i[14]+3275163606&4294967295)<<9&4294967295|s>>>23))+((s=r+(t^n&(o^t))+i[3]+4107603335&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(r^o))+i[8]+1163531501&4294967295)<<20&4294967295|s>>>12))+((s=t+(r^o&(n^r))+i[13]+2850285829&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^r&(t^n))+i[2]+4243563512&4294967295)<<9&4294967295|s>>>23))+((s=r+(t^n&(o^t))+i[7]+1735328473&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(r^o))+i[12]+2368359562&4294967295)<<20&4294967295|s>>>12))+((s=t+(n^r^o)+i[5]+4294588738&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^r)+i[8]+2272392833&4294967295)<<11&4294967295|s>>>21))+((s=r+(o^t^n)+i[11]+1839030562&4294967295)<<16&4294967295|s>>>16))+((s=n+(r^o^t)+i[14]+4259657740&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^r^o)+i[1]+2763975236&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^r)+i[4]+1272893353&4294967295)<<11&4294967295|s>>>21))+((s=r+(o^t^n)+i[7]+4139469664&4294967295)<<16&4294967295|s>>>16))+((s=n+(r^o^t)+i[10]+3200236656&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^r^o)+i[13]+681279174&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^r)+i[0]+3936430074&4294967295)<<11&4294967295|s>>>21))+((s=r+(o^t^n)+i[3]+3572445317&4294967295)<<16&4294967295|s>>>16))+((s=n+(r^o^t)+i[6]+76029189&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^r^o)+i[9]+3654602809&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^r)+i[12]+3873151461&4294967295)<<11&4294967295|s>>>21))+((s=r+(o^t^n)+i[15]+530742520&4294967295)<<16&4294967295|s>>>16))+((s=n+(r^o^t)+i[2]+3299628645&4294967295)<<23&4294967295|s>>>9))+((s=t+(r^(n|~o))+i[0]+4096336452&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~r))+i[7]+1126891415&4294967295)<<10&4294967295|s>>>22))+((s=r+(t^(o|~n))+i[14]+2878612391&4294967295)<<15&4294967295|s>>>17))+((s=n+(o^(r|~t))+i[5]+4237533241&4294967295)<<21&4294967295|s>>>11))+((s=t+(r^(n|~o))+i[12]+1700485571&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~r))+i[3]+2399980690&4294967295)<<10&4294967295|s>>>22))+((s=r+(t^(o|~n))+i[10]+4293915773&4294967295)<<15&4294967295|s>>>17))+((s=n+(o^(r|~t))+i[1]+2240044497&4294967295)<<21&4294967295|s>>>11))+((s=t+(r^(n|~o))+i[8]+1873313359&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~r))+i[15]+4264355552&4294967295)<<10&4294967295|s>>>22))+((s=r+(t^(o|~n))+i[6]+2734768916&4294967295)<<15&4294967295|s>>>17))+((s=n+(o^(r|~t))+i[13]+1309151649&4294967295)<<21&4294967295|s>>>11))+((o=(t=n+((s=t+(r^(n|~o))+i[4]+4149444226&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~r))+i[11]+3174756917&4294967295)<<10&4294967295|s>>>22))^((r=o+((s=r+(t^(o|~n))+i[2]+718787259&4294967295)<<15&4294967295|s>>>17))|~t))+i[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(r+(s<<21&4294967295|s>>>11))&4294967295,e.g[2]=e.g[2]+r&4294967295,e.g[3]=e.g[3]+o&4294967295}function hI(e,t){this.h=t;for(var n=[],i=!0,r=e.length-1;0<=r;r--){var o=0|e[r];i&&o==t||(n[r]=o,i=!1)}this.g=n}(yC=xE.prototype).Oa=function(e){this.M=e},yC.ha=function(e,t,n,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+e);t=t?t.toUpperCase():"GET",this.I=e,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():px.g(),this.C=this.u?hx(this.u):hx(px),this.g.onreadystatechange=OC(this.La,this);try{this.G=!0,this.g.open(t,String(e),!0),this.G=!1}catch(Qm){return void kE(this,Qm)}if(e=n||"",n=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var r in i)n.set(r,i[r]);else{if("function"!==typeof i.keys||"function"!==typeof i.get)throw Error("Unknown input type for opt_headers: "+String(i));for(const e of i.keys())n.set(e,i.get(e))}i=Array.from(n.keys()).find((e=>"content-type"==e.toLowerCase())),r=SC.FormData&&e instanceof SC.FormData,!(0<=NC(TE,t))||i||r||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[o,s]of n)this.g.setRequestHeader(o,s);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{RE(this),0=this.S)){var e=2*this.S;this.l.info("BP detection timer enabled: "+e),this.B=ax(OC(this.jb,this),e)}},yC.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,ox(10),HE(this),QE(this))},yC.ib=function(){null!=this.v&&(this.v=null,HE(this),KE(this),ox(19))},yC.pb=function(e){e?(this.l.info("Successfully pinged google.com"),ox(2)):(this.l.info("Failed to ping google.com"),ox(1))},yC.isActive=function(){return!!this.h&&this.h.isActive(this)},(yC=iI.prototype).Ba=function(){},yC.Aa=function(){},yC.za=function(){},yC.ya=function(){},yC.isActive=function(){return!0},yC.Va=function(){},rI.prototype.g=function(e,t){return new oI(e,t)},RC(oI,kS),oI.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var e=this.g,t=this.l,n=this.h||void 0;ox(0),e.Y=t,e.na=n||{},e.G=e.aa,e.I=tI(e,null,e.Y),zE(e)},oI.prototype.close=function(){VE(this.g)},oI.prototype.u=function(e){var t=this.g;if("string"===typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=AS(e),e=n);t.j.push(new iE(t.fb++,e)),3==t.H&&zE(t)},oI.prototype.N=function(){this.g.h=null,delete this.j,VE(this.g),delete this.g,oI.$.N.call(this)},RC(sI,mx),RC(aI,gx),RC(lI,iI),lI.prototype.Ba=function(){DS(this.g,"a")},lI.prototype.Aa=function(e){DS(this.g,new sI(e))},lI.prototype.za=function(e){DS(this.g,new aI)},lI.prototype.ya=function(){DS(this.g,"b")},RC(cI,(function(){this.blockSize=-1})),cI.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0},cI.prototype.j=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,i=this.m,r=this.h,o=0;othis.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;tt;++t)for(var i=0;32>i;i+=8)e[n++]=this.g[t]>>>i&255;return e};var dI={};function pI(e){return-128<=e&&128>e?function(e,t){var n=dI;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,(function(e){return new hI([0|e],0>e?-1:0)})):new hI([0|e],0>e?-1:0)}function fI(e){if(isNaN(e)||!isFinite(e))return gI;if(0>e)return wI(fI(-e));for(var t=[],n=1,i=0;e>=n;i++)t[i]=e/n|0,n*=mI;return new hI(t,0)}var mI=4294967296,gI=pI(0),vI=pI(1),_I=pI(16777216);function yI(e){if(0!=e.h)return!1;for(var t=0;t>>16,e[t]&=65535,t++}function xI(e,t){this.g=e,this.h=t}function EI(e,t){if(yI(t))throw Error("division by zero");if(yI(e))return new xI(gI,gI);if(bI(e))return t=EI(wI(e),t),new xI(wI(t.g),wI(t.h));if(bI(t))return t=EI(e,wI(t)),new xI(wI(t.g),t.h);if(30=i.X(e);)n=II(n),i=II(i);var r=TI(n,1),o=TI(i,1);for(i=TI(i,2),n=TI(n,2);!yI(i);){var s=o.add(i);0>=s.X(e)&&(r=r.add(n),o=s),i=TI(i,1),n=TI(n,1)}return t=CI(e,r.R(t)),new xI(r,t)}for(r=gI;0<=e.X(t);){for(n=Math.max(1,Math.floor(e.ea()/t.ea())),i=48>=(i=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,i-48),s=(o=fI(n)).R(t);bI(s)||0>>31;return new hI(n,e.h)}function TI(e,t){var n=t>>5;t%=32;for(var i=e.g.length-n,r=[],o=0;o>>t|e.D(o+n+1)<<32-t:e.D(o+n);return new hI(r,e.h)}(yC=hI.prototype).ea=function(){if(bI(this))return-wI(this).ea();for(var e=0,t=1,n=0;n(e=e||10)||36>>0).toString(e);if(yI(n=r))return o+i;for(;6>o.length;)o="0"+o;i=o+i}},yC.D=function(e){return 0>e?0:e>>16)+(this.D(r)>>>16)+(e.D(r)>>>16);i=s>>>16,o&=65535,s&=65535,n[r]=s<<16|o}return new hI(n,-2147483648&n[n.length-1]?-1:0)},yC.R=function(e){if(yI(this)||yI(e))return gI;if(bI(this))return bI(e)?wI(this).R(wI(e)):wI(wI(this).R(e));if(bI(e))return wI(this.R(wI(e)));if(0>this.X(_I)&&0>e.X(_I))return fI(this.ea()*e.ea());for(var t=this.g.length+e.g.length,n=[],i=0;i<2*t;i++)n[i]=0;for(i=0;i>>16,s=65535&this.D(i),a=e.D(r)>>>16,l=65535&e.D(r);n[2*i+2*r]+=s*l,SI(n,2*i+2*r),n[2*i+2*r+1]+=o*l,SI(n,2*i+2*r+1),n[2*i+2*r+1]+=s*a,SI(n,2*i+2*r+1),n[2*i+2*r+2]+=o*a,SI(n,2*i+2*r+2)}for(i=0;i(n=n||10)||36s?(s=fI(Math.pow(n,s)),r=r.R(s).add(fI(a))):r=(r=r.R(i)).add(fI(a))}return r};var kI=wC.createWebChannelTransport=function(){return new rI},DI=wC.getStatEventTarget=function(){return tx()},OI=wC.ErrorCode=lx,AI=wC.EventType=cx,RI=wC.Event=ZS,PI=wC.Stat={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},NI=(wC.FetchXmlHttpFactory=vE,wC.WebChannel=dx),MI=wC.XhrIo=xE,LI=wC.Md5=cI,FI=wC.Integer=hI;const BI="@firebase/firestore";class VI{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}VI.UNAUTHENTICATED=new VI(null),VI.GOOGLE_CREDENTIALS=new VI("google-credentials-uid"),VI.FIRST_PARTY=new VI("first-party-uid"),VI.MOCK_USER=new VI("mock-user");let HI="10.7.0";const UI=new d_("@firebase/firestore");function zI(){return UI.logLevel}function jI(e){if(UI.logLevel<=a_.DEBUG){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:"Unexpected state";const t="FIRESTORE (".concat(HI,") INTERNAL ASSERTION FAILED: ")+e;throw $I(t),new Error(t)}function qI(e,t){e||KI()}function QI(e,t){return e}const XI={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class YI extends Wv{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>"".concat(this.name,": [code=").concat(this.code,"]: ").concat(this.message)}}class JI{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class ZI{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer ".concat(e))}}class eT{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(VI.UNAUTHENTICATED)))}shutdown(){}}class tT{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable((()=>t(this.token.user)))}shutdown(){this.changeListener=null}}class nT{constructor(e){this.t=e,this.currentUser=VI.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let n=this.i;const i=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let r=new JI;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new JI,e.enqueueRetryable((()=>i(this.currentUser)))};const o=()=>{const t=r;e.enqueueRetryable((async()=>{await t.promise,await i(this.currentUser)}))},s=e=>{jI("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit((e=>s(e))),setTimeout((()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?s(e):(jI("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new JI)}}),0),o()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i!==e?(jI("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(qI("string"==typeof t.accessToken),new ZI(t.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return qI(null===e||"string"==typeof e),new VI(e)}}class iT{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=VI.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class rT{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){return Promise.resolve(new iT(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable((()=>t(VI.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class oT{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class sT{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){const n=e=>{null!=e.error&&jI("FirebaseAppCheckTokenProvider","Error getting App Check token; using placeholder token instead. Error: ".concat(e.error.message));const n=e.token!==this.R;return this.R=e.token,jI("FirebaseAppCheckTokenProvider","Received ".concat(n?"new":"existing"," token.")),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};const i=e=>{jI("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.appCheck.addTokenListener(this.o)};this.A.onInit((e=>i(e))),setTimeout((()=>{if(!this.appCheck){const e=this.A.getImmediate({optional:!0});e?i(e):jI("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(qI("string"==typeof e.token),this.R=e.token,new oT(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}function aT(e){const t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let i=0;it?1:0}function uT(e,t,n){return e.length===t.length&&e.every(((e,i)=>n(e,t[i])))}class hT{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new YI(XI.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new YI(XI.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new YI(XI.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new YI(XI.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return hT.fromMillis(Date.now())}static fromDate(e){return hT.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor(1e6*(e-1e3*t));return new hT(t,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?cT(this.nanoseconds,e.nanoseconds):cT(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class dT{constructor(e){this.timestamp=e}static fromTimestamp(e){return new dT(e)}static min(){return new dT(new hT(0,0))}static max(){return new dT(new hT(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class pT{constructor(e,t,n){void 0===t?t=0:t>e.length&&KI(),void 0===n?n=e.length-t:n>e.length-t&&KI(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===pT.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof pT?e.forEach((e=>{t.push(e)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.lengthr)return 1}return e.lengtht.length?1:0}}class fT extends pT{construct(e,t,n){return new fT(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(){const e=[];for(var t=arguments.length,n=new Array(t),i=0;i=0)throw new YI(XI.INVALID_ARGUMENT,"Invalid segment (".concat(r,"). Paths must not contain // in them."));e.push(...r.split("/").filter((e=>e.length>0)))}return new fT(e)}static emptyPath(){return new fT([])}}const mT=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class gT extends pT{construct(e,t,n){return new gT(e,t,n)}static isValidIdentifier(e){return mT.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),gT.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new gT(["__name__"])}static fromServerFormat(e){const t=[];let n="",i=0;const r=()=>{if(0===n.length)throw new YI(XI.INVALID_ARGUMENT,"Invalid field path (".concat(e,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"));t.push(n),n=""};let o=!1;for(;i=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===fT.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return fT.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new vT(new fT(e.slice()))}}class _T{constructor(e,t,n,i){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=i}}_T.UNKNOWN_ID=-1;function yT(e,t){const n=e.toTimestamp().seconds,i=e.toTimestamp().nanoseconds+1,r=dT.fromTimestamp(1e9===i?new hT(n+1,0):new hT(n,i));return new wT(r,vT.empty(),t)}function bT(e){return new wT(e.readTime,e.key,-1)}class wT{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new wT(dT.min(),vT.empty(),-1)}static max(){return new wT(dT.max(),vT.empty(),-1)}}function CT(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=vT.comparator(e.documentKey,t.documentKey),0!==n?n:cT(e.largestBatchId,t.largestBatchId))}const ST="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class xT{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}async function ET(e){if(e.code!==XI.FAILED_PRECONDITION||e.message!==ST)throw e;jI("LocalStore","Unexpectedly lost primary lease")}class IT{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&KI(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new IT(((n,i)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,i)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,i)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof IT?t:IT.resolve(t)}catch(e){return IT.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):IT.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):IT.reject(t)}static resolve(e){return new IT(((t,n)=>{t(e)}))}static reject(e){return new IT(((t,n)=>{n(e)}))}static waitFor(e){return new IT(((t,n)=>{let i=0,r=0,o=!1;e.forEach((e=>{++i,e.next((()=>{++r,o&&r===i&&t()}),(e=>n(e)))})),o=!0,r===i&&t()}))}static or(e){let t=IT.resolve(!1);for(const n of e)t=t.next((e=>e?IT.resolve(e):n()));return t}static forEach(e,t){const n=[];return e.forEach(((e,i)=>{n.push(t.call(this,e,i))})),this.waitFor(n)}static mapArray(e,t){return new IT(((n,i)=>{const r=e.length,o=new Array(r);let s=0;for(let a=0;a{o[l]=e,++s,s===r&&n(o)}),(e=>i(e)))}}))}static doWhile(e,t){return new IT(((n,i)=>{const r=()=>{!0===e()?t().next((()=>{r()}),i):n()};r()}))}}function TT(e){return"IndexedDbTransactionError"===e.name}class kT{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.se(e),this.oe=e=>t.writeSequenceNumber(e))}se(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.oe&&this.oe(e),e}}function DT(e){return null==e}function OT(e){return 0===e&&1/e==-1/0}function AT(e){return"number"==typeof e&&Number.isInteger(e)&&!OT(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}kT._e=-1;const RT=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries"],PT=["mutationQueues","mutations","documentMutations","remoteDocumentsV14","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries","documentOverlays"],NT=PT;function MT(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function LT(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function FT(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class BT{constructor(e,t){this.comparator=e,this.root=t||HT.EMPTY}insert(e,t){return new BT(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,HT.BLACK,null,null))}remove(e){return new BT(this.comparator,this.root.remove(e,this.comparator).copy(null,null,HT.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){const i=this.comparator(e,n.key);if(0===i)return t+n.left.size;i<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,n)=>(e(t,n),!1)))}toString(){const e=[];return this.inorderTraversal(((t,n)=>(e.push("".concat(t,":").concat(n)),!1))),"{".concat(e.join(", "),"}")}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new VT(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new VT(this.root,e,this.comparator,!1)}getReverseIterator(){return new VT(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new VT(this.root,e,this.comparator,!0)}}class VT{constructor(e,t,n,i){this.isReverse=i,this.nodeStack=[];let r=1;for(;!e.isEmpty();)if(r=t?n(e.key,t):1,t&&i&&(r*=-1),r<0)e=this.isReverse?e.left:e.right;else{if(0===r){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class HT{constructor(e,t,n,i,r){this.key=e,this.value=t,this.color=null!=n?n:HT.RED,this.left=null!=i?i:HT.EMPTY,this.right=null!=r?r:HT.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,i,r){return new HT(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=r?r:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let i=this;const r=n(e,i.key);return i=r<0?i.copy(null,null,null,i.left.insert(e,t,n),null):0===r?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n)),i.fixUp()}removeMin(){if(this.left.isEmpty())return HT.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let n,i=this;if(t(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===t(e,i.key)){if(i.right.isEmpty())return HT.EMPTY;n=i.right.min(),i=i.copy(n.key,n.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,HT.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,HT.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw KI();if(this.right.isRed())throw KI();const e=this.left.check();if(e!==this.right.check())throw KI();return e+(this.isRed()?0:1)}}HT.EMPTY=null,HT.RED=!0,HT.BLACK=!1,HT.EMPTY=new class{constructor(){this.size=0}get key(){throw KI()}get value(){throw KI()}get color(){throw KI()}get left(){throw KI()}get right(){throw KI()}copy(e,t,n,i,r){return this}insert(e,t,n){return new HT(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class UT{constructor(e){this.comparator=e,this.data=new BT(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,n)=>(e(t),!1)))}forEachInRange(e,t){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const i=n.getNext();if(this.comparator(i.key,e[1])>=0)return;t(i.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new zT(this.data.getIterator())}getIteratorFrom(e){return new zT(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size{t=t.add(e)})),t}isEqual(e){if(!(e instanceof UT))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,i=n.getNext().key;if(0!==this.comparator(e,i))return!1}return!0}toArray(){const e=[];return this.forEach((t=>{e.push(t)})),e}toString(){const e=[];return this.forEach((t=>e.push(t))),"SortedSet("+e.toString()+")"}copy(e){const t=new UT(this.comparator);return t.data=e,t}}class zT{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class jT{constructor(e){this.fields=e,e.sort(gT.comparator)}static empty(){return new jT([])}unionWith(e){let t=new UT(gT.comparator);for(const n of this.fields)t=t.add(n);for(const n of e)t=t.add(n);return new jT(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return uT(this.fields,e.fields,((e,t)=>e.isEqual(t)))}}class $T extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class WT{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new $T("Invalid base64 string: "+e):e}}(e);return new WT(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;neik(e,t)))}function ok(e,t){if(e===t)return 0;const n=nk(e),i=nk(t);if(n!==i)return cT(n,i);switch(n){case 0:case 9007199254740991:return 0;case 1:return cT(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=qT(e.integerValue||e.doubleValue),i=qT(t.integerValue||t.doubleValue);return ni?1:n===i?0:isNaN(n)?isNaN(i)?0:-1:1}(e,t);case 3:return sk(e.timestampValue,t.timestampValue);case 4:return sk(JT(e),JT(t));case 5:return cT(e.stringValue,t.stringValue);case 6:return function(e,t){const n=QT(e),i=QT(t);return n.compareTo(i)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),i=t.split("/");for(let r=0;rt.mapValue.fields[e]=mk(n))),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=mk(e.arrayValue.values[n]);return t}return Object.assign({},e)}function gk(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}class vk{constructor(e){this.value=e}static empty(){return new vk({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n{if(!t.isImmediateParentOf(r)){const e=this.getFieldsMap(t);this.applyChanges(e,n,i),n={},i=[],t=r.popLast()}e?n[r.lastSegment()]=mk(e):i.push(r.lastSegment())}));const r=this.getFieldsMap(t);this.applyChanges(r,n,i)}delete(e){const t=this.field(e.popLast());fk(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return ik(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;ne[t]=n));for(const i of n)delete e[i]}clone(){return new vk(mk(this.value))}}function _k(e){const t=[];return LT(e.fields,((e,n)=>{const i=new gT([e]);if(fk(n)){const e=_k(n.mapValue).fields;if(0===e.length)t.push(i);else for(const n of e)t.push(i.child(n))}else t.push(i)})),new jT(t)}class yk{constructor(e,t,n,i,r,o,s){this.key=e,this.documentType=t,this.version=n,this.readTime=i,this.createTime=r,this.data=o,this.documentState=s}static newInvalidDocument(e){return new yk(e,0,dT.min(),dT.min(),dT.min(),vk.empty(),0)}static newFoundDocument(e,t,n,i){return new yk(e,1,t,dT.min(),n,i,0)}static newNoDocument(e,t){return new yk(e,2,t,dT.min(),dT.min(),vk.empty(),0)}static newUnknownDocument(e,t){return new yk(e,3,t,dT.min(),dT.min(),vk.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(dT.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=vk.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=vk.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=dT.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof yk&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new yk(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return"Document(".concat(this.key,", ").concat(this.version,", ").concat(JSON.stringify(this.data.value),", {createTime: ").concat(this.createTime,"}), {documentType: ").concat(this.documentType,"}), {documentState: ").concat(this.documentState,"})")}}class bk{constructor(e,t){this.position=e,this.inclusive=t}}function wk(e,t,n){let i=0;for(let r=0;r1&&void 0!==arguments[1]?arguments[1]:"asc";this.field=e,this.dir=t}}function xk(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class Ek{}class Ik extends Ek{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new Nk(e,t,n):"array-contains"===t?new Bk(e,n):"in"===t?new Vk(e,n):"not-in"===t?new Hk(e,n):"array-contains-any"===t?new Uk(e,n):new Ik(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new Mk(e,n):new Lk(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(ok(t,this.value)):null!==t&&nk(this.value)===nk(t)&&this.matchesComparison(ok(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return KI()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Tk extends Ek{constructor(e,t){super(),this.filters=e,this.op=t,this.ue=null}static create(e,t){return new Tk(e,t)}matches(e){return kk(this)?void 0===this.filters.find((t=>!t.matches(e))):void 0!==this.filters.find((t=>t.matches(e)))}getFlattenedFilters(){return null!==this.ue||(this.ue=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.ue}getFilters(){return Object.assign([],this.filters)}}function kk(e){return"and"===e.op}function Dk(e){return Ok(e)&&kk(e)}function Ok(e){for(const t of e.filters)if(t instanceof Tk)return!1;return!0}function Ak(e){if(e instanceof Ik)return e.field.canonicalString()+e.op.toString()+ak(e.value);if(Dk(e))return e.filters.map((e=>Ak(e))).join(",");{const t=e.filters.map((e=>Ak(e))).join(",");return"".concat(e.op,"(").concat(t,")")}}function Rk(e,t){return e instanceof Ik?function(e,t){return t instanceof Ik&&e.op===t.op&&e.field.isEqual(t.field)&&ik(e.value,t.value)}(e,t):e instanceof Tk?function(e,t){return t instanceof Tk&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(((e,n,i)=>e&&Rk(n,t.filters[i])),!0)}(e,t):void KI()}function Pk(e){return e instanceof Ik?function(e){return"".concat(e.field.canonicalString()," ").concat(e.op," ").concat(ak(e.value))}(e):e instanceof Tk?function(e){return e.op.toString()+" {"+e.getFilters().map(Pk).join(" ,")+"}"}(e):"Filter"}class Nk extends Ik{constructor(e,t,n){super(e,t,n),this.key=vT.fromName(n.referenceValue)}matches(e){const t=vT.comparator(e.key,this.key);return this.matchesComparison(t)}}class Mk extends Ik{constructor(e,t){super(e,"in",t),this.keys=Fk("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class Lk extends Ik{constructor(e,t){super(e,"not-in",t),this.keys=Fk("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function Fk(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map((e=>vT.fromName(e.referenceValue)))}class Bk extends Ik{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return hk(t)&&rk(t.arrayValue,this.value)}}class Vk extends Ik{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&rk(this.value.arrayValue,t)}}class Hk extends Ik{constructor(e,t){super(e,"not-in",t)}matches(e){if(rk(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&!rk(this.value.arrayValue,t)}}class Uk extends Ik{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!hk(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>rk(this.value.arrayValue,e)))}}class zk{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=i,this.limit=r,this.startAt=o,this.endAt=s,this.ce=null}}function jk(e){return new zk(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,arguments.length>6&&void 0!==arguments[6]?arguments[6]:null)}function $k(e){const t=QI(e);if(null===t.ce){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map((e=>Ak(e))).join(","),e+="|ob:",e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(","),DT(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((e=>ak(e))).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((e=>ak(e))).join(",")),t.ce=e}return t.ce}function Wk(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"F",s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=i,this.limit=r,this.limitType=o,this.startAt=s,this.endAt=a,this.le=null,this.he=null,this.Pe=null,this.startAt,this.endAt}}function qk(e,t,n,i,r,o,s,a){return new Kk(e,t,n,i,r,o,s,a)}function Qk(e){return new Kk(e)}function Xk(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function Yk(e){return null!==e.collectionGroup}function Jk(e){const t=QI(e);if(null===t.le){t.le=[];const e=new Set;for(const r of t.explicitOrderBy)t.le.push(r),e.add(r.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",i=function(e){let t=new UT(gT.comparator);return e.filters.forEach((e=>{e.getFlattenedFilters().forEach((e=>{e.isInequality()&&(t=t.add(e.field))}))})),t}(t);i.forEach((i=>{e.has(i.canonicalString())||i.isKeyField()||t.le.push(new Sk(i,n))})),e.has(gT.keyField().canonicalString())||t.le.push(new Sk(gT.keyField(),n))}return t.le}function Zk(e){const t=QI(e);return t.he||(t.he=eD(t,Jk(e))),t.he}function eD(e,t){if("F"===e.limitType)return jk(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map((e=>{const t="desc"===e.dir?"asc":"desc";return new Sk(e.field,t)}));const n=e.endAt?new bk(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?new bk(e.startAt.position,e.startAt.inclusive):null;return jk(e.path,e.collectionGroup,t,e.filters,e.limit,n,i)}}function tD(e,t){const n=e.filters.concat([t]);return new Kk(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function nD(e,t,n){return new Kk(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function iD(e,t){return Wk(Zk(e),Zk(t))&&e.limitType===t.limitType}function rD(e){return"".concat($k(Zk(e)),"|lt:").concat(e.limitType)}function oD(e){return"Query(target=".concat(function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=", filters: [".concat(e.filters.map((e=>Pk(e))).join(", "),"]")),DT(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=", orderBy: [".concat(e.orderBy.map((e=>function(e){return"".concat(e.field.canonicalString()," (").concat(e.dir,")")}(e))).join(", "),"]")),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((e=>ak(e))).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((e=>ak(e))).join(",")),"Target(".concat(t,")")}(Zk(e)),"; limitType=").concat(e.limitType,")")}function sD(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):vT.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Jk(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const i=wk(e,t,n);return e.inclusive?i<=0:i<0}(e.startAt,Jk(e),t))&&!(e.endAt&&!function(e,t,n){const i=wk(e,t,n);return e.inclusive?i>=0:i>0}(e.endAt,Jk(e),t))}(e,t)}function aD(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function lD(e){return(t,n)=>{let i=!1;for(const r of Jk(e)){const e=cD(r,t,n);if(0!==e)return e;i=i||r.field.isKeyField()}return 0}}function cD(e,t,n){const i=e.field.isKeyField()?vT.comparator(t.key,n.key):function(e,t,n){const i=t.data.field(e),r=n.data.field(e);return null!==i&&null!==r?ok(i,r):KI()}(e.field,t,n);switch(e.dir){case"asc":return i;case"desc":return-1*i;default:return KI()}}class uD{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[i,r]of n)if(this.equalsFn(i,e))return r}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),i=this.inner[n];if(void 0===i)return this.inner[n]=[[e,t]],void this.innerSize++;for(let r=0;r{for(const[i,r]of n)e(i,r)}))}isEmpty(){return FT(this.inner)}size(){return this.innerSize}}const hD=new BT(vT.comparator);function dD(){return hD}const pD=new BT(vT.comparator);function fD(){let e=pD;for(var t=arguments.length,n=new Array(t),i=0;it=t.insert(e,n.overlayedDocument))),t}function gD(){return _D()}function vD(){return _D()}function _D(){return new uD((e=>e.toString()),((e,t)=>e.isEqual(t)))}const yD=new BT(vT.comparator),bD=new UT(vT.comparator);function wD(){let e=bD;for(var t=arguments.length,n=new Array(t),i=0;iik(e,i)))||n.push(i);return{arrayValue:{values:n}}}class ND extends TD{constructor(e){super(),this.elements=e}}function MD(e,t){let n=BD(t);for(const i of e.elements)n=n.filter((e=>!ik(e,i)));return{arrayValue:{values:n}}}class LD extends TD{constructor(e,t){super(),this.serializer=e,this.Ie=t}}function FD(e){return qT(e.integerValue||e.doubleValue)}function BD(e){return hk(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class VD{constructor(e,t){this.field=e,this.transform=t}}class HD{constructor(e,t){this.version=e,this.transformResults=t}}class UD{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new UD}static exists(e){return new UD(void 0,e)}static updateTime(e){return new UD(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function zD(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class jD{}function $D(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new eO(e.key,UD.none()):new QD(e.key,e.data,UD.none());{const n=e.data,i=vk.empty();let r=new UT(gT.comparator);for(let e of t.fields)if(!r.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?i.delete(e):i.set(e,t),r=r.add(e)}return new XD(e.key,i,new jT(r.toArray()),UD.none())}}function WD(e,t,n){e instanceof QD?function(e,t,n){const i=e.value.clone(),r=JD(e.fieldTransforms,t,n.transformResults);i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):e instanceof XD?function(e,t,n){if(!zD(e.precondition,t))return void t.convertToUnknownDocument(n.version);const i=JD(e.fieldTransforms,t,n.transformResults),r=t.data;r.setAll(YD(e)),r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function GD(e,t,n,i){return e instanceof QD?function(e,t,n,i){if(!zD(e.precondition,t))return n;const r=e.value.clone(),o=ZD(e.fieldTransforms,i,t);return r.setAll(o),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null}(e,t,n,i):e instanceof XD?function(e,t,n,i){if(!zD(e.precondition,t))return n;const r=ZD(e.fieldTransforms,i,t),o=t.data;return o.setAll(YD(e)),o.setAll(r),t.convertToFoundDocument(t.version,o).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,i):function(e,t,n){return zD(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function KD(e,t){let n=null;for(const i of e.fieldTransforms){const e=t.data.field(i.field),r=OD(i.transform,e||null);null!=r&&(null===n&&(n=vk.empty()),n.set(i.field,r))}return n||null}function qD(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&uT(e,t,((e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof RD&&t instanceof RD||e instanceof ND&&t instanceof ND?uT(e.elements,t.elements,ik):e instanceof LD&&t instanceof LD?ik(e.Ie,t.Ie):e instanceof AD&&t instanceof AD}(e.transform,t.transform)}(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class QD extends jD{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class XD extends jD{constructor(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function YD(e){const t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const i=e.data.field(n);t.set(n,i)}})),t}function JD(e,t,n){const i=new Map;qI(e.length===n.length);for(let r=0;r{const r=e.get(i.key),o=r.overlayedDocument;let s=this.applyToLocalView(o,r.mutatedFields);s=t.has(i.key)?null:s;const a=$D(o,s);null!==a&&n.set(i.key,a),o.isValidDocument()||o.convertToNoDocument(dT.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),wD())}isEqual(e){return this.batchId===e.batchId&&uT(this.mutations,e.mutations,((e,t)=>qD(e,t)))&&uT(this.baseMutations,e.baseMutations,((e,t)=>qD(e,t)))}}class iO{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}static from(e,t,n){qI(e.mutations.length===n.length);let i=yD;const r=e.mutations;for(let o=0;o=8)throw new gO("Invalid padding: ".concat(t));if(n<0)throw new gO("Invalid hash count: ".concat(n));if(e.length>0&&0===this.hashCount)throw new gO("Invalid hash count: ".concat(n));if(0===e.length&&0!==t)throw new gO("Invalid padding when bitmap length is 0: ".concat(t));this.Te=8*e.length-t,this.Ee=FI.fromNumber(this.Te)}de(e,t,n){let i=e.add(t.multiply(FI.fromNumber(n)));return 1===i.compare(dO)&&(i=new FI([i.getBits(0),i.getBits(1)],0)),i.modulo(this.Ee).toNumber()}Ae(e){return 0!=(this.bitmap[Math.floor(e/8)]&1<o.insert(e))),o}insert(e){if(0===this.Te)return;const t=pO(e),[n,i]=fO(t);for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:WT.EMPTY_BYTE_STRING,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=i}}class CO{constructor(){this.ge=0,this.pe=EO(),this.ye=WT.EMPTY_BYTE_STRING,this.we=!1,this.Se=!0}get current(){return this.we}get resumeToken(){return this.ye}get be(){return 0!==this.ge}get De(){return this.Se}Ce(e){e.approximateByteSize()>0&&(this.Se=!0,this.ye=e)}ve(){let e=wD(),t=wD(),n=wD();return this.pe.forEach(((i,r)=>{switch(r){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:n=n.add(i);break;default:KI()}})),new _O(this.ye,this.we,e,t,n)}Fe(){this.Se=!1,this.pe=EO()}Me(e,t){this.Se=!0,this.pe=this.pe.insert(e,t)}xe(e){this.Se=!0,this.pe=this.pe.remove(e)}Oe(){this.ge+=1}Ne(){this.ge-=1,qI(this.ge>=0)}Be(){this.Se=!0,this.we=!0}}class SO{constructor(e){this.Le=e,this.ke=new Map,this.qe=dD(),this.Qe=xO(),this.Ke=new BT(cT)}$e(e){for(const t of e.Ve)e.me&&e.me.isFoundDocument()?this.Ue(t,e.me):this.We(t,e.key,e.me);for(const t of e.removedTargetIds)this.We(t,e.key,e.me)}Ge(e){this.forEachTarget(e,(t=>{const n=this.ze(t);switch(e.state){case 0:this.je(t)&&n.Ce(e.resumeToken);break;case 1:n.Ne(),n.be||n.Fe(),n.Ce(e.resumeToken);break;case 2:n.Ne(),n.be||this.removeTarget(t);break;case 3:this.je(t)&&(n.Be(),n.Ce(e.resumeToken));break;case 4:this.je(t)&&(this.He(t),n.Ce(e.resumeToken));break;default:KI()}}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ke.forEach(((e,n)=>{this.je(n)&&t(n)}))}Je(e){const t=e.targetId,n=e.fe.count,i=this.Ye(t);if(i){const r=i.target;if(Gk(r))if(0===n){const e=new vT(r.path);this.We(t,e,yk.newNoDocument(e,dT.min()))}else qI(1===n);else{const i=this.Ze(t);if(i!==n){const n=this.Xe(e),r=n?this.et(n,e,i):1;if(0!==r){this.He(t);const e=2===r?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(t,e)}null==uO||uO.tt(function(e,t,n,i,r){var o,s,a,l,c,u;const h={localCacheCount:e,existenceFilterCount:t.count,databaseId:n.database,projectId:n.projectId},d=t.unchangedNames;return d&&(h.bloomFilter={applied:0===r,hashCount:null!==(o=null==d?void 0:d.hashCount)&&void 0!==o?o:0,bitmapLength:null!==(l=null===(a=null===(s=null==d?void 0:d.bits)||void 0===s?void 0:s.bitmap)||void 0===a?void 0:a.length)&&void 0!==l?l:0,padding:null!==(u=null===(c=null==d?void 0:d.bits)||void 0===c?void 0:c.padding)&&void 0!==u?u:0,mightContain:e=>{var t;return null!==(t=null==i?void 0:i.mightContain(e))&&void 0!==t&&t}}),h}(i,e.fe,this.Le.nt(),n,r))}}}}Xe(e){const t=e.fe.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:i=0},hashCount:r=0}=t;let o,s;try{o=QT(n).toUint8Array()}catch(e){if(e instanceof $T)return WI("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{s=new mO(o,i,r)}catch(e){return WI(e instanceof gO?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===s.Te?null:s}et(e,t,n){return t.fe.count===n-this.rt(e,t.targetId)?0:2}rt(e,t){const n=this.Le.getRemoteKeysForTarget(t);let i=0;return n.forEach((n=>{const r=this.Le.nt(),o="projects/".concat(r.projectId,"/databases/").concat(r.database,"/documents/").concat(n.path.canonicalString());e.mightContain(o)||(this.We(t,n,null),i++)})),i}it(e){const t=new Map;this.ke.forEach(((n,i)=>{const r=this.Ye(i);if(r){if(n.current&&Gk(r.target)){const t=new vT(r.target.path);null!==this.qe.get(t)||this.st(i,t)||this.We(i,t,yk.newNoDocument(t,e))}n.De&&(t.set(i,n.ve()),n.Fe())}}));let n=wD();this.Qe.forEach(((e,t)=>{let i=!0;t.forEachWhile((e=>{const t=this.Ye(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(i=!1,!1)})),i&&(n=n.add(e))})),this.qe.forEach(((t,n)=>n.setReadTime(e)));const i=new vO(e,t,this.Ke,this.qe,n);return this.qe=dD(),this.Qe=xO(),this.Ke=new BT(cT),i}Ue(e,t){if(!this.je(e))return;const n=this.st(e,t.key)?2:0;this.ze(e).Me(t.key,n),this.qe=this.qe.insert(t.key,t),this.Qe=this.Qe.insert(t.key,this.ot(t.key).add(e))}We(e,t,n){if(!this.je(e))return;const i=this.ze(e);this.st(e,t)?i.Me(t,1):i.xe(t),this.Qe=this.Qe.insert(t,this.ot(t).delete(e)),n&&(this.qe=this.qe.insert(t,n))}removeTarget(e){this.ke.delete(e)}Ze(e){const t=this.ze(e).ve();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Oe(e){this.ze(e).Oe()}ze(e){let t=this.ke.get(e);return t||(t=new CO,this.ke.set(e,t)),t}ot(e){let t=this.Qe.get(e);return t||(t=new UT(cT),this.Qe=this.Qe.insert(e,t)),t}je(e){const t=null!==this.Ye(e);return t||jI("WatchChangeAggregator","Detected inactive target",e),t}Ye(e){const t=this.ke.get(e);return t&&t.be?null:this.Le._t(e)}He(e){this.ke.set(e,new CO),this.Le.getRemoteKeysForTarget(e).forEach((t=>{this.We(e,t,null)}))}st(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function xO(){return new BT(vT.comparator)}function EO(){return new BT(vT.comparator)}const IO={asc:"ASCENDING",desc:"DESCENDING"},TO={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},kO={and:"AND",or:"OR"};class DO{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function OO(e,t){return e.useProto3Json||DT(t)?t:{value:t}}function AO(e,t){return e.useProto3Json?"".concat(new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z",""),".").concat(("000000000"+t.nanoseconds).slice(-9),"Z"):{seconds:""+t.seconds,nanos:t.nanoseconds}}function RO(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function PO(e,t){return AO(e,t.toTimestamp())}function NO(e){return qI(!!e),dT.fromTimestamp(function(e){const t=KT(e);return new hT(t.seconds,t.nanos)}(e))}function MO(e,t){return function(e){return new fT(["projects",e.projectId,"databases",e.database])}(e).child("documents").child(t).canonicalString()}function LO(e){const t=fT.fromString(e);return qI(nA(t)),t}function FO(e,t){return MO(e.databaseId,t.path)}function BO(e,t){const n=LO(t);if(n.get(1)!==e.databaseId.projectId)throw new YI(XI.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new YI(XI.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new vT(zO(n))}function VO(e,t){return MO(e.databaseId,t)}function HO(e){const t=LO(e);return 4===t.length?fT.emptyPath():zO(t)}function UO(e){return new fT(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function zO(e){return qI(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function jO(e,t,n){return{name:FO(e,t),fields:n.value.mapValue.fields}}function $O(e,t){let n;if(t instanceof QD)n={update:jO(e,t.key,t.value)};else if(t instanceof eO)n={delete:FO(e,t.key)};else if(t instanceof XD)n={update:jO(e,t.key,t.data),updateMask:tA(t.fieldMask)};else{if(!(t instanceof tO))return KI();n={verify:FO(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((e=>function(e,t){const n=t.transform;if(n instanceof AD)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof RD)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof ND)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof LD)return{fieldPath:t.field.canonicalString(),increment:n.Ie};throw KI()}(0,e)))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:PO(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:KI()}(e,t.precondition)),n}function WO(e,t){return{documents:[VO(e,t.path)]}}function GO(e,t){const n={structuredQuery:{}},i=t.path;null!==t.collectionGroup?(n.parent=VO(e,i),n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n.parent=VO(e,i.popLast()),n.structuredQuery.from=[{collectionId:i.lastSegment()}]);const r=function(e){if(0!==e.length)return eA(Tk.create(e,"and"))}(t.filters);r&&(n.structuredQuery.where=r);const o=function(e){if(0!==e.length)return e.map((e=>function(e){return{field:JO(e.field),direction:QO(e.dir)}}(e)))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);const s=OO(e,t.limit);return null!==s&&(n.structuredQuery.limit=s),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),n}function KO(e){let t=HO(e.parent);const n=e.structuredQuery,i=n.from?n.from.length:0;let r=null;if(i>0){qI(1===i);const e=n.from[0];e.allDescendants?r=e.collectionId:t=t.child(e.collectionId)}let o=[];n.where&&(o=function(e){const t=qO(e);return t instanceof Tk&&Dk(t)?t.getFilters():[t]}(n.where));let s=[];n.orderBy&&(s=function(e){return e.map((e=>function(e){return new Sk(ZO(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e)))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,DT(t)?null:t}(n.limit));let l=null;n.startAt&&(l=function(e){const t=!!e.before,n=e.values||[];return new bk(n,t)}(n.startAt));let c=null;return n.endAt&&(c=function(e){const t=!e.before,n=e.values||[];return new bk(n,t)}(n.endAt)),qk(t,r,s,o,a,"F",l,c)}function qO(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=ZO(e.unaryFilter.field);return Ik.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=ZO(e.unaryFilter.field);return Ik.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=ZO(e.unaryFilter.field);return Ik.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=ZO(e.unaryFilter.field);return Ik.create(r,"!=",{nullValue:"NULL_VALUE"});default:return KI()}}(e):void 0!==e.fieldFilter?function(e){return Ik.create(ZO(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return KI()}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return Tk.create(e.compositeFilter.filters.map((e=>qO(e))),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return KI()}}(e.compositeFilter.op))}(e):KI()}function QO(e){return IO[e]}function XO(e){return TO[e]}function YO(e){return kO[e]}function JO(e){return{fieldPath:e.canonicalString()}}function ZO(e){return gT.fromServerFormat(e.fieldPath)}function eA(e){return e instanceof Ik?function(e){if("=="===e.op){if(pk(e.value))return{unaryFilter:{field:JO(e.field),op:"IS_NAN"}};if(dk(e.value))return{unaryFilter:{field:JO(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(pk(e.value))return{unaryFilter:{field:JO(e.field),op:"IS_NOT_NAN"}};if(dk(e.value))return{unaryFilter:{field:JO(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:JO(e.field),op:XO(e.op),value:e.value}}}(e):e instanceof Tk?function(e){const t=e.getFilters().map((e=>eA(e)));return 1===t.length?t[0]:{compositeFilter:{op:YO(e.op),filters:t}}}(e):KI()}function tA(e){const t=[];return e.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function nA(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class iA{constructor(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:dT.min(),o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:dT.min(),s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:WT.EMPTY_BYTE_STRING,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=r,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s,this.expectedCount=a}withSequenceNumber(e){return new iA(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new iA(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new iA(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new iA(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class rA{constructor(e){this.ut=e}}function oA(e){const t=KO({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?nD(t,t.limit,"L"):t}class sA{constructor(){}ht(e,t){this.Pt(e,t),t.It()}Pt(e,t){if("nullValue"in e)this.Tt(t,5);else if("booleanValue"in e)this.Tt(t,10),t.Et(e.booleanValue?1:0);else if("integerValue"in e)this.Tt(t,15),t.Et(qT(e.integerValue));else if("doubleValue"in e){const n=qT(e.doubleValue);isNaN(n)?this.Tt(t,13):(this.Tt(t,15),OT(n)?t.Et(0):t.Et(n))}else if("timestampValue"in e){const n=e.timestampValue;this.Tt(t,20),"string"==typeof n?t.dt(n):(t.dt("".concat(n.seconds||"")),t.Et(n.nanos||0))}else if("stringValue"in e)this.At(e.stringValue,t),this.Rt(t);else if("bytesValue"in e)this.Tt(t,30),t.Vt(QT(e.bytesValue)),this.Rt(t);else if("referenceValue"in e)this.ft(e.referenceValue,t);else if("geoPointValue"in e){const n=e.geoPointValue;this.Tt(t,45),t.Et(n.latitude||0),t.Et(n.longitude||0)}else"mapValue"in e?gk(e)?this.Tt(t,Number.MAX_SAFE_INTEGER):(this.gt(e.mapValue,t),this.Rt(t)):"arrayValue"in e?(this.yt(e.arrayValue,t),this.Rt(t)):KI()}At(e,t){this.Tt(t,25),this.wt(e,t)}wt(e,t){t.dt(e)}gt(e,t){const n=e.fields||{};this.Tt(t,55);for(const i of Object.keys(n))this.At(i,t),this.Pt(n[i],t)}yt(e,t){const n=e.values||[];this.Tt(t,50);for(const i of n)this.Pt(i,t)}ft(e,t){this.Tt(t,37),vT.fromName(e).path.forEach((e=>{this.Tt(t,60),this.wt(e,t)}))}Tt(e,t){e.Et(t)}Rt(e){e.Et(2)}}sA.St=new sA;class aA{constructor(){this.on=new lA}addToCollectionParentIndex(e,t){return this.on.add(t),IT.resolve()}getCollectionParents(e,t){return IT.resolve(this.on.getEntries(t))}addFieldIndex(e,t){return IT.resolve()}deleteFieldIndex(e,t){return IT.resolve()}deleteAllFieldIndexes(e){return IT.resolve()}createTargetIndexes(e,t){return IT.resolve()}getDocumentsMatchingTarget(e,t){return IT.resolve(null)}getIndexType(e,t){return IT.resolve(0)}getFieldIndexes(e,t){return IT.resolve([])}getNextCollectionGroupToUpdate(e){return IT.resolve(null)}getMinOffset(e,t){return IT.resolve(wT.min())}getMinOffsetFromCollectionGroup(e,t){return IT.resolve(wT.min())}updateCollectionGroup(e,t,n){return IT.resolve()}updateIndexEntries(e,t){return IT.resolve()}}class lA{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),i=this.index[t]||new UT(fT.comparator),r=!i.has(n);return this.index[t]=i.add(n),r}has(e){const t=e.lastSegment(),n=e.popLast(),i=this.index[t];return i&&i.has(n)}getEntries(e){return(this.index[e]||new UT(fT.comparator)).toArray()}}new Uint8Array(0);class cA{constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}static withCacheSize(e){return new cA(e,cA.DEFAULT_COLLECTION_PERCENTILE,cA.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}cA.DEFAULT_COLLECTION_PERCENTILE=10,cA.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,cA.DEFAULT=new cA(41943040,cA.DEFAULT_COLLECTION_PERCENTILE,cA.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),cA.DISABLED=new cA(-1,0,0);class uA{constructor(e){this.xn=e}next(){return this.xn+=2,this.xn}static On(){return new uA(0)}static Nn(){return new uA(-1)}}class hA{constructor(){this.changes=new uD((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,yk.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?IT.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}class dA{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class pA{constructor(e,t,n,i){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=i}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((i=>(n=i,this.remoteDocumentCache.getEntry(e,t)))).next((e=>(null!==n&&GD(n.mutation,e,jT.empty(),hT.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,wD()).next((()=>t))))}getLocalViewOfDocuments(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wD();const i=gD();return this.populateOverlays(e,i,t).next((()=>this.computeViews(e,t,i,n).next((e=>{let t=fD();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){const n=gD();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,wD())))}populateOverlays(e,t,n){const i=[];return n.forEach((e=>{t.has(e)||i.push(e)})),this.documentOverlayCache.getOverlays(e,i).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,i){let r=dD();const o=_D(),s=_D();return t.forEach(((e,t)=>{const s=n.get(t.key);i.has(t.key)&&(void 0===s||s.mutation instanceof XD)?r=r.insert(t.key,t):void 0!==s?(o.set(t.key,s.mutation.getFieldMask()),GD(s.mutation,t,s.mutation.getFieldMask(),hT.now())):o.set(t.key,jT.empty())})),this.recalculateAndSaveOverlays(e,r).next((e=>(e.forEach(((e,t)=>o.set(e,t))),t.forEach(((e,t)=>{var n;return s.set(e,new dA(t,null!==(n=o.get(e))&&void 0!==n?n:null))})),s)))}recalculateAndSaveOverlays(e,t){const n=_D();let i=new BT(((e,t)=>e-t)),r=wD();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(const r of e)r.keys().forEach((e=>{const o=t.get(e);if(null===o)return;let s=n.get(e)||jT.empty();s=r.applyToLocalView(o,s),n.set(e,s);const a=(i.get(r.batchId)||wD()).add(e);i=i.insert(r.batchId,a)}))})).next((()=>{const o=[],s=i.getReverseIterator();for(;s.hasNext();){const i=s.getNext(),a=i.key,l=i.value,c=vD();l.forEach((e=>{if(!r.has(e)){const i=$D(t.get(e),n.get(e));null!==i&&c.set(e,i),r=r.add(e)}})),o.push(this.documentOverlayCache.saveOverlays(e,a,c))}return IT.waitFor(o)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n,i){return function(e){return vT.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Yk(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,i):this.getDocumentsMatchingCollectionQuery(e,t,n,i)}getNextDocuments(e,t,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,i).next((r=>{const o=i-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,i-r.size):IT.resolve(gD());let s=-1,a=r;return o.next((t=>IT.forEach(t,((t,n)=>(s{a=a.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,r))).next((()=>this.computeViews(e,a,t,wD()))).next((e=>({batchId:s,changes:mD(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new vT(t)).next((e=>{let t=fD();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,i){const r=t.collectionGroup;let o=fD();return this.indexManager.getCollectionParents(e,r).next((s=>IT.forEach(s,(s=>{const a=function(e,t){return new Kk(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,s.child(r));return this.getDocumentsMatchingCollectionQuery(e,a,n,i).next((e=>{e.forEach(((e,t)=>{o=o.insert(e,t)}))}))})).next((()=>o))))}getDocumentsMatchingCollectionQuery(e,t,n,i){let r;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((o=>(r=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,r,i)))).next((e=>{r.forEach(((t,n)=>{const i=n.getKey();null===e.get(i)&&(e=e.insert(i,yk.newInvalidDocument(i)))}));let n=fD();return e.forEach(((e,i)=>{const o=r.get(e);void 0!==o&&GD(o.mutation,i,jT.empty(),hT.now()),sD(t,i)&&(n=n.insert(e,i))})),n}))}}class fA{constructor(e){this.serializer=e,this.ur=new Map,this.cr=new Map}getBundleMetadata(e,t){return IT.resolve(this.ur.get(t))}saveBundleMetadata(e,t){return this.ur.set(t.id,function(e){return{id:e.id,version:e.version,createTime:NO(e.createTime)}}(t)),IT.resolve()}getNamedQuery(e,t){return IT.resolve(this.cr.get(t))}saveNamedQuery(e,t){return this.cr.set(t.name,function(e){return{name:e.name,query:oA(e.bundledQuery),readTime:NO(e.readTime)}}(t)),IT.resolve()}}class mA{constructor(){this.overlays=new BT(vT.comparator),this.lr=new Map}getOverlay(e,t){return IT.resolve(this.overlays.get(t))}getOverlays(e,t){const n=gD();return IT.forEach(t,(t=>this.getOverlay(e,t).next((e=>{null!==e&&n.set(t,e)})))).next((()=>n))}saveOverlays(e,t,n){return n.forEach(((n,i)=>{this.lt(e,t,i)})),IT.resolve()}removeOverlaysForBatchId(e,t,n){const i=this.lr.get(n);return void 0!==i&&(i.forEach((e=>this.overlays=this.overlays.remove(e))),this.lr.delete(n)),IT.resolve()}getOverlaysForCollection(e,t,n){const i=gD(),r=t.length+1,o=new vT(t.child("")),s=this.overlays.getIteratorFrom(o);for(;s.hasNext();){const e=s.getNext().value,o=e.getKey();if(!t.isPrefixOf(o.path))break;o.path.length===r&&e.largestBatchId>n&&i.set(e.getKey(),e)}return IT.resolve(i)}getOverlaysForCollectionGroup(e,t,n,i){let r=new BT(((e,t)=>e-t));const o=this.overlays.getIterator();for(;o.hasNext();){const e=o.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=r.get(e.largestBatchId);null===t&&(t=gD(),r=r.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const s=gD(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((e,t)=>s.set(e,t))),!(s.size()>=i)););return IT.resolve(s)}lt(e,t,n){const i=this.overlays.get(n.key);if(null!==i){const e=this.lr.get(i.largestBatchId).delete(n.key);this.lr.set(i.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new rO(t,n));let r=this.lr.get(t);void 0===r&&(r=wD(),this.lr.set(t,r)),this.lr.set(t,r.add(n.key))}}class gA{constructor(){this.hr=new UT(vA.Pr),this.Ir=new UT(vA.Tr)}isEmpty(){return this.hr.isEmpty()}addReference(e,t){const n=new vA(e,t);this.hr=this.hr.add(n),this.Ir=this.Ir.add(n)}Er(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.dr(new vA(e,t))}Ar(e,t){e.forEach((e=>this.removeReference(e,t)))}Rr(e){const t=new vT(new fT([])),n=new vA(t,e),i=new vA(t,e+1),r=[];return this.Ir.forEachInRange([n,i],(e=>{this.dr(e),r.push(e.key)})),r}Vr(){this.hr.forEach((e=>this.dr(e)))}dr(e){this.hr=this.hr.delete(e),this.Ir=this.Ir.delete(e)}mr(e){const t=new vT(new fT([])),n=new vA(t,e),i=new vA(t,e+1);let r=wD();return this.Ir.forEachInRange([n,i],(e=>{r=r.add(e.key)})),r}containsKey(e){const t=new vA(e,0),n=this.hr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class vA{constructor(e,t){this.key=e,this.gr=t}static Pr(e,t){return vT.comparator(e.key,t.key)||cT(e.gr,t.gr)}static Tr(e,t){return cT(e.gr,t.gr)||vT.comparator(e.key,t.key)}}class _A{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.pr=1,this.yr=new UT(vA.Pr)}checkEmpty(e){return IT.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,i){const r=this.pr;this.pr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new nO(r,t,n,i);this.mutationQueue.push(o);for(const s of i)this.yr=this.yr.add(new vA(s.key,r)),this.indexManager.addToCollectionParentIndex(e,s.key.path.popLast());return IT.resolve(o)}lookupMutationBatch(e,t){return IT.resolve(this.wr(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,i=this.Sr(n),r=i<0?0:i;return IT.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return IT.resolve(0===this.mutationQueue.length?-1:this.pr-1)}getAllMutationBatches(e){return IT.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new vA(t,0),i=new vA(t,Number.POSITIVE_INFINITY),r=[];return this.yr.forEachInRange([n,i],(e=>{const t=this.wr(e.gr);r.push(t)})),IT.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new UT(cT);return t.forEach((e=>{const t=new vA(e,0),i=new vA(e,Number.POSITIVE_INFINITY);this.yr.forEachInRange([t,i],(e=>{n=n.add(e.gr)}))})),IT.resolve(this.br(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,i=n.length+1;let r=n;vT.isDocumentKey(r)||(r=r.child(""));const o=new vA(new vT(r),0);let s=new UT(cT);return this.yr.forEachWhile((e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===i&&(s=s.add(e.gr)),!0)}),o),IT.resolve(this.br(s))}br(e){const t=[];return e.forEach((e=>{const n=this.wr(e);null!==n&&t.push(n)})),t}removeMutationBatch(e,t){qI(0===this.Dr(t.batchId,"removed")),this.mutationQueue.shift();let n=this.yr;return IT.forEach(t.mutations,(i=>{const r=new vA(i.key,t.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)})).next((()=>{this.yr=n}))}Fn(e){}containsKey(e,t){const n=new vA(t,0),i=this.yr.firstAfterOrEqual(n);return IT.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,IT.resolve()}Dr(e,t){return this.Sr(e)}Sr(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}wr(e){const t=this.Sr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class yA{constructor(e){this.Cr=e,this.docs=new BT(vT.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,i=this.docs.get(n),r=i?i.size:0,o=this.Cr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:o}),this.size+=o-r,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return IT.resolve(n?n.document.mutableCopy():yk.newInvalidDocument(t))}getEntries(e,t){let n=dD();return t.forEach((e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():yk.newInvalidDocument(e))})),IT.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let r=dD();const o=t.path,s=new vT(o.child("")),a=this.docs.getIteratorFrom(s);for(;a.hasNext();){const{key:e,value:{document:s}}=a.getNext();if(!o.isPrefixOf(e.path))break;e.path.length>o.length+1||CT(bT(s),n)<=0||(i.has(s.key)||sD(t,s))&&(r=r.insert(s.key,s.mutableCopy()))}return IT.resolve(r)}getAllFromCollectionGroup(e,t,n,i){KI()}vr(e,t){return IT.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new bA(this)}getSize(e){return IT.resolve(this.size)}}class bA extends hA{constructor(e){super(),this._r=e}applyChanges(e){const t=[];return this.changes.forEach(((n,i)=>{i.isValidDocument()?t.push(this._r.addEntry(e,i)):this._r.removeEntry(n)})),IT.waitFor(t)}getFromCache(e,t){return this._r.getEntry(e,t)}getAllFromCache(e,t){return this._r.getEntries(e,t)}}class wA{constructor(e){this.persistence=e,this.Fr=new uD((e=>$k(e)),Wk),this.lastRemoteSnapshotVersion=dT.min(),this.highestTargetId=0,this.Mr=0,this.Or=new gA,this.targetCount=0,this.Nr=uA.On()}forEachTarget(e,t){return this.Fr.forEach(((e,n)=>t(n))),IT.resolve()}getLastRemoteSnapshotVersion(e){return IT.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return IT.resolve(this.Mr)}allocateTargetId(e){return this.highestTargetId=this.Nr.next(),IT.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Mr&&(this.Mr=t),IT.resolve()}kn(e){this.Fr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.Nr=new uA(t),this.highestTargetId=t),e.sequenceNumber>this.Mr&&(this.Mr=e.sequenceNumber)}addTargetData(e,t){return this.kn(t),this.targetCount+=1,IT.resolve()}updateTargetData(e,t){return this.kn(t),IT.resolve()}removeTargetData(e,t){return this.Fr.delete(t.target),this.Or.Rr(t.targetId),this.targetCount-=1,IT.resolve()}removeTargets(e,t,n){let i=0;const r=[];return this.Fr.forEach(((o,s)=>{s.sequenceNumber<=t&&null===n.get(s.targetId)&&(this.Fr.delete(o),r.push(this.removeMatchingKeysForTargetId(e,s.targetId)),i++)})),IT.waitFor(r).next((()=>i))}getTargetCount(e){return IT.resolve(this.targetCount)}getTargetData(e,t){const n=this.Fr.get(t)||null;return IT.resolve(n)}addMatchingKeys(e,t,n){return this.Or.Er(t,n),IT.resolve()}removeMatchingKeys(e,t,n){this.Or.Ar(t,n);const i=this.persistence.referenceDelegate,r=[];return i&&t.forEach((t=>{r.push(i.markPotentiallyOrphaned(e,t))})),IT.waitFor(r)}removeMatchingKeysForTargetId(e,t){return this.Or.Rr(t),IT.resolve()}getMatchingKeysForTargetId(e,t){const n=this.Or.mr(t);return IT.resolve(n)}containsKey(e,t){return IT.resolve(this.Or.containsKey(t))}}class CA{constructor(e,t){this.Br={},this.overlays={},this.Lr=new kT(0),this.kr=!1,this.kr=!0,this.referenceDelegate=e(this),this.qr=new wA(this),this.indexManager=new aA,this.remoteDocumentCache=function(e){return new yA(e)}((e=>this.referenceDelegate.Qr(e))),this.serializer=new rA(t),this.Kr=new fA(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.kr=!1,Promise.resolve()}get started(){return this.kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new mA,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.Br[e.toKey()];return n||(n=new _A(t,this.referenceDelegate),this.Br[e.toKey()]=n),n}getTargetCache(){return this.qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Kr}runTransaction(e,t,n){jI("MemoryPersistence","Starting transaction:",e);const i=new SA(this.Lr.next());return this.referenceDelegate.$r(),n(i).next((e=>this.referenceDelegate.Ur(i).next((()=>e)))).toPromise().then((e=>(i.raiseOnCommittedEvent(),e)))}Wr(e,t){return IT.or(Object.values(this.Br).map((n=>()=>n.containsKey(e,t))))}}class SA extends xT{constructor(e){super(),this.currentSequenceNumber=e}}class xA{constructor(e){this.persistence=e,this.Gr=new gA,this.zr=null}static jr(e){return new xA(e)}get Hr(){if(this.zr)return this.zr;throw KI()}addReference(e,t,n){return this.Gr.addReference(n,t),this.Hr.delete(n.toString()),IT.resolve()}removeReference(e,t,n){return this.Gr.removeReference(n,t),this.Hr.add(n.toString()),IT.resolve()}markPotentiallyOrphaned(e,t){return this.Hr.add(t.toString()),IT.resolve()}removeTarget(e,t){this.Gr.Rr(t.targetId).forEach((e=>this.Hr.add(e.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.Hr.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}$r(){this.zr=new Set}Ur(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return IT.forEach(this.Hr,(n=>{const i=vT.fromPath(n);return this.Jr(e,i).next((e=>{e||t.removeEntry(i,dT.min())}))})).next((()=>(this.zr=null,t.apply(e))))}updateLimboDocument(e,t){return this.Jr(e,t).next((e=>{e?this.Hr.delete(t.toString()):this.Hr.add(t.toString())}))}Qr(e){return 0}Jr(e,t){return IT.or([()=>IT.resolve(this.Gr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Wr(e,t)])}}class EA{constructor(e,t,n,i){this.targetId=e,this.fromCache=t,this.ki=n,this.qi=i}static Qi(e,t){let n=wD(),i=wD();for(const r of t.docChanges)switch(r.type){case 0:n=n.add(r.doc.key);break;case 1:i=i.add(r.doc.key)}return new EA(e,t.fromCache,n,i)}}class IA{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class TA{constructor(){this.Ki=!1,this.$i=!1,this.Ui=100,this.Wi=8}initialize(e,t){this.Gi=e,this.indexManager=t,this.Ki=!0}getDocumentsMatchingQuery(e,t,n,i){const r={result:null};return this.zi(e,t).next((e=>{r.result=e})).next((()=>{if(!r.result)return this.ji(e,t,i,n).next((e=>{r.result=e}))})).next((()=>{if(r.result)return;const n=new IA;return this.Hi(e,t,n).next((i=>{if(r.result=i,this.$i)return this.Ji(e,t,n,i.size)}))})).next((()=>r.result))}Ji(e,t,n,i){return n.documentReadCountthis.Wi*i?(zI()<=a_.DEBUG&&jI("QueryEngine","The SDK decides to create cache indexes for query:",oD(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Zk(t))):IT.resolve())}zi(e,t){if(Xk(t))return IT.resolve(null);let n=Zk(t);return this.indexManager.getIndexType(e,n).next((i=>0===i?null:(null!==t.limit&&1===i&&(t=nD(t,null,"F"),n=Zk(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next((i=>{const r=wD(...i);return this.Gi.getDocuments(e,r).next((i=>this.indexManager.getMinOffset(e,n).next((n=>{const o=this.Yi(t,i);return this.Zi(t,o,r,n.readTime)?this.zi(e,nD(t,null,"F")):this.Xi(e,o,t,n)}))))})))))}ji(e,t,n,i){return Xk(t)||i.isEqual(dT.min())?IT.resolve(null):this.Gi.getDocuments(e,n).next((r=>{const o=this.Yi(t,r);return this.Zi(t,o,n,i)?IT.resolve(null):(zI()<=a_.DEBUG&&jI("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),oD(t)),this.Xi(e,o,t,yT(i,-1)).next((e=>e)))}))}Yi(e,t){let n=new UT(lD(e));return t.forEach(((t,i)=>{sD(e,i)&&(n=n.add(i))})),n}Zi(e,t,n,i){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const r="F"===e.limitType?t.last():t.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(i)>0)}Hi(e,t,n){return zI()<=a_.DEBUG&&jI("QueryEngine","Using full collection scan to execute query:",oD(t)),this.Gi.getDocumentsMatchingQuery(e,t,wT.min(),n)}Xi(e,t,n,i){return this.Gi.getDocumentsMatchingQuery(e,n,i).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}}class kA{constructor(e,t,n,i){this.persistence=e,this.es=t,this.serializer=i,this.ts=new BT(cT),this.ns=new uD((e=>$k(e)),Wk),this.rs=new Map,this.ss=e.getRemoteDocumentCache(),this.qr=e.getTargetCache(),this.Kr=e.getBundleCache(),this.os(n)}os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new pA(this.ss,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ss.setIndexManager(this.indexManager),this.es.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.ts)))}}function DA(e,t,n,i){return new kA(e,t,n,i)}async function OA(e,t){const n=QI(e);return await n.persistence.runTransaction("Handle user change","readonly",(e=>{let i;return n.mutationQueue.getAllMutationBatches(e).next((r=>(i=r,n.os(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{const r=[],o=[];let s=wD();for(const e of i){r.push(e.batchId);for(const t of e.mutations)s=s.add(t.key)}for(const e of t){o.push(e.batchId);for(const t of e.mutations)s=s.add(t.key)}return n.localDocuments.getDocuments(e,s).next((e=>({_s:e,removedBatchIds:r,addedBatchIds:o})))}))}))}function AA(e){const t=QI(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(e=>t.qr.getLastRemoteSnapshotVersion(e)))}function RA(e,t,n){let i=wD(),r=wD();return n.forEach((e=>i=i.add(e))),t.getEntries(e,i).next((e=>{let i=dD();return n.forEach(((n,o)=>{const s=e.get(n);o.isFoundDocument()!==s.isFoundDocument()&&(r=r.add(n)),o.isNoDocument()&&o.version.isEqual(dT.min())?(t.removeEntry(n,o.readTime),i=i.insert(n,o)):!s.isValidDocument()||o.version.compareTo(s.version)>0||0===o.version.compareTo(s.version)&&s.hasPendingWrites?(t.addEntry(o),i=i.insert(n,o)):jI("LocalStore","Ignoring outdated watch update for ",n,". Current version:",s.version," Watch version:",o.version)})),{us:i,cs:r}}))}function PA(e,t){const n=QI(e);return n.persistence.runTransaction("Get next mutation batch","readonly",(e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t))))}function NA(e,t){const n=QI(e);return n.persistence.runTransaction("Allocate target","readwrite",(e=>{let i;return n.qr.getTargetData(e,t).next((r=>r?(i=r,IT.resolve(i)):n.qr.allocateTargetId(e).next((r=>(i=new iA(t,r,"TargetPurposeListen",e.currentSequenceNumber),n.qr.addTargetData(e,i).next((()=>i)))))))})).then((e=>{const i=n.ts.get(e.targetId);return(null===i||e.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.ts=n.ts.insert(e.targetId,e),n.ns.set(t,e.targetId)),e}))}async function MA(e,t,n){const i=QI(e),r=i.ts.get(t),o=n?"readwrite":"readwrite-primary";try{n||await i.persistence.runTransaction("Release target",o,(e=>i.persistence.referenceDelegate.removeTarget(e,r)))}catch(e){if(!TT(e))throw e;jI("LocalStore","Failed to update sequence numbers for target ".concat(t,": ").concat(e))}i.ts=i.ts.remove(t),i.ns.delete(r.target)}function LA(e,t,n){const i=QI(e);let r=dT.min(),o=wD();return i.persistence.runTransaction("Execute query","readwrite",(e=>function(e,t,n){const i=QI(e),r=i.ns.get(n);return void 0!==r?IT.resolve(i.ts.get(r)):i.qr.getTargetData(t,n)}(i,e,Zk(t)).next((t=>{if(t)return r=t.lastLimboFreeSnapshotVersion,i.qr.getMatchingKeysForTargetId(e,t.targetId).next((e=>{o=e}))})).next((()=>i.es.getDocumentsMatchingQuery(e,t,n?r:dT.min(),n?o:wD()))).next((e=>(FA(i,aD(t),e),{documents:e,ls:o})))))}function FA(e,t,n){let i=e.rs.get(t)||dT.min();n.forEach(((e,t)=>{t.readTime.compareTo(i)>0&&(i=t.readTime)})),e.rs.set(t,i)}class BA{constructor(){this.activeTargetIds=SD()}ds(e){this.activeTargetIds=this.activeTargetIds.add(e)}As(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Es(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class VA{constructor(){this.eo=new BA,this.no={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return this.eo.ds(e),this.no[e]||"not-current"}updateQueryState(e,t,n){this.no[e]=t}removeLocalQueryTarget(e){this.eo.As(e)}isLocalQueryTarget(e){return this.eo.activeTargetIds.has(e)}clearQueryState(e){delete this.no[e]}getAllActiveQueryTargets(){return this.eo.activeTargetIds}isActiveQueryTarget(e){return this.eo.activeTargetIds.has(e)}start(){return this.eo=new BA,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class HA{ro(e){}shutdown(){}}class UA{constructor(){this.io=()=>this.so(),this.oo=()=>this._o(),this.ao=[],this.uo()}ro(e){this.ao.push(e)}shutdown(){window.removeEventListener("online",this.io),window.removeEventListener("offline",this.oo)}uo(){window.addEventListener("online",this.io),window.addEventListener("offline",this.oo)}so(){jI("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ao)e(0)}_o(){jI("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.ao)e(1)}static D(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let zA=null;function jA(){return null===zA?zA=268435456+Math.round(2147483648*Math.random()):zA++,"0x"+zA.toString(16)}const $A={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class WA{constructor(e){this.co=e.co,this.lo=e.lo}ho(e){this.Po=e}Io(e){this.To=e}onMessage(e){this.Eo=e}close(){this.lo()}send(e){this.co(e)}Ao(){this.Po()}Ro(e){this.To(e)}Vo(e){this.Eo(e)}}const GA="WebChannelConnection";class KA extends class{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.mo=t+"://"+e.host,this.fo="projects/".concat(n,"/databases/").concat(i),this.po="(default)"===this.databaseId.database?"project_id=".concat(n):"project_id=".concat(n,"&database_id=").concat(i)}get yo(){return!1}wo(e,t,n,i,r){const o=jA(),s=this.So(e,t);jI("RestConnection","Sending RPC '".concat(e,"' ").concat(o,":"),s,n);const a={"google-cloud-resource-prefix":this.fo,"x-goog-request-params":this.po};return this.bo(a,i,r),this.Do(e,s,a,n).then((t=>(jI("RestConnection","Received RPC '".concat(e,"' ").concat(o,": "),t),t)),(t=>{throw WI("RestConnection","RPC '".concat(e,"' ").concat(o," failed with error: "),t,"url: ",s,"request:",n),t}))}Co(e,t,n,i,r,o){return this.wo(e,t,n,i,r)}bo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+HI,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}So(e,t){const n=$A[e];return"".concat(this.mo,"/v1/").concat(t,":").concat(n)}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Do(e,t,n,i){const r=jA();return new Promise(((o,s)=>{const a=new MI;a.setWithCredentials(!0),a.listenOnce(AI.COMPLETE,(()=>{try{switch(a.getLastErrorCode()){case OI.NO_ERROR:const t=a.getResponseJson();jI(GA,"XHR for RPC '".concat(e,"' ").concat(r," received:"),JSON.stringify(t)),o(t);break;case OI.TIMEOUT:jI(GA,"RPC '".concat(e,"' ").concat(r," timed out")),s(new YI(XI.DEADLINE_EXCEEDED,"Request time out"));break;case OI.HTTP_ERROR:const n=a.getStatus();if(jI(GA,"RPC '".concat(e,"' ").concat(r," failed with status:"),n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=null==e?void 0:e.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(XI).indexOf(t)>=0?t:XI.UNKNOWN}(t.status);s(new YI(e,t.message))}else s(new YI(XI.UNKNOWN,"Server responded with status "+a.getStatus()))}else s(new YI(XI.UNAVAILABLE,"Connection failed."));break;default:KI()}}finally{jI(GA,"RPC '".concat(e,"' ").concat(r," completed."))}}));const l=JSON.stringify(i);jI(GA,"RPC '".concat(e,"' ").concat(r," sending request:"),i),a.send(t,"POST",l,n,15)}))}vo(e,t,n){const i=jA(),r=[this.mo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=kI(),s=DI(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/".concat(this.databaseId.projectId,"/databases/").concat(this.databaseId.database)},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},l=this.longPollingOptions.timeoutSeconds;void 0!==l&&(a.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(a.useFetchStreams=!0),this.bo(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const c=r.join("");jI(GA,"Creating RPC '".concat(e,"' stream ").concat(i,": ").concat(c),a);const u=o.createWebChannel(c,a);let h=!1,d=!1;const p=new WA({co:t=>{d?jI(GA,"Not sending because RPC '".concat(e,"' stream ").concat(i," is closed:"),t):(h||(jI(GA,"Opening RPC '".concat(e,"' stream ").concat(i," transport.")),u.open(),h=!0),jI(GA,"RPC '".concat(e,"' stream ").concat(i," sending:"),t),u.send(t))},lo:()=>u.close()}),f=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))};return f(u,NI.EventType.OPEN,(()=>{d||jI(GA,"RPC '".concat(e,"' stream ").concat(i," transport opened."))})),f(u,NI.EventType.CLOSE,(()=>{d||(d=!0,jI(GA,"RPC '".concat(e,"' stream ").concat(i," transport closed")),p.Ro())})),f(u,NI.EventType.ERROR,(t=>{d||(d=!0,WI(GA,"RPC '".concat(e,"' stream ").concat(i," transport errored:"),t),p.Ro(new YI(XI.UNAVAILABLE,"The operation could not be completed")))})),f(u,NI.EventType.MESSAGE,(t=>{var n;if(!d){const r=t.data[0];qI(!!r);const o=r,s=o.error||(null===(n=o[0])||void 0===n?void 0:n.error);if(s){jI(GA,"RPC '".concat(e,"' stream ").concat(i," received error:"),s);const t=s.status;let n=function(e){const t=sO[e];if(void 0!==t)return cO(t)}(t),r=s.message;void 0===n&&(n=XI.INTERNAL,r="Unknown error status: "+t+" with message "+s.message),d=!0,p.Ro(new YI(n,r)),u.close()}else jI(GA,"RPC '".concat(e,"' stream ").concat(i," received:"),r),p.Vo(r)}})),f(s,RI.STAT_EVENT,(t=>{t.stat===PI.PROXY?jI(GA,"RPC '".concat(e,"' stream ").concat(i," detected buffering proxy")):t.stat===PI.NOPROXY&&jI(GA,"RPC '".concat(e,"' stream ").concat(i," detected no buffering proxy"))})),setTimeout((()=>{p.Ao()}),0),p}}function qA(){return"undefined"!=typeof document?document:null}function QA(e){return new DO(e,!0)}class XA{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.5,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6e4;this.si=e,this.timerId=t,this.Fo=n,this.Mo=i,this.xo=r,this.Oo=0,this.No=null,this.Bo=Date.now(),this.reset()}reset(){this.Oo=0}Lo(){this.Oo=this.xo}ko(e){this.cancel();const t=Math.floor(this.Oo+this.qo()),n=Math.max(0,Date.now()-this.Bo),i=Math.max(0,t-n);i>0&&jI("ExponentialBackoff","Backing off for ".concat(i," ms (base delay: ").concat(this.Oo," ms, delay with jitter: ").concat(t," ms, last attempt: ").concat(n," ms ago)")),this.No=this.si.enqueueAfterDelay(this.timerId,i,(()=>(this.Bo=Date.now(),e()))),this.Oo*=this.Mo,this.Oothis.xo&&(this.Oo=this.xo)}Qo(){null!==this.No&&(this.No.skipDelay(),this.No=null)}cancel(){null!==this.No&&(this.No.cancel(),this.No=null)}qo(){return(Math.random()-.5)*this.Oo}}class YA{constructor(e,t,n,i,r,o,s,a){this.si=e,this.Ko=n,this.$o=i,this.connection=r,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=s,this.listener=a,this.state=0,this.Uo=0,this.Wo=null,this.Go=null,this.stream=null,this.zo=new XA(e,t)}jo(){return 1===this.state||5===this.state||this.Ho()}Ho(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Jo()}async stop(){this.jo()&&await this.close(0)}Yo(){this.state=0,this.zo.reset()}Zo(){this.Ho()&&null===this.Wo&&(this.Wo=this.si.enqueueAfterDelay(this.Ko,6e4,(()=>this.Xo())))}e_(e){this.t_(),this.stream.send(e)}async Xo(){if(this.Ho())return this.close(0)}t_(){this.Wo&&(this.Wo.cancel(),this.Wo=null)}n_(){this.Go&&(this.Go.cancel(),this.Go=null)}async close(e,t){this.t_(),this.n_(),this.zo.cancel(),this.Uo++,4!==e?this.zo.reset():t&&t.code===XI.RESOURCE_EXHAUSTED?($I(t.toString()),$I("Using maximum backoff delay to prevent overloading the backend."),this.zo.Lo()):t&&t.code===XI.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.r_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Io(t)}r_(){}auth(){this.state=1;const e=this.i_(this.Uo),t=this.Uo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((e=>{let[n,i]=e;this.Uo===t&&this.s_(n,i)}),(t=>{e((()=>{const e=new YI(XI.UNKNOWN,"Fetching auth token failed: "+t.message);return this.o_(e)}))}))}s_(e,t){const n=this.i_(this.Uo);this.stream=this.__(e,t),this.stream.ho((()=>{n((()=>(this.state=2,this.Go=this.si.enqueueAfterDelay(this.$o,1e4,(()=>(this.Ho()&&(this.state=3),Promise.resolve()))),this.listener.ho())))})),this.stream.Io((e=>{n((()=>this.o_(e)))})),this.stream.onMessage((e=>{n((()=>this.onMessage(e)))}))}Jo(){this.state=5,this.zo.ko((async()=>{this.state=0,this.start()}))}o_(e){return jI("PersistentStream","close with error: ".concat(e)),this.stream=null,this.close(4,e)}i_(e){return t=>{this.si.enqueueAndForget((()=>this.Uo===e?t():(jI("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class JA extends YA{constructor(e,t,n,i,r,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,o),this.serializer=r}__(e,t){return this.connection.vo("Listen",e,t)}onMessage(e){this.zo.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const i=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:KI()}(t.targetChange.targetChangeType||"NO_CHANGE"),r=t.targetChange.targetIds||[],o=function(e,t){return e.useProto3Json?(qI(void 0===t||"string"==typeof t),WT.fromBase64String(t||"")):(qI(void 0===t||t instanceof Uint8Array),WT.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),s=t.targetChange.cause,a=s&&function(e){const t=void 0===e.code?XI.UNKNOWN:cO(e.code);return new YI(t,e.message||"")}(s);n=new wO(i,r,o,a||null)}else if("documentChange"in t){t.documentChange;const i=t.documentChange;i.document,i.document.name,i.document.updateTime;const r=BO(e,i.document.name),o=NO(i.document.updateTime),s=i.document.createTime?NO(i.document.createTime):dT.min(),a=new vk({mapValue:{fields:i.document.fields}}),l=yk.newFoundDocument(r,o,s,a),c=i.targetIds||[],u=i.removedTargetIds||[];n=new yO(c,u,l.key,l)}else if("documentDelete"in t){t.documentDelete;const i=t.documentDelete;i.document;const r=BO(e,i.document),o=i.readTime?NO(i.readTime):dT.min(),s=yk.newNoDocument(r,o),a=i.removedTargetIds||[];n=new yO([],a,s.key,s)}else if("documentRemove"in t){t.documentRemove;const i=t.documentRemove;i.document;const r=BO(e,i.document),o=i.removedTargetIds||[];n=new yO([],o,r,null)}else{if(!("filter"in t))return KI();{t.filter;const e=t.filter;e.targetId;const{count:i=0,unchangedNames:r}=e,o=new oO(i,r),s=e.targetId;n=new bO(s,o)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return dT.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?dT.min():t.readTime?NO(t.readTime):dT.min()}(e);return this.listener.a_(t,n)}u_(e){const t={};t.database=UO(this.serializer),t.addTarget=function(e,t){let n;const i=t.target;if(n=Gk(i)?{documents:WO(e,i)}:{query:GO(e,i)},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=RO(e,t.resumeToken);const i=OO(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(dT.min())>0){n.readTime=AO(e,t.snapshotVersion.toTimestamp());const i=OO(e,t.expectedCount);null!==i&&(n.expectedCount=i)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return KI()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.e_(t)}c_(e){const t={};t.database=UO(this.serializer),t.removeTarget=e,this.e_(t)}}class ZA extends YA{constructor(e,t,n,i,r,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,o),this.serializer=r,this.l_=!1}get h_(){return this.l_}start(){this.l_=!1,this.lastStreamToken=void 0,super.start()}r_(){this.l_&&this.P_([])}__(e,t){return this.connection.vo("Write",e,t)}onMessage(e){if(qI(!!e.streamToken),this.lastStreamToken=e.streamToken,this.l_){this.zo.reset();const t=function(e,t){return e&&e.length>0?(qI(void 0!==t),e.map((e=>function(e,t){let n=e.updateTime?NO(e.updateTime):NO(t);return n.isEqual(dT.min())&&(n=NO(t)),new HD(n,e.transformResults||[])}(e,t)))):[]}(e.writeResults,e.commitTime),n=NO(e.commitTime);return this.listener.I_(n,t)}return qI(!e.writeResults||0===e.writeResults.length),this.l_=!0,this.listener.T_()}E_(){const e={};e.database=UO(this.serializer),this.e_(e)}P_(e){const t={streamToken:this.lastStreamToken,writes:e.map((e=>$O(this.serializer,e)))};this.e_(t)}}class eR extends class{}{constructor(e,t,n,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=i,this.d_=!1}A_(){if(this.d_)throw new YI(XI.FAILED_PRECONDITION,"The client has already been terminated.")}wo(e,t,n){return this.A_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((i=>{let[r,o]=i;return this.connection.wo(e,t,n,r,o)})).catch((e=>{throw"FirebaseError"===e.name?(e.code===XI.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new YI(XI.UNKNOWN,e.toString())}))}Co(e,t,n,i){return this.A_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((r=>{let[o,s]=r;return this.connection.Co(e,t,n,o,s,i)})).catch((e=>{throw"FirebaseError"===e.name?(e.code===XI.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new YI(XI.UNKNOWN,e.toString())}))}terminate(){this.d_=!0}}class tR{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.V_=0,this.m_=null,this.f_=!0}g_(){0===this.V_&&(this.p_("Unknown"),this.m_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.m_=null,this.y_("Backend didn't respond within 10 seconds."),this.p_("Offline"),Promise.resolve()))))}w_(e){"Online"===this.state?this.p_("Unknown"):(this.V_++,this.V_>=1&&(this.S_(),this.y_("Connection failed 1 times. Most recent error: ".concat(e.toString())),this.p_("Offline")))}set(e){this.S_(),this.V_=0,"Online"===e&&(this.f_=!1),this.p_(e)}p_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}y_(e){const t="Could not reach Cloud Firestore backend. ".concat(e,"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.");this.f_?($I(t),this.f_=!1):jI("OnlineStateTracker",t)}S_(){null!==this.m_&&(this.m_.cancel(),this.m_=null)}}class nR{constructor(e,t,n,i,r){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.b_=[],this.D_=new Map,this.C_=new Set,this.v_=[],this.F_=r,this.F_.ro((e=>{n.enqueueAndForget((async()=>{hR(this)&&(jI("RemoteStore","Restarting streams for network reachability change."),await async function(e){const t=QI(e);t.C_.add(4),await rR(t),t.M_.set("Unknown"),t.C_.delete(4),await iR(t)}(this))}))})),this.M_=new tR(n,i)}}async function iR(e){if(hR(e))for(const t of e.v_)await t(!0)}async function rR(e){for(const t of e.v_)await t(!1)}function oR(e,t){const n=QI(e);n.D_.has(t.targetId)||(n.D_.set(t.targetId,t),uR(n)?cR(n):DR(n).Ho()&&aR(n,t))}function sR(e,t){const n=QI(e),i=DR(n);n.D_.delete(t),i.Ho()&&lR(n,t),0===n.D_.size&&(i.Ho()?i.Zo():hR(n)&&n.M_.set("Unknown"))}function aR(e,t){if(e.x_.Oe(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(dT.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}DR(e).u_(t)}function lR(e,t){e.x_.Oe(t),DR(e).c_(t)}function cR(e){e.x_=new SO({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),_t:t=>e.D_.get(t)||null,nt:()=>e.datastore.serializer.databaseId}),DR(e).start(),e.M_.g_()}function uR(e){return hR(e)&&!DR(e).jo()&&e.D_.size>0}function hR(e){return 0===QI(e).C_.size}function dR(e){e.x_=void 0}async function pR(e){e.D_.forEach(((t,n)=>{aR(e,t)}))}async function fR(e,t){dR(e),uR(e)?(e.M_.w_(t),cR(e)):e.M_.set("Unknown")}async function mR(e,t,n){if(e.M_.set("Online"),t instanceof wO&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const i of t.targetIds)e.D_.has(i)&&(await e.remoteSyncer.rejectListen(i,n),e.D_.delete(i),e.x_.removeTarget(i))}(e,t)}catch(n){jI("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),n),await gR(e,n)}else if(t instanceof yO?e.x_.$e(t):t instanceof bO?e.x_.Je(t):e.x_.Ge(t),!n.isEqual(dT.min()))try{const t=await AA(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.x_.it(t);return n.targetChanges.forEach(((n,i)=>{if(n.resumeToken.approximateByteSize()>0){const r=e.D_.get(i);r&&e.D_.set(i,r.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{const i=e.D_.get(t);if(!i)return;e.D_.set(t,i.withResumeToken(WT.EMPTY_BYTE_STRING,i.snapshotVersion)),lR(e,t);const r=new iA(i.target,t,n,i.sequenceNumber);aR(e,r)})),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){jI("RemoteStore","Failed to raise snapshot:",t),await gR(e,t)}}async function gR(e,t,n){if(!TT(t))throw t;e.C_.add(1),await rR(e),e.M_.set("Offline"),n||(n=()=>AA(e.localStore)),e.asyncQueue.enqueueRetryable((async()=>{jI("RemoteStore","Retrying IndexedDB access"),await n(),e.C_.delete(1),await iR(e)}))}function vR(e,t){return t().catch((n=>gR(e,n,t)))}async function _R(e){const t=QI(e),n=OR(t);let i=t.b_.length>0?t.b_[t.b_.length-1].batchId:-1;for(;yR(t);)try{const e=await PA(t.localStore,i);if(null===e){0===t.b_.length&&n.Zo();break}i=e.batchId,bR(t,e)}catch(e){await gR(t,e)}wR(t)&&CR(t)}function yR(e){return hR(e)&&e.b_.length<10}function bR(e,t){e.b_.push(t);const n=OR(e);n.Ho()&&n.h_&&n.P_(t.mutations)}function wR(e){return hR(e)&&!OR(e).jo()&&e.b_.length>0}function CR(e){OR(e).start()}async function SR(e){OR(e).E_()}async function xR(e){const t=OR(e);for(const n of e.b_)t.P_(n.mutations)}async function ER(e,t,n){const i=e.b_.shift(),r=iO.from(i,t,n);await vR(e,(()=>e.remoteSyncer.applySuccessfulWrite(r))),await _R(e)}async function IR(e,t){t&&OR(e).h_&&await async function(e,t){if(function(e){return lO(e)&&e!==XI.ABORTED}(t.code)){const n=e.b_.shift();OR(e).Yo(),await vR(e,(()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t))),await _R(e)}}(e,t),wR(e)&&CR(e)}async function TR(e,t){const n=QI(e);n.asyncQueue.verifyOperationInProgress(),jI("RemoteStore","RemoteStore received new credentials");const i=hR(n);n.C_.add(3),await rR(n),i&&n.M_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.C_.delete(3),await iR(n)}async function kR(e,t){const n=QI(e);t?(n.C_.delete(2),await iR(n)):t||(n.C_.add(2),await rR(n),n.M_.set("Unknown"))}function DR(e){return e.O_||(e.O_=function(e,t,n){const i=QI(e);return i.A_(),new JA(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)}(e.datastore,e.asyncQueue,{ho:pR.bind(null,e),Io:fR.bind(null,e),a_:mR.bind(null,e)}),e.v_.push((async t=>{t?(e.O_.Yo(),uR(e)?cR(e):e.M_.set("Unknown")):(await e.O_.stop(),dR(e))}))),e.O_}function OR(e){return e.N_||(e.N_=function(e,t,n){const i=QI(e);return i.A_(),new ZA(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)}(e.datastore,e.asyncQueue,{ho:SR.bind(null,e),Io:IR.bind(null,e),T_:xR.bind(null,e),I_:ER.bind(null,e)}),e.v_.push((async t=>{t?(e.N_.Yo(),await _R(e)):(await e.N_.stop(),e.b_.length>0&&(jI("RemoteStore","Stopping write stream with ".concat(e.b_.length," pending writes")),e.b_=[]))}))),e.N_}class AR{constructor(e,t,n,i,r){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=r,this.deferred=new JI,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,i,r){const o=Date.now()+n,s=new AR(e,t,o,i,r);return s.start(n),s}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new YI(XI.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function RR(e,t){if($I("AsyncQueue","".concat(t,": ").concat(e)),TT(e))return new YI(XI.UNAVAILABLE,"".concat(t,": ").concat(e));throw e}class PR{constructor(e){this.comparator=e?(t,n)=>e(t,n)||vT.comparator(t.key,n.key):(e,t)=>vT.comparator(e.key,t.key),this.keyedMap=fD(),this.sortedSet=new BT(this.comparator)}static emptySet(e){return new PR(e.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,n)=>(e(t),!1)))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof PR))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,i=n.getNext().key;if(!e.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach((t=>{e.push(t.toString())})),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new PR;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class NR{constructor(){this.B_=new BT(vT.comparator)}track(e){const t=e.doc.key,n=this.B_.get(t);n?0!==e.type&&3===n.type?this.B_=this.B_.insert(t,e):3===e.type&&1!==n.type?this.B_=this.B_.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.B_=this.B_.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.B_=this.B_.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.B_=this.B_.remove(t):1===e.type&&2===n.type?this.B_=this.B_.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.B_=this.B_.insert(t,{type:2,doc:e.doc}):KI():this.B_=this.B_.insert(t,e)}L_(){const e=[];return this.B_.inorderTraversal(((t,n)=>{e.push(n)})),e}}class MR{constructor(e,t,n,i,r,o,s,a,l){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=r,this.fromCache=o,this.syncStateChanged=s,this.excludesMetadataChanges=a,this.hasCachedResults=l}static fromInitialDocuments(e,t,n,i,r){const o=[];return t.forEach((e=>{o.push({type:0,doc:e})})),new MR(e,t,PR.emptySet(t),o,n,i,!0,!1,r)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&iD(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let i=0;irD(e)),iD),this.onlineState="Unknown",this.q_=new Set}}async function BR(e,t){const n=QI(e),i=t.query;let r=!1,o=n.queries.get(i);if(o||(r=!0,o=new LR),r)try{o.k_=await n.onListen(i)}catch(e){const n=RR(e,"Initialization of query '".concat(oD(t.query),"' failed"));return void t.onError(n)}n.queries.set(i,o),o.listeners.push(t),t.Q_(n.onlineState),o.k_&&t.K_(o.k_)&&zR(n)}async function VR(e,t){const n=QI(e),i=t.query;let r=!1;const o=n.queries.get(i);if(o){const e=o.listeners.indexOf(t);e>=0&&(o.listeners.splice(e,1),r=0===o.listeners.length)}if(r)return n.queries.delete(i),n.onUnlisten(i)}function HR(e,t){const n=QI(e);let i=!1;for(const r of t){const e=r.query,t=n.queries.get(e);if(t){for(const e of t.listeners)e.K_(r)&&(i=!0);t.k_=r}}i&&zR(n)}function UR(e,t,n){const i=QI(e),r=i.queries.get(t);if(r)for(const o of r.listeners)o.onError(n);i.queries.delete(t)}function zR(e){e.q_.forEach((e=>{e.next()}))}class jR{constructor(e,t,n){this.query=e,this.U_=t,this.W_=!1,this.G_=null,this.onlineState="Unknown",this.options=n||{}}K_(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new MR(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.W_?this.z_(e)&&(this.U_.next(e),t=!0):this.j_(e,this.onlineState)&&(this.H_(e),t=!0),this.G_=e,t}onError(e){this.U_.error(e)}Q_(e){this.onlineState=e;let t=!1;return this.G_&&!this.W_&&this.j_(this.G_,e)&&(this.H_(this.G_),t=!0),t}j_(e,t){if(!e.fromCache)return!0;const n="Offline"!==t;return(!this.options.J_||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}z_(e){if(e.docChanges.length>0)return!0;const t=this.G_&&this.G_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}H_(e){e=MR.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.W_=!0,this.U_.next(e)}}class $R{constructor(e){this.key=e}}class WR{constructor(e){this.key=e}}class GR{constructor(e,t){this.query=e,this.ia=t,this.sa=null,this.hasCachedResults=!1,this.current=!1,this.oa=wD(),this.mutatedKeys=wD(),this._a=lD(e),this.aa=new PR(this._a)}get ua(){return this.ia}ca(e,t){const n=t?t.la:new NR,i=t?t.aa:this.aa;let r=t?t.mutatedKeys:this.mutatedKeys,o=i,s=!1;const a="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,l="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal(((e,t)=>{const c=i.get(e),u=sD(this.query,t)?t:null,h=!!c&&this.mutatedKeys.has(c.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let p=!1;c&&u?c.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),p=!0):this.ha(c,u)||(n.track({type:2,doc:u}),p=!0,(a&&this._a(u,a)>0||l&&this._a(u,l)<0)&&(s=!0)):!c&&u?(n.track({type:0,doc:u}),p=!0):c&&!u&&(n.track({type:1,doc:c}),p=!0,(a||l)&&(s=!0)),p&&(u?(o=o.add(u),r=d?r.add(e):r.delete(e)):(o=o.delete(e),r=r.delete(e)))})),null!==this.query.limit)for(;o.size>this.query.limit;){const e="F"===this.query.limitType?o.last():o.first();o=o.delete(e.key),r=r.delete(e.key),n.track({type:1,doc:e})}return{aa:o,la:n,Zi:s,mutatedKeys:r}}ha(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,i){const r=this.aa;this.aa=e.aa,this.mutatedKeys=e.mutatedKeys;const o=e.la.L_();o.sort(((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return KI()}};return n(e)-n(t)}(e.type,t.type)||this._a(e.doc,t.doc))),this.Pa(n),i=null!=i&&i;const s=t&&!i?this.Ia():[],a=0===this.oa.size&&this.current&&!i?1:0,l=a!==this.sa;return this.sa=a,0!==o.length||l?{snapshot:new MR(this.query,e.aa,r,o,e.mutatedKeys,0===a,l,!1,!!n&&n.resumeToken.approximateByteSize()>0),Ta:s}:{Ta:s}}Q_(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({aa:this.aa,la:new NR,mutatedKeys:this.mutatedKeys,Zi:!1},!1)):{Ta:[]}}Ea(e){return!this.ia.has(e)&&!!this.aa.has(e)&&!this.aa.get(e).hasLocalMutations}Pa(e){e&&(e.addedDocuments.forEach((e=>this.ia=this.ia.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.ia=this.ia.delete(e))),this.current=e.current)}Ia(){if(!this.current)return[];const e=this.oa;this.oa=wD(),this.aa.forEach((e=>{this.Ea(e.key)&&(this.oa=this.oa.add(e.key))}));const t=[];return e.forEach((e=>{this.oa.has(e)||t.push(new WR(e))})),this.oa.forEach((n=>{e.has(n)||t.push(new $R(n))})),t}da(e){this.ia=e.ls,this.oa=wD();const t=this.ca(e.documents);return this.applyChanges(t,!0)}Aa(){return MR.fromInitialDocuments(this.query,this.aa,this.mutatedKeys,0===this.sa,this.hasCachedResults)}}class KR{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class qR{constructor(e){this.key=e,this.Ra=!1}}class QR{constructor(e,t,n,i,r,o){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=r,this.maxConcurrentLimboResolutions=o,this.Va={},this.ma=new uD((e=>rD(e)),iD),this.fa=new Map,this.ga=new Set,this.pa=new BT(vT.comparator),this.ya=new Map,this.wa=new gA,this.Sa={},this.ba=new Map,this.Da=uA.Nn(),this.onlineState="Unknown",this.Ca=void 0}get isPrimaryClient(){return!0===this.Ca}}async function XR(e,t){const n=fP(e);let i,r;const o=n.ma.get(t);if(o)i=o.targetId,n.sharedClientState.addLocalQueryTarget(i),r=o.view.Aa();else{const e=await NA(n.localStore,Zk(t)),o=n.sharedClientState.addLocalQueryTarget(e.targetId);i=e.targetId,r=await YR(n,t,i,"current"===o,e.resumeToken),n.isPrimaryClient&&oR(n.remoteStore,e)}return r}async function YR(e,t,n,i,r){e.va=(t,n,i)=>async function(e,t,n,i){let r=t.view.ca(n);r.Zi&&(r=await LA(e.localStore,t.query,!1).then((e=>{let{documents:n}=e;return t.view.ca(n,r)})));const o=i&&i.targetChanges.get(t.targetId),s=i&&null!=i.targetMismatches.get(t.targetId),a=t.view.applyChanges(r,e.isPrimaryClient,o,s);return lP(e,t.targetId,a.Ta),a.snapshot}(e,t,n,i);const o=await LA(e.localStore,t,!0),s=new GR(t,o.ls),a=s.ca(o.documents),l=_O.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==e.onlineState,r),c=s.applyChanges(a,e.isPrimaryClient,l);lP(e,n,c.Ta);const u=new KR(t,n,s);return e.ma.set(t,u),e.fa.has(n)?e.fa.get(n).push(t):e.fa.set(n,[t]),c.snapshot}async function JR(e,t){const n=QI(e),i=n.ma.get(t),r=n.fa.get(i.targetId);if(r.length>1)return n.fa.set(i.targetId,r.filter((e=>!iD(e,t)))),void n.ma.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(i.targetId),n.sharedClientState.isActiveQueryTarget(i.targetId)||await MA(n.localStore,i.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(i.targetId),sR(n.remoteStore,i.targetId),sP(n,i.targetId)})).catch(ET)):(sP(n,i.targetId),await MA(n.localStore,i.targetId,!0))}async function ZR(e,t){const n=QI(e);try{const e=await function(e,t){const n=QI(e),i=t.snapshotVersion;let r=n.ts;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(e=>{const o=n.ss.newChangeBuffer({trackRemovals:!0});r=n.ts;const s=[];t.targetChanges.forEach(((o,a)=>{const l=r.get(a);if(!l)return;s.push(n.qr.removeMatchingKeys(e,o.removedDocuments,a).next((()=>n.qr.addMatchingKeys(e,o.addedDocuments,a))));let c=l.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?c=c.withResumeToken(WT.EMPTY_BYTE_STRING,dT.min()).withLastLimboFreeSnapshotVersion(dT.min()):o.resumeToken.approximateByteSize()>0&&(c=c.withResumeToken(o.resumeToken,i)),r=r.insert(a,c),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(l,c,o)&&s.push(n.qr.updateTargetData(e,c))}));let a=dD(),l=wD();if(t.documentUpdates.forEach((i=>{t.resolvedLimboDocuments.has(i)&&s.push(n.persistence.referenceDelegate.updateLimboDocument(e,i))})),s.push(RA(e,o,t.documentUpdates).next((e=>{a=e.us,l=e.cs}))),!i.isEqual(dT.min())){const t=n.qr.getLastRemoteSnapshotVersion(e).next((t=>n.qr.setTargetsMetadata(e,e.currentSequenceNumber,i)));s.push(t)}return IT.waitFor(s).next((()=>o.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,a,l))).next((()=>a))})).then((e=>(n.ts=r,e)))}(n.localStore,t);t.targetChanges.forEach(((e,t)=>{const i=n.ya.get(t);i&&(qI(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?i.Ra=!0:e.modifiedDocuments.size>0?qI(i.Ra):e.removedDocuments.size>0&&(qI(i.Ra),i.Ra=!1))})),await hP(n,e,t)}catch(e){await ET(e)}}function eP(e,t,n){const i=QI(e);if(i.isPrimaryClient&&0===n||!i.isPrimaryClient&&1===n){const e=[];i.ma.forEach(((n,i)=>{const r=i.view.Q_(t);r.snapshot&&e.push(r.snapshot)})),function(e,t){const n=QI(e);n.onlineState=t;let i=!1;n.queries.forEach(((e,n)=>{for(const r of n.listeners)r.Q_(t)&&(i=!0)})),i&&zR(n)}(i.eventManager,t),e.length&&i.Va.a_(e),i.onlineState=t,i.isPrimaryClient&&i.sharedClientState.setOnlineState(t)}}async function tP(e,t,n){const i=QI(e);i.sharedClientState.updateQueryState(t,"rejected",n);const r=i.ya.get(t),o=r&&r.key;if(o){let e=new BT(vT.comparator);e=e.insert(o,yk.newNoDocument(o,dT.min()));const n=wD().add(o),r=new vO(dT.min(),new Map,new BT(cT),e,n);await ZR(i,r),i.pa=i.pa.remove(o),i.ya.delete(t),uP(i)}else await MA(i.localStore,t,!1).then((()=>sP(i,t,n))).catch(ET)}async function nP(e,t){const n=QI(e),i=t.batch.batchId;try{const e=await function(e,t){const n=QI(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(e=>{const i=t.batch.keys(),r=n.ss.newChangeBuffer({trackRemovals:!0});return function(e,t,n,i){const r=n.batch,o=r.keys();let s=IT.resolve();return o.forEach((e=>{s=s.next((()=>i.getEntry(t,e))).next((t=>{const o=n.docVersions.get(e);qI(null!==o),t.version.compareTo(o)<0&&(r.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),i.addEntry(t)))}))})),s.next((()=>e.mutationQueue.removeMutationBatch(t,r)))}(n,e,t,r).next((()=>r.apply(e))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=wD();for(let n=0;n0&&(t=t.add(e.batch.mutations[n].key));return t}(t)))).next((()=>n.localDocuments.getDocuments(e,i)))}))}(n.localStore,t);oP(n,i,null),rP(n,i),n.sharedClientState.updateMutationState(i,"acknowledged"),await hP(n,e)}catch(e){await ET(e)}}async function iP(e,t,n){const i=QI(e);try{const e=await function(e,t){const n=QI(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",(e=>{let i;return n.mutationQueue.lookupMutationBatch(e,t).next((t=>(qI(null!==t),i=t.keys(),n.mutationQueue.removeMutationBatch(e,t)))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,i))).next((()=>n.localDocuments.getDocuments(e,i)))}))}(i.localStore,t);oP(i,t,n),rP(i,t),i.sharedClientState.updateMutationState(t,"rejected",n),await hP(i,e)}catch(n){await ET(n)}}function rP(e,t){(e.ba.get(t)||[]).forEach((e=>{e.resolve()})),e.ba.delete(t)}function oP(e,t,n){const i=QI(e);let r=i.Sa[i.currentUser.toKey()];if(r){const e=r.get(t);e&&(n?e.reject(n):e.resolve(),r=r.remove(t)),i.Sa[i.currentUser.toKey()]=r}}function sP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.sharedClientState.removeLocalQueryTarget(t);for(const i of e.fa.get(t))e.ma.delete(i),n&&e.Va.Fa(i,n);e.fa.delete(t),e.isPrimaryClient&&e.wa.Rr(t).forEach((t=>{e.wa.containsKey(t)||aP(e,t)}))}function aP(e,t){e.ga.delete(t.path.canonicalString());const n=e.pa.get(t);null!==n&&(sR(e.remoteStore,n),e.pa=e.pa.remove(t),e.ya.delete(n),uP(e))}function lP(e,t,n){for(const i of n)i instanceof $R?(e.wa.addReference(i.key,t),cP(e,i)):i instanceof WR?(jI("SyncEngine","Document no longer in limbo: "+i.key),e.wa.removeReference(i.key,t),e.wa.containsKey(i.key)||aP(e,i.key)):KI()}function cP(e,t){const n=t.key,i=n.path.canonicalString();e.pa.get(n)||e.ga.has(i)||(jI("SyncEngine","New document in limbo: "+n),e.ga.add(i),uP(e))}function uP(e){for(;e.ga.size>0&&e.pa.size{s.push(i.va(a,t,n).then((e=>{if((e||n)&&i.isPrimaryClient&&i.sharedClientState.updateQueryState(a.targetId,(null==e?void 0:e.fromCache)?"not-current":"current"),e){r.push(e);const t=EA.Qi(a.targetId,e);o.push(t)}})))})),await Promise.all(s),i.Va.a_(r),await async function(e,t){const n=QI(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(e=>IT.forEach(t,(t=>IT.forEach(t.ki,(i=>n.persistence.referenceDelegate.addReference(e,t.targetId,i))).next((()=>IT.forEach(t.qi,(i=>n.persistence.referenceDelegate.removeReference(e,t.targetId,i)))))))))}catch(e){if(!TT(e))throw e;jI("LocalStore","Failed to update sequence numbers: "+e)}for(const i of t){const e=i.targetId;if(!i.fromCache){const t=n.ts.get(e),i=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(i);n.ts=n.ts.insert(e,r)}}}(i.localStore,o))}async function dP(e,t){const n=QI(e);if(!n.currentUser.isEqual(t)){jI("SyncEngine","User change. New user:",t.toKey());const e=await OA(n.localStore,t);n.currentUser=t,function(e,t){e.ba.forEach((e=>{e.forEach((e=>{e.reject(new YI(XI.CANCELLED,t))}))})),e.ba.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await hP(n,e._s)}}function pP(e,t){const n=QI(e),i=n.ya.get(t);if(i&&i.Ra)return wD().add(i.key);{let e=wD();const i=n.fa.get(t);if(!i)return e;for(const t of i){const i=n.ma.get(t);e=e.unionWith(i.view.ua)}return e}}function fP(e){const t=QI(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=ZR.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=pP.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=tP.bind(null,t),t.Va.a_=HR.bind(null,t.eventManager),t.Va.Fa=UR.bind(null,t.eventManager),t}function mP(e){const t=QI(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=nP.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=iP.bind(null,t),t}class gP{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=QA(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return DA(this.persistence,new TA,e.initialUser,this.serializer)}createPersistence(e){return new CA(xA.jr,this.serializer)}createSharedClientState(e){return new VA}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class vP{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>eP(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=dP.bind(null,this.syncEngine),await kR(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new FR}createDatastore(e){const t=QA(e.databaseInfo.databaseId),n=function(e){return new KA(e)}(e.databaseInfo);return function(e,t,n,i){return new eR(e,t,n,i)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,i,r){return new nR(e,t,n,i,r)}(this.localStore,this.datastore,e.asyncQueue,(e=>eP(this.syncEngine,e,0)),UA.D()?new UA:new HA)}createSyncEngine(e,t){return function(e,t,n,i,r,o,s){const a=new QR(e,t,n,i,r,o);return s&&(a.Ca=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}terminate(){return async function(e){const t=QI(e);jI("RemoteStore","RemoteStore shutting down."),t.C_.add(5),await rR(t),t.F_.shutdown(),t.M_.set("Unknown")}(this.remoteStore)}}class _P{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Oa(this.observer.next,e)}error(e){this.observer.error?this.Oa(this.observer.error,e):$I("Uncaught Error in snapshot listener:",e.toString())}Na(){this.muted=!0}Oa(e,t){this.muted||setTimeout((()=>{this.muted||e(t)}),0)}}class yP{constructor(e,t,n,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=VI.UNAUTHENTICATED,this.clientId=lT.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async e=>{jI("FirestoreClient","Received user=",e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(jI("FirestoreClient","Received new app check token=",e),this.appCheckCredentialListener(e,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new YI(XI.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new JI;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const n=RR(t,"Failed to shutdown persistence");e.reject(n)}})),e.promise}}async function bP(e,t){e.asyncQueue.verifyOperationInProgress(),jI("FirestoreClient","Initializing OfflineComponentProvider");const n=await e.getConfiguration();await t.initialize(n);let i=n.initialUser;e.setCredentialChangeListener((async e=>{i.isEqual(e)||(await OA(t.localStore,e),i=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function wP(e,t){e.asyncQueue.verifyOperationInProgress();const n=await SP(e);jI("FirestoreClient","Initializing OnlineComponentProvider");const i=await e.getConfiguration();await t.initialize(n,i),e.setCredentialChangeListener((e=>TR(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>TR(t.remoteStore,n))),e._onlineComponents=t}function CP(e){return"FirebaseError"===e.name?e.code===XI.FAILED_PRECONDITION||e.code===XI.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}async function SP(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){jI("FirestoreClient","Using user provided OfflineComponentProvider");try{await bP(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!CP(n))throw n;WI("Error using user provided cache. Falling back to memory cache: "+n),await bP(e,new gP)}}else jI("FirestoreClient","Using default OfflineComponentProvider"),await bP(e,new gP);return e._offlineComponents}async function xP(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(jI("FirestoreClient","Using user provided OnlineComponentProvider"),await wP(e,e._uninitializedComponentsProvider._online)):(jI("FirestoreClient","Using default OnlineComponentProvider"),await wP(e,new vP))),e._onlineComponents}function EP(e){return xP(e).then((e=>e.syncEngine))}async function IP(e){const t=await xP(e),n=t.eventManager;return n.onListen=XR.bind(null,t.syncEngine),n.onUnlisten=JR.bind(null,t.syncEngine),n}function TP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=new JI;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,i,r){const o=new _P({next:o=>{t.enqueueAndForget((()=>VR(e,s)));const a=o.docs.has(n);!a&&o.fromCache?r.reject(new YI(XI.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&o.fromCache&&i&&"server"===i.source?r.reject(new YI(XI.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):r.resolve(o)},error:e=>r.reject(e)}),s=new jR(Qk(n.path),o,{includeMetadataChanges:!0,J_:!0});return BR(e,s)}(await IP(e),e.asyncQueue,t,n,i))),i.promise}function kP(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}const DP=new Map;function OP(e,t,n){if(!n)throw new YI(XI.INVALID_ARGUMENT,"Function ".concat(e,"() cannot be called with an empty ").concat(t,"."))}function AP(e){if(!vT.isDocumentKey(e))throw new YI(XI.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but ".concat(e," has ").concat(e.length,"."))}function RP(e){if(vT.isDocumentKey(e))throw new YI(XI.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but ".concat(e," has ").concat(e.length,"."))}function PP(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e="".concat(e.substring(0,20),"...")),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?"a custom ".concat(t," object"):"an object"}}return"function"==typeof e?"a function":KI()}function NP(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new YI(XI.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=PP(e);throw new YI(XI.INVALID_ARGUMENT,"Expected type '".concat(t.name,"', but it was: ").concat(n))}}return e}class MP{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new YI(XI.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=null===(t=e.ssl)||void 0===t||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new YI(XI.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,i){if(!0===t&&!0===i)throw new YI(XI.INVALID_ARGUMENT,"".concat(e," and ").concat(n," cannot be used together."))})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=kP(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new YI(XI.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (must not be NaN)"));if(e.timeoutSeconds<5)throw new YI(XI.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (minimum allowed value is 5)"));if(e.timeoutSeconds>30)throw new YI(XI.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (maximum allowed value is 30)"))}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class LP{constructor(e,t,n,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new MP({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new YI(XI.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new YI(XI.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new MP(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new eT;switch(e.type){case"firstParty":return new rT(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new YI(XI.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=DP.get(e);t&&(jI("ComponentProvider","Removing Datastore"),DP.delete(e),t.terminate())}(this),Promise.resolve()}}class FP{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new FP(this.firestore,e,this._query)}}class BP{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new VP(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new BP(this.firestore,e,this._key)}}class VP extends FP{constructor(e,t,n){super(e,t,Qk(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new BP(this.firestore,null,new vT(e))}withConverter(e){return new VP(this.firestore,e,this._path)}}function HP(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r2?n-2:0),r=2;r{const e=qA();e&&jI("AsyncQueue","Visibility state changed to "+e.visibilityState),this.zo.Qo()};const e=qA();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.iu)}get isShuttingDown(){return this.Za}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.su(),this.ou(e)}enterRestrictedMode(e){if(!this.Za){this.Za=!0,this.nu=e||!1;const t=qA();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.iu)}}enqueue(e){if(this.su(),this.Za)return new Promise((()=>{}));const t=new JI;return this.ou((()=>this.Za&&this.nu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Ya.push(e),this._u())))}async _u(){if(0!==this.Ya.length){try{await this.Ya[0](),this.Ya.shift(),this.zo.reset()}catch(e){if(!TT(e))throw e;jI("AsyncQueue","Operation failed with retryable error: "+e)}this.Ya.length>0&&this.zo.ko((()=>this._u()))}}ou(e){const t=this.Ja.then((()=>(this.tu=!0,e().catch((e=>{this.eu=e,this.tu=!1;const t=function(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}(e);throw $I("INTERNAL UNHANDLED ERROR: ",t),e})).then((e=>(this.tu=!1,e))))));return this.Ja=t,t}enqueueAfterDelay(e,t,n){this.su(),this.ru.indexOf(e)>-1&&(t=0);const i=AR.createAndSchedule(this,e,t,n,(e=>this.au(e)));return this.Xa.push(i),i}su(){this.eu&&KI()}verifyOperationInProgress(){}async uu(){let e;do{e=this.Ja,await e}while(e!==this.Ja)}cu(e){for(const t of this.Xa)if(t.timerId===e)return!0;return!1}lu(e){return this.uu().then((()=>{this.Xa.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(const t of this.Xa)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.uu()}))}hu(e){this.ru.push(e)}au(e){const t=this.Xa.indexOf(e);this.Xa.splice(t,1)}}function jP(e){return function(e,t){if("object"!=typeof e||null===e)return!1;const n=e;for(const i of t)if(i in n&&"function"==typeof n[i])return!0;return!1}(e,["next","error","complete"])}class $P extends LP{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new zP,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||GP(this),this._firestoreClient.terminate()}}function WP(e){return e._firestoreClient||GP(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function GP(e){var t,n,i;const r=e._freezeSettings(),o=function(e,t,n,i){return new ZT(e,t,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,kP(i.experimentalLongPollingOptions),i.useFetchStreams)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,r);e._firestoreClient=new yP(e._authCredentials,e._appCheckCredentials,e._queue,o),(null===(n=r.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(i=r.localCache)||void 0===i?void 0:i._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:r.localCache.kind,_offline:r.localCache._offlineComponentProvider,_online:r.localCache._onlineComponentProvider})}class KP{constructor(e){this._byteString=e}static fromBase64String(e){try{return new KP(WT.fromBase64String(e))}catch(e){throw new YI(XI.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new KP(WT.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}class qP{constructor(){for(var e=arguments.length,t=new Array(e),n=0;n90)throw new YI(XI.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new YI(XI.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return cT(this._lat,e._lat)||cT(this._long,e._long)}}const YP=/^__.*__$/;class JP{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new XD(e,this.data,this.fieldMask,t,this.fieldTransforms):new QD(e,this.data,t,this.fieldTransforms)}}function ZP(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw KI()}}class eN{constructor(e,t,n,i,r,o){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=i,void 0===r&&this.Pu(),this.fieldTransforms=r||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Iu(){return this.settings.Iu}Tu(e){return new eN(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Eu(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Tu({path:n,du:!1});return i.Au(e),i}Ru(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Tu({path:n,du:!1});return i.Pu(),i}Vu(e){return this.Tu({path:void 0,du:!0})}mu(e){return pN(e,this.settings.methodName,this.settings.fu||!1,this.path,this.settings.gu)}contains(e){return void 0!==this.fieldMask.find((t=>e.isPrefixOf(t)))||void 0!==this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))}Pu(){if(this.path)for(let e=0;e3&&void 0!==arguments[3]&&arguments[3];return new eN({Iu:e,methodName:t,gu:n,path:gT.emptyPath(),du:!1,fu:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function nN(e){const t=e._freezeSettings(),n=QA(e._databaseId);return new tN(e._databaseId,!!t.ignoreUndefinedProperties,n)}function iN(e,t,n,i,r){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const s=e.pu(o.merge||o.mergeFields?2:0,t,n,r);cN("Data must be an object, but it was:",s,i);const a=aN(i,s);let l,c;if(o.merge)l=new jT(s.fieldMask),c=s.fieldTransforms;else if(o.mergeFields){const e=[];for(const i of o.mergeFields){const r=uN(t,i,n);if(!s.contains(r))throw new YI(XI.INVALID_ARGUMENT,"Field '".concat(r,"' is specified in your field mask but missing from your input data."));fN(e,r)||e.push(r)}l=new jT(e),c=s.fieldTransforms.filter((e=>l.covers(e.field)))}else l=null,c=s.fieldTransforms;return new JP(new vk(a),l,c)}class rN extends QP{_toFieldTransform(e){return new VD(e.path,new AD)}isEqual(e){return e instanceof rN}}function oN(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return sN(n,e.pu(i?4:3,t))}function sN(e,t){if(lN(e=t_(e)))return cN("Unsupported field value:",t,e),aN(e,t);if(e instanceof QP)return function(e,t){if(!ZP(t.Iu))throw t.mu("".concat(e._methodName,"() can only be used with update() and set()"));if(!t.path)throw t.mu("".concat(e._methodName,"() is not currently supported inside arrays"));const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.du&&4!==t.Iu)throw t.mu("Nested arrays are not supported");return function(e,t){const n=[];let i=0;for(const r of e){let e=sN(r,t.Vu(i));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),i++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=t_(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return ID(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=hT.fromDate(e);return{timestampValue:AO(t.serializer,n)}}if(e instanceof hT){const n=new hT(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:AO(t.serializer,n)}}if(e instanceof XP)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof KP)return{bytesValue:RO(t.serializer,e._byteString)};if(e instanceof BP){const n=t.databaseId,i=e.firestore._databaseId;if(!i.isEqual(n))throw t.mu("Document reference is for database ".concat(i.projectId,"/").concat(i.database," but should be for database ").concat(n.projectId,"/").concat(n.database));return{referenceValue:MO(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t.mu("Unsupported field value: ".concat(PP(e)))}(e,t)}function aN(e,t){const n={};return FT(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):LT(e,((e,i)=>{const r=sN(i,t.Eu(e));null!=r&&(n[e]=r)})),{mapValue:{fields:n}}}function lN(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof hT||e instanceof XP||e instanceof KP||e instanceof BP||e instanceof QP)}function cN(e,t,n){if(!lN(n)||!function(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(n)){const i=PP(n);throw"an object"===i?t.mu(e+" a custom object"):t.mu(e+" "+i)}}function uN(e,t,n){if((t=t_(t))instanceof qP)return t._internalPath;if("string"==typeof t)return dN(e,t);throw pN("Field path arguments must be of type string or ",e,!1,void 0,n)}const hN=new RegExp("[~\\*/\\[\\]]");function dN(e,t,n){if(t.search(hN)>=0)throw pN("Invalid field path (".concat(t,"). Paths must not contain '~', '*', '/', '[', or ']'"),e,!1,void 0,n);try{return new qP(...t.split("."))._internalPath}catch(jm){throw pN("Invalid field path (".concat(t,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"),e,!1,void 0,n)}}function pN(e,t,n,i,r){const o=i&&!i.isEmpty(),s=void 0!==r;let a="Function ".concat(t,"() called with invalid data");n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(o||s)&&(l+=" (found",o&&(l+=" in field ".concat(i)),s&&(l+=" in document ".concat(r)),l+=")"),new YI(XI.INVALID_ARGUMENT,a+e+l)}function fN(e,t){return e.some((e=>e.isEqual(t)))}class mN{constructor(e,t,n,i,r){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=i,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new BP(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new gN(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(vN("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class gN extends mN{data(){return super.data()}}function vN(e,t){return"string"==typeof t?dN(e,t):t instanceof qP?t._internalPath:t._delegate._internalPath}function _N(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new YI(XI.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class yN{}class bN extends yN{}function wN(e,t){let n=[];for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;oe instanceof xN)).length,n=e.filter((e=>e instanceof CN)).length;if(t>1||t>0&&n>0)throw new YI(XI.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(n);for(const s of n)e=s._apply(e);return e}class CN extends bN{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new CN(e,t,n)}_apply(e){const t=this._parse(e);return DN(e._query,t),new FP(e.firestore,e.converter,tD(e._query,t))}_parse(e){const t=nN(e.firestore),n=function(e,t,n,i,r,o,s){let a;if(r.isKeyField()){if("array-contains"===o||"array-contains-any"===o)throw new YI(XI.INVALID_ARGUMENT,"Invalid Query. You can't perform '".concat(o,"' queries on documentId()."));if("in"===o||"not-in"===o){kN(s,o);const t=[];for(const n of s)t.push(TN(i,e,n));a={arrayValue:{values:t}}}else a=TN(i,e,s)}else"in"!==o&&"not-in"!==o&&"array-contains-any"!==o||kN(s,o),a=oN(n,t,s,"in"===o||"not-in"===o);return Ik.create(r,o,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function SN(e,t,n){const i=t,r=vN("where",e);return CN._create(r,i,n)}class xN extends yN{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new xN(e,t)}_parse(e){const t=this._queryConstraints.map((t=>t._parse(e))).filter((e=>e.getFilters().length>0));return 1===t.length?t[0]:Tk.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const i=t.getFlattenedFilters();for(const r of i)DN(n,r),n=tD(n,r)}(e._query,t),new FP(e.firestore,e.converter,tD(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}class EN extends bN{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new EN(e,t)}_apply(e){const t=function(e,t,n){if(null!==e.startAt)throw new YI(XI.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==e.endAt)throw new YI(XI.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Sk(t,n)}(e._query,this._field,this._direction);return new FP(e.firestore,e.converter,function(e,t){const n=e.explicitOrderBy.concat([t]);return new Kk(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(e._query,t))}}function IN(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc",n=vN("orderBy",e);return EN._create(n,t)}function TN(e,t,n){if("string"==typeof(n=t_(n))){if(""===n)throw new YI(XI.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Yk(t)&&-1!==n.indexOf("/"))throw new YI(XI.INVALID_ARGUMENT,"Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '".concat(n,"' contains a '/' character."));const i=t.path.child(fT.fromString(n));if(!vT.isDocumentKey(i))throw new YI(XI.INVALID_ARGUMENT,"Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '".concat(i,"' is not because it has an odd number of segments (").concat(i.length,")."));return ck(e,new vT(i))}if(n instanceof BP)return ck(e,n._key);throw new YI(XI.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ".concat(PP(n),"."))}function kN(e,t){if(!Array.isArray(e)||0===e.length)throw new YI(XI.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '".concat(t.toString(),"' filters."))}function DN(e,t){const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new YI(XI.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '".concat(t.op.toString(),"' filter.")):new YI(XI.INVALID_ARGUMENT,"Invalid query. You cannot use '".concat(t.op.toString(),"' filters with '").concat(n.toString(),"' filters."))}class ON{convertValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";switch(nk(e)){case 0:return null;case 1:return e.booleanValue;case 2:return qT(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(QT(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw KI()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";const n={};return LT(e,((e,i)=>{n[e]=this.convertValue(i,t)})),n}convertGeoPoint(e){return new XP(qT(e.latitude),qT(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const n=YT(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(JT(e));default:return null}}convertTimestamp(e){const t=KT(e);return new hT(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=fT.fromString(e);qI(nA(n));const i=new ek(n.get(1),n.get(3)),r=new vT(n.popFirst(5));return i.isEqual(t)||$I("Document ".concat(r," contains a document reference within a different database (").concat(i.projectId,"/").concat(i.database,") which is not supported. It will be treated as a reference in the current database (").concat(t.projectId,"/").concat(t.database,") instead.")),r}}function AN(e,t,n){let i;return i=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,i}class RN{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class PN extends mN{constructor(e,t,n,i,r,o){super(e,t,n,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=r}exists(){return super.exists()}data(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._document){if(this._converter){const t=new NN(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._document){const n=this._document.data.field(vN("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}class NN extends PN{data(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return super.data(e)}}class MN{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new RN(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){const e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new NN(this._firestore,this._userDataWriter,n.key,n,new RN(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(){const e=!!(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new YI(XI.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map((n=>{const i=new NN(e._firestore,e._userDataWriter,n.doc.key,n.doc,new RN(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||3!==e.type)).map((t=>{const i=new NN(e._firestore,e._userDataWriter,t.doc.key,t.doc,new RN(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let r=-1,o=-1;return 0!==t.type&&(r=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),o=n.indexOf(t.doc.key)),{type:LN(t.type),doc:i,oldIndex:r,newIndex:o}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function LN(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return KI()}}class FN extends ON{constructor(e){super(),this.firestore=e}convertBytes(e){return new KP(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new BP(this.firestore,null,t)}}function BN(e,t){const n=NP(e.firestore,$P),i=UP(e),r=AN(e.converter,t);return HN(n,[iN(nN(e.firestore),"addDoc",i._key,r,null!==e.converter,{}).toMutation(i._key,UD.exists(!1))]).then((()=>i))}function VN(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i{n[l]&&n[l](UN(h,e,t))},error:n[l+1],complete:n[l+2]};else{const t=NP(e,FP);h=NP(t.firestore,$P),d=t._query;const i=new FN(h);u={next:e=>{n[l]&&n[l](new MN(h,i,t,e))},error:n[l+1],complete:n[l+2]},_N(e._query)}return function(e,t,n,i){const r=new _P(i),o=new jR(t,r,n);return e.asyncQueue.enqueueAndForget((async()=>BR(await IP(e),o))),()=>{r.Na(),e.asyncQueue.enqueueAndForget((async()=>VR(await IP(e),o)))}}(WP(h),d,c,u)}function HN(e,t){return function(e,t){const n=new JI;return e.asyncQueue.enqueueAndForget((async()=>async function(e,t,n){const i=mP(e);try{const e=await function(e,t){const n=QI(e),i=hT.now(),r=t.reduce(((e,t)=>e.add(t.key)),wD());let o,s;return n.persistence.runTransaction("Locally write mutations","readwrite",(e=>{let a=dD(),l=wD();return n.ss.getEntries(e,r).next((e=>{a=e,a.forEach(((e,t)=>{t.isValidDocument()||(l=l.add(e))}))})).next((()=>n.localDocuments.getOverlayedDocuments(e,a))).next((r=>{o=r;const s=[];for(const e of t){const t=KD(e,o.get(e.key).overlayedDocument);null!=t&&s.push(new XD(e.key,t,_k(t.value.mapValue),UD.exists(!0)))}return n.mutationQueue.addMutationBatch(e,i,s,t)})).next((t=>{s=t;const i=t.applyToLocalDocumentSet(o,l);return n.documentOverlayCache.saveOverlays(e,t.batchId,i)}))})).then((()=>({batchId:s.batchId,changes:mD(o)})))}(i.localStore,t);i.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let i=e.Sa[e.currentUser.toKey()];i||(i=new BT(cT)),i=i.insert(t,n),e.Sa[e.currentUser.toKey()]=i}(i,e.batchId,n),await hP(i,e.changes),await _R(i.remoteStore)}catch(e){const t=RR(e,"Failed to persist write");n.reject(t)}}(await EP(e),t,n))),n.promise}(WP(e),t)}function UN(e,t,n){const i=n.docs.get(t._key),r=new FN(e);return new PN(e,r,t._key,i,new RN(n.hasPendingWrites,n.fromCache),t.converter)}function zN(){return new rN("serverTimestamp")}new WeakMap;!function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!function(e){HI=e}(j_),V_(new n_("firestore",((e,n)=>{let{instanceIdentifier:i,options:r}=n;const o=e.getProvider("app").getImmediate(),s=new $P(new nT(e.getProvider("auth-internal")),new sT(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new YI(XI.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ek(e.options.projectId,t)}(o,i),o);return r=Object.assign({useFetchStreams:t},r),s._setSettings(r),s}),"PUBLIC").setMultipleInstances(!0)),G_(BI,"4.4.0",e),G_(BI,"4.4.0","esm2017")}();const jN="firebasestorage.googleapis.com",$N="storageBucket";class WN extends Wv{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;super(qN(e),"Firebase Storage: ".concat(t," (").concat(qN(e),")")),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,WN.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return qN(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message="".concat(this._baseMessage,"\n").concat(this.customData.serverResponse):this.message=this._baseMessage}}var GN,KN;function qN(e){return"storage/"+e}function QN(){return new WN(GN.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function XN(){return new WN(GN.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function YN(){return new WN(GN.CANCELED,"User canceled the upload/download.")}function JN(){return new WN(GN.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function ZN(e){return new WN(GN.INVALID_ARGUMENT,e)}function eM(){return new WN(GN.APP_DELETED,"The Firebase app was deleted.")}function tM(e,t){return new WN(GN.INVALID_FORMAT,"String does not match format '"+e+"': "+t)}function nM(e){throw new WN(GN.INTERNAL_ERROR,"Internal error: "+e)}!function(e){e.UNKNOWN="unknown",e.OBJECT_NOT_FOUND="object-not-found",e.BUCKET_NOT_FOUND="bucket-not-found",e.PROJECT_NOT_FOUND="project-not-found",e.QUOTA_EXCEEDED="quota-exceeded",e.UNAUTHENTICATED="unauthenticated",e.UNAUTHORIZED="unauthorized",e.UNAUTHORIZED_APP="unauthorized-app",e.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",e.INVALID_CHECKSUM="invalid-checksum",e.CANCELED="canceled",e.INVALID_EVENT_NAME="invalid-event-name",e.INVALID_URL="invalid-url",e.INVALID_DEFAULT_BUCKET="invalid-default-bucket",e.NO_DEFAULT_BUCKET="no-default-bucket",e.CANNOT_SLICE_BLOB="cannot-slice-blob",e.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",e.NO_DOWNLOAD_URL="no-download-url",e.INVALID_ARGUMENT="invalid-argument",e.INVALID_ARGUMENT_COUNT="invalid-argument-count",e.APP_DELETED="app-deleted",e.INVALID_ROOT_OPERATION="invalid-root-operation",e.INVALID_FORMAT="invalid-format",e.INTERNAL_ERROR="internal-error",e.UNSUPPORTED_ENVIRONMENT="unsupported-environment"}(GN||(GN={}));class iM{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let n;try{n=iM.makeFromUrl(e,t)}catch(r){return new iM(e,"")}if(""===n.path)return n;throw i=e,new WN(GN.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+i+"'.");var i}static makeFromUrl(e,t){let n=null;const i="([A-Za-z0-9.\\-_]+)";const r=new RegExp("^gs://"+i+"(/(.*))?$","i");function o(e){e.path_=decodeURIComponent(e.path)}const s=t.replace(/[.]/g,"\\."),a=[{regex:r,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:new RegExp("^https?://".concat(s,"/").concat("v[A-Za-z0-9_]+","/b/").concat(i,"/o").concat("(/([^?#]*).*)?$"),"i"),indices:{bucket:1,path:3},postModify:o},{regex:new RegExp("^https?://".concat(t===jN?"(?:storage.googleapis.com|storage.cloud.google.com)":t,"/").concat(i,"/").concat("([^?#]*)"),"i"),indices:{bucket:1,path:2},postModify:o}];for(let l=0;ln)throw ZN("Invalid value for '".concat(e,"'. Expected ").concat(n," or less."))}function cM(e,t,n){let i=t;return null==n&&(i="https://".concat(t)),"".concat(n,"://").concat(i,"/v0").concat(e)}function uM(e){const t=encodeURIComponent;let n="?";for(const i in e)if(e.hasOwnProperty(i)){n=n+(t(i)+"="+t(e[i]))+"&"}return n=n.slice(0,-1),n}function hM(e,t){const n=e>=500&&e<600,i=-1!==[408,429].indexOf(e),r=-1!==t.indexOf(e);return n||i||r}!function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"}(KN||(KN={}));class dM{constructor(e,t,n,i,r,o,s,a,l,c,u){let h=!(arguments.length>11&&void 0!==arguments[11])||arguments[11];this.url_=e,this.method_=t,this.headers_=n,this.body_=i,this.successCodes_=r,this.additionalRetryCodes_=o,this.callback_=s,this.errorCallback_=a,this.timeout_=l,this.progressCallback_=c,this.connectionFactory_=u,this.retry=h,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise(((e,t)=>{this.resolve_=e,this.reject_=t,this.start_()}))}start_(){const e=(e,t)=>{if(t)return void e(!1,new pM(!1,null,!0));const n=this.connectionFactory_();this.pendingConnection_=n;const i=e=>{const t=e.loaded,n=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,n)};null!==this.progressCallback_&&n.addUploadProgressListener(i),n.send(this.url_,this.method_,this.body_,this.headers_).then((()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(i),this.pendingConnection_=null;const t=n.getErrorCode()===KN.NO_ERROR,r=n.getStatus();if(!t||hM(r,this.additionalRetryCodes_)&&this.retry){const t=n.getErrorCode()===KN.ABORT;return void e(!1,new pM(!1,null,t))}const o=-1!==this.successCodes_.indexOf(r);e(!0,new pM(o,n))}))},t=(e,t)=>{const n=this.resolve_,i=this.reject_,r=t.connection;if(t.wasSuccessCode)try{const e=this.callback_(r,r.getResponse());!function(e){return void 0!==e}(e)?n():n(e)}catch(o){i(o)}else if(null!==r){const e=QN();e.serverResponse=r.getErrorText(),this.errorCallback_?i(this.errorCallback_(r,e)):i(e)}else if(t.canceled){i(this.appDelete_?eM():YN())}else{i(XN())}};this.canceled_?t(0,new pM(!1,null,!0)):this.backoffId_=function(e,t,n){let i=1,r=null,o=null,s=!1,a=0;function l(){return 2===a}let c=!1;function u(){if(!c){c=!0;for(var e=arguments.length,n=new Array(e),i=0;i{r=null,e(p,l())}),t)}function d(){o&&clearTimeout(o)}function p(e){if(c)return void d();for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{s=!0,m(!0)}),n),m}(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,null!==this.backoffId_&&function(e){e(!1)}(this.backoffId_),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class pM{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}}function fM(){return"undefined"!==typeof BlobBuilder?BlobBuilder:"undefined"!==typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function mM(){const e=fM();for(var t=arguments.length,n=new Array(t),i=0;i>6,128|63&i);else if(55296===(64512&i)){if(n>18,128|i>>12&63,128|i>>6&63,128|63&i)}else t.push(239,191,189)}else 56320===(64512&i)?t.push(239,191,189):t.push(224|i>>12,128|i>>6&63,128|63&i)}return new Uint8Array(t)}function wM(e,t){switch(e){case vM.BASE64:{const n=-1!==t.indexOf("-"),i=-1!==t.indexOf("_");if(n||i){throw tM(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?")}break}case vM.BASE64URL:{const n=-1!==t.indexOf("+"),i=-1!==t.indexOf("/");if(n||i){throw tM(e,"Invalid character '"+(n?"+":"/")+"' found: is it base64 encoded?")}t=t.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=gM(t)}catch(r){if(r.message.includes("polyfill"))throw r;throw tM(e,"Invalid character found")}const i=new Uint8Array(n.length);for(let o=0;o][;base64],");const n=t[1]||null;null!=n&&(this.base64=function(e,t){if(!(e.length>=t.length))return!1;return e.substring(e.length-t.length)===t}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=e.substring(e.indexOf(",")+1)}}class SM{constructor(e,t){let n=0,i="";sM(e)?(this.data_=e,n=e.size,i=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),n=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),n=e.length),this.size_=n,this.type_=i}size(){return this.size_}type(){return this.type_}slice(e,t){if(sM(this.data_)){const n=function(e,t,n){return e.webkitSlice?e.webkitSlice(t,n):e.mozSlice?e.mozSlice(t,n):e.slice?e.slice(t,n):null}(this.data_,e,t);return null===n?null:new SM(n)}{const n=new Uint8Array(this.data_.buffer,e,t-e);return new SM(n,!0)}}static getBlob(){for(var e=arguments.length,t=new Array(e),n=0;ne instanceof SM?e.data_:e));return new SM(mM.apply(null,e))}{const e=t.map((e=>oM(e)?yM(vM.RAW,e).data:e.data_));let n=0;e.forEach((e=>{n+=e.byteLength}));const i=new Uint8Array(n);let r=0;return e.forEach((e=>{for(let t=0;t{const r=e.bucket,o=e.fullPath;return cM("/b/"+s(r)+"/o/"+s(o),n,i)+uM({alt:"media",token:t})}))[0]}(r,i,e.host,e._protocol)}}function FM(e){return function(t,n){let i;var r,o;return 401===t.getStatus()?i=t.getErrorText().includes("Firebase App Check token is invalid")?new WN(GN.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project."):new WN(GN.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(o=e.bucket,i=new WN(GN.QUOTA_EXCEEDED,"Quota for bucket '"+o+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=e.path,i=new WN(GN.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):i=n,i.status=t.getStatus(),i.serverResponse=n.serverResponse,i}}function BM(e){const t=FM(e);return function(n,i){let r=t(n,i);var o;return 404===n.getStatus()&&(o=e.path,r=new WN(GN.OBJECT_NOT_FOUND,"Object '"+o+"' does not exist.")),r.serverResponse=i.serverResponse,r}}function VM(e,t,n){const i=cM(t.fullServerUrl(),e.host,e._protocol),r=e.maxOperationRetryTime,o=new PM(i,"GET",MM(e,n),r);return o.errorHandler=BM(t),o}function HM(e,t,n){const i=Object.assign({},n);return i.fullPath=e.path,i.size=t.size(),i.contentType||(i.contentType=function(e,t){return e&&e.contentType||t&&t.type()||"application/octet-stream"}(null,t)),i}function UM(e,t,n,i,r){const o=t.bucketOnlyServerUrl(),s={"X-Goog-Upload-Protocol":"multipart"};const a=function(){let e="";for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();s["Content-Type"]="multipart/related; boundary="+a;const l=HM(t,i,r),c="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+RM(l,n)+"\r\n--"+a+"\r\nContent-Type: "+l.contentType+"\r\n\r\n",u="\r\n--"+a+"--",h=SM.getBlob(c,i,u);if(null===h)throw JN();const d={name:l.fullPath},p=cM(o,e.host,e._protocol),f=e.maxUploadRetryTime,m=new PM(p,"POST",MM(e,n),f);return m.urlParams=d,m.headers=s,m.body=h.uploadData(),m.errorHandler=FM(t),m}class zM{constructor(e,t,n,i){this.current=e,this.total=t,this.finalized=!!n,this.metadata=i||null}}function jM(e,t){let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Status")}catch(i){NM(!1)}return NM(!!n&&-1!==(t||["active"]).indexOf(n)),n}const $M=262144;function WM(e,t,n,i,r,o,s,a){const l=new zM(0,0);if(s?(l.current=s.current,l.total=s.total):(l.current=0,l.total=i.size()),i.size()!==l.total)throw new WN(GN.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");const c=l.total-l.current;let u=c;r>0&&(u=Math.min(u,r));const h=l.current,d=h+u;let p="";p=0===u?"finalize":c===u?"upload, finalize":"upload";const f={"X-Goog-Upload-Command":p,"X-Goog-Upload-Offset":"".concat(l.current)},m=i.slice(h,d);if(null===m)throw JN();const g=t.maxUploadRetryTime,v=new PM(n,"POST",(function(e,n){const r=jM(e,["active","final"]),s=l.current+u,a=i.size();let c;return c="final"===r?MM(t,o)(e,n):null,new zM(s,a,"final"===r,c)}),g);return v.headers=f,v.body=m.uploadData(),v.progressCallback=a||null,v.errorHandler=FM(e),v}const GM="running",KM="paused",qM="success",QM="canceled",XM="error";function YM(e){switch(e){case"running":case"pausing":case"canceling":return GM;case"paused":return KM;case"success":return qM;case"canceled":return QM;default:return XM}}class JM{constructor(e,t,n){const i=function(e){return"function"===typeof e}(e)||null!=t||null!=n;if(i)this.next=e,this.error=null!==t&&void 0!==t?t:void 0,this.complete=null!==n&&void 0!==n?n:void 0;else{const t=e;this.next=t.next,this.error=t.error,this.complete=t.complete}}}function ZM(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;ie(...n)))}}let eL=null;class tL{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=KN.NO_ERROR,this.sendPromise_=new Promise((e=>{this.xhr_.addEventListener("abort",(()=>{this.errorCode_=KN.ABORT,e()})),this.xhr_.addEventListener("error",(()=>{this.errorCode_=KN.NETWORK_ERROR,e()})),this.xhr_.addEventListener("load",(()=>{e()}))}))}send(e,t,n,i){if(this.sent_)throw nM("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),void 0!==i)for(const r in i)i.hasOwnProperty(r)&&this.xhr_.setRequestHeader(r,i[r].toString());return void 0!==n?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw nM("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw nM("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return-1}}getResponse(){if(!this.sent_)throw nM("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw nM("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",e)}}class nL extends tL{initXhr(){this.xhr_.responseType="text"}}function iL(){return eL?eL():new nL}class rL{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=n,this._mappings=DM(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals(GN.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const t=this.isExponentialBackoffExpired();if(hM(e.status,[])){if(!t)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();e=XN()}this._error=e,this._transition("error")}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals(GN.CANCELED)?this.completeTransitions_():(this._error=e,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t,this._start()})),this._promise.then(null,(()=>{}))}isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}_makeProgressCallback(){const e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>262144}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout((()=>{this.pendingTimeout=void 0,this._continueUpload()}),this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then((t=>{let[n,i]=t;switch(this._state){case"running":e(n,i);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}}))}_createResumable(){this._resolveToken(((e,t)=>{const n=function(e,t,n,i,r){const o=t.bucketOnlyServerUrl(),s=HM(t,i,r),a={name:s.fullPath},l=cM(o,e.host,e._protocol),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":"".concat(i.size()),"X-Goog-Upload-Header-Content-Type":s.contentType,"Content-Type":"application/json; charset=utf-8"},u=RM(s,n),h=e.maxUploadRetryTime,d=new PM(l,"POST",(function(e){let t;jM(e);try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(n){NM(!1)}return NM(oM(t)),t}),h);return d.urlParams=a,d.headers=c,d.body=u,d.errorHandler=FM(t),d}(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,iL,e,t);this._request=i,i.getPromise().then((e=>{this._request=void 0,this._uploadUrl=e,this._needToFetchStatus=!1,this.completeTransitions_()}),this._errorHandler)}))}_fetchStatus(){const e=this._uploadUrl;this._resolveToken(((t,n)=>{const i=function(e,t,n,i){const r=e.maxUploadRetryTime,o=new PM(n,"POST",(function(e){const t=jM(e,["active","final"]);let n=null;try{n=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(o){NM(!1)}n||NM(!1);const r=Number(n);return NM(!isNaN(r)),new zM(r,i.size(),"final"===t)}),r);return o.headers={"X-Goog-Upload-Command":"query"},o.errorHandler=FM(t),o}(this._ref.storage,this._ref._location,e,this._blob),r=this._ref.storage._makeRequest(i,iL,t,n);this._request=r,r.getPromise().then((e=>{this._request=void 0,this._updateProgress(e.current),this._needToFetchStatus=!1,e.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()}),this._errorHandler)}))}_continueUpload(){const e=$M*this._chunkMultiplier,t=new zM(this._transferred,this._blob.size()),n=this._uploadUrl;this._resolveToken(((i,r)=>{let o;try{o=WM(this._ref._location,this._ref.storage,n,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(a){return this._error=a,void this._transition("error")}const s=this._ref.storage._makeRequest(o,iL,i,r,!1);this._request=s,s.getPromise().then((e=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(e.current),e.finalized?(this._metadata=e.metadata,this._transition("success")):this.completeTransitions_()}),this._errorHandler)}))}_increaseMultiplier(){2*($M*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken(((e,t)=>{const n=VM(this._ref.storage,this._ref._location,this._mappings),i=this._ref.storage._makeRequest(n,iL,e,t);this._request=i,i.getPromise().then((e=>{this._request=void 0,this._metadata=e,this._transition("success")}),this._metadataErrorHandler)}))}_oneShotUpload(){this._resolveToken(((e,t)=>{const n=UM(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),i=this._ref.storage._makeRequest(n,iL,e,t);this._request=i,i.getPromise().then((e=>{this._request=void 0,this._metadata=e,this._updateProgress(this._blob.size()),this._transition("success")}),this._errorHandler)}))}_updateProgress(e){const t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const t="paused"===this._state;this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":case"error":case"success":this._state=e,this._notifyObservers();break;case"canceled":this._error=YN(),this._state=e,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){const e=YM(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,n,i){const r=new JM(t||void 0,n||void 0,i||void 0);return this._addObserver(r),()=>{this._removeObserver(r)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const t=this._observers.indexOf(e);-1!==t&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise();this._observers.slice().forEach((e=>{this._notifyObserver(e)}))}_finishPromise(){if(void 0!==this._resolve){let e=!0;switch(YM(this._state)){case qM:ZM(this._resolve.bind(null,this.snapshot))();break;case QM:case XM:ZM(this._reject.bind(null,this._error))();break;default:e=!1}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(YM(this._state)){case GM:case KM:e.next&&ZM(e.next.bind(e,this.snapshot))();break;case qM:e.complete&&ZM(e.complete.bind(e))();break;default:e.error&&ZM(e.error.bind(e,this._error))()}}resume(){const e="paused"===this._state||"pausing"===this._state;return e&&this._transition("running"),e}pause(){const e="running"===this._state;return e&&this._transition("pausing"),e}cancel(){const e="running"===this._state||"pausing"===this._state;return e&&this._transition("canceling"),e}}class oL{constructor(e,t){this._service=e,this._location=t instanceof iM?t:iM.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new oL(e,t)}get root(){const e=new iM(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return EM(this._location.path)}get storage(){return this._service}get parent(){const e=function(e){if(0===e.length)return null;const t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}(this._location.path);if(null===e)return null;const t=new iM(this._location.bucket,e);return new oL(this._service,t)}_throwIfRoot(e){if(""===this._location.path)throw function(e){return new WN(GN.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(e)}}function sL(e){e._throwIfRoot("getDownloadURL");const t=function(e,t,n){const i=cM(t.fullServerUrl(),e.host,e._protocol),r=e.maxOperationRetryTime,o=new PM(i,"GET",LM(e,n),r);return o.errorHandler=BM(t),o}(e.storage,e._location,DM());return e.storage.makeRequestWithTokens(t,iL).then((e=>{if(null===e)throw new WN(GN.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return e}))}function aL(e,t){const n=function(e,t){const n=t.split("/").filter((e=>e.length>0)).join("/");return 0===e.length?n:e+"/"+n}(e._location.path,t),i=new iM(e._location.bucket,n);return new oL(e.storage,i)}function lL(e,t){if(e instanceof hL){const n=e;if(null==n._bucket)throw new WN(GN.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+$N+"' property when initializing the app?");const i=new oL(n,n._bucket);return null!=t?lL(i,t):i}return void 0!==t?aL(e,t):e}function cL(e,t){if(t&&/^[A-Za-z]+:\/\//.test(t)){if(e instanceof hL)return new oL(e,t);throw ZN("To use ref(service, url), the first argument must be a Storage instance.")}return lL(e,t)}function uL(e,t){const n=null===t||void 0===t?void 0:t[$N];return null==n?null:iM.makeFromBucketSpec(n,e)}class hL{constructor(e,t,n,i,r){this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=i,this._firebaseVersion=r,this._bucket=null,this._host=jN,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=i?iM.makeFromBucketSpec(i,this._host):uL(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=iM.makeFromBucketSpec(this._url,e):this._bucket=uL(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){lM("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){lM("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(null!==t)return t.accessToken}return null}async _getAppCheckToken(){const e=this._appCheckProvider.getImmediate({optional:!0});if(e){return(await e.getToken()).token}return null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach((e=>e.cancel())),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new oL(this,e)}_makeRequest(e,t,n,i){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(this._deleted)return new rM(eM());{const o=function(e,t,n,i,r,o){let s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];const a=uM(e.urlParams),l=e.url+a,c=Object.assign({},e.headers);return function(e,t){t&&(e["X-Firebase-GMPID"]=t)}(c,t),function(e,t){null!==t&&t.length>0&&(e.Authorization="Firebase "+t)}(c,n),function(e,t){e["X-Firebase-Storage-Version"]="webjs/"+(null!==t&&void 0!==t?t:"AppManager")}(c,o),function(e,t){null!==t&&(e["X-Firebase-AppCheck"]=t)}(c,i),new dM(l,e.method,c,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,r,s)}(e,this._appId,n,i,t,this._firebaseVersion,r);return this._requests.add(o),o.getPromise().then((()=>this._requests.delete(o)),(()=>this._requests.delete(o))),o}}async makeRequestWithTokens(e,t){const[n,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,n,i).getPromise()}}const dL="@firebase/storage",pL="0.12.0",fL="storage";function mL(e,t,n){return function(e,t,n){return e._throwIfRoot("uploadBytesResumable"),new rL(e,new SM(t),n)}(e=t_(e),t,n)}function gL(e,t){return cL(e=t_(e),t)}function vL(e,t){let{instanceIdentifier:n}=t;const i=e.getProvider("app").getImmediate(),r=e.getProvider("auth-internal"),o=e.getProvider("app-check-internal");return new hL(i,r,o,n,j_)}V_(new n_(fL,vL,"PUBLIC").setMultipleInstances(!0)),G_(dL,pL,""),G_(dL,pL,"esm2017");const _L=$_({apiKey:"AIzaSyAjxXsW1c9uIjoay8fx2Ycp7wC5CxRn2y0",authDomain:"drive-e2df5.firebaseapp.com",projectId:"drive-e2df5",storageBucket:"drive-e2df5.appspot.com",messagingSenderId:"246736099441",appId:"1:246736099441:web:a9f6b34333f463955da3d0"}),yL=function(e,t){const n="string"==typeof e?e:t||"(default)",i=H_("object"==typeof e?e:W_(),"firestore").getImmediate({identifier:n});if(!i._initialized){const e=Vv("firestore");e&&function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};var r;const o=(e=NP(e,LP))._getSettings(),s="".concat(t,":").concat(n);if("firestore.googleapis.com"!==o.host&&o.host!==s&&WI("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),e._setSettings(Object.assign(Object.assign({},o),{host:s,ssl:!1})),i.mockUserToken){let t,n;if("string"==typeof i.mockUserToken)t=i.mockUserToken,n=VI.MOCK_USER;else{t=jv(i.mockUserToken,null===(r=e._app)||void 0===r?void 0:r.options.projectId);const o=i.mockUserToken.sub||i.mockUserToken.user_id;if(!o)throw new YI(XI.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new VI(o)}e._authCredentials=new tT(new ZI(t,n))}}(i,...e)}return i}(_L),bL=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W_();const t=H_(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=H_(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(qv(n.getOptions(),null!==t&&void 0!==t?t:{}))return e;hy(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:dC,persistence:[Cw,ow,aw]}),i=Uv("authTokenSyncURL");if(i){const e=(r=i,async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>gC)return;const i=null===t||void 0===t?void 0:t.token;vC!==i&&(vC=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:"Bearer ".concat(i)}:{}}))});!function(e,t,n){t_(e).beforeAuthStateChanged(t,n)}(n,e,(()=>e(n.currentUser))),function(e,t,n,i){t_(e).onIdTokenChanged(t,n,i)}(n,(t=>e(t)))}var r;const o=Bv("auth");return o&&Cb(n,"http://".concat(o)),n}(_L),wL=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W_(),t=arguments.length>1?arguments[1]:void 0;e=t_(e);const n=H_(e,fL).getImmediate({identifier:t}),i=Vv("storage");return i&&function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};e.host="".concat(t,":").concat(n),e._protocol="http";const{mockUserToken:r}=i;r&&(e._overrideAuthToken="string"===typeof r?r:jv(r,e.app.options.projectId))}(e,t,n,i)}(n,...i),n}(_L),CL=(0,t.createContext)(),SL=e=>{let{children:n}=e;const[i,r]=(0,t.useState)();return(0,Vm.jsx)(CL.Provider,{value:{currentUser:i,setCurrentUser:r},children:n})},xL=()=>{const{loading:e,setLoading:n}=(0,t.useContext)(Um),{setCurrentUser:i}=(0,t.useContext)(CL),r=fv(),o=(0,t.useRef)();return setTimeout((()=>{n(!1)}),2e3),(0,Vm.jsxs)(Vm.Fragment,{children:[(0,Vm.jsx)(Hm,{visible:e}),(0,Vm.jsx)(ug,{autoClose:8e3}),(0,Vm.jsxs)("div",{children:[(0,Vm.jsxs)("div",{className:"clsLoginPage",children:[(0,Vm.jsx)("h1",{className:"clsLoginHeaderTitle",children:"Log In"}),(0,Vm.jsxs)("div",{children:[(0,Vm.jsxs)("form",{ref:o,children:[(0,Vm.jsx)("input",{type:"input",className:"clsEmailInput",placeholder:"example@example.com",autoComplete:"false",required:!0}),(0,Vm.jsx)("input",{type:"password",className:"clsPassInput",placeholder:"password",autoComplete:"false",required:!0})]}),(0,Vm.jsx)(kp,{text:"Log in",className:"clsLoginBtn",onClick:()=>{n(!0);let e=o.current[0].value,t=o.current[1].value;(function(e,t,n){return Yb(t_(e),Lb.credential(t,n)).catch((async t=>{throw t.code==="auth/".concat("password-does-not-meet-requirements")&&Zb(e),t}))})(bL,e,t).then((e=>{const t=e.user;i(t),t.emailVerified?r("/D-Drive/MainPage"):bg.error("Please verify the email address",{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})})).catch((e=>{bg.error(e.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})})),n(!1)}}),(0,Vm.jsx)("div",{children:(0,Vm.jsx)("h4",{className:"clsForgotPass",onClick:()=>{try{r("/D-Drive/ResetPassword")}catch(D){bg.error(D.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}},children:"Forgot Password ?"})})]})]}),(0,Vm.jsx)("div",{className:"clsLoginNeedAccount",children:(0,Vm.jsxs)("h4",{children:["Need an account? ",(0,Vm.jsx)("span",{className:"clsSignUpTxtColor",onClick:()=>{try{r("/D-Drive/Signup")}catch(D){bg.error(D.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}},children:"Sign up"})]})})]})]})},EL=()=>{const e=(0,t.useRef)(),{setCurrentUser:n}=(0,t.useContext)(CL),{loading:i,setLoading:r}=(0,t.useContext)(Um),o=fv(),s=(e,t,i)=>{(async function(e,t,n){const i=mb(e),r=wb(i,{returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",jb),o=await r.catch((t=>{throw t.code==="auth/".concat("password-does-not-meet-requirements")&&Zb(e),t})),s=await $b._fromIdTokenResponse(i,"signIn",o);return await i._updateCurrentUser(s.user),s})(e,t,i).then((t=>{const i=t.user;n(i),ew(e.currentUser).then((()=>{})),bg.success("Please Verify the Email Address",{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})})).catch((e=>{"auth/email-already-in-use"===e.code&&bg.error("Email / Password already in use",{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}))};return setTimeout((()=>{r(!1)}),2e3),(0,Vm.jsx)(Vm.Fragment,{children:(0,Vm.jsxs)("div",{children:[(0,Vm.jsx)(Hm,{visible:i}),(0,Vm.jsx)(ug,{autoClose:8e3}),(0,Vm.jsxs)("div",{className:"clsSignupPage",children:[(0,Vm.jsx)("h1",{className:"clsSignUpHeaderTitle",children:"Sign Up"}),(0,Vm.jsxs)("div",{children:[(0,Vm.jsxs)("form",{ref:e,children:[(0,Vm.jsx)("input",{type:"email",className:"clsEmailInput",placeholder:"example@example.com",autoComplete:"false",required:!0}),(0,Vm.jsx)("input",{type:"password",className:"clsPassInput",placeholder:"password",autoComplete:"false",required:!0}),(0,Vm.jsx)("input",{type:"password",className:"clsPassInput",placeholder:"confirm password",autoComplete:"false",required:!0})]}),(0,Vm.jsx)(kp,{text:"Sign Up",className:"clsSignUpBtn",onClick:t=>{try{r(!0);let t="",n="";if(!(""!==e.current[0].value&&e.current[0].value.length>7))throw Error("Email id field is empty");{t=e.current[0].value;let n=t.replace(/[^a-zA-Z0-9_@.]/g,"");t=n}if(!(""!==e.current[1].value&&e.current[1].value.length>7))throw Error("Password field is empty");if(n=e.current[1].value,""!==e.current[2].value&&e.current[2].value.length>7&&n!==e.current[2].value)throw Error("Password and Confirm Password does not match");s(bL,t,n),o("/D-Drive/Login")}catch(D){bg.error(D.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}}})]})]}),(0,Vm.jsx)("div",{className:"clsHaveAccount",children:(0,Vm.jsxs)("h4",{children:["Already have an account? ",(0,Vm.jsx)("span",{className:"clsLoginTxtColor",onClick:()=>{o("/D-Drive/Login")},children:"Log in"})]})})]})})},IL=()=>{const e=fv(),{loading:n,setLoading:i}=(0,t.useContext)(Um),{currentUser:r}=(0,t.useContext)(CL);return setTimeout((()=>{i(!1)}),2e3),r?(0,Vm.jsxs)(Vm.Fragment,{children:[(0,Vm.jsx)(Hm,{visible:n}),(0,Vm.jsx)(ug,{autoClose:8e3}),(0,Vm.jsxs)("div",{children:[(0,Vm.jsxs)("div",{className:"clsProfilePage",children:[(0,Vm.jsx)("h1",{className:"clsHeaderHeaderTitle",children:"Profile"}),(0,Vm.jsxs)("div",{children:[(0,Vm.jsxs)("h4",{className:"clsUserProfile",children:[(0,Vm.jsx)("b",{children:"Email:"})," ",null===r||void 0===r?void 0:r.email]}),(0,Vm.jsx)(kp,{text:"Update Profile",className:"clsLoginBtn",onClick:()=>{try{e("/D-Drive/UpdateProfile"),i(!0)}catch(D){bg.error(D.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}}})]})]}),(0,Vm.jsx)("div",{className:"clsLogOutAccount",children:(0,Vm.jsx)("h4",{onClick:()=>{try{bL.signOut(),setTimeout((()=>{bg.success("User Logout Successfully",{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}),100),i(!0),e("/D-Drive/Login")}catch(D){bg.error("Failed to Logout",{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}},children:"Log Out"})})]})]}):e("/D-Drive/Login")},TL=()=>{const e=fv(),{loading:n,setLoading:i}=(0,t.useContext)(Um),r=(0,t.useRef)(),o=()=>{try{e("/D-Drive/Login")}catch(D){bg.error(D.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}};return setTimeout((()=>{i(!1)}),2e3),(0,Vm.jsxs)(Vm.Fragment,{children:[(0,Vm.jsx)(Hm,{visible:n}),(0,Vm.jsx)(ug,{autoClose:8e3}),(0,Vm.jsxs)("div",{children:[(0,Vm.jsxs)("div",{className:"clsResetPassPage",children:[(0,Vm.jsx)("h1",{className:"clsResetPassHeaderTitle",children:"Reset Password"}),(0,Vm.jsxs)("div",{children:[(0,Vm.jsx)("form",{ref:r,children:(0,Vm.jsx)("input",{type:"input",className:"clsEmailInput",placeholder:"example@example.com",required:!0})}),(0,Vm.jsx)(kp,{text:"Reset Password",className:"clsResetPassBtn",onClick:()=>{let e=r.current[0].value;(async function(e,t,n){const i=mb(e),r={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};n&&Jb(i,r,n),await wb(i,r,"getOobCode",Db)})(bL,e).then((()=>{i(!0),setTimeout((()=>{bg.success("Please a check ur email inbox to reset password",{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}),100),o()})).catch((e=>{bg.error(e.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}))}})]}),(0,Vm.jsx)("h4",{className:"clsLoginResetBtn",onClick:o,children:"Login"})]}),(0,Vm.jsx)("div",{className:"clsNeedAccount",children:(0,Vm.jsx)("div",{children:(0,Vm.jsxs)("h4",{children:["Need an account? ",(0,Vm.jsx)("span",{className:"clsSignUpColor",onClick:()=>{try{e("/D-Drive/Signup")}catch(D){bg.error(D.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}},children:"Sign up"})]})})})]})]})};new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);new Map;const kL=i.startTransition;Ed.flushSync;function DL(e){let{basename:n,children:i,future:r,window:o}=e,s=t.useRef();null==s.current&&(s.current=function(e){return void 0===e&&(e={}),Og((function(e,t){let{pathname:n,search:i,hash:r}=e.location;return Tg("",{pathname:n,search:i,hash:r},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"===typeof t?t:kg(t)}),null,e)}({window:o,v5Compat:!0}));let a=s.current,[l,c]=t.useState({action:a.action,location:a.location}),{v7_startTransition:u}=r||{},h=t.useCallback((e=>{u&&kL?kL((()=>c(e))):c(e)}),[c,u]);return t.useLayoutEffect((()=>a.listen(h)),[a,h]),t.createElement(kv,{basename:n,children:i,location:l.location,navigationType:l.action,navigator:a,future:r})}"undefined"!==typeof window&&"undefined"!==typeof window.document&&window.document.createElement;var OL,AL;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(OL||(OL={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(AL||(AL={}));const RL=()=>{const{currentUser:e}=(0,t.useContext)(CL),{loading:n,setLoading:i}=(0,t.useContext)(Um),r=(0,t.useRef)(),o=fv();return setTimeout((()=>{i(!1)}),2e3),e?(0,Vm.jsx)(Vm.Fragment,{children:(0,Vm.jsxs)("div",{children:[(0,Vm.jsx)(Hm,{visible:n}),(0,Vm.jsx)(ug,{autoClose:8e3}),(0,Vm.jsxs)("div",{className:"clsUpdateProfilePage",children:[(0,Vm.jsx)("h1",{className:"clsUpdateProfileHeaderTitle",children:"Update Profile"}),(0,Vm.jsxs)("div",{children:[(0,Vm.jsxs)("form",{ref:r,children:[(0,Vm.jsx)("input",{type:"email",className:"clsEmailInput",placeholder:"example@example.com",autoComplete:"false",required:!0}),(0,Vm.jsx)("input",{type:"password",className:"clsPassInput",placeholder:"password leave it blank to keep same",autoComplete:"false",required:!0}),(0,Vm.jsx)("input",{type:"password",className:"clsPassInput",placeholder:"confirm password leave it blank to keep same",autoComplete:"false",required:!0})]}),(0,Vm.jsx)(kp,{text:"Update",className:"clsUpdateProfileBtn",onClick:async()=>{try{let n=r.current[0].value,i="";if(""!==n){let i=n.replace(/[^a-zA-Z0-9_@.]/g,"");n=i,await ew(bL.currentUser).then((()=>!0))&&(e=bL.currentUser,t=n,tw(t_(e),t,null)).then((()=>{bg.success("Email Update Successfully",{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})})).catch((e=>{bg.error(e.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}))}if(""!==r.current[1].value&&r.current[1].value.length>7&&(i=r.current[1].value),""!==r.current[2].value&&r.current[2].value.length>7){if(i!==r.current[2].value)throw Error("Password and Confirm Password does not match");{const e=bL.currentUser;(function(e,t){return tw(t_(e),null,t)})(e,i).then((()=>{bg.success("Password Update Successfully",{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})})).catch((e=>{bg.error(e.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}))}}}catch(D){bg.error(D.message,{position:bg.POSITION.TOP_RIGHT,pauseOnHover:!1})}var e,t}})]})]}),(0,Vm.jsx)("div",{className:"clsUpdateProfileHaveAccount",children:(0,Vm.jsx)("h4",{className:"clsUpdateProfileTxtColor",onClick:()=>{o("/D-Drive/ProfileDashboard")},children:"Cancel"})})]})}):o("/D-Drive/Login")},PL=()=>{const e=fv();return(0,Vm.jsx)("div",{children:(0,Vm.jsx)("nav",{className:"navbar",children:(0,Vm.jsxs)("div",{className:"container",children:[(0,Vm.jsx)("div",{className:"logo",children:"D - Drive"}),(0,Vm.jsx)("div",{className:"menu",children:(0,Vm.jsx)("a",{onClick:t=>{try{t.preventDefault(),e("/D-Drive/ProfileDashboard")}catch(D){console.log(D)}},children:"Profile"})})]})})})};var NL=Ws.add,ML="DEVEXTREME_XHR_ERROR_UNLOAD",LL=function(e){return Array.isArray(e)||(e=[e]),b(e,(function(e){var t={selector:c(e)||"string"===typeof e?e:e.getter||e.field||e.selector,desc:!(!e.desc&&"d"!==String(e.dir).charAt(0).toLowerCase())};return e.compare&&(t.compare=e.compare),t}))},FL=function(){var e,t={timeout:"Network connection timeout",error:"Unspecified network error",parsererror:"Unexpected server response"};return NL((function(){var t=Ye();We.listen(t,"beforeunload",(function(){e=!0}))})),function(n,i){return e?ML:n.status<400?function(e){var n=t[e];return n||e}(i):n.statusText}}(),BL={count:{seed:0,step:function(e){return 1+e}},sum:{seed:0,step:function(e,t){return e+t}},min:{step:function(e,t){return te?t:e}},avg:{seed:[0,0],step:function(e,t){return[e[0]+t,e[1]+1]},finalize:function(e){return e[1]?e[0]/e[1]:NaN}}},VL=function(){var e,t=0;return{obtain:function(){0===t&&(e=new ee),t++},release:function(){--t<1&&e.resolve()},promise:function(){return(0===t?(new ee).resolve():e).promise()},reset:function(){t=0,e&&e.resolve()}}}();var HL=function(e,t,n){if(Array.isArray(e)){for(var i,r=b(t,(function(e,t){return t})),o=0;o{n=void 0,e.call(this)}),c(t)?t():t)),n}}((function(){e.call(this,n),n=[]}),t);return function(e){return Array.isArray(e)&&n.push(...e),i.call(this,n)}}var $L=D(O.ERROR_MESSAGES,{E4000:"[DevExpress.data]: {0}",E4001:"Unknown aggregating function is detected: '{0}'",E4002:"Unsupported OData protocol version is used",E4003:"Unknown filter operation is used: {0}",E4004:"The thenby() method is called before the sortby() method",E4005:"Store requires a key expression for this operation",E4006:"ArrayStore 'data' option must be an array",E4007:"Compound keys cannot be auto-generated",E4008:"Attempt to insert an item with a duplicated key",E4009:"Data item cannot be found",E4010:"CustomStore does not support creating queries",E4011:"Custom Store method is not implemented or is not a function: {0}",E4012:"Custom Store method returns an invalid value: {0}",E4013:"Local Store requires the 'name' configuration option is specified",E4014:"Unknown data type is specified for ODataStore: {0}",E4015:"Unknown entity name or alias is used: {0}",E4016:"The compileSetter(expr) method is called with 'self' passed as a parameter",E4017:"Keys cannot be modified",E4018:"The server has returned a non-numeric value in a response to an item count request",E4019:"Mixing of group operators inside a single group of filter expression is not allowed",E4020:"Unknown store type is detected: {0}",E4021:"The server response does not provide the totalCount value",E4022:"The server response does not provide the groupCount value",E4023:"Could not parse the following XML: {0}",E4024:"String function {0} cannot be used with the data field {1} of type {2}.",W4000:"Data returned from the server has an incorrect structure",W4001:'The {0} field is listed in both "keyType" and "fieldTypes". The value of "fieldTypes" is used.',W4002:"Data loading has failed for some cells due to the following error: {0}"}),WL=null,GL=function(e){var t;null===(t=WL)||void 0===t||t(e)};function KL(e,t,n,i){var r;if(i){for(var o=0;o=0)return t}function qL(e,t,n,i){return i?KL(e,t,n,i)||[]:t}function QL(e,t,n){e._dataByKeyMap&&(e._dataByKeyMap[JSON.stringify(t)]=n,e._dataByKeyMapLength+=n?1:-1)}function XL(e,t,n){n=n||new WeakMap;var i=e?Object.create(Object.getPrototypeOf(e)):{};e&&n.set(e,i);var r=H({},e);for(var o in re(i,r,!0,!0),r){var s=r[o],a=null===t||void 0===t?void 0:t[o];d(s)&&!f(s)&&d(a)&&!n.has(s)&&(i[o]=XL(s,a,n))}for(var l in i){var c=i[l];d(c)&&n.has(c)&&(i[l]=n.get(c))}return i}function YL(e,t){var n=XL(e,t);return re(n,t,!0,!0)}function JL(e){var{keyInfo:t,data:n,changes:i,groupCount:r,useInsertIndex:o,immutable:s,disableCache:a,logError:c,skipCopying:u}=e,h=!0===s?[...n]:n;return i.forEach((e=>{var n="insert"===e.type?h:qL(t,h,e.key,r);switch(!a&&function(e,t){if(e.key()&&(!t._dataByKeyMap||t._dataByKeyMapLength!==t.length)){for(var n={},i=t.length,r=0;r=0?t.splice(i,0,c):t.push(c),QL(t,a,c),!r)return UL(W().useLegacyStoreResult?n:c,a)}function nF(e,t,n,i,r){var o=iF(e,t,n);return o>-1&&(t.splice(o,1),QL(t,n,null)),i?o<0?ZL(i,r,"E4009"):void 0:UL(n)}function iF(e,t,n){var i=e.key();if(!function(e,t){return!e._dataByKeyMap||e._dataByKeyMap[JSON.stringify(t)]}(t,n))return-1;for(var r=0,o=t.length;r(t,n)=>function(e,t,n){return u(e)&&u(t)&&(null!==n&&void 0!==n&&n.locale||null!==n&&void 0!==n&&n.collatorOptions)?new Intl.Collator((null===n||void 0===n?void 0:n.locale)||void 0,(null===n||void 0===n?void 0:n.collatorOptions)||void 0).compare(e,t):(e=ge(e,!1,n),t=ge(t,!1,n),null===e&&null!==t?-1:null!==e&&null===t||void 0===e&&void 0!==t?1:void 0!==e&&void 0===t||et?1:0)}(t,n,e),_compare:function(e,t){var n=e.index,i=t.index;if((e=e.value)===(t=t.value))return n-i;for(var r=0,o=this.rules.length;rge(t,!1,e),n=function(t){var n;return l(t)?null!==(n=e)&&void 0!==n&&n.locale?t.toLocaleString(e.locale):t.toString():""};function i(e,n,i){return function(r){r=t(e(r));var o=function(e){return""===e||0===e||!1===e}(n)?r===n:r==n;return i&&(o=!o),o}}return function(r,o){return e=o||{},c(r)?r:function(e){var t=e[0],n=e[1];return!!Array.isArray(t)||!(!c(t)||!(Array.isArray(n)||c(n)||function(e){return"and"===e||"or"===e}(n)))}(r)?function(t){var n=[],i=!1,r=!1;return w(t,(function(){if(Array.isArray(this)||c(this)){if(n.length>1&&i!==r)throw new $L.Error("E4019");n.push(cF(this,e)),i=r,r=!0}else r=/^(and|&&|&)$/i.test(this)})),function(e){for(var t=i,r=0;r(e=t(r(e)),(null!=s&&null!=e||s===e)&&n(e,s));switch(o.toLowerCase()){case"=":return i(r,s);case"<>":return i(r,s,!0);case">":return e=>a(e,((e,t)=>e>t));case"<":return e=>a(e,((e,t)=>e=":return e=>a(e,((e,t)=>e>=t));case"<=":return e=>a(e,((e,t)=>e<=t));case"startswith":return function(e){return 0===t(n(r(e))).indexOf(s)};case"endswith":return function(e){var i=t(n(r(e))),o=n(s);if(i.length-1};case"notcontains":return function(e){return-1===t(n(r(e))).indexOf(s)}}throw $L.Error("E4003",o)}(r)}}(),uF=sF.inherit({ctor:function(e,t){this.callBase(e),this.langParams=e.langParams,this.criteria=cF(t,this.langParams)},next:function(){for(;this.iter.next();)if(this.criteria(this.current()))return!0;return!1}}),hF=rF.inherit({ctor:function(e,t){this.iter=e,this.getter=t},next:function(){return this._ensureGrouped(),this.groupedIter.next()},current:function(){return this._ensureGrouped(),this.groupedIter.current()},reset:function(){delete this.groupedIter},countable:function(){return!!this.groupedIter},count:function(){return this.groupedIter.count()},_ensureGrouped:function(){if(!this.groupedIter){var e={},t=[],n=this.iter,i=de(this.getter);for(n.reset();n.next();){var r=n.current(),o=i(r);o in e?e[o].push(r):(e[o]=[r],t.push(o))}this.groupedIter=new oF(b(t,(function(t){return{key:t,items:e[t]}})))}}}),dF=sF.inherit({ctor:function(e,t){this.callBase(e),this.getter=de(t)},current:function(){return this.getter(this.callBase())},countable:function(){return this.iter.countable()},count:function(){return this.iter.count()}}),pF=sF.inherit({ctor:function(e,t,n){this.callBase(e),this.skip=Math.max(0,t),this.take=Math.max(0,n),this.pos=0},next:function(){if(this.pos>=this.skip+this.take)return!1;for(;this.pos1&&(e=e.select((function(e){return y({},e,{items:mF(fF(e.items),t.slice(1)).toArray()})}))),e}function gF(e,t){var n=[];return w(e,(function(e,i){Ne(t,(function(e){return i.selector===e.selector})).length<1&&n.push(i)})),n.concat(t)}const vF={multiLevelGroup:mF,arrangeSortingInfo:gF,queryByOptions:function(e,t,n){var i,r,o,s=(t=t||{}).filter;if(null!==(i=t)&&void 0!==i&&i.langParams&&(null===(r=(o=e).setLangParams)||void 0===r||r.call(o,t.langParams)),s&&(e=e.filter(s)),n)return e;var a=t.sort,l=t.select,c=t.group,u=t.skip,h=t.take;return c&&((c=LL(c)).keepInitialKeyOrder=!!t.group.keepInitialKeyOrder),(a||c)&&(a=LL(a||[]),c&&!c.keepInitialKeyOrder&&(a=gF(c,a)),w(a,(function(t){e=e[t?"thenBy":"sortBy"](this.selector,this.desc,this.compare)}))),l&&(e=e.select(l)),c&&(e=mF(e,c)),(h||u)&&(e=e.slice(u||0,h)),e}};var _F,yF=B.abstract,bF=vF.queryByOptions,wF={},CF=B.inherit({_langParams:{},ctor:function(e){var t=this;e=e||{},this._eventsStrategy=new ei(this),w(["onLoaded","onLoading","onInserted","onInserting","onUpdated","onUpdating","onPush","onRemoved","onRemoving","onModified","onModifying"],(function(n,i){i in e&&t.on(i.slice(2).toLowerCase(),e[i])})),this._key=e.key,this._errorHandler=e.errorHandler,this._useDefaultSearch=!0},_clearCache:Pe,_customLoadOptions:function(){return null},key:function(){return this._key},keyOf:function(e){return this._keyGetter||(this._keyGetter=de(this.key())),this._keyGetter(e)},_requireKey:function(){if(!this.key())throw $L.Error("E4005")},load:function(e){var t=this;return e=e||{},this._eventsStrategy.fireEvent("loading",[e]),this._withLock(this._loadImpl(e)).done((function(n){t._eventsStrategy.fireEvent("loaded",[n,e])}))},_loadImpl:function(e){return p(this._langParams)||((e=e||{})._langParams=H({},this._langParams,e._langParams)),bF(this.createQuery(e),e).enumerate()},_withLock:function(e){var t=new ee;return e.done((function(){var e=this,n=arguments;VL.promise().done((function(){t.resolveWith(e,n)}))})).fail((function(){t.rejectWith(this,arguments)})),t},createQuery:yF,totalCount:function(e){return this._totalCountImpl(e)},_totalCountImpl:function(e){return bF(this.createQuery(e),e,!0).count()},byKey:function(e,t){return this._addFailHandlers(this._withLock(this._byKeyImpl(e,t)))},_byKeyImpl:yF,insert:function(e){var t=this;return t._eventsStrategy.fireEvent("modifying"),t._eventsStrategy.fireEvent("inserting",[e]),t._addFailHandlers(t._insertImpl(e).done((function(e,n){t._eventsStrategy.fireEvent("inserted",[e,n]),t._eventsStrategy.fireEvent("modified")})))},_insertImpl:yF,update:function(e,t){var n=this;return n._eventsStrategy.fireEvent("modifying"),n._eventsStrategy.fireEvent("updating",[e,t]),n._addFailHandlers(n._updateImpl(e,t).done((function(){n._eventsStrategy.fireEvent("updated",[e,t]),n._eventsStrategy.fireEvent("modified")})))},_updateImpl:yF,push:function(e){var t={changes:e,waitFor:[]};this._eventsStrategy.fireEvent("beforePushAggregation",[t]),te(...t.waitFor).done((()=>{this._pushImpl(e),this._eventsStrategy.fireEvent("beforePush",[{changes:e}]),this._eventsStrategy.fireEvent("push",[e])}))},_pushImpl:Pe,remove:function(e){var t=this;return t._eventsStrategy.fireEvent("modifying"),t._eventsStrategy.fireEvent("removing",[e]),t._addFailHandlers(t._removeImpl(e).done((function(e){t._eventsStrategy.fireEvent("removed",[e]),t._eventsStrategy.fireEvent("modified")})))},_removeImpl:yF,_addFailHandlers:function(e){return e.fail(this._errorHandler).fail(GL)},on(e,t){return this._eventsStrategy.on(e,t),this},off(e,t){return this._eventsStrategy.off(e,t),this}});CF.create=function(e,t){if(!(e in wF))throw $L.Error("E4020",e);return new wF[e](t)},CF.registerClass=function(e,t){return t&&(wF[t]=e),e},CF.inherit=(_F=CF.inherit,function(e,t){var n=_F.apply(this,[e]);return CF.registerClass(n,t),n});const SF=CF;var xF="totalCount",EF="load",IF="byKey",TF="insert",kF="update",DF="remove";function OF(e){return e&&c(e.then)}function AF(e){return(new ee).resolve(e).promise()}function RF(e,t){if(!c(t))throw $L.Error("E4011",e)}function PF(e){throw $L.Error("E4012",e)}function NF(e){return function(t){var n;(n=t instanceof Error?t:new Error(function(e){var t=e[0],n=e[1];return t&&t.getResponseHeader?FL(t,n):null}(arguments)||t&&String(t)||"Unknown error")).message!==ML&&e.reject(n)}}function MF(e,t){var n,i=e._loadFunc;return RF(EF,i),n=i.apply(e,[t]),Array.isArray(n)?n=AF(n):null===n||void 0===n?n=AF([]):OF(n)||PF(EF),J(n)}function LF(e,t,n,i){if(t.__rawData)i(t.__rawData);else{var r=t.__rawDataPromise||MF(t,n);t._cacheRawData&&(t.__rawDataPromise=r),r.always((function(){delete t.__rawDataPromise})).done((function(e){t._cacheRawData&&(t.__rawData=e),i(e)})).fail(NF(e))}}function FF(e,t,n,i){var r={};"userData"in(n=n||{})&&(r.userData=n.userData),LF(e,t,r,(function(r){var o,s,a,l,c=fF(r,{errorHandler:t._errorHandler}),u=[];i||((o=vF.queryByOptions(c,n))===c?a=r.slice(0):u.push(o.enumerate().done((function(e){a=e})))),(n.requireTotalCount||i)&&((s=vF.queryByOptions(c,n,!0))===c?l=r.length:u.push(s.count().done((function(e){l=e})))),te.apply(Un,u).done((function(){i?e.resolve(l):n.requireTotalCount?e.resolve(a,{totalCount:l}):e.resolve(a)})).fail((function(t){e.reject(t)}))}))}var BF=SF.inherit({ctor:function(e){e=e||{},this.callBase(e),this._useDefaultSearch=!!e.useDefaultSearch||"raw"===e.loadMode,this._loadMode=e.loadMode,this._cacheRawData=!1!==e.cacheRawData,this._loadFunc=e[EF],this._totalCountFunc=e[xF],this._byKeyFunc=e[IF],this._insertFunc=e[TF],this._updateFunc=e[kF],this._removeFunc=e[DF]},_clearCache(){delete this.__rawData},createQuery:function(){throw $L.Error("E4010")},clearRawDataCache:function(){this._clearCache()},_totalCountImpl:function(e){var t=new ee;return"raw"!==this._loadMode||this._totalCountFunc?(function(e,t){var n,i=e._totalCountFunc;if(!c(i))throw $L.Error("E4021");return OF(n=i.apply(e,[t]))||(n=Number(n),isFinite(n)||PF(xF),n=AF(n)),J(n)}(this,e).done((function(e){t.resolve(Number(e))})).fail(NF(t)),t=this._addFailHandlers(t)):FF(t,this,e,!0),t.promise()},_pushImpl:function(e){this.__rawData&&JL({keyInfo:this,data:this.__rawData,changes:e})},_loadImpl:function(e){var t=new ee;return"raw"===this._loadMode?FF(t,this,e,!1):(MF(this,e).done((function(e,n){t.resolve(e,n)})).fail(NF(t)),t=this._addFailHandlers(t)),t.promise()},_byKeyImpl:function(e,t){var n=new ee;return this._byKeyViaLoad()?(this._requireKey(),function(e,t,n){LF(e,t,{},(function(i){for(var r,o=t.key(),s=0,a=i.length;s-1?"&":"?")+n),n=null):t["Content-Type"]&&t["Content-Type"].indexOf("application/x-www-form-urlencoded")>-1&&(n=n.replace(/%20/g,"+"))),{url:r,parameters:n}};function JF(e){return(e.method||"GET").toUpperCase()}var ZF=function(e){var t=e.headers||{};return t["Content-Type"]=t["Content-Type"]||function(e){var t;return e.data&&!e.upload&&"GET"!==JF(e)&&(t="application/x-www-form-urlencoded;charset=utf-8"),e.contentType||t}(e),t.Accept=t.Accept||XF(e),e.crossDomain||t["X-Requested-With"]||(t["X-Requested-With"]="XMLHttpRequest"),t};const eB=V({sendRequest:function(e){var t,n=zF.getXhr(),i=new ee,r=i.promise(),o=!l(e.async)||e.async,s=e.dataType,a=e.timeout||0;e.crossDomain=function(e){if(!Qe())return!0;var t=!1,n=We.createElement("a"),i=We.createElement("a");n.href=jF.location.href;try{i.href=e,i.href=i.href,t=n.protocol+"//"+n.host!==i.protocol+"//"+i.host}catch(r){t=!0}return t}(e.url);var c="jsonp"===s||"script"===s;void 0===e.cache&&(e.cache=!c);var u=function(e){if("jsonp"===e.dataType){var t=Math.random().toString().replace(/\D/g,""),n=e.jsonpCallback||"dxCallback"+Date.now()+"_"+t,i=e.jsonp||"callback";return e.data=e.data||{},e.data[i]=n,n}}(e),h=ZF(e),d=YF(e,h),p=d.url,f=d.parameters;if(u&&(jF[u]=function(e){i.resolve(e,$F,n)}),e.crossDomain&&c)return function(e){var t=GF({src:e});return new Promise((function(e,n){var i={load:e,error:n},r=function(e){i[e.type](),KF(t)};for(var o in i)We.listen(t,o,r);qF(t)}))}(p).then((function(){"jsonp"!==s&&i.resolve(null,$F,n)}),(function(){i.reject(n,WF)})),r;if(e.crossDomain&&!("withCredentials"in n))return i.reject(n,WF),r;if(n.open(JF(e),p,o,e.username,e.password),o&&(n.timeout=a,t=function(e,t){return e&&setTimeout((function(){t.customStatus="timeout",t.abort()}),e)}(a,n)),n.onreadystatechange=function(e){var r;4===n.readyState&&(clearTimeout(t),200<=(r=n.status)&&r<300?function(e){return 204!==e}(n.status)?function(t,n,i){var r=function(e){return e.responseType&&"text"!==e.responseType||"string"!==typeof e.responseText?e.response:e.responseText}(n);switch(i){case"jsonp":QF(r);break;case"script":QF(r),t.resolve(r,$F,n);break;case"json":try{t.resolve(JSON.parse(r),$F,n)}catch(e){t.reject(n,"parsererror",e)}break;default:t.resolve(r,$F,n)}}(i,n,s):i.resolve(null,"nocontent",n):i.reject(n,n.customStatus||WF))},e.upload&&(n.upload.onprogress=e.upload.onprogress,n.upload.onloadstart=e.upload.onloadstart,n.upload.onabort=e.upload.onabort),e.xhrFields)for(var m in e.xhrFields)n[m]=e.xhrFields[m];for(var g in"arraybuffer"===e.responseType&&(n.responseType=e.responseType),h)Object.prototype.hasOwnProperty.call(h,g)&&l(h[g])&&n.setRequestHeader(g,h[g]);return e.beforeSend&&e.beforeSend(n),n.send(f),r.abort=function(){n.abort()},r}}),tB={};const nB=function e(t,n,i){i=i||[],n=n||{};var r=function(e,t){return{name:e,args:t}},o=function(e){var o,s,a,l,u,h=new ee,d=function(e){var t=n.errorHandler;t&&t(e),GL(e),h.reject(e)};function p(e){switch(e.name){case"sortBy":return u=[e.args],!0;case"thenBy":if(!u)throw $L.Error("E4004");return u.push(e.args),!0}return!1}try{o=n.adapter,c(o)||(o=tB[o]),s=o(n),a=[].concat(i).concat(e);var f=s.optimize;for(f&&f(a);a.length;){if(!p(l=a[0])){if(u){a.unshift(r("multiSort",[u])),u=null;continue}if("enumerate"!==String(l.name)&&(!s[l.name]||!1===s[l.name].apply(s,l.args)))break}a.shift()}!function(){var e=a[0],t=[];e&&"multiSort"===e.name&&(a.shift(),w(e.args[0],(function(){t.push(r(t.length?"thenBy":"sortBy",this))}))),a=t.concat(a)}(),s.exec(t).done((function(e,t){if(a.length){var i=fF(e,{errorHandler:n.errorHandler});w(a,(function(){i=i[this.name].apply(i,this.args)})),i.done(h.resolve).fail(h.reject)}else h.resolve(e,t)})).fail(d)}catch(m){d(m)}return h.promise()},s={};return w(["sortBy","thenBy","filter","slice","select","groupBy"],(function(){var o=String(this);s[o]=function(){return e(t,n,i.concat(r(o,arguments)))}})),w(["count","min","max","sum","avg","aggregate","enumerate"],(function(){var e=String(this);s[e]=function(){return o.call(this,r(e,arguments))}})),s};var iB={array:fF,remote:nB};const rB=function(){var e=Array.isArray(arguments[0])?"array":"remote";return iB[e].apply(this,arguments)};var oB=SF.inherit({ctor:function(e){e=Array.isArray(e)?{data:e}:e||{},this.callBase(e);var t=e.data;if(t&&!Array.isArray(t))throw $L.Error("E4006");this._array=t||[]},createQuery:function(){return rB(this._array,{errorHandler:this._errorHandler})},_byKeyImpl:function(e){var t=iF(this,this._array,e);return-1===t?zL($L.Error("E4009")):UL(this._array[t])},_insertImpl:function(e){return tF(this,this._array,e)},_pushImpl:function(e){JL({keyInfo:this,data:this._array,changes:e})},_updateImpl:function(e,t){return eF(this,this._array,e,t)},_removeImpl:function(e){return nF(this,this._array,e)},clear:function(){this._eventsStrategy.fireEvent("modifying"),this._array=[],this._eventsStrategy.fireEvent("modified")}},"array");const sB=oB;var aB=["items"],lB="canceled",cB=e=>"pending"===e.state(),uB=e=>{switch(e.length){case 0:return;case 1:return e[0]}return[].slice.call(e)},hB=(e,t,n)=>Array.isArray(e)?t?((e,t,n)=>b(e,(e=>H({},ql(e,aB),{items:hB(e.items,t-1,n)}))))(e,t,n):b(e,n):e,dB=(e,t)=>{var n;return null!==(n=e)&&void 0!==n&&n.data&&(t=e,e=e.data),Array.isArray(e)||(e=[e]),{data:e,extra:t}},pB=e=>{var t={};return w(["useDefaultSearch","key","load","loadMode","cacheRawData","byKey","lookup","totalCount","insert","update","remove"],(function(){t[this]=e[this],delete e[this]})),new VF(t)},fB=(e,t)=>new VF({load:()=>eB.sendRequest({url:e,dataType:"json"}),loadMode:null===t||void 0===t?void 0:t.fromUrlLoadMode}),mB=(e,t)=>{var n;return"string"===typeof e&&(e={paginate:!1,store:fB(e,t)}),void 0===e&&(e=[]),void 0===(e=Array.isArray(e)||e instanceof SF?{store:e}:y({},e)).store&&(e.store=[]),n=e.store,"load"in e?n=pB(e):Array.isArray(n)?n=new sB(n):f(n)&&(n=(e=>{var t=e.type;return delete e.type,SF.create(t,e)})(y({},n))),e.store=n,e};class gB{constructor(){this._counter=-1,this._deferreds={}}add(e){return this._counter++,this._deferreds[this._counter]=e,this._counter}remove(e){return delete this._deferreds[e]}cancel(e){return e in this._deferreds&&(this._deferreds[e].reject(lB),!0)}cancelAll(){for(;this._counter>-1;)this.cancel(this._counter),this._counter--}}var vB=B.inherit({ctor(e){var t;if(e=mB(e),this._eventsStrategy=new ei(this,{syncStrategy:!0}),this._store=e.store,this._changedTime=0,0!==e.pushAggregationTimeout){var n,i,r=jL((e=>{n.resolve(),te(...i).done((()=>this._onPush(e))),i=void 0,n=void 0}),void 0===e.pushAggregationTimeout?()=>5*this._changedTime:e.pushAggregationTimeout);this._onPushHandler=e=>{this._aggregationTimeoutId=r(e.changes),n||(n=new ee),i=e.waitFor,e.waitFor.push(n.promise())},this._store.on("beforePushAggregation",this._onPushHandler)}else this._onPushHandler=e=>this._onPush(e),this._store.on("push",this._onPushHandler);this._storeLoadOptions=this._extractLoadOptions(e),this._mapFunc=e.map,this._postProcessFunc=e.postProcess,this._pageIndex=void 0!==e.pageIndex?e.pageIndex:0,this._pageSize=void 0!==e.pageSize?e.pageSize:20,this._loadingCount=0,this._loadQueue=this._createLoadQueue(),this._searchValue="searchValue"in e?e.searchValue:null,this._searchOperation=e.searchOperation||"contains",this._searchExpr=e.searchExpr,this._paginate=e.paginate,this._reshapeOnPush=null!==(t=e.reshapeOnPush)&&void 0!==t&&t,w(["onChanged","onLoadError","onLoadingChanged","onCustomizeLoadResult","onCustomizeStoreLoadOptions"],((t,n)=>{n in e&&this.on(n.substr(2,1).toLowerCase()+n.substr(3),e[n])})),this._operationManager=new gB,this._init()},_init(){this._items=[],this._userData={},this._totalCount=-1,this._isLoaded=!1,l(this._paginate)||(this._paginate=!this.group()),this._isLastPage=!this._paginate},dispose(){var e;this._store.off("beforePushAggregation",this._onPushHandler),this._store.off("push",this._onPushHandler),this._eventsStrategy.dispose(),clearTimeout(this._aggregationTimeoutId),null===(e=this._delayedLoadTask)||void 0===e||e.abort(),this._operationManager.cancelAll(),delete this._store,delete this._items,delete this._delayedLoadTask,this._disposed=!0},_extractLoadOptions(e){var t={},n=["sort","filter","langParams","select","group","requireTotalCount"],i=this._store._customLoadOptions();return i&&(n=n.concat(i)),w(n,(function(){t[this]=e[this]})),t},loadOptions(){return this._storeLoadOptions},items(){return this._items},pageIndex(e){if(!h(e))return this._pageIndex;this._pageIndex=e,this._isLastPage=!this._paginate},paginate(e){if(!a(e))return this._paginate;this._paginate!==e&&(this._paginate=e,this.pageIndex(0))},pageSize(e){if(!h(e))return this._pageSize;this._pageSize=e},isLastPage(){return this._isLastPage},generateStoreLoadOptionAccessor(e){return t=>{var n=uB(t);if(void 0===n)return this._storeLoadOptions[e];this._storeLoadOptions[e]=n}},sort(){for(var e=arguments.length,t=new Array(e),n=0;n1&&(e=[].slice.call(arguments)),this._searchExpr=e,this.pageIndex(0)},store(){return this._store},key(){var e;return null===(e=this._store)||void 0===e?void 0:e.key()},totalCount(){return this._totalCount},isLoaded(){return this._isLoaded},isLoading(){return this._loadingCount>0},beginLoading(){this._changeLoadingCount(1)},endLoading(){this._changeLoadingCount(-1)},_createLoadQueue:()=>HF(),_changeLoadingCount(e){var t=this.isLoading();this._loadingCount+=e;var n=this.isLoading();t^n&&this._eventsStrategy.fireEvent("loadingChanged",[n])},_scheduleLoadCallbacks(e){this.beginLoading(),e.always((()=>{this.endLoading()}))},_scheduleFailCallbacks(e){var t=this;e.fail((function(){for(var e=arguments.length,n=new Array(e),i=0;ithis._fireChanged()))},loadSingle(e,t){var n=new ee,i=this.key(),r=this._store,o=this._createStoreLoadOptions();return this._scheduleFailCallbacks(n),arguments.length<2&&(t=e,e=i),delete o.skip,delete o.group,delete o.refresh,delete o.pageIndex,delete o.searchString,(e===i||r instanceof VF&&!r._byKeyViaLoad()?r.byKey(t,o):(o.take=1,o.filter=o.filter?[o.filter,[e,t]]:[e,t],r.load(o))).fail(n.reject).done((e=>{var t=Array.isArray(e)&&!e.length;!l(e)||t?n.reject(new $L.Error("E4009")):(Array.isArray(e)||(e=[e]),n.resolve(this._applyMapFunction(e)[0]))})),n.promise()},load(){var e=new ee,t=()=>{if(!this._disposed&&cB(e))return this._loadFromStore(n,e)};this._scheduleLoadCallbacks(e),this._scheduleFailCallbacks(e),this._scheduleChangedCallbacks(e);var n=this._createLoadOperation(e);return this._eventsStrategy.fireEvent("customizeStoreLoadOptions",[n]),this._loadQueue.add((()=>("number"===typeof n.delay?this._delayedLoadTask=_e(t,n.delay):t(),e.promise()))),e.promise({operationId:n.operationId})},_onPush(e){if(this._reshapeOnPush)this.load();else{var t={changes:e};this._eventsStrategy.fireEvent("changing",[t]);var n=this.group(),i=this.items(),r=0,o=this.paginate()||n?e.filter((e=>"update"===e.type)):e;n&&(r=Array.isArray(n)?n.length:1),this._mapFunc&&o.forEach((e=>{"insert"===e.type&&(e.data=this._mapFunc(e.data))})),t.postProcessChanges&&(o=t.postProcessChanges(o)),JL({keyInfo:this.store(),data:i,changes:o,groupCount:r,useInsertIndex:!0}),this._fireChanged([{changes:e}])}},_createLoadOperation(e){var t=this._operationManager.add(e),n=this._createStoreLoadOptions();return this._store&&!p(null===n||void 0===n?void 0:n.langParams)&&(this._store._langParams=H({},this._store._langParams,n.langParams)),e.always((()=>this._operationManager.remove(t))),{operationId:t,storeLoadOptions:n}},reload(){return this.store()._clearCache(),this._init(),this.load()},cancel(e){return this._operationManager.cancel(e)},cancelAll(){return this._operationManager.cancelAll()},_addSearchOptions(e){this._disposed||(this.store()._useDefaultSearch?this._addSearchFilter(e):(e.searchOperation=this._searchOperation,e.searchValue=this._searchValue,e.searchExpr=this._searchExpr))},_createStoreLoadOptions(){var e=y({},this._storeLoadOptions);return this._addSearchOptions(e),this._paginate&&this._pageSize&&(e.skip=this._pageIndex*this._pageSize,e.take=this._pageSize),e.userData=this._userData,e},_addSearchFilter(e){var t=this._searchValue,n=this._searchOperation,i=this._searchExpr,r=[];t&&(i||(i="this"),Array.isArray(i)||(i=[i]),w(i,(function(e,i){r.length&&r.push("or"),r.push([i,n,t])})),e.filter?e.filter=[r,e.filter]:e.filter=r)},_loadFromStore(e,t){var n=(n,i)=>{if(!this._disposed&&cB(t)){var r=y(dB(n,i),e);this._eventsStrategy.fireEvent("customizeLoadResult",[r]),te(r.data).done((e=>{r.data=e,this._processStoreLoadResult(r,t)})).fail(t.reject)}};return e.data?(new ee).resolve(e.data).done(n):this.store().load(e.storeLoadOptions).done(n).fail(t.reject)},_processStoreLoadResult(e,t){var n=e.data,i=e.extra,r=e.storeLoadOptions,o=()=>(this._isLoaded=!0,this._totalCount=isFinite(i.totalCount)?i.totalCount:-1,t.resolve(n,i));this._disposed||(n=this._applyPostProcessFunction(this._applyMapFunction(n)),d(i)||(i={}),this._items=n,(!n.length||!this._paginate||this._pageSize&&n.length{this.store().totalCount(r).done((function(e){i.totalCount=e,o()})).fail(t.reject)})():o())},_applyMapFunction(e){return this._mapFunc?((e,t,n)=>{var i=n?LL(n).length:0;return hB(e,i,t)})(e,this._mapFunc,this.group()):e},_applyPostProcessFunction(e){return this._postProcessFunc?this._postProcessFunc(e):e},on(e,t){return this._eventsStrategy.on(e,t),this},off(e,t){return this._eventsStrategy.off(e,t),this}}),_B={load:()=>ee().reject(),loadSingle:()=>ee().reject(),loadFromStore:()=>ee().reject(),loadNextPage:()=>ee().reject(),loadOptions:Pe,userData:Pe,cancel:Pe,cancelAll:Pe,filter:Pe,addSearchFilter:Pe,group:Pe,paginate:Pe,pageSize:Pe,pageIndex:Pe,resetDataSourcePageIndex:Pe,totalCount:Pe,isLastPage:Pe,isLoading:Pe,isLoaded:Pe,searchValue:Pe,searchOperation:Pe,searchExpr:Pe,select:Pe,key:Pe,keyOf:Pe,store:Pe,items:Pe,applyMapFunction:Pe,getDataSource:Pe,reload:Pe,on:Pe,off:Pe};const yB=class{constructor(e){if(!e)return _B;this._dataSource=e}load(){return this._dataSource.load()}loadSingle(e,t){return arguments.length<2&&(t=e,e=this.key()),this._dataSource.loadSingle(e,t)}loadFromStore(e){return this.store().load(e)}loadNextPage(){return this.pageIndex(1+this.pageIndex()),this.load()}loadOptions(){return this._dataSource.loadOptions()}userData(){return this._dataSource._userData}cancel(e){this._dataSource.cancel(e)}cancelAll(){this._dataSource.cancelAll()}filter(e){return this._dataSource.filter(e)}addSearchFilter(e){this._dataSource._addSearchFilter(e)}group(e){return this._dataSource.group(e)}paginate(){return this._dataSource.paginate()}pageSize(){return this._dataSource._pageSize}pageIndex(e){return this._dataSource.pageIndex(e)}resetDataSourcePageIndex(){this.pageIndex()&&(this.pageIndex(0),this.load())}totalCount(){return this._dataSource.totalCount()}isLastPage(){return this._dataSource.isLastPage()||!this._dataSource._pageSize}isLoading(){return this._dataSource.isLoading()}isLoaded(){return this._dataSource.isLoaded()}searchValue(e){return arguments.length?this._dataSource.searchValue(e):this._dataSource.searchValue()}searchOperation(e){return this._dataSource.searchOperation(e)}searchExpr(e){return arguments.length?this._dataSource.searchExpr(e):this._dataSource.searchExpr()}select(){return this._dataSource.select(...arguments)}key(){return this._dataSource.key()}keyOf(e){return this.store().keyOf(e)}store(){return this._dataSource.store()}items(){return this._dataSource.items()}applyMapFunction(e){return this._dataSource._applyMapFunction(e)}getDataSource(){return this._dataSource||null}reload(){return this._dataSource.reload()}on(e,t){this._dataSource.on(e,t)}off(e,t){this._dataSource.off(e,t)}};var bB="_dataSourceOptions",wB="_dataSourceChangedHandler",CB="_dataSourceLoadErrorHandler",SB="_dataSourceLoadingChangedHandler",xB="_dataSourceFromUrlLoadMode",EB="_getSpecificDataSourceOption",IB="_normalizeDataSource",TB={postCtor:function(){this.on("disposing",function(){this._disposeDataSource()}.bind(this))},_refreshDataSource:function(){this._initDataSource(),this._loadDataSource()},_initDataSource:function(){var e,t,n=EB in this?this[EB]():this.option("dataSource");this._disposeDataSource(),n&&(n instanceof vB?(this._isSharedDataSource=!0,this._dataSource=n):(e=bB in this?this[bB]():{},t=this._dataSourceType?this._dataSourceType():vB,n=mB(n,{fromUrlLoadMode:xB in this&&this[xB]()}),this._dataSource=new t(y(!0,{},e,n))),IB in this&&(this._dataSource=this[IB](this._dataSource)),this._addDataSourceHandlers(),this._initDataController())},_initDataController:function(){var e,t=null===(e=this.option)||void 0===e?void 0:e.call(this,"_dataController"),n=this._dataSource;this._dataController=t||new yB(n)},_addDataSourceHandlers:function(){wB in this&&this._addDataSourceChangeHandler(),CB in this&&this._addDataSourceLoadErrorHandler(),SB in this&&this._addDataSourceLoadingChangedHandler(),this._addReadyWatcher()},_addReadyWatcher:function(){this._dataSource.on("loadingChanged",function(e){this._ready&&this._ready(!e)}.bind(this))},_addDataSourceChangeHandler:function(){var e=this._dataSource;this._proxiedDataSourceChangedHandler=function(t){this[wB](e.items(),t)}.bind(this),e.on("changed",this._proxiedDataSourceChangedHandler)},_addDataSourceLoadErrorHandler:function(){this._proxiedDataSourceLoadErrorHandler=this[CB].bind(this),this._dataSource.on("loadError",this._proxiedDataSourceLoadErrorHandler)},_addDataSourceLoadingChangedHandler:function(){this._proxiedDataSourceLoadingChangedHandler=this[SB].bind(this),this._dataSource.on("loadingChanged",this._proxiedDataSourceLoadingChangedHandler)},_loadDataSource:function(){var e=this._dataSource;e&&(e.isLoaded()?this._proxiedDataSourceChangedHandler&&this._proxiedDataSourceChangedHandler():e.load())},_loadSingle:function(e,t){return e="this"===e?this._dataSource.key()||"this":e,this._dataSource.loadSingle(e,t)},_isLastPage:function(){return!this._dataSource||this._dataSource.isLastPage()||!this._dataSource._pageSize},_isDataSourceLoading:function(){return this._dataSource&&this._dataSource.isLoading()},_disposeDataSource:function(){this._dataSource&&(this._isSharedDataSource?(delete this._isSharedDataSource,this._proxiedDataSourceChangedHandler&&this._dataSource.off("changed",this._proxiedDataSourceChangedHandler),this._proxiedDataSourceLoadErrorHandler&&this._dataSource.off("loadError",this._proxiedDataSourceLoadErrorHandler),this._proxiedDataSourceLoadingChangedHandler&&this._dataSource.off("loadingChanged",this._proxiedDataSourceLoadingChangedHandler)):this._dataSource.dispose(),delete this._dataSource,delete this._proxiedDataSourceChangedHandler,delete this._proxiedDataSourceLoadErrorHandler,delete this._proxiedDataSourceLoadingChangedHandler)},getDataSource:function(){return this._dataSource||null}};const kB=TB;var DB=B.inherit({ctor:function(e,t,n){this._$element=e,this._options=t,this._rawData=n,Yn(e,this,this._dispose),this._render()},_render:function(){var e=Un("").addClass("dx-item-content-placeholder");this._$element.append(e),this._watchers=[],this._renderWatchers()},_renderWatchers:function(){this._startWatcher("disabled",this._renderDisabled.bind(this)),this._startWatcher("visible",this._renderVisible.bind(this))},_startWatcher:function(e,t){var n=this._rawData,i=this._options.fieldGetter(e),r=function(e,t,n){var i,r=function(e){i!==e&&(n(e,i),i=e)};return{dispose:e(t,r),force:function(){r(t())}}}(this._options.watchMethod(),(function(){return i(n)}),function(e,n){this._dirty=!0,t(e,n)}.bind(this));this._watchers.push(r)},setDataField:function(){if(this._dirty=!1,w(this._watchers,(function(e,t){t.force()})),this._dirty)return!0},_renderDisabled:function(e,t){this._$element.toggleClass("dx-state-disabled",!!e),this._$element.attr("aria-disabled",!!e),this._updateOwnerFocus(e)},_updateOwnerFocus:function(e){var t=this._options.owner;t&&e&&t._resetItemFocus(this._$element)},_renderVisible:function(e,t){this._$element.toggleClass("dx-state-invisible",void 0!==e&&!e)},_dispose:function(){w(this._watchers,(function(e,t){t.dispose()}))}});DB.getInstance=function(e){return Jn(e,this)};const OB=DB;var AB=Math.abs,RB="dxhold";Zc({emitter:$c.inherit({start:function(e){this._startEventData=os(e),this._startTimer(e)},_startTimer:function(e){var t="timeout"in this?this.timeout:750;this._holdTimer=setTimeout(function(){this._requestAccept(e),this._fireEvent(RB,e,{target:e.target}),this._forgetAccept()}.bind(this),t)},move:function(e){this._touchWasMoved(e)&&this._cancel(e)},_touchWasMoved:function(e){var t=ss(this._startEventData,os(e));return AB(t.x)>5||AB(t.y)>5},end:function(){this._stopTimer()},_stopTimer:function(){clearTimeout(this._holdTimer)},cancel:function(){this._stopTimer()},dispose:function(){this._stopTimer()}}),bubble:!0,events:[RB]});const PB=RB;var NB="dxContexMenu",MB=ds("contextmenu",NB),LB=ds(PB,NB),FB="dxcontextmenu",BB=B.inherit({setup:function(e){var t=Un(e);Dt.on(t,MB,this._contextMenuHandler.bind(this)),(fc||aa.isSimulator())&&Dt.on(t,LB,this._holdHandler.bind(this))},_holdHandler:function(e){ns(e)&&!aa.isSimulator()||this._fireContextMenu(e)},_contextMenuHandler:function(e){this._fireContextMenu(e)},_fireContextMenu:function(e){return us({type:FB,originalEvent:e})},teardown:function(e){Dt.off(e,"."+NB)}});$n(FB,new BB);var VB=FB,HB=function(e,t,n,i,r){var o,a=((e,t,n)=>t((()=>e),n))(e,t,(function(e){o&&o(),function(e){return-1===["object","array","function"].indexOf(s(e))}(e)?r(e):o=function(e,t,n,i,r){var o={},s=n.slice(),a=n.map((function(n){var a=i[n];return t(a?()=>a(e):()=>e[n],(function(e){if(o[n]=e,s.length){var t=s.indexOf(n);t>=0&&s.splice(t,1)}s.length||r(o)}))}));return function(){a.forEach((e=>e()))}}(e,t,n,i,r)}));return function(){o&&o(),a&&a()}};class UB extends Ra{constructor(e,t,n,i){super(),this._render=e,this._fields=t,this._fieldsMap=i||{},this._watchMethod=n}_renderCore(e){var t=Un(e.container),n=HB(e.model,this._watchMethod,this._fields,this._fieldsMap,(n=>{t.empty(),this._render(t,n,e.model)}));return Dt.on(t,Wn,n),t.contents()}}var zB="dx-item",jB="-content",$B="dx-item-content-placeholder",WB="dx-template-wrapper",GB=/^([^.]+\[\d+\]\.)+([\w.]+)$/,KB="up",qB="down",QB="left",XB="right",YB="last",JB="first",ZB=Rp.inherit({_activeStateUnit:"."+zB,_supportedKeys:function(){var e=function(e,t){ps(t)||(t.preventDefault(),t.stopPropagation(),this._moveFocus(e,t))};return y(this.callBase(),{space:function(e){e.preventDefault(),this._enterKeyHandler(e)},enter:this._enterKeyHandler,leftArrow:e.bind(this,QB),rightArrow:e.bind(this,XB),upArrow:e.bind(this,KB),downArrow:e.bind(this,qB),pageUp:e.bind(this,KB),pageDown:e.bind(this,qB),home:e.bind(this,JB),end:e.bind(this,YB)})},_enterKeyHandler:function(e){var t=Un(this.option("focusedElement"));if(t.length){var n=this._getItemData(t);null!==n&&void 0!==n&&n.onClick&&this._itemEventHandlerByHandler(t,n.onClick,{event:e}),this._itemClickHandler(y({},e,{target:t.get(0),currentTarget:t.get(0)}))}},_getDefaultOptions:function(){return y(this.callBase(),{selectOnFocus:!1,loopItemFocus:!0,items:[],itemTemplate:"item",onItemRendered:null,onItemClick:null,onItemHold:null,itemHoldTimeout:750,onItemContextMenu:null,onFocusedItemChanged:null,noDataText:Li.format("dxCollectionWidget-noDataText"),encodeNoDataText:!1,dataSource:null,_dataController:null,_itemAttributes:{},itemTemplateProperty:"template",focusOnSelectedItem:!0,focusedElement:null,displayExpr:void 0,disabledExpr:function(e){return e?e.disabled:void 0},visibleExpr:function(e){return e?e.visible:void 0}})},_init:function(){this._compileDisplayGetter(),this._initDataController(),this.callBase(),this._cleanRenderedItems(),this._refreshDataSource()},_compileDisplayGetter:function(){var e=this.option("displayExpr");this._displayGetter=e?de(this.option("displayExpr")):void 0},_initTemplates:function(){this._initItemsFromMarkup(),this._initDefaultItemTemplate(),this.callBase()},_getAnonymousTemplateName:function(){return"item"},_initDefaultItemTemplate:function(){var e=this._getFieldsMap();this._templateManager.addDefaultTemplates({item:new UB(function(t,n){f(n)?this._prepareDefaultItemTemplate(n,t):(e&&c(e.text)&&(n=e.text(n)),t.text(String(ve(n,""))))}.bind(this),this._getBindableFields(),this.option("integrationOptions.watchMethod"),e)})},_getBindableFields:function(){return["text","html"]},_getFieldsMap:function(){if(this._displayGetter)return{text:this._displayGetter}},_prepareDefaultItemTemplate:function(e,t){l(e.text)&&t.text(e.text),l(e.html)&&t.html(e.html)},_initItemsFromMarkup:function(){var e=Wa(this.$element(),"dxItem");if(e.length&&!this.option("items").length){var t=e.map((e=>{var{element:t,options:n}=e;return/\S/.test(t.innerHTML)&&!n.template?n.template=this._prepareItemTemplate(t):Un(t).remove(),n}));this.option("items",t)}},_prepareItemTemplate:function(e){var t="tmpl-"+new K,n=Un(e).detach().clone().removeAttr("data-options").addClass(WB);return this._saveTemplate(t,n),t},_dataSourceOptions:function(){return{paginate:!1}},_cleanRenderedItems:function(){this._renderedItemsCount=0},_focusTarget:function(){return this.$element()},_focusInHandler:function(e){if(this.callBase.apply(this,arguments),this._isFocusTarget(e.target)){var t=Un(this.option("focusedElement"));if(t.length)this._setFocusedItem(t);else{var n=this._getActiveItem();n.length&&this.option("focusedElement",La(n))}}},_focusOutHandler:function(){this.callBase.apply(this,arguments);var e=Un(this.option("focusedElement"));this._updateFocusedItemState(e,!1)},_findActiveTarget(e){return e.find(this._activeStateUnit)},_getActiveItem:function(e){var t=Un(this.option("focusedElement"));if(t.length)return t;var n=this.option("focusOnSelectedItem")?this.option("selectedIndex"):0,i=this._getActiveElement(),r=i.length-1;return n<0&&(n=e?r:0),i.eq(n)},_moveFocus:function(e){var t,n=this._getAvailableItems();switch(e){case"pageup":case KB:t=this._prevItem(n);break;case"pagedown":case qB:t=this._nextItem(n);break;case XB:t=this.option("rtlEnabled")?this._prevItem(n):this._nextItem(n);break;case QB:t=this.option("rtlEnabled")?this._nextItem(n):this._prevItem(n);break;case JB:t=n.first();break;case YB:t=n.last();break;default:return!1}0!==t.length&&this.option("focusedElement",La(t))},_getVisibleItems:function(e){return(e=e||this._itemElements()).filter(":visible")},_getAvailableItems:function(e){return this._getVisibleItems(e)},_prevItem:function(e){var t=this._getActiveItem(),n=e.index(t),i=e.last(),r=Un(e[n-1]),o=this.option("loopItemFocus");return 0===r.length&&o&&(r=i),r},_nextItem:function(e){var t=this._getActiveItem(!0),n=e.index(t),i=e.first(),r=Un(e[n+1]),o=this.option("loopItemFocus");return 0===r.length&&o&&(r=i),r},_selectFocusedItem:function(e){this.selectItem(e)},_updateFocusedItemState:function(e,t,n){var i=Un(e);i.length&&(this._refreshActiveDescendant(),this._refreshItemId(i,n),this._toggleFocusClass(t,i)),this._updateParentActiveDescendant()},_refreshActiveDescendant:function(e){this.setAria("activedescendant",l(this.option("focusedElement"))?this.getFocusedItemId():null,e)},_refreshItemId:function(e,t){!t&&this.option("focusedElement")?this.setAria("id",this.getFocusedItemId(),e):this.setAria("id",null,e)},_isDisabled:e=>e&&"true"===Un(e).attr("aria-disabled"),_setFocusedItem:function(e){if(e&&e.length){this._updateFocusedItemState(e,!0),this.onFocusedItemChanged(this.getFocusedItemId());var{selectOnFocus:t}=this.option(),n=this._isDisabled(e);t&&!n&&this._selectFocusedItem(e)}},_findItemElementByItem:function(e){var t=Un(),n=this;return this.itemElements().each((function(){var i=Un(this);if(i.data(n._itemDataKey())===e)return t=i,!1})),t},_getIndexByItem:function(e){return this.option("items").indexOf(e)},_itemOptionChanged:function(e,t,n,i){var r=this._findItemElementByItem(e);r.length&&(this.constructor.ItemClass.getInstance(r).setDataField(t,n)||this._refreshItem(r,e),"disabled"===t&&n&&this._resetItemFocus(r))},_resetItemFocus(e){e.is(this.option("focusedElement"))&&this.option("focusedElement",null)},_refreshItem:function(e){var t=this._getItemData(e),n=e.data(this._itemIndexKey());this._renderItem(this._renderedItemsCount+n,t,null,e)},_updateParentActiveDescendant:Pe,_optionChanged:function(e){if("items"===e.name){var t=e.fullName.match(GB);if(t&&t.length){var n=t[t.length-1],i=e.fullName.replace("."+n,""),r=this.option(i);return void this._itemOptionChanged(r,n,e.value,e.previousValue)}}switch(e.name){case"items":case"_itemAttributes":case"itemTemplateProperty":case"useItemTextAsTitle":this._cleanRenderedItems(),this._invalidate();break;case"dataSource":this._refreshDataSource(),this._renderEmptyMessage();break;case"noDataText":case"encodeNoDataText":this._renderEmptyMessage();break;case"itemTemplate":case"visibleExpr":case"disabledExpr":this._invalidate();break;case"onItemRendered":this._createItemRenderAction();break;case"onItemClick":case"selectOnFocus":case"loopItemFocus":case"focusOnSelectedItem":break;case"onItemHold":case"itemHoldTimeout":this._attachHoldEvent();break;case"onItemContextMenu":this._attachContextMenuEvent();break;case"onFocusedItemChanged":this.onFocusedItemChanged=this._createActionByOption("onFocusedItemChanged");break;case"focusedElement":this._updateFocusedItemState(e.previousValue,!1,!0),this._setFocusedItem(Un(e.value));break;case"displayExpr":this._compileDisplayGetter(),this._initDefaultItemTemplate(),this._invalidate();break;default:this.callBase(e)}},_invalidate:function(){return this.option("focusedElement",null),this.callBase.apply(this,arguments)},_loadNextPage:function(){return this._expectNextPageLoading(),this._dataController.loadNextPage()},_expectNextPageLoading:function(){this._startIndexForAppendedItems=0},_expectLastItemLoading:function(){this._startIndexForAppendedItems=-1},_forgetNextPageLoading:function(){this._startIndexForAppendedItems=null},_dataSourceChangedHandler:function(e){var t=this.option("items");this._initialized&&t&&this._shouldAppendItems()?(this._renderedItemsCount=t.length,this._isLastPage()&&-1===this._startIndexForAppendedItems||(this.option().items=t.concat(e.slice(this._startIndexForAppendedItems))),this._forgetNextPageLoading(),this._refreshContent()):this.option("items",e.slice())},_refreshContent:function(){this._prepareContent(),this._renderContent()},_dataSourceLoadErrorHandler:function(){this._forgetNextPageLoading(),this.option("items",this.option("items"))},_shouldAppendItems:function(){return null!=this._startIndexForAppendedItems&&this._allowDynamicItemsAppend()},_allowDynamicItemsAppend:function(){return!1},_clean:function(){this._cleanFocusState(),this._cleanItemContainer(),this._inkRipple&&delete this._inkRipple,this._resetActiveState()},_cleanItemContainer:function(){Un(this._itemContainer()).empty()},_dispose:function(){this.callBase(),clearTimeout(this._itemFocusTimeout)},_refresh:function(){this._cleanRenderedItems(),this.callBase.apply(this,arguments)},_itemContainer:function(){return this.$element()},_itemClass:function(){return zB},_itemContentClass:function(){return this._itemClass()+jB},_selectedItemClass:function(){return"dx-item-selected"},_itemResponseWaitClass:function(){return"dx-item-response-wait"},_itemSelector:function(){return"."+this._itemClass()},_itemDataKey:function(){return"dxItemData"},_itemIndexKey:function(){return"dxItemIndex"},_itemElements:function(){return this._itemContainer().find(this._itemSelector())},_initMarkup:function(){this.callBase(),this.onFocusedItemChanged=this._createActionByOption("onFocusedItemChanged"),this.$element().addClass("dx-collection"),this._prepareContent()},_prepareContent:Ee((function(){this._renderContentImpl()})),_renderContent:function(){this._fireContentReadyAction()},_render:function(){this.callBase(),this._attachClickEvent(),this._attachHoldEvent(),this._attachContextMenuEvent()},_getPointerEvent:()=>zc.down,_attachClickEvent(){var e=this._itemSelector(),t=this._getPointerEvent(),n=ds(eu,this.NAME),i=ds(t,this.NAME),r=new va((e=>{var{event:t}=e;this._itemPointerDownHandler(t)}));Dt.off(this._itemContainer(),n,e),Dt.off(this._itemContainer(),i,e),Dt.on(this._itemContainer(),n,e,(e=>this._itemClickHandler(e))),Dt.on(this._itemContainer(),i,e,(e=>{r.execute({element:Un(e.target),event:e})}))},_itemClickHandler:function(e,t,n){this._itemDXEventHandler(e,"onItemClick",t,n)},_itemPointerDownHandler:function(e){this.option("focusStateEnabled")&&(this._itemFocusHandler=function(){if(clearTimeout(this._itemFocusTimeout),this._itemFocusHandler=null,!e.isDefaultPrevented()){var t=Un(e.target),n=t.closest(this._itemElements()),i=this._closestFocusable(t);n.length&&this._isFocusTarget(null===i||void 0===i?void 0:i.get(0))&&this.option("focusedElement",La(n))}}.bind(this),this._itemFocusTimeout=setTimeout(this._forcePointerDownFocus.bind(this)))},_closestFocusable:function(e){if(e.is(Go))return e;for(e=e.parent();e.length&&!We.isDocument(e.get(0))&&!We.isDocumentFragment(e.get(0));){if(e.is(Go))return e;e=e.parent()}},_forcePointerDownFocus:function(){this._itemFocusHandler&&this._itemFocusHandler()},_updateFocusState:function(){this.callBase.apply(this,arguments),this._forcePointerDownFocus()},_attachHoldEvent:function(){var e=this._itemContainer(),t=this._itemSelector(),n=ds(PB,this.NAME);Dt.off(e,n,t),Dt.on(e,n,t,{timeout:this._getHoldTimeout()},this._itemHoldHandler.bind(this))},_getHoldTimeout:function(){return this.option("itemHoldTimeout")},_shouldFireHoldEvent:function(){return this.hasActionSubscription("onItemHold")},_itemHoldHandler:function(e){this._shouldFireHoldEvent()?this._itemDXEventHandler(e,"onItemHold"):e.cancel=!0},_attachContextMenuEvent:function(){var e=this._itemContainer(),t=this._itemSelector(),n=ds(VB,this.NAME);Dt.off(e,n,t),Dt.on(e,n,t,this._itemContextMenuHandler.bind(this))},_shouldFireContextMenuEvent:function(){return this.hasActionSubscription("onItemContextMenu")},_itemContextMenuHandler:function(e){this._shouldFireContextMenuEvent()?this._itemDXEventHandler(e,"onItemContextMenu"):e.cancel=!0},_renderContentImpl:function(){var e=this.option("items")||[];this._renderedItemsCount?this._renderItems(e.slice(this._renderedItemsCount)):this._renderItems(e)},_renderItems:function(e){e.length&&w(e,function(e,t){this._renderItem(this._renderedItemsCount+e,t)}.bind(this)),this._renderEmptyMessage()},_getItemsContainer:function(){return this._itemContainer()},_setAttributes(e){var t=H({},this.option("_itemAttributes")),{class:n}=t;if(n){var i=e.get(0).className;t.class=[i,n].join(" ")}e.attr(t)},_renderItem:function(e,t,n,i){var r,o=null!==(r=null===e||void 0===e?void 0:e.item)&&void 0!==r?r:e;n=n||this._getItemsContainer();var s=this._renderItemFrame(o,t,n,i);this._setElementData(s,t,o),this._setAttributes(s),this._attachItemClickEvent(t,s);var a=this._getItemContent(s),l=this._renderItemContent({index:o,itemData:t,container:La(a),contentClass:this._itemContentClass(),defaultTemplateName:this.option("itemTemplate")}),c=this;return te(l).done((function(n){c._postprocessRenderItem({itemElement:s,itemContent:n,itemData:t,itemIndex:o}),c._executeItemRenderAction(e,t,La(s))})),s},_getItemContent:function(e){var t=e.find("."+$B);return t.removeClass($B),t},_attachItemClickEvent:function(e,t){e&&e.onClick&&Dt.on(t,eu,function(n){this._itemEventHandlerByHandler(t,e.onClick,{event:n})}.bind(this))},_renderItemContent:function(e){var t=this._getItemTemplateName(e),n=this._getTemplate(t);this._addItemContentClasses(e);var i=Un(this._createItemByTemplate(n,e));return i.hasClass(WB)?this._renderItemContentByNode(e,i):e.container},_renderItemContentByNode:function(e,t){return Un(e.container).replaceWith(t),e.container=La(t),this._addItemContentClasses(e),t},_addItemContentClasses:function(e){var t=[zB+jB,e.contentClass];Un(e.container).addClass(t.join(" "))},_appendItemToContainer:function(e,t,n){t.appendTo(e)},_renderItemFrame:function(e,t,n,i){var r=Un("
");if(new this.constructor.ItemClass(r,this._itemOptions(),t||{}),i&&i.length?i.replaceWith(r):this._appendItemToContainer.call(this,n,r,e),this.option("useItemTextAsTitle")){var o=this._displayGetter?this._displayGetter(t):t;r.attr("title",o)}return r},_itemOptions:function(){var e=this;return{watchMethod:function(){return e.option("integrationOptions.watchMethod")},owner:e,fieldGetter:function(t){var n=e.option(t+"Expr");return de(n)}}},_postprocessRenderItem:Pe,_executeItemRenderAction:function(e,t,n){this._getItemRenderAction()({itemElement:n,itemIndex:e,itemData:t})},_setElementData:function(e,t,n){e.addClass([zB,this._itemClass()].join(" ")).data(this._itemDataKey(),t).data(this._itemIndexKey(),n)},_createItemRenderAction:function(){return this._itemRenderAction=this._createActionByOption("onItemRendered",{element:this.element(),excludeValidators:["disabled","readOnly"],category:"rendering"})},_getItemRenderAction:function(){return this._itemRenderAction||this._createItemRenderAction()},_getItemTemplateName:function(e){var t=e.itemData,n=e.templateProperty||this.option("itemTemplateProperty");return t&&t[n]||e.defaultTemplateName},_createItemByTemplate:function(e,t){return e.render({model:t.itemData,container:t.container,index:t.index,onRendered:this._onItemTemplateRendered(e,t)})},_onItemTemplateRendered:function(){return Pe},_emptyMessageContainer:function(){return this._itemContainer()},_renderEmptyMessage:function(e){e=e||this.option("items");var t=this.option("noDataText"),n=!t||e&&e.length||this._dataController.isLoading();n&&this._$noData&&(this._$noData.remove(),this._$noData=null,this.setAria("label",void 0)),n||(this._$noData=this._$noData||Un("
").addClass("dx-empty-message"),this._$noData.appendTo(this._emptyMessageContainer()),this.option("encodeNoDataText")?this._$noData.text(t):this._$noData.html(t)),this.$element().toggleClass("dx-empty-collection",!n)},_itemDXEventHandler:function(e,t,n,i){this._itemEventHandler(e.target,t,y(n,{event:e}),i)},_itemEventHandler:function(e,t,n,i){var r=this._createActionByOption(t,y({validatingTargetName:"itemElement"},i));return this._itemEventHandlerImpl(e,r,n)},_itemEventHandlerByHandler:function(e,t,n,i){var r=this._createAction(t,y({validatingTargetName:"itemElement"},i));return this._itemEventHandlerImpl(e,r,n)},_itemEventHandlerImpl:function(e,t,n){var i=this._closestItemElement(Un(e)),r=y({},n);return t(y(n,this._extendActionArgs(i),r))},_extendActionArgs:function(e){return{itemElement:La(e),itemIndex:this._itemElements().index(e),itemData:this._getItemData(e)}},_closestItemElement:function(e){return Un(e).closest(this._itemSelector())},_getItemData:function(e){return Un(e).data(this._itemDataKey())},_getSummaryItemsSize(e,t,n){var i=0;return t&&w(t,(function(t,r){"width"===e?i+=wn(r,n||!1):"height"===e&&(i+=Cn(r,n||!1))})),i},getFocusedItemId:function(){return this._focusedItemId||(this._focusedItemId="dx-"+new K),this._focusedItemId},itemElements:function(){return this._itemElements()},itemsContainer:function(){return this._itemContainer()}}).include(kB);ZB.ItemClass=OB;const eV=ZB;var tV=B.abstract,nV=B.inherit({ctor:function(e){this._collectionWidget=e},getIndexByItemData:tV,getItemDataByIndex:tV,getKeysByItems:tV,getItemsByKeys:tV,itemsGetter:tV,getKeyByIndex:function(e){var t=this._denormalizeItemIndex(e);return this.getKeysByItems([this.getItemDataByIndex(t)])[0]},_equalKeys:function(e,t){return this._collectionWidget._isKeySpecified()?Fe(e,t):e===t},beginCache:function(){this._cache={}},endCache:function(){this._cache=null},getIndexByKey:tV,getNormalizedIndex:function(e){return this._isNormalizedItemIndex(e)?e:this._isItemIndex(e)?this._normalizeItemIndex(e):this._isNode(e)?this._getNormalizedItemIndex(e):this._normalizeItemIndex(this.getIndexByItemData(e))},getIndex:function(e){return this._isNormalizedItemIndex(e)?this._denormalizeItemIndex(e):this._isItemIndex(e)?e:this._isNode(e)?this._denormalizeItemIndex(this._getNormalizedItemIndex(e)):this.getIndexByItemData(e)},getItemElement:function(e){if(this._isNormalizedItemIndex(e))return this._getItemByNormalizedIndex(e);if(this._isItemIndex(e))return this._getItemByNormalizedIndex(this._normalizeItemIndex(e));if(this._isNode(e))return Un(e);var t=this._normalizeItemIndex(this.getIndexByItemData(e));return this._getItemByNormalizedIndex(t)},_isNode:e=>We.isNode(e&&g(e)?e.get(0):e),deleteItemAtIndex:tV,itemPlacementFunc:function(e,t){return this._itemsFromSameParent(e,t)&&e-1?this._collectionWidget._itemElements().eq(e):null},_itemsFromSameParent:function(){return!0}});const rV=iV;class oV{constructor(e){this.options=e,this._setOption("disabledItemKeys",[]),this._clearItemKeys()}_clearItemKeys(){this._setOption("addedItemKeys",[]),this._setOption("removedItemKeys",[]),this._setOption("removedItems",[]),this._setOption("addedItems",[])}validate(){}_setOption(e,t){this.options[e]=t}onSelectionChanged(){var e=this.options.addedItemKeys,t=this.options.removedItemKeys,n=this.options.addedItems,i=this.options.removedItems,r=this.options.selectedItems,o=this.options.selectedItemKeys,s=this.options.onSelectionChanged||Pe;this._clearItemKeys(),s({selectedItems:r,selectedItemKeys:o,addedItemKeys:e,removedItemKeys:t,addedItems:n,removedItems:i})}equalKeys(e,t){return this.options.equalByReference&&d(e)&&d(t)?e===t:Fe(e,t)}getSelectableItems(e){return e.filter((function(e){return!(null!==e&&void 0!==e&&e.disabled)}))}_clearSelection(e,t,n,i){return e=e||[],e=Array.isArray(e)?e:[e],this.validate(),this.selectedItemKeys(e,t,n,i)}_removeTemplateProperty(e){return Array.isArray(e)?e.map((e=>this._removeTemplateProperty(e))):(d(e)&&delete e.template,e)}_loadFilteredData(e,t,n,i){var r=encodeURI(JSON.stringify(this._removeTemplateProperty(e))).length,o=this.options.maxFilterLengthInRequest&&r>this.options.maxFilterLengthInRequest,s=new ee,a={filter:o?void 0:e,select:o?this.options.dataFields():n||this.options.dataFields()};return e&&0===e.length?s.resolve([]):this.options.load(a).done((function(n){var r=f(n)?n.data:n;t&&!i?r=r.filter(t):o&&(r=rB(r).filter(e).toArray()),s.resolve(r)})).fail(s.reject.bind(s)),s}updateSelectedItemKeyHash(e){for(var t=0;t!(null!==e&&void 0!==e&&e.disabled)));t&&(n=rB(n).filter(t).toArray());var i=n.length,r=e.length-this.getSelectableItems(e).length;return i?i>=this.options.totalCount()-r||void 0:this._isAnyItemSelected(e)}_getVisibleSelectAllState(){for(var e=this.getSelectableItems(this.options.plainItems()),t=!1,n=!1,i=0;i1&&u(e[1])&&e[1]!==t&&(e=[e]),e.length&&e.push(t),e}_denormalizeFilter(e){return e&&u(e[0])&&(e=[e]),e}_isOnlyNegativeFiltersLeft(e){return e.every(((e,t)=>t%2===0?Array.isArray(e)&&"!"===e[0]:"and"===e))}_addSelectionFilter(e,t,n,i){var r,o=e?["!",t]:t,s=e?"and":"or",a=!0,l=this.options.selectionFilter||[];if(null!==(r=l=this._denormalizeFilter(l))&&void 0!==r&&r.length&&!i){var c=this._removeSameFilter(l,t,e,n),u=this._removeSameFilter(l,t,!e);e&&(-1!==c||-1!==u)&&this._isOnlyNegativeFiltersLeft(l)&&(l=[]);var h=this._isKeyFilter(t)&&this._hasKeyFiltersOnlyStartingFromIndex(l,u);a=t.length&&!h}a&&(l=this._addFilterOperator(l,s)).push(o),l=this._normalizeFilter(l),this._setOption("selectionFilter",e||l.length?l:null)}_normalizeFilter(e){return e&&1===e.length&&(e=e[0]),e}_removeFilterByIndex(e,t,n){var i=e[1];t>0?e.splice(t-1,2):e.splice(t,2),n&&"and"===i&&e.splice(0,e.length)}_isSimpleKeyFilter(e,t){return 3===e.length&&e[0]===t&&"="===e[1]}_isKeyFilter(e){if(2===e.length&&"!"===e[0])return this._isKeyFilter(e[1]);var t=this._getKeyExpr();if(Array.isArray(t)){if(e.length!==2*t.length-1)return!1;for(var n=0;n