text: !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("jquery"));else if("function"==typeof define&&define.amd)define(["jquery"],e);else{var n="object"==typeof exports?e(require("jquery")):e(t.$);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}("undefined"!=typeof self?self:this,function(__WEBPACK_EXTERNAL_MODULE_23__){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=25)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ChartManager=void 0;var r=n(10),i=n(26),o=_(n(30)),a=_(n(22)),s=_(n(8)),u=_(n(2)),c=n(4),l=_(n(14)),h=_(n(6)),d=_(n(13)),p=_(n(12)),f=_(n(15)),g=n(5);function _(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}function v(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var m=function(){function t(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._dataSources={},this._dataSourceCache={},this._dataProviders={},this._frames={},this._areas={},this._timelines={},this._ranges={},this._plotters={},this._themes={},this._titles={},this._frameMousePos={},this._dsChartStyle={},this._dragStarted=!1,this._oldX=0,this._fakeIndicators={},this._captureMouseWheelDirectly=!0,this._chart={},this._chart.defaultFrame=new i.Chart,this._drawingTool=t.DrawingTool.CrossCursor,this._beforeDrawingTool=this._drawingTool,this._language="zh-cn",this._mainCanvas=null,this._overlayCanvas=null,this._mainContext=null,this._overlayContext=null,t.created||(t.instance=this,t.created=!0),t.instance}var e,n,_;return e=t,(n=[{key:"redraw",value:function(t,e){(void 0===t||e)&&(t="All"),"All"!==t&&"MainCanvas"!==t||(e&&this.getFrame("frame0").setChanged(!0),this.layout(this._mainContext,"frame0",0,0,this._mainCanvas.width,this._mainCanvas.height),this.drawMain("frame0",this._mainContext)),"All"!==t&&"OverlayCanvas"!==t||(this._overlayContext.clearRect(0,0,this._overlayCanvas.width,this._overlayCanvas.height),this.drawOverlay("frame0",this._overlayContext))}},{key:"bindCanvas",value:function(t,e){"main"===t?(this._mainCanvas=e,this._mainContext=e.getContext("2d")):"overlay"===t&&(this._overlayCanvas=e,this._overlayContext=e.getContext("2d"),this._captureMouseWheelDirectly&&$(this._overlayCanvas).bind("mousewheel",r.Control.mouseWheel))}},{key:"getCaptureMouseWheelDirectly",value:function(){return this._captureMouseWheelDirectly}},{key:"setCaptureMouseWheelDirectly",value:function(t){this._captureMouseWheelDirectly=t,t?$(this._overlayCanvas).bind("mousewheel",r.Control.mouseWheel):$(this._overlayCanvas).unbind("mousewheel")}},{key:"getChart",value:function(t){return this._chart.defaultFrame}},{key:"init",value:function(){delete this._ranges["frame0.k0.indic1"],delete this._ranges["frame0.k0.indic1Range"],delete this._areas["frame0.k0.indic1"],delete this._areas["frame0.k0.indic1Range"],s.DefaultTemplate.loadTemplate("frame0.k0",""),this.redraw("All",!0)}},{key:"setCurrentDrawingTool",value:function(e){this._drawingTool=t.DrawingTool[e],this.setRunningMode(this._drawingTool)}},{key:"getLanguage",value:function(){return this._language}},{key:"setLanguage",value:function(t){this._language=t}},{key:"setThemeName",value:function(t,e){var n;switch(void 0===e&&(e="Dark"),e){case"Light":n=new h.LightTheme;break;default:e="Dark",n=new h.DarkTheme}this._themeName=e,this.setTheme(t,n),this.getFrame(t).setChanged(!0)}},{key:"getChartStyle",value:function(t){var e=this._dsChartStyle[t];return void 0===e?"CandleStick":e}},{key:"setChartStyle",value:function(t,e){if(this._dsChartStyle[t]!==e){var n,r,i=t+".main",a=i+".main",s=i+".main";switch(e){case"CandleStick":case"CandleStickHLC":case"OHLC":switch(void 0!==(n=this.getDataProvider(a))&&g.Util.isInstance(n,l.MainDataProvider)||(n=new l.MainDataProvider(a),this.setDataProvider(a,n),n.updateData()),this.setMainIndicator(t,c.ChartSettings.get().charts.mIndic),e){case"CandleStick":r=new d.CandlestickPlotter(s);break;case"CandleStickHLC":r=new d.CandlestickHLCPlotter(s);break;case"OHLC":r=new d.OHLCPlotter(s)}this.setPlotter(s,r),r=new d.MinMaxPlotter(i+".decoration"),this.setPlotter(r.getName(),r);break;case"Line":n=new l.IndicatorDataProvider(a),this.setDataProvider(n.getName(),n),n.setIndicator(new o.HLCIndicator),this.removeMainIndicator(t),r=new d.IndicatorPlotter(s),this.setPlotter(s,r),this.removePlotter(i+".decoration")}this.getArea(r.getAreaName()).setChanged(!0),this._dsChartStyle[t]=e}}},{key:"setNormalMode",value:function(){this._drawingTool=this._beforeDrawingTool,$(".chart_dropdown_data").removeClass("chart_dropdown-hover"),$("#chart_toolpanel .chart_toolpanel_button").removeClass("selected"),$("#chart_CrossCursor").parent().addClass("selected"),this._drawingTool===t.DrawingTool.Cursor?(this.showCursor(),$("#mode a").removeClass("selected"),$("#chart_toolpanel .chart_toolpanel_button").removeClass("selected"),$("#chart_Cursor").parent().addClass("selected")):this.hideCursor()}},{key:"setRunningMode",value:function(e){var n=this.getDataSource("frame0.k0"),r=n.getCurrentToolObject();if(null!==r&&r.state!==p.CToolObject.state.AfterDraw&&n.delToolObject(),n.getToolObjectCount()>10)this.setNormalMode();else switch(this._drawingTool=e,e===t.DrawingTool.Cursor&&this.showCursor(),e){case t.DrawingTool.Cursor:this._beforeDrawingTool=e;break;case t.DrawingTool.ArrowLine:n.addToolObject(new p.CArrowLineObject("frame0.k0"));break;case t.DrawingTool.BandLine:n.addToolObject(new p.CBandLineObject("frame0.k0"));break;case t.DrawingTool.BiParallelLine:n.addToolObject(new p.CBiParallelLineObject("frame0.k0"));break;case t.DrawingTool.BiParallelRayLine:n.addToolObject(new p.CBiParallelRayLineObject("frame0.k0"));break;case t.DrawingTool.CrossCursor:this._beforeDrawingTool=e;break;case t.DrawingTool.DrawFibFans:n.addToolObject(new p.CFibFansObject("frame0.k0"));break;case t.DrawingTool.DrawFibRetrace:n.addToolObject(new p.CFibRetraceObject("frame0.k0"));break;case t.DrawingTool.DrawLines:n.addToolObject(new p.CStraightLineObject("frame0.k0"));break;case t.DrawingTool.HoriRayLine:n.addToolObject(new p.CHoriRayLineObject("frame0.k0"));break;case t.DrawingTool.HoriSegLine:n.addToolObject(new p.CHoriSegLineObject("frame0.k0"));break;case t.DrawingTool.HoriStraightLine:n.addToolObject(new p.CHoriStraightLineObject("frame0.k0"));break;case t.DrawingTool.PriceLine:n.addToolObject(new p.CPriceLineObject("frame0.k0"));break;case t.DrawingTool.RayLine:n.addToolObject(new p.CRayLineObject("frame0.k0"));break;case t.DrawingTool.SegLine:n.addToolObject(new p.CSegLineObject("frame0.k0"));break;case t.DrawingTool.StraightLine:n.addToolObject(new p.CStraightLineObject("frame0.k0"));break;case t.DrawingTool.TriParallelLine:n.addToolObject(new p.CTriParallelLineObject("frame0.k0"));break;case t.DrawingTool.VertiStraightLine:n.addToolObject(new p.CVertiStraightLineObject("frame0.k0"))}}},{key:"getTitle",value:function(t){return this._titles[t]}},{key:"setTitle",value:function(t,e){this._titles[t]=e}},{key:"setCurrentDataSource",value:function(t,e){var n=this.getCachedDataSource(e);void 0!==n&&null!==n?this.setDataSource(t,n,!0):(n=new u.MainDataSource(e),this.setDataSource(t,n,!0),this.setCachedDataSource(e,n))}},{key:"getDataSource",value:function(t){return this._dataSources[t]}},{key:"setDataSource",value:function(t,e,n){this._dataSources[t]=e,n&&this.updateData(t,null)}},{key:"getCachedDataSource",value:function(t){return this._dataSourceCache[t]}},{key:"setCachedDataSource",value:function(t,e){this._dataSourceCache[t]=e}},{key:"getDataProvider",value:function(t){return this._dataProviders[t]}},{key:"setDataProvider",value:function(t,e){this._dataProviders[t]=e}},{key:"removeDataProvider",value:function(t){delete this._dataProviders[t]}},{key:"getFrame",value:function(t){return this._frames[t]}},{key:"setFrame",value:function(t,e){this._frames[t]=e}},{key:"removeFrame",value:function(t){delete this._frames[t]}},{key:"getArea",value:function(t){return this._areas[t]}},{key:"setArea",value:function(t,e){this._areas[t]=e}},{key:"removeArea",value:function(t){delete this._areas[t]}},{key:"getTimeline",value:function(t){return this._timelines[t]}},{key:"setTimeline",value:function(t,e){this._timelines[t]=e}},{key:"removeTimeline",value:function(t){delete this._timelines[t]}},{key:"getRange",value:function(t){return this._ranges[t]}},{key:"setRange",value:function(t,e){this._ranges[t]=e}},{key:"removeRange",value:function(t){delete this._ranges[t]}},{key:"getPlotter",value:function(t){return this._plotters[t]}},{key:"setPlotter",value:function(t,e){this._plotters[t]=e}},{key:"removePlotter",value:function(t){delete this._plotters[t]}},{key:"getTheme",value:function(t){return this._themes[t]}},{key:"setTheme",value:function(t,e){this._themes[t]=e}},{key:"getFrameMousePos",value:function(t,e){void 0!==this._frameMousePos[t]?(e.x=this._frameMousePos[t].x,e.y=this._frameMousePos[t].y):(e.x=-1,e.y=-1)}},{key:"setFrameMousePos",value:function(t,e,n){this._frameMousePos[t]={x:e,y:n}}},{key:"drawArea",value:function(t,e,n){var r=e.getNameObject().getCompAt(2);if("timeline"===r){if(e.getHeight()<20)return}else if(e.getHeight()<30)return;if(!(e.getWidth()<30)){var i;r=e.getName();var o,a=n.length;for(o=0;o<a;o++)void 0!==(i=this._plotters[r+n[o]])&&i.Draw(t)}}},{key:"drawAreaMain",value:function(t,e){var n;n=this._dataSources[e.getDataSourceName()].getDataCount()<1?[".background"]:[".background",".grid",".main",".secondary"],this.drawArea(t,e,n),e.setChanged(!1)}},{key:"drawAreaOverlay",value:function(t,e){var n;n=this._dataSources[e.getDataSourceName()].getDataCount()<1?[".selection"]:[".decoration",".selection",".info",".tool"],this.drawArea(t,e,n)}},{key:"drawMain",value:function(t,e){var n;for(var r in this._areas)this._areas[r].getFrameName()!==t||g.Util.isInstance(this._areas[r],f.ChartAreaGroup)||this.drawAreaMain(e,this._areas[r]);for(var i in this._timelines)(n=this._timelines[i]).getFrameName()===t&&n.setUpdated(!1);for(var o in this._ranges)(n=this._ranges[o]).getFrameName()===t&&n.setUpdated(!1);for(var a in this._areas)(n=this._areas[a]).getFrameName()===t&&n.setChanged(!1)}},{key:"drawOverlay",value:function(t,e){for(var n in this._areas){var r=this._areas[n];g.Util.isInstance(r,f.ChartAreaGroup)&&r.getFrameName()===t&&r.drawGrid(e)}for(var i in this._areas){var o=this._areas[i];!1===g.Util.isInstance(o,f.ChartAreaGroup)&&o.getFrameName()===t&&this.drawAreaOverlay(e,o)}}},{key:"updateData",value:function(t,e){var n=this.getDataSource(t);if(void 0!==n&&null!==n){if(void 0!==e&&null!==e){if(!n.update(e))return!1;if(n.getUpdateMode()===u.DataSource.UpdateMode.DoNothing)return!0}else n.setUpdateMode(u.DataSource.UpdateMode.Refresh);var r=this.getTimeline(t);if(void 0!==r&&null!==r&&r.update(),n.getDataCount()<1)return!0;var i,o,a=[".main",".secondary"];for(var s in this._areas)if(i=this._areas[s],!g.Util.isInstance(i,f.ChartAreaGroup)&&i.getDataSourceName()===t){o=i.getName();for(var c=0;c<a.length;c++){var l=this.getDataProvider(o+a[c]);void 0!==l&&null!==l&&l.updateData()}}return!0}}},{key:"updateRange",value:function(t){if(!(this.getDataSource(t).getDataCount()<1)){var e,n,r=[".main",".secondary"];for(var i in this._areas)if(e=this._areas[i],!g.Util.isInstance(e,f.ChartAreaGroup)&&e.getDataSourceName()===t){n=e.getName();for(var o=0;o<r.length;o++){var a=this.getDataProvider(n+r[o]);void 0!==a&&null!==a&&a.updateRange()}var s=this.getTimeline(t);if(void 0!==s&&s.getMaxItemCount()>0){var u=this.getRange(n);void 0!==u&&null!==u&&u.update()}}}}},{key:"layout",value:function(t,e,n,r,i,o){var a=this.getFrame(e);for(var s in a.measure(t,i-n,o-r),a.layout(n,r,i,o),this._timelines){var u=this._timelines[s];u.getFrameName()===e&&u.onLayout()}for(var c in this._dataSources)c.substring(0,e.length)===e&&this.updateRange(c)}},{key:"SelectRange",value:function(t,e){for(var n in this._ranges){this._ranges[n].getAreaName()===t.getName()?this._ranges[n].selectAt(e):this._ranges[n].unselect()}}},{key:"scale",value:function(t){if(null!==this._highlightedFrame){var e=this._highlightedFrame.getHighlightedArea();if(void 0!==this.getRange(e.getName())){var n=e.getDataSourceName(),r=this.getTimeline(n);null!==r&&(r.scale(t),this.updateRange(n))}}}},{key:"showCursor",value:function(t){void 0===t&&(t="default"),this._mainCanvas.style.cursor=t,this._overlayCanvas.style.cursor=t}},{key:"hideCursor",value:function(){this._mainCanvas.style.cursor="none",this._overlayCanvas.style.cursor="none"}},{key:"showCrossCursor",value:function(t,e,n){var r=this.getRange(t.getName());return!(void 0===r||(r.selectAt(n),void 0===(r=this.getTimeline(t.getDataSourceName()))||!r.selectAt(e)))}},{key:"hideCrossCursor",value:function(t){if(null!==t&&void 0!==t)for(var e in this._timelines){var n=this._timelines[e];n!==t&&n.unselect()}else for(var r in this._timelines)this._timelines[r].unselect();for(var i in this._ranges)this._ranges[i].unselect()}},{key:"clearHighlight",value:function(){null!==this._highlightedFrame&&void 0!==this._highlightedFrame&&(this._highlightedFrame.highlight(null),this._highlightedFrame=null)}},{key:"onToolMouseMove",value:function(t,e,n){var r=!1;for(var i in t+=".",this._dataSources)if(0===i.indexOf(t)){var o=this._dataSources[i];g.Util.isInstance(o,u.MainDataSource)&&o.toolManager.acceptMouseMoveEvent(e,n)&&(r=!0)}return r}},{key:"onToolMouseDown",value:function(t,e,n){var r=!1;for(var i in t+=".",this._dataSources)if(0===i.indexOf(t)){var o=this._dataSources[i];g.Util.isInstance(o,u.MainDataSource)&&o.toolManager.acceptMouseDownEvent(e,n)&&(r=!0)}return r}},{key:"onToolMouseUp",value:function(t,e,n){var r=!1;for(var i in t+=".",this._dataSources)if(0===i.indexOf(t)){var o=this._dataSources[i];g.Util.isInstance(o,u.MainDataSource)&&o.toolManager.acceptMouseUpEvent(e,n)&&(r=!0)}return r}},{key:"onToolMouseDrag",value:function(t,e,n){var r=!1;for(var i in t+=".",this._dataSources)if(0===i.indexOf(t)){var o=this._dataSources[i];g.Util.isInstance(o,u.MainDataSource)&&o.toolManager.acceptMouseDownMoveEvent(e,n)&&(r=!0)}return r}},{key:"onMouseMove",value:function(t,e,n,r){var i=this.getFrame(t);if(void 0!==i)if(this.setFrameMousePos(t,e,n),this.hideCrossCursor(),this._highlightedFrame!==i&&this.clearHighlight(),null===this._capturingMouseArea||void 0===this._capturingMouseArea){var o,a,s=i.contains(e,n);if(null!==s)for(a=s.length-1;a>=0;a--)if(null!==(o=(o=s[a]).onMouseMove(e,n)))return void(g.Util.isInstance(o,f.ChartAreaGroup)||(i.highlight(o),this._highlightedFrame=i))}else this._capturingMouseArea.onMouseMove(e,n)}},{key:"onMouseLeave",value:function(t,e,n,r){void 0!==this.getFrame(t)&&(this.setFrameMousePos(t,e,n),this.hideCrossCursor(),this.clearHighlight(),null!==this._capturingMouseArea&&void 0!==this._capturingMouseArea&&(this._capturingMouseArea.onMouseLeave(e,n),this._capturingMouseArea=null),this._dragStarted=!1)}},{key:"onMouseDown",value:function(t,e,n){var r=this.getFrame(t);if(void 0!==r){var i,o,a=r.contains(e,n);if(null!==a)for(o=a.length-1;o>=0;o--)if(null!==(i=(i=a[o]).onMouseDown(e,n)))return void(this._capturingMouseArea=i)}}},{key:"onMouseUp",value:function(t,e,n){var i=this.getFrame(t);void 0!==i&&this._capturingMouseArea&&(null===this._capturingMouseArea.onMouseUp(e,n)&&!1===this._dragStarted&&(null!==this._selectedFrame&&void 0!==this._selectedFrame&&this._selectedFrame!==i&&this._selectedFrame.select(null),this._capturingMouseArea.isSelected()?(this._captureMouseWheelDirectly||$(this._overlayCanvas).unbind("mousewheel"),i.select(null),this._selectedFrame=null):(this._selectedFrame!==i&&(this._captureMouseWheelDirectly||$(this._overlayCanvas).bind("mousewheel",r.Control.mouseWheel)),i.select(this._capturingMouseArea),this._selectedFrame=i)),this._capturingMouseArea=null,this._dragStarted=!1)}},{key:"deleteToolObject",value:function(){var t=this.getDataSource("frame0.k0");null!==t.getSelectToolObjcet()&&t.delSelectToolObject();var e=t.getCurrentToolObject();null!==e&&e.getState()!==p.CToolObject.state.AfterDraw&&t.delToolObject(),this.setNormalMode()}},{key:"unloadTemplate",value:function(t){if(void 0!==this.getFrame(t)){for(var e in this._dataSources)e.match(t+".")&&delete this._dataSources[e];for(var n in this._dataProviders)this._dataProviders[n].getFrameName()===t&&delete this._dataProviders[n];for(var r in delete this._frames[t],this._areas)this._areas[r].getFrameName()===t&&delete this._areas[r];for(var i in this._timelines)this._timelines[i].getFrameName()===t&&delete this._timelines[i];for(var o in this._ranges)this._ranges[o].getFrameName()===t&&delete this._ranges[o];for(var a in this._plotters)this._plotters[a].getFrameName()===t&&delete this._plotters[a];delete this._themes[t],delete this._frameMousePos[t]}}},{key:"createIndicatorAndRange",value:function(t,e,n){var r,i;switch(e){case"MA":r=new o.MAIndicator,i=new a.PositiveRange(t);break;case"EMA":r=new o.EMAIndicator,i=new a.PositiveRange(t);break;case"VOLUME":r=new o.VOLUMEIndicator,i=new a.ZeroBasedPositiveRange(t);break;case"MACD":r=new o.MACDIndicator,i=new a.ZeroCenteredRange(t);break;case"DMI":r=new o.DMIIndicator,i=new a.PercentageRange(t);break;case"DMA":r=new o.DMAIndicator,i=new a.Range(t);break;case"TRIX":r=new o.TRIXIndicator,i=new a.Range(t);break;case"BRAR":r=new o.BRARIndicator,i=new a.Range(t);break;case"VR":r=new o.VRIndicator,i=new a.Range(t);break;case"OBV":r=new o.OBVIndicator,i=new a.Range(t);break;case"EMV":r=new o.EMVIndicator,i=new a.Range(t);break;case"RSI":r=new o.RSIIndicator,i=new a.PercentageRange(t);break;case"WR":r=new o.WRIndicator,i=new a.PercentageRange(t);break;case"SAR":r=new o.SARIndicator,i=new a.PositiveRange(t);break;case"KDJ":r=new o.KDJIndicator,i=new a.PercentageRange(t);break;case"ROC":r=new o.ROCIndicator,i=new a.Range(t);break;case"MTM":r=new o.MTMIndicator,i=new a.Range(t);break;case"BOLL":r=new o.BOLLIndicator,i=new a.Range(t);break;case"PSY":r=new o.PSYIndicator,i=new a.Range(t);break;case"StochRSI":r=new o.STOCHRSIIndicator,i=new a.PercentageRange(t);break;default:return null}return n||r.setParameters(c.ChartSettings.get().indics[e]),{indic:r,range:i}}},{key:"setMainIndicator",value:function(t,e){var n,r=t+".main",i=this.getDataProvider(r+".main");if(void 0===i||!g.Util.isInstance(i,l.MainDataProvider))return!1;switch(e){case"MA":n=new o.MAIndicator;break;case"EMA":n=new o.EMAIndicator;break;case"BOLL":n=new o.BOLLIndicator;break;case"SAR":n=new o.SARIndicator;break;default:return!1}n.setParameters(c.ChartSettings.get().indics[e]);var a=r+".secondary",s=this.getDataProvider(a);void 0===s&&(s=new l.IndicatorDataProvider(a),this.setDataProvider(s.getName(),s)),s.setIndicator(n);var u=this.getPlotter(a);return void 0===u&&(u=new d.IndicatorPlotter(a),this.setPlotter(u.getName(),u)),this.getArea(r).setChanged(!0),!0}},{key:"setIndicator",value:function(t,e){var n=this.getArea(t);if(null===n||void 0===n||"main"===n.getNameObject().getCompAt(2))return!1;var r=this.getDataProvider(t+".secondary");if(null===r||void 0===r||!g.Util.isInstance(r,l.IndicatorDataProvider))return!1;var i=this.createIndicatorAndRange(t,e);if(null===i||void 0===i)return!1;var a=i.indic,s=i.range;if(this.removeDataProvider(t+".main"),this.removePlotter(t+".main"),this.removeRange(t),this.removePlotter(t+"Range.decoration"),r.setIndicator(a),this.setRange(t,s),s.setPaddingTop(20),s.setPaddingBottom(4),s.setMinInterval(20),g.Util.isInstance(a,o.VOLUMEIndicator)){var u=new d.LastVolumePlotter(t+"Range.decoration");this.setPlotter(u.getName(),u)}else if(g.Util.isInstance(a,o.BOLLIndicator)||g.Util.isInstance(a,o.SARIndicator)){var c=new l.MainDataProvider(t+".main");this.setDataProvider(c.getName(),c),c.updateData();var h=new d.OHLCPlotter(t+".main");this.setPlotter(h.getName(),h)}return!0}},{key:"removeMainIndicator",value:function(t){var e=t+".main",n=e+".secondary",r=this.getDataProvider(n);void 0!==r&&g.Util.isInstance(r,l.IndicatorDataProvider)&&(this.removeDataProvider(n),this.removePlotter(n),this.getArea(e).setChanged(!0))}},{key:"removeIndicator",value:function(t){var e=this.getArea(t);if(void 0!==e&&"main"!==e.getNameObject().getCompAt(2)){var n=this.getDataProvider(t+".secondary");if(void 0!==n&&g.Util.isInstance(n,l.IndicatorDataProvider)){var r=t+"Range",i=this.getArea(r);if(void 0!==i){var o=this.getArea(e.getDataSourceName()+".charts");if(void 0!==o){for(var a in o.removeArea(e),this.removeArea(t),o.removeArea(i),this.removeArea(r),this._dataProviders)this._dataProviders[a].getAreaName()===t&&this.removeDataProvider(a);for(var s in this._ranges)this._ranges[s].getAreaName()===t&&this.removeRange(s);for(var u in this._plotters)this._plotters[u].getAreaName()===t&&this.removePlotter(u);for(var c in this._plotters)this._plotters[c].getAreaName()===r&&this.removePlotter(c)}}}}}},{key:"getIndicatorParameters",value:function(t){var e=this._fakeIndicators[t];if(void 0===e){var n=this.createIndicatorAndRange("",t);if(null===n)return null;this._fakeIndicators[t]=e=n.indic}var r,i=[],o=e.getParameterCount();for(r=0;r<o;r++)i.push(e.getParameterAt(r));return i}},{key:"setIndicatorParameters",value:function(t,e){var n,r;for(n in this._dataProviders){var i=this._dataProviders[n];!1!==g.Util.isInstance(i,l.IndicatorDataProvider)&&((r=i.getIndicator()).getName()===t&&(r.setParameters(e),i.refresh(),this.getArea(i.getAreaName()).setChanged(!0)))}if(void 0===(r=this._fakeIndicators[t])){var o=this.createIndicatorAndRange("",t,!0);if(null===o)return;this._fakeIndicators[t]=r=o.indic}r.setParameters(e)}},{key:"getIndicatorAreaName",value:function(t,e){var n=this.getArea(t+".charts"),r=n.getAreaCount()>>1;return e<0||e>=r?"":n.getAreaAt(e<<1).getName()}}])&&v(e.prototype,n),_&&v(e,_),t}();e.ChartManager=m,m.DrawingTool={Cursor:0,CrossCursor:1,DrawLines:2,DrawFibRetrace:3,DrawFibFans:4,SegLine:5,StraightLine:6,ArrowLine:7,RayLine:8,HoriStraightLine:9,HoriRayLine:10,HoriSegLine:11,VertiStraightLine:12,PriceLine:13,BiParallelLine:14,BiParallelRayLine:15,TriParallelLine:16,BandLine:17},m.created=!1,m.instance=null},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NamedObject=void 0;var r=n(19);function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._name=e,this._nameObj=new r.CName(e)}var e,n,o;return e=t,(n=[{key:"getFrameName",value:function(){return this._nameObj.getName(0)}},{key:"getDataSourceName",value:function(){return this._nameObj.getName(1)}},{key:"getAreaName",value:function(){return this._nameObj.getName(2)}},{key:"getName",value:function(){return this._nameObj.getName(-1)}},{key:"getNameObject",value:function(){return this._nameObj}},{key:"getRectCrossPt",value:function(t,e,n){var r={x:-1,y:-1},i={x:-1,y:-1},o=n.x-e.x,a=n.y-e.y;if(Math.abs(o)<2)return[r={x:e.x,y:t.top},i={x:n.x,y:t.bottom}];var s=a/o;return i.x=t.right,i.y=e.y+(t.right-e.x)*s,r.x=t.left,r.y=e.y+(t.left-e.x)*s,[r,i]}}])&&i(e.prototype,n),o&&i(e,o),t}();e.NamedObject=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MainDataSource=e.DataSource=void 0;var r,i=n(1),o=n(27),a=(r=n(3))&&r.__esModule?r:{default:r};function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),t}function h(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)}function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var g=function(t){function e(t){return u(this,e),h(this,d(e).call(this,t))}return p(e,i.NamedObject),l(e,[{key:"getUpdateMode",value:function(){return this._updateMode}},{key:"setUpdateMode",value:function(t){this._updateMode=t}},{key:"getCacheSize",value:function(){return 0}},{key:"getDataCount",value:function(){return 0}},{key:"getDataAt",value:function(t){return this._dataItems[t]}}]),e}();e.DataSource=g,g.UpdateMode={DoNothing:0,Refresh:1,Update:2,Append:3};var _=function(t){function e(t){var n;return u(this,e),(n=h(this,d(e).call(this,t)))._erasedCount=0,n._dataItems=[],n._decimalDigits=0,n.toolManager=new o.CToolManager(t),n}return p(e,g),l(e,[{key:"getCacheSize",value:function(){return this._dataItems.length}},{key:"getDataCount",value:function(){return this._dataItems.length}},{key:"getUpdatedCount",value:function(){return this._updatedCount}},{key:"getAppendedCount",value:function(){return this._appendedCount}},{key:"getErasedCount",value:function(){return this._erasedCount}},{key:"getDecimalDigits",value:function(){return this._decimalDigits}},{key:"calcDecimalDigits",value:function(t){var e=""+t,n=e.indexOf(".");return n<0?0:e.length-1-n}},{key:"getLastDate",value:function(){var t=this.getDataCount();return t<1?-1:this.getDataAt(t-1).date}},{key:"getDataAt",value:function(t){return this._dataItems[t]}},{key:"update",value:function(t){this._updatedCount=0,this._appendedCount=0,this._erasedCount=0;var e=this._dataItems.length;if(e>0){var n,r,i=e-1,o=this._dataItems[i],s=t.length;for(r=0;r<s;r++)if((n=t[r])[0]===o.date){if(o.open===n[1]&&o.high===n[2]&&o.low===n[3]&&o.close===n[4]&&o.volume===n[5]?this.setUpdateMode(g.UpdateMode.DoNothing):(this.setUpdateMode(g.UpdateMode.Update),this._dataItems[i]={date:n[0],open:n[1],high:n[2],low:n[3],close:n[4],volume:n[5]},this._updatedCount++),++r<s)for(this.setUpdateMode(g.UpdateMode.Append);r<s;r++,this._appendedCount++)n=t[r],this._dataItems.push({date:n[0],open:n[1],high:n[2],low:n[3],close:n[4],volume:n[5]});return!0}if(s<a.default.instance.limit)return this.setUpdateMode(g.UpdateMode.DoNothing),!1}this.setUpdateMode(g.UpdateMode.Refresh),this._dataItems=[];var u,c,l,h,d=t.length;for(h=0;h<d;h++){for(l=t[h],c=1;c<=4;c++)u=this.calcDecimalDigits(l[c]),this._decimalDigits<u&&(this._decimalDigits=u);this._dataItems.push({date:l[0],open:l[1],high:l[2],low:l[3],close:l[4],volume:l[5]})}return!0}},{key:"select",value:function(t){this.toolManager.selecedObject=t}},{key:"unselect",value:function(){this.toolManager.selecedObject=-1}},{key:"addToolObject",value:function(t){this.toolManager.addToolObject(t)}},{key:"delToolObject",value:function(){this.toolManager.delCurrentObject()}},{key:"getToolObject",value:function(t){return this.toolManager.getToolObject(t)}},{key:"getToolObjectCount",value:function(){return this.toolManager.toolObjects.length}},{key:"getCurrentToolObject",value:function(){return this.toolManager.getCurrentObject()}},{key:"getSelectToolObjcet",value:function(){return this.toolManager.getSelectedObject()}},{key:"delSelectToolObject",value:function(){this.toolManager.delSelectedObject()}}]),e}();e.MainDataSource=_},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(10),i=n(18),o=n(0),a=n(4),s=n(8);n(31);var u=h(n(47)),c=h(n(48)),l=h(n(23));function h(t){return t&&t.__esModule?t:{default:t}}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var p=function(){function t(e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.element="#kline_container",this.chartMgr=null,this.G_HTTP_REQUEST=null,this.timer=null,this.buttonDown=!1,this.init=!1,this.requestParam="",this.data={},this.width=1200,this.height=650,this.symbol="",this.symbolName="",this.range=null,this.url="",this.limit=1e3,this.type="poll",this.subscribePath="",this.sendPath="",this.stompClient=null,this.intervalTime=5e3,this.debug=!0,this.language="zh-cn",this.theme="dark",this.ranges=["1w","1d","4h","1h","30m","15m","5m","1m","line"],this.showTrade=!1,this.tradeWidth=250,this.socketConnected=!1,this.enableSockjs=!0,this.reverseColor=!1,this.isSized=!1,this.paused=!1,this.subscribed=null,this.disableFirebase=!1,this.periodMap={"01w":6048e5,"03d":2592e5,"01d":864e5,"12h":432e5,"06h":216e5,"04h":144e5,"02h":72e5,"01h":36e5,"30m":18e5,"15m":9e5,"05m":3e5,"03m":18e4,"01m":6e4,line:6e4},this.tagMapPeriod={"1w":"01w","3d":"03d","1d":"01d","12h":"12h","6h":"06h","4h":"04h","2h":"02h","1h":"01h","30m":"30m","15m":"15m","5m":"05m","3m":"03m","1m":"01m",line:"line"},Object.assign(this,e),t.created||(t.instance=this,t.created=!0),t.instance}var e,n,h;return e=t,(n=[{key:"draw",value:function(){t.trade=new i.KlineTrade,t.chartMgr=new o.ChartManager;var e=l.default.parseHTML(u.default);for(var n in this.ranges){(0,l.default)(e).find('[name="'+this.ranges[n]+'"]').each(function(t,e){(0,l.default)(e).attr("style","display:inline-block")})}(0,l.default)(this.element).html(e),setInterval(r.Control.refreshFunction,this.intervalTime),"stomp"===this.type&&r.Control.socketConnect(),this.disableFirebase||(0,c.default)(),this.registerMouseEvent(),o.ChartManager.instance.bindCanvas("main",document.getElementById("chart_mainCanvas")),o.ChartManager.instance.bindCanvas("overlay",document.getElementById("chart_overlayCanvas")),r.Control.refreshTemplate(),r.Control.onSize(this.width,this.height),r.Control.readCookie(),this.setTheme(this.theme),this.setLanguage(this.language),(0,l.default)(this.element).css({visibility:"visible"})}},{key:"resize",value:function(t,e){this.width=t,this.height=e,r.Control.onSize(this.width,this.height)}},{key:"setSymbol",value:function(t,e){this.symbol=t,this.symbolName=e,r.Control.switchSymbol(t),this.onSymbolChange(t,e)}},{key:"setTheme",value:function(t){this.theme=t,r.Control.switchTheme(t)}},{key:"setLanguage",value:function(t){this.language=t,r.Control.chartSwitchLanguage(t)}},{key:"setShowTrade",value:function(t){this.showTrade=t,t?(0,l.default)(".trade_container").show():(0,l.default)(".trade_container").hide(),r.Control.onSize(this.width,this.height)}},{key:"toggleTrade",value:function(){this.showTrade?(this.showTrade=!1,(0,l.default)(".trade_container").hide()):(this.showTrade=!0,(0,l.default)(".trade_container").show()),r.Control.onSize(this.width,this.height)}},{key:"setIntervalTime",value:function(t){this.intervalTime=t,this.debug&&console.log("DEBUG: interval time changed to "+t)}},{key:"pause",value:function(){this.debug&&console.log("DEBUG: kline paused"),this.paused=!0}},{key:"resend",value:function(){this.debug&&console.log("DEBUG: kline continue"),this.paused=!1,r.Control.requestData(!0)}},{key:"connect",value:function(){"stomp"===this.type?r.Control.socketConnect():this.debug&&console.log("DEBUG: this is for stomp type")}},{key:"disconnect",value:function(){"stomp"===this.type?(this.stompClient&&(this.stompClient.disconnect(),this.socketConnected=!1),this.debug&&console.log("DEBUG: socket disconnected")):this.debug&&console.log("DEBUG: this is for stomp type")}},{key:"onResize",value:function(t,e){this.debug&&console.log("DEBUG: chart resized to width: "+t+" height: "+e)}},{key:"onLangChange",value:function(t){this.debug&&console.log("DEBUG: language changed to "+t)}},{key:"onSymbolChange",value:function(t,e){this.debug&&console.log("DEBUG: symbol changed to "+t+" "+e)}},{key:"onThemeChange",value:function(t){this.debug&&console.log("DEBUG: themes changed to : "+t)}},{key:"onRangeChange",value:function(t){this.debug&&console.log("DEBUG: range changed to "+t)}},{key:"registerMouseEvent",value:function(){(0,l.default)(document).ready(function(){(0,l.default)("#chart_overlayCanvas").bind("contextmenu",function(t){return t.cancelBubble=!0,t.returnValue=!1,t.preventDefault(),t.stopPropagation(),!1}),(0,l.default)(".chart_container .chart_dropdown .chart_dropdown_t").mouseover(function(){var t=(0,l.default)(".chart_container"),e=(0,l.default)(this),n=e.next(),r=t.offset().left,i=e.offset().left,o=t.width(),a=e.width(),s=(n.width()-a)/2<<0;i-s<r+4?s=i-r-4:s+=i+a+s>r+o-4?i+a+s-(r+o-4)+19:4,n.css({"margin-left":-s}),e.addClass("chart_dropdown-hover"),n.addClass("chart_dropdown-hover")}).mouseout(function(){(0,l.default)(this).next().removeClass("chart_dropdown-hover"),(0,l.default)(this).removeClass("chart_dropdown-hover")}),(0,l.default)(".chart_dropdown_data").mouseover(function(){(0,l.default)(this).addClass("chart_dropdown-hover"),(0,l.default)(this).prev().addClass("chart_dropdown-hover")}).mouseout(function(){(0,l.default)(this).prev().removeClass("chart_dropdown-hover"),(0,l.default)(this).removeClass("chart_dropdown-hover")}),(0,l.default)("#close_settings").click(function(){(0,l.default)("#chart_parameter_settings").removeClass("clicked")}),(0,l.default)(".chart_container .chart_toolbar_tabgroup a").click(function(){r.Control.switchPeriod((0,l.default)(this).parent().attr("name"))}),(0,l.default)("#chart_toolbar_periods_vert ul a").click(function(){r.Control.switchPeriod((0,l.default)(this).parent().attr("name"))}),(0,l.default)(".market_chooser ul a").click(function(){r.Control.switchSymbol((0,l.default)(this).attr("name"))}),(0,l.default)("#chart_show_tools").click(function(){(0,l.default)(this).hasClass("selected")?r.Control.switchTools("off"):r.Control.switchTools("on")}),(0,l.default)("#chart_toolpanel .chart_toolpanel_button").click(function(){(0,l.default)(".chart_dropdown_data").removeClass("chart_dropdown-hover"),(0,l.default)("#chart_toolpanel .chart_toolpanel_button").removeClass("selected"),(0,l.default)(this).addClass("selected");var e=(0,l.default)(this).children().attr("name");t.instance.chartMgr.setRunningMode(o.ChartManager.DrawingTool[e])}),(0,l.default)("#chart_show_indicator").click(function(){(0,l.default)(this).hasClass("selected")?r.Control.switchIndic("off"):r.Control.switchIndic("on")}),(0,l.default)("#chart_tabbar li a").click(function(){(0,l.default)("#chart_tabbar li a").removeClass("selected"),(0,l.default)(this).addClass("selected");var t=(0,l.default)(this).attr("name");a.ChartSettings.get().charts.indics[1]=t,a.ChartSettings.save(),!1===s.Template.displayVolume?o.ChartManager.instance.getChart().setIndicator(1,t):o.ChartManager.instance.getChart().setIndicator(2,t)}),(0,l.default)("#chart_select_chart_style a").click(function(){(0,l.default)("#chart_select_chart_style a").removeClass("selected"),(0,l.default)(this).addClass("selected"),a.ChartSettings.get().charts.chartStyle=(0,l.default)(this)[0].innerHTML,a.ChartSettings.save();var t=o.ChartManager.instance;t.setChartStyle("frame0.k0",(0,l.default)(this).html()),t.redraw()}),(0,l.default)("#chart_dropdown_themes li").click(function(){(0,l.default)("#chart_dropdown_themes li a").removeClass("selected");var t=(0,l.default)(this).attr("name");"chart_themes_dark"===t?r.Control.switchTheme("dark"):"chart_themes_light"===t&&r.Control.switchTheme("light")}),(0,l.default)("#chart_select_main_indicator a").click(function(){(0,l.default)("#chart_select_main_indicator a").removeClass("selected"),(0,l.default)(this).addClass("selected");var t=(0,l.default)(this).attr("name");a.ChartSettings.get().charts.mIndic=t,a.ChartSettings.save();var e=o.ChartManager.instance;e.setMainIndicator("frame0.k0",t)||e.removeMainIndicator("frame0.k0"),e.redraw()}),(0,l.default)("#chart_select_theme li a").click(function(){(0,l.default)("#chart_select_theme a").removeClass("selected"),"dark"===(0,l.default)(this).attr("name")?r.Control.switchTheme("dark"):"light"===(0,l.default)(this).attr("name")&&r.Control.switchTheme("light")}),(0,l.default)("#chart_enable_tools li a").click(function(){(0,l.default)("#chart_enable_tools a").removeClass("selected"),"on"===(0,l.default)(this).attr("name")?r.Control.switchTools("on"):"off"===(0,l.default)(this).attr("name")&&r.Control.switchTools("off")}),(0,l.default)("#chart_enable_indicator li a").click(function(){(0,l.default)("#chart_enable_indicator a").removeClass("selected"),"on"===(0,l.default)(this).attr("name")?r.Control.switchIndic("on"):"off"===(0,l.default)(this).attr("name")&&r.Control.switchIndic("off")}),(0,l.default)(document).keyup(function(t){46===t.keyCode&&(o.ChartManager.instance.deleteToolObject(),o.ChartManager.instance.redraw("OverlayCanvas",!1))}),(0,l.default)("#clearCanvas").click(function(){for(var t=o.ChartManager.instance.getDataSource("frame0.k0"),e=t.getToolObjectCount(),n=0;n<e;n++)t.delToolObject();o.ChartManager.instance.redraw("OverlayCanvas",!1)}),(0,l.default)("#chart_overlayCanvas").mousemove(function(e){var n=e.target.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top,a=o.ChartManager.instance;!0===t.instance.buttonDown?(a.onMouseMove("frame0",r,i,!0),a.redraw("All",!1)):(a.onMouseMove("frame0",r,i,!1),a.redraw("OverlayCanvas"))}).mouseleave(function(t){var e=t.target.getBoundingClientRect(),n=t.clientX-e.left,r=t.clientY-e.top,i=o.ChartManager.instance;i.onMouseLeave("frame0",n,r,!1),i.redraw("OverlayCanvas")}).mouseup(function(e){if(1===e.which){t.instance.buttonDown=!1;var n=e.target.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top,a=o.ChartManager.instance;a.onMouseUp("frame0",r,i),a.redraw("All")}}).mousedown(function(e){if(1!==e.which)return o.ChartManager.instance.deleteToolObject(),void o.ChartManager.instance.redraw("OverlayCanvas",!1);t.instance.buttonDown=!0;var n=e.target.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top;o.ChartManager.instance.onMouseDown("frame0",r,i)}),(0,l.default)("#chart_parameter_settings :input").change(function(){var t=(0,l.default)(this).attr("name"),e=0,n=[],r=o.ChartManager.instance;if((0,l.default)("#chart_parameter_settings :input").each(function(){if((0,l.default)(this).attr("name")===t){if(""!==(0,l.default)(this).val()&&null!==(0,l.default)(this).val()&&void 0!==(0,l.default)(this).val()){var r=parseInt((0,l.default)(this).val());n.push(r)}e++}}),0!==n.length){r.setIndicatorParameters(t,n);var i=r.getIndicatorParameters(t),s=[];e=0,(0,l.default)("#chart_parameter_settings :input").each(function(){(0,l.default)(this).attr("name")===t&&(""!==(0,l.default)(this).val()&&null!==(0,l.default)(this).val()&&void 0!==(0,l.default)(this).val()&&((0,l.default)(this).val(i[e].getValue()),s.push(i[e].getValue())),e++)}),a.ChartSettings.get().indics[t]=s,a.ChartSettings.save(),r.redraw("All",!1)}}),(0,l.default)("#chart_parameter_settings button").click(function(){var t=(0,l.default)(this).parents("tr").children("th").html(),e=0,n=o.ChartManager.instance.getIndicatorParameters(t),r=[];(0,l.default)(this).parent().prev().children("input").each(function(){null!==n&&e<n.length&&((0,l.default)(this).val(n[e].getDefaultValue()),r.push(n[e].getDefaultValue())),e++}),o.ChartManager.instance.setIndicatorParameters(t,r),a.ChartSettings.get().indics[t]=r,a.ChartSettings.save(),o.ChartManager.instance.redraw("All",!1)}),(0,l.default)("body").on("click","#sizeIcon",function(){t.instance.isSized=!t.instance.isSized,t.instance.isSized?((0,l.default)(t.instance.element).css({position:"fixed",left:"0",right:"0",top:"0",bottom:"0",width:"100%",height:"100%",zIndex:"10000"}),r.Control.onSize(),(0,l.default)("html,body").css({width:"100%",height:"100%",overflow:"hidden"})):((0,l.default)(t.instance.element).attr("style",""),(0,l.default)("html,body").attr("style",""),r.Control.onSize(t.instance.width,t.instance.height),(0,l.default)(t.instance.element).css({visibility:"visible",height:t.instance.height+"px"}))})})}}])&&d(e.prototype,n),h&&d(e,h),t}();e.default=p,p.created=!1,p.instance=null},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ChartSettings=void 0;var r=n(0);function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,o;return e=t,o=[{key:"checkVersion",value:function(){if(t._data.ver<2){t._data.ver=2;var e=t._data.charts;e.period_weight={},e.period_weight.line=8,e.period_weight["1min"]=7,e.period_weight["5min"]=6,e.period_weight["15min"]=5,e.period_weight["30min"]=4,e.period_weight["1hour"]=3,e.period_weight["1day"]=2,e.period_weight["1week"]=1,e.period_weight["3min"]=0,e.period_weight["2hour"]=0,e.period_weight["4hour"]=0,e.period_weight["6hour"]=0,e.period_weight["12hour"]=0,e.period_weight["3day"]=0}t._data.ver<3&&(t._data.ver=3,t._data.charts.areaHeight=[])}},{key:"get",value:function(){return void 0===t._data&&(t.init(),t.load(),t.checkVersion()),t._data}},{key:"init",value:function(){for(var e={},n=["MA","EMA","VOLUME","MACD","KDJ","StochRSI","RSI","DMI","OBV","BOLL","DMA","TRIX","BRAR","VR","EMV","WR","ROC","MTM","PSY"],i=0;i<n.length;i++){var o=r.ChartManager.instance.createIndicatorAndRange("",n[i],!0);if(null!==o){e[n[i]]=[];for(var a=o.indic.getParameters(),s=0;s<a.length;s++)e[n[i]].push(a[s])}}var u={chartStyle:"CandleStick",mIndic:"MA",indics:["VOLUME","MACD"],indicsStatus:"open",period:"15m"};t._data={ver:1,charts:u,indics:e,theme:"Dark"},t.checkVersion()}},{key:"load",value:function(){if(!(document.cookie.length<=0)){var e=document.cookie.indexOf("chartSettings=");if(!(e<0)){e+="chartSettings=".length;var n=document.cookie.indexOf(";",e);n<0&&(n=document.cookie.length);var r=unescape(document.cookie.substring(e,n));t._data=JSON.parse(r)}}}},{key:"save",value:function(){var e=new Date;e.setDate(e.getDate()+2),document.cookie="chartSettings="+escape(JSON.stringify(t._data))+";expires="+e.toGMTString()}}],(n=null)&&i(e.prototype,n),o&&i(e,o),t}();e.ChartSettings=o},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}Object.defineProperty(e,"__esModule",{value:!0}),e.Util=void 0;var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,i;return e=t,i=[{key:"fromFloat",value:function(t,e){for(var n=t.toFixed(e),r=n.length-1;r>=0;r--){if("."===n[r])return n.substring(0,r);if("0"!==n[r])return n.substring(0,r+1)}}},{key:"formatTime",value:function(t){return t<10?"0"+t.toString():t.toString()}},{key:"isInstance",value:function(t,e){return null!==t&&void 0!==t&&t instanceof e}}],(n=null)&&r(e.prototype,n),i&&r(e,i),t}();e.Util=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LightTheme=e.DarkTheme=e.Theme=void 0;var r,i=(r=n(3))&&r.__esModule?r:{default:r};function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var d=function(){function t(){l(this,t),this.getFont=function(t){return this._fonts[t]}}var e,n,r;return e=t,(n=[{key:"getColor",value:function(t){return this._colors[t]}}])&&h(e.prototype,n),r&&h(e,r),t}();e.Theme=d,d.theme_color_id=0,d.theme_font_id=0,d.Color={Positive:d.theme_color_id++,Negative:d.theme_color_id++,PositiveDark:d.theme_color_id++,NegativeDark:d.theme_color_id++,Unchanged:d.theme_color_id++,Background:d.theme_color_id++,Cursor:d.theme_color_id++,RangeMark:d.theme_color_id++,Indicator0:d.theme_color_id++,Indicator1:d.theme_color_id++,Indicator2:d.theme_color_id++,Indicator3:d.theme_color_id++,Indicator4:d.theme_color_id++,Indicator5:d.theme_color_id++,Grid0:d.theme_color_id++,Grid1:d.theme_color_id++,Grid2:d.theme_color_id++,Grid3:d.theme_color_id++,Grid4:d.theme_color_id++,TextPositive:d.theme_color_id++,TextNegative:d.theme_color_id++,Text0:d.theme_color_id++,Text1:d.theme_color_id++,Text2:d.theme_color_id++,Text3:d.theme_color_id++,Text4:d.theme_color_id++,LineColorNormal:d.theme_color_id++,LineColorSelected:d.theme_color_id++,CircleColorFill:d.theme_color_id++,CircleColorStroke:d.theme_color_id++},d.Font={Default:d.theme_font_id++};var p=function(t){function e(){var t;return l(this,e),(t=a(this,s(e).call(this)))._colors=[],i.default.instance.reverseColor?(t._colors[d.Color.Positive]="#eb1944",t._colors[d.Color.Negative]="#43cc63",t._colors[d.Color.PositiveDark]="#3b0e08",t._colors[d.Color.NegativeDark]="#004718"):(t._colors[d.Color.Positive]="#43cc63",t._colors[d.Color.Negative]="#eb1944",t._colors[d.Color.PositiveDark]="#004718",t._colors[d.Color.NegativeDark]="#3b0e08"),t._colors[d.Color.Unchanged]="#fff",t._colors[d.Color.Background]="#333537",t._colors[d.Color.Cursor]="#aaa",t._colors[d.Color.RangeMark]="#f9ee30",t._colors[d.Color.Indicator0]="#ddd",t._colors[d.Color.Indicator1]="#f9ee30",t._colors[d.Color.Indicator2]="#f600ff",t._colors[d.Color.Indicator3]="#6bf",t._colors[d.Color.Indicator4]="#a5cf81",t._colors[d.Color.Indicator5]="#e18b89",t._colors[d.Color.Grid0]="#333",t._colors[d.Color.Grid1]="#444",t._colors[d.Color.Grid2]="#666",t._colors[d.Color.Grid3]="#888",t._colors[d.Color.Grid4]="#aaa",t._colors[d.Color.TextPositive]="#1bd357",t._colors[d.Color.TextNegative]="#ff6f5e",t._colors[d.Color.Text0]="#444",t._colors[d.Color.Text1]="#666",t._colors[d.Color.Text2]="#888",t._colors[d.Color.Text3]="#aaa",t._colors[d.Color.Text4]="#ccc",t._colors[d.Color.LineColorNormal]="#a6a6a6",t._colors[d.Color.LineColorSelected]="#ffffff",t._colors[d.Color.CircleColorFill]="#000000",t._colors[d.Color.CircleColorStroke]="#ffffff",t._fonts=[],t._fonts[d.Font.Default]="12px Tahoma",t}return u(e,d),e}();e.DarkTheme=p;var f=function(t){function e(){var t;return l(this,e),(t=a(this,s(e).call(this)))._colors=[],i.default.instance.reverseColor?(t._colors[d.Color.Positive]="#db5542",t._colors[d.Color.Negative]="#53b37b",t._colors[d.Color.PositiveDark]="#ffadaa",t._colors[d.Color.NegativeDark]="#66d293"):(t._colors[d.Color.Positive]="#53b37b",t._colors[d.Color.Negative]="#db5542",t._colors[d.Color.PositiveDark]="#66d293",t._colors[d.Color.NegativeDark]="#ffadaa"),t._colors[d.Color.Unchanged]="#fff",t._colors[d.Color.Background]="#fff",t._colors[d.Color.Cursor]="#aaa",t._colors[d.Color.RangeMark]="#f27935",t._colors[d.Color.Indicator0]="#2fd2b2",t._colors[d.Color.Indicator1]="#ffb400",t._colors[d.Color.Indicator2]="#e849b9",t._colors[d.Color.Indicator3]="#1478c8",t._colors[d.Color.Grid0]="#eee",t._colors[d.Color.Grid1]="#afb1b3",t._colors[d.Color.Grid2]="#ccc",t._colors[d.Color.Grid3]="#bbb",t._colors[d.Color.Grid4]="#aaa",t._colors[d.Color.TextPositive]="#53b37b",t._colors[d.Color.TextNegative]="#db5542",t._colors[d.Color.Text0]="#ccc",t._colors[d.Color.Text1]="#aaa",t._colors[d.Color.Text2]="#888",t._colors[d.Color.Text3]="#666",t._colors[d.Color.Text4]="#444",t._colors[d.Color.LineColorNormal]="#8c8c8c",t._colors[d.Color.LineColorSelected]="#393c40",t._colors[d.Color.CircleColorFill]="#ffffff",t._colors[d.Color.CircleColorStroke]="#393c40",t._fonts=[],t._fonts[d.Font.Default]="12px Tahoma",t}return u(e,d),e}();e.LightTheme=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"firebase",function(){return l});var r=n(16),i=(n.n(r),function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}),o="[DEFAULT]",a=[],s=function(){function t(t,e,n){this.firebase_=n,this.isDeleted_=!1,this.services_={},this.name_=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled||!1,this.options_=Object(r.deepCopy)(t),this.INTERNAL={getUid:function(){return null},getToken:function(){return Promise.resolve(null)},addAuthTokenListener:function(t){a.push(t),setTimeout(function(){return t(null)},0)},removeAuthTokenListener:function(t){a=a.filter(function(e){return e!==t})}}}return Object.defineProperty(t.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this._automaticDataCollectionEnabled},set:function(t){this.checkDestroyed_(),this._automaticDataCollectionEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),t.prototype.delete=function(){var t=this;return new Promise(function(e){t.checkDestroyed_(),e()}).then(function(){t.firebase_.INTERNAL.removeApp(t.name_);var e=[];return Object.keys(t.services_).forEach(function(n){Object.keys(t.services_[n]).forEach(function(r){e.push(t.services_[n][r])})}),Promise.all(e.map(function(t){return t.INTERNAL.delete()}))}).then(function(){t.isDeleted_=!0,t.services_={}})},t.prototype._getService=function(t,e){if(void 0===e&&(e=o),this.checkDestroyed_(),this.services_[t]||(this.services_[t]={}),!this.services_[t][e]){var n=e!==o?e:void 0,r=this.firebase_.INTERNAL.factories[t](this,this.extendApp.bind(this),n);this.services_[t][e]=r}return this.services_[t][e]},t.prototype.extendApp=function(t){var e=this;Object(r.deepExtend)(this,t),t.INTERNAL&&t.INTERNAL.addAuthTokenListener&&(a.forEach(function(t){e.INTERNAL.addAuthTokenListener(t)}),a=[])},t.prototype.checkDestroyed_=function(){this.isDeleted_&&u("app-deleted",{name:this.name_})},t}();function u(t,e){throw c.create(t,e)}s.prototype.name&&s.prototype.options||s.prototype.delete||console.log("dc");var c=new r.ErrorFactory("app","Firebase",{"no-app":"No Firebase App '{$name}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$name}","duplicate-app":"Firebase App named '{$name}' already exists","app-deleted":"Firebase App named '{$name}' already deleted","duplicate-service":"Firebase service named '{$name}' already registered","sa-not-supported":"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain","invalid-app-argument":"firebase.{$name}() takes either no argument or a Firebase App instance."}),l=function t(){var e={},n={},a={},c={__esModule:!0,initializeApp:function(t,n){if(void 0===n&&(n={}),"object"!=typeof n||null===n){var r=n;n={name:r}}var a=n;void 0===a.name&&(a.name=o);var l=a.name;"string"==typeof l&&l||u("bad-app-name",{name:l+""}),i(e,l)&&u("duplicate-app",{name:l});var h=new s(t,a,c);return e[l]=h,d(h,"create"),h},app:l,apps:null,Promise:Promise,SDK_VERSION:"4.13.0",INTERNAL:{registerService:function(t,e,i,o,d){n[t]&&u("duplicate-service",{name:t}),n[t]=e,o&&(a[t]=o,h().forEach(function(t){o("create",t)}));var p=function(e){return void 0===e&&(e=l()),"function"!=typeof e[t]&&u("invalid-app-argument",{name:t}),e[t]()};return void 0!==i&&Object(r.deepExtend)(p,i),c[t]=p,s.prototype[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return this._getService.bind(this,t).apply(this,d?e:[])},p},createFirebaseNamespace:t,extendNamespace:function(t){Object(r.deepExtend)(c,t)},createSubscribe:r.createSubscribe,ErrorFactory:r.ErrorFactory,removeApp:function(t){d(e[t],"delete"),delete e[t]},factories:n,useAsService:p,Promise:Promise,deepExtend:r.deepExtend}};function l(t){return i(e,t=t||o)||u("no-app",{name:t}),e[t]}function h(){return Object.keys(e).map(function(t){return e[t]})}function d(t,e){Object.keys(n).forEach(function(n){var r=p(t,n);null!==r&&a[r]&&a[r](e,t)})}function p(t,e){if("serverAuth"===e)return null;var n=e;return t.options,n}return Object(r.patchProperty)(c,"default",c),Object.defineProperty(c,"apps",{get:h}),Object(r.patchProperty)(l,"App",s),c}();e.default=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TemplateMeasuringHandler=e.DefaultTemplate=e.Template=void 0;var r=n(0),i=n(4),o=f(n(2)),a=f(n(14)),s=f(n(15)),u=f(n(13)),c=n(28),l=n(19),h=f(n(29)),d=f(n(6)),p=f(n(22));function f(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}function g(t){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _(t,e){return!e||"object"!==g(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function m(t,e){return(m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function w(t,e,n){return e&&b(t.prototype,e),n&&b(t,n),t}var C=function(){function t(){y(this,t)}return w(t,null,[{key:"createCandlestickDataSource",value:function(t){return new o.MainDataSource(t)}},{key:"createDataSource",value:function(t,e,n){var i=r.ChartManager.instance;null===i.getCachedDataSource(e)&&i.setCachedDataSource(e,n(e)),i.setCurrentDataSource(t,e),i.updateData(t,null)}},{key:"createTableComps",value:function(t){this.createMainChartComps(t),this.displayVolume&&this.createIndicatorChartComps(t,"VOLUME"),this.createTimelineComps(t)}},{key:"createMainChartComps",value:function(t){var e=r.ChartManager.instance,n=e.getArea(t+".charts"),i=t+".main",o=i+"Range",c=new s.MainArea(i);e.setArea(i,c),n.addArea(c);var l=new s.MainRangeArea(o);e.setArea(o,l),n.addArea(l);var h=new a.MainDataProvider(i+".main");e.setDataProvider(h.getName(),h),e.setMainIndicator(t,"MA");var d=new p.MainRange(i);e.setRange(d.getName(),d),d.setPaddingTop(28),d.setPaddingBottom(12);var f=new u.MainAreaBackgroundPlotter(i+".background");e.setPlotter(f.getName(),f),f=new u.CGridPlotter(i+".grid"),e.setPlotter(f.getName(),f),f=new u.CandlestickPlotter(i+".main"),e.setPlotter(f.getName(),f),f=new u.MinMaxPlotter(i+".decoration"),e.setPlotter(f.getName(),f),f=new u.MainInfoPlotter(i+".info"),e.setPlotter(f.getName(),f),f=new u.SelectionPlotter(i+".selection"),e.setPlotter(f.getName(),f),f=new u.CDynamicLinePlotter(i+".tool"),e.setPlotter(f.getName(),f),f=new u.RangeAreaBackgroundPlotter(i+"Range.background"),e.setPlotter(f.getName(),f),f=new u.COrderGraphPlotter(i+"Range.grid"),e.setPlotter(f.getName(),f),f=new u.RangePlotter(i+"Range.main"),e.setPlotter(f.getName(),f),f=new u.RangeSelectionPlotter(i+"Range.selection"),e.setPlotter(f.getName(),f),f=new u.LastClosePlotter(i+"Range.decoration"),e.setPlotter(f.getName(),f)}},{key:"createIndicatorChartComps",value:function(t,e){var n=r.ChartManager.instance,o=n.getArea(t+".charts"),c=t+".indic"+o.getNextRowId(),l=c+"Range",h=new s.IndicatorArea(c);n.setArea(c,h),o.addArea(h);var d=o.getAreaCount()>>1,p=i.ChartSettings.get().charts.areaHeight;if(p.length>d){var f,g;for(g=0;g<d;g++)(f=o.getAreaAt(g<<1)).setTop(0),f.setBottom(p[g]);h.setTop(0),h.setBottom(p[d])}var _=new s.IndicatorRangeArea(l);n.setArea(l,_),o.addArea(_);var v=new a.IndicatorDataProvider(c+".secondary");if(n.setDataProvider(v.getName(),v),!1!==n.setIndicator(c,e)){var m=new u.MainAreaBackgroundPlotter(c+".background");n.setPlotter(m.getName(),m),m=new u.CGridPlotter(c+".grid"),n.setPlotter(m.getName(),m),m=new u.IndicatorPlotter(c+".secondary"),n.setPlotter(m.getName(),m),m=new u.IndicatorInfoPlotter(c+".info"),n.setPlotter(m.getName(),m),m=new u.SelectionPlotter(c+".selection"),n.setPlotter(m.getName(),m),m=new u.RangeAreaBackgroundPlotter(c+"Range.background"),n.setPlotter(m.getName(),m),m=new u.RangePlotter(c+"Range.main"),n.setPlotter(m.getName(),m),m=new u.RangeSelectionPlotter(c+"Range.selection"),n.setPlotter(m.getName(),m)}else n.removeIndicator(c)}},{key:"createTimelineComps",value:function(t){var e,n=r.ChartManager.instance,i=new c.Timeline(t);n.setTimeline(i.getName(),i),e=new u.TimelineAreaBackgroundPlotter(t+".timeline.background"),n.setPlotter(e.getName(),e),e=new u.TimelinePlotter(t+".timeline.main"),n.setPlotter(e.getName(),e),e=new u.TimelineSelectionPlotter(t+".timeline.selection"),n.setPlotter(e.getName(),e)}},{key:"createLiveOrderComps",value:function(t){var e,n=r.ChartManager.instance;e=new u.BackgroundPlotter(t+".main.background"),n.setPlotter(e.getName(),e),e=new u.CLiveOrderPlotter(t+".main.main"),n.setPlotter(e.getName(),e)}},{key:"createLiveTradeComps",value:function(t){var e,n=r.ChartManager.instance;e=new u.BackgroundPlotter(t+".main.background"),n.setPlotter(e.getName(),e),e=new u.CLiveTradePlotter(t+".main.main"),n.setPlotter(e.getName(),e)}}]),t}();e.Template=C,C.displayVolume=!0;var E=function(t){function e(){return y(this,e),_(this,v(e).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&m(t,e)}(e,C),w(e,null,[{key:"loadTemplate",value:function(t,e){var n=r.ChartManager.instance,o=i.ChartSettings.get(),a=new l.CName(t).getCompAt(0);n.unloadTemplate(a),this.createDataSource(t,e,this.createCandlestickDataSource);var u=new h.DockableLayout(a);n.setFrame(u.getName(),u),n.setArea(u.getName(),u),u.setGridColor(d.Theme.Color.Grid1);var c=new s.TimelineArea(t+".timeline");n.setArea(c.getName(),c),u.addArea(c),c.setDockStyle(s.ChartArea.DockStyle.Bottom),c.Measuring.addHandler(c,x.onMeasuring);var p=new h.TableLayout(t+".charts");return n.setArea(p.getName(),p),p.setDockStyle(s.ChartArea.DockStyle.Fill),u.addArea(p),this.createTableComps(t),n.setThemeName(a,o.theme),n}}]),e}();e.DefaultTemplate=E;var x=function(){function t(){y(this,t)}return w(t,null,[{key:"onMeasuring",value:function(t,e){var n=e.Width;e.Height;"timeline"===t.getNameObject().getCompAt(2)&&t.setMeasuredDimension(n,22)}}]),t}();e.TemplateMeasuringHandler=x},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Control=void 0;var _kline=_interopRequireDefault(__webpack_require__(3)),_kline_trade=__webpack_require__(18),_chart_manager=__webpack_require__(0),_chart_settings=__webpack_require__(4),_templates=__webpack_require__(8),_mevent=__webpack_require__(21),_jquery=_interopRequireDefault(__webpack_require__(23));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}var Control=function(){function Control(){_classCallCheck(this,Control)}return _createClass(Control,null,[{key:"refreshFunction",value:function(){Control.refreshCounter++;var t=_chart_manager.ChartManager.instance.getLanguage();if(Control.refreshCounter>3600){var e=Number(Control.refreshCounter/3600);"en-us"===t?(0,_jquery.default)("#chart_updated_time_text").html(e.toFixed(0)+"h"):"zh-tw"===t?(0,_jquery.default)("#chart_updated_time_text").html(e.toFixed(0)+"小時"):(0,_jquery.default)("#chart_updated_time_text").html(e.toFixed(0)+"小时")}else if(Control.refreshCounter>60&&Control.refreshCounter<=3600){var n=Number(Control.refreshCounter/60);"en-us"===t?(0,_jquery.default)("#chart_updated_time_text").html(n.toFixed(0)+"m"):"zh-tw"===t?(0,_jquery.default)("#chart_updated_time_text").html(n.toFixed(0)+"分鐘"):(0,_jquery.default)("#chart_updated_time_text").html(n.toFixed(0)+"分钟")}else Control.refreshCounter<=60&&("en-us"===t?(0,_jquery.default)("#chart_updated_time_text").html(Control.refreshCounter+"s"):(0,_jquery.default)("#chart_updated_time_text").html(Control.refreshCounter+"秒"))}},{key:"clearRefreshCounter",value:function(){window.clearInterval(Control.refreshHandler),Control.refreshCounter=0,"en-us"===_chart_manager.ChartManager.instance.getLanguage()?(0,_jquery.default)("#chart_updated_time_text").html(Control.refreshCounter+"s"):(0,_jquery.default)("#chart_updated_time_text").html(Control.refreshCounter+"秒"),Control.refreshHandler=setInterval(Control.refreshFunction,_kline.default.instance.intervalTime)}},{key:"requestData",value:function(t){Control.AbortRequest(),window.clearTimeout(_kline.default.instance.timer),_kline.default.instance.paused||(!0===t&&(0,_jquery.default)("#chart_loading").addClass("activated"),"stomp"===_kline.default.instance.type&&_kline.default.instance.stompClient?Control.requestOverStomp():Control.requestOverHttp())}},{key:"parseRequestParam",value:function(t){return JSON.parse('{"'+decodeURI(t.replace(/&/g,'","').replace(/=/g,'":"'))+'"}')}},{key:"requestOverStomp",value:function(){_kline.default.instance.socketConnected?_kline.default.instance.stompClient&&1===_kline.default.instance.stompClient.ws.readyState?_kline.default.instance.stompClient.send(_kline.default.instance.sendPath,{},JSON.stringify(Control.parseRequestParam(_kline.default.instance.requestParam))):(_kline.default.instance.debug&&console.log("DEBUG: stomp client is not ready yet ..."),_kline.default.instance.timer=setTimeout(function(){Control.requestData(!0)},1e3)):_kline.default.instance.debug&&console.log("DEBUG: socket is not coonnected")}},{key:"requestOverHttp",value:function(){_kline.default.instance.debug&&console.log("DEBUG: "+_kline.default.instance.requestParam),(0,_jquery.default)(document).ready(_kline.default.instance.G_HTTP_REQUEST=_jquery.default.ajax({type:"GET",url:_kline.default.instance.url,dataType:"json",data:_kline.default.instance.requestParam,timeout:3e4,created:Date.now(),beforeSend:function(){this.range=_kline.default.instance.range,this.symbol=_kline.default.instance.symbol},success:function(t){_kline.default.instance.G_HTTP_REQUEST&&Control.requestSuccessHandler(t)},error:function(t,e,n){_kline.default.instance.debug&&console.log(t),200===t.status&&4===t.readyState||(_kline.default.instance.timer=setTimeout(function(){Control.requestData(!0)},_kline.default.instance.intervalTime))},complete:function(){_kline.default.instance.G_HTTP_REQUEST=null}}))}},{key:"requestSuccessHandler",value:function requestSuccessHandler(res){if(_kline.default.instance.debug&&console.log(res),res&&res.success){(0,_jquery.default)("#chart_loading").removeClass("activated");var chart=_chart_manager.ChartManager.instance.getChart();chart.setTitle(),_kline.default.instance.data=eval(res.data);var updateDataRes=_kline.default.instance.chartMgr.updateData("frame0.k0",_kline.default.instance.data.lines);_kline.default.instance.requestParam=Control.setHttpRequestParam(_kline.default.instance.symbol,_kline.default.instance.range,null,_kline.default.instance.chartMgr.getDataSource("frame0.k0").getLastDate());var intervalTime=_kline.default.instance.intervalTime<_kline.default.instance.range?_kline.default.instance.intervalTime:_kline.default.instance.range;updateDataRes?(_kline.default.instance.data.trades&&_kline.default.instance.data.trades.length>0&&(_kline_trade.KlineTrade.instance.pushTrades(_kline.default.instance.data.trades),_kline_trade.KlineTrade.instance.klineTradeInit=!0),_kline.default.instance.data.depths&&_kline_trade.KlineTrade.instance.updateDepth(_kline.default.instance.data.depths),Control.clearRefreshCounter(),"poll"===_kline.default.instance.type&&(_kline.default.instance.timer=setTimeout(Control.TwoSecondThread,intervalTime)),_chart_manager.ChartManager.instance.redraw("All",!1)):"poll"===_kline.default.instance.type&&(_kline.default.instance.timer=setTimeout(Control.requestData,intervalTime))}else"poll"===_kline.default.instance.type&&(_kline.default.instance.timer=setTimeout(function(){Control.requestData(!0)},_kline.default.instance.intervalTime))}},{key:"AbortRequest",value:function(){"stomp"===_kline.default.instance.type&&_kline.default.instance.stompClient||_kline.default.instance.G_HTTP_REQUEST&&4!==_kline.default.instance.G_HTTP_REQUEST.readyState&&_kline.default.instance.G_HTTP_REQUEST.abort()}},{key:"TwoSecondThread",value:function(){var t=_kline.default.instance.chartMgr.getDataSource("frame0.k0").getLastDate();_kline.default.instance.requestParam=-1===t?Control.setHttpRequestParam(_kline.default.instance.symbol,_kline.default.instance.range,_kline.default.instance.limit,null):Control.setHttpRequestParam(_kline.default.instance.symbol,_kline.default.instance.range,null,t.toString()),Control.requestData()}},{key:"readCookie",value:function(){_chart_settings.ChartSettings.get(),_chart_settings.ChartSettings.save();var t=_chart_settings.ChartSettings.get();_chart_manager.ChartManager.instance.setChartStyle("frame0.k0",t.charts.chartStyle);var e=t.charts.symbol;_kline.default.instance.init||(e=_kline.default.instance.symbol,_kline.default.instance.init=!0),_kline.default.instance.symbol=e,Control.switchSymbolSelected(e);var n=t.charts.period;Control.switchPeriod(n),(0,_jquery.default)("#chart_period_"+n+"_v a").addClass("selected"),(0,_jquery.default)("#chart_period_"+n+"_h a").addClass("selected"),"close"===t.charts.indicsStatus?Control.switchIndic("off"):"open"===t.charts.indicsStatus&&Control.switchIndic("on"),(0,_jquery.default)("#chart_select_main_indicator").find("a").each(function(){(0,_jquery.default)(this).attr("name")===t.charts.mIndic&&(0,_jquery.default)(this).addClass("selected")}),(0,_jquery.default)("#chart_select_chart_style").find("a").each(function(){(0,_jquery.default)(this)[0].innerHTML===t.charts.chartStyle&&(0,_jquery.default)(this).addClass("selected")}),_chart_manager.ChartManager.instance.getChart().setMainIndicator(t.charts.mIndic),_chart_manager.ChartManager.instance.setThemeName("frame0",t.theme),Control.switchTools("off"),"Dark"===t.theme?Control.switchTheme("dark"):"Light"===t.theme&&Control.switchTheme("light"),Control.chartSwitchLanguage(t.language||"zh-cn")}},{key:"setHttpRequestParam",value:function(t,e,n,r){var i="symbol="+t+"&range="+e;return i+=null!==n?"&limit="+n:"&since="+r,0!==_kline_trade.KlineTrade.instance.tradeDate.getTime()&&(i+="&prevTradeTime="+_kline_trade.KlineTrade.instance.tradeDate.getTime()),i}},{key:"refreshTemplate",value:function(){_kline.default.instance.chartMgr=_templates.DefaultTemplate.loadTemplate("frame0.k0",""),_chart_manager.ChartManager.instance.redraw("All",!0)}},{key:"chartSwitchLanguage",value:function(t){var e=t.replace(/-/,"_");(0,_jquery.default)("#chart_language_switch_tmp").find("span").each(function(){var t=(0,_jquery.default)(this).attr("name"),n=(0,_jquery.default)(this).attr(e);t="."+t,(0,_jquery.default)(t)[0]&&(0,_jquery.default)(t).each(function(){(0,_jquery.default)(this)[0].innerHTML=n})}),(0,_jquery.default)("#chart_language_setting_div li a[name='"+t+"']").addClass("selected"),_chart_manager.ChartManager.instance.setLanguage(t),_chart_manager.ChartManager.instance.getChart().setTitle(),_chart_settings.ChartSettings.get().language=t,_chart_settings.ChartSettings.save(),_kline.default.instance.onLangChange(t)}},{key:"onSize",value:function(t,e){var n=t||window.innerWidth,r=_kline.default.instance.showTrade?n-_kline.default.instance.tradeWidth:n,i=e||window.innerHeight;(0,_jquery.default)(_kline.default.instance.element).css({width:n+"px",height:i+"px"});var o=(0,_jquery.default)("#chart_toolbar"),a=(0,_jquery.default)("#chart_toolpanel"),s=(0,_jquery.default)("#chart_canvasGroup"),u=(0,_jquery.default)("#chart_tabbar"),c="inline"===a[0].style.display,l="block"===u[0].style.display,h={x:0,y:0};h.w=r,h.h=29;var d={x:0};d.y=h.h+1,d.w=c?32:0,d.h=i-d.y;var p={};p.w=c?r-(d.w+1):r,p.h=l?22:-1,p.x=r-p.w,p.y=i-(p.h+1);var f={};f.x=p.x,f.y=d.y,f.w=p.w,f.h=p.y-d.y,o.css({left:h.x+"px",top:h.y+"px",width:h.w+"px",height:h.h+"px"}),c&&a.css({left:d.x+"px",top:d.y+"px",width:d.w+"px",height:d.h+"px"}),s.css({left:f.x+"px",top:f.y+"px",height:f.h+"px"});var g=(0,_jquery.default)("#chart_mainCanvas")[0],_=(0,_jquery.default)("#chart_overlayCanvas")[0];g.width=f.w,g.height=f.h,_.width=f.w,_.height=f.h,l&&u.css({left:p.x+"px",top:p.y+"px",width:p.w+"px",height:p.h+"px"});var v=(0,_jquery.default)("#chart_parameter_settings");v.css({left:r-v.width()>>1,top:i-v.height()>>1});var m=(0,_jquery.default)("#chart_loading");m.css({left:r-m.width()>>1,top:i-m.height()>>2});var y=(0,_jquery.default)("#chart_dom_elem_cache"),b=((0,_jquery.default)("#chart_select_theme")[0],(0,_jquery.default)("#chart_enable_tools")[0]),w=(0,_jquery.default)("#chart_enable_indicator")[0],C=(0,_jquery.default)("#chart_toolbar_periods_vert"),E=(0,_jquery.default)("#chart_toolbar_periods_horz")[0],x=(0,_jquery.default)("#chart_show_indicator")[0],A=(0,_jquery.default)("#chart_show_tools")[0],S=(0,_jquery.default)("#chart_dropdown_settings"),k=C[0].offsetWidth,T=k+E.offsetWidth,P=T+x.offsetWidth+4,I=P+A.offsetWidth+4,O=S.find(".chart_dropdown_t")[0].offsetWidth+150;k+=O,P+=O,I+=O,r<(T+=O)?y.append(E):C.after(E),r<P?(y.append(x),w.style.display=""):(S.before(x),w.style.display="none"),r<I?(y.append(A),b.style.display=""):(S.before(A),b.style.display="none"),_chart_manager.ChartManager.instance.redraw("All",!0),_kline.default.instance.onResize(n,i)}},{key:"mouseWheel",value:function(t,e){return _chart_manager.ChartManager.instance.scale(e>0?1:-1),_chart_manager.ChartManager.instance.redraw("All",!0),!1}},{key:"switchTheme",value:function(t){if((0,_jquery.default)("#chart_toolbar_theme a").removeClass("selected"),(0,_jquery.default)("#chart_select_theme a").removeClass("selected"),(0,_jquery.default)("#chart_toolbar_theme").find("a").each(function(){(0,_jquery.default)(this).attr("name")===t&&(0,_jquery.default)(this).addClass("selected")}),(0,_jquery.default)("#chart_select_theme a").each(function(){(0,_jquery.default)(this).attr("name")===t&&(0,_jquery.default)(this).addClass("selected")}),(0,_jquery.default)(".chart_container").attr("class","chart_container "+t),(0,_jquery.default)(".marketName_ a").attr("class",t),"dark"===t)(0,_jquery.default)(".trade_container").addClass("dark").removeClass("light"),_chart_manager.ChartManager.instance.setThemeName("frame0","Dark"),_chart_settings.ChartSettings.get().theme="Dark",_chart_settings.ChartSettings.save();else if("light"===t){(0,_jquery.default)(".trade_container").addClass("light").removeClass("dark"),_chart_manager.ChartManager.instance.setThemeName("frame0","Light"),_chart_settings.ChartSettings.get().theme="Light",_chart_settings.ChartSettings.save()}var e={command:"set current themes"};e.content=t,(0,_jquery.default)("#chart_output_interface_text").val(JSON.stringify(e)),(0,_jquery.default)("#chart_output_interface_submit").submit(),(new _mevent.MEvent).raise(t),_chart_manager.ChartManager.instance.redraw(),_kline.default.instance.onThemeChange(t)}},{key:"switchTools",value:function(t){(0,_jquery.default)(".chart_dropdown_data").removeClass("chart_dropdown-hover"),(0,_jquery.default)("#chart_toolpanel .chart_toolpanel_button").removeClass("selected"),(0,_jquery.default)("#chart_enable_tools a").removeClass("selected"),"on"===t?((0,_jquery.default)("#chart_show_tools").addClass("selected"),(0,_jquery.default)("#chart_enable_tools a").each(function(){"on"===(0,_jquery.default)(this).attr("name")&&(0,_jquery.default)(this).addClass("selected")}),(0,_jquery.default)("#chart_toolpanel")[0].style.display="inline",_chart_manager.ChartManager.instance._drawingTool===_chart_manager.ChartManager.DrawingTool.Cursor?(0,_jquery.default)("#chart_Cursor").parent().addClass("selected"):_chart_manager.ChartManager.instance._drawingTool===_chart_manager.ChartManager.DrawingTool.CrossCursor&&(0,_jquery.default)("#chart_CrossCursor").parent().addClass("selected")):"off"===t&&((0,_jquery.default)("#chart_show_tools").removeClass("selected"),(0,_jquery.default)("#chart_enable_tools a").each(function(){"off"===(0,_jquery.default)(this).attr("name")&&(0,_jquery.default)(this).addClass("selected")}),(0,_jquery.default)("#chart_toolpanel")[0].style.display="none",_chart_manager.ChartManager.instance.setRunningMode(_chart_manager.ChartManager.instance._beforeDrawingTool),_chart_manager.ChartManager.instance.redraw("All",!0)),_kline.default.instance.isSized?Control.onSize():Control.onSize(_kline.default.instance.width,_kline.default.instance.height)}},{key:"switchIndic",value:function(t){if((0,_jquery.default)("#chart_enable_indicator a").removeClass("selected"),(0,_jquery.default)("#chart_enable_indicator a[name='"+t+"']").addClass("selected"),"on"===t){(0,_jquery.default)("#chart_show_indicator").addClass("selected");var e=_chart_settings.ChartSettings.get();e.charts.indicsStatus="open",_chart_settings.ChartSettings.save();var n=e.charts.indics[1];_templates.Template.displayVolume,_chart_manager.ChartManager.instance.getChart().setIndicator(2,n),(0,_jquery.default)("#chart_tabbar").find("a").each(function(){(0,_jquery.default)(this).attr("name")===n&&(0,_jquery.default)(this).addClass("selected")}),(0,_jquery.default)("#chart_tabbar")[0].style.display="block"}else if("off"===t){(0,_jquery.default)("#chart_show_indicator").removeClass("selected"),_chart_manager.ChartManager.instance.getChart().setIndicator(2,"NONE"),_chart_settings.ChartSettings.get().charts.indicsStatus="close",_chart_settings.ChartSettings.save(),(0,_jquery.default)("#chart_tabbar")[0].style.display="none",(0,_jquery.default)("#chart_tabbar a").removeClass("selected")}_kline.default.instance.isSized?Control.onSize():Control.onSize(_kline.default.instance.width,_kline.default.instance.height)}},{key:"switchPeriod",value:function(t){if((0,_jquery.default)(".chart_container .chart_toolbar_tabgroup a").removeClass("selected"),(0,_jquery.default)("#chart_toolbar_periods_vert ul a").removeClass("selected"),(0,_jquery.default)(".chart_container .chart_toolbar_tabgroup a").each(function(){(0,_jquery.default)(this).parent().attr("name")===t&&(0,_jquery.default)(this).addClass("selected")}),(0,_jquery.default)("#chart_toolbar_periods_vert ul a").each(function(){(0,_jquery.default)(this).parent().attr("name")===t&&(0,_jquery.default)(this).addClass("selected")}),_chart_manager.ChartManager.instance.showCursor(),Control.calcPeriodWeight(t),"line"===t)return _chart_manager.ChartManager.instance.getChart().strIsLine=!0,_chart_manager.ChartManager.instance.setChartStyle("frame0.k0","Line"),_chart_manager.ChartManager.instance.getChart().setCurrentPeriod("line"),_chart_settings.ChartSettings.get().charts.period=t,void _chart_settings.ChartSettings.save();_chart_manager.ChartManager.instance.getChart().strIsLine=!1;var e=_kline.default.instance.tagMapPeriod[t];_chart_manager.ChartManager.instance.setChartStyle("frame0.k0",_chart_settings.ChartSettings.get().charts.chartStyle),_chart_manager.ChartManager.instance.getChart().setCurrentPeriod(e),_chart_settings.ChartSettings.get().charts.period=t,_chart_settings.ChartSettings.save()}},{key:"reset",value:function(t){_kline.default.instance.symbol=t,_kline.default.instance.showTrade&&_kline_trade.KlineTrade.instance.reset(t)}},{key:"switchSymbolSelected",value:function(t){Control.reset(t),(0,_jquery.default)(".market_chooser ul a").removeClass("selected"),(0,_jquery.default)(".market_chooser ul a[name='"+t+"']").addClass("selected"),_chart_manager.ChartManager.instance.getChart()._symbol=t,_chart_settings.ChartSettings.get().charts.symbol=t,_chart_settings.ChartSettings.save()}},{key:"switchSymbol",value:function(t){"stomp"===_kline.default.instance.type&&1===_kline.default.instance.stompClient.ws.readyState&&(_kline.default.instance.subscribed.unsubscribe(),_kline.default.instance.subscribed=_kline.default.instance.stompClient.subscribe(_kline.default.instance.subscribePath+"/"+t+"/"+_kline.default.instance.range,Control.subscribeCallback)),Control.switchSymbolSelected(t),"line"===_chart_settings.ChartSettings.get().charts.period?(_chart_manager.ChartManager.instance.getChart().strIsLine=!0,_chart_manager.ChartManager.instance.setChartStyle("frame0.k0","Line")):(_chart_manager.ChartManager.instance.getChart().strIsLine=!1,_chart_manager.ChartManager.instance.setChartStyle("frame0.k0",_chart_settings.ChartSettings.get().charts.chartStyle)),_chart_manager.ChartManager.instance.getChart().setSymbol(t)}},{key:"calcPeriodWeight",value:function(t){var e=t;"line"!==t&&(e=_kline.default.instance.periodMap[_kline.default.instance.tagMapPeriod[t]]);var n=_chart_settings.ChartSettings.get().charts.period_weight;for(var r in n)n[r]>n[e]&&(n[r]-=1);n[e]=8,_chart_settings.ChartSettings.save()}},{key:"subscribeCallback",value:function(t){Control.requestSuccessHandler(JSON.parse(t.body))}},{key:"socketConnect",value:function(){if(!_kline.default.instance.stompClient||!_kline.default.instance.socketConnected){if(_kline.default.instance.enableSockjs){var t=new SockJS(_kline.default.instance.url);_kline.default.instance.stompClient=Stomp.over(t)}else _kline.default.instance.stompClient=Stomp.client(_kline.default.instance.url);_kline.default.instance.socketConnected=!0}1!==_kline.default.instance.stompClient.ws.readyState?(_kline.default.instance.debug||(_kline.default.instance.stompClient.debug=null),_kline.default.instance.stompClient.connect({},function(){_kline.default.instance.stompClient.subscribe("/user"+_kline.default.instance.subscribePath,Control.subscribeCallback),_kline.default.instance.subscribed=_kline.default.instance.stompClient.subscribe(_kline.default.instance.subscribePath+"/"+_kline.default.instance.symbol+"/"+_kline.default.instance.range,Control.subscribeCallback),Control.requestData(!0)},function(){_kline.default.instance.stompClient.disconnect(),console.log("DEBUG: reconnect in 5 seconds ..."),setTimeout(function(){Control.socketConnect()},5e3)})):console.log("DEBUG: already connected")}}]),Control}();exports.Control=Control,Control.refreshCounter=0,Control.refreshHandler=null},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CPoint=void 0;var r=n(0),i=n(1),o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}(n(2)),a=n(5);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var d=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=c(this,l(e).call(this,t))).pos={index:-1,value:-1},n.state=e.state.Hide,n}var n,s,d;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}(e,i.NamedObject),n=e,(s=[{key:"getChartObjects",value:function(){var t=r.ChartManager.instance,e=t.getDataSource("frame0.k0");if(null===e||!a.Util.isInstance(e,o.MainDataSource))return null;var n=t.getTimeline("frame0.k0");if(null===n)return null;var i=t.getRange("frame0.k0.main");return null===i?null:{pMgr:t,pCDS:e,pTimeline:n,pRange:i}}},{key:"setPosXY",value:function(t,e){var n=this.getChartObjects(),r=n.pTimeline.toIndex(t),i=n.pRange.toValue(e),o=this.snapValue(r,i);null!==o&&(i=o),this.setPosIV(r,i)}},{key:"setPosXYNoSnap",value:function(t,e){var n=this.getChartObjects(),r=n.pTimeline.toIndex(t),i=n.pRange.toValue(e);this.setPosIV(r,i)}},{key:"setPosIV",value:function(t,e){this.pos={index:t,value:e}}},{key:"getPosXY",value:function(){var t=this.getChartObjects();return{x:t.pTimeline.toItemCenter(this.pos.index),y:t.pRange.toY(this.pos.value)}}},{key:"getPosIV",value:function(){return{i:this.pos.index,v:this.pos.value}}},{key:"setState",value:function(t){this.state=t}},{key:"getState",value:function(){return this.state}},{key:"isSelected",value:function(t,n){var r=this.getPosXY();return!(t<r.x-4||t>r.x+4||n<r.y-4||n>r.y+4)&&(this.setState(e.state.Highlight),!0)}},{key:"snapValue",value:function(t,e){var n=this.getChartObjects(),r=null,i=Math.floor(n.pTimeline.getFirstIndex()),o=Math.floor(n.pTimeline.getLastIndex());if(t<i||t>o)return r;var a=n.pRange.toY(e),s=n.pCDS.getDataAt(t);if(null===s||void 0===s)return r;var u=null;u=t>0?n.pCDS.getDataAt(t-1):n.pCDS.getDataAt(t);var c=n.pMgr.getChartStyle(n.pCDS.getFrameName()),l=n.pRange.toY(s.open),h=n.pRange.toY(s.high),d=n.pRange.toY(s.low),p=n.pRange.toY(s.close);"CandleStickHLC"===c&&(l=n.pRange.toY(u.close));var f=Math.abs(l-a),g=Math.abs(h-a),_=Math.abs(d-a),v=Math.abs(p-a);return f<=g&&f<=_&&f<=v&&f<6&&(r=s.open),g<=f&&g<=_&&g<=v&&g<6&&(r=s.high),_<=f&&_<=g&&_<=v&&_<6&&(r=s.low),v<=f&&v<=g&&v<=_&&v<6&&(r=s.close),r}}])&&u(n.prototype,s),d&&u(n,d),e}();e.CPoint=d,d.state={Hide:0,Show:1,Highlight:2}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CArrowLineObject=e.CPriceLineObject=e.CVertiStraightLineObject=e.CTriParallelLineObject=e.CStraightLineObject=e.CSegLineObject=e.CRayLineObject=e.CHoriStraightLineObject=e.CHoriSegLineObject=e.CHoriRayLineObject=e.CFibRetraceObject=e.CFibFansObject=e.CBiParallelRayLineObject=e.CBiParallelLineObject=e.CBandLineObject=e.CTriToolObject=e.CBiToolObject=e.CToolObject=void 0;var r=n(0),i=n(1),o=n(11),a=n(5),s=c(n(2)),u=c(n(13));function c(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,e,n){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=v(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e,n){return e&&p(t.prototype,e),n&&p(t,n),t}function g(t,e){return!e||"object"!==l(e)&&"function"!=typeof e?_(t):e}function _(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function m(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var b=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=null,n.state=e.state.BeforeDraw,n.points=[],n.step=0,n}return m(e,i.NamedObject),f(e,[{key:"getChartObjects",value:function(){var t=r.ChartManager.instance,e=t.getDataSource("frame0.k0");if(null===e||!a.Util.isInstance(e,s.MainDataSource))return null;var n=t.getTimeline("frame0.k0");if(null===n)return null;var i=t.getArea("frame0.k0.main");if(null===i)return null;var o=t.getRange("frame0.k0.main");return null===o?null:{pMgr:t,pCDS:e,pTimeline:n,pArea:i,pRange:o}}},{key:"isValidMouseXY",value:function(t,e){var n=this.getChartObjects(),r=n.pArea.getLeft(),i=n.pArea.getTop(),o=n.pArea.getRight(),a=n.pArea.getBottom();return!(t<r||t>o||e<i||e>a)}},{key:"getPlotter",value:function(){return this.drawer}},{key:"setState",value:function(t){this.state=t}},{key:"getState",value:function(){return this.state}},{key:"addPoint",value:function(t){this.points.push(t)}},{key:"getPoint",value:function(t){return this.points[t]}},{key:"acceptMouseMoveEvent",value:function(t,n){return!1!==this.isValidMouseXY(t,n)&&(this.state===e.state.BeforeDraw?this.setBeforeDrawPos(t,n):this.state===e.state.Draw?this.setDrawPos(t,n):this.state===e.state.AfterDraw&&this.setAfterDrawPos(t,n),!0)}},{key:"acceptMouseDownEvent",value:function(t,n){return!1!==this.isValidMouseXY(t,n)&&(this.state===e.state.BeforeDraw?(this.setDrawPos(t,n),this.setState(e.state.Draw)):this.state===e.state.Draw?(this.setAfterDrawPos(t,n),0===this.step&&this.setState(e.state.AfterDraw)):this.state===e.state.AfterDraw&&(e.prototype.isSelected(t,n)?(this.setDrawPos(t,n),this.setState(e.state.Draw)):(this.oldx=t,this.oldy=n)),!0)}},{key:"acceptMouseDownMoveEvent",value:function(t,n){if(!1===this.isValidMouseXY(t,n))return!1;if(this.state===e.state.Draw)this.setDrawPos(t,n);else if(this.state===e.state.AfterDraw){var r=this.getChartObjects(),i=r.pTimeline.getItemWidth();r.pRange;if(Math.abs(t-this.oldx)<i&&0===Math.abs(n-this.oldy))return!0;var o=r.pTimeline.toIndex(this.oldx),a=r.pRange.toValue(this.oldy),s=r.pTimeline.toIndex(t),u=r.pRange.toValue(n);this.oldx=t,this.oldy=n;var c=s-o,l=u-a;for(var h in this.points)this.points[h].pos.index+=c,this.points[h].pos.value+=l}return!0}},{key:"acceptMouseUpEvent",value:function(t,n){return!1!==this.isValidMouseXY(t,n)&&(this.state===e.state.Draw&&(this.setAfterDrawPos(t,n),0===this.step&&this.setState(e.state.AfterDraw),!0))}},{key:"setBeforeDrawPos",value:function(t,e){for(var n in this.points)this.points[n].setPosXY(t,e),this.points[n].setState(o.CPoint.state.Show)}},{key:"setDrawPos",value:function(t,e){for(var n in this.points)this.points[n].getState()===o.CPoint.state.Highlight&&this.points[n].setPosXY(t,e)}},{key:"setAfterDrawPos",value:function(t,e){for(var n in 0!==this.step&&(this.step-=1),this.points)this.points[n].setState(o.CPoint.state.Hide);0===this.step&&this.getChartObjects().pMgr.setNormalMode()}},{key:"isSelected",value:function(t,e){var n=!1;for(var r in this.points)if(this.points[r].isSelected(t,e)){this.points[r].setState(o.CPoint.state.Highlight),n=!0;break}return!0===n&&(this.select(),!0)}},{key:"select",value:function(){for(var t in this.points)this.points[t].getState()===o.CPoint.state.Hide&&this.points[t].setState(o.CPoint.state.Show)}},{key:"unselect",value:function(){for(var t in this.points)this.points[t].getState()!==o.CPoint.state.Hide&&this.points[t].setState(o.CPoint.state.Hide)}},{key:"calcDistance",value:function(t,e,n){var r=t.getPosXY().x,i=t.getPosXY().y,o=e.getPosXY().x,a=e.getPosXY().y,s=n.getPosXY().x,u=n.getPosXY().y,c=r-s,l=i-u,h=o-s,d=a-u;return Math.abs(c*d-l*h)/Math.sqrt(Math.pow(o-r,2)+Math.pow(a-i,2))}},{key:"calcGap",value:function(t,e,n){var r=t.sx,i=t.sy,o=t.ex,a=t.ey,s=r-e,u=i-n,c=o-e,l=a-n;return Math.abs(s*l-u*c)/Math.sqrt(Math.pow(o-r,2)+Math.pow(a-i,2))}},{key:"isWithRect",value:function(t,e,n){var r=t.getPosXY().x,i=t.getPosXY().y,o=e.getPosXY().x,a=e.getPosXY().y,s=n.getPosXY().x,u=n.getPosXY().y;return r>o?(r+=4,o-=4):(r-=4,o+=4),i>a?(i+=4,a-=4):(i-=4,a+=4),r<=s&&o>=s&&i<=u&&a>=u||(r>=s&&o<=s&&i<=u&&a>=u||(r<=s&&o>=s&&i>=u&&a<=u||r>=s&&o<=s&&i>=u&&a<=u))}}]),e}();e.CToolObject=b,b.state={BeforeDraw:0,Draw:1,AfterDraw:2};var w=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).addPoint(new o.CPoint(t)),n.addPoint(new o.CPoint(t)),n}return m(e,b),f(e,[{key:"setBeforeDrawPos",value:function(t,n){this.step=1,h(v(e.prototype),"setBeforeDrawPos",this).call(this,t,n),this.getPoint(0).setState(o.CPoint.state.Show),this.getPoint(1).setState(o.CPoint.state.Highlight)}}]),e}();e.CBiToolObject=w;var C=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).addPoint(new o.CPoint(t)),n.addPoint(new o.CPoint(t)),n.addPoint(new o.CPoint(t)),n}return m(e,b),f(e,[{key:"setBeforeDrawPos",value:function(t,n){this.step=2,h(v(e.prototype),"setBeforeDrawPos",this).call(this,t,n),this.getPoint(0).setState(o.CPoint.state.Show),this.getPoint(1).setState(o.CPoint.state.Show),this.getPoint(2).setState(o.CPoint.state.Highlight)}},{key:"setAfterDrawPos",value:function(t,e){if(0!==this.step&&(this.step-=1),0===this.step)for(var n in this.points)this.points[n].setState(o.CPoint.state.Hide);else this.getPoint(0).setState(o.CPoint.state.Show),this.getPoint(1).setState(o.CPoint.state.Highlight),this.getPoint(2).setState(o.CPoint.state.Show);0===this.step&&this.getChartObjects().pMgr.setNormalMode()}}]),e}();e.CTriToolObject=C;var E=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawBandLinesPlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;new o.CPoint("frame0.k0").setPosXY(t,n);this.getPoint(0).getPosXY().x;for(var r=this.getPoint(0).getPosXY().y,i=(this.getPoint(1).getPosXY().x,this.getPoint(1).getPosXY().y),a=[100,87.5,75,62.5,50,37.5,25,12.5,0],s=0;s<a.length;s++){var u=r+(100-a[s])/100*(i-r);if(u<n+4&&u>n-4)return this.select(),!0}return!1}}]),e}();e.CBandLineObject=E;var x=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawBiParallelLinesPlotter(t,_(_(n))),n}return m(e,C),f(e,[{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;var r=this.getPoint(0).getPosXY().x,i=this.getPoint(0).getPosXY().y,o=this.getPoint(1).getPosXY().x,a=this.getPoint(1).getPosXY().y,s=this.getPoint(2).getPosXY().x,u=this.getPoint(2).getPosXY().y,c={sx:r,sy:i,ex:s,ey:u},l={sx:o,sy:a,ex:r-(r-o+(r-s)),ey:i-(i-a+(i-u))};return!(this.calcGap(c,t,n)>4&&this.calcGap(l,t,n)>4)}}]),e}();e.CBiParallelLineObject=x;var A=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawBiParallelRayLinesPlotter(t,_(_(n))),n}return m(e,C),f(e,[{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;var r=this.getPoint(0).getPosXY().x,i=this.getPoint(0).getPosXY().y,o=this.getPoint(1).getPosXY().x,a=this.getPoint(1).getPosXY().y,s=this.getPoint(2).getPosXY().x,u=this.getPoint(2).getPosXY().y,c={sx:r,sy:i,ex:s,ey:u},l={sx:o,sy:a,ex:r-(r-o+(r-s)),ey:i-(i-a+(i-u))};return(c.ex>c.sx&&t>c.sx-4||c.ex<c.sx&&t<c.sx+4||l.ex>l.sx&&t>l.sx-4||l.ex<l.sx&&t<l.sx+4)&&(!(this.calcGap(c,t,n)>4&&this.calcGap(l,t,n)>4)&&(this.select(),!0))}}]),e}();e.CBiParallelRayLineObject=A;var S=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawFibFansPlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;var r=new o.CPoint("frame0.k0");r.setPosXY(t,n);for(var i=this.getPoint(0).getPosXY().x,a=this.getPoint(0).getPosXY().y,s=this.getPoint(1).getPosXY().x,u=this.getPoint(1).getPosXY().y,c=this.getChartObjects(),l={left:c.pArea.getLeft(),top:c.pArea.getTop(),right:c.pArea.getRight(),bottom:c.pArea.getBottom()},d=[0,38.2,50,61.8],p=0;p<d.length;p++){var f={x:i,y:a},g={x:s,y:a+(100-d[p])/100*(u-a)},_=this.getRectCrossPt(l,f,g),m=Math.pow(_[0].x-i,2)+Math.pow(_[0].y-a,2)>Math.pow(_[0].x-s,2)+Math.pow(_[0].y-u,2)?{x:_[0].x,y:_[0].y}:{x:_[1].x,y:_[1].y};if(!(m.x>i&&t<i)&&!(m.x<i&&t>i)){var y=new o.CPoint("frame0.k0");y.setPosXY(i,a);var b=new o.CPoint("frame0.k0");if(b.setPosXY(m.x,m.y),!(this.calcDistance(y,b,r)>4))return this.select(),!0}}return!1}}]),e}();e.CFibFansObject=S;var k=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawFibRetracePlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;new o.CPoint("frame0.k0").setPosXY(t,n);this.getPoint(0).getPosXY().x;for(var r=this.getPoint(0).getPosXY().y,i=(this.getPoint(1).getPosXY().x,this.getPoint(1).getPosXY().y),a=[100,78.6,61.8,50,38.2,23.6,0],s=0;s<a.length;s++){var u=r+(100-a[s])/100*(i-r);if(u<n+4&&u>n-4)return this.select(),!0}return!1}}]),e}();e.CFibRetraceObject=k;var T=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawHoriRayLinesPlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"setDrawPos",value:function(t,e){if(this.points[0].getState()===o.CPoint.state.Highlight)return this.points[0].setPosXY(t,e),void this.points[1].setPosXYNoSnap(this.points[1].getPosXY().x,this.points[0].getPosXY().y);this.points[1].getState()===o.CPoint.state.Highlight&&(this.points[1].setPosXY(t,e),this.points[0].setPosXYNoSnap(this.points[0].getPosXY().x,this.points[1].getPosXY().y))}},{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;new o.CPoint("frame0.k0").setPosXY(t,n);var r=this.getPoint(0).getPosXY().y,i=this.getPoint(0).getPosXY().x,a=this.getPoint(1).getPosXY().x;return!(n>r+4||n<r-4)&&(!(a>i&&t<i-4)&&(!(a<i&&t>i+4)&&(this.select(),!0)))}}]),e}();e.CHoriRayLineObject=T;var P=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawHoriSegLinesPlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"setDrawPos",value:function(t,e){if(this.points[0].getState()===o.CPoint.state.Highlight)return this.points[0].setPosXY(t,e),void this.points[1].setPosXYNoSnap(this.points[1].getPosXY().x,this.points[0].getPosXY().y);this.points[1].getState()===o.CPoint.state.Highlight&&(this.points[1].setPosXY(t,e),this.points[0].setPosXYNoSnap(this.points[0].getPosXY().x,this.points[1].getPosXY().y))}},{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;new o.CPoint("frame0.k0").setPosXY(t,n);var r=this.getPoint(0).getPosXY().y,i=this.getPoint(0).getPosXY().x,a=this.getPoint(1).getPosXY().x;return!(n>r+4||n<r-4)&&(!(i>a&&(t>i+4||t<a-4))&&(!(i<a&&(t<i-4||t>a+4))&&(this.select(),!0)))}}]),e}();e.CHoriSegLineObject=P;var I=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawHoriStraightLinesPlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"setDrawPos",value:function(t,e){for(var n in this.points)this.points[n].setPosXY(t,e)}},{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;new o.CPoint("frame0.k0").setPosXY(t,n);var r=this.getPoint(0).getPosXY().y;return!(n>r+4||n<r-4)&&(this.select(),!0)}}]),e}();e.CHoriStraightLineObject=I;var O=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawRayLinesPlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;var r=new o.CPoint("frame0.k0");r.setPosXY(t,n);var i=this.getPoint(0).getPosXY().x,a=this.getPoint(1).getPosXY().x;return!(a>i&&t<i-4)&&(!(a<i&&t>i+4)&&(this.calcDistance(this.getPoint(0),this.getPoint(1),r)<4&&(this.select(),!0)))}}]),e}();e.CRayLineObject=O;var N=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawSegLinesPlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;var r=new o.CPoint("frame0.k0");return r.setPosXY(t,n),!1!==this.isWithRect(this.getPoint(0),this.getPoint(1),r)&&(this.calcDistance(this.getPoint(0),this.getPoint(1),r)<4&&(this.select(),!0))}}]),e}();e.CSegLineObject=N;var R=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawStraightLinesPlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;var r=new o.CPoint("frame0.k0");return r.setPosXY(t,n),this.calcDistance(this.getPoint(0),this.getPoint(1),r)<4&&(this.select(),!0)}}]),e}();e.CStraightLineObject=R;var D=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawTriParallelLinesPlotter(t,_(_(n))),n}return m(e,C),f(e,[{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;this.getChartObjects();var r=this.getPoint(0).getPosXY().x,i=this.getPoint(0).getPosXY().y,o=this.getPoint(1).getPosXY().x,a=this.getPoint(1).getPosXY().y,s=this.getPoint(2).getPosXY().x,u=this.getPoint(2).getPosXY().y,c=r-(r-o+(r-s)),l=i-(i-a+(i-u)),d={sx:r,sy:i,ex:s,ey:u},p={sx:o,sy:a,ex:c,ey:l},f=o-r,g=a-i,_=c-s,m=l-u,y={sx:Math.abs(f-r),sy:Math.abs(g-i),ex:Math.abs(_-s),ey:Math.abs(m-u)};return!(this.calcGap(d,t,n)>4&&this.calcGap(p,t,n)>4&&this.calcGap(y,t,n)>4)&&(this.select(),!0)}}]),e}();e.CTriParallelLineObject=D;var M=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawVertiStraightLinesPlotter(t,_(_(n))),n}return m(e,w),f(e,[{key:"setDrawPos",value:function(t,e){for(var n in this.points)this.points[n].setPosXY(t,e)}},{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;new o.CPoint("frame0.k0").setPosXY(t,n);var r=this.getPoint(0).getPosXY().x;return!(t>r+4||t<r-4)&&(this.select(),!0)}}]),e}();e.CVertiStraightLineObject=M;var L=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawPriceLinesPlotter(t,_(_(n))),n}return m(e,N),f(e,[{key:"setDrawPos",value:function(t,e){for(var n in this.points)this.points[n].setPosXY(t,e)}},{key:"isSelected",value:function(t,n){if(!0===h(v(e.prototype),"isSelected",this).call(this,t,n))return!0;new o.CPoint("frame0.k0").setPosXY(t,n);var r=this.getPoint(0).getPosXY().x,i=this.getPoint(0).getPosXY().y;this.getPoint(1).getPosXY().x,this.getPoint(1).getPosXY().y;return!(t<r-4)&&(!(n>=i+4||n<=i-4)&&(this.select(),!0))}}]),e}();e.CPriceLineObject=L;var j=function(t){function e(t){var n;return d(this,e),(n=g(this,v(e).call(this,t))).drawer=new u.DrawArrowLinesPlotter(t,_(_(n))),n}return m(e,N),e}();e.CArrowLineObject=j},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CDynamicLinePlotter=e.DrawFibFansPlotter=e.DrawBandLinesPlotter=e.DrawFibRetracePlotter=e.BandLinesPlotter=e.DrawTriParallelLinesPlotter=e.DrawBiParallelRayLinesPlotter=e.DrawBiParallelLinesPlotter=e.ParallelLinesPlotter=e.DrawPriceLinesPlotter=e.DrawVertiStraightLinesPlotter=e.DrawHoriSegLinesPlotter=e.DrawHoriRayLinesPlotter=e.DrawHoriStraightLinesPlotter=e.DrawArrowLinesPlotter=e.DrawRayLinesPlotter=e.DrawSegLinesPlotter=e.DrawStraightLinesPlotter=e.CToolPlotter=e.RangeSelectionPlotter=e.TimelineSelectionPlotter=e.SelectionPlotter=e.LastClosePlotter=e.LastVolumePlotter=e.COrderGraphPlotter=e.RangePlotter=e.TimelinePlotter=e.MinMaxPlotter=e.IndicatorInfoPlotter=e.IndicatorPlotter=e.MainInfoPlotter=e.OHLCPlotter=e.CandlestickHLCPlotter=e.CandlestickPlotter=e.CGridPlotter=e.TimelineAreaBackgroundPlotter=e.RangeAreaBackgroundPlotter=e.MainAreaBackgroundPlotter=e.BackgroundPlotter=e.Plotter=void 0;var r,i=(r=n(3))&&r.__esModule?r:{default:r},o=n(1),a=n(0),s=n(5),u=n(11),c=f(n(20)),l=f(n(6)),h=f(n(14)),d=f(n(2)),p=f(n(12));function f(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}function g(t){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e,n){return e&&v(t.prototype,e),n&&v(t,n),t}function y(t,e){return!e||"object"!==g(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function b(t){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function w(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&C(t,e)}function C(t,e){return(C=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var E=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,o.NamedObject),m(e,null,[{key:"drawLine",value:function(t,e,n,r,i){t.beginPath(),t.moveTo(.5+(e<<0),.5+(n<<0)),t.lineTo(.5+(r<<0),.5+(i<<0)),t.stroke()}},{key:"drawLines",value:function(t,n){var r,i=n.length;for(t.beginPath(),t.moveTo(n[0].x,n[0].y),r=1;r<i;r++)t.lineTo(n[r].x,n[r].y);if(e.isChrome)for(t.moveTo(n[0].x,n[0].y),r=1;r<i;r++)t.lineTo(n[r].x,n[r].y);t.stroke()}},{key:"drawDashedLine",value:function(t,e,n,r,i,o,a){o<2&&(o=2);var s=r-e,u=i-n;if(t.beginPath(),0===u){for(var c=s/o+.5<<0,l=0;l<c;l++)t.rect(e,n,a,1),e+=o;t.fill()}else{for(var h=Math.sqrt(s*s+u*u)/o+.5<<0,d=(s/=h)*a/o,p=(u/=h)*a/o,f=0;f<h;f++)t.moveTo(e+.5,n+.5),t.lineTo(e+.5+d,n+.5+p),e+=s,n+=u;t.stroke()}}},{key:"createHorzDashedLine",value:function(t,e,n,r,i,o){i<2&&(i=2);for(var a=(n-e)/i+.5<<0,s=0;s<a;s++)t.rect(e,r,o,1),e+=i}},{key:"createRectangles",value:function(t,e){t.beginPath();var n,r,i=e.length;for(r=0;r<i;r++)n=e[r],t.rect(n.x,n.y,n.w,n.h)}},{key:"createPolygon",value:function(t,e){t.beginPath(),t.moveTo(e[0].x+.5,e[0].y+.5);var n,r=e.length;for(n=1;n<r;n++)t.lineTo(e[n].x+.5,e[n].y+.5);t.closePath()}},{key:"drawString",value:function(t,e,n){var r=t.measureText(e).width;return!(n.w<r)&&(t.fillText(e,n.x,n.y),n.x+=r,n.w-=r,!0)}}]),e}();e.Plotter=E,E.isChrome=null!==navigator.userAgent.toLowerCase().match(/chrome/);var x=function(t){function e(t){var n;return _(this,e),(n=y(this,b(e).call(this,t)))._color=l.Theme.Color.Background,n}return w(e,E),m(e,[{key:"getColor",value:function(){return this._color}},{key:"setColor",value:function(t){this._color=t}},{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getArea(this.getAreaName()),r=e.getTheme(this.getFrameName());t.fillStyle=r.getColor(this._color),t.fillRect(n.getLeft(),n.getTop(),n.getWidth(),n.getHeight())}}]),e}();e.BackgroundPlotter=x;var A=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,x),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getArea(this.getAreaName()),r=e.getTimeline(this.getDataSourceName()),i=e.getRange(this.getAreaName()),o=e.getTheme(this.getFrameName()),s=n.getRect();if(!n.isChanged()&&!r.isUpdated()&&!i.isUpdated()){var u=r.getFirstIndex(),c=r.getLastIndex()-2,l=Math.max(u,c);s.X=r.toColumnLeft(l),s.Width=n.getRight()-s.X}t.fillStyle=o.getColor(this._color),t.fillRect(s.X,s.Y,s.Width,s.Height)}}]),e}();e.MainAreaBackgroundPlotter=A;var S=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,x),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=this.getAreaName(),r=e.getArea(n),i=e.getRange(n.substring(0,n.lastIndexOf("Range")));if("main"===i.getNameObject().getCompAt(2)||r.isChanged()||i.isUpdated()){var o=e.getTheme(this.getFrameName());t.fillStyle=o.getColor(this._color),t.fillRect(r.getLeft(),r.getTop(),r.getWidth(),r.getHeight())}}}]),e}();e.RangeAreaBackgroundPlotter=S;var k=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,x),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getArea(this.getAreaName()),r=e.getTimeline(this.getDataSourceName());if(n.isChanged()||r.isUpdated()){var i=e.getTheme(this.getFrameName());t.fillStyle=i.getColor(this._color),t.fillRect(n.getLeft(),n.getTop(),n.getWidth(),n.getHeight())}}}]),e}();e.TimelineAreaBackgroundPlotter=k;var T=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,o.NamedObject),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getArea(this.getAreaName()),r=e.getTimeline(this.getDataSourceName()),i=e.getRange(this.getAreaName()),o=!1;if(!n.isChanged()&&!r.isUpdated()&&!i.isUpdated()){var s=r.getFirstIndex(),u=r.getLastIndex(),c=Math.max(s,u-2),h=r.toColumnLeft(c);t.save(),t.rect(h,n.getTop(),n.getRight()-h,n.getHeight()),t.clip(),o=!0}var d=e.getTheme(this.getFrameName());t.fillStyle=d.getColor(l.Theme.Color.Grid0),t.beginPath();var p=4,f=1;E.isChrome&&(p=4,f=1);var g=i.getGradations();for(var _ in g)E.createHorzDashedLine(t,n.getLeft(),n.getRight(),i.toY(g[_]),p,f);t.fill(),o&&t.restore()}}]),e}();e.CGridPlotter=T;var P=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,o.NamedObject),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getDataSource(this.getDataSourceName());if(!(n.getDataCount()<1)){var r=e.getArea(this.getAreaName()),i=e.getTimeline(this.getDataSourceName()),o=e.getRange(this.getAreaName());if(0!==o.getRange()){var u,c=e.getTheme(this.getFrameName()),h=s.Util.isInstance(c,l.DarkTheme),d=i.getFirstIndex(),p=i.getLastIndex();u=r.isChanged()||i.isUpdated()||o.isUpdated()?d:Math.max(d,p-2);for(var f=i.getColumnWidth(),g=i.getItemWidth(),_=i.toItemLeft(u),v=i.toItemCenter(u),m=[],y=[],b=[],w=[],C=u;C<p;C++){var x=n.getDataAt(C),A=o.toY(x.high),S=o.toY(x.low),k=x.open,T=x.close;if(T>k){var P=o.toY(T),I=o.toY(k),O=Math.max(I-P,1);O>1&&g>1&&h?m.push({x:_+.5,y:P+.5,w:g-1,h:O-1}):y.push({x:_,y:P,w:Math.max(g,1),h:Math.max(O,1)}),x.high>T&&(A=Math.min(A,P-1),y.push({x:v,y:A,w:1,h:P-A})),k>x.low&&(S=Math.max(S,I+1),y.push({x:v,y:I,w:1,h:S-I}))}else if(T===k){var N=o.toY(T);b.push({x:_,y:N,w:Math.max(g,1),h:1}),x.high>T&&(A=Math.min(A,N-1)),k>x.low&&(S=Math.max(S,N+1)),A<S&&b.push({x:v,y:A,w:1,h:S-A})}else{var R=o.toY(k),D=o.toY(T),M=Math.max(D-R,1);w.push({x:_,y:R,w:Math.max(g,1),h:Math.max(M,1)}),x.high>k&&(A=Math.min(A,R-1)),T>x.low&&(S=Math.max(S,D+1)),A<S&&w.push({x:v,y:A,w:1,h:S-A})}_+=f,v+=f}m.length>0&&(t.strokeStyle=c.getColor(l.Theme.Color.Positive),E.createRectangles(t,m),t.stroke()),y.length>0&&(t.fillStyle=c.getColor(l.Theme.Color.Positive),E.createRectangles(t,y),t.fill()),b.length>0&&(t.fillStyle=c.getColor(l.Theme.Color.Negative),E.createRectangles(t,b),t.fill()),w.length>0&&(t.fillStyle=c.getColor(l.Theme.Color.Negative),E.createRectangles(t,w),t.fill())}}}}]),e}();e.CandlestickPlotter=P;var I=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,E),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getDataSource(this.getDataSourceName());if(s.Util.isInstance(n,d.MainDataSource)&&!(n.getDataCount()<1)){var r=e.getArea(this.getAreaName()),i=e.getTimeline(this.getDataSourceName()),o=e.getRange(this.getAreaName());if(0!==o.getRange()){var u,c=e.getTheme(this.getFrameName()),h=s.Util.isInstance(c,l.DarkTheme),p=i.getFirstIndex(),f=i.getLastIndex();u=r.isChanged()||i.isUpdated()||o.isUpdated()?p:Math.max(p,f-2);for(var g=i.getColumnWidth(),_=i.getItemWidth(),v=i.toItemLeft(u),m=i.toItemCenter(u),y=[],b=[],w=[],C=[],x=u;x<f;x++){var A=n.getDataAt(x),S=o.toY(A.high),k=o.toY(A.low),T=A.open;x>0&&(T=n.getDataAt(x-1).close);var P=A.close;if(P>T){var I=o.toY(P),O=o.toY(T),N=Math.max(O-I,1);N>1&&_>1&&h?y.push({x:v+.5,y:I+.5,w:_-1,h:N-1}):b.push({x:v,y:I,w:Math.max(_,1),h:Math.max(N,1)}),A.high>P&&(S=Math.min(S,I-1),b.push({x:m,y:S,w:1,h:I-S})),T>A.low&&(k=Math.max(k,O+1),b.push({x:m,y:O,w:1,h:k-O}))}else if(P===T){var R=o.toY(P);w.push({x:v,y:R,w:Math.max(_,1),h:1}),A.high>P&&(S=Math.min(S,R-1)),T>A.low&&(k=Math.max(k,R+1)),S<k&&w.push({x:m,y:S,w:1,h:k-S})}else{var D=o.toY(T),M=o.toY(P),L=Math.max(M-D,1);C.push({x:v,y:D,w:Math.max(_,1),h:Math.max(L,1)}),A.high>T&&(S=Math.min(S,D-1)),P>A.low&&(k=Math.max(k,M+1)),S<k&&C.push({x:m,y:S,w:1,h:k-S})}v+=g,m+=g}y.length>0&&(t.strokeStyle=c.getColor(l.Theme.Color.Positive),E.createRectangles(t,y),t.stroke()),b.length>0&&(t.fillStyle=c.getColor(l.Theme.Color.Positive),E.createRectangles(t,b),t.fill()),w.length>0&&(t.fillStyle=c.getColor(l.Theme.Color.Negative),E.createRectangles(t,w),t.fill()),C.length>0&&(t.fillStyle=c.getColor(l.Theme.Color.Negative),E.createRectangles(t,C),t.fill())}}}}]),e}();e.CandlestickHLCPlotter=I;var O=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,E),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getDataSource(this.getDataSourceName());if(s.Util.isInstance(n,d.MainDataSource)&&!(n.getDataCount()<1)){var r=e.getArea(this.getAreaName()),i=e.getTimeline(this.getDataSourceName()),o=e.getRange(this.getAreaName());if(0!==o.getRange()){var u,c=e.getTheme(this.getFrameName()),h=i.getFirstIndex(),p=i.getLastIndex();u=r.isChanged()||i.isUpdated()||o.isUpdated()?h:Math.max(h,p-2);for(var f=i.getColumnWidth(),g=i.getItemWidth()>>1,_=i.toItemLeft(u),v=i.toItemCenter(u),m=(i.getItemWidth(),[]),y=[],b=[],w=u;w<p;w++){var C=n.getDataAt(w),x=o.toY(C.high),A=o.toY(C.low),S=Math.max(A-x,1);if(C.close>C.open){var k=o.toY(C.close),T=o.toY(C.open);m.push({x:v,y:x,w:1,h:S}),m.push({x:_,y:k,w:g,h:1}),m.push({x:v,y:T,w:g,h:1})}else if(C.close===C.open){var P=o.toY(C.close);y.push({x:v,y:x,w:1,h:S}),y.push({x:_,y:P,w:g,h:1}),y.push({x:v,y:P,w:g,h:1})}else{var I=o.toY(C.open),O=o.toY(C.close);b.push({x:v,y:x,w:1,h:S}),b.push({x:_,y:I,w:g,h:1}),b.push({x:v,y:O,w:g,h:1})}_+=f,v+=f,f}m.length>0&&(t.fillStyle=c.getColor(l.Theme.Color.Positive),E.createRectangles(t,m),t.fill()),y.length>0&&(t.fillStyle=c.getColor(l.Theme.Color.Negative),E.createRectangles(t,y),t.fill()),b.length>0&&(t.fillStyle=c.getColor(l.Theme.Color.Negative),E.createRectangles(t,b),t.fill())}}}}]),e}();e.OHLCPlotter=O;var N=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,E),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getArea(this.getAreaName()),r=e.getTimeline(this.getDataSourceName()),i=e.getDataSource(this.getDataSourceName()),o=e.getTheme(this.getFrameName());t.font=o.getFont(l.Theme.Font.Default),t.textAlign="left",t.textBaseline="top",t.fillStyle=o.getColor(l.Theme.Color.Text4);var u={x:n.getLeft()+4,y:n.getTop()+2,w:n.getWidth()-8,h:20},c=r.getSelectedIndex();if(!(c<0)){var h,d=i.getDataAt(c),p=i.getDecimalDigits(),f=new Date(d.date),g=(f.getFullYear(),s.Util.formatTime(f.getMonth()+1),s.Util.formatTime(f.getDate()),s.Util.formatTime(f.getHours()),s.Util.formatTime(f.getMinutes()),e.getLanguage());if("zh-cn"===g){if(!E.drawString(t,"  开: "+d.open.toFixed(p),u))return;if(!E.drawString(t,"  高: "+d.high.toFixed(p),u))return;if(!E.drawString(t,"  低: "+d.low.toFixed(p),u))return;if(!E.drawString(t,"  收: "+d.close.toFixed(p),u))return}else if("en-us"===g){if(!E.drawString(t,"  O: "+d.open.toFixed(p),u))return;if(!E.drawString(t,"  H: "+d.high.toFixed(p),u))return;if(!E.drawString(t,"  L: "+d.low.toFixed(p),u))return;if(!E.drawString(t,"  C: "+d.close.toFixed(p),u))return}else if("zh-tw"===g){if(!E.drawString(t,"  開: "+d.open.toFixed(p),u))return;if(!E.drawString(t,"  高: "+d.high.toFixed(p),u))return;if(!E.drawString(t,"  低: "+d.low.toFixed(p),u))return;if(!E.drawString(t,"  收: "+d.close.toFixed(p),u))return}if(c>0){if("zh-cn"===g){if(!E.drawString(t,"  涨幅: ",u))return}else if("en-us"===g){if(!E.drawString(t,"  CHANGE: ",u))return}else if("zh-tw"===g&&!E.drawString(t,"  漲幅: ",u))return;var _,v=i.getDataAt(c-1);if((_=(d.close-v.close)/v.close*100?(d.close-v.close)/v.close*100:0)>=0?(_=" "+_.toFixed(2),t.fillStyle=o.getColor(l.Theme.Color.TextPositive)):(_=_.toFixed(2),t.fillStyle=o.getColor(l.Theme.Color.TextNegative)),!E.drawString(t,_,u))return;if(t.fillStyle=o.getColor(l.Theme.Color.Text4),!E.drawString(t," %",u))return}if(h=(d.high-d.low)/d.low*100?(d.high-d.low)/d.low*100:0,"zh-cn"===g){if(!E.drawString(t,"  振幅: "+h.toFixed(2)+" %",u))return}else if("en-us"===g){if(!E.drawString(t,"  AMPLITUDE: "+h.toFixed(2)+" %",u))return}else if("zh-tw"===g&&!E.drawString(t,"  振幅: "+h.toFixed(2)+" %",u))return;var m=e.getDataProvider(this.getAreaName()+".secondary");if(void 0!==m){var y,b=m.getIndicator(),w=b.getOutputCount();for(y=0;y<w;y++){var C=b.getOutputAt(y),x=C.execute(c);if(!isNaN(x)){var A="  "+C.getName()+": "+x.toFixed(p),S=C.getColor();if(void 0===S&&(S=l.Theme.Color.Indicator0+y),t.fillStyle=o.getColor(S),!E.drawString(t,A,u))return}}}}}}]),e}();e.MainInfoPlotter=N;var R=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,o.NamedObject),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getArea(this.getAreaName()),r=e.getTimeline(this.getDataSourceName()),i=e.getRange(this.getAreaName());if(0!==i.getRange()){var o=e.getDataProvider(this.getName());if(s.Util.isInstance(o,h.IndicatorDataProvider)){var u,d=e.getTheme(this.getFrameName()),p=r.getColumnWidth(),f=r.getFirstIndex(),g=r.getLastIndex();u=n.isChanged()||r.isUpdated()||i.isUpdated()?f:Math.max(f,g-2);var _,v,m=o.getIndicator(),y=m.getOutputCount();for(v=0;v<y;v++){var b=(_=m.getOutputAt(v)).getStyle();b===c.OutputExpr.outputStyle.VolumeStick?this.drawVolumeStick(t,d,e.getDataSource(this.getDataSourceName()),u,g,r.toItemLeft(u),p,r.getItemWidth(),i):b===c.OutputExpr.outputStyle.MACDStick?this.drawMACDStick(t,d,_,u,g,r.toItemLeft(u),p,r.getItemWidth(),i):b===c.OutputExpr.outputStyle.SARPoint&&this.drawSARPoint(t,d,_,u,g,r.toItemCenter(u),p,r.getItemWidth(),i)}var w=r.toColumnLeft(u),C=r.toItemCenter(u);for(t.save(),t.rect(w,n.getTop(),n.getRight()-w,n.getHeight()),t.clip(),t.translate(.5,.5),v=0;v<y;v++){var x=C;if((_=m.getOutputAt(v)).getStyle()===c.OutputExpr.outputStyle.Line){var A=void 0,S=[];u>f&&(A=_.execute(u-1),!1===isNaN(A)&&S.push({x:x-p,y:i.toY(A)}));for(var k=u;k<g;k++,x+=p)A=_.execute(k),!1===isNaN(A)&&S.push({x:x,y:i.toY(A)});if(S.length>0){var T=_.getColor();void 0===T&&(T=l.Theme.Color.Indicator0+v),t.strokeStyle=d.getColor(T),E.drawLines(t,S)}}}t.restore()}}}},{key:"drawVolumeStick",value:function(t,e,n,r,i,o,a,u,c){for(var h=s.Util.isInstance(e,l.DarkTheme),d=o,p=(c.toY(0),[]),f=[],g=[],_=r;_<i;_++){var v=n.getDataAt(_),m=c.toY(v.volume),y=c.toHeight(v.volume);v.close>v.open?y>1&&u>1&&h?p.push({x:d+.5,y:m+.5,w:u-1,h:y-1}):f.push({x:d,y:m,w:Math.max(u,1),h:Math.max(y,1)}):v.close===v.open&&_>0&&v.close>=n.getDataAt(_-1).close?y>1&&u>1&&h?p.push({x:d+.5,y:m+.5,w:u-1,h:y-1}):f.push({x:d,y:m,w:Math.max(u,1),h:Math.max(y,1)}):g.push({x:d,y:m,w:Math.max(u,1),h:Math.max(y,1)}),d+=a}p.length>0&&(t.strokeStyle=e.getColor(l.Theme.Color.Positive),E.createRectangles(t,p),t.stroke()),f.length>0&&(t.fillStyle=e.getColor(l.Theme.Color.Positive),E.createRectangles(t,f),t.fill()),g.length>0&&(t.fillStyle=e.getColor(l.Theme.Color.Negative),E.createRectangles(t,g),t.fill())}},{key:"drawMACDStick",value:function(t,e,n,r,i,o,a,s,u){for(var c=o,h=u.toY(0),d=[],p=[],f=[],g=[],_=r>0?n.execute(r-1):NaN,v=r;v<i;v++){var m=n.execute(v);if(m>=0){var y=u.toHeight(m);(0===v||m>=_)&&y>1&&s>1?d.push({x:c+.5,y:h-y+.5,w:s-1,h:y-1}):f.push({x:c,y:h-y,w:Math.max(s,1),h:Math.max(y,1)})}else{var b=u.toHeight(-m);(0===v||m>=_)&&b>1&&s>1?p.push({x:c+.5,y:h+.5,w:s-1,h:b-1}):g.push({x:c,y:h,w:Math.max(s,1),h:Math.max(b,1)})}_=m,c+=a}d.length>0&&(t.strokeStyle=e.getColor(l.Theme.Color.Positive),E.createRectangles(t,d),t.stroke()),p.length>0&&(t.strokeStyle=e.getColor(l.Theme.Color.Negative),E.createRectangles(t,p),t.stroke()),f.length>0&&(t.fillStyle=e.getColor(l.Theme.Color.Positive),E.createRectangles(t,f),t.fill()),g.length>0&&(t.fillStyle=e.getColor(l.Theme.Color.Negative),E.createRectangles(t,g),t.fill())}},{key:"drawSARPoint",value:function(t,e,n,r,i,o,a,s,u){var c=s>>1;c<.5&&(c=.5),c>4&&(c=4);var h=o,d=h+c,p=2*Math.PI;t.save(),t.translate(.5,.5),t.strokeStyle=e.getColor(l.Theme.Color.Indicator3),t.beginPath();for(var f=r;f<i;f++){var g=u.toY(n.execute(f));t.moveTo(d,g),t.arc(h,g,c,0,p),h+=a,d+=a}t.stroke(),t.restore()}}]),e}();e.IndicatorPlotter=R;var D=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,E),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getArea(this.getAreaName()),r=e.getTimeline(this.getDataSourceName()),i=e.getDataProvider(this.getAreaName()+".secondary"),o=e.getTheme(this.getFrameName());t.font=o.getFont(l.Theme.Font.Default),t.textAlign="left",t.textBaseline="top",t.fillStyle=o.getColor(l.Theme.Color.Text4);var s,u={x:n.getLeft()+4,y:n.getTop()+2,w:n.getWidth()-8,h:20},c=i.getIndicator();switch(c.getParameterCount()){case 0:s=c.getName();break;case 1:s=c.getName()+"("+c.getParameterAt(0).getValue()+")";break;case 2:s=c.getName()+"("+c.getParameterAt(0).getValue()+","+c.getParameterAt(1).getValue()+")";break;case 3:s=c.getName()+"("+c.getParameterAt(0).getValue()+","+c.getParameterAt(1).getValue()+","+c.getParameterAt(2).getValue()+")";break;case 4:s=c.getName()+"("+c.getParameterAt(0).getValue()+","+c.getParameterAt(1).getValue()+","+c.getParameterAt(2).getValue()+","+c.getParameterAt(3).getValue()+")";break;default:return}if(E.drawString(t,s,u)){var h=r.getSelectedIndex();if(!(h<0)){var d,p,f,g,_,v=c.getOutputCount();for(_=0;_<v;_++)if(p=(d=c.getOutputAt(_)).execute(h),!isNaN(p)&&(f="  "+d.getName()+": "+p.toFixed(2),void 0===(g=d.getColor())&&(g=l.Theme.Color.Indicator0+_),t.fillStyle=o.getColor(g),!E.drawString(t,f,u)))return}}}}]),e}();e.IndicatorInfoPlotter=D;var M=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,o.NamedObject),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=e.getDataSource(this.getDataSourceName());if(!(n.getDataCount()<1)){var r=e.getTimeline(this.getDataSourceName());if(!(r.getInnerWidth()<r.getColumnWidth())){var i=e.getRange(this.getAreaName());if(0!==i.getRange()){var o=e.getDataProvider(this.getAreaName()+".main"),s=r.getFirstIndex(),u=s+r.getLastIndex()>>1,c=e.getTheme(this.getFrameName());t.font=c.getFont(l.Theme.Font.Default),t.textBaseline="middle",t.fillStyle=c.getColor(l.Theme.Color.Text4),t.strokeStyle=c.getColor(l.Theme.Color.Text4);var h=n.getDecimalDigits();this.drawMark(t,o.getMinValue(),h,i.toY(o.getMinValue()),s,u,o.getMinValueIndex(),r),this.drawMark(t,o.getMaxValue(),h,i.toY(o.getMaxValue()),s,u,o.getMaxValueIndex(),r)}}}}},{key:"drawMark",value:function(t,e,n,r,i,o,a,u){var c,l,h,d;a>o?(t.textAlign="right",h=(c=u.toItemCenter(a)-4)-3,d=(l=c-7)-4):(t.textAlign="left",h=(c=u.toItemCenter(a)+4)+3,d=(l=c+7)+4),E.drawLine(t,c,r,l,r),E.drawLine(t,c,r,h,r+2),E.drawLine(t,c,r,h,r-2),t.fillText(s.Util.fromFloat(e,n),d,r)}}]),e}();e.MinMaxPlotter=M;var L=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,E),m(e,[{key:"Draw",value:function(t){var n=a.ChartManager.instance,r=n.getArea(this.getAreaName()),i=n.getTimeline(this.getDataSourceName());if(r.isChanged()||i.isUpdated()){var o=n.getDataSource(this.getDataSourceName());if(!(o.getDataCount()<2)){var s,u=o.getDataAt(1).date-o.getDataAt(0).date,c=e.TIME_INTERVAL.length;for(s=0;s<c&&!(u<e.TIME_INTERVAL[s]);s++);for(;s<c&&!(e.TIME_INTERVAL[s]%u==0&&e.TIME_INTERVAL[s]/u*i.getColumnWidth()>60);s++);var h=i.getFirstIndex(),d=i.getLastIndex(),p=60*(new Date).getTimezoneOffset()*1e3,f=n.getTheme(this.getFrameName());t.font=f.getFont(l.Theme.Font.Default),t.textAlign="center",t.textBaseline="middle";for(var g=n.getLanguage(),_=[],v=r.getTop(),m=r.getMiddle(),y=h;y<d;y++){var b=o.getDataAt(y).date,w=b-p,C=new Date(b),x=C.getFullYear(),A=C.getMonth()+1,S=C.getDate(),k=C.getHours(),T=C.getMinutes(),P="";if(s<c){if(w%Math.max(e.TP_DAY,e.TIME_INTERVAL[s])==0)"zh-cn"===g?P=A.toString()+"月"+S.toString()+"日":"zh-tw"===g?P=A.toString()+"月"+S.toString()+"日":"en-us"===g&&(P=e.MonthConvert[A]+" "+S.toString()),t.fillStyle=f.getColor(l.Theme.Color.Text4);else if(w%e.TIME_INTERVAL[s]==0){var I=T.toString();T<10&&(I="0"+I),P=k.toString()+":"+I,t.fillStyle=f.getColor(l.Theme.Color.Text2)}}else 1===S&&k<u/e.TP_HOUR&&(1===A?(P=x.toString(),"zh-cn"===g?P+="年":"zh-tw"===g&&(P+="年")):"zh-cn"===g?P=A.toString()+"月":"zh-tw"===g?P=A.toString()+"月":"en-us"===g&&(P=e.MonthConvert[A]),t.fillStyle=f.getColor(l.Theme.Color.Text4));if(P.length>0){var O=i.toItemCenter(y);_.push({x:O,y:v,w:1,h:4}),t.fillText(P,O,m)}}_.length>0&&(t.fillStyle=f.getColor(l.Theme.Color.Grid1),E.createRectangles(t,_),t.fill())}}}}]),e}();e.TimelinePlotter=L,L.TP_MINUTE=6e4,L.TP_HOUR=60*L.TP_MINUTE,L.TP_DAY=24*L.TP_HOUR,L.TIME_INTERVAL=[5*L.TP_MINUTE,10*L.TP_MINUTE,15*L.TP_MINUTE,30*L.TP_MINUTE,L.TP_HOUR,2*L.TP_HOUR,3*L.TP_HOUR,6*L.TP_HOUR,12*L.TP_HOUR,L.TP_DAY,2*L.TP_DAY],L.MonthConvert={1:"Jan.",2:"Feb.",3:"Mar.",4:"Apr.",5:"May.",6:"Jun.",7:"Jul.",8:"Aug.",9:"Sep.",10:"Oct.",11:"Nov.",12:"Dec."};var j=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,o.NamedObject),m(e,[{key:"getRequiredWidth",value:function(t,e){var n=a.ChartManager.instance.getTheme(this.getFrameName());return t.font=n.getFont(l.Theme.Font.Default),t.measureText((Math.floor(e)+.88).toString()).width+16}},{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=this.getAreaName(),r=e.getArea(n),i=n.substring(0,n.lastIndexOf("Range")),o=e.getRange(i);if(0!==o.getRange()){if("main"===o.getNameObject().getCompAt(2));else if(!r.isChanged()&&!o.isUpdated())return;var u=o.getGradations();if(0!==u.length){var c=r.getLeft(),h=r.getRight(),d=r.getCenter(),p=e.getTheme(this.getFrameName());t.font=p.getFont(l.Theme.Font.Default),t.textAlign="center",t.textBaseline="middle",t.fillStyle=p.getColor(l.Theme.Color.Text2);var f=[];for(var g in u){var _=o.toY(u[g]);f.push({x:c,y:_,w:6,h:1}),f.push({x:h-6,y:_,w:6,h:1}),t.fillText(s.Util.fromFloat(u[g],2),d,_)}f.length>0&&(t.fillStyle=p.getColor(l.Theme.Color.Grid1),E.createRectangles(t,f),t.fill())}}}}]),e}();e.RangePlotter=j;var U=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,o.NamedObject),m(e,[{key:"Draw",value:function(t){return this._Draw_(t)}},{key:"_Draw_",value:function(t){if(!1!==this.Update()&&!1!==this.updateData()){this.m_top=this.m_pArea.getTop(),this.m_bottom=this.m_pArea.getBottom(),this.m_left=this.m_pArea.getLeft(),this.m_right=this.m_pArea.getRight(),t.save(),t.rect(this.m_left,this.m_top,this.m_right-this.m_left,this.m_bottom-this.m_top),t.clip();var e=a.ChartManager.instance.getChart()._depthData;this.x_offset=0,this.y_offset=0;var n={},r={};n.x=this.m_left+e.array[this.m_ask_si].amounts*this.m_Step,n.y=this.m_pRange.toY(e.array[this.m_ask_si].rate),r.x=this.m_left+e.array[this.m_bid_si].amounts*this.m_Step,r.y=this.m_pRange.toY(e.array[this.m_bid_si].rate),Math.abs(n.y-r.y)<1&&(this.y_offset=1),this.x_offset=1,this.DrawBackground(t),this.UpdatePoints(),this.FillBlack(t),this.DrawGradations(t),this.DrawLine(t),t.restore()}}},{key:"DrawBackground",value:function(t){t.fillStyle=this.m_pTheme.getColor(l.Theme.Color.Background),t.fillRect(this.m_left,this.m_top,this.m_right-this.m_left,this.m_bottom-this.m_top);var e=a.ChartManager.instance.getChart()._depthData;if(0===this.m_mode){var n=this.m_pRange.toY(e.array[this.m_ask_si].rate)-this.y_offset,r=this.m_pRange.toY(e.array[this.m_bid_si].rate)+this.y_offset,i=t.createLinearGradient(this.m_left,0,this.m_right,0);i.addColorStop(0,this.m_pTheme.getColor(l.Theme.Color.Background)),i.addColorStop(1,this.m_pTheme.getColor(l.Theme.Color.PositiveDark)),t.fillStyle=i,t.fillRect(this.m_left,this.m_top,this.m_right-this.m_left,n-this.m_top);var o=t.createLinearGradient(this.m_left,0,this.m_right,0);o.addColorStop(0,this.m_pTheme.getColor(l.Theme.Color.Background)),o.addColorStop(1,this.m_pTheme.getColor(l.Theme.Color.NegativeDark)),t.fillStyle=o,t.fillRect(this.m_left,r,this.m_right-this.m_left,this.m_bottom-r)}else if(1===this.m_mode){var s=t.createLinearGradient(this.m_left,0,this.m_right,0);s.addColorStop(0,this.m_pTheme.getColor(l.Theme.Color.Background)),s.addColorStop(1,this.m_pTheme.getColor(l.Theme.Color.PositiveDark)),t.fillStyle=s,t.fillRect(this.m_left,this.m_top,this.m_right-this.m_left,this.m_bottom-this.m_top)}else if(2===this.m_mode){var u=t.createLinearGradient(this.m_left,0,this.m_right,0);u.addColorStop(0,this.m_pTheme.getColor(l.Theme.Color.Background)),u.addColorStop(1,this.m_pTheme.getColor(l.Theme.Color.NegativeDark)),t.fillStyle=u,t.fillRect(this.m_left,this.m_top,this.m_right-this.m_left,this.m_bottom-this.m_top)}}},{key:"DrawLine",value:function(t){if(0===this.m_mode||1===this.m_mode){t.strokeStyle=this.m_pTheme.getColor(l.Theme.Color.Positive),t.beginPath(),t.moveTo(Math.floor(this.m_ask_points[0].x)+.5,Math.floor(this.m_ask_points[0].y)+.5);for(var e=1;e<this.m_ask_points.length;e++)t.lineTo(Math.floor(this.m_ask_points[e].x)+.5,Math.floor(this.m_ask_points[e].y)+.5);t.stroke()}if(0===this.m_mode||2===this.m_mode){t.strokeStyle=this.m_pTheme.getColor(l.Theme.Color.Negative),t.beginPath(),t.moveTo(this.m_bid_points[0].x+.5,this.m_bid_points[0].y+.5);for(var n=1;n<this.m_bid_points.length;n++)t.lineTo(this.m_bid_points[n].x+.5,this.m_bid_points[n].y+.5);t.stroke()}}},{key:"UpdatePoints",value:function(){var t=a.ChartManager.instance.getChart()._depthData;this.m_ask_points=[];var e={};e.x=Math.floor(this.m_left),e.y=Math.floor(this.m_pRange.toY(t.array[this.m_ask_si].rate)-this.y_offset),this.m_ask_points.push(e);for(var n=0,r=this.m_ask_si;r>=this.m_ask_ei;r--){var i={},o={};r===this.m_ask_si?(i.x=Math.floor(this.m_left+t.array[r].amounts*this.m_Step+this.x_offset),i.y=Math.floor(this.m_pRange.toY(t.array[r].rate)-this.y_offset),this.m_ask_points.push(i),n=1):(i.x=Math.floor(this.m_left+t.array[r].amounts*this.m_Step+this.x_offset),i.y=Math.floor(this.m_ask_points[n].y),o.x=Math.floor(i.x),o.y=Math.floor(this.m_pRange.toY(t.array[r].rate)-this.y_offset),this.m_ask_points.push(i),n++,this.m_ask_points.push(o),n++)}this.m_bid_points=[];var s={};s.x=Math.floor(this.m_left),s.y=Math.ceil(this.m_pRange.toY(t.array[this.m_bid_si].rate)+this.y_offset),this.m_bid_points.push(s);for(var u=0,c=this.m_bid_si;c<=this.m_bid_ei;c++){var l={},h={};c===this.m_bid_si?(l.x=Math.floor(this.m_left+t.array[c].amounts*this.m_Step+this.x_offset),l.y=Math.ceil(this.m_pRange.toY(t.array[c].rate)+this.y_offset),this.m_bid_points.push(l),u=1):(l.x=Math.floor(this.m_left+t.array[c].amounts*this.m_Step+this.x_offset),l.y=Math.ceil(this.m_bid_points[u].y),h.x=Math.floor(l.x),h.y=Math.ceil(this.m_pRange.toY(t.array[c].rate)+this.x_offset),this.m_bid_points.push(l),u++,this.m_bid_points.push(h),u++)}}},{key:"updateData",value:function(){var t=a.ChartManager.instance.getChart()._depthData;if(null===t.array)return!1;if(t.array.length<=50)return!1;var e=this.m_pRange.getOuterMinValue(),n=this.m_pRange.getOuterMaxValue();this.m_ask_si=t.asks_si,this.m_ask_ei=t.asks_si;for(var r=t.asks_si;r>=t.asks_ei&&t.array[r].rate<n;r--)this.m_ask_ei=r;this.m_bid_si=t.bids_si,this.m_bid_ei=t.bids_si;for(var i=t.bids_si;i<=t.bids_ei&&t.array[i].rate>e;i++)this.m_bid_ei=i;return this.m_ask_ei===this.m_ask_si?this.m_mode=2:this.m_bid_ei===this.m_bid_si?this.m_mode=1:this.m_mode=0,this.m_Step=this.m_pArea.getWidth(),0===this.m_mode?this.m_ask_ei===t.asks_ei&&this.m_bid_ei===t.bids_ei?this.m_Step/=Math.min(t.array[this.m_ask_ei].amounts,t.array[this.m_bid_ei].amounts):this.m_ask_ei!==t.asks_ei&&this.m_bid_ei===t.bids_ei?this.m_Step/=t.array[this.m_bid_ei].amounts:this.m_ask_ei===t.asks_ei&&this.m_bid_ei!==t.bids_ei?this.m_Step/=t.array[this.m_ask_ei].amounts:this.m_ask_ei!==t.asks_ei&&this.m_bid_ei!==t.bids_ei&&(this.m_Step/=Math.max(t.array[this.m_ask_ei].amounts,t.array[this.m_bid_ei].amounts)):1===this.m_mode?this.m_Step/=t.array[this.m_ask_ei].amounts:2===this.m_mode&&(this.m_Step/=t.array[this.m_bid_ei].amounts),!0}},{key:"Update",value:function(){this.m_pMgr=a.ChartManager.instance;var t=this.getAreaName();if(this.m_pArea=this.m_pMgr.getArea(t),null===this.m_pArea)return!1;var e=t.substring(0,t.lastIndexOf("Range"));return this.m_pRange=this.m_pMgr.getRange(e),null!==this.m_pRange&&0!==this.m_pRange.getRange()&&(this.m_pTheme=this.m_pMgr.getTheme(this.getFrameName()),null!==this.m_pTheme)}},{key:"DrawGradations",value:function(t){var e=a.ChartManager.instance,n=this.getAreaName(),r=e.getArea(n),i=n.substring(0,n.lastIndexOf("Range")),o=e.getRange(i);if(0!==o.getRange()){var s=o.getGradations();if(0!==s.length){var u=r.getLeft(),c=r.getRight(),h=[];for(var d in s){var p=o.toY(s[d]);h.push({x:u,y:p,w:6,h:1}),h.push({x:c-6,y:p,w:6,h:1})}if(h.length>0){var f=e.getTheme(this.getFrameName());t.fillStyle=f.getColor(l.Theme.Color.Grid1),E.createRectangles(t,h),t.fill()}}}}},{key:"FillBlack",value:function(t){var e=this.m_ask_points,n=this.m_bid_points,r={},i={};r.x=this.m_right,r.y=e[0].y,i.x=this.m_right,i.y=e[e.length-1].y;var o={},a={};o.x=this.m_right,o.y=n[0].y-1,a.x=this.m_right,a.y=n[n.length-1].y,e.unshift(r),e.push(i),n.unshift(o),n.push(a),t.fillStyle=this.m_pTheme.getColor(l.Theme.Color.Background),t.beginPath(),t.moveTo(Math.floor(e[0].x)+.5,Math.floor(e[0].y)+.5);for(var s=1;s<e.length;s++)t.lineTo(Math.floor(e[s].x)+.5,Math.floor(e[s].y)+.5);t.fill(),t.beginPath(),t.moveTo(Math.floor(n[0].x)+.5,Math.floor(n[0].y)+.5);for(var u=1;u<n.length;u++)t.lineTo(Math.floor(n[u].x)+.5,Math.floor(n[u].y)+.5);t.fill(),e.shift(),e.pop(),n.shift(),n.pop()}},{key:"DrawTickerGraph",value:function(t){var e=a.ChartManager.instance.getDataSource(this.getDataSourceName()),n=e._dataItems[e._dataItems.length-1].close;this.m_left,this.m_pRange.toY(n);t.fillStyle=this.m_pTheme.getColor(l.Theme.Color.Mark),t.strokeStyle=this.m_pTheme.getColor(l.Theme.Color.Mark)}}]),e}();e.COrderGraphPlotter=U;var F=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,E),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=(e.getTimeline(this.getDataSourceName()),this.getAreaName()),r=e.getArea(n),i=n.substring(0,n.lastIndexOf("Range")),o=e.getRange(i);if(0!==o.getRange()){var u=e.getDataSource(this.getDataSourceName());if(!(u.getDataCount()<1)){var c=e.getTheme(this.getFrameName());t.font=c.getFont(l.Theme.Font.Default),t.textAlign="left",t.textBaseline="middle",t.fillStyle=c.getColor(l.Theme.Color.RangeMark),t.strokeStyle=c.getColor(l.Theme.Color.RangeMark);var h=u.getDataAt(u.getDataCount()-1).volume,d=o.toY(h),p=r.getLeft()+1;E.drawLine(t,p,d,p+7,d),E.drawLine(t,p,d,p+3,d+2),E.drawLine(t,p,d,p+3,d-2),t.fillText(s.Util.fromFloat(h,2),p+10,d)}}}}]),e}();e.LastVolumePlotter=F;var B=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,E),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=(e.getTimeline(this.getDataSourceName()),this.getAreaName()),r=e.getArea(n),i=n.substring(0,n.lastIndexOf("Range")),o=e.getRange(i);if(0!==o.getRange()){var u=e.getDataSource(this.getDataSourceName());if(!(u.getDataCount()<1)){var c=u._dataItems[u._dataItems.length-1].close;if(!(c<=o.getMinValue()||c>=o.getMaxValue())){var h=e.getTheme(this.getFrameName());t.font=h.getFont(l.Theme.Font.Default),t.textAlign="left",t.textBaseline="middle",t.fillStyle=h.getColor(l.Theme.Color.RangeMark),t.strokeStyle=h.getColor(l.Theme.Color.RangeMark);var d=o.toY(c),p=r.getLeft()+1;E.drawLine(t,p,d,p+7,d),E.drawLine(t,p,d,p+3,d+2),E.drawLine(t,p,d,p+3,d-2),t.fillText(s.Util.fromFloat(c,u.getDecimalDigits()),p+10,d)}}}}}]),e}();e.LastClosePlotter=B;var V=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,E),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance;if(e._drawingTool===a.ChartManager.DrawingTool.CrossCursor){var n=e.getArea(this.getAreaName()),r=e.getTimeline(this.getDataSourceName());if(!(r.getSelectedIndex()<0)){var i=e.getRange(this.getAreaName()),o=e.getTheme(this.getFrameName());t.strokeStyle=o.getColor(l.Theme.Color.Cursor);var s=r.toItemCenter(r.getSelectedIndex());E.drawLine(t,s,n.getTop()-1,s,n.getBottom());var u=i.getSelectedPosition();u>=0&&E.drawLine(t,n.getLeft(),u,n.getRight(),u)}}}}]),e}();e.SelectionPlotter=V;var W=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,E),m(e,[{key:"Draw",value:function(t){var n=a.ChartManager.instance,r=n.getArea(this.getAreaName()),o=n.getTimeline(this.getDataSourceName());if(!(o.getSelectedIndex()<0)){var u=n.getDataSource(this.getDataSourceName());if(s.Util.isInstance(u,d.MainDataSource)){var c=n.getTheme(this.getFrameName()),h=n.getLanguage(),p=o.toItemCenter(o.getSelectedIndex());t.fillStyle=c.getColor(l.Theme.Color.Background),t.fillRect(p-52.5,r.getTop()+2.5,106,18),t.strokeStyle=c.getColor(l.Theme.Color.Grid3),t.strokeRect(p-52.5,r.getTop()+2.5,106,18),t.font=c.getFont(l.Theme.Font.Default),t.textAlign="center",t.textBaseline="middle",t.fillStyle=c.getColor(l.Theme.Color.Text4);var f=new Date(u.getDataAt(o.getSelectedIndex()).date),g=f.getMonth()+1,_=f.getDate(),v=f.getHours(),m=f.getMinutes(),y=f.getSeconds(),b=g.toString(),w=_.toString(),C=v.toString(),E=m.toString(),x=y.toString();m<10&&(E="0"+E),y<10&&(x="0"+x);var A="";"zh-cn"===h?A=b+"月"+w+"日  "+C+":"+E:"zh-tw"===h?A=b+"月"+w+"日  "+C+":"+E:"en-us"===h&&(A=e.MonthConvert[g]+" "+w+"  "+C+":"+E),i.default.instance.range<6e4&&(A+=":"+x),t.fillText(A,p,r.getMiddle())}}}}]),e}();e.TimelineSelectionPlotter=W,W.MonthConvert={1:"Jan.",2:"Feb.",3:"Mar.",4:"Apr.",5:"May.",6:"Jun.",7:"Jul.",8:"Aug.",9:"Sep.",10:"Oct.",11:"Nov.",12:"Dec."};var G=function(t){function e(t){return _(this,e),y(this,b(e).call(this,t))}return w(e,o.NamedObject),m(e,[{key:"Draw",value:function(t){var e=a.ChartManager.instance,n=this.getAreaName(),r=e.getArea(n);if(!(e.getTimeline(this.getDataSourceName()).getSelectedIndex()<0)){var i=n.substring(0,n.lastIndexOf("Range")),o=e.getRange(i);if(!(0===o.getRange()||o.getSelectedPosition()<0)){var u=o.getSelectedValue();if(u!==-Number.MAX_VALUE){var c=o.getSelectedPosition();E.createPolygon(t,[{x:r.getLeft(),y:c},{x:r.getLeft()+5,y:c+10},{x:r.getRight()-3,y:c+10},{x:r.getRight()-3,y:c-10},{x:r.getLeft()+5,y:c-10}]);var h=e.getTheme(this.getFrameName());t.fillStyle=h.getColor(l.Theme.Color.Background),t.fill(),t.strokeStyle=h.getColor(l.Theme.Color.Grid4),t.stroke(),t.font=h.getFont(l.Theme.Font.Default),t.textAlign="center",t.textBaseline="middle",t.fillStyle=h.getColor(l.Theme.Color.Text3);var d=2;"main"===o.getNameObject().getCompAt(2)&&(d=e.getDataSource(this.getDataSourceName()).getDecimalDigits()),t.fillText(s.Util.fromFloat(u,d),r.getCenter(),c)}}}}}]),e}();e.RangeSelectionPlotter=G;var H=function(t){function e(t,n){var r;_(this,e),(r=y(this,b(e).call(this,t))).toolObject=n;var i=a.ChartManager.instance.getArea("frame0.k0.main");return null===i?(r.areaPos={left:0,top:0,right:0,bottom:0},y(r)):(r.areaPos={left:i.getLeft(),top:i.getTop(),right:i.getRight(),bottom:i.getBottom()},r.crossPt={},r.normalSize=4,r.selectedSize=6,r.cursorLen=4,r.cursorGapLen=3,r.theme=a.ChartManager.instance.getTheme(r.getFrameName()),r)}return w(e,o.NamedObject),m(e,[{key:"drawCursor",value:function(t){this.drawCrossCursor(t)}},{key:"drawCrossCursor",value:function(t){t.strokeStyle=this.theme.getColor(l.Theme.Color.LineColorNormal),t.fillStyle=this.theme.getColor(l.Theme.Color.LineColorNormal);var e=this.toolObject.getPoint(0).getPosXY();if(null!==e){var n=e.x,r=e.y,i=this.cursorLen,o=this.cursorGapLen;t.fillRect(n,r,1,1),E.drawLine(t,n-i-o,r,n-o,r),E.drawLine(t,n+i+o,r,n+o,r),E.drawLine(t,n,r-i-o,n,r-o),E.drawLine(t,n,r+i+o,n,r+o)}}},{key:"drawCircle",value:function(t,e,n){var r=e.x,i=e.y;t.beginPath(),t.arc(r,i,n,0,2*Math.PI,!1),t.fillStyle=this.theme.getColor(l.Theme.Color.CircleColorFill),t.fill(),t.stroke()}},{key:"drawCtrlPt",value:function(t){t.strokeStyle=this.theme.getColor(l.Theme.Color.CircleColorStroke);for(var e=0;e<this.ctrlPtsNum;e++)this.drawCircle(t,this.ctrlPts[1][e],this.normalSize)}},{key:"highlightCtrlPt",value:function(t){t.strokeStyle=this.theme.getColor(l.Theme.Color.CircleColorStroke);for(var e=0;e<this.ctrlPtsNum;e++)this.toolObject.getPoint(e).getState()===u.CPoint.state.Highlight&&this.drawCircle(t,this.ctrlPts[1][e],this.selectedSize)}},{key:"drawFibRayLines",value:function(t,e,n){for(var r=0;r<this.fiboFansSequence.length;r++){var i=e.y+(100-this.fiboFansSequence[r])/100*(n.y-e.y),o={x:e.x,y:e.y},a={x:n.x,y:i};this.drawRayLines(t,o,a)}}},{key:"drawRayLines",value:function(t,e,n){this.getAreaPos();var r,i={x:e.x,y:e.y},o={x:n.x,y:n.y},a=this.getRectCrossPt(this.areaPos,i,o);r=n.x===e.x?n.y===e.y?n:n.y>e.y?{x:a[1].x,y:a[1].y}:{x:a[0].x,y:a[0].y}:n.x>e.x?{x:a[1].x,y:a[1].y}:{x:a[0].x,y:a[0].y},E.drawLine(t,e.x,e.y,r.x,r.y)}},{key:"lenBetweenPts",value:function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}},{key:"getCtrlPts",value:function(){for(var t=0;t<this.ctrlPtsNum;t++)this.ctrlPts[0][t]=this.toolObject.getPoint(t)}},{key:"updateCtrlPtPos",value:function(){for(var t=0;t<this.ctrlPtsNum;t++)this.ctrlPts[1][t]=this.ctrlPts[0][t].getPosXY()}},{key:"getAreaPos",value:function(){var t=a.ChartManager.instance.getArea("frame0.k0.main");this.areaPos=null!==t?{left:Math.floor(t.getLeft()),top:Math.floor(t.getTop()),right:Math.floor(t.getRight()),bottom:Math.floor(t.getBottom())}:{left:0,top:0,right:0,bottom:0}}},{key:"updateDraw",value:function(t){t.strokeStyle=this.theme.getColor(l.Theme.Color.LineColorNormal),this.draw(t),this.drawCtrlPt(t)}},{key:"finishDraw",value:function(t){t.strokeStyle=this.theme.getColor(l.Theme.Color.LineColorNormal),this.draw(t)}},{key:"highlight",value:function(t){t.strokeStyle=this.theme.getColor(l.Theme.Color.LineColorSelected),this.draw(t),this.drawCtrlPt(t),this.highlightCtrlPt(t)}}]),e}();e.CToolPlotter=H;var Y=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t,n))).toolObject=n,r.ctrlPtsNum=2,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"draw",value:function(t){this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],this.endPoint=this.ctrlPts[1][1],this.startPoint.x===this.endPoint.x&&this.startPoint.y===this.endPoint.y?E.drawLine(t,this.areaPos.left,this.startPoint.y,this.areaPos.right,this.startPoint.y):(this.crossPt=this.getRectCrossPt(this.areaPos,this.startPoint,this.endPoint),E.drawLine(t,this.crossPt[0].x,this.crossPt[0].y,this.crossPt[1].x,this.crossPt[1].y))}}]),e}();e.DrawStraightLinesPlotter=Y;var z=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t,n))).toolObject=n,r.ctrlPtsNum=2,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"draw",value:function(t){this.updateCtrlPtPos(),this.startPoint=this.ctrlPts[1][0],this.endPoint=this.ctrlPts[1][1],this.startPoint.x===this.endPoint.x&&this.startPoint.y===this.endPoint.y&&(this.endPoint.x+=1),E.drawLine(t,this.startPoint.x,this.startPoint.y,this.endPoint.x,this.endPoint.y)}}]),e}();e.DrawSegLinesPlotter=z;var q=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t))).toolObject=n,r.ctrlPtsNum=2,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"draw",value:function(t){this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],this.endPoint=this.ctrlPts[1][1],this.startPoint.x===this.endPoint.x&&this.startPoint.y===this.endPoint.y&&(this.endPoint.x+=1),this.drawRayLines(t,this.startPoint,this.endPoint)}}]),e}();e.DrawRayLinesPlotter=q;var X=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t,n))).toolObject=n,r.arrowSizeRatio=.03,r.arrowSize=4,r.crossPt={x:-1,y:-1},r.ctrlPtsNum=2,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"drawArrow",value:function(t,e,n){var r=this.lenBetweenPts(e,n),i=[n.x-e.x,n.y-e.y];this.crossPt.x=e.x+(1-this.arrowSize/r)*i[0],this.crossPt.y=e.y+(1-this.arrowSize/r)*i[1];var o=[-i[1],i[0]],a={x:o[0],y:o[1]},s={x:0,y:0};o[0]=this.arrowSize*a.x/this.lenBetweenPts(a,s),o[1]=this.arrowSize*a.y/this.lenBetweenPts(a,s);var u=[this.crossPt.x+o[0],this.crossPt.y+o[1]];E.drawLine(t,n.x,n.y,u[0],u[1]),u=[this.crossPt.x-o[0],this.crossPt.y-o[1]],E.drawLine(t,n.x,n.y,u[0],u[1])}},{key:"draw",value:function(t){this.updateCtrlPtPos(),this.startPoint=this.ctrlPts[1][0],this.endPoint=this.ctrlPts[1][1],this.startPoint.x===this.endPoint.x&&this.startPoint.y===this.endPoint.y&&(this.endPoint.x+=1),E.drawLine(t,this.startPoint.x,this.startPoint.y,this.endPoint.x,this.endPoint.y),this.drawArrow(t,this.startPoint,this.endPoint)}}]),e}();e.DrawArrowLinesPlotter=X;var Q=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t))).toolObject=n,r.ctrlPtsNum=1,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"draw",value:function(t){this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],E.drawLine(t,this.areaPos.left,this.startPoint.y,this.areaPos.right,this.startPoint.y)}}]),e}();e.DrawHoriStraightLinesPlotter=Q;var K=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t))).toolObject=n,r.ctrlPtsNum=2,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"draw",value:function(t){if(this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],this.endPoint=this.ctrlPts[1][1],this.startPoint.x===this.endPoint.x)E.drawLine(t,this.startPoint.x,this.startPoint.y,this.areaPos.right,this.startPoint.y);else{var e={x:this.endPoint.x,y:this.startPoint.y};this.drawRayLines(t,this.startPoint,e)}}}]),e}();e.DrawHoriRayLinesPlotter=K;var Z=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t,n))).toolObject=n,r.ctrlPtsNum=2,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"draw",value:function(t){this.updateCtrlPtPos(),this.startPoint=this.ctrlPts[1][0],this.endPoint=this.ctrlPts[1][1],this.endPoint.y=this.startPoint.y,this.startPoint.x===this.endPoint.x&&this.startPoint.y===this.endPoint.y?E.drawLine(t,this.startPoint.x,this.startPoint.y,this.endPoint.x+1,this.startPoint.y):E.drawLine(t,this.startPoint.x,this.startPoint.y,this.endPoint.x,this.startPoint.y)}}]),e}();e.DrawHoriSegLinesPlotter=Z;var J=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t))).toolObject=n,r.ctrlPtsNum=1,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"draw",value:function(t){this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],E.drawLine(t,this.startPoint.x,this.areaPos.top,this.startPoint.x,this.areaPos.bottom)}}]),e}();e.DrawVertiStraightLinesPlotter=J;var $=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t))).toolObject=n,r.ctrlPtsNum=1,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"draw",value:function(t){t.font="12px Tahoma",t.textAlign="left",t.fillStyle=this.theme.getColor(l.Theme.Color.LineColorNormal),this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0];var e=this.ctrlPts[0][0].getPosIV().v;E.drawLine(t,this.startPoint.x,this.startPoint.y,this.areaPos.right,this.startPoint.y),t.fillText(e.toFixed(2),this.startPoint.x+2,this.startPoint.y-15)}}]),e}();e.DrawPriceLinesPlotter=$;var tt=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t))).toolObject=n,r}return w(e,H),m(e,[{key:"getParaPt",value:function(){var t=[];t[0]=this.endPoint.x-this.startPoint.x,t[1]=this.endPoint.y-this.startPoint.y;var e=[];e[0]=this.paraStartPoint.x-this.startPoint.x,e[1]=this.paraStartPoint.y-this.startPoint.y,this.paraEndPoint={x:-1,y:-1},this.paraEndPoint.x=t[0]+e[0]+this.startPoint.x,this.paraEndPoint.y=t[1]+e[1]+this.startPoint.y}}]),e}();e.ParallelLinesPlotter=tt;var et=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t,n))).toolObject=n,r.ctrlPtsNum=3,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,tt),m(e,[{key:"draw",value:function(t){this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],this.paraStartPoint=this.ctrlPts[1][1],this.endPoint=this.ctrlPts[1][2],this.getParaPt(),this.getAreaPos(),this.crossPt0=this.getRectCrossPt(this.areaPos,this.startPoint,this.endPoint),E.drawLine(t,this.crossPt0[0].x,this.crossPt0[0].y,this.crossPt0[1].x,this.crossPt0[1].y),this.crossPt1=this.getRectCrossPt(this.areaPos,this.paraStartPoint,this.paraEndPoint),E.drawLine(t,this.crossPt1[0].x,this.crossPt1[0].y,this.crossPt1[1].x,this.crossPt1[1].y)}}]),e}();e.DrawBiParallelLinesPlotter=et;var nt=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t,n))).toolObject=n,r.ctrlPtsNum=3,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,tt),m(e,[{key:"draw",value:function(t){this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],this.paraStartPoint=this.ctrlPts[1][1],this.endPoint=this.ctrlPts[1][2],this.startPoint.x===this.endPoint.x&&this.startPoint.y===this.endPoint.y&&(this.endPoint.x+=1),this.getParaPt(),this.drawRayLines(t,this.startPoint,this.endPoint),this.drawRayLines(t,this.paraStartPoint,this.paraEndPoint)}}]),e}();e.DrawBiParallelRayLinesPlotter=nt;var rt=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t,n))).toolObject=n,r.ctrlPtsNum=3,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,tt),m(e,[{key:"draw",value:function(t){this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],this.paraStartPoint=this.ctrlPts[1][1],this.endPoint=this.ctrlPts[1][2];var e=[];e[0]=this.endPoint.x-this.startPoint.x,e[1]=this.endPoint.y-this.startPoint.y;var n=[];n[0]=this.paraStartPoint.x-this.startPoint.x,n[1]=this.paraStartPoint.y-this.startPoint.y,this.para1EndPoint={x:-1,y:-1},this.para2EndPoint={x:-1,y:-1},this.para2StartPoint={x:-1,y:-1},this.para1EndPoint.x=e[0]+n[0]+this.startPoint.x,this.para1EndPoint.y=e[1]+n[1]+this.startPoint.y,this.para2StartPoint.x=this.startPoint.x-n[0],this.para2StartPoint.y=this.startPoint.y-n[1],this.para2EndPoint.x=this.endPoint.x-n[0],this.para2EndPoint.y=this.endPoint.y-n[1],this.getAreaPos(),this.crossPt0=this.getRectCrossPt(this.areaPos,this.startPoint,this.endPoint),E.drawLine(t,this.crossPt0[0].x,this.crossPt0[0].y,this.crossPt0[1].x,this.crossPt0[1].y),this.crossPt1=this.getRectCrossPt(this.areaPos,this.paraStartPoint,this.para1EndPoint),E.drawLine(t,this.crossPt1[0].x,this.crossPt1[0].y,this.crossPt1[1].x,this.crossPt1[1].y),this.crossPt2=this.getRectCrossPt(this.areaPos,this.para2StartPoint,this.para2EndPoint),E.drawLine(t,this.crossPt2[0].x,this.crossPt2[0].y,this.crossPt2[1].x,this.crossPt2[1].y)}}]),e}();e.DrawTriParallelLinesPlotter=rt;var it=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t))).toolObject=n,r.ctrlPtsNum=2,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"drawLinesAndInfo",value:function(t,e,n){var r;t.font="12px Tahoma",t.textAlign="left",t.fillStyle=this.theme.getColor(l.Theme.Color.LineColorNormal),this.toolObject.state===p.CToolObject.state.Draw&&(this.startPtValue=this.toolObject.getPoint(0).getPosIV().v,this.endPtValue=this.toolObject.getPoint(1).getPosIV().v),this.getAreaPos();for(var i=0;i<this.fiboSequence.length;i++){var o=e.y+(100-this.fiboSequence[i])/100*(n.y-e.y);if(!(o>this.areaPos.bottom)){var a=this.startPtValue+(100-this.fiboSequence[i])/100*(this.endPtValue-this.startPtValue);E.drawLine(t,this.areaPos.left,o,this.areaPos.right,o),r=this.fiboSequence[i].toFixed(1)+"% "+a.toFixed(1),t.fillText(r,this.areaPos.left+2,o-15)}}}},{key:"draw",value:function(t){this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],this.endPoint=this.ctrlPts[1][1],this.drawLinesAndInfo(t,this.startPoint,this.endPoint)}}]),e}();e.BandLinesPlotter=it;var ot=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t,n))).toolObject=n,r.fiboSequence=[100,78.6,61.8,50,38.2,23.6,0],r}return w(e,it),e}();e.DrawFibRetracePlotter=ot;var at=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t,n))).toolObject=n,r.fiboSequence=[0,12.5,25,37.5,50,62.5,75,87.5,100],r}return w(e,it),e}();e.DrawBandLinesPlotter=at;var st=function(t){function e(t,n){var r;return _(this,e),(r=y(this,b(e).call(this,t))).toolObject=n,r.fiboFansSequence=[0,38.2,50,61.8],r.ctrlPtsNum=2,r.ctrlPts=[new Array(r.ctrlPtsNum),new Array(2)],r.getCtrlPts(),r}return w(e,H),m(e,[{key:"drawLinesAndInfo",value:function(t,e,n){this.drawFibRayLines(t,e,n)}},{key:"draw",value:function(t){this.updateCtrlPtPos(),this.getAreaPos(),this.startPoint=this.ctrlPts[1][0],this.endPoint=this.ctrlPts[1][1],this.startPoint.x===this.endPoint.x&&this.startPoint.y===this.endPoint.y&&(this.endPoint.x+=1),this.drawLinesAndInfo(t,this.startPoint,this.endPoint)}}]),e}();e.DrawFibFansPlotter=st;var ut=function(t){function e(t){var n;return _(this,e),(n=y(this,b(e).call(this,t))).flag=!0,n.context=a.ChartManager.instance._overlayContext,n}return w(e,o.NamedObject),m(e,[{key:"getAreaPos",value:function(){var t=a.ChartManager.instance.getArea("frame0.k0.main");this.areaPos=null!==t?{left:Math.floor(t.getLeft()),top:Math.floor(t.getTop()),right:Math.floor(t.getRight()),bottom:Math.floor(t.getBottom())}:{left:0,top:0,right:0,bottom:0}}},{key:"Draw",value:function(t){this.getAreaPos();var e=a.ChartManager.instance.getDataSource(this.getDataSourceName());if(null!==e&&s.Util.isInstance(e,d.MainDataSource)){this.context.save(),this.context.rect(this.areaPos.left,this.areaPos.top,this.areaPos.right-this.areaPos.left,this.areaPos.bottom-this.areaPos.top),this.context.clip();for(var n=e.getToolObjectCount(),r=0;r<n;r++){var i=e.getToolObject(r);switch(i.getState()){case p.CToolObject.state.BeforeDraw:i.getPlotter().theme=a.ChartManager.instance.getTheme(this.getFrameName()),i.getPlotter().drawCursor(this.context);break;case p.CToolObject.state.Draw:i.getPlotter().theme=a.ChartManager.instance.getTheme(this.getFrameName()),i.getPlotter().updateDraw(this.context);break;case p.CToolObject.state.AfterDraw:i.getPlotter().theme=a.ChartManager.instance.getTheme(this.getFrameName()),i.getPlotter().finishDraw(this.context)}}var o=e.getSelectToolObjcet();null!==o&&o!==p.CToolObject.state.Draw&&o.getPlotter().highlight(this.context),this.context.restore()}}}]),e}();e.CDynamicLinePlotter=ut},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IndicatorDataProvider=e.MainDataProvider=e.DataProvider=void 0;var r=n(1),i=n(0),o=n(5),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}(n(2));function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),t}function h(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)}function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var g=function(t){function e(t){var n;return u(this,e),(n=h(this,d(e).call(this,t)))._minValue=0,n._maxValue=0,n._minValueIndex=-1,n._maxValueIndex=-1,n}return p(e,r.NamedObject),l(e,[{key:"getMinValue",value:function(){return this._minValue}},{key:"getMaxValue",value:function(){return this._maxValue}},{key:"getMinValueIndex",value:function(){return this._minValueIndex}},{key:"getMaxValueIndex",value:function(){return this._maxValueIndex}},{key:"getMinMaxAt",value:function(t,e){return!0}},{key:"calcRange",value:function(t,e,n,r){for(var i=Number.MAX_VALUE,o=-Number.MAX_VALUE,a=-1,s=-1,u={},c=e-1,l=t.length-1;l>=0;l--){var h=t[l];if(c<h)n[l]={min:i,max:o};else{for(;c>=h;c--)!1!==this.getMinMaxAt(c,u)&&(i>u.min&&(i=u.min,a=c),o<u.max&&(o=u.max,s=c));n[l]={min:i,max:o}}null!==r&&void 0!==r&&(r[l]={minIndex:a,maxIndex:s})}}},{key:"updateRange",value:function(){var t=i.ChartManager.instance.getTimeline(this.getDataSourceName()),e=[t.getFirstIndex()],n=[{}],r=[{}];this.calcRange(e,t.getLastIndex(),n,r),this._minValue=n[0].min,this._maxValue=n[0].max,this._minValueIndex=r[0].minIndex,this._maxValueIndex=r[0].maxIndex}}]),e}();e.DataProvider=g;var _=function(t){function e(t){var n;return u(this,e),(n=h(this,d(e).call(this,t)))._candlestickDS=null,n}return p(e,g),l(e,[{key:"updateData",value:function(){var t=i.ChartManager.instance.getDataSource(this.getDataSourceName());o.Util.isInstance(t,a.MainDataSource)&&(this._candlestickDS=t)}},{key:"getMinMaxAt",value:function(t,e){var n=this._candlestickDS.getDataAt(t);return e.min=n.low,e.max=n.high,!0}}]),e}();e.MainDataProvider=_;var v=function(t){function e(){return u(this,e),h(this,d(e).apply(this,arguments))}return p(e,g),l(e,[{key:"getIndicator",value:function(){return this._indicator}},{key:"setIndicator",value:function(t){this._indicator=t,this.refresh()}},{key:"refresh",value:function(){var t=i.ChartManager.instance.getDataSource(this.getDataSourceName());if(!(t.getDataCount()<1)){var e,n=this._indicator,r=t.getDataCount();for(n.clear(),n.reserve(r),e=0;e<r;e++)n.execute(t,e)}}},{key:"updateData",value:function(){var t=i.ChartManager.instance.getDataSource(this.getDataSourceName());if(!(t.getDataCount()<1)){var e=this._indicator;switch(t.getUpdateMode()){case a.DataSource.UpdateMode.Refresh:this.refresh();break;case a.DataSource.UpdateMode.Append:e.reserve(t.getAppendedCount());break;case a.DataSource.UpdateMode.Update:var n,r=t.getDataCount();for(n=r-(t.getUpdatedCount()+t.getAppendedCount());n<r;n++)e.execute(t,n)}}}},{key:"getMinMaxAt",value:function(t,e){e.min=Number.MAX_VALUE,e.max=-Number.MAX_VALUE;var n,r,i=!1,o=this._indicator.getOutputCount();for(r=0;r<o;r++)n=this._indicator.getOutputAt(r).execute(t),!1===isNaN(n)&&(i=!0,e.min>n&&(e.min=n),e.max<n&&(e.max=n));return i}}]),e}();e.IndicatorDataProvider=v},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ChartAreaGroup=e.TimelineArea=e.IndicatorRangeArea=e.MainRangeArea=e.IndicatorArea=e.MainArea=e.ChartArea=void 0;var r=n(1),i=n(0),o=n(21);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e,n){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=d(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),t}function h(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)}function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var g=function(t){function e(t){var n;return u(this,e),(n=h(this,d(e).call(this,t)))._left=0,n._top=0,n._right=0,n._bottom=0,n._changed=!1,n._highlighted=!1,n._pressed=!1,n._selected=!1,n.Measuring=new o.MEvent,n}return p(e,r.NamedObject),l(e,[{key:"getDockStyle",value:function(){return this._dockStyle}},{key:"setDockStyle",value:function(t){this._dockStyle=t}},{key:"getLeft",value:function(){return this._left}},{key:"getTop",value:function(){return this._top}},{key:"setTop",value:function(t){this._top!==t&&(this._top=t,this._changed=!0)}},{key:"getRight",value:function(){return this._right}},{key:"getBottom",value:function(){return this._bottom}},{key:"setBottom",value:function(t){this._bottom!==t&&(this._bottom=t,this._changed=!0)}},{key:"getCenter",value:function(){return this._left+this._right>>1}},{key:"getMiddle",value:function(){return this._top+this._bottom>>1}},{key:"getWidth",value:function(){return this._right-this._left}},{key:"getHeight",value:function(){return this._bottom-this._top}},{key:"getRect",value:function(){return{X:this._left,Y:this._top,Width:this._right-this._left,Height:this._bottom-this._top}}},{key:"contains",value:function(t,e){return t>=this._left&&t<this._right&&e>=this._top&&e<this._bottom?[this]:null}},{key:"getMeasuredWidth",value:function(){return this._measuredWidth}},{key:"getMeasuredHeight",value:function(){return this._measuredHeight}},{key:"setMeasuredDimension",value:function(t,e){this._measuredWidth=t,this._measuredHeight=e}},{key:"measure",value:function(t,e,n){this._measuredWidth=0,this._measuredHeight=0,this.Measuring.raise(this,{Width:e,Height:n}),0===this._measuredWidth&&0===this._measuredHeight&&this.setMeasuredDimension(e,n)}},{key:"layout",value:function(t,e,n,r,i){t<<=0,this._left!==t&&(this._left=t,this._changed=!0),e<<=0,this._top!==e&&(this._top=e,this._changed=!0),n<<=0,this._right!==n&&(this._right=n,this._changed=!0),r<<=0,this._bottom!==r&&(this._bottom=r,this._changed=!0),i&&(this._changed=!0)}},{key:"isChanged",value:function(){return this._changed}},{key:"setChanged",value:function(t){this._changed=t}},{key:"isHighlighted",value:function(){return this._highlighted}},{key:"getHighlightedArea",value:function(){return this._highlighted?this:null}},{key:"highlight",value:function(t){return this._highlighted=this===t,this._highlighted?this:null}},{key:"isPressed",value:function(){return this._pressed}},{key:"setPressed",value:function(t){this._pressed=t}},{key:"isSelected",value:function(){return this._selected}},{key:"getSelectedArea",value:function(){return this._selected?this:null}},{key:"select",value:function(t){return this._selected=this===t,this._selected?this:null}},{key:"onMouseMove",value:function(t,e){return null}},{key:"onMouseLeave",value:function(t,e){}},{key:"onMouseDown",value:function(t,e){return null}},{key:"onMouseUp",value:function(t,e){return null}}]),e}();e.ChartArea=g,g.DockStyle={Left:0,Top:1,Right:2,Bottom:3,Fill:4};var _=function(t){function e(t){var n;return u(this,e),(n=h(this,d(e).call(this,t)))._dragStarted=!1,n._oldX=0,n._oldY=0,n._passMoveEventToToolManager=!0,n}return p(e,g),l(e,[{key:"onMouseMove",value:function(t,e){var n=i.ChartManager.instance;if(n._capturingMouseArea===this&&!1===this._dragStarted&&(Math.abs(this._oldX-t)>1||Math.abs(this._oldY-e)>1)&&(this._dragStarted=!0),this._dragStarted)return n.hideCursor(),n.onToolMouseDrag(this.getFrameName(),t,e)?this:(n.getTimeline(this.getDataSourceName()).move(t-this._oldX),this);if(this._passMoveEventToToolManager&&n.onToolMouseMove(this.getFrameName(),t,e))return n.hideCursor(),this;switch(n._drawingTool){case i.ChartManager.DrawingTool.Cursor:n.showCursor();break;case i.ChartManager.DrawingTool.CrossCursor:n.showCrossCursor(this,t,e)?n.hideCursor():n.showCursor();break;default:n.hideCursor()}return this}},{key:"onMouseLeave",value:function(t,e){this._dragStarted=!1,this._passMoveEventToToolManager=!0}},{key:"onMouseDown",value:function(t,e){var n=i.ChartManager.instance;return n.getTimeline(this.getDataSourceName()).startMove(),this._oldX=t,this._oldY=e,this._dragStarted=!1,n.onToolMouseDown(this.getFrameName(),t,e)&&(this._passMoveEventToToolManager=!1),this}},{key:"onMouseUp",value:function(t,e){var n=i.ChartManager.instance,r=null;return this._dragStarted&&(this._dragStarted=!1,r=this),n.onToolMouseUp(this.getFrameName(),t,e)&&(r=this),this._passMoveEventToToolManager=!0,r}}]),e}();e.MainArea=_;var v=function(t){function e(t){var n;return u(this,e),(n=h(this,d(e).call(this,t)))._dragStarted=!1,n._oldX=0,n._oldY=0,n}return p(e,g),l(e,[{key:"onMouseMove",value:function(t,e){var n=i.ChartManager.instance;if(n._capturingMouseArea===this&&!1===this._dragStarted&&(this._oldX===t&&this._oldY===e||(this._dragStarted=!0)),this._dragStarted)return n.hideCursor(),n.getTimeline(this.getDataSourceName()).move(t-this._oldX),this;switch(n._drawingTool){case i.ChartManager.DrawingTool.CrossCursor:n.showCrossCursor(this,t,e)?n.hideCursor():n.showCursor();break;default:n.showCursor()}return this}},{key:"onMouseLeave",value:function(t,e){this._dragStarted=!1}},{key:"onMouseDown",value:function(t,e){return i.ChartManager.instance.getTimeline(this.getDataSourceName()).startMove(),this._oldX=t,this._oldY=e,this._dragStarted=!1,this}},{key:"onMouseUp",value:function(t,e){return this._dragStarted?(this._dragStarted=!1,this):null}}]),e}();e.IndicatorArea=v;var m=function(t){function e(t){return u(this,e),h(this,d(e).call(this,t))}return p(e,g),l(e,[{key:"onMouseMove",value:function(t,e){return i.ChartManager.instance.showCursor(),this}}]),e}();e.MainRangeArea=m;var y=function(t){function e(t){return u(this,e),h(this,d(e).call(this,t))}return p(e,g),l(e,[{key:"onMouseMove",value:function(t,e){return i.ChartManager.instance.showCursor(),this}}]),e}();e.IndicatorRangeArea=y;var b=function(t){function e(t){return u(this,e),h(this,d(e).call(this,t))}return p(e,g),l(e,[{key:"onMouseMove",value:function(t,e){return i.ChartManager.instance.showCursor(),this}}]),e}();e.TimelineArea=b;var w=function(t){function e(t){var n;return u(this,e),(n=h(this,d(e).call(this,t)))._areas=[],n._highlightedArea=null,n._selectedArea=null,n}return p(e,g),l(e,[{key:"contains",value:function(t,n){var r,i,o=this._areas.length;for(i=0;i<o;i++)if(null!==(r=this._areas[i].contains(t,n)))return r.push(this),r;return s(d(e.prototype),"contains",this).call(this,t,n)}},{key:"getAreaCount",value:function(){return this._areas.length}},{key:"getAreaAt",value:function(t){return t<0||t>=this._areas.length?null:this._areas[t]}},{key:"addArea",value:function(t){this._areas.push(t)}},{key:"removeArea",value:function(t){var e,n=this._areas.length;for(e=0;e<n;e++)if(t===this._areas[e]){this._areas.splice(e),this.setChanged(!0);break}}},{key:"getGridColor",value:function(){return this._gridColor}},{key:"setGridColor",value:function(t){this._gridColor=t}},{key:"getHighlightedArea",value:function(){return null!==this._highlightedArea?this._highlightedArea.getHighlightedArea():null}},{key:"highlight",value:function(t){this._highlightedArea=null;var e,n,r=this._areas.length;for(n=0;n<r;n++)if(null!==(e=this._areas[n].highlight(t)))return this._highlightedArea=e,this;return null}},{key:"getSelectedArea",value:function(){return null!==this._selectedArea?this._selectedArea.getSelectedArea():null}},{key:"select",value:function(t){this._selectedArea=null;var e,n,r=this._areas.length;for(n=0;n<r;n++)if(null!==(e=this._areas[n].select(t)))return this._selectedArea=e,this;return null}},{key:"onMouseLeave",value:function(t,e){var n,r=this._areas.length;for(n=0;n<r;n++)this._areas[n].onMouseLeave(t,e)}},{key:"onMouseUp",value:function(t,e){var n,r,i=this._areas.length;for(r=0;r<i;r++)if(null!==(n=this._areas[r].onMouseUp(t,e)))return n;return null}}]),e}();e.ChartAreaGroup=w},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(17),i={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},o=function(t,e){if(!t)throw a(e)},a=function(t){return new Error("Firebase Database ("+i.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},s=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},u={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:function(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<t.length;i+=3){var o=t[i],a=i+1<t.length,s=a?t[i+1]:0,u=i+2<t.length,c=u?t[i+2]:0,l=o>>2,h=(3&o)<<4|s>>4,d=(15&s)<<2|c>>6,p=63&c;u||(p=64,a||(d=64)),r.push(n[l],n[h],n[d],n[p])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(s(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n<t.length;){var i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){var o=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){var a=((7&i)<<18|(63&(o=t[n++]))<<12|(63&(s=t[n++]))<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(a>>10)),e[r++]=String.fromCharCode(56320+(1023&a))}else{o=t[n++];var s=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<t.length;){var o=n[t.charAt(i++)],a=i<t.length?n[t.charAt(i)]:0,s=++i<t.length?n[t.charAt(i)]:64,u=++i<t.length?n[t.charAt(i)]:64;if(++i,null==o||null==a||null==s||null==u)throw Error();var c=o<<2|a>>4;if(r.push(c),64!=s){var l=a<<4&240|s>>2;if(r.push(l),64!=u){var h=s<<6&192|u;r.push(h)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},c=function(t){try{return u.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};function l(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n in e)e.hasOwnProperty(n)&&(t[n]=l(t[n],e[n]));return t}var h=function(){function t(){var t=this;this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}return t.prototype.wrapCallback=function(t){var e=this;return function(n,r){n?e.reject(n):e.resolve(r),"function"==typeof t&&(e.promise.catch(function(){}),1===t.length?t(n):t(n,r))}},t}(),d=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""},p="FirebaseError",f=Error.captureStackTrace;var g=function(){return function(t,e){if(this.code=t,this.message=e,f)f(this,_.prototype.create);else{var n=Error.apply(this,arguments);this.name=p,Object.defineProperty(this,"stack",{get:function(){return n.stack}})}}}();g.prototype=Object.create(Error.prototype),g.prototype.constructor=g,g.prototype.name=p;var _=function(){function t(t,e,n){this.service=t,this.serviceName=e,this.errors=n,this.pattern=/\{\$([^}]+)}/g}return t.prototype.create=function(t,e){void 0===e&&(e={});var n,r=this.errors[t],i=this.service+"/"+t;n=void 0===r?"Error":r.replace(this.pattern,function(t,n){var r=e[n];return void 0!==r?r.toString():"<"+n+"?>"}),n=this.serviceName+": "+n+" ("+i+").";var o=new g(i,n);for(var a in e)e.hasOwnProperty(a)&&"_"!==a.slice(-1)&&(o[a]=e[a]);return o},t}();function v(t){return JSON.parse(t)}var m=function(t){var e={},n={},r={},i="";try{var o=t.split(".");e=v(c(o[0])||""),n=v(c(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}},y=function(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])},b=function(t,e){return y(e,function(e,n){t[e]=n}),t},w=function(t,e,n){for(var r in t)if(e.call(n,t[r],r,t))return r},C=function(t){function e(){var e=t.call(this)||this;e.chain_=[],e.buf_=[],e.W_=[],e.pad_=[],e.inbuf_=0,e.total_=0,e.blockSize=64,e.pad_[0]=128;for(var n=1;n<e.blockSize;++n)e.pad_[n]=0;return e.reset(),e}return r.__extends(e,t),e.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},e.prototype.compress_=function(t,e){e||(e=0);var n=this.W_;if("string"==typeof t)for(var r=0;r<16;r++)n[r]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(r=0;r<16;r++)n[r]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(r=16;r<80;r++){var i=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&(i<<1|i>>>31)}var o,a,s=this.chain_[0],u=this.chain_[1],c=this.chain_[2],l=this.chain_[3],h=this.chain_[4];for(r=0;r<80;r++){r<40?r<20?(o=l^u&(c^l),a=1518500249):(o=u^c^l,a=1859775393):r<60?(o=u&c|l&(u|c),a=2400959708):(o=u^c^l,a=3395469782);i=(s<<5|s>>>27)+o+h+a+n[r]&4294967295;h=l,l=c,c=4294967295&(u<<30|u>>>2),u=s,s=i}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},e.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r<e;){if(0==o)for(;r<=n;)this.compress_(t,r),r+=this.blockSize;if("string"==typeof t){for(;r<e;)if(i[o]=t.charCodeAt(r),++r,++o==this.blockSize){this.compress_(i),o=0;break}}else for(;r<e;)if(i[o]=t[r],++r,++o==this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=e}},e.prototype.digest=function(){var t=[],e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;n>=56;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},e}(function(){return function(){this.blockSize=-1}}());var E=function(){function t(t,e){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(function(){t(n)}).catch(function(t){n.error(t)})}return t.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},t.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},t.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},t.prototype.subscribe=function(t,e,n){var r,i=this;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(t,e){if("object"!=typeof t||null===t)return!1;for(var n=0,r=e;n<r.length;n++){var i=r[n];if(i in t&&"function"==typeof t[i])return!0}return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n}).next&&(r.next=x),void 0===r.error&&(r.error=x),void 0===r.complete&&(r.complete=x);var o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(t){}}),this.observers.push(r),o},t.prototype.unsubscribeOne=function(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},t.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},t.prototype.sendOne=function(t,e){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[t])try{e(n.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}})},t.prototype.close=function(t){var e=this;this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then(function(){e.observers=void 0,e.onNoObservers=void 0}))},t}();function x(){}function A(t,e,n){var r="";switch(e){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:throw new Error("errorPrefix called with argumentNumber > 4.  Need to update it?")}var i=t+" failed: ";return i+=r+" argument "}e.assert=o,e.assertionError=a,e.base64=u,e.base64Decode=c,e.base64Encode=function(t){var e=s(t);return u.encodeByteArray(e,!0)},e.CONSTANTS=i,e.deepCopy=function(t){return l(void 0,t)},e.deepExtend=l,e.patchProperty=function(t,e,n){t[e]=n},e.Deferred=h,e.getUA=d,e.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(d())},e.isNodeSdk=function(){return!0===i.NODE_CLIENT||!0===i.NODE_ADMIN},e.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},e.ErrorFactory=_,e.FirebaseError=g,e.patchCapture=function(t){var e=f;return f=t,e},e.jsonEval=v,e.stringify=function(t){return JSON.stringify(t)},e.decode=m,e.isAdmin=function(t){var e=m(t).claims;return"object"==typeof e&&!0===e.admin},e.issuedAtTime=function(t){var e=m(t).claims;return"object"==typeof e&&e.hasOwnProperty("iat")?e.iat:null},e.isValidFormat=function(t){var e=m(t),n=e.claims;return!!e.signature&&!!n&&"object"==typeof n&&n.hasOwnProperty("iat")},e.isValidTimestamp=function(t){var e,n,r=m(t).claims,i=Math.floor((new Date).getTime()/1e3);return"object"==typeof r&&(r.hasOwnProperty("nbf")?e=r.nbf:r.hasOwnProperty("iat")&&(e=r.iat),n=r.hasOwnProperty("exp")?r.exp:e+86400),i&&e&&n&&i>=e&&i<=n},e.clone=function(t){return b({},t)},e.contains=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.every=function(t,e){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&!e(n,t[n]))return!1;return!0},e.extend=b,e.findKey=w,e.findValue=function(t,e,n){var r=w(t,e,n);return r&&t[r]},e.forEach=y,e.getAnyKey=function(t){for(var e in t)return e},e.getCount=function(t){var e=0;for(var n in t)e++;return e},e.getValues=function(t){var e=[],n=0;for(var r in t)e[n++]=t[r];return e},e.isEmpty=function(t){for(var e in t)return!1;return!0},e.isNonNullObject=function(t){return"object"==typeof t&&null!==t},e.map=function(t,e,n){var r={};for(var i in t)r[i]=e.call(n,t[i],i,t);return r},e.safeGet=function(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]},e.querystring=function(t){var e=[];return y(t,function(t,n){Array.isArray(n)?n.forEach(function(n){e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}),e.length?"&"+e.join("&"):""},e.querystringDecode=function(t){var e={};return t.replace(/^\?/,"").split("&").forEach(function(t){if(t){var n=t.split("=");e[n[0]]=n[1]}}),e},e.Sha1=C,e.async=function(t,e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];Promise.resolve(!0).then(function(){t.apply(void 0,n)}).catch(function(t){e&&e(t)})}},e.createSubscribe=function(t,e){var n=new E(t,e);return n.subscribe.bind(n)},e.errorPrefix=A,e.validateArgCount=function(t,e,n,r){var i;if(r<e?i="at least "+e:r>n&&(i=0===n?"none":"no more than "+n),i)throw new Error(t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".")},e.validateCallback=function(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(A(t,e,r)+"must be a valid function.")},e.validateContextObject=function(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(A(t,e,r)+"must be a valid context object.")},e.validateNamespace=function(t,e,n,r){if((!r||n)&&"string"!=typeof n)throw new Error(A(t,e,r)+"must be a valid firebase namespace.")},e.stringLength=function(t){for(var e=0,n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e++:r<2048?e+=2:r>=55296&&r<=56319?(e+=4,n++):e+=3}return e},e.stringToByteArray=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);if(i>=55296&&i<=56319){var a=i-55296;o(++r<t.length,"Surrogate pair missing trail surrogate."),i=65536+(a<<10)+(t.charCodeAt(r)-56320)}i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):i<65536?(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.__extends=function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},n.d(e,"__assign",function(){return i}),e.__rest=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&(n[r[i]]=t[r[i]]);return n},e.__decorate=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},e.__param=function(t,e){return function(n,r){e(n,r,t)}},e.__metadata=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},e.__awaiter=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},e.__generator=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},e.__exportStar=function(t,e){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])},e.__values=o,e.__read=a,e.__spread=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t},e.__await=s,e.__asyncGenerator=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(t){i[t]&&(r[t]=function(e){return new Promise(function(n,r){o.push([t,e,n,r])>1||u(t,e)})})}function u(t,e){try{(n=i[t](e)).value instanceof s?Promise.resolve(n.value.v).then(c,l):h(o[0][2],n)}catch(t){h(o[0][3],t)}var n}function c(t){u("next",t)}function l(t){u("throw",t)}function h(t,e){t(e),o.shift(),o.length&&u(o[0][0],o[0][1])}},e.__asyncDelegator=function(t){var e,n;return e={},r("next"),r("throw",function(t){throw t}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,i){t[r]&&(e[r]=function(e){return(n=!n)?{value:s(t[r](e)),done:"return"===r}:i?i(e):e})}},e.__asyncValues=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator];return e?e.call(t):o(t)},e.__makeTemplateObject=function(t,e){Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e;return t},e.__importStar=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},e.__importDefault=function(t){return t&&t.__esModule?t:{default:t}};
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};var i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};function o(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function a(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function s(t){return this instanceof s?(this.v=t,this):new s(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KlineTrade=void 0;var r=n(0);function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.browerState=0,this.tradeDate=new Date,this.tradesLimit=20,this.lastDepth=null,this.depthShowSize=15,this.priceDecimalDigits=6,this.amountDecimalDigits=4,this.symbol=null,this.curPrice=null,this.title="",Object.assign(this,e),t.created||(t.instance=this,t.created=!0),t.instance}var e,n,o;return e=t,(n=[{key:"reset",value:function(t){this.symbol=t,this.lastDepth=null,this.curPrice=null,this.klineTradeInit=!1,$("#trades .trades_list").empty(),$("#gasks .table").empty(),$("#gbids .table").empty(),$("#asks .table").empty(),$("#bids .table").empty()}},{key:"pushTrades",value:function(t){for(var e=$("#trades .trades_list"),n="",r=0;r<t.length;r++){var i=t[r];if(r>=t.length-this.tradesLimit){this.tradeDate.setTime(i.time);var o=this.dateFormatTf(this.tradeDate.getHours())+":"+this.dateFormatTf(this.tradeDate.getMinutes())+":"+this.dateFormatTf(this.tradeDate.getSeconds()),a=(i.amount.toFixed(4)+"").split("."),s=i.price;s>1&&(s=s.toFixed(2)),s<1&&s>1e-5&&(s=s.toFixed(4)),s<1e-5&&(s=s.toFixed(6)),n=this.klineTradeInit?"<ul class='newul'><li class='tm'>"+o+"</li><li class='pr-"+("buy"===i.type?"green":"red")+"'>"+s+"</li><li class='vl'>"+a[0]+"<g>"+(a.length>1?"."+a[1]:"")+"</g></li></ul>"+n:"<ul><li class='tm'>"+o+"</li><li class='pr-"+("buy"===i.type?"green":"red")+"'>"+s+"</li><li class='vl'>"+a[0]+"<g>"+(a.length>1?"."+a[1]:"")+"</g></li></ul>"+n}}var u=0,c=this;if(this.klineTradeInit){clearInterval(l);var l=setInterval(function(){var e=t[u],n=Number(e.price);n>1&&(n=n.toFixed(2)),n<1&&n>1e-4&&(n=n.toFixed(4)),n<1e-4&&(n=n.toFixed(6)),c.curPrice=n,$("div#price").attr("class","buy"===e.type?"green":"red").text(n),++u>=t.length&&clearInterval(l)},100)}else if(t.length>0){var h=Number(t[t.length-1].price);h>1&&(h=h.toFixed(2)),h<1&&h>1e-4&&(h=h.toFixed(4)),h<1e-4&&(h=h.toFixed(6)),c.curPrice=h,$("div#price").attr("class","buy"===t[t.length-1].type?"green":"red").text(h)}this.klineTradeInit?e.prepend(n):e.append(n),n=null,e.find("ul.newul").slideDown(1e3,function(){$(this).removeClass("newul")}),e.find("ul:gt("+(this.tradesLimit-1)+")").remove()}},{key:"updateDepth",value:function(t){if(r.ChartManager.instance.getChart().updateDepth(t),t)if($("#gasks .table").html(this.getgview(this.getgasks(t.asks))),$("#gbids .table").html(this.getgview(this.getgbids(t.bids))),null===this.lastDepth)this.lastDepth={},this.lastDepth.asks=this.getAsks(t.asks,this.depthShowSize),this.depthInit(this.lastDepth.asks,$("#asks .table")),this.lastDepth.bids=this.getBids(t.bids,this.depthShowSize),this.depthInit(this.lastDepth.bids,$("#bids .table"));else{var e=$("#asks .table");e.find("div.remove").remove(),e.find("div.add").removeClass("add");var n=this.getAsks(t.asks,this.depthShowSize),i=this.lastDepth.asks;this.lastDepth.asks=n,this.asksAndBids(n.slice(0),i,e);var o=$("#bids .table");o.find("div.remove").remove(),o.find("div.add").removeClass("add");var a=this.getBids(t.bids,this.depthShowSize),s=this.lastDepth.bids;this.lastDepth.bids=a,this.asksAndBids(a.slice(0),s,$("#bids .table"))}}},{key:"depthInit",value:function(t,e){if(e.empty(),t&&t.length>0){for(var n,r="",i=0;i<t.length;i++){var o=(t[i][0]+"").split("."),a=this.getPrice(o,n);n=o[0],o=(t[i][1]+"").split(".");var s=this.getAmount(o);r+="<div class='row'><span class='price'>"+a[0]+"<g>"+a[1]+"</g></span> <span class='amount'>"+s[0]+"<g>"+s[1]+"</g></span></div>"}e.append(r),r=null}}},{key:"asksAndBids",value:function(t,e,n){for(var r=0;r<e.length;r++){for(var i=!1,o=0;o<t.length;o++)if(e[r][0]===t[o][0]){if(i=!0,e[r][1]!==t[o][1]){var a=n.find("div:eq("+r+") .amount");a.addClass(e[r][1]>t[o][1]?"red":"green");var s=this.getAmount((t[o][1]+"").split("."));setTimeout(function(t,e){return function(){t.html(e[0]+"<g>"+e[1]+"</g>"),t.removeClass("red").removeClass("green"),t=null,e=null}}(a,s),500)}t.splice(o,1);break}i||(n.find("div:eq("+r+")").addClass("remove"),e[r][2]=-1)}for(var u=0;u<e.length;u++)for(var c=0;c<t.length;c++)if(t[c][0]>e[u][0]){var l=(t[c][1]+"").split("."),h=this.getAmount(l);n.find("div:eq("+u+")").before("<div class='row add'><span class='price'></span> <span class='amount'>"+h[0]+"<g>"+h[1]+"</g></span></div>"),e.splice(u,0,t[c]),t.splice(c,1);break}for(var d,p,f,g="",_=0;_<t.length;_++){e.push(t[_]);var v=(t[_][1]+"").split("."),m=this.getAmount(v);g+="<div class='row add'><span class='price'></span> <span class='amount'>"+m[0]+"<g>"+m[1]+"</g></span></div>"}g.length>0&&n.append(g),g=null;for(var y=0;y<e.length;y++){var b=n.find("div:eq("+y+")");if(!(e[y].length>=3&&-1===e[y][2])){var w=(e[y][0]+"").split("."),C=this.getPrice(w,d);d=w[0],b.find(".price").html(C[0]+"<g>"+C[1]+"</g>")}}t=null,e=null,n.find("div.add").slideDown(800),setTimeout((p=n.find("div.remove"),f=n.find("div.add"),function(){p.slideUp(500,function(){$(this).remove()}),f.removeClass("add")}),1e3)}},{key:"getAsks",value:function(t,e){return t.length>e&&t.splice(0,t.length-e),t}},{key:"getBids",value:function(t,e){return t.length>e&&t.splice(e,t.length-1),t}},{key:"getgview",value:function(t){for(var e,n="",r=0;r<t.length;r++){var i=t[r][0].split(".");1===i.length||i[0]!==e?(n+="<div class='row'><span class='price'>"+t[r][0]+"</span> <span class='amount'>"+t[r][1]+"</span></div>",e=i[0]):n+="<div class='row'><span class='price'><h>"+i[0]+".</h>"+i[1]+"</span> <span class='amount'>"+t[r][1]+"</span></div>"}return n}},{key:"getgasks",value:function(t){if(t.length<2)return[];var e=t[t.length-1][0],n=t[0][0],r=n-e,i=this.getBlock(r,100),o=Math.abs(Number(Math.log(i)/Math.log(10))).toFixed(0);r/i<2&&(i/=2,o++),i>=1&&(o=0),e=parseInt(e/i)*i,n=parseInt(n/i)*i;for(var a=[],s=0,u=t.length-1;u>=0;u--){if(t[u][0]>e){var c=parseInt(s,10);if(c>0&&a.unshift([Number(e).toFixed(o),c]),e>=n)break;e+=i}s+=t[u][1]}return a}},{key:"getgbids",value:function(t){if(t.length<2)return[];var e=t[t.length-1][0],n=t[0][0],r=n-e,i=this.getBlock(r,100),o=Math.abs(Number(Math.log(i)/Math.log(10))).toFixed(0);r/i<2&&(i/=2,o++),i>=1&&(o=0),e=parseInt(e/i)*i,n=parseInt(n/i)*i;for(var a=[],s=0,u=0;u<t.length;u++){if(t[u][0]<n){var c=parseInt(s,10);if(c>0&&a.push([Number(n).toFixed(o),c]),n<=e)break;n-=i}s+=t[u][1]}return a}},{key:"getBlock",value:function(t,e){return t>e||t<=0?e:(e/=10,this.getBlock(t,e))}},{key:"getZeros",value:function(t){for(var e="";t>0;)t--,e+="0";return e}},{key:"getPrice",value:function(t,e){var n=t[0];e===n?n="<h>"+n+".</h>":n+=".";var r="";return 1===t.length?(n+="0",r=this.getZeros(this.priceDecimalDigits-1)):(n+=t[1],r=this.getZeros(this.priceDecimalDigits-t[1].length)),[n,r]}},{key:"getAmount",value:function(t){var e=t[0],n="",r=this.amountDecimalDigits-e.length+1;return r>0&&(n=".",1===t.length?n+=this.getZeros(r):r>t[1].length?n+=t[1]+this.getZeros(r-t[1].length):r===t[1].length?n+=t[1]:n+=t[1].substring(0,r)),[e,n]}},{key:"dateFormatTf",value:function(t){return(t<10?"0":"")+t}}])&&i(e.prototype,n),o&&i(e,o),t}();e.KlineTrade=o,o.created=!1,o.instance=null},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}Object.defineProperty(e,"__esModule",{value:!0}),e.CName=void 0;var i=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._names=[],this._comps=[],e instanceof t)this._names=e._names,this._comps=e._comps;else{var n=e.split("."),r=n.length-1;if(r>0){this._comps=n,this._names.push(n[0]);for(var i=1;i<=r;i++)this._names.push(this._names[i-1]+"."+n[i])}else this._comps.push(e),this._names.push(e)}}var e,n,i;return e=t,(n=[{key:"getCompAt",value:function(t){return t>=0&&t<this._comps.length?this._comps[t]:""}},{key:"getName",value:function(t){if(t<0){if(this._names.length>0)return this._names[this._names.length-1]}else if(t<this._names.length)return this._names[t];return""}}])&&r(e.prototype,n),i&&r(e,i),t}();e.CName=i},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e,n){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function o(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,e,n){return e&&l(t.prototype,e),n&&l(t,n),t}Object.defineProperty(e,"__esModule",{value:!0}),e.SarExpr=e.SmaExpr=e.ExpmemaExpr=e.EmaExpr=e.MaExpr=e.StdExpr=e.SumExpr=e.CountExpr=e.LlvExpr=e.HhvExpr=e.RangeExpr=e.RangeOutputExpr=e.OutputExpr=e.AssignExpr=e.IfExpr=e.OrExpr=e.AndExpr=e.RefExpr=e.AbsExpr=e.MaxExpr=e.EqExpr=e.LeExpr=e.LtExpr=e.GeExpr=e.GtExpr=e.DivExpr=e.MulExpr=e.SubExpr=e.AddExpr=e.NegExpr=e.OpABCDExpr=e.OpABCExpr=e.OpABExpr=e.OpAExpr=e.ParameterExpr=e.ConstExpr=e.VolumeExpr=e.CloseExpr=e.LowExpr=e.HighExpr=e.OpenExpr=e.Expr=e.ExprEnv=void 0;var d=function(){function t(){c(this,t),this._ds=null,this._firstIndex=null}return h(t,[{key:"getDataSource",value:function(){return this._ds}},{key:"setDataSource",value:function(t){return this._ds=t}},{key:"getFirstIndex",value:function(){return this._firstIndex}},{key:"setFirstIndex",value:function(t){return this._firstIndex=t}}],[{key:"get",value:function(){return this.inst}},{key:"set",value:function(t){this.inst=t}}]),t}();e.ExprEnv=d,d.inst=null;var p=function(){function t(){c(this,t),this._rid=0}return h(t,[{key:"execute",value:function(t){}},{key:"reserve",value:function(t,e){}},{key:"clear",value:function(){}}]),t}();e.Expr=p;var f=function(t){function e(){return c(this,e),o(this,a(e).apply(this,arguments))}return s(e,p),h(e,[{key:"execute",value:function(t){return d.get()._ds.getDataAt(t).open}}]),e}();e.OpenExpr=f;var g=function(t){function e(){return c(this,e),o(this,a(e).apply(this,arguments))}return s(e,p),h(e,[{key:"execute",value:function(t){return d.get()._ds.getDataAt(t).high}}]),e}();e.HighExpr=g;var _=function(t){function e(){return c(this,e),o(this,a(e).apply(this,arguments))}return s(e,p),h(e,[{key:"execute",value:function(t){return d.get()._ds.getDataAt(t).low}}]),e}();e.LowExpr=_;var v=function(t){function e(){return c(this,e),o(this,a(e).apply(this,arguments))}return s(e,p),h(e,[{key:"execute",value:function(t){return d.get()._ds.getDataAt(t).close}}]),e}();e.CloseExpr=v;var m=function(t){function e(){return c(this,e),o(this,a(e).apply(this,arguments))}return s(e,p),h(e,[{key:"execute",value:function(t){return d.get()._ds.getDataAt(t).volume}}]),e}();e.VolumeExpr=m;var y=function(t){function e(t){var n;return c(this,e),(n=o(this,a(e).call(this)))._value=t,n}return s(e,p),h(e,[{key:"execute",value:function(t){return this._value}}]),e}();e.ConstExpr=y;var b=function(t){function e(t,n,r,i){var s;return c(this,e),(s=o(this,a(e).call(this)))._name=t,s._minValue=n,s._maxValue=r,s._value=s._defaultValue=i,s}return s(e,p),h(e,[{key:"execute",value:function(t){return this._value}},{key:"getMinValue",value:function(){return this._minValue}},{key:"getMaxValue",value:function(){return this._maxValue}},{key:"getDefaultValue",value:function(){return this._defaultValue}},{key:"getValue",value:function(){return this._value}},{key:"setValue",value:function(t){0===t?this._value=0:t<this._minValue?this._value=this._minValue:t>this._maxValue?this._value=this._maxValue:this._value=t}}]),e}();e.ParameterExpr=b;var w=function(t){function e(t){var n;return c(this,e),(n=o(this,a(e).call(this)))._exprA=t,n}return s(e,p),h(e,[{key:"reserve",value:function(t,e){this._rid<t&&(this._rid=t,this._exprA.reserve(t,e))}},{key:"clear",value:function(){this._exprA.clear()}}]),e}();e.OpAExpr=w;var C=function(t){function e(t,n){var r;return c(this,e),(r=o(this,a(e).call(this)))._exprA=t,r._exprB=n,r}return s(e,p),h(e,[{key:"reserve",value:function(t,e){this._rid<t&&(this._rid=t,this._exprA.reserve(t,e),this._exprB.reserve(t,e))}},{key:"clear",value:function(){this._exprA.clear(),this._exprB.clear()}}]),e}();e.OpABExpr=C;var E=function(t){function e(t,n,r){var i;return c(this,e),(i=o(this,a(e).call(this)))._exprA=t,i._exprB=n,i._exprC=r,i}return s(e,p),h(e,[{key:"reserve",value:function(t,e){this._rid<t&&(this._rid=t,this._exprA.reserve(t,e),this._exprB.reserve(t,e),this._exprC.reserve(t,e))}},{key:"clear",value:function(){this._exprA.clear(),this._exprB.clear(),this._exprC.clear()}}]),e}();e.OpABCExpr=E;var x=function(t){function e(t,n,r,i){var s;return c(this,e),(s=o(this,a(e).call(this)))._exprA=t,s._exprB=n,s._exprC=r,s._exprD=i,s}return s(e,p),h(e,[{key:"reserve",value:function(t,e){this._rid<t&&(this._rid=t,this._exprA.reserve(t,e),this._exprB.reserve(t,e),this._exprC.reserve(t,e),this._exprD.reserve(t,e))}},{key:"clear",value:function(){this._exprA.clear(),this._exprB.clear(),this._exprC.clear(),this._exprD.clear()}}]),e}();e.OpABCDExpr=x;var A=function(t){function e(t){return c(this,e),o(this,a(e).call(this,t))}return s(e,w),h(e,[{key:"execute",value:function(t){return-this._exprA.execute(t)}}]),e}();e.NegExpr=A;var S=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return this._exprA.execute(t)+this._exprB.execute(t)}}]),e}();e.AddExpr=S;var k=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return this._exprA.execute(t)-this._exprB.execute(t)}}]),e}();e.SubExpr=k;var T=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return this._exprA.execute(t)*this._exprB.execute(t)}}]),e}();e.MulExpr=T;var P=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){var e=this._exprA.execute(t),n=this._exprB.execute(t);return 0===e?e:0===n?e>0?1e6:-1e6:e/n}}]),e}();e.DivExpr=P;var I=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return this._exprA.execute(t)>this._exprB.execute(t)?1:0}}]),e}();e.GtExpr=I;var O=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return this._exprA.execute(t)>=this._exprB.execute(t)?1:0}}]),e}();e.GeExpr=O;var N=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return this._exprA.execute(t)<this._exprB.execute(t)?1:0}}]),e}();e.LtExpr=N;var R=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return this._exprA.execute(t)<=this._exprB.execute(t)?1:0}}]),e}();e.LeExpr=R;var D=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return this._exprA.execute(t)===this._exprB.execute(t)?1:0}}]),e}();e.EqExpr=D;var M=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return Math.max(this._exprA.execute(t),this._exprB.execute(t))}}]),e}();e.MaxExpr=M;var L=function(t){function e(t){return c(this,e),o(this,a(e).call(this,t))}return s(e,w),h(e,[{key:"execute",value:function(t){return Math.abs(this._exprA.execute(t))}}]),e}();e.AbsExpr=L;var j=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){if((void 0===this._offset||this._offset<0)&&(this._offset=this._exprB.execute(t),this._offset<0))throw"offset < 0";if((t-=this._offset)<0)throw"index < 0";var e=this._exprA.execute(t);if(isNaN(e))throw"NaN";return e}}]),e}();e.RefExpr=j;var U=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return 0!==this._exprA.execute(t)&&0!==this._exprB.execute(t)?1:0}}]),e}();e.AndExpr=U;var F=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,C),h(e,[{key:"execute",value:function(t){return 0!==this._exprA.execute(t)||0!==this._exprB.execute(t)?1:0}}]),e}();e.OrExpr=F;var B=function(t){function e(t,n,r){return c(this,e),o(this,a(e).call(this,t,n,r))}return s(e,E),h(e,[{key:"execute",value:function(t){return 0!==this._exprA.execute(t)?this._exprB.execute(t):this._exprC.execute(t)}}]),e}();e.IfExpr=B;var V=function(t){function e(t,n){var r;return c(this,e),(r=o(this,a(e).call(this,n)))._name=t,r._buf=[],r}return s(e,w),h(e,[{key:"getName",value:function(){return this._name}},{key:"execute",value:function(t){return this._buf[t]}},{key:"assign",value:function(t){if(this._buf[t]=this._exprA.execute(t),d.get()._firstIndex>=0&&isNaN(this._buf[t])&&!isNaN(this._buf[t-1]))throw this._name+".assign("+t+"): NaN"}},{key:"reserve",value:function(t,n){if(this._rid<t)for(var r=n;r>0;r--)this._buf.push(NaN);i(a(e.prototype),"reserve",this).call(this,t,n)}},{key:"clear",value:function(){i(a(e.prototype),"clear",this).call(this),this._buf=[]}}]),e}();e.AssignExpr=V;var W=function(t){function e(t,n,r,i){var s;return c(this,e),(s=o(this,a(e).call(this,t,n)))._style=void 0===r?e.outputStyle.Line:r,s._color=i,s}return s(e,V),h(e,[{key:"getStyle",value:function(){return this._style}},{key:"getColor",value:function(){return this._color}}]),e}();e.OutputExpr=W,W.outputStyle={None:0,Line:1,VolumeStick:2,MACDStick:3,SARPoint:4};var G=function(t){function e(t,n,r,i){return c(this,e),o(this,a(e).call(this,t,n,r,i))}return s(e,W),h(e,[{key:"getName",value:function(){return this._name+this._exprA.getRange()}}]),e}();e.RangeOutputExpr=G;var H=function(t){function e(t,n){var r;return c(this,e),(r=o(this,a(e).call(this,t,n)))._range=-1,r._buf=[],r}return s(e,C),h(e,[{key:"getRange",value:function(){return this._range}},{key:"initRange",value:function(){this._range=this._exprB.execute(0)}},{key:"execute",value:function(t){this._range<0&&this.initRange();var e=this._buf[t].resultA=this._exprA.execute(t);return this._buf[t].result=this.calcResult(t,e)}},{key:"reserve",value:function(t,n){if(this._rid<t)for(var r=n;r>0;r--)this._buf.push({resultA:NaN,result:NaN});i(a(e.prototype),"reserve",this).call(this,t,n)}},{key:"clear",value:function(){i(a(e.prototype),"clear",this).call(this),this._range=-1,this._buf=[]}}]),e}();e.RangeExpr=H;var Y=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,H),h(e,[{key:"calcResult",value:function(t,e){if(0===this._range)return NaN;var n=d.get()._firstIndex;if(n<0)return e;if(t>n){for(var r=e,i=t-this._range+1,o=Math.max(n,i);o<t;o++){var a=this._buf[o];r<a.resultA&&(r=a.resultA)}return r}return e}}]),e}();e.HhvExpr=Y;var z=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,H),h(e,[{key:"calcResult",value:function(t,e){if(0===this._range)return NaN;var n=d.get()._firstIndex;if(n<0)return e;if(t>n){for(var r=e,i=t-this._range+1,o=Math.max(n,i);o<t;o++){var a=this._buf[o];r>a.resultA&&(r=a.resultA)}return r}return e}}]),e}();e.LlvExpr=z;var q=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,H),h(e,[{key:"calcResult",value:function(t,e){if(0===this._range)return NaN;var n=d.get()._firstIndex;if(n<0)return 0;if(t>=n){var r=this._range-1;r>t-n&&(r=t-n);for(var i=0;r>=0;r--)0!==this._buf[t-r].resultA&&i++;return i}return 0}}]),e}();e.CountExpr=q;var X=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,H),h(e,[{key:"calcResult",value:function(t,e){var n=d.get()._firstIndex;if(n<0)return e;if(t>n){var r=this._range;return 0===r||r>=t+1-n?this._buf[t-1].result+e:this._buf[t-1].result+e-this._buf[t-r].resultA}return e}}]),e}();e.SumExpr=X;var Q=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,H),h(e,[{key:"calcResult",value:function(t,e){if(0===this._range)return NaN;var n=this._stdBuf[t],r=d.get()._firstIndex;if(r<0)return n.resultMA=e,0;if(t>r){var i=this._range;i>=t+1-r?(i=t+1-r,n.resultMA=this._stdBuf[t-1].resultMA*(1-1/i)+e/i):n.resultMA=this._stdBuf[t-1].resultMA+(e-this._buf[t-i].resultA)/i;for(var o=0,a=t-i+1;a<=t;a++)o+=Math.pow(this._buf[a].resultA-n.resultMA,2);return Math.sqrt(o/i)}return n.resultMA=e,0}},{key:"reserve",value:function(t,n){if(this._rid<t)for(var r=n;r>0;r--)this._stdBuf.push({resultMA:NaN});i(a(e.prototype),"reserve",this).call(this,t,n)}},{key:"clear",value:function(){i(a(e.prototype),"clear",this).call(this),this._stdBuf=[]}}]),e}();e.StdExpr=Q;var K=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,H),h(e,[{key:"calcResult",value:function(t,e){if(0===this._range)return NaN;var n=d.get()._firstIndex;if(n<0)return e;if(t>n){var r=this._range;return r>=t+1-n?(r=t+1-n,this._buf[t-1].result*(1-1/r)+e/r):this._buf[t-1].result+(e-this._buf[t-r].resultA)/r}return e}}]),e}();e.MaExpr=K;var Z=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,H),h(e,[{key:"initRange",value:function(){i(a(e.prototype),"initRange",this).call(this),this._alpha=2/(this._range+1)}},{key:"calcResult",value:function(t,e){if(0===this._range)return NaN;var n=d.get()._firstIndex;if(n<0)return e;if(t>n){var r=this._buf[t-1];return this._alpha*(e-r.result)+r.result}return e}}]),e}();e.EmaExpr=Z;var J=function(t){function e(t,n){return c(this,e),o(this,a(e).call(this,t,n))}return s(e,Z),h(e,[{key:"calcResult",value:function(t,e){var n=d.get()._firstIndex;if(n<0)return e;if(t>n){var r=this._range,i=this._buf[t-1];return r>=t+1-n?(r=t+1-n,i.result*(1-1/r)+e/r):this._alpha*(e-i.result)+i.result}return e}}]),e}();e.ExpmemaExpr=J;var $=function(t){function e(t,n,r){var i;return c(this,e),(i=o(this,a(e).call(this,t,n)))._exprC=r,i._mul=null,i}return s(e,H),h(e,[{key:"initRange",value:function(){i(a(e.prototype),"initRange",this).call(this),this._mul=this._exprC.execute(0)}},{key:"calcResult",value:function(t,e){if(0===this._range)return NaN;var n=d.get()._firstIndex;if(n<0)return e;if(t>n){var r=this._range;return r>t+1-n&&(r=t+1-n),((r-1)*this._buf[t-1].result+e*this._mul)/r}return e}}]),e}();e.SmaExpr=$;var tt=function(t){function e(t,n,r,i){var s;return c(this,e),(s=o(this,a(e).call(this,t,n,r,i)))._buf=[],s._range=-1,s._min=null,s._step=null,s._max=null,s}return s(e,x),h(e,[{key:"execute",value:function(t){this._range<0&&(this._range=this._exprA.execute(0),this._min=this._exprB.execute(0)/100,this._step=this._exprC.execute(0)/100,this._max=this._exprD.execute(0)/100);var e=this._buf[t],n=d.get(),r=n._firstIndex;if(r<0)e.longPos=!0,e.sar=n._ds.getDataAt(t).low,e.ep=n._ds.getDataAt(t).high,e.af=.02;else{var i=n._ds.getDataAt(t).high,o=n._ds.getDataAt(t).low,a=this._buf[t-1];if(e.sar=a.sar+a.af*(a.ep-a.sar),a.longPos){if(e.longPos=!0,i>a.ep?(e.ep=i,e.af=Math.min(a.af+this._step,this._max)):(e.ep=a.ep,e.af=a.af),e.sar>o){e.longPos=!1;var s=t-this._range+1;for(s=Math.max(s,r);s<t;s++){var u=n._ds.getDataAt(s).high;i<u&&(i=u)}e.sar=i,e.ep=o,e.af=.02}}else if(e.longPos=!1,o<a.ep?(e.ep=o,e.af=Math.min(a.af+this._step,this._max)):(e.ep=a.ep,e.af=a.af),e.sar<i){e.longPos=!0;var c=t-this._range+1;for(c=Math.max(c,r);c<t;c++){var l=n._ds.getDataAt(c).low;o>l&&(o=l)}e.sar=o,e.ep=i,e.af=.02}}return e.sar}},{key:"reserve",value:function(t,n){if(this._rid<t)for(var r=n;r>0;r--)this._buf.push({longPos:!0,sar:NaN,ep:NaN,af:NaN});i(a(e.prototype),"reserve",this).call(this,t,n)}},{key:"clear",value:function(){i(a(e.prototype),"clear",this).call(this),this._range=-1}}]),e}();e.SarExpr=tt},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}Object.defineProperty(e,"__esModule",{value:!0}),e.MEvent=void 0;var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._handlers=[]}var e,n,i;return e=t,(n=[{key:"addHandler",value:function(t,e){this.indexOf(t,e)<0&&this._handlers.push({obj:t,func:e})}},{key:"removeHandler",value:function(t,e){var n=this.indexOf(t,e);n>=0&&this._handlers.splice(n,1)}},{key:"raise",value:function(t,e){var n,r=this._handlers,i=r.length;for(n=0;n<i;n++)r[n].func(t,e)}},{key:"indexOf",value:function(t,e){var n,r,i=this._handlers,o=i.length;for(r=0;r<o;r++)if(t===(n=i[r]).obj&&e===n.func)return r;return-1}}])&&r(e.prototype,n),i&&r(e,i),t}();e.MEvent=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PercentageRange=e.ZeroCenteredRange=e.MainRange=e.ZeroBasedPositiveRange=e.PositiveRange=e.Range=void 0;var r=n(1),i=n(0);function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}function c(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var p=function(t){function e(t){var n;return a(this,e),(n=c(this,l(e).call(this,t)))._updated=!0,n._minValue=Number.MAX_VALUE,n._maxValue=-Number.MAX_VALUE,n._outerMinValue=Number.MAX_VALUE,n._outerMaxValue=-Number.MAX_VALUE,n._ratio=0,n._top=0,n._bottom=0,n._paddingTop=0,n._paddingBottom=0,n._minInterval=36,n._selectedPosition=-1,n._selectedValue=-Number.MAX_VALUE,n._gradations=[],n}return h(e,r.NamedObject),u(e,[{key:"isUpdated",value:function(){return this._updated}},{key:"setUpdated",value:function(t){this._updated=t}},{key:"getMinValue",value:function(){return this._minValue}},{key:"getMaxValue",value:function(){return this._maxValue}},{key:"getRange",value:function(){return this._maxValue-this._minValue}},{key:"getOuterMinValue",value:function(){return this._outerMinValue}},{key:"getOuterMaxValue",value:function(){return this._outerMaxValue}},{key:"getOuterRange",value:function(){return this._outerMaxValue-this._outerMinValue}},{key:"getHeight",value:function(){return Math.max(0,this._bottom-this._top)}},{key:"getGradations",value:function(){return this._gradations}},{key:"getMinInterval",value:function(){return this._minInterval}},{key:"setMinInterval",value:function(t){this._minInterval=t}},{key:"getSelectedPosition",value:function(){return this._selectedPosition>=0?this._selectedPosition:this._selectedValue>-Number.MAX_VALUE?this.toY(this._selectedValue):-1}},{key:"getSelectedValue",value:function(){if(this._selectedValue>-Number.MAX_VALUE)return this._selectedValue;var t=i.ChartManager.instance.getArea(this.getAreaName());return null===t?-Number.MAX_VALUE:this._selectedPosition<t.getTop()+12||this._selectedPosition>=t.getBottom()-4?-Number.MAX_VALUE:this.toValue(this._selectedPosition)}},{key:"setPaddingTop",value:function(t){this._paddingTop=t}},{key:"setPaddingBottom",value:function(t){this._paddingBottom=t}},{key:"toValue",value:function(t){return this._maxValue-(t-this._top)/this._ratio}},{key:"toY",value:function(t){return this._ratio>0?this._top+Math.floor((this._maxValue-t)*this._ratio+.5):this._top}},{key:"toHeight",value:function(t){return t==1/0||0==this._ratio?1.5:Math.floor(t*this._ratio+1.5)}},{key:"update",value:function(){for(var t,e=Number.MAX_VALUE,n=-Number.MAX_VALUE,r=i.ChartManager.instance,o=[".main",".secondary"],a=0;a<o.length;a++)null!==(t=r.getDataProvider(this.getName()+o[a]))&&void 0!==t&&(e=Math.min(e,t.getMinValue()),n=Math.max(n,t.getMaxValue()));var s={min:e,max:n};this.preSetRange(s),this.setRange(s.min,s.max)}},{key:"select",value:function(t){this._selectedValue=t,this._selectedPosition=-1}},{key:"selectAt",value:function(t){this._selectedPosition=t,this._selectedValue=-Number.MAX_VALUE}},{key:"unselect",value:function(){this._selectedPosition=-1,this._selectedValue=-Number.MAX_VALUE}},{key:"preSetRange",value:function(t){t.min===t.max&&(t.min=-1,t.max=1)}},{key:"setRange",value:function(t,e){var n=i.ChartManager.instance.getArea(this.getAreaName());if(this._minValue!==t||this._maxValue!==e||n.isChanged()){this._updated=!0,this._minValue=t,this._maxValue=e,this._gradations=[];var r=n.getTop()+this._paddingTop,o=n.getBottom()-(this._paddingBottom+1);r>=o?this._minValue=this._maxValue:(this._top=r,this._bottom=o,this._maxValue>this._minValue?this._ratio=(o-r)/(this._maxValue-this._minValue):this._ratio=1,this._outerMinValue=this.toValue(n.getBottom()),this._outerMaxValue=this.toValue(n.getTop()),this.updateGradations())}}},{key:"calcInterval",value:function(){var t=this.getHeight(),e=this.getMinInterval();t/e<=1&&(e=t>>1);for(var n,r,i=this.getRange(),o=0;o>-2&&Math.floor(i)<i;)i*=10,o--;for(;(n=r=Math.pow(10,o),!(this.toHeight(n)>e))&&(n=2*r,!(this.toHeight(n)>e))&&(n=5*r,!(this.toHeight(n)>e));o++);return n}},{key:"updateGradations",value:function(){this._gradations=[];var t=this.calcInterval();if(!(t<=0)){var e=Math.floor(this.getMaxValue()/t)*t;do{this._gradations.push(e),e-=t}while(e>this.getMinValue())}}}]),e}();e.Range=p;var f=function(t){function e(t){return a(this,e),c(this,l(e).call(this,t))}return h(e,p),u(e,[{key:"preSetRange",value:function(t){t.min<0&&(t.min=0),t.max<0&&(t.max=0)}}]),e}();e.PositiveRange=f;var g=function(t){function e(t){return a(this,e),c(this,l(e).call(this,t))}return h(e,p),u(e,[{key:"preSetRange",value:function(t){t.min=0,t.max<0&&(t.max=0)}}]),e}();e.ZeroBasedPositiveRange=g;var _=function(t){function e(t){return a(this,e),c(this,l(e).call(this,t))}return h(e,p),u(e,[{key:"preSetRange",value:function(t){var e=i.ChartManager.instance,n=e.getTimeline(this.getDataSourceName()),r=n.getMaxIndex()-n.getLastIndex();if(r<25){var o=e.getDataSource(this.getDataSourceName()),a=o.getDataAt(o.getDataCount()-1),s=(t.max-t.min)/4*(1-r/25);t.min=Math.min(t.min,Math.max(a.low-s,0)),t.max=Math.max(t.max,a.high+s)}if(t.min>0){var u=t.max/t.min;if(u<1.016){var c=(t.max+t.min)/2,l=1.5*(u-1);t.max=c*(1+l),t.min=c*(1-l)}else if(u<1.048){var h=(t.max+t.min)/2;t.max=1.024*h,t.min=.976*h}}t.min<0&&(t.min=0),t.max<0&&(t.max=0)}}]),e}();e.MainRange=_;var v=function(t){function e(t){return a(this,e),c(this,l(e).call(this,t))}return h(e,p),u(e,[{key:"calcInterval",value:function(t){var e=this.getMinInterval();if(t.getHeight()/e<2)return 0;var n,r=this.getRange();for(n=3;!(this.toHeight(r/n)<=e);n+=2);return r/(n-=2)}},{key:"updateGradations",value:function(){this._gradations=[];var t=i.ChartManager.instance.getArea(this.getAreaName()),e=this.calcInterval(t);if(!(e<=0)){var n=e/2;do{this._gradations.push(n),this._gradations.push(-n),n+=e}while(n<=this.getMaxValue())}}},{key:"preSetRange",value:function(t){var e=Math.max(Math.abs(t.min),Math.abs(t.max));t.min=-e,t.max=e}}]),e}();e.ZeroCenteredRange=v;var m=function(t){function e(t){return a(this,e),c(this,l(e).call(this,t))}return h(e,p),u(e,[{key:"updateGradations",value:function(){this._gradations=[];var t=i.ChartManager.instance.getArea(this.getAreaName()),e=Math.floor(this.toHeight(10));if(!(e<<2>t.getHeight())){var n=10*Math.ceil(this.getMinValue()/10);if(0===n&&(n=0),e<<2<24){if(e<<1<8)return;do{20!==n&&80!==n||this._gradations.push(n),n+=10}while(n<this.getMaxValue())}else do{e<8?20!==n&&50!==n&&80!==n||this._gradations.push(n):0!==n&&20!==n&&50!==n&&80!==n&&100!==n||this._gradations.push(n),n+=10}while(n<this.getMaxValue())}}}]),e}();e.PercentageRange=m},function(t,e){t.exports=__WEBPACK_EXTERNAL_MODULE_23__},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,h=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&p())}function p(){if(!l){var t=s(d);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new f(t,e)),1!==c.length||l||s(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r,i=(r=n(3))&&r.__esModule?r:{default:r};window.Kline=i.default;var o=i.default;e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Chart=void 0;var r,i=n(0),o=n(10),a=(r=n(3))&&r.__esModule?r:{default:r},s=n(8);function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var c=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._data=null,this._charStyle="CandleStick",this._depthData={array:null,asks_count:0,bids_count:0,asks_si:0,asks_ei:0,bids_si:0,bids_ei:0},this.strIsLine=!1,this._range=a.default.instance.range,this._symbol=a.default.instance.symbol}var e,n,r;return e=t,(n=[{key:"setTitle",value:function(){var e=i.ChartManager.instance.getLanguage(),n=a.default.instance.symbolName;n+=" ",n+=this.strIsLine?t.strPeriod[e].line:t.strPeriod[e][this._range],n+=(this._contract_unit+"/"+this._money_type).toUpperCase(),i.ChartManager.instance.setTitle("frame0.k0",n)}},{key:"setSymbol",value:function(t){this._symbol=t,this.updateDataAndDisplay()}},{key:"updateDataAndDisplay",value:function(){a.default.instance.symbol=this._symbol,a.default.instance.range=this._range,i.ChartManager.instance.setCurrentDataSource("frame0.k0",this._symbol+"."+this._range),i.ChartManager.instance.setNormalMode();var t=a.default.instance.chartMgr.getDataSource("frame0.k0").getLastDate();$(".symbol-title>a").text(a.default.instance.symbolName),-1===t?(a.default.instance.requestParam=o.Control.setHttpRequestParam(a.default.instance.symbol,a.default.instance.range,a.default.instance.limit,null),o.Control.requestData(!0)):(a.default.instance.requestParam=o.Control.setHttpRequestParam(a.default.instance.symbol,a.default.instance.range,null,t.toString()),o.Control.requestData()),i.ChartManager.instance.redraw("All",!1)}},{key:"setCurrentContractUnit",value:function(t){this._contract_unit=t,this.updateDataAndDisplay()}},{key:"setCurrentMoneyType",value:function(t){this._money_type=t,this.updateDataAndDisplay()}},{key:"setCurrentPeriod",value:function(t){this._range=a.default.instance.periodMap[t],"stomp"===a.default.instance.type&&1===a.default.instance.stompClient.ws.readyState&&(a.default.instance.subscribed.unsubscribe(),a.default.instance.subscribed=a.default.instance.stompClient.subscribe(a.default.instance.subscribePath+"/"+a.default.instance.symbol+"/"+this._range,o.Control.subscribeCallback)),this.updateDataAndDisplay(),a.default.instance.onRangeChange(this._range)}},{key:"updateDataSource",value:function(t){this._data=t,i.ChartManager.instance.updateData("frame0.k0",this._data)}},{key:"updateDepth",value:function(t){if(null===t)return this._depthData.array=[],void i.ChartManager.instance.redraw("All",!1);if(t.asks&&t.bids&&""!==t.asks&&""!==t.bids){var e=this._depthData;e.array=[];for(var n=0;n<t.asks.length;n++){var r={};r.rate=t.asks[n][0],r.amount=t.asks[n][1],e.array.push(r)}for(var o=0;o<t.bids.length;o++){var a={};a.rate=t.bids[o][0],a.amount=t.bids[o][1],e.array.push(a)}e.asks_count=t.asks.length,e.bids_count=t.bids.length,e.asks_si=e.asks_count-1,e.asks_ei=0,e.bids_si=e.asks_count-1,e.bids_ei=e.asks_count+e.bids_count-2;for(var s=e.asks_si;s>=e.asks_ei;s--)s===e.asks_si&&void 0!==e.array[s]?e.array[s].amounts=e.array[s].amount:void 0!==e.array[s+1]&&(e.array[s].amounts=e.array[s+1].amounts+e.array[s].amount);for(var u=e.bids_si;u<=e.bids_ei;u++)u===e.bids_si&&void 0!==e.array[u]?e.array[u].amounts=e.array[u].amount:void 0!==e.array[u-1]&&(e.array[u].amounts=e.array[u-1].amounts+e.array[u].amount);i.ChartManager.instance.redraw("All",!1)}}},{key:"setMainIndicator",value:function(t){this._mainIndicator=t,"NONE"===t?i.ChartManager.instance.removeMainIndicator("frame0.k0"):i.ChartManager.instance.setMainIndicator("frame0.k0",t),i.ChartManager.instance.redraw("All",!0)}},{key:"setIndicator",value:function(t,e){if("NONE"===e){var n=2;!1===s.Template.displayVolume&&(n=1);var r=i.ChartManager.instance.getIndicatorAreaName("frame0.k0",n);""!==r&&i.ChartManager.instance.removeIndicator(r)}else{var o=2;!1===s.Template.displayVolume&&(o=1);var a=i.ChartManager.instance.getIndicatorAreaName("frame0.k0",o);""===a?s.Template.createIndicatorChartComps("frame0.k0",e):i.ChartManager.instance.setIndicator(a,e)}i.ChartManager.instance.redraw("All",!0)}},{key:"addIndicator",value:function(t){i.ChartManager.instance.addIndicator(t),i.ChartManager.instance.redraw("All",!0)}},{key:"removeIndicator",value:function(t){var e=i.ChartManager.instance.getIndicatorAreaName(2);i.ChartManager.instance.removeIndicator(e),i.ChartManager.instance.redraw("All",!0)}}])&&u(e.prototype,n),r&&u(e,r),t}();e.Chart=c,c.strPeriod={"zh-cn":{line:"(分时)","1min":"(1分钟)","5min":"(5分钟)","15min":"(15分钟)","30min":"(30分钟)","1hour":"(1小时)","1day":"(日线)","1week":"(周线)","3min":"(3分钟)","2hour":"(2小时)","4hour":"(4小时)","6hour":"(6小时)","12hour":"(12小时)","3day":"(3天)"},"en-us":{line:"(Line)","1min":"(1m)","5min":"(5m)","15min":"(15m)","30min":"(30m)","1hour":"(1h)","1day":"(1d)","1week":"(1w)","3min":"(3m)","2hour":"(2h)","4hour":"(4h)","6hour":"(6h)","12hour":"(12h)","3day":"(3d)"},"zh-tw":{line:"(分時)","1min":"(1分鐘)","5min":"(5分鐘)","15min":"(15分鐘)","30min":"(30分鐘)","1hour":"(1小時)","1day":"(日線)","1week":"(周線)","3min":"(3分鐘)","2hour":"(2小時)","4hour":"(4小時)","6hour":"(6小時)","12hour":"(12小時)","3day":"(3天)"}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CToolManager=void 0;var r=n(1),i=n(11),o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}(n(12));function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var h=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=u(this,c(e).call(this,t))).selectedObject=-1,n.toolObjects=[],n}var n,a,h;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}(e,r.NamedObject),n=e,(a=[{key:"getToolObjectCount",value:function(){return this.toolObjects.length}},{key:"addToolObject",value:function(t){this.toolObjects.push(t)}},{key:"getToolObject",value:function(t){return t<this.toolObjects.length&&t>=0?this.toolObjects[t]:null}},{key:"getCurrentObject",value:function(){return this.getToolObject(this.getToolObjectCount()-1)}},{key:"getSelectedObject",value:function(){return this.getToolObject(this.selectedObject)}},{key:"delCurrentObject",value:function(){this.toolObjects.splice(this.getToolObjectCount()-1,1)}},{key:"delSelectedObject",value:function(){this.toolObjects.splice(this.selectedObject,1),this.selectedObject=-1}},{key:"acceptMouseMoveEvent",value:function(t,e){if(-1===this.selectedObject){var n=this.toolObjects[this.getToolObjectCount()-1];if(null!==n&&void 0!==n&&n.getState()!==o.CToolObject.state.AfterDraw)return n.acceptMouseMoveEvent(t,e)}else{var r=this.toolObjects[this.selectedObject];if(r.getState()===o.CToolObject.state.Draw)return r.acceptMouseMoveEvent(t,e);r.unselect(),this.selectedObject=-1}for(var i in this.toolObjects)if(this.toolObjects[i].isSelected(t,e))return this.selectedObject=i,!1;return!1}},{key:"acceptMouseDownEvent",value:function(t,e){if(this.mouseDownMove=!1,-1===this.selectedObject){var n=this.toolObjects[this.getToolObjectCount()-1];if(null!==n&&void 0!==n&&n.getState()!==o.CToolObject.state.AfterDraw)return n.acceptMouseDownEvent(t,e)}else{var r=this.toolObjects[this.selectedObject];if(r.getState()!==o.CToolObject.state.BeforeDraw)return r.acceptMouseDownEvent(t,e)}return!1}},{key:"acceptMouseDownMoveEvent",value:function(t,e){if(this.mouseDownMove=!0,-1===this.selectedObject){var n=this.toolObjects[this.getToolObjectCount()-1];return null!==n&&void 0!==n&&n.getState()===o.CToolObject.state.Draw&&n.acceptMouseDownMoveEvent(t,e)}var r=this.toolObjects[this.selectedObject];if(r.getState()!==o.CToolObject.state.BeforeDraw){if(!0===r.acceptMouseDownMoveEvent(t,e))for(var a=this.toolObjects[this.selectedObject].points,s=0;s<a.length;s++)if(a[s].state===i.CPoint.state.Highlight||a[s].state===i.CPoint.state.Show)return!0;return!0}}},{key:"acceptMouseUpEvent",value:function(t,e){if(!0===this.mouseDownMove){if(-1===this.selectedObject){var n=this.toolObjects[this.getToolObjectCount()-1];return null===n||void 0===n||n.getState()!==o.CToolObject.state.Draw||n.acceptMouseUpEvent(t,e)}var r=this.toolObjects[this.selectedObject];if(r.getState()!==o.CToolObject.state.BeforeDraw)return r.acceptMouseUpEvent(t,e)}if(-1!==this.selectedObject)return!0;var i=this.toolObjects[this.getToolObjectCount()-1];if(null!==i&&void 0!==i){if(i.getState()===o.CToolObject.state.Draw)return!0;if(!i.isValidMouseXY(t,e))return!1;if(i.isSelected(t,e))return!0}return!1}}])&&s(n.prototype,a),h&&s(n,h),e}();e.CToolManager=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Timeline=void 0;var r=n(1),i=n(0),o=n(2);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var h=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=u(this,c(e).call(this,t)))._updated=!1,n._innerLeft=0,n._innerWidth=0,n._firstColumnLeft=0,n._scale=3,n._lastScale=-1,n._maxItemCount=0,n._maxIndex=0,n._firstIndex=-1,n._selectedIndex=-1,n._savedFirstIndex=-1,n}var n,a,h;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}(e,r.NamedObject),n=e,(a=[{key:"isLatestShown",value:function(){return this.getLastIndex()===this._maxIndex}},{key:"isUpdated",value:function(){return this._updated}},{key:"setUpdated",value:function(t){this._updated=t}},{key:"getItemWidth",value:function(){return e.itemWidth[this._scale]}},{key:"getSpaceWidth",value:function(){return e.spaceWidth[this._scale]}},{key:"getColumnWidth",value:function(){return this.getSpaceWidth()+this.getItemWidth()}},{key:"getInnerWidth",value:function(){return this._innerWidth}},{key:"getItemLeftOffset",value:function(){return this.getSpaceWidth()}},{key:"getItemCenterOffset",value:function(){return this.getSpaceWidth()+(this.getItemWidth()>>1)}},{key:"getFirstColumnLeft",value:function(){return this._firstColumnLeft}},{key:"getMaxItemCount",value:function(){return this._maxItemCount}},{key:"getFirstIndex",value:function(){return this._firstIndex}},{key:"getLastIndex",value:function(){return Math.min(this._firstIndex+this._maxItemCount,this._maxIndex)}},{key:"getSelectedIndex",value:function(){return this._selectedIndex}},{key:"getMaxIndex",value:function(){return this._maxIndex}},{key:"calcColumnCount",value:function(t){return Math.floor(t/this.getColumnWidth())<<0}},{key:"calcFirstColumnLeft",value:function(t){return this._innerLeft+this._innerWidth-this.getColumnWidth()*t}},{key:"calcFirstIndexAlignRight",value:function(t,e,n){return Math.max(0,t+Math.max(e,1)-Math.max(n,1))}},{key:"calcFirstIndex",value:function(t){return this.validateFirstIndex(this.calcFirstIndexAlignRight(this._firstIndex,this._maxItemCount,t),t)}},{key:"updateMaxItemCount",value:function(){var t,e=this.calcColumnCount(this._innerWidth);if(this._maxItemCount<1)t=this.calcFirstIndex(e);else if(this._lastScale===this._scale)t=this.validateFirstIndex(this._firstIndex-(e-this._maxItemCount));else{var n=this._selectedIndex>=0?this._selectedIndex:this.getLastIndex()-1;t=this.validateFirstIndex(n-Math.round((n-this._firstIndex)*e/this._maxItemCount))}this._lastScale=this._scale,this._firstIndex!==t&&(this._selectedIndex===this._firstIndex&&(this._selectedIndex=t),this._firstIndex=t,this._updated=!0),this._maxItemCount!==e&&(this._maxItemCount=e,this._updated=!0),this._firstColumnLeft=this.calcFirstColumnLeft(e)}},{key:"validateFirstIndex",value:function(t,e){if(this._maxIndex<1)return-1;if(t<0)return 0;var n=Math.max(0,this._maxIndex-1);return t>n?n:t}},{key:"validateSelectedIndex",value:function(){this._selectedIndex<this._firstIndex?this._selectedIndex=-1:this._selectedIndex>=this.getLastIndex()&&(this._selectedIndex=-1)}},{key:"onLayout",value:function(){var t=i.ChartManager.instance.getArea(this.getDataSourceName()+".main");if(null!==t){this._innerLeft=t.getLeft()+e.PADDING_LEFT;var n=Math.max(0,t.getWidth()-(e.PADDING_LEFT+e.PADDING_RIGHT));this._innerWidth!==n&&(this._innerWidth=n,this.updateMaxItemCount())}}},{key:"toIndex",value:function(t){return this._firstIndex+this.calcColumnCount(t-this._firstColumnLeft)}},{key:"toColumnLeft",value:function(t){return this._firstColumnLeft+this.getColumnWidth()*(t-this._firstIndex)}},{key:"toItemLeft",value:function(t){return this.toColumnLeft(t)+this.getItemLeftOffset()}},{key:"toItemCenter",value:function(t){return this.toColumnLeft(t)+this.getItemCenterOffset()}},{key:"selectAt",value:function(t){return this._selectedIndex=this.toIndex(t),this.validateSelectedIndex(),this._selectedIndex>=0}},{key:"unselect",value:function(){this._selectedIndex=-1}},{key:"update",value:function(){var t=i.ChartManager.instance.getDataSource(this.getDataSourceName()),e=this._maxIndex;switch(this._maxIndex=t.getDataCount(),t.getUpdateMode()){case o.DataSource.UpdateMode.Refresh:this._maxIndex<1?this._firstIndex=-1:this._firstIndex=Math.max(this._maxIndex-this._maxItemCount,0),this._selectedIndex=-1,this._updated=!0;break;case o.DataSource.UpdateMode.Append:var n=this.getLastIndex(),r=t.getErasedCount();n<e?r>0&&(this._firstIndex=Math.max(this._firstIndex-r,0),this._selectedIndex>=0&&(this._selectedIndex-=r,this.validateSelectedIndex()),this._updated=!0):n===e&&(this._firstIndex+=this._maxIndex-e,this._selectedIndex>=0&&(this._selectedIndex-=r,this.validateSelectedIndex()),this._updated=!0)}}},{key:"move",value:function(t){this.isLatestShown()&&i.ChartManager.instance.getArea(this.getDataSourceName()+".mainRange").setChanged(!0),this._firstIndex=this.validateFirstIndex(this._savedFirstIndex-this.calcColumnCount(t),this._maxItemCount),this._updated=!0,this._selectedIndex>=0&&this.validateSelectedIndex()}},{key:"startMove",value:function(){this._savedFirstIndex=this._firstIndex}},{key:"scale",value:function(t){this._scale+=t,this._scale<0?this._scale=0:this._scale>=e.itemWidth.length&&(this._scale=e.itemWidth.length-1),this.updateMaxItemCount(),this._selectedIndex>=0&&this.validateSelectedIndex()}}])&&s(n.prototype,a),h&&s(n,h),e}();e.Timeline=h,h.itemWidth=[1,3,3,5,5,7,9,11,13,15,17,19,21,23,25,27,29],h.spaceWidth=[1,1,2,2,3,3,3,3,3,3,5,5,5,5,7,7,7],h.PADDING_LEFT=4,h.PADDING_RIGHT=8},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DockableLayout=e.TableLayout=void 0;var r=s(n(15)),i=n(0),o=s(n(6)),a=n(4);function s(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,e,n){return e&&l(t.prototype,e),n&&l(t,n),t}function d(t,e){return!e||"object"!==u(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t,e,n){return(p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function g(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_(t,e)}function _(t,e){return(_=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var v=function(t){function e(t){var n;return c(this,e),(n=d(this,f(e).call(this,t)))._nextRowId=0,n._focusedRowIndex=-1,n}return g(e,r.ChartAreaGroup),h(e,[{key:"getNextRowId",value:function(){return this._nextRowId++}},{key:"measure",value:function(t,e,n){this.setMeasuredDimension(e,n);var r,o,a,s,u=0,c=0,l=[],h=this._areas.length;for(s=0;s<h;s+=2){if(0===(r=this._areas[s].getHeight())){if(0===s){var d=n/(2*(a=h+1>>1)+5)*2<<0;for(o=n,s=a-1;s>0;s--)l.unshift(d),o-=d;l.unshift(o);break}r=2===s?u/3:u}c+=r,u=r,l.push(r)}if(c>0){var p=n/c;for(o=n,s=(a=h+1>>1)-1;s>0;s--)l[s]*=p,o-=l[s];l[0]=o}var f=Math.min(240,e>>1),g=76,_=i.ChartManager.instance,v=_.getTimeline(this.getDataSourceName());if(v.getFirstIndex()>=0){var m=[];for(g=76;g<f;g+=8)m.push(v.calcFirstIndex(v.calcColumnCount(e-g)));var y,b,w=v.getLastIndex(),C=[".main",".secondary"],E=new Array(m.length);for(y=0,b=0,g=76;y<this._areas.length&&b<m.length;y+=2){var x=this._areas[y],A=_.getPlotter(x.getName()+"Range.main");for(var S in C){var k=_.getDataProvider(x.getName()+C[S]);if(void 0!==k)for(k.calcRange(m,w,E,null);b<m.length;){var T=A.getRequiredWidth(t,E[b].min),P=A.getRequiredWidth(t,E[b].max);if(Math.max(T,P)<g)break;b++,g+=8}}}}for(s=1;s<this._areas.length;s+=2)this._areas[s].measure(t,g,l[s>>1]);var I=e-g;for(s=0;s<this._areas.length;s+=2)this._areas[s].measure(t,I,l[s>>1])}},{key:"layout",value:function(t,n,r,i,o){if(p(f(e.prototype),"layout",this).call(this,t,n,r,i,o),!(this._areas.length<1)){var a,s,u=t+this._areas[0].getMeasuredWidth(),c=n;o||(o=this.isChanged());var l,h=this._areas.length;for(l=0;l<h;l++)s=c+(a=this._areas[l]).getMeasuredHeight(),a.layout(t,c,u,s,o),l++,(a=this._areas[l]).layout(u,c,this.getRight(),s,o),c=s;this.setChanged(!1)}}},{key:"drawGrid",value:function(t){if(!(this._areas.length<1)){var e=i.ChartManager.instance,n=e.getTheme(this.getFrameName());t.fillStyle=n.getColor(o.Theme.Color.Grid1),t.fillRect(this._areas[0].getRight(),this.getTop(),1,this.getHeight());var r,a=this._areas.length-2;for(r=0;r<a;r+=2)t.fillRect(this.getLeft(),this._areas[r].getBottom(),this.getWidth(),1);if(!e.getCaptureMouseWheelDirectly())for(r=0,a+=2;r<a;r+=2)if(this._areas[r].isSelected()){t.strokeStyle=n.getColor(o.Theme.Color.Indicator1),t.strokeRect(this.getLeft()+.5,this.getTop()+.5,this.getWidth()-1,this.getHeight()-1);break}}}},{key:"highlight",value:function(t){this._highlightedArea=null;var e,n,r=this._areas.length;for(n=0;n<r;n++)(e=this._areas[n])===t?(n&=-2,(e=this._areas[n]).highlight(e),this._highlightedArea=e,n++,(e=this._areas[n]).highlight(null),e.highlight(e)):e.highlight(null);return null!==this._highlightedArea?this:null}},{key:"select",value:function(t){this._selectedArea=null;var e,n,r=this._areas.length;for(n=0;n<r;n++)(e=this._areas[n])===t?(n&=-2,(e=this._areas[n]).select(e),this._selectedArea=e,n++,(e=this._areas[n]).select(e)):e.select(null);return null!==this._selectedArea?this:null}},{key:"onMouseMove",value:function(t,e){if(this._focusedRowIndex>=0){var n=this._areas[this._focusedRowIndex],r=this._areas[this._focusedRowIndex+2],o=e-this._oldY;if(0===o)return this;var a=this._oldUpperBottom+o,s=this._oldLowerTop+o;return a-n.getTop()>=60&&r.getBottom()-s>=60&&(n.setBottom(a),r.setTop(s)),this}var u,c=this._areas.length-2;for(u=0;u<c;u+=2){var l=this._areas[u].getBottom();if(e>=l-4&&e<l+4)return i.ChartManager.instance.showCursor("n-resize"),this}return null}},{key:"onMouseLeave",value:function(t,e){this._focusedRowIndex=-1}},{key:"onMouseDown",value:function(t,e){var n,r=this._areas.length-2;for(n=0;n<r;n+=2){var i=this._areas[n].getBottom();if(e>=i-4&&e<i+4)return this._focusedRowIndex=n,this._oldY=e,this._oldUpperBottom=i,this._oldLowerTop=this._areas[n+2].getTop(),this}return null}},{key:"onMouseUp",value:function(t,e){if(this._focusedRowIndex>=0){this._focusedRowIndex=-1;var n,r=this._areas.length,i=[];for(n=0;n<r;n+=2)i.push(this._areas[n].getHeight());a.ChartSettings.get().charts.areaHeight=i,a.ChartSettings.save()}return this}}]),e}();e.TableLayout=v;var m=function(t){function e(t){return c(this,e),d(this,f(e).call(this,t))}return g(e,r.ChartAreaGroup),h(e,[{key:"measure",value:function(t,n,i){for(var o in p(f(e.prototype),"measure",this).call(this,t,n,i),n=this.getMeasuredWidth(),i=this.getMeasuredHeight(),this._areas){var a=this._areas[o];switch(a.measure(t,n,i),a.getDockStyle()){case r.ChartArea.DockStyle.left:case r.ChartArea.DockStyle.Right:n-=a.getMeasuredWidth();break;case r.ChartArea.DockStyle.Top:case r.ChartArea.DockStyle.Bottom:i-=a.getMeasuredHeight();break;case r.ChartArea.DockStyle.Fill:n=0,i=0}}}},{key:"layout",value:function(t,n,i,o,a){var s,u;for(var c in p(f(e.prototype),"layout",this).call(this,t,n,i,o,a),t=this.getLeft(),n=this.getTop(),i=this.getRight(),o=this.getBottom(),a||(a=this.isChanged()),this._areas){var l=this._areas[c];switch(l.getDockStyle()){case r.ChartArea.DockStyle.left:s=l.getMeasuredWidth(),l.layout(t,n,t+s,o,a),t+=s;break;case r.ChartArea.DockStyle.Top:u=l.getMeasuredHeight(),l.layout(t,n,i,n+u,a),n+=u;break;case r.ChartArea.DockStyle.Right:s=l.getMeasuredWidth(),l.layout(i-s,n,i,o,a),i-=s;break;case r.ChartArea.DockStyle.Bottom:u=l.getMeasuredHeight(),l.layout(t,o-u,i,o,a),o-=u;break;case r.ChartArea.DockStyle.Fill:l.layout(t,n,i,o,a),t=i,n=o}}this.setChanged(!1)}},{key:"drawGrid",value:function(t){var e=i.ChartManager.instance.getTheme(this.getFrameName()),n=this.getLeft(),o=this.getTop(),a=this.getRight(),s=this.getBottom();for(var u in t.fillStyle=e.getColor(this._gridColor),this._areas){var c=this._areas[u];switch(c.getDockStyle()){case r.ChartArea.DockStyle.Left:t.fillRect(c.getRight(),o,1,s-o),n+=c.getWidth();break;case r.ChartArea.DockStyle.Top:t.fillRect(n,c.getBottom(),a-n,1),o+=c.getHeight();break;case r.ChartArea.DockStyle.Right:t.fillRect(c.getLeft(),o,1,s-o),a-=c.getWidth();break;case r.ChartArea.DockStyle.Bottom:t.fillRect(n,c.getTop(),a-n,1),s-=c.getHeight()}}}}]),e}();e.DockableLayout=m},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.STOCHRSIIndicator=e.PSYIndicator=e.BOLLIndicator=e.MTMIndicator=e.ROCIndicator=e.KDJIndicator=e.SARIndicator=e.WRIndicator=e.RSIIndicator=e.EMVIndicator=e.OBVIndicator=e.VRIndicator=e.BRARIndicator=e.TRIXIndicator=e.DMAIndicator=e.DMIIndicator=e.MACDIndicator=e.VOLUMEIndicator=e.EMAIndicator=e.MAIndicator=e.HLCIndicator=e.Indicator=void 0;var r=o(n(20)),i=o(n(6));function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function p(t,e,n){return e&&d(t.prototype,e),n&&d(t,n),t}var f=function(){function t(){h(this,t),this._exprEnv=new r.ExprEnv,this._rid=0,this._params=[],this._assigns=[],this._outputs=[]}return p(t,[{key:"addParameter",value:function(t){this._params.push(t)}},{key:"addAssign",value:function(t){this._assigns.push(t)}},{key:"addOutput",value:function(t){this._outputs.push(t)}},{key:"getParameterCount",value:function(){return this._params.length}},{key:"getParameterAt",value:function(t){return this._params[t]}},{key:"getOutputCount",value:function(){return this._outputs.length}},{key:"getOutputAt",value:function(t){return this._outputs[t]}},{key:"clear",value:function(){var t,e;for(this._exprEnv.setFirstIndex(-1),e=this._assigns.length,t=0;t<e;t++)this._assigns[t].clear();for(e=this._outputs.length,t=0;t<e;t++)this._outputs[t].clear()}},{key:"reserve",value:function(t){var e,n;for(this._rid++,n=this._assigns.length,e=0;e<n;e++)this._assigns[e].reserve(this._rid,t);for(n=this._outputs.length,e=0;e<n;e++)this._outputs[e].reserve(this._rid,t)}},{key:"execute",value:function(t,e){if(!(e<0)){this._exprEnv.setDataSource(t),r.ExprEnv.set(this._exprEnv);try{var n,i;for(i=this._assigns.length,n=0;n<i;n++)this._assigns[n].assign(e);for(i=this._outputs.length,n=0;n<i;n++)this._outputs[n].assign(e);this._exprEnv.getFirstIndex()<0&&this._exprEnv.setFirstIndex(e)}catch(t){if(this._exprEnv.getFirstIndex()>=0)throw alert(t),t}}}},{key:"getParameters",value:function(){var t,e=[],n=this._params.length;for(t=0;t<n;t++)e.push(this._params[t].getValue());return e}},{key:"setParameters",value:function(t){if(t instanceof Array&&t.length===this._params.length)for(var e in this._params)this._params[e].setValue(t[e])}}]),t}();e.Indicator=f;var g=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("M1",2,1e3,60);return t.addParameter(n),t.addOutput(new r.OutputExpr("HIGH",new r.HighExpr,r.OutputExpr.outputStyle.None)),t.addOutput(new r.OutputExpr("LOW",new r.LowExpr,r.OutputExpr.outputStyle.None)),t.addOutput(new r.OutputExpr("CLOSE",new r.CloseExpr,r.OutputExpr.outputStyle.Line,i.Theme.Color.Indicator0)),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(new r.CloseExpr,n),r.OutputExpr.outputStyle.Line,i.Theme.Color.Indicator1)),t}return c(e,f),p(e,[{key:"getName",value:function(){return"CLOSE"}}]),e}();e.HLCIndicator=g;var _=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("M1",2,1e3,7),i=new r.ParameterExpr("M2",2,1e3,30),o=new r.ParameterExpr("M3",2,1e3,0),a=new r.ParameterExpr("M4",2,1e3,0),c=new r.ParameterExpr("M5",2,1e3,0),l=new r.ParameterExpr("M6",2,1e3,0);return t.addParameter(n),t.addParameter(i),t.addParameter(o),t.addParameter(a),t.addParameter(c),t.addParameter(l),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(new r.CloseExpr,n))),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(new r.CloseExpr,i))),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(new r.CloseExpr,o))),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(new r.CloseExpr,a))),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(new r.CloseExpr,c))),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(new r.CloseExpr,l))),t}return c(e,f),p(e,[{key:"getName",value:function(){return"MA"}}]),e}();e.MAIndicator=_;var v=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("M1",2,1e3,7),i=new r.ParameterExpr("M2",2,1e3,30),o=new r.ParameterExpr("M3",2,1e3,0),a=new r.ParameterExpr("M4",2,1e3,0),c=new r.ParameterExpr("M5",2,1e3,0),l=new r.ParameterExpr("M6",2,1e3,0);return t.addParameter(n),t.addParameter(i),t.addParameter(o),t.addParameter(a),t.addParameter(c),t.addParameter(l),t.addOutput(new r.RangeOutputExpr("EMA",new r.EmaExpr(new r.CloseExpr,n))),t.addOutput(new r.RangeOutputExpr("EMA",new r.EmaExpr(new r.CloseExpr,i))),t.addOutput(new r.RangeOutputExpr("EMA",new r.EmaExpr(new r.CloseExpr,o))),t.addOutput(new r.RangeOutputExpr("EMA",new r.EmaExpr(new r.CloseExpr,a))),t.addOutput(new r.RangeOutputExpr("EMA",new r.EmaExpr(new r.CloseExpr,c))),t.addOutput(new r.RangeOutputExpr("EMA",new r.EmaExpr(new r.CloseExpr,l))),t}return c(e,f),p(e,[{key:"getName",value:function(){return"EMA"}}]),e}();e.EMAIndicator=v;var m=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("M1",2,500,5),o=new r.ParameterExpr("M2",2,500,10);t.addParameter(n),t.addParameter(o);var a=new r.OutputExpr("VOLUME",new r.VolumeExpr,r.OutputExpr.outputStyle.VolumeStick,i.Theme.Color.Text4);return t.addOutput(a),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(a,n),r.OutputExpr.outputStyle.Line,i.Theme.Color.Indicator0)),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(a,o),r.OutputExpr.outputStyle.Line,i.Theme.Color.Indicator1)),t}return c(e,f),p(e,[{key:"getName",value:function(){return"VOLUME"}}]),e}();e.VOLUMEIndicator=m;var y=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("SHORT",2,200,12),i=new r.ParameterExpr("LONG",2,200,26),o=new r.ParameterExpr("MID",2,200,9);t.addParameter(n),t.addParameter(i),t.addParameter(o);var a=new r.OutputExpr("DIF",new r.SubExpr(new r.EmaExpr(new r.CloseExpr,n),new r.EmaExpr(new r.CloseExpr,i)));t.addOutput(a);var c=new r.OutputExpr("DEA",new r.EmaExpr(a,o));t.addOutput(c);var l=new r.OutputExpr("MACD",new r.MulExpr(new r.SubExpr(a,c),new r.ConstExpr(2)),r.OutputExpr.outputStyle.MACDStick);return t.addOutput(l),t}return c(e,f),p(e,[{key:"getName",value:function(){return"MACD"}}]),e}();e.MACDIndicator=y;var b=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,90,14),i=new r.ParameterExpr("MM",2,60,6);t.addParameter(n),t.addParameter(i);var o=new r.AssignExpr("MTR",new r.ExpmemaExpr(new r.MaxExpr(new r.MaxExpr(new r.SubExpr(new r.HighExpr,new r.LowExpr),new r.AbsExpr(new r.SubExpr(new r.HighExpr,new r.RefExpr(new r.CloseExpr,new r.ConstExpr(1))))),new r.AbsExpr(new r.SubExpr(new r.RefExpr(new r.CloseExpr,new r.ConstExpr(1)),new r.LowExpr))),n));t.addAssign(o);var a=new r.AssignExpr("HD",new r.SubExpr(new r.HighExpr,new r.RefExpr(new r.HighExpr,new r.ConstExpr(1))));t.addAssign(a);var c=new r.AssignExpr("LD",new r.SubExpr(new r.RefExpr(new r.LowExpr,new r.ConstExpr(1)),new r.LowExpr));t.addAssign(c);var l=new r.AssignExpr("DMP",new r.ExpmemaExpr(new r.IfExpr(new r.AndExpr(new r.GtExpr(a,new r.ConstExpr(0)),new r.GtExpr(a,c)),a,new r.ConstExpr(0)),n));t.addAssign(l);var d=new r.AssignExpr("DMM",new r.ExpmemaExpr(new r.IfExpr(new r.AndExpr(new r.GtExpr(c,new r.ConstExpr(0)),new r.GtExpr(c,a)),c,new r.ConstExpr(0)),n));t.addAssign(d);var p=new r.OutputExpr("PDI",new r.MulExpr(new r.DivExpr(l,o),new r.ConstExpr(100)));t.addOutput(p);var f=new r.OutputExpr("MDI",new r.MulExpr(new r.DivExpr(d,o),new r.ConstExpr(100)));t.addOutput(f);var g=new r.OutputExpr("ADX",new r.ExpmemaExpr(new r.MulExpr(new r.DivExpr(new r.AbsExpr(new r.SubExpr(f,p)),new r.AddExpr(f,p)),new r.ConstExpr(100)),i));t.addOutput(g);var _=new r.OutputExpr("ADXR",new r.ExpmemaExpr(g,i));return t.addOutput(_),t}return c(e,f),p(e,[{key:"getName",value:function(){return"DMI"}}]),e}();e.DMIIndicator=b;var w=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N1",2,60,10),i=new r.ParameterExpr("N2",2,250,50),o=new r.ParameterExpr("M",2,100,10);t.addParameter(n),t.addParameter(i),t.addParameter(o);var a=new r.OutputExpr("DIF",new r.SubExpr(new r.MaExpr(new r.CloseExpr,n),new r.MaExpr(new r.CloseExpr,i)));t.addOutput(a);var c=new r.OutputExpr("DIFMA",new r.MaExpr(a,o));return t.addOutput(c),t}return c(e,f),p(e,[{key:"getName",value:function(){return"DMA"}}]),e}();e.DMAIndicator=w;var C=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,100,12),i=new r.ParameterExpr("M",2,100,9);t.addParameter(n),t.addParameter(i);var o=new r.AssignExpr("MTR",new r.EmaExpr(new r.EmaExpr(new r.EmaExpr(new r.CloseExpr,n),n),n));t.addAssign(o);var a=new r.OutputExpr("TRIX",new r.MulExpr(new r.DivExpr(new r.SubExpr(o,new r.RefExpr(o,new r.ConstExpr(1))),new r.RefExpr(o,new r.ConstExpr(1))),new r.ConstExpr(100)));t.addOutput(a);var c=new r.OutputExpr("MATRIX",new r.MaExpr(a,i));return t.addOutput(c),t}return c(e,f),p(e,[{key:"getName",value:function(){return"TRIX"}}]),e}();e.TRIXIndicator=C;var E=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,120,26);t.addParameter(n);var i=new r.AssignExpr("REF_CLOSE_1",new r.RefExpr(new r.CloseExpr,new r.ConstExpr(1)));t.addAssign(i);var o=new r.OutputExpr("BR",new r.MulExpr(new r.DivExpr(new r.SumExpr(new r.MaxExpr(new r.ConstExpr(0),new r.SubExpr(new r.HighExpr,i)),n),new r.SumExpr(new r.MaxExpr(new r.ConstExpr(0),new r.SubExpr(i,new r.LowExpr)),n)),new r.ConstExpr(100)));t.addOutput(o);var a=new r.OutputExpr("AR",new r.MulExpr(new r.DivExpr(new r.SumExpr(new r.SubExpr(new r.HighExpr,new r.OpenExpr),n),new r.SumExpr(new r.SubExpr(new r.OpenExpr,new r.LowExpr),n)),new r.ConstExpr(100)));return t.addOutput(a),t}return c(e,f),p(e,[{key:"getName",value:function(){return"BRAR"}}]),e}();e.BRARIndicator=E;var x=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,100,26),i=new r.ParameterExpr("M",2,100,6);t.addParameter(n),t.addParameter(i);var o=new r.AssignExpr("REF_CLOSE_1",new r.RefExpr(new r.CloseExpr,new r.ConstExpr(1)));t.addAssign(o);var a=new r.AssignExpr("TH",new r.SumExpr(new r.IfExpr(new r.GtExpr(new r.CloseExpr,o),new r.VolumeExpr,new r.ConstExpr(0)),n));t.addAssign(a);var c=new r.AssignExpr("TL",new r.SumExpr(new r.IfExpr(new r.LtExpr(new r.CloseExpr,o),new r.VolumeExpr,new r.ConstExpr(0)),n));t.addAssign(c);var l=new r.AssignExpr("TQ",new r.SumExpr(new r.IfExpr(new r.EqExpr(new r.CloseExpr,o),new r.VolumeExpr,new r.ConstExpr(0)),n));t.addAssign(l);var d=new r.OutputExpr("VR",new r.MulExpr(new r.DivExpr(new r.AddExpr(new r.MulExpr(a,new r.ConstExpr(2)),l),new r.AddExpr(new r.MulExpr(c,new r.ConstExpr(2)),l)),new r.ConstExpr(100)));t.addOutput(d);var p=new r.OutputExpr("MAVR",new r.MaExpr(d,i));return t.addOutput(p),t}return c(e,f),p(e,[{key:"getName",value:function(){return"VR"}}]),e}();e.VRIndicator=x;var A=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("M",2,100,30);t.addParameter(n);var i=new r.AssignExpr("REF_CLOSE_1",new r.RefExpr(new r.CloseExpr,new r.ConstExpr(1)));t.addAssign(i);var o=new r.AssignExpr("VA",new r.IfExpr(new r.GtExpr(new r.CloseExpr,i),new r.VolumeExpr,new r.NegExpr(new r.VolumeExpr)));t.addAssign(o);var a=new r.OutputExpr("OBV",new r.SumExpr(new r.IfExpr(new r.EqExpr(new r.CloseExpr,i),new r.ConstExpr(0),o),new r.ConstExpr(0)));t.addOutput(a);var c=new r.OutputExpr("MAOBV",new r.MaExpr(a,n));return t.addOutput(c),t}return c(e,f),p(e,[{key:"getName",value:function(){return"OBV"}}]),e}();e.OBVIndicator=A;var S=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,90,14),i=new r.ParameterExpr("M",2,60,9);t.addParameter(n),t.addParameter(i);var o=new r.AssignExpr("VOLUME",new r.DivExpr(new r.MaExpr(new r.VolumeExpr,n),new r.VolumeExpr));t.addAssign(o);var a=new r.AssignExpr("MID",new r.MulExpr(new r.DivExpr(new r.SubExpr(new r.AddExpr(new r.HighExpr,new r.LowExpr),new r.RefExpr(new r.AddExpr(new r.HighExpr,new r.LowExpr),new r.ConstExpr(1))),new r.AddExpr(new r.HighExpr,new r.LowExpr)),new r.ConstExpr(100)));t.addAssign(a);var c=new r.OutputExpr("EMV",new r.MaExpr(new r.DivExpr(new r.MulExpr(a,new r.MulExpr(o,new r.SubExpr(new r.HighExpr,new r.LowExpr))),new r.MaExpr(new r.SubExpr(new r.HighExpr,new r.LowExpr),n)),n));t.addOutput(c);var l=new r.OutputExpr("MAEMV",new r.MaExpr(c,i));return t.addOutput(l),t}return c(e,f),p(e,[{key:"getName",value:function(){return"EMV"}}]),e}();e.EMVIndicator=S;var k=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N1",2,120,6),i=new r.ParameterExpr("N2",2,250,12),o=new r.ParameterExpr("N3",2,500,24);t.addParameter(n),t.addParameter(i),t.addParameter(o);var a=new r.AssignExpr("LC",new r.RefExpr(new r.CloseExpr,new r.ConstExpr(1)));t.addAssign(a);var c=new r.AssignExpr("CLOSE_LC",new r.SubExpr(new r.CloseExpr,a));return t.addAssign(c),t.addOutput(new r.OutputExpr("RSI1",new r.MulExpr(new r.DivExpr(new r.SmaExpr(new r.MaxExpr(c,new r.ConstExpr(0)),n,new r.ConstExpr(1)),new r.SmaExpr(new r.AbsExpr(c),n,new r.ConstExpr(1))),new r.ConstExpr(100)))),t.addOutput(new r.OutputExpr("RSI2",new r.MulExpr(new r.DivExpr(new r.SmaExpr(new r.MaxExpr(c,new r.ConstExpr(0)),i,new r.ConstExpr(1)),new r.SmaExpr(new r.AbsExpr(c),i,new r.ConstExpr(1))),new r.ConstExpr(100)))),t.addOutput(new r.OutputExpr("RSI3",new r.MulExpr(new r.DivExpr(new r.SmaExpr(new r.MaxExpr(c,new r.ConstExpr(0)),o,new r.ConstExpr(1)),new r.SmaExpr(new r.AbsExpr(c),o,new r.ConstExpr(1))),new r.ConstExpr(100)))),t}return c(e,f),p(e,[{key:"getName",value:function(){return"RSI"}}]),e}();e.RSIIndicator=k;var T=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,100,10),i=new r.ParameterExpr("N1",2,100,6);t.addParameter(n),t.addParameter(i);var o=new r.AssignExpr("HHV",new r.HhvExpr(new r.HighExpr,n));t.addAssign(o);var a=new r.AssignExpr("HHV1",new r.HhvExpr(new r.HighExpr,i));t.addAssign(a);var c=new r.AssignExpr("LLV",new r.LlvExpr(new r.LowExpr,n));t.addAssign(c);var l=new r.AssignExpr("LLV1",new r.LlvExpr(new r.LowExpr,i));t.addAssign(l);var d=new r.OutputExpr("WR1",new r.MulExpr(new r.DivExpr(new r.SubExpr(o,new r.CloseExpr),new r.SubExpr(o,c)),new r.ConstExpr(100)));t.addOutput(d);var p=new r.OutputExpr("WR2",new r.MulExpr(new r.DivExpr(new r.SubExpr(a,new r.CloseExpr),new r.SubExpr(a,l)),new r.ConstExpr(100)));return t.addOutput(p),t}return c(e,f),p(e,[{key:"getName",value:function(){return"WR"}}]),e}();e.WRIndicator=T;var P=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ConstExpr(4),i=new r.ConstExpr(2),o=new r.ConstExpr(2),a=new r.ConstExpr(20);return t.addOutput(new r.OutputExpr("SAR",new r.SarExpr(n,i,o,a),r.OutputExpr.outputStyle.SARPoint)),t}return c(e,f),p(e,[{key:"getName",value:function(){return"SAR"}}]),e}();e.SARIndicator=P;var I=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,90,9),i=new r.ParameterExpr("M1",2,30,3),o=new r.ParameterExpr("M2",2,30,3);t.addParameter(n),t.addParameter(i),t.addParameter(o);var a=new r.AssignExpr("HHV",new r.HhvExpr(new r.HighExpr,n));t.addAssign(a);var c=new r.AssignExpr("LLV",new r.LlvExpr(new r.LowExpr,n));t.addAssign(c);var l=new r.AssignExpr("RSV",new r.MulExpr(new r.DivExpr(new r.SubExpr(new r.CloseExpr,c),new r.SubExpr(a,c)),new r.ConstExpr(100)));t.addAssign(l);var d=new r.OutputExpr("K",new r.SmaExpr(l,i,new r.ConstExpr(1)));t.addOutput(d);var p=new r.OutputExpr("D",new r.SmaExpr(d,o,new r.ConstExpr(1)));t.addOutput(p);var f=new r.OutputExpr("J",new r.SubExpr(new r.MulExpr(d,new r.ConstExpr(3)),new r.MulExpr(p,new r.ConstExpr(2))));return t.addOutput(f),t}return c(e,f),p(e,[{key:"getName",value:function(){return"KDJ"}}]),e}();e.KDJIndicator=I;var O=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,120,12),i=new r.ParameterExpr("M",2,60,6);t.addParameter(n),t.addParameter(i);var o=new r.AssignExpr("REF_CLOSE_N",new r.RefExpr(new r.CloseExpr,n));t.addAssign(o);var a=new r.OutputExpr("ROC",new r.MulExpr(new r.DivExpr(new r.SubExpr(new r.CloseExpr,o),o),new r.ConstExpr(100)));t.addOutput(a);var c=new r.OutputExpr("MAROC",new r.MaExpr(a,i));return t.addOutput(c),t}return c(e,f),p(e,[{key:"getName",value:function(){return"ROC"}}]),e}();e.ROCIndicator=O;var N=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,120,12),i=new r.ParameterExpr("M",2,60,6);t.addParameter(n),t.addParameter(i);var o=new r.OutputExpr("MTM",new r.SubExpr(new r.CloseExpr,new r.RefExpr(new r.CloseExpr,n)));t.addOutput(o);var a=new r.OutputExpr("MTMMA",new r.MaExpr(o,i));return t.addOutput(a),t}return c(e,f),p(e,[{key:"getName",value:function(){return"MTM"}}]),e}();e.MTMIndicator=N;var R=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,120,20);t.addParameter(n);var i=new r.AssignExpr("STD_CLOSE_N",new r.StdExpr(new r.CloseExpr,n));t.addAssign(i);var o=new r.OutputExpr("BOLL",new r.MaExpr(new r.CloseExpr,n));t.addOutput(o);var a=new r.OutputExpr("UB",new r.AddExpr(o,new r.MulExpr(new r.ConstExpr(2),i)));t.addOutput(a);var c=new r.OutputExpr("LB",new r.SubExpr(o,new r.MulExpr(new r.ConstExpr(2),i)));return t.addOutput(c),t}return c(e,f),p(e,[{key:"getName",value:function(){return"BOLL"}}]),e}();e.BOLLIndicator=R;var D=function(t){function e(){var t;h(this,e),t=s(this,u(e).call(this));var n=new r.ParameterExpr("N",2,100,12),i=new r.ParameterExpr("M",2,100,6);t.addParameter(n),t.addParameter(i);var o=new r.OutputExpr("PSY",new r.MulExpr(new r.DivExpr(new r.CountExpr(new r.GtExpr(new r.CloseExpr,new r.RefExpr(new r.CloseExpr,new r.ConstExpr(1))),n),n),new r.ConstExpr(100)));t.addOutput(o);var a=new r.OutputExpr("PSYMA",new r.MaExpr(o,i));return t.addOutput(a),t}return c(e,f),p(e,[{key:"getName",value:function(){return"PSY"}}]),e}();e.PSYIndicator=D;var M=function(t){function e(){var t;h(this,e),(t=s(this,u(e).call(this))).getName=function(){return"StochRSI"};var n=new r.ParameterExpr("N",3,100,14),i=new r.ParameterExpr("M",3,100,14),o=new r.ParameterExpr("P1",2,50,3),a=new r.ParameterExpr("P2",2,50,3);t.addParameter(n),t.addParameter(i),t.addParameter(o),t.addParameter(a);var c=new r.AssignExpr("LC",new r.RefExpr(new r.CloseExpr,new r.ConstExpr(1)));t.addAssign(c);var l=new r.AssignExpr("CLOSE_LC",new r.SubExpr(new r.CloseExpr,c));t.addAssign(l);var d=new r.AssignExpr("RSI",new r.MulExpr(new r.DivExpr(new r.SmaExpr(new r.MaxExpr(l,new r.ConstExpr(0)),n,new r.ConstExpr(1)),new r.SmaExpr(new r.AbsExpr(l),n,new r.ConstExpr(1))),new r.ConstExpr(100)));t.addAssign(d);var p=new r.OutputExpr("STOCHRSI",new r.MulExpr(new r.DivExpr(new r.MaExpr(new r.SubExpr(d,new r.LlvExpr(d,i)),o),new r.MaExpr(new r.SubExpr(new r.HhvExpr(d,i),new r.LlvExpr(d,i)),o)),new r.ConstExpr(100)));return t.addOutput(p),t.addOutput(new r.RangeOutputExpr("MA",new r.MaExpr(p,a))),t}return c(e,f),e}();e.STOCHRSIIndicator=M},function(t,e,n){var r=n(32);"string"==typeof r&&(r=[[t.i,r,""]]);var i={hmr:!0,transform:void 0};n(45)(r,i);r.locals&&(t.exports=r.locals)},function(t,e,n){var r=n(33);(t.exports=n(34)(!1)).push([t.i,"html,\nbody {\n    min-height: 100%;\n    margin: 0;\n    min-width: 100%\n}\n\n.chart_container {\n    cursor: default;\n    font-family: arial, sans, serif;\n    font-size: 12px;\n    height: 100%;\n    position: relative;\n    width: 100%\n}\n\n.chart_container div,\n.chart_container ul,\n.chart_container form {\n    margin: 0;\n    padding: 0\n}\n\n.chart_container a:hover {\n    text-decoration: none\n}\n\n.chart_container ul {\n    list-style: none;\n    border: 0;\n    margin: 0;\n    padding: 0\n}\n\n.chart_container button {\n    cursor: pointer\n}\n\n#chart_dom_elem_cache {\n    *font-weight: bold;\n    position: absolute;\n    visibility: hidden;\n    z-index: -1\n}\n\n#chart_toolbar {\n    border-bottom: 1px solid;\n    *font-weight: bold;\n    height: 29px;\n    position: absolute;\n    z-index: 3\n}\n\n.chart_container.dark #chart_toolbar {\n    background-color: #424242;\n    border-bottom-color: #404040\n}\n\n.chart_container.light #chart_toolbar {\n    background-color: #fff;\n    border-bottom-color: #afb1b3\n}\n\n.chart_container .chart_toolbar_sep {\n    float: left;\n    height: 100%;\n    width: 16px\n}\n\n.chart_container .chart_toolbar_minisep {\n    float: left;\n    height: 100%;\n    width: 4px\n}\n\n.chart_container .chart_dropdown {\n    display: inline-block;\n    float: left;\n    position: relative;\n    z-index: 100\n}\n\n.chart_container .chart_dropdown_t {\n    background-origin: content-box;\n    background-repeat: no-repeat;\n    border: 1px solid #6E6E6E;\n    margin-top: 5px;\n    padding-right: 10px;\n    z-index: 101;\n    position: relative;\n    border-radius: 2px;\n    height: 20px;\n    top: 1px;\n    box-sizing: border-box;\n}\n\n.chart_container .chart_dropdown_t a {\n    display: inline-block;\n    padding: 0px 12px 5px 10px\n}\n\n.chart_container .chart_dropdown_data {\n    border: 1px solid;\n    display: none;\n    position: absolute;\n    padding: 6px 8px 6px 8px;\n    margin-top: -1px;\n    z-index: 100\n}\n\n.chart_container .chart_dropdown_data table {\n    border-collapse: collapse;\n    font-weight: normal;\n    white-space: nowrap\n}\n\n.chart_container .chart_dropdown_data td {\n    border-bottom: 1px solid;\n    padding: 8px 6px;\n    vertical-align: top\n}\n\n.market_chooser .chart_dropdown_data {\n    width: 370px\n}\n\n.market_chooser .chart_dropdown_data td {\n    border-bottom: 1px solid;\n    padding: 1px 6px !important;\n    vertical-align: top;\n    line-height: 24px\n}\n\n.market_chooser li {\n    float: left;\n    width: 80px;\n    height: 24px;\n    line-height: 24px\n}\n\n.chart_container .chart_dropdown_data td.marketName_ a.dark {\n    color: #fff\n}\n\n.chart_container .chart_dropdown_data td.marketName_ a.light {\n    color: #000\n}\n\n.chart_container .chart_dropdown_data table tr:last-child td {\n    border-bottom: 0\n}\n\n.chart_container .chart_dropdown_data li {\n    white-space: nowrap;\n    display: inline-block\n}\n\n.chart_container .chart_dropdown_data a {\n    text-decoration: none;\n    cursor: pointer;\n    padding: 5px 6px 5px 6px\n}\n\n.chart_container .chart_dropdown-hover.chart_dropdown_data {\n    display: block\n}\n\n#chart_dropdown_symbols .chart_dropdown_data td {\n    padding: 8px 6px 0 6px\n}\n\n#chart_dropdown_symbols .chart_dropdown_data li {\n    display: block;\n    height: 26px\n}\n\n#chart_dropdown_symbols .chart_dropdown_data a {\n    cursor: pointer\n}\n\n#chart_dropdown_themes .chart_dropdown_data td:first-child {\n    padding: 6px 1px 7px 6px\n}\n\n.chart_container.dark .chart_dropdown_t {\n    background-image: url("+r(n(35))+");\n    background-position: right 7px;\n    /* border-color: #0a0a0a; */\n    color: #e5e5e5\n}\n\n.chart_container.dark .chart_dropdown-hover.chart_dropdown_t {\n    /* background-color: #0a0a0a; */\n    background-image: url("+r(n(36))+");\n    background-position: right 6px;\n    /* border-color: #606060; */\n    color: #fff\n}\n\n.chart_container.dark .chart_dropdown_data {\n    margin-top: 5px;\n    background: #333537;\n    border-color: #606060\n}\n\n.chart_container.dark .chart_dropdown_data td {\n    border-bottom-color: #404040;\n    color: #e5e5e5;\n    font-size: 12px;\n}\n\n.chart_container.dark .chart_dropdown_data li a {\n    color: #B6B6B6;\n}\n\n.chart_container.dark .chart_dropdown_data li a:hover {\n    background-color: #383838\n}\n\n.chart_container.dark .chart_dropdown_data li a.selected {\n    color: #ffac00\n}\n\n.chart_container.light .chart_dropdown_t {\n    background-image: url("+r(n(37))+");\n    background-position: right 10px;\n    border-color: #fff;\n    color: #393c40\n}\n\n.chart_container.light .chart_dropdown-hover.chart_dropdown_t {\n    background-color: #fff;\n    background-image: url("+r(n(38))+");\n    background-position: right 9px;\n    border-color: #4c4f53;\n    color: #393c40\n}\n\n.chart_container.light .chart_dropdown_data {\n    background-color: #fff;\n    border-color: #4c4f53\n}\n\n.chart_container.light .chart_dropdown_data td {\n    border-bottom-color: #e4e5e6;\n    color: #393c40\n}\n\n.chart_container.light .chart_dropdown_data li a {\n    color: #1478c8\n}\n\n.chart_container.light .chart_dropdown_data a:hover {\n    background-color: #f4f4f4\n}\n\n.chart_container.light .chart_dropdown_data a.selected {\n    color: #f27935\n}\n\n.chart_container .chart_toolbar_label {\n    cursor: default;\n    display: inline-block;\n    float: left;\n    padding: 7px 4px\n}\n\n.chart_container.dark .chart_toolbar_label {\n    border-color: #232323;\n    color: #e5e5e5\n}\n\n.chart_container.light .chart_toolbar_label {\n    border-color: #fff;\n    color: #393c40\n}\n\n.chart_container .chart_toolbar_button {\n    border: 1px solid;\n    cursor: pointer;\n    float: left;\n    margin: 5px 2px;\n    padding: 0px 10px;\n    position: relative;\n    z-index: 100;\n    height: 22px;\n    box-sizing: border-box;\n    border-radius: 2px;\n    line-height: 22px;\n}\n\n.chart_container.dark .chart_toolbar_button {\n    border-color: #404040;\n    color: #e5e5e5\n}\n\n.chart_container.dark .chart_toolbar_button:hover {\n    background-color: #383838;\n    border-color: #606060;\n    color: #fff\n}\n\n.chart_container.dark .chart_toolbar_button.selected {\n    background-color: #383838;\n    border-color: #606060;\n    color: #ffac00\n}\n\n.chart_container.dark .chart_toolbar_button.selected:hover {\n    background-color: #474747;\n    border-color: #808080;\n    color: #ffac00\n}\n\n.chart_container.light .chart_toolbar_button {\n    border-color: #ccc;\n    color: #393c40\n}\n\n.chart_container.light .chart_toolbar_button:hover {\n    background-color: #f4f4f4;\n    color: #393c40\n}\n\n.chart_container.light .chart_toolbar_button.selected {\n    background-color: #f4f4f4;\n    border-color: #f27935;\n    color: #f27935\n}\n\n.chart_container .chart_toolbar_tabgroup {\n    float: left\n}\n\n.chart_container .chart_toolbar_tabgroup li {\n    display: inline-block;\n    /* padding: 4px 0;\n    margin: 3px 0 */\n    height: 20px;\n    margin: 5px 0;\n}\n\n.chart_container .chart_toolbar_tabgroup li a {\n    cursor: pointer;\n    padding: 2px 4px\n}\n\n.chart_container .chart_toolbar_tabgroup li a:hover {\n    text-decoration: none\n}\n\n.chart_container.dark .chart_toolbar_tabgroup li a {\n    background: rgba(58,58,58,1);\n    border-radius: 2px;\n    color: #B6B6B6;\n    border: 1px solid #6E6E6E;\n}\n\n.chart_container.dark .chart_toolbar_tabgroup li a:hover {\n    color: #ffac00;\n    background-color: #383838\n}\n\n.chart_container.dark .chart_toolbar_tabgroup li a.selected {\n    color: #fff;\n    border: 1px solid #ffac00;\n}\n\n.chart_container.light .chart_toolbar_tabgroup li a {\n    color: #1478c8\n}\n\n.chart_container.light .chart_toolbar_tabgroup li a:hover {\n    background-color: #f4f4f4\n}\n\n.chart_container.light .chart_toolbar_tabgroup li a.selected {\n    color: #f27935\n}\n\n#chart_toolbar_periods_horz {\n    display: inline-block;\n    float: left;\n    position: relative;\n    z-index: 100;\n    margin-top: 1.5px;\n}\n\n#chart_toolbar_periods_vert {\n    float: left\n}\n\n.chart_container a.chart_icon {\n    border: 1px solid;\n    height: 16px;\n    padding: 0;\n    width: 16px;\n    box-sizing:border-box;\n}\n\n.chart_container a.chart_icon:hover {\n    border-width: 2px;\n}\n\n.chart_container .chart_dropdown_data a.chart_icon {\n    display: inline-block;\n    margin: 0 6px 0 6px\n}\n\n.chart_container a.chart_icon_theme_dark,\n.chart_container .chart_dropdown_data li a.chart_icon_theme_dark:hover {\n    background-color: #000\n}\n\n.chart_container a.chart_icon_theme_light,\n.chart_container .chart_dropdown_data li a.chart_icon_theme_light:hover {\n    background-color: #fff\n}\n\n.chart_container #chart_toolbar_theme {\n    float: left;\n    padding: 0 8px\n}\n\n.chart_container #chart_toolbar_theme a.chart_icon {\n    cursor: pointer;\n    float: left;\n    margin: 6px 4px\n}\n\n.chart_container #chart_select_theme td:last-child {\n    padding: 6px 6px 0 8px\n}\n\n.chart_container #chart_select_theme li {\n    padding: 0 4px 0 4px\n}\n\n.chart_container.dark a.chart_icon {\n    border-color: #aaa\n}\n\n.chart_container.dark a.chart_icon:hover {\n    border-color: #1987da\n}\n\n.chart_container.dark a.chart_icon.selected {\n    border-color: #ffac00\n}\n\n.chart_container.light a.chart_icon {\n    border-color: #aaa\n}\n\n.chart_container.light a.chart_icon.selected {\n    border-color: #f27935\n}\n\n.chart_container #chart_updated_time {\n    float: right;\n    margin: 4px 3px;\n    padding: 3px 10px\n}\n\n.chart_container.dark #chart_updated_time {\n    color: #e5e5e5\n}\n\n.chart_container.light #chart_updated_time {\n    color: #393c40\n}\n\n#chart_toolpanel {\n    border-right: 1px solid;\n    display: none;\n    position: absolute;\n    width: 32px;\n    z-index: 2\n}\n\n#chart_toolpanel .chart_toolpanel_separator {\n    position: relative;\n    height: 4px\n}\n\n#chart_toolpanel .chart_toolpanel_button {\n    position: relative;\n    z-index: 100\n}\n\n#chart_toolpanel .chart_toolpanel_icon {\n    background-origin: content-box;\n    background-repeat: no-repeat;\n    border: 1px solid;\n    cursor: pointer;\n    height: 16px;\n    margin: 1px 4px 1px 4px;\n    padding: 3px;\n    position: relative;\n    width: 16px;\n    z-index: 101\n}\n\n#chart_toolpanel .chart_toolpanel_tip {\n    border-radius: 4px;\n    border: 1px solid;\n    display: none;\n    *font-weight: bold;\n    position: absolute;\n    padding: 3px 6px 4px 6px;\n    margin-left: 36px;\n    margin-top: -25px;\n    white-space: nowrap;\n    z-index: 100\n}\n\n#chart_toolpanel .chart_toolpanel_button:hover .chart_toolpanel_tip {\n    display: block\n}\n\n.chart_container.dark #chart_toolpanel {\n    background-color: #0a0a0a;\n    border-right-color: #404040\n}\n\n.chart_container.dark .chart_toolpanel_icon {\n    background-color: #0a0a0a;\n    border-color: #0a0a0a\n}\n\n.chart_container.dark .chart_toolpanel_button:hover .chart_toolpanel_icon {\n    background-color: #404040;\n    border-color: #666\n}\n\n.chart_container.dark .chart_toolpanel_button.selected .chart_toolpanel_icon {\n    background-color: #080808;\n    border-color: #666\n}\n\n.chart_container.dark .chart_toolpanel_tip {\n    background-color: #ffac00;\n    border-color: #ffac00;\n    color: #0a0a0a\n}\n\n.chart_container.light #chart_toolpanel {\n    background-color: #fff;\n    border-right-color: #afb1b3\n}\n\n.chart_container.light .chart_toolpanel_icon {\n    background-color: #fff;\n    border-color: #fff\n}\n\n.chart_container.light .chart_toolpanel_button:hover .chart_toolpanel_icon {\n    background-color: #eee;\n    border-color: #afb1b3\n}\n\n.chart_container.light .chart_toolpanel_button.selected .chart_toolpanel_icon {\n    background-color: #f4f4f4;\n    border-color: #afb1b3\n}\n\n.chart_container.light .chart_toolpanel_tip {\n    background-color: #f27938;\n    border-color: #f27938;\n    color: #eee\n}\n\n.chart_container.dark #chart_toolpanel .chart_toolpanel_button .chart_toolpanel_icon {\n    background-image: url("+r(n(39))+")\n}\n\n.chart_container.dark #chart_toolpanel .chart_toolpanel_button.selected .chart_toolpanel_icon {\n    background-image: url("+r(n(40))+")\n}\n\n.chart_container.dark #chart_toolbar .chart_BoxSize {\n    background: url("+r(n(41))+") no-repeat;\n}\n\n.chart_container.light #chart_toolpanel .chart_toolpanel_button .chart_toolpanel_icon {\n    background-image: url("+r(n(42))+")\n}\n\n.chart_container.light #chart_toolpanel .chart_toolpanel_button.selected .chart_toolpanel_icon {\n    background-image: url("+r(n(43))+")\n}\n\n.chart_container.light #chart_toolbar .chart_BoxSize {\n    background: url("+r(n(44))+') no-repeat;\n}\n\n.chart_container #chart_toolpanel #chart_Cursor {\n    background-position: 0 0\n}\n\n.chart_container #chart_toolpanel #chart_CrossCursor {\n    background-position: 0 -20px\n}\n\n.chart_container #chart_toolpanel #chart_SegLine {\n    background-position: 0 -40px\n}\n\n.chart_container #chart_toolpanel #chart_StraightLine {\n    background-position: 0 -60px\n}\n\n.chart_container #chart_toolpanel #chart_RayLine {\n    background-position: 0 -100px\n}\n\n.chart_container #chart_toolpanel #chart_ArrowLine {\n    background-position: 0 -80px\n}\n\n.chart_container #chart_toolpanel #chart_HoriSegLine {\n    background-position: 0 -160px\n}\n\n.chart_container #chart_toolpanel #chart_HoriStraightLine {\n    background-position: 0 -120px\n}\n\n.chart_container #chart_toolpanel #chart_HoriRayLine {\n    background-position: 0 -140px\n}\n\n.chart_container #chart_toolpanel #chart_VertiStraightLine {\n    background-position: 0 -180px\n}\n\n.chart_container #chart_toolpanel #chart_PriceLine {\n    background-position: 0 -200px\n}\n\n.chart_container #chart_toolpanel #chart_TriParallelLine {\n    background-position: 0 -220px\n}\n\n.chart_container #chart_toolpanel #chart_BiParallelLine {\n    background-position: 0 -240px\n}\n\n.chart_container #chart_toolpanel #chart_BiParallelRayLine {\n    background-position: 0 -260px\n}\n\n.chart_container .chart_toolpanel_button #chart_DrawFibRetrace {\n    background-position: 0 -280px\n}\n\n.chart_container #chart_toolpanel #chart_DrawFibFans {\n    background-position: 0 -300px\n}\n\n#chart_tabbar {\n    border-top: 1px solid;\n    cursor: default;\n    display: none;\n    *font-weight: bold;\n    height: 22px;\n    overflow: hidden;\n    position: absolute;\n    z-index: 1\n}\n\n#chart_tabbar ul {\n    height: 100%;\n    list-style: none;\n    padding: 0 0 0 4px\n}\n\n#chart_tabbar li {\n    display: inline-block;\n    height: 100%;\n    margin: 0\n}\n\n#chart_tabbar a {\n    cursor: pointer;\n    display: inline-block;\n    height: 100%;\n    margin: 0;\n    padding: 3px 4px 0 4px;\n    overflow: hidden\n}\n\n#chart_tabbar a:hover {\n    text-decoration: none\n}\n\n.chart_container.dark #chart_tabbar {\n    background-color: #424242;\n    border-top-color: #404040\n}\n\n.chart_container.dark #chart_tabbar a {\n    color: #e5e5e5\n}\n\n.chart_container.dark #chart_tabbar a:hover {\n    background-color: #383838;\n    color: #fff\n}\n\n.chart_container.dark #chart_tabbar a.selected {\n    color: #ffac00\n}\n\n.chart_container.light #chart_tabbar {\n    background-color: #fff;\n    border-top-color: #afb1b3\n}\n\n.chart_container.light #chart_tabbar a {\n    color: #393c40\n}\n\n.chart_container.light #chart_tabbar a:hover {\n    background-color: #f4f4f4;\n    color: #393c40\n}\n\n.chart_container.light #chart_tabbar a.selected {\n    color: #f27935\n}\n\n#chart_canvasGroup {\n    position: absolute;\n    z-index: 0\n}\n\n#chart_mainCanvas {\n    overflow: hidden;\n    position: absolute;\n    z-index: 0\n}\n\n#chart_overlayCanvas {\n    overflow: hidden;\n    position: absolute;\n    z-index: 2\n}\n\n#chart_loading {\n    border: 1px solid;\n    border-radius: 4px;\n    font-size: 18px;\n    font-weight: bold;\n    line-height: 48px;\n    overflow: hidden;\n    position: absolute;\n    text-align: center;\n    visibility: hidden;\n    width: 200px;\n    z-index: 200\n}\n\n#chart_loading.activated {\n    visibility: visible\n}\n\n.chart_container.dark #chart_loading {\n    border-color: #aaa;\n    background-color: rgba(0, 0, 0, 0.6);\n    color: #ccc\n}\n\n.chart_container.light #chart_loading {\n    border-color: #afb1b3;\n    background-color: rgba(244, 244, 244, 0.8);\n    color: #393c40\n}\n\n#chart_parameter_settings {\n    border-radius: 4px;\n    border: 1px solid;\n    width: 640px;\n    position: absolute;\n    overflow: hidden;\n    visibility: hidden;\n    z-index: 500\n}\n\n#chart_parameter_settings.clicked {\n    visibility: visible\n}\n\n#chart_parameter_settings h2 {\n    padding: 8px 12px;\n    margin: 0\n}\n\n#chart_parameter_settings table {\n    border-collapse: collapse;\n    width: 100%\n}\n\n#chart_parameter_settings tr {\n    line-height: 32px\n}\n\n#chart_parameter_settings th {\n    text-align: right;\n    padding: 0 4px 0 16px\n}\n\n#chart_parameter_settings input {\n    width: 2em;\n    margin: 0 2px 0 2px\n}\n\n#chart_parameter_settings #close_settings {\n    border-radius: 4px;\n    cursor: pointer;\n    font-weight: bold;\n    text-align: center;\n    margin: 8px auto;\n    padding: 5px 24px 5px 24px;\n    width: 84px\n}\n\n#chart_parameter_settings .chart_str_default {\n    margin-right: 24px\n}\n\n.chart_container.dark #chart_parameter_settings {\n    background-color: rgba(0, 0, 0, 0.9);\n    border-color: rgba(0, 0, 0, 0.9);\n    color: #ccc;\n}\n\n.chart_container.dark #chart_parameter_settings #close_settings {\n    background: #1887da;\n    color: #eee\n}\n\n.chart_container.light #chart_parameter_settings {\n    background-color: rgba(244, 244, 244, 0.8);\n    border-color: #afb1b3;\n    color: #393c40\n}\n\n.chart_container.light #chart_parameter_settings #close_settings {\n    background: #1478c8;\n    color: #eee\n}\n\n.chart_container input,\n.chart_container button {\n    border-radius: 4px;\n    border: 1px solid;\n    padding: 4px\n}\n\n.chart_container input[type=text] {\n    width: 12em\n}\n\n.chart_container input[type=button],\n.chart_container input[type=submit],\n.chart_container button {\n    font-family: arial, sans, serif;\n    padding: 4px 8px;\n    cursor: pointer\n}\n\n.chart_container.dark input,\n.chart_container.dark button {\n    background-color: #151515;\n    border-color: #333;\n    color: #ccc\n}\n\n.chart_container.light input,\n.chart_container.light button {\n    background-color: #ddd;\n    border-color: #ddd;\n    color: #222\n}\n\n.trade_container {\n    width: 250px;\n    height: 100%;\n    float: right;\n    z-index: 99999;\n    font-size: 12px;\n    overflow: hidden\n}\n\n.trade_container.dark {\n    background: #0a0a0a;\n    color: #f1f1f1\n}\n\n.m_righttop {\n    position: fixed;\n    top: 0;\n    height: 41px;\n    line-height: 41px;\n    width: 230px;\n    text-align: right;\n    padding-right: 20px;\n    font-size: 16px;\n    color: #f78d15;\n    font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif\n}\n\n.m_righttop em {\n    width: 123px;\n    height: 28px;\n    background-position: 0 0;\n    display: block;\n    float: right;\n    margin-top: 5px\n}\n\n.dark .m_righttop em {\n    background-position: 0 0\n}\n\n.m_rightbot {\n    height: 22px;\n    line-height: 22px;\n    border-top: 1px solid #404040;\n    width: 230px;\n    text-align: right;\n    padding-right: 20px;\n    background-color: #0a0a0a;\n    border-bottom-color: #404040\n}\n\n.m_guadan {\n    margin-top: 29px;\n    overflow: hidden;\n    border-left: 1px solid #404040;\n    border-top: 1px solid #404040\n}\n\n.m_guadan a {\n    font-weight: bold;\n    color: #FFF;\n    text-decoration: none\n}\n\n.light .m_guadan {\n    margin-top: 29px;\n    overflow: hidden;\n    border-left: 1px solid #afb1b3;\n    border-top: 1px solid #afb1b3\n}\n\n#orderbook #asks,\n#orderbook #gasks,\n#orderbook #bids,\n#orderbook #gbids {\n    height: 195px;\n    position: relative;\n    display: inline-block;\n    overflow: hidden\n}\n\n.symbol-title {\n    font-size: 14px;\n    font-weight: bold;\n    text-align: center;\n    height: 16px;\n    line-height: 16px;\n    font-family: Arial, sans, serif;\n    padding: 5px\n}\n\n.symbol-title .dark {\n    color: #6BF\n}\n\n.symbol-title .infoDepth {\n    margin-left: 8px;\n    color: #f78d15\n}\n\n.symbol-title a:hover {\n    text-decoration: underline\n}\n\n#asks,\n#bids {\n    width: 150px\n}\n\n#orderbook {\n    padding-left: 3px;\n    border-bottom: 1px solid #222;\n    padding-bottom: 2px;\n    margin-left: 5px;\n    margin-bottom: 2px\n}\n\n#orderbook .table {\n    position: absolute;\n    border-collapse: collapse;\n    padding: 0;\n    margin: 0\n}\n\n#gasks .table,\n#asks .table {\n    bottom: 0\n}\n\n#orderbook .table .row {\n    padding: 0;\n    margin: 0;\n    height: 13px;\n    line-height: 13px;\n    font-family: Consolas, monospace\n}\n\n#orderbook .table .row {\n    line-height: 13px\n}\n\n#orderbook .table .g {\n    color: #666\n}\n\n#gasks,\n#gbids {\n    width: 80px\n}\n\n#gasks .amount,\n#gbids .amount {\n    float: right\n}\n\n#gasks .price,\n#gbids .price {\n    float: left;\n    text-align: right\n}\n\n.price {\n    margin-right: 10px\n}\n\n.price h {\n    visibility: hidden\n}\n\n.price g,\n.amount g {\n    color: #666\n}\n\n#price {\n    text-align: center;\n    font-size: 16px;\n    font-weight: bold;\n    height: 25px;\n    line-height: 25px\n}\n\n.trade_container .green {\n    color: #0F0\n}\n\n.trade_container .red {\n    color: #F00\n}\n\n.trade_container.dark #orderbook div.table div.remove g,\n.trade_container.dark #orderbook div.table div.remove span {\n    color: #444\n}\n\n.trade_container.light #orderbook div.table div.remove g,\n.trade_container.light #orderbook div.table div.remove span {\n    color: #ddd\n}\n\n.trade_container.dark #orderbook div.table div.add {\n    display: none;\n    background-color: rgba(238, 238, 238, 0.2)\n}\n\n.trade_container.light #orderbook div.table div.add {\n    display: none;\n    background-color: rgba(100, 100, 100, 0.2)\n}\n\n#trades {\n    overflow-y: auto;\n    text-align: left;\n    color: #666;\n    padding-top: 5px\n}\n\n.trade_container.light {\n    background: #fff;\n    border-left: 1px solid #afb1b3;\n    color: #000\n}\n\n.trade_container.light .m_righttop em {\n    background-position: 0 -32px\n}\n\n.trade_container.light .m_righttop {\n    position: fixed;\n    top: 0;\n    height: 40px;\n    line-height: 40px;\n    background: #FFF;\n    width: 230px;\n    border-bottom: 1px solid #afb1b3;\n    text-align: right;\n    padding-right: 20px\n}\n\n.trade_container.light #trades.trades table {\n    color: #333\n}\n\n.trade_container.light #trades.trades .v {\n    color: #333\n}\n\n.trade_container.light #trades.trades .v g {\n    color: #333\n}\n\n.trade_container.light .m_rightbot {\n    background: #fff;\n    border-top: 1px solid #afb1b3\n}\n\n.trade_container.light #orderbook {\n    border-bottom: 1px solid #afb1b3\n}\n\n.trades_list {\n    padding-left: 25px\n}\n\n.trades_list ul {\n    width: 200px;\n    height: 14px;\n    line-height: 14px;\n    text-align: left;\n    list-style: none;\n    clear: both;\n    zoom: 1;\n    margin: 0;\n    padding: 0\n}\n\n.trades_list ul li {\n    height: 14px;\n    line-height: 14px;\n    color: #999;\n    font-size: 12px;\n    list-style: none;\n    float: left;\n    *display: inline;\n    margin: 0;\n    padding: 0;\n    font-family: Consolas, monospace\n}\n\n.trades_list ul li.tm {\n    width: 62px;\n    color: #999\n}\n\n.trades_list ul li.pr-green {\n    width: 65px;\n    color: #6c6\n}\n\n.trades_list ul li.pr-red {\n    width: 65px;\n    color: #c66\n}\n\n.trades_list ul li.vl {\n    width: 60px;\n    color: #ccc\n}\n\n.trades_list ul li.vl g {\n    color: #666\n}\n\n.trade_container.dark .trades_list ul.newul {\n    display: none;\n    background-color: rgba(238, 238, 238, 0.2)\n}\n\n.trade_container.light .trades_list ul.newul {\n    display: none;\n    background-color: rgba(100, 100, 100, 0.2)\n}\n\n.light .trades_list ul li.tm {\n    color: #333\n}\n\n.light .trades_list ul li.pr-green {\n    color: #6c6\n}\n\n.light .trades_list ul li.pr-red {\n    color: #c66\n}\n\n.light .trades_list ul li.vl {\n    color: #333\n}\n\n.light .trades_list ul li.vl g {\n    color: #333\n}\n\n.container .nav {\n    margin: 0;\n    list-style: none;\n    padding: 0 0 0 3px;\n    height: 41px\n}\n\n.container .nav li {\n    display: inline-block;\n    margin-right: 9px\n}\n\n.container a {\n    text-decoration: none;\n    color: #6BF;\n    font-family: Arial, sans, serif\n}\n\n.container a:hover {\n    text-decoration: underline\n}\n\n.container a.active {\n    color: #FC9\n}\n\n.container span {\n    margin-left: 3px;\n    font-family: Consolas, monospace;\n    color: #ccc\n}\n\n.light .container span {\n    color: #333\n}\n\n.light .container a {\n    text-decoration: none;\n    color: #1478c8;\n    font-family: Arial, sans, serif\n}\n\n.chart_BoxSize {\n    width: 20px;\n    height: 20px\n}\n',""])},function(t,e){t.exports=function(t){return"string"!=typeof t?t:(/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),/["'() \t\n]/.test(t)?'"'+t.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"':t)}},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),o=r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"});return[n].concat(o).concat([i]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},i=0;i<this.length;i++){var o=this[i][0];"number"==typeof o&&(r[o]=!0)}for(i=0;i<t.length;i++){var a=t[i];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAFCAYAAABmWJ3mAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAJn2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgICAgICAgICAgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iCiAgICAgICAgICAgIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiCiAgICAgICAgICAgIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIgogICAgICAgICAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyI+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDxleGlmOlBpeGVsWERpbWVuc2lvbj42PC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6Q29sb3JTcGFjZT42NTUzNTwvZXhpZjpDb2xvclNwYWNlPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+NTwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAgICAgIDxkYzpmb3JtYXQ+aW1hZ2UvcG5nPC9kYzpmb3JtYXQ+CiAgICAgICAgIDx4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ+eG1wLmRpZDoxZjBjZTZmNC1lNGU1LWM4NDctYjI5OC00Y2Q2NGJjMGRjMDY8L3htcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD4KICAgICAgICAgPHhtcE1NOkhpc3Rvcnk+CiAgICAgICAgICAgIDxyZGY6U2VxPgogICAgICAgICAgICAgICA8cmRmOmxpIHJkZjpwYXJzZVR5cGU9IlJlc291cmNlIj4KICAgICAgICAgICAgICAgICAgPHN0RXZ0OnNvZnR3YXJlQWdlbnQ+QWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKTwvc3RFdnQ6c29mdHdhcmVBZ2VudD4KICAgICAgICAgICAgICAgICAgPHN0RXZ0OmNoYW5nZWQ+Lzwvc3RFdnQ6Y2hhbmdlZD4KICAgICAgICAgICAgICAgICAgPHN0RXZ0OndoZW4+MjAxNC0xMi0wM1QxNzo1Njo1MiswODowMDwvc3RFdnQ6d2hlbj4KICAgICAgICAgICAgICAgICAgPHN0RXZ0Omluc3RhbmNlSUQ+eG1wLmlpZDozNjIzYmJlYi1iNGU2LWNhNDktOTRjZi05MTIyY2Q1Y2NiZTk8L3N0RXZ0Omluc3RhbmNlSUQ+CiAgICAgICAgICAgICAgICAgIDxzdEV2dDphY3Rpb24+c2F2ZWQ8L3N0RXZ0OmFjdGlvbj4KICAgICAgICAgICAgICAgPC9yZGY6bGk+CiAgICAgICAgICAgIDwvcmRmOlNlcT4KICAgICAgICAgPC94bXBNTTpIaXN0b3J5PgogICAgICAgICA8eG1wTU06SW5zdGFuY2VJRD54bXAuaWlkOjM2MjNiYmViLWI0ZTYtY2E0OS05NGNmLTkxMjJjZDVjY2JlOTwveG1wTU06SW5zdGFuY2VJRD4KICAgICAgICAgPHhtcE1NOkRvY3VtZW50SUQ+eG1wLmRpZDo2QzE5MkVEOTY1N0UxMUU0QUUwMkE5RkYyNDYyQTBBODwveG1wTU06RG9jdW1lbnRJRD4KICAgICAgICAgPHhtcE1NOkRlcml2ZWRGcm9tIHJkZjpwYXJzZVR5cGU9IlJlc291cmNlIj4KICAgICAgICAgICAgPHN0UmVmOmluc3RhbmNlSUQ+eG1wLmlpZDo4MzE3OTEwZi1kOTE5LTY4NDAtYWVhOS0zNzI5NWE2NGI1NmU8L3N0UmVmOmluc3RhbmNlSUQ+CiAgICAgICAgICAgIDxzdFJlZjpkb2N1bWVudElEPnhtcC5kaWQ6MWYwY2U2ZjQtZTRlNS1jODQ3LWIyOTgtNGNkNjRiYzBkYzA2PC9zdFJlZjpkb2N1bWVudElEPgogICAgICAgICA8L3htcE1NOkRlcml2ZWRGcm9tPgogICAgICAgICA8eG1wOk1ldGFkYXRhRGF0ZT4yMDE0LTEyLTAzVDE3OjU2OjUyKzA4OjAwPC94bXA6TWV0YWRhdGFEYXRlPgogICAgICAgICA8eG1wOkNyZWF0ZURhdGU+MjAxNC0xMi0wM1QxNzo1NjoyOCswODowMDwveG1wOkNyZWF0ZURhdGU+CiAgICAgICAgIDx4bXA6TW9kaWZ5RGF0ZT4yMDE0LTEyLTAzVDE3OjU2OjUyKzA4OjAwPC94bXA6TW9kaWZ5RGF0ZT4KICAgICAgICAgPHhtcDpDcmVhdG9yVG9vbD5BZG9iZSBQaG90b3Nob3AgQ0MgKFdpbmRvd3MpPC94bXA6Q3JlYXRvclRvb2w+CiAgICAgICAgIDxwaG90b3Nob3A6Q29sb3JNb2RlPjM8L3Bob3Rvc2hvcDpDb2xvck1vZGU+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgqC9xe+AAAAWUlEQVQIHWO8cOHCFgYGBm8gRgZbmRgZGXOBIj+QRH8wMTHlMenr69////9/J0wCxNbT07vHCBK4f/8+x8ePH6+B2Pz8/FqKioo/mEAcEAOoEmRkHogNEgMA0qYfb8X3frQAAAAASUVORK5CYII="},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAFCAYAAABmWJ3mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA21pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoxZjBjZTZmNC1lNGU1LWM4NDctYjI5OC00Y2Q2NGJjMGRjMDYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6M0E5Qjc0ODc3QUQ0MTFFNDhCN0ZBNEVBQTM1QTBFNjgiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6M0E5Qjc0ODY3QUQ0MTFFNDhCN0ZBNEVBQTM1QTBFNjgiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjM2MjNiYmViLWI0ZTYtY2E0OS05NGNmLTkxMjJjZDVjY2JlOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo2QzE5MkVEOTY1N0UxMUU0QUUwMkE5RkYyNDYyQTBBOCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PvrZrC8AAABOSURBVHjaYvz//z8DCFy8eNEbSDHq6+tvAfEZQRJAQQ4g+xoDBGgBJX8wQTkVQKwIxRVgHRcuXFCEquaAKvoBxNogHZORBBmg7EkAAQYAImEV+46peUgAAAAASUVORK5CYII="},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAFCAYAAABmWJ3mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3FpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoxZjBjZTZmNC1lNGU1LWM4NDctYjI5OC00Y2Q2NGJjMGRjMDYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NkMxOTJFRDk2NTdFMTFFNEFFMDJBOUZGMjQ2MkEwQTgiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NkMxOTJFRDg2NTdFMTFFNEFFMDJBOUZGMjQ2MkEwQTgiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjgzMTc5MTBmLWQ5MTktNjg0MC1hZWE5LTM3Mjk1YTY0YjU2ZSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoxZjBjZTZmNC1lNGU1LWM4NDctYjI5OC00Y2Q2NGJjMGRjMDYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5MkIK1AAAAPklEQVR42mJ0CUvewsDA4M2ACrYyAYlcIP6BJAhi54Ek7gNxJ5IEiH2PCcrpgCq4D2UzsCBpBxnJCDMWIMAAVuANgw9cJ2UAAAAASUVORK5CYII="},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAFCAYAAABmWJ3mAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADcWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS41LWMwMTQgNzkuMTUxNDgxLCAyMDEzLzAzLzEzLTEyOjA5OjE1ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjFmMGNlNmY0LWU0ZTUtYzg0Ny1iMjk4LTRjZDY0YmMwZGMwNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo2QzE5MkVEOTY1N0UxMUU0QUUwMkE5RkYyNDYyQTBBOCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo2QzE5MkVEODY1N0UxMUU0QUUwMkE5RkYyNDYyQTBBOCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6ODMxNzkxMGYtZDkxOS02ODQwLWFlYTktMzcyOTVhNjRiNTZlIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjFmMGNlNmY0LWU0ZTUtYzg0Ny1iMjk4LTRjZDY0YmMwZGMwNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkyQgrUAAABCSURBVBhXY3QJS2aAAh8g/g/EW0EcJhABBBxAPAmIJ0PZcIkKIFaEYhAbLKEExOUgDhSA2IogCZARYO1QAGQzTAYAPbkH1E4jJr8AAAAASUVORK5CYII="},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAFACAYAAAC1CvwiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoxZjBjZTZmNC1lNGU1LWM4NDctYjI5OC00Y2Q2NGJjMGRjMDYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6N0EwQTE5MkI4MTFEMTFFNEI4Njg4OEVFQzVGMTEyOTIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6N0EwQTE5MkE4MTFEMTFFNEI4Njg4OEVFQzVGMTEyOTIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjYzNEUzRUIyODExOTExRTRBNkJDQzhDODM5MEQxQTkwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjYzNEUzRUIzODExOTExRTRBNkJDQzhDODM5MEQxQTkwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+VsD84AAABMxJREFUeNrsXEloFEEU7QztBgoKkmgueogajSQRBEEQJ3jITVDUgxL1YoggHlSU6MHlKkEQ3FFREEEviogexJlTDqIxcQl60Is4oujFDVFhfN+p1kqlu7ZZMhN+w6My1f1fVXf9ev2r+6eDfD4fRMhkMpeBaXKdCalg5NYFPMpms0sDy62OWKINhtGPn8ABoC+dTud1BKmE+onAUeAOSBt8CKKtExgESafrKagb1fcB+3FKv1x68K8hYA/Qj0aafAiijUZnACRdUUVoYfQbuA8MAy+BF8BzG4LPwARgCtCLcx9wGYVXwHLgqvjd6zKMGWAZWqRunhF1a3HeC2wITtHYw/gT/UD5AMWQOG6v0Q/iNrTcI4jJvZtA+sZ1GK8AX4V773J1ZTqNLyjOi16ccD4Fp+lcmwRavYM+Zlw10XljghIQ1NFQafa3k6xr5kkH+8H48AOWtDEgGBUGuQSVYoLl5b8r6wfofqu43QcuMZJsfARYAiEZdOqBZHxINrYNMBKNjQQmYy2BjXEiga1xLIGLcVy0HhkfhPGQ7Y1FPYd2W+NCWKr4tuvcKHouhIaVCktaOQlw4etRvE95GpPHngUafVR5xFyxVST1oP+y5iPlJXVlW00cUsK7uirVRO3Vtlmx+IhL6UbBdLW1BD5qLKvyLJSnfYwjTXwHNMD4A0taBQkw7ItQbAXmWhMIo/UCLaK6L3RoeAP5ilJ30TVOpOcoPeLnMHynJeWoxrOlh1PXrZc8irhQDw4D1zhO5DiR48SaeZ5oiJvqqfQV1chjt1cmTtRNNBdZj52lJkUyx0y+EWr5I1XbmIk1kTWRCZig/ASqeyet4HTvWNKRkSDLOt0bbad56Pjkgv2ACZiACewjFJunV6MIrLRPF2AoPejgCIUJmIAJakMTVfEJZSPaCWRMrcrHO2tibA9cNVE+nv2ACaqDgPPSqjqtzHbtXPTStzRPsopZO7MncoIjE5SDALMvJ8SjMfpbEpTYurgZmHOpCzVakLOpS+xBXKtOPVBbjLsGVTSMscPjShAZCbL+omQdZOucCWLHmKdzrROY3vpp8xMtjEfnJ9omtankYdJ6UDbWkVvfXIk8akAmD6VueT1TC5OywZVzTiQPA807VhP53w3q2paguq3ADaBdt98rP1EeSufwVu2ZU4ykzT8wvWvX5h+Y3nhrc/dN+YmmiWWTn6h9F8+ayJrImlikJkbgnG3O2WZNLLUmOhrH5ycmGetmaWg7hZMEN6UTzKIfxtlqYuLOymui7VBqPZHzEz2f6vLb/zHOjCs+sc3mFanoUaYspzBOXlxn2JXZlVnSKkSAEZmB4gKwG6PxWt5ne2vbCdxWjbUxUsztblJ5XNn34qGHZDvZ650r6ueh2AfcSgqyiPgccAkXLqvUbwZWAcew72HSKGwEcorx/KDwr4nTgW1kHDsKOHAOijVAt/hNn/vaAqwUrQ7oojSasseBezjwJn43B4UPbD2h9QHqvpv8YHVQ+DbaXRhTD1YEhe/Gxa0b6LtZzfLSd6a4cPQtrE3AY9HqD7F/KorFAMWS9F+mRDAcLX1HxYrAW6BNGC0EiOgZ8JRKEH8bcQpKpugO4KMwoI+tnVS/FSc/Q4nz8W7T9/LU1bt3sitrYhD8EWAAdoU1AmCjen8AAAAASUVORK5CYII="},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAFACAYAAAC1CvwiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoxZjBjZTZmNC1lNGU1LWM4NDctYjI5OC00Y2Q2NGJjMGRjMDYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NjI0MkEyMUI4MTIwMTFFNDgxNjhGRjc0RjJGMjMwQkQiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NjI0MkEyMUE4MTIwMTFFNDgxNjhGRjc0RjJGMjMwQkQiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjZDNzdDQUY4NjU3RTExRTRBRTAyQTlGRjI0NjJBMEE4IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjZDNzdDQUY5NjU3RTExRTRBRTAyQTlGRjI0NjJBMEE4Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+s3AxtQAABPZJREFUeNrsXE1oHkUYnvkYq0IFC5ImubRI1WolSUEoFIqWHnIr6KqHStWLtaceJFhyUryG4ElKf8RaKELNYkFETyYXPYhNW3+CHtqL+NX+XdoKxQrTZ3bny7ffdv43+Wziu/BssrP7Pjs7M++z7+683zIpJVvEDDsBPNJT5kGL9S57gTMs58+xwKVlKHsC+A4kEwBPIVDLGmAK+Bok61MIOss4cA4k46kEahnUNZkCHkghUItqiwnge5BsSiHoLKp35kGyt1MgAoz+Bb4FFoDfgd+AX0MIbgDqmh8GJlkm52Ma8QKwHfhMb0/G9MIssA1nVNU8rMtewnU/FUJwqOj7TF4vtjL5A9bn9XHvGrtHOYRzyfl+TfwPsAmkf8R240nglh7e79R3+rsxkzdRi481wUfxl5DojauGIOez//s2WBEEHLcyV1eNFbJu95Od7nsfyGPvjdSN/804IElrTCCiLXIum9cgk7xA/8dBzkf07T6hDUrjD4CtqH5XZIKC6hk2ApwGxur7Ghn7CTzGboIAYztBoLGZIML4XoKu8WjoI4+oj+3iZpLJ88HjA2eTlRrImAeuJbmxCJOLkqgutyZ29WEA68utRGMlLkeAYRY7cOq+IlKkvEfWAs9qHe596IWywazDXSRJeY87N9REEdzaVkEJbO1lFpSA1vYpUqe14wRVi+pgrJTXe+ESsB5nvkKa2E9NzPkzWL8JbBSRRq9obNGl0zE1eBV4r1b2SWycqN7m7NdbCxg7W1qRUj5UeTn1eXgjdn3l/UIfcv4X/j8VpsoUJ1KcSHHi/U5QxomsWZyY86HGcWIj4zgCi5f6ojR/zJQaofYhUg2MmURyhGptA9JE0kQioGjdJ6j6Jey9Q9k+x/LColFJNhf77Bzk5rH3BfJGIiACInBoYqD2uUW1qn0BKQNuVVaT0RShEAEREMHK0MTa8WmaWDk+XhONNYjVxMrxpIlEsBIIKD+xPwR2PQjUypZX+zwiu8yTdSFaSRmSlOBIBMvhjTlvax0YXvy/qw3mMoMHtmPKXK8D2yFlwiNpw9ZtTeZTpLazDe4LXxDGxqlfe9A46BgpspzPNJP1TL4cT2Dqd1KkFU+gpgxzfhoYs+wfULf/ltW4mndi3l/kJwpHMLHVYdwhvyRsz4M9xg7y8EasBlwV8mpeWtI7NeGdoPWRO+dYg3JxUo31/l53TunK6JmdWs3ifMEwQsPzE23DO2jG25m778tP9OZkqcaaYQOOgNs5F0+qTJpImthUE43ORDnblLNNmpisicmRifl3LLYzO7xUBLuwRXBbLsFs/jIuwEtFYFjj+B1LQ02knG1G+YmMMuOW5O2+CE4bsRzXeIJiFYwDEZt7syrbgIYySVrfCHK+DvgCeDy1BgeAr9CVF9OHMmMP+h+6ljzd2N0uyvahtDnXnKtPoh0EvhQO9uPAp2i4uVr568Au4EPs+9HWC3uAds34SVb+NPFR4C1lbO6FnG/A+kVgn95Wn/t6A3hen3XePg7KT7xNFNXP5FVsb9ZnXQu8bfpeWL0Gu1n5bbRvYKxqsAOYtjx0qM9ebe7qQc4fw/ooK7+F9RpwtngqyeRtvV/V4llAxc/qV6aKYKEkMMWKjP0JjGqjpwFF9Avwc/E3k393Fal8iKhmyR8DrmmDn5j6yFom79hE1TTG98EgSOvMlxCR7EqiythdAQYAbEvqZUahHBUAAAAASUVORK5CYII="},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABC0lEQVQ4T7WTYVEDMRSEv1VAJYCDOmgdgAPAASigKGhx0CoACcUBEsDBVcFj9ibpvF6TDn/IzM0kL9l9t5usImIFvHA6niVtcikinoB1qg3AmyIiSnEslPle0n5CsAT8eZjsChgqwaEUtpIeJ39zsoyILXAPjJhK8Apcl40uSQLvgG9LPxJIWqUDZyQZLOmhemcC6/mqmlskU7A1RYT9mKultwDuLEvSEBE2+MOdp+ebBKXDzOBLhnrvfwiKhFvgJkl4b13xJRN3VXPH2Dmw6F3jEVw9mJLka/RTzg/pDNwiAX7yQ7LbM6ALbpCMGEvwZAwGUBP42QnTIoXJDQ8mcJxrumqjv8TZYdr8Ai/uwaXkPGIcAAAAAElFTkSuQmCC"},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAFACAYAAAC1CvwiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoxZjBjZTZmNC1lNGU1LWM4NDctYjI5OC00Y2Q2NGJjMGRjMDYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OEI1Q0Q4QzI4MTIxMTFFNEFGNzk4NUQxNjVEMjU2RTYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OEI1Q0Q4QzE4MTIxMTFFNEFGNzk4NUQxNjVEMjU2RTYiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkMwNTdERDc2N0U4RDExRTRCOUQ1Q0FDNDRFM0JBN0QwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkMwNTdERDc3N0U4RDExRTRCOUQ1Q0FDNDRFM0JBN0QwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+R+XfywAABNVJREFUeNrsXEloFEEU7QztBgoKkmgueogajSQRBFEMJnjITVDUgxL1YogXDypK9OBylSAI4r6CCOpBEdGDOAEhB9GYuIR40Is4QdGLG6LC+H6mWsua7lq6Z8aZ8Bsela7u/7q669ebX10/7WWzWS/A0uWtl4Apcp0JKe/frQN4vKylbbFnuVURS7DBMNj5AewDevoepLM6glRE/XjgMHAHpDVxCIKtHRgASbvrLagb1fcAe3FLP11a8OdCwC6gDxepi0MQbNQ7/SDpCCp8C6NfwH1gCHgJDAMvbAg+AeOASUA37r3fpRde0TMFroj9bpduTANLcEVq5klRtwb3Pc+G4Dj1PYw/0g7KhygGxXm7jX4QtuHKXYKY3LsOpG9cu/Ey8EW49w5XV6bb+IzirGjFMedbcBrOlUmg1TvoY9pVE503JigAQRV1leZ4M8m6Zpy0sR+MDT9gSUtO4Lsa5IVBLkGlGGBZ+e/S+gGa3yh+7t2fgTA+BCyCkAw4tUAyPiAb2wYYkcZGApOxlsDGOJLA1jiUwMU4LFoPjPfDeND2h0W9h2Zb49FN9W3XsZF4LPiGmQprYjE0UXK6ahTvUjGNyWNPAbV+TONgrIzYKpJ60l9ZiyPlBXVlW00cVMK7qjLVRO3TtpmxxBGXwvWC6WlrCeKosazKM1CeiGMcDOcRoAbG71kTS6iJ6PYFKLYAs61bIIzWCTSI6h6XFqwnX1HqzrvGifQepUvsDsF3GlKOajxTejl1zXrKo4gLteAgcJXjRI4TOU6smPeJhripmspYLZA8dltp4kTdQHOR9dBRalIkc8wUN0ItfqRqGzOxJrImMgETFJ9Ade+oGZxujaU1MBJkvU6/jbbD3Hd8c8F+wARMwAT2EYrN26s8Aivts32HMroYzREKEzABE1SEJqri48tGdBBIm64qn++siaEtcNVE+Xz2AyYoDwLOSyvrtDLbuXPiqW9h3mQlmTuzJ3KCIxMUgwCjLyPEozb4WxKU0LqwEZhxqfM1WpCxqYtsQdhVnVqgXjHsGZRRN4Z2j6sqB0ZEBlxPJOsgW+tMENrHPJwrhEA3nLWrftr8RAvj/PxE26Q2dd3Zj5oPysY6cusfVyIPLiCT+1KzYr1T86OywZV7jiT3Pc0aq4l8dIO6NkWobiNwA2jWHY+Vnyh3pXN4q7bMKUbS5h+Y1tq1+QemFW9t7r4pP9E0sGzyE7Vr8ayJrImsiQk1MQDnbHPONmtioTXR0Tg8PzHKWDdKfdshHCW4KZ1gJn4ZZ6uJkQdLr4m2Xal1Zc5PjDmcefX/P2fGJU9ss1kiFS1KF+UWxsjCdZpdmV2ZJa1EBOiRaSjOATvRG6/lY7Y/bduB26qxKVJVmzahOK4c9+GhhWQ7MdaaK+rnoNgD3PI17BeAi3hwvUr9JmAlcATHHkX1wgYgoxjP9XL/mjgV2ErGob2AE2ehWA10in363NdmYIW4ar8uSqMhexS4hxNvYr/ey31g6ynND1D3zeQHq7zct9Huwpha0OLlvhsXNm+g72bVy1Pf6ShOe7lvYW0EnoirfhfHJ6NYCFAsSf9lSgRDwdQ3L1YE3gJNwmg+QETPgWdUgvirPHdWM0XPAB+EAd3/sPqtOPkdSpiPd5q+l6fO3mMnu7Imet5vAQYAtaODAARZxFkAAAAASUVORK5CYII="},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAFACAYAAAC1CvwiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoxZjBjZTZmNC1lNGU1LWM4NDctYjI5OC00Y2Q2NGJjMGRjMDYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OEY5QjlCQTA4MTIyMTFFNEIwQUVBMkM3NjgwODE3OTYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OEY5QjlCOUY4MTIyMTFFNEIwQUVBMkM3NjgwODE3OTYiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkMwNTdERDdBN0U4RDExRTRCOUQ1Q0FDNDRFM0JBN0QwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkMwNTdERDdCN0U4RDExRTRCOUQ1Q0FDNDRFM0JBN0QwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+2tcnMAAABOxJREFUeNrsXDtoFUEU3SzjDwwoiNE0WsS/aAQ/IIiKRTpBUQvBT+MPxEKDEhs1hU0IVvEHahREUAtBRCu10UI0RtSghTbiE39NoiAqPM9NZnWzmZm9My/vaeIdOGx2svfs7Myds3d37tuoWCxGCbqbFl0AqtN1eYij/mUT8Kjn4OKFEbPEhrppwD2QNAJVIQRURgItwE2Q1IQQJKUB6ARJQygBlUm6JS3AiBACKtQXjcB9kNSFECSFRqcDJJuSCsUw+gncBrqAl8AL4DmHoBugax4DNFUffdDh04mvgKXAJb3f5DMKd4AlOCM185SuW4vrnsEhOEFjD+PPtIPtA2ye6OP2G4eHJoSr4Mw7NfF3oA6kb3yH8SLwRbv3Xm9Hwhl7sDmjW9HmfQmhs3G4EGAI7/zvfTA0CKpwK3MNVT3JumOerHTe94jc994ow/hX/EAkrXQC5WsAnSyW3ALMwipC5f0AzZ+nb/f+faCNm4EFaH6nVx+kjA+njVkELmPOrc1p7CTgGFsJuMZGAh/jAcOYMj4E4yfcG0vWk+q5xn0BMQhSN5KizwPXoNxYlGmKiqiWWRNTTjcRm/dxoDF57GmgNg40TubKO8U0yo71H1njuKvL3cs/Cvqare6uQqR8UDVRsXvbVri9XV5B4fR2niIlHeYnqFqV6SXLSR8pz7bgHVAD4w+iiRXURAz7bGy2AlOVp9F6jTm6utWnBRvIVzJ153zjRHqPslPvdsF35sQexuTuk1Mvp66ExonUgiPAZe6LKIkTJU6UOPGfJtBxYlgnpjx2V8lxYlyCcadXH9hmaV6Ulh8zhUao5Y9UuTGTCo1QRRNFE4VACHwUqZ+LJi9hTdPZtsayIjHSZHdzn1xDnmJ97wsyG4VACISAH6HYtM8pqmnt46QMOFW5dzFaIhQhEAIh+CtxIjcetAVeQZqYPt5bE40t8NXE9PGiiUIwBAgkP7FScaJND7haGedpX57IlnexjqWVkiEpCY5CUIbZiNlX0DpQm/yd0gZjnWkGFnzqXK8DC5w6lSNptbb9hCxPkQquPvg35oIydU722ll+kBgRGXC1JFkH2TpvAlMPiyINSUHJTCTnqp8zP5Fh/Ds/UTmCiQUOY3N+Yvp5MG3sImd3YjrgGrDuHJrUljw7OxdoOfmJ1jVWzuqvYhi7hrK533QOGUrvlR3UzwOuAfXecaLpstj5ic78g7z8RFeH5uYn5o0GJz/RuRYvqiyaKJqoC2bjfI7y2BCkidZnZ8nZlpzt/1gT40BjsybajF2zVHGnsE1wY5dglvwyjquJnLCmQprIHUqnK0t+YvgLCFn9L5MmVubtvuKmjdiOK3mBYhj4gfLNvRmOfSCuLJIWVeq3fRiR8dicBfZhNF6HtGAPcCNr7OXKKKNyH7oGPd04p1/IdnTQmivq6ZNoB4DrysHeDpxHx93N1G8GVgHH8L+HtlHYCBQyxtOjvp8mjgO2kbFxFHDgFGzWANv1Pn3uawuwXJ+1w+oH+hNv9Fmzdhz4Efsz9VnHAjtM3wvLtmB11PdttFswphYsA1otzw303ayZ6UffCVHfT0/b9IPoY32t3/T/qRVzAYol6VemRNDVKyiG4aKPCr0F5mujWQARPQOe0hbEX/tdQiZLfjfwSRvQx9aO4/8/bKJq8vHtMGBpnfESfJJdRVSj6JcAAwDMequ4kXXO2QAAAABJRU5ErkJggg=="},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABKElEQVQ4T7VTwU0DMRCcrYArwby9j3QQOoAOgA5CBYQKCB0kFUAJoQMe9v/o4JD8X7SWfVo5vhMfLJ1krT3jm9kdYuY9gGeYJSJPMcaDrXnvd0T0amoTgDdiZinFXCj7cwjhbAmY+QaAfrp2AK4ATJXgRwsicowxPlpgu/feH4noHkDGVIIXEXF6sEZSwSJyIqJRpc8EIYS9uXDxJxYcY3yo3lEx56tq7pG0YJWlnojIhnp6C+AupeTGcZyYeRKRD325vd8l0EvOuUHBa4bq2f8QFAm3KaVrI+G91+I1E09V84KxGyLaLrVxBlcPWpK5jWWU7SBdgHskRPRtB0ndHnTCeq1qQlVHOWNUgm5yMADUBH4uhGlrwjRoHpRA41zTlc//GGcN0+EXyGXo9iBlz1cAAAAASUVORK5CYII="},function(t,e,n){var r,i,o={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=r.apply(this,arguments)),i}),s=function(t){var e={};return function(t){if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),u=null,c=0,l=[],h=n(46);function d(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=o[r.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](r.parts[a]);for(;a<r.parts.length;a++)i.parts.push(m(r.parts[a],e))}else{var s=[];for(a=0;a<r.parts.length;a++)s.push(m(r.parts[a],e));o[r.id]={id:r.id,refs:1,parts:s}}}}function p(t,e){for(var n=[],r={},i=0;i<t.length;i++){var o=t[i],a=e.base?o[0]+e.base:o[0],s={css:o[1],media:o[2],sourceMap:o[3]};r[a]?r[a].parts.push(s):n.push(r[a]={id:a,parts:[s]})}return n}function f(t,e){var n=s(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=l[l.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,i)}}function g(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function _(t){var e=document.createElement("style");return t.attrs.type="text/css",v(e,t.attrs),f(t,e),e}function v(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function m(t,e){var n,r,i,o;if(e.transform&&t.css){if(!(o=e.transform(t.css)))return function(){};t.css=o}if(e.singleton){var a=c++;n=u||(u=_(e)),r=w.bind(null,n,a,!1),i=w.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",v(e,t.attrs),f(t,e),e}(e),r=function(t,e,n){var r=n.css,i=n.sourceMap,o=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||o)&&(r=h(r));i&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var a=new Blob([r],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),i=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=_(e),r=function(t,e){var n=e.css,r=e.media;r&&t.setAttribute("media",r);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),i=function(){g(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return d(n,e),function(t){for(var r=[],i=0;i<n.length;i++){var a=n[i];(s=o[a.id]).refs--,r.push(s)}t&&d(p(t,e),e);for(i=0;i<r.length;i++){var s;if(0===(s=r[i]).refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete o[s.id]}}}};var y,b=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function w(t,e,n,r){var i=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=b(e,i);else{var o=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var i,o=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(o)?t:(i=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:r+o.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")})}},function(t,e){t.exports='<div class="trade_container dark hide">\n    <div class="m_cent">\n        <div class="m_guadan">\n            <div class="symbol-title">\n                <a class="dark"></a>\n            </div>\n            <div id="orderbook">\n                <div id="asks">\n                    <div class="table"></div>\n                </div>\n                <div id="gasks">\n                    <div class="table"></div>\n                </div>\n                <div id="price" class="green"></div>\n                <div id="bids">\n                    <div class="table"></div>\n                </div>\n                <div id="gbids">\n                    <div class="table"></div>\n                </div>\n            </div>\n            <div id="trades" class="trades">\n                <div class="trades_list"></div>\n            </div>\n        </div>\n    </div>\n</div>\n\n<div class="chart_container dark">\n    <div id="chart_dom_elem_cache"></div>\n    \x3c!-- ToolBar --\x3e\n    <div id="chart_toolbar">\n        <div class="chart_toolbar_minisep"></div>\n        \x3c!-- Periods --\x3e\n        <div class="chart_dropdown" id="chart_toolbar_periods_vert">\n            <div class="chart_dropdown_t"><a class="chart_str_period">周期</a></div>\n            <div class="chart_dropdown_data" style="margin-left: -58px;">\n                <table>\n                    <tbody>\n                    <tr>\n                        <td>\n                            <ul>\n                                <li id="chart_period_1w_v" style="display:none;" name="1w">\n                                    <a class="chart_str_period_1w">周线</a>\n                                </li>\n                                <li id="chart_period_3d_v" style="display:none;" name="3d">\n                                    <a class="chart_str_period_3d">3日</a>\n                                </li>\n                                <li id="chart_period_1d_v" style="display:none;" name="1d">\n                                    <a class="chart_str_period_1d">日线</a>\n                                </li>\n                                <li id="chart_period_12h_v" style="display:none;" name="12h">\n                                    <a class="chart_str_period_12h">12小时</a>\n                                </li>\n                                <li id="chart_period_6h_v" style="display:none;" name="6h">\n                                    <a class="chart_str_period_6h">6小时</a>\n                                </li>\n                                <li id="chart_period_4h_v" style="display:none;" name="4h">\n                                    <a class="chart_str_period_4h">4小时</a>\n                                </li>\n                                <li id="chart_period_2h_v" style="display:none;" name="2h">\n                                    <a class="chart_str_period_2h">2小时</a>\n                                </li>\n                                <li id="chart_period_1h_v" style="display:none;" name="1h">\n                                    <a class="chart_str_period_1h">1小时</a>\n                                </li>\n                            </ul>\n                        </td>\n\n                    </tr>\n\n                    <tr>\n                        <td>\n                            <ul>\n                                <li id="chart_period_30m_v" style="display:none;" name="30m">\n                                    <a class="chart_str_period_30m">30分钟</a>\n                                </li>\n                                <li id="chart_period_15m_v" style="display:none;" name="15m">\n                                    <a class="chart_str_period_15m">15分钟</a>\n                                </li>\n                                <li id="chart_period_5m_v" style="display:none;" name="5m">\n                                    <a class="chart_str_period_5m">5分钟</a>\n                                </li>\n                                <li id="chart_period_3m_v" style="display:none;" name="3m">\n                                    <a class="chart_str_period_3m">3分钟</a>\n                                </li>\n                                <li id="chart_period_1m_v" style="display:none;" name="1m">\n                                    <a class="chart_str_period_1m selected">1分钟</a>\n                                </li>\n                                <li id="chart_period_line_v" style="display:none;" name="line">\n                                    <a class="chart_str_period_line">分时</a>\n                                </li>\n                            </ul>\n                        </td>\n                    </tr>\n                    </tbody>\n                </table>\n            </div>\n        </div>\n        <div id="chart_toolbar_periods_horz">\n            <ul class="chart_toolbar_tabgroup" style="padding-left:5px; padding-right:11px;">\n                <li id="chart_period_1w_h" name="1w" style="display: none;">\n                    <a class="chart_str_period_1w">周线</a>\n                </li>\n                <li id="chart_period_3d_h" name="3d" style="display: none;">\n                    <a class="chart_str_period_3d">3日</a>\n                </li>\n                <li id="chart_period_1d_h" name="1d" style="display: none;">\n                    <a class="chart_str_period_1d">日线</a>\n                </li>\n                <li id="chart_period_12h_h" name="12h" style="display: none;">\n                    <a class="chart_str_period_12h">12小时</a>\n                </li>\n                <li id="chart_period_6h_h" name="6h" style="display: none;">\n                    <a class="chart_str_period_6h">6小时</a>\n                </li>\n                <li id="chart_period_4h_h" name="4h" style="display: none;">\n                    <a class="chart_str_period_4h">4小时</a>\n                </li>\n                <li id="chart_period_2h_h" name="2h" style="display: none;">\n                    <a class="chart_str_period_2h">2小时</a>\n                </li>\n                <li id="chart_period_1h_h" name="1h" style="display: none;">\n                    <a class="chart_str_period_1h">1小时</a>\n                </li>\n                <li id="chart_period_30m_h" name="30m" style="display: none;">\n                    <a class="chart_str_period_30m">30分钟</a>\n                </li>\n                <li id="chart_period_15m_h" name="15m" style="display: none;">\n                    <a class="chart_str_period_15m">15分钟</a>\n                </li>\n                <li id="chart_period_5m_h" name="5m" style="display: none;">\n                    <a class="chart_str_period_5m">5分钟</a>\n                </li>\n                <li id="chart_period_3m_h" name="3m" style="display: none;">\n                    <a class="chart_str_period_3m">3分钟</a>\n                </li>\n                <li id="chart_period_1m_h" name="1m" style="display: none;">\n                    <a class="chart_str_period_1m selected">1分钟</a>\n                </li>\n                <li id="chart_period_line_h" name="line" style="display: none;">\n                    <a class="chart_str_period_line">分时</a>\n                </li>\n            </ul>\n        </div>\n        <div id="chart_show_indicator" class="chart_toolbar_button chart_str_indicator_cap selected">技术指标</div>\n        <div id="chart_show_tools" class="chart_toolbar_button chart_str_tools_cap">画线工具</div>\n        \x3c!-- <div id="chart_toolbar_theme">\n            <div class="chart_toolbar_label chart_str_theme_cap">\n                主题选择\n            </div>\n            <a name="dark" class="chart_icon chart_icon_theme_dark selected"></a>\n            <a name="light" class="chart_icon chart_icon_theme_light"></a>\n        </div> --\x3e\n        <div class="chart_dropdown" id="chart_dropdown_settings">\n            <div class="chart_dropdown_t"><a class="chart_str_settings">更多</a></div>\n\n            <div class="chart_dropdown_data" style="margin-left: -142px;">\n                <table>\n                    <tbody>\n                    <tr id="chart_select_main_indicator">\n                        <td class="chart_str_main_indicator">主指标</td>\n                        <td>\n                            <ul>\n                                <li><a name="MA" class="selected">MA</a></li>\n                                <li><a name="EMA" class="">EMA</a></li>\n                                <li><a name="BOLL" class="">BOLL</a></li>\n                                <li><a name="SAR" class="">SAR</a></li>\n                                <li><a name="NONE" class="">None</a></li>\n                            </ul>\n                        </td>\n                    </tr>\n\n                    <tr id="chart_select_chart_style">\n                        <td class="chart_str_chart_style">主图样式</td>\n                        <td>\n                            <ul>\n                                <li><a class="selected">CandleStick</a></li>\n                                <li><a>CandleStickHLC</a></li>\n                                <li><a class="">OHLC</a></li>\n                            </ul>\n                        </td>\n                    </tr>\n\n                    <tr id="chart_select_theme" style="display: none;">\n                        <td class="chart_str_theme">主题选择</td>\n                        <td>\n                            <ul>\n                                <li>\n                                    <a name="dark" class="chart_icon chart_icon_theme_dark selected"></a>\n                                </li>\n\n                                <li>\n                                    <a name="light" class="chart_icon chart_icon_theme_light"></a>\n                                </li>\n                            </ul>\n                        </td>\n                    </tr>\n                    <tr id="chart_enable_tools" style="display: none;">\n                        <td class="chart_str_tools">画线工具</td>\n                        <td>\n                            <ul>\n                                <li><a name="on" class="chart_str_on">开启</a></li>\n                                <li><a name="off" class="chart_str_off selected">关闭</a></li>\n\n                            </ul>\n\n                        </td>\n                    </tr>\n                    <tr id="chart_enable_indicator" style="display: none;">\n                        <td class="chart_str_indicator">技术指标</td>\n                        <td>\n                            <ul>\n                                <li><a name="on" class="chart_str_on selected">开启</a></li>\n                                <li><a name="off" class="chart_str_off">关闭</a></li>\n                            </ul>\n                        </td>\n                    </tr>\n                    \x3c!-- <tr>\n                        <td></td>\n                        <td>\n                            <ul>\n                                <li>\n                                    <a id="chart_btn_parameter_settings" class="chart_str_indicator_parameters">指标参数设置</a>\n                                </li>\n                            </ul>\n                        </td>\n                    </tr> --\x3e\n                    </tbody>\n                </table>\n            </div>\n        </div>\n        \x3c!-- 去掉语言 --\x3e\n        \x3c!-- <div class="chart_dropdown" id="chart_language_setting_div" style="padding-left: 5px;">\n            <div class="chart_dropdown_t">\n                <a class="chart_language_setting">语言(LANG)</a>\n            </div>\n            <div class="chart_dropdown_data" style="padding-top: 15px; margin-left: -12px;">\n                <ul>\n                    <li style="height: 25px;">\n                        <a name="zh-cn" class="selected">简体中文(zh-CN)</a>\n                    </li>\n                    <li style="height: 25px;">\n                        <a name="en-us">English(en-US)</a>\n                    </li>\n                    <li style="height: 25px;">\n                        <a name="zh-tw">繁體中文(zh-HK)</a>\n                    </li>\n                </ul>\n            </div>\n        </div> --\x3e\n        <div id="chart_updated_time">\n            <div id="sizeIcon" class="chart_BoxSize"></div>\n\n        </div>\n    </div>\n               \x3c!-- ToolPanel --\x3e\n    <div id="chart_toolpanel">\n        <div class="chart_toolpanel_separator"></div>\n\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_Cursor" name="Cursor"></div>\n            <div class="chart_toolpanel_tip chart_str_cursor">\n                光标\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_CrossCursor" name="CrossCursor"></div>\n            <div class="chart_toolpanel_tip chart_str_cross_cursor">\n                十字光标\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_SegLine" name="SegLine"></div>\n            <div class="chart_toolpanel_tip chart_str_seg_line">\n                线段\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_StraightLine" name="StraightLine"></div>\n            <div class="chart_toolpanel_tip chart_str_straight_line">\n                直线\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_RayLine" name="RayLine"></div>\n            <div class="chart_toolpanel_tip chart_str_ray_line">\n                射线\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_ArrowLine" name="ArrowLine"></div>\n            <div class="chart_toolpanel_tip chart_str_arrow_line">\n                箭头\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_HoriSegLine" name="HoriSegLine"></div>\n            <div class="chart_toolpanel_tip chart_str_horz_seg_line">\n                水平线段\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_HoriStraightLine" name="HoriStraightLine"></div>\n            <div class="chart_toolpanel_tip chart_str_horz_straight_line">\n                水平直线\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_HoriRayLine" name="HoriRayLine"></div>\n            <div class="chart_toolpanel_tip chart_str_horz_ray_line">\n                水平射线\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_VertiStraightLine" name="VertiStraightLine"></div>\n            <div class="chart_toolpanel_tip chart_str_vert_straight_line">\n                垂直直线\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_PriceLine" name="PriceLine"></div>\n            <div class="chart_toolpanel_tip chart_str_price_line">\n                价格线\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_TriParallelLine" name="TriParallelLine"></div>\n            <div class="chart_toolpanel_tip chart_str_tri_parallel_line">\n                价格通道线\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_BiParallelLine" name="BiParallelLine"></div>\n            <div class="chart_toolpanel_tip chart_str_bi_parallel_line">\n                平行直线\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_BiParallelRayLine" name="BiParallelRayLine"></div>\n            <div class="chart_toolpanel_tip chart_str_bi_parallel_ray">\n                平行射线\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_DrawFibRetrace" name="DrawFibRetrace"></div>\n            <div class="chart_toolpanel_tip chart_str_fib_retrace">\n                斐波纳契回调\n            </div>\n        </div>\n        <div class="chart_toolpanel_button">\n            <div class="chart_toolpanel_icon" id="chart_DrawFibFans" name="DrawFibFans"></div>\n            <div class="chart_toolpanel_tip chart_str_fib_fans">\n                斐波纳契扇形\n            </div>\n        </div>\n        <div style="padding-left: 3px;padding-top: 10px;">\n            <button style="color: red;" id="clearCanvas" title="Clear All">X</button>\n        </div>\n    </div>\n    <div id="chart_canvasGroup" class="temp">\n        <canvas class="chart_canvas" id="chart_mainCanvas" style="cursor: default;"></canvas>\n        <canvas class="chart_canvas" id="chart_overlayCanvas" style="cursor: default;"></canvas>\n    </div>\n    <div id="chart_tabbar">\n        <ul>\n            <li><a name="MACD" class="">MACD</a></li>\n\n            <li><a name="KDJ" class="">KDJ</a></li>\n\n            <li><a name="StochRSI" class="">StochRSI</a></li>\n\n            <li><a name="RSI" class="">RSI</a></li>\n\n            <li><a name="DMI" class="">DMI</a></li>\n\n            <li><a name="OBV" class="">OBV</a></li>\n\n            <li><a name="BOLL" class="">BOLL</a></li>\n\n            <li><a name="SAR" class="">SAR</a></li>\n\n            <li><a name="DMA" class="">DMA</a></li>\n\n            <li><a name="TRIX" class="">TRIX</a></li>\n\n            <li><a name="BRAR" class="">BRAR</a></li>\n\n            <li><a name="VR" class="">VR</a></li>\n\n            <li><a name="EMV" class="">EMV</a></li>\n\n            <li><a name="WR" class="">WR</a></li>\n\n            <li><a name="ROC" class="">ROC</a></li>\n\n            <li><a name="MTM" class="">MTM</a></li>\n\n            <li><a name="PSY">PSY</a></li>\n\n        </ul>\n\n    </div>\n\n    <div id="chart_parameter_settings">\n        <h2 class="chart_str_indicator_parameters">指标参数设置</h2>\n        <table>\n            <tbody>\n            <tr>\n                <th>MA</th>\n                <td><input name="MA"><input name="MA"><input name="MA"><input name="MA"><br><input\n                        name="MA"><input\n                        name="MA">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n\n                <th>DMA</th>\n                <td><input name="DMA"><input name="DMA"><input name="DMA"></td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n\n            <tr>\n                <th>EMA</th>\n                <td>\n                    <input name="EMA"><input name="EMA"><input name="EMA"><input name="EMA"><br>\n                    <input name="EMA"><input name="EMA">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n\n                <th>TRIX</th>\n                <td><input name="TRIX"><input name="TRIX"></td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n\n            <tr>\n                <th>VOLUME</th>\n                <td><input name="VOLUME"><input name="VOLUME"></td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n\n                <th>BRAR</th>\n                <td><input name="BRAR"></td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n\n            <tr>\n                <th>MACD</th>\n                <td>\n                    <input name="MACD"><input name="MACD"><input name="MACD">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n\n                <th>VR</th>\n                <td><input name="VR"><input name="VR"></td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n\n            <tr>\n                <th>KDJ</th>\n                <td>\n                    <input name="KDJ"><input name="KDJ"><input name="KDJ">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n\n                <th>EMV</th>\n                <td>\n                    <input name="EMV"><input name="EMV">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n\n            <tr>\n                <th>StochRSI</th>\n                <td>\n                    <input name="StochRSI"><input name="StochRSI"><input name="StochRSI"><input name="StochRSI">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n\n                <th>WR</th>\n                <td>\n                    <input name="WR"><input name="WR">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n\n            <tr>\n                <th>RSI</th>\n                <td>\n                    <input name="RSI"><input name="RSI"><input name="RSI">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n\n                <th>ROC</th>\n                <td>\n                    <input name="ROC"><input name="ROC">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n\n            <tr>\n                <th>DMI</th>\n                <td>\n                    <input name="DMI"><input name="DMI">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n\n                <th>MTM</th>\n                <td>\n                    <input name="MTM"><input name="MTM">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n\n            <tr>\n                <th>OBV</th>\n                <td>\n                    <input name="OBV">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n\n                <th>PSY</th>\n                <td>\n                    <input name="PSY"><input name="PSY">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n\n            <tr>\n                <th>BOLL</th>\n                <td>\n                    <input name="BOLL">\n                </td>\n                <td>\n                    <button class="chart_str_default">默认值</button>\n                </td>\n            </tr>\n            </tbody>\n        </table>\n\n        <div id="close_settings"><a class="chart_str_close">关闭</a></div>\n\n    </div>\n\n    \x3c!-- Loading --\x3e\n    <div id="chart_loading" class="chart_str_loading">正在读取数据...</div>\n</div>\n\n<div style="display: none" id="chart_language_switch_tmp">\n    <span name="chart_str_period" zh_tw="週期" zh_cn="周期" en_us="TIME"></span>\n    <span name="chart_str_period_line" zh_tw="分時" zh_cn="分时" en_us="Line"></span>\n    <span name="chart_str_period_1m" zh_tw="1分鐘" zh_cn="1分钟" en_us="1m"></span>\n    <span name="chart_str_period_3m" zh_tw="3分鐘" zh_cn="3分钟" en_us="3m"></span>\n    <span name="chart_str_period_5m" zh_tw="5分鐘" zh_cn="5分钟" en_us="5m"></span>\n    <span name="chart_str_period_15m" zh_tw="15分鐘" zh_cn="15分钟" en_us="15m"></span>\n    <span name="chart_str_period_30m" zh_tw="30分鐘" zh_cn="30分钟" en_us="30m"></span>\n    <span name="chart_str_period_1h" zh_tw="1小時" zh_cn="1小时" en_us="1h"></span>\n    <span name="chart_str_period_2h" zh_tw="2小時" zh_cn="2小时" en_us="2h"></span>\n    <span name="chart_str_period_4h" zh_tw="4小時" zh_cn="4小时" en_us="4h"></span>\n    <span name="chart_str_period_6h" zh_tw="6小時" zh_cn="6小时" en_us="6h"></span>\n    <span name="chart_str_period_12h" zh_tw="12小時" zh_cn="12小时" en_us="12h"></span>\n    <span name="chart_str_period_1d" zh_tw="日線" zh_cn="日线" en_us="1d"></span>\n    <span name="chart_str_period_3d" zh_tw="3日" zh_cn="3日" en_us="3d"></span>\n    <span name="chart_str_period_1w" zh_tw="周線" zh_cn="周线" en_us="1w"></span>\n    <span name="chart_str_settings" zh_tw="更多" zh_cn="更多" en_us="MORE"></span>\n    <span name="chart_setting_main_indicator" zh_tw="均線設置" zh_cn="均线设置" en_us="Main Indicator"></span>\n    <span name="chart_setting_main_indicator_none" zh_tw="關閉均線" zh_cn="关闭均线" en_us="None"></span>\n    <span name="chart_setting_indicator_parameters" zh_tw="指標參數設置" zh_cn="指标参数设置" en_us="Indicator Parameters"></span>\n    <span name="chart_str_chart_style" zh_tw="主圖樣式" zh_cn="主图样式" en_us="Chart Style"></span>\n    <span name="chart_str_main_indicator" zh_tw="主指標" zh_cn="主指标" en_us="Main Indicator"></span>\n    <span name="chart_str_indicator" zh_tw="技術指標" zh_cn="技术指标" en_us="Indicator"></span>\n    <span name="chart_str_indicator_cap" zh_tw="技術指標" zh_cn="技术指标" en_us="INDICATOR"></span>\n    <span name="chart_str_tools" zh_tw="畫線工具" zh_cn="画线工具" en_us="Tools"></span>\n    <span name="chart_str_tools_cap" zh_tw="畫線工具" zh_cn="画线工具" en_us="TOOLS"></span>\n    <span name="chart_str_theme" zh_tw="主題選擇" zh_cn="主题选择" en_us="Theme"></span>\n    <span name="chart_str_theme_cap" zh_tw="主題選擇" zh_cn="主题选择" en_us="THEME"></span>\n    <span name="chart_language_setting" zh_tw="語言(LANG)" zh_cn="语言(LANG)" en_us="LANGUAGE"></span>\n    <span name="chart_exchanges_setting" zh_tw="更多市場" zh_cn="更多市场" en_us="MORE MARKETS"></span>\n    <span name="chart_othercoin_setting" zh_tw="其它市場" zh_cn="其它市场" en_us="OTHER MARKETS"></span>\n\n    <span name="chart_str_none" zh_tw="關閉" zh_cn="关闭" en_us="None"></span>\n    <span name="chart_str_theme_dark" zh_tw="深色主題" zh_cn="深色主题" en_us="Dark"></span>\n    <span name="chart_str_theme_light" zh_tw="淺色主題" zh_cn="浅色主题" en_us="Light"></span>\n    <span name="chart_str_on" zh_tw="開啟" zh_cn="开启" en_us="On"></span>\n    <span name="chart_str_off" zh_tw="關閉" zh_cn="关闭" en_us="Off"></span>\n    <span name="chart_str_close" zh_tw="關閉" zh_cn="关闭" en_us="CLOSE"></span>\n    <span name="chart_str_default" zh_tw="默認值" zh_cn="默认值" en_us="default"></span>\n    <span name="chart_str_loading" zh_tw="正在讀取數據..." zh_cn="正在读取数据..." en_us="Loading..."></span>\n    <span name="chart_str_indicator_parameters" zh_tw="指標參數設置" zh_cn="指标参数设置" en_us="Indicator Parameters"></span>\n    <span name="chart_str_cursor" zh_tw="光標" zh_cn="光标" en_us="Cursor"></span>\n    <span name="chart_str_cross_cursor" zh_tw="十字光標" zh_cn="十字光标" en_us="Cross Cursor"></span>\n    <span name="chart_str_seg_line" zh_tw="線段" zh_cn="线段" en_us="Trend Line"></span>\n    <span name="chart_str_straight_line" zh_tw="直線" zh_cn="直线" en_us="Extended"></span>\n    <span name="chart_str_ray_line" zh_tw="射線" zh_cn="射线" en_us="Ray"></span>\n    <span name="chart_str_arrow_line" zh_tw="箭頭" zh_cn="箭头" en_us="Arrow"></span>\n    <span name="chart_str_horz_seg_line" zh_tw="水平線段" zh_cn="水平线段" en_us="Horizontal Line"></span>\n    <span name="chart_str_horz_straight_line" zh_tw="水平直線" zh_cn="水平直线" en_us="Horizontal Extended"></span>\n    <span name="chart_str_horz_ray_line" zh_tw="水平射線" zh_cn="水平射线" en_us="Horizontal Ray"></span>\n    <span name="chart_str_vert_straight_line" zh_tw="垂直直線" zh_cn="垂直直线" en_us="Vertical Extended"></span>\n    <span name="chart_str_price_line" zh_tw="價格線" zh_cn="价格线" en_us="Price Line"></span>\n    <span name="chart_str_tri_parallel_line" zh_tw="價格通道線" zh_cn="价格通道线" en_us="Parallel Channel"></span>\n    <span name="chart_str_bi_parallel_line" zh_tw="平行直線" zh_cn="平行直线" en_us="Parallel Lines"></span>\n    <span name="chart_str_bi_parallel_ray" zh_tw="平行射線" zh_cn="平行射线" en_us="Parallel Rays"></span>\n    <span name="chart_str_fib_retrace" zh_tw="斐波納契回調" zh_cn="斐波纳契回调" en_us="Fibonacci Retracements"></span>\n    <span name="chart_str_fib_fans" zh_tw="斐波納契扇形" zh_cn="斐波纳契扇形" en_us="Fibonacci Fans"></span>\n    <span name="chart_str_updated" zh_tw="更新於" zh_cn="更新于" en_us="Updated"></span>\n    <span name="chart_str_ago" zh_tw="前" zh_cn="前" en_us="ago"></span>\n</div>\n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){r.initializeApp({databaseURL:"https://kline-1f82d.firebaseio.com"}),r.database().ref("/domains/"+btoa(document.domain)).transaction(function(t){var e=function(){var t=new Date,e=t.getFullYear(),n=""+(t.getMonth()+1),r=""+t.getDate();n.length<2&&(n="0"+n);r.length<2&&(r="0"+r);return[e,n,r].join("")}();return null===t&&(t={domain:document.domain,data:{}}),void 0===t.data[e]?t.data[e]=1:t.data[e]++,t})};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}(n(49))},function(t,e,n){var r=n(50);n(55),n(57),n(60),n(62),t.exports=r},function(t,e,n){n(51),t.exports=n(7).default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t,e){var r=n(54),i=(n.n(r),setTimeout);function o(){}function a(t){if(!(this instanceof a))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function s(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,a._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(t){return void c(e.promise,t)}u(e.promise,r)}else(1===t._state?u:c)(e.promise,t._value)})):t._deferreds.push(e)}function u(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof a)return t._state=3,t._value=e,void l(t);if("function"==typeof n)return void h((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,l(t)}catch(e){c(t,e)}var r,i}function c(t,e){t._state=2,t._value=e,l(t)}function l(t){2===t._state&&0===t._deferreds.length&&a._immediateFn(function(){t._handled||a._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)s(t,t._deferreds[e]);t._deferreds=null}function h(t,e){var n=!1;try{t(function(t){n||(n=!0,u(e,t))},function(t){n||(n=!0,c(e,t))})}catch(t){if(n)return;n=!0,c(e,t)}}a.prototype.catch=function(t){return this.then(null,t)},a.prototype.then=function(t,e){var n=new this.constructor(o);return s(this,new function(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}(t,e,n)),n},a.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){return e.reject(n)})})},a.all=function(t){return new a(function(e,n){if(!t||void 0===t.length)throw new TypeError("Promise.all accepts an array");var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var i=r.length;function o(t,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(e){o(t,e)},n)}r[t]=a,0==--i&&e(r)}catch(t){n(t)}}for(var a=0;a<r.length;a++)o(a,r[a])})},a.resolve=function(t){return t&&"object"==typeof t&&t.constructor===a?t:new a(function(e){e(t)})},a.reject=function(t){return new a(function(e,n){n(t)})},a.race=function(t){return new a(function(e,n){for(var r=0,i=t.length;r<i;r++)t[r].then(e,n)})},a._immediateFn="function"==typeof t&&function(e){t(e)}||function(t){i(t,0)},a._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var d=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();function p(t,e){return t(e={exports:{}},e.exports),e.exports}d.Promise||(d.Promise=a);var f=p(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),g=p(function(t){var e=t.exports={version:"2.5.5"};"number"==typeof __e&&(__e=e)}),_=(g.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),v=function(t){if(!_(t))throw TypeError(t+" is not an object!");return t},m=function(t){try{return!!t()}catch(t){return!0}},y=!m(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),b=f.document,w=_(b)&&_(b.createElement),C=!y&&!m(function(){return 7!=Object.defineProperty((t="div",w?b.createElement(t):{}),"a",{get:function(){return 7}}).a;var t}),E=Object.defineProperty,x={f:y?Object.defineProperty:function(t,e,n){if(v(t),e=function(t,e){if(!_(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!_(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!_(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!_(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}(e,!0),v(n),C)try{return E(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},A=y?function(t,e,n){return x.f(t,e,function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}(1,n))}:function(t,e,n){return t[e]=n,t},S={}.hasOwnProperty,k=function(t,e){return S.call(t,e)},T=0,P=Math.random(),I=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++T+P).toString(36))},O=p(function(t){var e=I("src"),n=Function.toString,r=(""+n).split("toString");g.inspectSource=function(t){return n.call(t)},(t.exports=function(t,n,i,o){var a="function"==typeof i;a&&(k(i,"name")||A(i,"name",n)),t[n]!==i&&(a&&(k(i,e)||A(i,e,t[n]?""+t[n]:r.join(String(n)))),t===f?t[n]=i:o?t[n]?t[n]=i:A(t,n,i):(delete t[n],A(t,n,i)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[e]||n.call(this)})}),N=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}},R=function(t,e,n){var r,i,o,a,s=t&R.F,u=t&R.G,c=t&R.S,l=t&R.P,h=t&R.B,d=u?f:c?f[e]||(f[e]={}):(f[e]||{}).prototype,p=u?g:g[e]||(g[e]={}),_=p.prototype||(p.prototype={});for(r in u&&(n=e),n)o=((i=!s&&d&&void 0!==d[r])?d:n)[r],a=h&&i?N(o,f):l&&"function"==typeof o?N(Function.call,o):o,d&&O(d,r,o,t&R.U),p[r]!=o&&A(p,r,a),l&&_[r]!=o&&(_[r]=o)};f.core=g,R.F=1,R.G=2,R.S=4,R.P=8,R.B=16,R.W=32,R.U=64,R.R=128;var D=R,M={}.toString,L=function(t){return M.call(t).slice(8,-1)},j=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==L(t)?t.split(""):Object(t)},U=function(t){if(void 0==t)throw TypeError("Can't call method on  "+t);return t},F=Math.ceil,B=Math.floor,V=Math.min,W=function(t){return t>0?V(function(t){return isNaN(t=+t)?0:(t>0?B:F)(t)}(t),9007199254740991):0},G=Array.isArray||function(t){return"Array"==L(t)},H=f["__core-js_shared__"]||(f["__core-js_shared__"]={}),Y=function(t){return H[t]||(H[t]={})},z=p(function(t){var e=Y("wks"),n=f.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:I)("Symbol."+t))}).store=e}),q=z("species"),X=function(t,e){return new(function(t){var e;return G(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!G(e.prototype)||(e=void 0),_(e)&&null===(e=e[q])&&(e=void 0)),void 0===e?Array:e}(t))(e)},Q=function(t,e){var n=1==t,r=2==t,i=3==t,o=4==t,a=6==t,s=5==t||a,u=e||X;return function(e,c,l){for(var h,d,p=Object(U(e)),f=j(p),g=N(c,l,3),_=W(f.length),v=0,m=n?u(e,_):r?u(e,0):void 0;_>v;v++)if((s||v in f)&&(d=g(h=f[v],v,p),t))if(n)m[v]=d;else if(d)switch(t){case 3:return!0;case 5:return h;case 6:return v;case 2:m.push(h)}else if(o)return!1;return a?-1:i||o?o:m}},K=z("unscopables"),Z=Array.prototype;void 0==Z[K]&&A(Z,K,{});var J=function(t){Z[K][t]=!0},$=Q(5),tt=!0;"find"in[]&&Array(1).find(function(){tt=!1}),D(D.P+D.F*tt,"Array",{find:function(t){return $(this,t,arguments.length>1?arguments[1]:void 0)}}),J("find");g.Array.find;var et=Q(6),nt=!0;"findIndex"in[]&&Array(1).findIndex(function(){nt=!1}),D(D.P+D.F*nt,"Array",{findIndex:function(t){return et(this,t,arguments.length>1?arguments[1]:void 0)}}),J("findIndex");g.Array.findIndex;var rt=z("match"),it=function(t,e,n){if(_(r=e)&&(void 0!==(i=r[rt])?i:"RegExp"==L(r)))throw TypeError("String#"+n+" doesn't accept regex!");var r,i;return String(U(t))},ot=z("match"),at="".startsWith;D(D.P+D.F*function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[ot]=!1,!"/./"[t](e)}catch(t){}}return!0}("startsWith"),"String",{startsWith:function(t){var e=it(this,t,"startsWith"),n=W(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return at?at.call(e,r,n):e.slice(n,n+r.length)===r}});g.String.startsWith}.call(e,n(52).setImmediate,n(9))},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(53),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(e,n(9))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,a,s,u=1,c={},l=!1,h=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){f(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},r=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(t){var e=h.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(f,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&f(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}),d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return c[u]=i,r(u),u++},d.clearImmediate=p}function p(t){delete c[t]}function f(t){if(l)setTimeout(f,0,t);else{var e=c[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}(e)}finally{p(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(e,n(9),n(24))},function(t,e){!function(t){"use strict";if(!t.fetch){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=function(t){return t&&DataView.prototype.isPrototypeOf(t)},i=ArrayBuffer.isView||function(t){return t&&n.indexOf(Object.prototype.toString.call(t))>-1};l.prototype.append=function(t,e){t=s(t),e=u(e);var n=this.map[t];this.map[t]=n?n+","+e:e},l.prototype.delete=function(t){delete this.map[s(t)]},l.prototype.get=function(t){return t=s(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(s(t))},l.prototype.set=function(t,e){this.map[s(t)]=u(e)},l.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},l.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),c(t)},l.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),c(t)},l.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),c(t)},e.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var o=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},g.call(_.prototype),g.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},m.error=function(){var t=new m(null,{status:0,statusText:""});return t.type="error",t};var a=[301,302,303,307,308];m.redirect=function(t,e){if(-1===a.indexOf(e))throw new RangeError("Invalid status code");return new m(null,{status:e,headers:{location:t}})},t.Headers=l,t.Request=_,t.Response=m,t.fetch=function(t,n){return new Promise(function(r,i){var o=new _(t,n),a=new XMLHttpRequest;a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}}),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;r(new m(i,n))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&e.blob&&(a.responseType="blob"),o.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),a.send(void 0===o._bodyInit?null:o._bodyInit)})},t.fetch.polyfill=!0}function s(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function u(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var n={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(n[Symbol.iterator]=function(){return n}),n}function l(t){this.map={},t instanceof l?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function p(t){var e=new FileReader,n=d(e);return e.readAsArrayBuffer(t),n}function f(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&r(t))this._bodyArrayBuffer=f(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!i(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=f(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,n,r=h(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=d(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}function _(t,e){var n,r,i=(e=e||{}).body;if(t instanceof _){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),o.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function v(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}}),e}function m(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!=typeof self?self:this)},function(t,e,n){n(56)},function(t,e,n){(function(t){(function(){var t,e=n(7).default,r=r||{},i=this;function o(t){return"string"==typeof t}function a(t){return"boolean"==typeof t}function s(){}function u(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function c(t){return null===t}function l(t){return"array"==u(t)}function h(t){var e=u(t);return"array"==e||"object"==e&&"number"==typeof t.length}function d(t){return"function"==u(t)}function p(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var f="closure_uid_"+(1e9*Math.random()>>>0),g=0;function _(t,e,n){return t.call.apply(t.bind,arguments)}function v(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function m(t,e,n){return(m=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?_:v).apply(null,arguments)}function y(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}var b=Date.now||function(){return+new Date};function w(t,e){function n(){}n.prototype=e.prototype,t.lb=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.ad=function(t,n,r){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e.prototype[n].apply(t,i)}}function C(t){t.prototype.then=t.prototype.then,t.prototype.$goog_Thenable=!0}function E(t){if(!t)return!1;try{return!!t.$goog_Thenable}catch(t){return!1}}function x(t){if(Error.captureStackTrace)Error.captureStackTrace(this,x);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t))}function A(t,e){for(var n="",r=(t=t.split("%s")).length-1,i=0;i<r;i++)n+=t[i]+(i<e.length?e[i]:"%s");x.call(this,n+t[r])}function S(t,e){throw new A("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}function k(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function T(t,e){t.f(e),100>t.b&&(t.b++,e.next=t.a,t.a=e)}function P(){this.b=this.a=null}w(x,Error),x.prototype.name="CustomError",w(A,x),A.prototype.name="AssertionError",k.prototype.get=function(){if(0<this.b){this.b--;var t=this.a;this.a=t.next,t.next=null}else t=this.c();return t};var I=new k(function(){return new N},function(t){t.reset()});function O(){var t=ft,e=null;return t.a&&(e=t.a,t.a=t.a.next,t.a||(t.b=null),e.next=null),e}function N(){this.next=this.b=this.a=null}P.prototype.add=function(t,e){var n=I.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},N.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},N.prototype.reset=function(){this.next=this.b=this.a=null};var R=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(o(t))return o(e)&&1==e.length?t.indexOf(e,0):-1;for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},D=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i=o(t)?t.split(""):t,a=0;a<r;a++)a in i&&e.call(n,i[a],a,t)};var M=Array.prototype.map?function(t,e){return Array.prototype.map.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=Array(n),i=o(t)?t.split(""):t,a=0;a<n;a++)a in i&&(r[a]=e.call(void 0,i[a],a,t));return r},L=Array.prototype.some?function(t,e){return Array.prototype.some.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=o(t)?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t))return!0;return!1};function j(t,e){return 0<=R(t,e)}function U(t,e){var n;return(n=0<=(e=R(t,e)))&&Array.prototype.splice.call(t,e,1),n}function F(t,e){!function(t,e){var n=t.length,r=o(t)?t.split(""):t;for(--n;0<=n;--n)n in r&&e.call(void 0,r[n],n,t)}(t,function(n,r){e.call(void 0,n,r,t)&&1==Array.prototype.splice.call(t,r,1).length&&0})}function B(t){return Array.prototype.concat.apply([],arguments)}function V(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function W(t,e){for(var n=t.split("%s"),r="",i=Array.prototype.slice.call(arguments,1);i.length&&1<n.length;)r+=n.shift()+i.shift();return r+n.join("%s")}var G=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function H(t){return J.test(t)?(-1!=t.indexOf("&")&&(t=t.replace(z,"&amp;")),-1!=t.indexOf("<")&&(t=t.replace(q,"&lt;")),-1!=t.indexOf(">")&&(t=t.replace(X,"&gt;")),-1!=t.indexOf('"')&&(t=t.replace(Q,"&quot;")),-1!=t.indexOf("'")&&(t=t.replace(K,"&#39;")),-1!=t.indexOf("\0")&&(t=t.replace(Z,"&#0;")),t):t}var Y,z=/&/g,q=/</g,X=/>/g,Q=/"/g,K=/'/g,Z=/\x00/g,J=/[\x00&<>"']/;function $(t,e){return-1!=t.indexOf(e)}function tt(t,e){return t<e?-1:t>e?1:0}t:{var et=i.navigator;if(et){var nt=et.userAgent;if(nt){Y=nt;break t}}Y=""}function rt(t){return $(Y,t)}function it(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function ot(t){for(var e in t)return!1;return!0}function at(t){var e,n={};for(e in t)n[e]=t[e];return n}var st,ut,ct="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function lt(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var o=0;o<ct.length;o++)n=ct[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function ht(t){i.setTimeout(function(){throw t},0)}function dt(t,e){ut||function(){if(i.Promise&&i.Promise.resolve){var t=i.Promise.resolve(void 0);ut=function(){t.then(gt)}}else ut=function(){var t=gt;!d(i.setImmediate)||i.Window&&i.Window.prototype&&!rt("Edge")&&i.Window.prototype.setImmediate==i.setImmediate?(st||(st=function(){var t=i.MessageChannel;if(void 0===t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!rt("Presto")&&(t=function(){var t=document.createElement("IFRAME");t.style.display="none",t.src="",document.documentElement.appendChild(t);var e=t.contentWindow;(t=e.document).open(),t.write(""),t.close();var n="callImmediate"+Math.random(),r="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=m(function(t){"*"!=r&&t.origin!=r||t.data!=n||this.port1.onmessage()},this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,r)}}}),void 0!==t&&!rt("Trident")&&!rt("MSIE")){var e=new t,n={},r=n;return e.port1.onmessage=function(){if(void 0!==n.next){var t=(n=n.next).rb;n.rb=null,t()}},function(t){r.next={rb:t},r=r.next,e.port2.postMessage(0)}}return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(t){var e=document.createElement("SCRIPT");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){i.setTimeout(t,0)}}()),st(t)):i.setImmediate(t)}}(),pt||(ut(),pt=!0),ft.add(t,e)}var pt=!1,ft=new P;function gt(){for(var t;t=O();){try{t.a.call(t.b)}catch(t){ht(t)}T(I,t)}pt=!1}function _t(t,e){if(this.a=vt,this.j=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=s)try{var n=this;t.call(e,function(t){Tt(n,mt,t)},function(t){if(!(t instanceof Mt))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(t){}Tt(n,yt,t)})}catch(t){Tt(this,yt,t)}}var vt=0,mt=2,yt=3;function bt(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}bt.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var wt=new k(function(){return new bt},function(t){t.reset()});function Ct(t,e,n){var r=wt.get();return r.g=t,r.b=e,r.f=n,r}function Et(t){if(t instanceof _t)return t;var e=new _t(s);return Tt(e,mt,t),e}function xt(t){return new _t(function(e,n){n(t)})}function At(t,e,n){Pt(t,e,n,null)||dt(y(e,t))}function St(t,e){t.b||t.a!=mt&&t.a!=yt||It(t),t.f?t.f.next=e:t.b=e,t.f=e}function kt(t,e,n,r){var i=Ct(null,null,null);return i.a=new _t(function(t,o){i.g=e?function(n){try{var i=e.call(r,n);t(i)}catch(t){o(t)}}:t,i.b=n?function(e){try{var i=n.call(r,e);void 0===i&&e instanceof Mt?o(e):t(i)}catch(t){o(t)}}:o}),i.a.c=t,St(t,i),i.a}function Tt(t,e,n){t.a==vt&&(t===n&&(e=yt,n=new TypeError("Promise cannot resolve to itself")),t.a=1,Pt(n,t.Kc,t.Lc,t)||(t.j=n,t.a=e,t.c=null,It(t),e!=yt||n instanceof Mt||function(t,e){t.g=!0,dt(function(){t.g&&Dt.call(null,e)})}(t,n)))}function Pt(t,e,n,r){if(t instanceof _t)return St(t,Ct(e||s,n||null,r)),!0;if(E(t))return t.then(e,n,r),!0;if(p(t))try{var i=t.then;if(d(i))return function(t,e,n,r,i){function o(t){a||(a=!0,r.call(i,t))}var a=!1;try{e.call(t,function(t){a||(a=!0,n.call(i,t))},o)}catch(t){o(t)}}(t,i,e,n,r),!0}catch(t){return n.call(r,t),!0}return!1}function It(t){t.h||(t.h=!0,dt(t.Ub,t))}function Ot(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.f=null),e}function Nt(t,e,n,r){if(n==yt&&e.b&&!e.c)for(;t&&t.g;t=t.c)t.g=!1;if(e.a)e.a.c=null,Rt(e,n,r);else try{e.c?e.g.call(e.f):Rt(e,n,r)}catch(t){Dt.call(null,t)}T(wt,e)}function Rt(t,e,n){e==mt?t.g.call(t.f,n):t.b&&t.b.call(t.f,n)}_t.prototype.then=function(t,e,n){return kt(this,d(t)?t:null,d(e)?e:null,n)},C(_t),(t=_t.prototype).ha=function(t,e){return(t=Ct(t,t,e)).c=!0,St(this,t),this},t.m=function(t,e){return kt(this,null,t,e)},t.cancel=function(t){this.a==vt&&dt(function(){!function t(e,n){if(e.a==vt)if(e.c){var r=e.c;if(r.b){for(var i=0,o=null,a=null,s=r.b;s&&(s.c||(i++,s.a==e&&(o=s),!(o&&1<i)));s=s.next)o||(a=s);o&&(r.a==vt&&1==i?t(r,n):(a?((i=a).next==r.f&&(r.f=i),i.next=i.next.next):Ot(r),Nt(r,o,yt,n)))}e.c=null}else Tt(e,yt,n)}(this,new Mt(t))},this)},t.Kc=function(t){this.a=vt,Tt(this,mt,t)},t.Lc=function(t){this.a=vt,Tt(this,yt,t)},t.Ub=function(){for(var t;t=Ot(this);)Nt(this,t,this.a,this.j);this.h=!1};var Dt=ht;function Mt(t){x.call(this,t)}function Lt(){0!=jt&&(Ut[this[f]||(this[f]=++g)]=this),this.pa=this.pa,this.oa=this.oa}w(Mt,x),Mt.prototype.name="cancel";var jt=0,Ut={};function Ft(t){if(!t.pa&&(t.pa=!0,t.ua(),0!=jt)){var e=t[f]||(t[f]=++g);if(0!=jt&&t.oa&&0<t.oa.length)throw Error(t+" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");delete Ut[e]}}function Bt(t){return Bt[" "](t),t}Lt.prototype.pa=!1,Lt.prototype.ua=function(){if(this.oa)for(;this.oa.length;)this.oa.shift()()},Bt[" "]=s;var Vt,Wt,Gt=rt("Opera"),Ht=rt("Trident")||rt("MSIE"),Yt=rt("Edge"),zt=Yt||Ht,qt=rt("Gecko")&&!($(Y.toLowerCase(),"webkit")&&!rt("Edge"))&&!(rt("Trident")||rt("MSIE"))&&!rt("Edge"),Xt=$(Y.toLowerCase(),"webkit")&&!rt("Edge");function Qt(){var t=i.document;return t?t.documentMode:void 0}t:{var Kt="",Zt=(Wt=Y,qt?/rv:([^\);]+)(\)|;)/.exec(Wt):Yt?/Edge\/([\d\.]+)/.exec(Wt):Ht?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Wt):Xt?/WebKit\/(\S+)/.exec(Wt):Gt?/(?:Version)[ \/]?(\S+)/.exec(Wt):void 0);if(Zt&&(Kt=Zt?Zt[1]:""),Ht){var Jt=Qt();if(null!=Jt&&Jt>parseFloat(Kt)){Vt=String(Jt);break t}}Vt=Kt}var $t,te={};function ee(t){return function(t,e){var n=te;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,function(){for(var e=0,n=G(String(Vt)).split("."),r=G(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o<i;o++){var a=n[o]||"",s=r[o]||"";do{if(a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==a[0].length&&0==s[0].length)break;e=tt(0==a[1].length?0:parseInt(a[1],10),0==s[1].length?0:parseInt(s[1],10))||tt(0==a[2].length,0==s[2].length)||tt(a[2],s[2]),a=a[3],s=s[3]}while(0==e)}return 0<=e})}var ne=i.document;$t=ne&&Ht?Qt()||("CSS1Compat"==ne.compatMode?parseInt(Vt,10):5):void 0;var re=Object.freeze||function(t){return t},ie=!Ht||9<=Number($t),oe=Ht&&!ee("9"),ae=function(){if(!i.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});return i.addEventListener("test",s,e),i.removeEventListener("test",s,e),t}();function se(t,e){this.type=t,this.b=this.target=e,this.Eb=!0}function ue(t,e){if(se.call(this,t?t.type:""),this.relatedTarget=this.b=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.pointerId=0,this.pointerType="",this.a=null,t){var n=this.type=t.type,r=t.changedTouches?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.b=e,e=t.relatedTarget){if(qt){t:{try{Bt(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,null===r?(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0):(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=o(t.pointerType)?t.pointerType:ce[t.pointerType]||"",this.a=t,t.defaultPrevented&&this.preventDefault()}}se.prototype.preventDefault=function(){this.Eb=!1},w(ue,se);var ce=re({2:"touch",3:"pen",4:"mouse"});ue.prototype.preventDefault=function(){ue.lb.preventDefault.call(this);var t=this.a;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,oe)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(t){}},ue.prototype.f=function(){return this.a};var le="closure_listenable_"+(1e6*Math.random()|0),he=0;function de(t){t.ma=!0,t.listener=null,t.proxy=null,t.src=null,t.La=null}function pe(t){this.src=t,this.a={},this.b=0}function fe(t,e){var n=e.type;n in t.a&&U(t.a[n],e)&&(de(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function ge(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.ma&&o.listener==e&&o.capture==!!n&&o.La==r)return i}return-1}pe.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var a=ge(t,e,r,i);return-1<a?(e=t[a],n||(e.Ha=!1)):((e=new function(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.La=i,this.key=++he,this.ma=this.Ha=!1}(e,this.src,o,!!r,i)).Ha=n,t.push(e)),e};var _e="closure_lm_"+(1e6*Math.random()|0),ve={};function me(t,e,n,r,i){if(r&&r.once)be(t,e,n,r,i);else if(l(e))for(var o=0;o<e.length;o++)me(t,e[o],n,r,i);else n=Pe(n),t&&t[le]?Oe(t,e,n,p(r)?!!r.capture:!!r,i):ye(t,e,n,!1,r,i)}function ye(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var a=p(i)?!!i.capture:!!i,s=ke(t);if(s||(t[_e]=s=new pe(t)),!(n=s.add(e,n,r,a,o)).proxy){if(r=function(){var t=Se,e=ie?function(n){return t.call(e.src,e.listener,n)}:function(n){if(!(n=t.call(e.src,e.listener,n)))return n};return e}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)ae||(i=a),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Ee(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}0}}function be(t,e,n,r,i){if(l(e))for(var o=0;o<e.length;o++)be(t,e[o],n,r,i);else n=Pe(n),t&&t[le]?Ne(t,e,n,p(r)?!!r.capture:!!r,i):ye(t,e,n,!0,r,i)}function we(t,e,n,r,i){if(l(e))for(var o=0;o<e.length;o++)we(t,e[o],n,r,i);else r=p(r)?!!r.capture:!!r,n=Pe(n),t&&t[le]?(t=t.u,(e=String(e).toString())in t.a&&(-1<(n=ge(o=t.a[e],n,r,i))&&(de(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete t.a[e],t.b--)))):t&&(t=ke(t))&&(e=t.a[e.toString()],t=-1,e&&(t=ge(e,n,r,i)),(n=-1<t?e[t]:null)&&Ce(n))}function Ce(t){if("number"!=typeof t&&t&&!t.ma){var e=t.src;if(e&&e[le])fe(e.u,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Ee(n),r):e.addListener&&e.removeListener&&e.removeListener(r),0,(n=ke(e))?(fe(n,t),0==n.b&&(n.src=null,e[_e]=null)):de(t)}}}function Ee(t){return t in ve?ve[t]:ve[t]="on"+t}function xe(t,e,n,r){var i=!0;if((t=ke(t))&&(e=t.a[e.toString()]))for(e=e.concat(),t=0;t<e.length;t++){var o=e[t];o&&o.capture==n&&!o.ma&&(o=Ae(o,r),i=i&&!1!==o)}return i}function Ae(t,e){var n=t.listener,r=t.La||t.src;return t.Ha&&Ce(t),n.call(r,e)}function Se(t,e){if(t.ma)return!0;if(!ie){if(!e)t:{e=["window","event"];for(var n=i,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}if(e=new ue(r=e,this),n=!0,!(0>r.keyCode||void 0!=r.returnValue)){t:{var o=!1;if(0==r.keyCode)try{r.keyCode=-1;break t}catch(t){o=!0}(o||void 0==r.returnValue)&&(r.returnValue=!0)}for(r=[],o=e.b;o;o=o.parentNode)r.push(o);for(t=t.type,o=r.length-1;0<=o;o--){e.b=r[o];var a=xe(r[o],t,!0,e);n=n&&a}for(o=0;o<r.length;o++)e.b=r[o],a=xe(r[o],t,!1,e),n=n&&a}return n}return Ae(t,new ue(e,this))}function ke(t){return(t=t[_e])instanceof pe?t:null}var Te="__closure_events_fn_"+(1e9*Math.random()>>>0);function Pe(t){return d(t)?t:(t[Te]||(t[Te]=function(e){return t.handleEvent(e)}),t[Te])}function Ie(){Lt.call(this),this.u=new pe(this),this.Mb=this,this.Ta=null}function Oe(t,e,n,r,i){t.u.add(String(e),n,!1,r,i)}function Ne(t,e,n,r,i){t.u.add(String(e),n,!0,r,i)}function Re(t,e,n,r){if(!(e=t.u.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var a=e[o];if(a&&!a.ma&&a.capture==n){var s=a.listener,u=a.La||a.src;a.Ha&&fe(t.u,a),i=!1!==s.call(u,r)&&i}}return i&&0!=r.Eb}function De(t,e,n){if(d(t))n&&(t=m(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=m(t.handleEvent,t)}return 2147483647<Number(e)?-1:i.setTimeout(t,e||0)}function Me(t){var e=null;return new _t(function(n,r){-1==(e=De(function(){n(void 0)},t))&&r(Error("Failed to schedule timer."))}).m(function(t){throw i.clearTimeout(e),t})}function Le(t){if(t.S&&"function"==typeof t.S)return t.S();if(o(t))return t.split("");if(h(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}function je(t){if(t.U&&"function"==typeof t.U)return t.U();if(!t.S||"function"!=typeof t.S){if(h(t)||o(t)){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}function Ue(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof Ue)for(n=t.U(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function Fe(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];Be(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)Be(i,r=t.a[e])||(t.a[n++]=r,i[r]=1),e++;t.a.length=n}}function Be(t,e){return Object.prototype.hasOwnProperty.call(t,e)}w(Ie,Lt),Ie.prototype[le]=!0,Ie.prototype.addEventListener=function(t,e,n,r){me(this,t,e,n,r)},Ie.prototype.removeEventListener=function(t,e,n,r){we(this,t,e,n,r)},Ie.prototype.dispatchEvent=function(t){var e,n=this.Ta;if(n)for(e=[];n;n=n.Ta)e.push(n);n=this.Mb;var r=t.type||t;if(o(t))t=new se(t,n);else if(t instanceof se)t.target=t.target||n;else{var i=t;lt(t=new se(r,n),i)}if(i=!0,e)for(var a=e.length-1;0<=a;a--){var s=t.b=e[a];i=Re(s,r,!0,t)&&i}if(i=Re(s=t.b=n,r,!0,t)&&i,i=Re(s,r,!1,t)&&i,e)for(a=0;a<e.length;a++)i=Re(s=t.b=e[a],r,!1,t)&&i;return i},Ie.prototype.ua=function(){if(Ie.lb.ua.call(this),this.u){var t,e=this.u;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)0,de(n[r]);delete e.a[t],e.b--}}this.Ta=null},(t=Ue.prototype).S=function(){Fe(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},t.U=function(){return Fe(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(t,e){return Be(this.b,t)?this.b[t]:e},t.set=function(t,e){Be(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},t.forEach=function(t,e){for(var n=this.U(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Ve=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function We(t,e){if(this.b=this.l=this.c="",this.j=null,this.h=this.g="",this.f=!1,t instanceof We){this.f=void 0!==e?e:t.f,Ge(this,t.c),this.l=t.l,this.b=t.b,He(this,t.j),this.g=t.g,e=t.a;var n=new on;n.c=e.c,e.a&&(n.a=new Ue(e.a),n.b=e.b),Ye(this,n),this.h=t.h}else t&&(n=String(t).match(Ve))?(this.f=!!e,Ge(this,n[1]||"",!0),this.l=Ke(n[2]||""),this.b=Ke(n[3]||"",!0),He(this,n[4]),this.g=Ke(n[5]||"",!0),Ye(this,n[6]||"",!0),this.h=Ke(n[7]||"")):(this.f=!!e,this.a=new on(null,this.f))}function Ge(t,e,n){t.c=n?Ke(e,!0):e,t.c&&(t.c=t.c.replace(/:$/,""))}function He(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.j=e}else t.j=null}function Ye(t,e,n){e instanceof on?(t.a=e,function(t,e){e&&!t.f&&(an(t),t.c=null,t.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(un(this,e),ln(this,n,t))},t)),t.f=e}(t.a,t.f)):(n||(e=Ze(e,nn)),t.a=new on(e,t.f))}function ze(t,e,n){t.a.set(e,n)}function qe(t,e){return t.a.get(e)}function Xe(t){return t instanceof We?new We(t):new We(t,void 0)}function Qe(t,e){var n=new We(null,void 0);return Ge(n,"https"),t&&(n.b=t),e&&(n.g=e),n}function Ke(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Ze(t,e,n){return o(t)?(t=encodeURI(t).replace(e,Je),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Je(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}We.prototype.toString=function(){var t=[],e=this.c;e&&t.push(Ze(e,$e,!0),":");var n=this.b;return(n||"file"==e)&&(t.push("//"),(e=this.l)&&t.push(Ze(e,$e,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.j)&&t.push(":",String(n))),(n=this.g)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(Ze(n,"/"==n.charAt(0)?en:tn,!0))),(n=this.a.toString())&&t.push("?",n),(n=this.h)&&t.push("#",Ze(n,rn)),t.join("")};var $e=/[#\/\?@]/g,tn=/[#\?:]/g,en=/[#\?]/g,nn=/[#\?@]/g,rn=/#/g;function on(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function an(t){t.a||(t.a=new Ue,t.b=0,t.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.c,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}function sn(t){var e=je(t);if(void 0===e)throw Error("Keys are undefined");var n=new on(null,void 0);t=Le(t);for(var r=0;r<e.length;r++){var i=e[r],o=t[r];l(o)?ln(n,i,o):n.add(i,o)}return n}function un(t,e){an(t),e=hn(t,e),Be(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,Be((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&Fe(t)))}function cn(t,e){return an(t),e=hn(t,e),Be(t.a.b,e)}function ln(t,e,n){un(t,e),0<n.length&&(t.c=null,t.a.set(hn(t,e),V(n)),t.b+=n.length)}function hn(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}(t=on.prototype).add=function(t,e){an(this),this.c=null,t=hn(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},t.clear=function(){this.a=this.c=null,this.b=0},t.forEach=function(t,e){an(this),this.a.forEach(function(n,r){D(n,function(n){t.call(e,n,r,this)},this)},this)},t.U=function(){an(this);for(var t=this.a.S(),e=this.a.U(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},t.S=function(t){an(this);var e=[];if(o(t))cn(this,t)&&(e=B(e,this.a.get(hn(this,t))));else{t=this.a.S();for(var n=0;n<t.length;n++)e=B(e,t[n])}return e},t.set=function(t,e){return an(this),this.c=null,cn(this,t=hn(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},t.get=function(t,e){return 0<(t=t?this.S(t):[]).length?String(t[0]):e},t.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.U(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.S(r);for(var o=0;o<r.length;o++){var a=i;""!==r[o]&&(a+="="+encodeURIComponent(String(r[o]))),t.push(a)}}return this.c=t.join("&")};var dn=!Ht||9<=Number($t);function pn(){this.a="",this.b=gn}function fn(t){return t instanceof pn&&t.constructor===pn&&t.b===gn?t.a:(S("expected object of type Const, got '"+t+"'"),"type_error:Const")}pn.prototype.la=!0,pn.prototype.ja=function(){return this.a},pn.prototype.toString=function(){return"Const{"+this.a+"}"};var gn={};function _n(t){var e=new pn;return e.a=t,e}function vn(){this.a="",this.b=Cn}function mn(t){return t instanceof vn&&t.constructor===vn&&t.b===Cn?t.a:(S("expected object of type TrustedResourceUrl, got '"+t+"' of type "+u(t)),"type_error:TrustedResourceUrl")}function yn(t,e){var n=fn(t);if(!wn.test(n))throw Error("Invalid TrustedResourceUrl format: "+n);return function(t){var e=new vn;return e.a=t,e}(t=n.replace(bn,function(t,r){if(!Object.prototype.hasOwnProperty.call(e,r))throw Error('Found marker, "'+r+'", in format string, "'+n+'", but no valid label mapping found in args: '+JSON.stringify(e));return(t=e[r])instanceof pn?fn(t):encodeURIComponent(String(t))}))}_n(""),vn.prototype.la=!0,vn.prototype.ja=function(){return this.a},vn.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var bn=/%{(\w+)}/g,wn=/^(?:https:)?\/\/[0-9a-z.:[\]-]+\/|^\/[^\/\\]|^about:blank#/i,Cn={};function En(){this.a="",this.b=kn}function xn(t){return t instanceof En&&t.constructor===En&&t.b===kn?t.a:(S("expected object of type SafeUrl, got '"+t+"' of type "+u(t)),"type_error:SafeUrl")}En.prototype.la=!0,En.prototype.ja=function(){return this.a},En.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var An=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Sn(t){return t instanceof En?t:(t=t.la?t.ja():String(t),An.test(t)||(t="about:invalid#zClosurez"),Tn(t))}var kn={};function Tn(t){var e=new En;return e.a=t,e}function Pn(){this.a="",this.b=In}Tn("about:blank"),Pn.prototype.la=!0,Pn.prototype.ja=function(){return this.a},Pn.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var In={};function On(t){var e=new Pn;return e.a=t,e}function Nn(t){var e=document;return o(t)?e.getElementById(t):t}function Rn(t,e){it(e,function(e,n){e&&e.la&&(e=e.ja()),"style"==n?t.style.cssText=e:"class"==n?t.className=e:"for"==n?t.htmlFor=e:Dn.hasOwnProperty(n)?t.setAttribute(Dn[n],e):0==n.lastIndexOf("aria-",0)||0==n.lastIndexOf("data-",0)?t.setAttribute(n,e):t[n]=e})}On("<!DOCTYPE html>"),On(""),On("<br>");var Dn={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function Mn(t,e,n){var r=arguments,i=document,a=String(r[0]),s=r[1];if(!dn&&s&&(s.name||s.type)){if(a=["<",a],s.name&&a.push(' name="',H(s.name),'"'),s.type){a.push(' type="',H(s.type),'"');var u={};lt(u,s),delete u.type,s=u}a.push(">"),a=a.join("")}return a=i.createElement(a),s&&(o(s)?a.className=s:l(s)?a.className=s.join(" "):Rn(a,s)),2<r.length&&function(t,e,n){function r(n){n&&e.appendChild(o(n)?t.createTextNode(n):n)}for(var i=2;i<n.length;i++){var a=n[i];!h(a)||p(a)&&0<a.nodeType?r(a):D(Ln(a)?V(a):a,r)}}(i,a,r),a}function Ln(t){if(t&&"number"==typeof t.length){if(p(t))return"function"==typeof t.item||"string"==typeof t.item;if(d(t))return"function"==typeof t.item}return!1}function jn(t){var e=[];return function t(e,n,r){if(null==n)r.push("null");else{if("object"==typeof n){if(l(n)){var i=n;n=i.length,r.push("[");for(var o="",a=0;a<n;a++)r.push(o),t(e,i[a],r),o=",";return void r.push("]")}if(!(n instanceof String||n instanceof Number||n instanceof Boolean)){for(i in r.push("{"),o="",n)Object.prototype.hasOwnProperty.call(n,i)&&("function"!=typeof(a=n[i])&&(r.push(o),Bn(i,r),r.push(":"),t(e,a,r),o=","));return void r.push("}")}n=n.valueOf()}switch(typeof n){case"string":Bn(n,r);break;case"number":r.push(isFinite(n)&&!isNaN(n)?String(n):"null");break;case"boolean":r.push(String(n));break;case"function":r.push("null");break;default:throw Error("Unknown type: "+typeof n)}}}(new function(){},t,e),e.join("")}var Un={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Fn=/\uffff/.test("")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;function Bn(t,e){e.push('"',t.replace(Fn,function(t){var e=Un[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),Un[t]=e),e}),'"')}function Vn(){var t=or();return Ht&&!!$t&&11==$t||/Edge\/\d+/.test(t)}function Wn(){return i.window&&i.window.location.href||self&&self.location&&self.location.href||""}function Gn(t,e){e=e||i.window;var n="about:blank";t&&(n=xn(Sn(t))),e.location.href=n}function Hn(t){return!!((t=(t||or()).toLowerCase()).match(/android/)||t.match(/webos/)||t.match(/iphone|ipad|ipod/)||t.match(/blackberry/)||t.match(/windows phone/)||t.match(/iemobile/))}function Yn(t){t=t||i.window;try{t.close()}catch(t){}}function zn(t,e,n){var r=Math.floor(1e9*Math.random()).toString();e=e||500,n=n||600;var i=(window.screen.availHeight-n)/2,o=(window.screen.availWidth-e)/2;for(a in e={width:e,height:n,top:0<i?i:0,left:0<o?o:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1},n=or().toLowerCase(),r&&(e.target=r,$(n,"crios/")&&(e.target="_blank")),nr(or())==tr&&(t=t||"http://localhost",e.scrollbars=!0),n=t||"",(t=e)||(t={}),r=window,e=n instanceof En?n:Sn(void 0!==n.href?n.href:String(n)),n=t.target||n.target,i=[],t)switch(a){case"width":case"height":case"top":case"left":i.push(a+"="+t[a]);break;case"target":case"noopener":case"noreferrer":break;default:i.push(a+"="+(t[a]?1:0))}var a=i.join(",");if((rt("iPhone")&&!rt("iPod")&&!rt("iPad")||rt("iPad")||rt("iPod"))&&r.navigator&&r.navigator.standalone&&n&&"_self"!=n?(a=r.document.createElement("A"),e instanceof En||e instanceof En||(e=e.la?e.ja():String(e),An.test(e)||(e="about:invalid#zClosurez"),e=Tn(e)),a.href=xn(e),a.setAttribute("target",n),t.noreferrer&&a.setAttribute("rel","noreferrer"),(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,r,1),a.dispatchEvent(t),a={}):t.noreferrer?(a=r.open("",n,a),t=xn(e),a&&(zt&&$(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),a.opener=null,_n("b/12014412, meta tag with sanitized URL"),t=On(t='<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+H(t)+'">'),a.document.write(function(t){return t instanceof Pn&&t.constructor===Pn&&t.b===In?t.a:(S("expected object of type SafeHtml, got '"+t+"' of type "+u(t)),"type_error:SafeHtml")}(t)),a.document.close())):(a=r.open(xn(e),n,a))&&t.noopener&&(a.opener=null),a)try{a.focus()}catch(t){}return a}var qn=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;function Xn(){var t=null;return new _t(function(e){"complete"==i.document.readyState?e():(t=function(){e()},be(window,"load",t))}).m(function(e){throw we(window,"load",t),e})}function Qn(t){return t=t||or(),!("file:"!==lr()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function Kn(){var t=i.window;try{return!(!t||t==t.top)}catch(t){return!1}}function Zn(){return"object"!=typeof i.window&&"function"==typeof i.importScripts}function Jn(){return e.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":e.INTERNAL.hasOwnProperty("node")?"Node":Zn()?"Worker":"Browser"}function $n(){var t=Jn();return"ReactNative"===t||"Node"===t}var tr="Firefox",er="Chrome";function nr(t){var e=t.toLowerCase();return $(e,"opera/")||$(e,"opr/")||$(e,"opios/")?"Opera":$(e,"iemobile")?"IEMobile":$(e,"msie")||$(e,"trident/")?"IE":$(e,"edge/")?"Edge":$(e,"firefox/")?tr:$(e,"silk/")?"Silk":$(e,"blackberry")?"Blackberry":$(e,"webos")?"Webos":!$(e,"safari/")||$(e,"chrome/")||$(e,"crios/")||$(e,"android")?!$(e,"chrome/")&&!$(e,"crios/")||$(e,"edge/")?$(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":er:"Safari"}var rr={Qc:"FirebaseCore-web",Sc:"FirebaseUI-web"};function ir(t,e){e=e||[];var n,r=[],i={};for(n in rr)i[rr[n]]=!0;for(n=0;n<e.length;n++)void 0!==i[e[n]]&&(delete i[e[n]],r.push(e[n]));return r.sort(),(e=r).length||(e=["FirebaseCore-web"]),"Browser"===(r=Jn())?r=nr(i=or()):"Worker"===r&&(r=nr(i=or())+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function or(){return i.navigator&&i.navigator.userAgent||""}function ar(t,e){t=t.split("."),e=e||i;for(var n=0;n<t.length&&"object"==typeof e&&null!=e;n++)e=e[t[n]];return n!=t.length&&(e=void 0),e}function sr(){try{var t=i.localStorage,e=gr();if(t)return t.setItem(e,"1"),t.removeItem(e),!Vn()||!!i.indexedDB}catch(t){return Zn()&&!!i.indexedDB}return!1}function ur(){return(cr()||"chrome-extension:"===lr()||Qn())&&!$n()&&sr()&&!Zn()}function cr(){return"http:"===lr()||"https:"===lr()}function lr(){return i.location&&i.location.protocol||null}function hr(t){return!Hn(t=t||or())&&nr(t)!=tr}function dr(t){return void 0===t?null:jn(t)}function pr(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&null!==t[e]&&void 0!==t[e]&&(n[e]=t[e]);return n}function fr(t){if(null!==t)return JSON.parse(t)}function gr(t){return t||Math.floor(1e9*Math.random()).toString()}function _r(t){return"Safari"!=nr(t=t||or())&&!t.toLowerCase().match(/iphone|ipad|ipod/)}function vr(){var t=i.___jsl;if(t&&t.H)for(var e in t.H)if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=t.H[e].L.concat(),t.CP)for(var n=0;n<t.CP.length;n++)t.CP[n]=null}function mr(t,e){if(t>e)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=or(),e=Jn(),this.b=Hn(t)||"ReactNative"===e}function yr(){var t=i.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function br(t){try{var e=new Date(parseInt(t,10));if(!isNaN(e.getTime())&&!/[^0-9]/.test(t))return e.toUTCString()}catch(t){}return null}function wr(){return!(!ar("fireauth.oauthhelper",i)&&!ar("fireauth.iframe",i))}mr.prototype.get=function(){var t=i.navigator;return!t||"boolean"!=typeof t.onLine||!cr()&&"chrome-extension:"!==lr()&&void 0===t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Cr,Er={};try{var xr={};Object.defineProperty(xr,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(xr,"abcd",{configurable:!0,enumerable:!0,value:2}),Cr=2==xr.abcd}catch(Wt){Cr=!1}function Ar(t,e,n){Cr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function Sr(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&Ar(t,n,e[n])}function kr(t){var e={};return Sr(e,t),e}function Tr(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)Ar(e,n,Tr(t[n]));return e}var Pr="EMAIL_SIGNIN",Ir="email",Or="newEmail",Nr="requestType",Rr="email",Dr="fromEmail",Mr="data",Lr="operation";function jr(t,e){this.code=Fr+t,this.message=e||Br[t]||""}function Ur(t){var e=t&&t.code;return e?new jr(e.substring(Fr.length),t.message):null}w(jr,Error),jr.prototype.C=function(){return{code:this.code,message:this.message}},jr.prototype.toJSON=function(){return this.C()};var Fr="auth/",Br={"argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal error has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal error has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted.  Please whitelist the domain in the Firebase console.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","user-cancelled":"User did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled."};function Vr(t){var e=t[Yr];if(void 0===e)throw new jr("missing-continue-uri");if("string"!=typeof e||"string"==typeof e&&!e.length)throw new jr("invalid-continue-uri");this.h=e,this.b=this.a=null,this.g=!1;var n=t[Wr];if(n&&"object"==typeof n){e=n[Xr];var r=n[zr];if(n=n[qr],"string"==typeof e&&e.length){if(this.a=e,void 0!==r&&"boolean"!=typeof r)throw new jr("argument-error",zr+" property must be a boolean when specified.");if(this.g=!!r,void 0!==n&&("string"!=typeof n||"string"==typeof n&&!n.length))throw new jr("argument-error",qr+" property must be a non empty string when specified.");this.b=n||null}else{if(void 0!==e)throw new jr("argument-error",Xr+" property must be a non empty string when specified.");if(void 0!==r||void 0!==n)throw new jr("missing-android-pkg-name")}}else if(void 0!==n)throw new jr("argument-error",Wr+" property must be a non null object when specified.");if(this.f=null,(e=t[Hr])&&"object"==typeof e){if("string"==typeof(e=e[Qr])&&e.length)this.f=e;else if(void 0!==e)throw new jr("argument-error",Qr+" property must be a non empty string when specified.")}else if(void 0!==e)throw new jr("argument-error",Hr+" property must be a non null object when specified.");if(void 0!==(t=t[Gr])&&"boolean"!=typeof t)throw new jr("argument-error",Gr+" property must be a boolean when specified.");this.c=!!t}var Wr="android",Gr="handleCodeInApp",Hr="iOS",Yr="url",zr="installApp",qr="minimumVersion",Xr="packageName",Qr="bundleId";function Kr(t){var e={};for(var n in e.continueUrl=t.h,e.canHandleCodeInApp=t.c,(e.androidPackageName=t.a)&&(e.androidMinimumVersion=t.b,e.androidInstallApp=t.g),e.iOSBundleId=t.f,e)null===e[n]&&delete e[n];return e}var Zr=null,Jr=null;function $r(t){var e="";return function(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),i=Jr[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}!function(){if(!Zr){Zr={},Jr={};for(var t=0;65>t;t++)Zr[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(t),Jr[Zr[t]]=t,62<=t&&(Jr["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(t)]=t)}}();for(var r=0;;){var i=n(-1),o=n(0),a=n(64),s=n(64);if(64===s&&-1===i)break;e(i<<2|o>>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}}(t,function(t){e+=String.fromCharCode(t)}),e}function ti(t){this.c=t.sub,b(),this.a=t.provider_id||t.firebase&&t.firebase.sign_in_provider||null,this.b=!!t.is_anonymous||"anonymous"==this.a}function ei(t){return(t=ni(t))&&t.sub&&t.iss&&t.aud&&t.exp?new ti(t):null}function ni(t){if(!t)return null;if(3!=(t=t.split(".")).length)return null;for(var e=(4-(t=t[1]).length%4)%4,n=0;n<e;n++)t+=".";try{return JSON.parse($r(t))}catch(t){}return null}ti.prototype.f=function(){return this.b};var ri="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),ii=["client_id","response_type","scope","redirect_uri","state"],oi={Rc:{Ma:"locale",Aa:500,za:600,Na:"facebook.com",cb:ii},Tc:{Ma:null,Aa:500,za:620,Na:"github.com",cb:ii},Uc:{Ma:"hl",Aa:515,za:680,Na:"google.com",cb:ii},$c:{Ma:"lang",Aa:485,za:705,Na:"twitter.com",cb:ri}};function ai(t){for(var e in oi)if(oi[e].Na==t)return oi[e];return null}function si(t){var e={};e["facebook.com"]=di,e["google.com"]=fi,e["github.com"]=pi,e["twitter.com"]=gi;var n=t&&t[ci];try{if(n)return e[n]?new e[n](t):new hi(t);if(void 0!==t[ui])return new li(t)}catch(t){}return null}var ui="idToken",ci="providerId";function li(t){var e=t[ci];if(!e&&t[ui]){var n=ei(t[ui]);n&&n.a&&(e=n.a)}if(!e)throw Error("Invalid additional user info!");"anonymous"!=e&&"custom"!=e||(e=null),n=!1,void 0!==t.isNewUser?n=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(n=!0),Ar(this,"providerId",e),Ar(this,"isNewUser",n)}function hi(t){li.call(this,t),Ar(this,"profile",Tr((t=fr(t.rawUserInfo||"{}"))||{}))}function di(t){if(hi.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function pi(t){if(hi.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");Ar(this,"username",this.profile&&this.profile.login||null)}function fi(t){if(hi.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function gi(t){if(hi.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");Ar(this,"username",t.screenName||null)}function _i(t){var e=Xe(t),n=qe(e,"link"),r=qe(Xe(n),"link");return qe(Xe(e=qe(e,"deep_link_id")),"link")||e||r||n||t}function vi(t,e){return t.then(function(t){if(t[Zo]){var n=ei(t[Zo]);if(!n||e!=n.c)throw new jr("user-mismatch");return t}throw new jr("user-mismatch")}).m(function(t){throw t&&t.code&&t.code==Fr+"user-not-found"?new jr("user-mismatch"):t})}function mi(t,e,n){if(e.idToken||e.accessToken)e.idToken&&Ar(this,"idToken",e.idToken),e.accessToken&&Ar(this,"accessToken",e.accessToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new jr("internal-error","failed to construct a credential");Ar(this,"accessToken",e.oauthToken),Ar(this,"secret",e.oauthTokenSecret)}Ar(this,"providerId",t),Ar(this,"signInMethod",n)}function yi(t){var e={};return t.idToken&&(e.id_token=t.idToken),t.accessToken&&(e.access_token=t.accessToken),t.secret&&(e.oauth_token_secret=t.secret),e.providerId=t.providerId,{postBody:sn(e).toString(),requestUri:"http://localhost"}}function bi(t,e){this.Ac=e||[],Sr(this,{providerId:t,isOAuthProvider:!0}),this.tb={},this.Za=(ai(t)||{}).Ma||null,this.Xa=null}function wi(t){bi.call(this,t,ii),this.a=[]}function Ci(){wi.call(this,"facebook.com")}function Ei(t){if(!t)throw new jr("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return p(t)&&(e=t.accessToken),(new Ci).credential(null,e)}function xi(){wi.call(this,"github.com")}function Ai(t){if(!t)throw new jr("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return p(t)&&(e=t.accessToken),(new xi).credential(null,e)}function Si(){wi.call(this,"google.com"),this.ta("profile")}function ki(t,e){var n=t;return p(t)&&(n=t.idToken,e=t.accessToken),(new Si).credential(n,e)}function Ti(){bi.call(this,"twitter.com",ri)}function Pi(t,e){var n=t;if(p(n)||(n={oauthToken:t,oauthTokenSecret:e}),!n.oauthToken||!n.oauthTokenSecret)throw new jr("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new mi("twitter.com",n,"twitter.com")}function Ii(t,e,n){this.a=t,this.b=e,Ar(this,"providerId","password"),Ar(this,"signInMethod",n===Oi.EMAIL_LINK_SIGN_IN_METHOD?Oi.EMAIL_LINK_SIGN_IN_METHOD:Oi.EMAIL_PASSWORD_SIGN_IN_METHOD)}function Oi(){Sr(this,{providerId:"password",isOAuthProvider:!1})}function Ni(t,e){if(!(e=Ri(e)))throw new jr("argument-error","Invalid email link!");return new Ii(t,e,Oi.EMAIL_LINK_SIGN_IN_METHOD)}function Ri(t){var e=qe((t=new function(t){this.a=Xe(t)}(t=_i(t))).a,"oobCode")||null;return"signIn"===(qe(t.a,"mode")||null)&&e?e:null}function Di(t){if(!(t.Ra&&t.Qa||t.Ea&&t.Z))throw new jr("internal-error");this.a=t,Ar(this,"providerId","phone"),Ar(this,"signInMethod","phone")}function Mi(t){return t.a.Ea&&t.a.Z?{temporaryProof:t.a.Ea,phoneNumber:t.a.Z}:{sessionInfo:t.a.Ra,code:t.a.Qa}}function Li(t){try{this.a=t||e.auth()}catch(t){throw new jr("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Sr(this,{providerId:"phone",isOAuthProvider:!1})}function ji(t,e){if(!t)throw new jr("missing-verification-id");if(!e)throw new jr("missing-verification-code");return new Di({Ra:t,Qa:e})}function Ui(t){if(t.temporaryProof&&t.phoneNumber)return new Di({Ea:t.temporaryProof,Z:t.phoneNumber});var e=t&&t.providerId;if(!e||"password"===e)return null;var n=t&&t.oauthAccessToken,r=t&&t.oauthTokenSecret;t=t&&t.oauthIdToken;try{switch(e){case"google.com":return ki(t,n);case"facebook.com":return Ei(n);case"github.com":return Ai(n);case"twitter.com":return Pi(n,r);default:return new wi(e).credential(t,n)}}catch(t){return null}}function Fi(t){if(!t.isOAuthProvider)throw new jr("invalid-oauth-provider")}function Bi(t,e,n,r,i){if(this.b=t,this.c=e||null,this.f=n||null,this.g=r||null,this.a=i||null,!this.f&&!this.a)throw new jr("invalid-auth-event");if(this.f&&this.a)throw new jr("invalid-auth-event");if(this.f&&!this.g)throw new jr("invalid-auth-event")}function Vi(t){return(t=t||{}).type?new Bi(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&Ur(t.error)):null}function Wi(){this.b=null,this.a=[]}w(hi,li),w(di,hi),w(pi,hi),w(fi,hi),w(gi,hi),mi.prototype.xa=function(t){return fa(t,yi(this))},mi.prototype.c=function(t,e){var n=yi(this);return n.idToken=e,ga(t,n)},mi.prototype.f=function(t,e){return vi(_a(t,yi(this)),e)},mi.prototype.C=function(){var t={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(t.oauthIdToken=this.idToken),this.accessToken&&(t.oauthAccessToken=this.accessToken),this.secret&&(t.oauthTokenSecret=this.secret),t},bi.prototype.Ca=function(t){return this.tb=at(t),this},w(wi,bi),wi.prototype.ta=function(t){return j(this.a,t)||this.a.push(t),this},wi.prototype.yb=function(){return V(this.a)},wi.prototype.credential=function(t,e){if(!t&&!e)throw new jr("argument-error","credential failed: must provide the ID token and/or the access token.");return new mi(this.providerId,{idToken:t||null,accessToken:e||null},this.providerId)},w(Ci,wi),Ar(Ci,"PROVIDER_ID","facebook.com"),Ar(Ci,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),w(xi,wi),Ar(xi,"PROVIDER_ID","github.com"),Ar(xi,"GITHUB_SIGN_IN_METHOD","github.com"),w(Si,wi),Ar(Si,"PROVIDER_ID","google.com"),Ar(Si,"GOOGLE_SIGN_IN_METHOD","google.com"),w(Ti,bi),Ar(Ti,"PROVIDER_ID","twitter.com"),Ar(Ti,"TWITTER_SIGN_IN_METHOD","twitter.com"),Ii.prototype.xa=function(t){return this.signInMethod==Oi.EMAIL_LINK_SIGN_IN_METHOD?Ya(t,xa,{email:this.a,oobCode:this.b}):Ya(t,Va,{email:this.a,password:this.b})},Ii.prototype.c=function(t,e){return this.signInMethod==Oi.EMAIL_LINK_SIGN_IN_METHOD?Ya(t,Aa,{idToken:e,email:this.a,oobCode:this.b}):Ya(t,Ma,{idToken:e,email:this.a,password:this.b})},Ii.prototype.f=function(t,e){return vi(this.xa(t),e)},Ii.prototype.C=function(){return{email:this.a,password:this.b,signInMethod:this.signInMethod}},Sr(Oi,{PROVIDER_ID:"password"}),Sr(Oi,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Sr(Oi,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),Di.prototype.xa=function(t){return t.Sa(Mi(this))},Di.prototype.c=function(t,e){var n=Mi(this);return n.idToken=e,Ya(t,Ga,n)},Di.prototype.f=function(t,e){var n=Mi(this);return n.operation="REAUTH",vi(t=Ya(t,Ha,n),e)},Di.prototype.C=function(){var t={providerId:"phone"};return this.a.Ra&&(t.verificationId=this.a.Ra),this.a.Qa&&(t.verificationCode=this.a.Qa),this.a.Ea&&(t.temporaryProof=this.a.Ea),this.a.Z&&(t.phoneNumber=this.a.Z),t},Li.prototype.Sa=function(t,e){var n=this.a.b;return Et(e.verify()).then(function(r){if(!o(r))throw new jr("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(e.type){case"recaptcha":return function(t,e){return Ya(t,Ra,e)}(n,{phoneNumber:t,recaptchaToken:r}).then(function(t){return"function"==typeof e.reset&&e.reset(),t},function(t){throw"function"==typeof e.reset&&e.reset(),t});default:throw new jr("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})},Sr(Li,{PROVIDER_ID:"phone"}),Sr(Li,{PHONE_SIGN_IN_METHOD:"phone"}),Bi.prototype.C=function(){return{type:this.b,eventId:this.c,urlResponse:this.f,sessionId:this.g,error:this.a&&this.a.C()}};var Gi=null;function Hi(t){var e="unauthorized-domain",n=void 0,r=Xe(t);t=r.b,"chrome-extension"==(r=r.c)?n=W("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):"http"==r||"https"==r?n=W("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):e="operation-not-supported-in-this-environment",jr.call(this,e,n)}function Yi(t,e,n){jr.call(this,t,n),(t=e||{}).ub&&Ar(this,"email",t.ub),t.Z&&Ar(this,"phoneNumber",t.Z),t.credential&&Ar(this,"credential",t.credential)}function zi(t){if(t.code){var e=t.code||"";0==e.indexOf(Fr)&&(e=e.substring(Fr.length));var n={credential:Ui(t)};if(t.email)n.ub=t.email;else{if(!t.phoneNumber)return new jr(e,t.message||void 0);n.Z=t.phoneNumber}return new Yi(e,n,t.message)}return null}Wi.prototype.subscribe=function(t){var e=this;this.a.push(t),this.b||(this.b=function(t){for(var n=0;n<e.a.length;n++)e.a[n](t)},"function"==typeof(t=ar("universalLinks.subscribe",i))&&t(null,this.b))},Wi.prototype.unsubscribe=function(t){F(this.a,function(e){return e==t})},w(Hi,jr),w(Yi,jr),Yi.prototype.C=function(){var t={code:this.code,message:this.message};this.email&&(t.email=this.email),this.phoneNumber&&(t.phoneNumber=this.phoneNumber);var e=this.credential&&this.credential.C();return e&&lt(t,e),t},Yi.prototype.toJSON=function(){return this.C()};var qi,Xi=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;function Qi(){}function Ki(t){return t.c||(t.c=t.b())}function Zi(){}function Ji(t){if(!t.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n<e.length;n++){var r=e[n];try{return new ActiveXObject(r),t.f=r}catch(t){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return t.f}function $i(){}function to(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseText="",this.status=-1,this.statusText="",this.a.onload=m(this.bc,this),this.a.onerror=m(this.zb,this),this.a.onprogress=m(this.cc,this),this.a.ontimeout=m(this.fc,this)}function eo(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function no(t,e,n){this.reset(t,e,n,void 0,void 0)}Qi.prototype.c=null,w(Zi,Qi),Zi.prototype.a=function(){var t=Ji(this);return t?new ActiveXObject(t):new XMLHttpRequest},Zi.prototype.b=function(){var t={};return Ji(this)&&(t[0]=!0,t[1]=!0),t},qi=new Zi,w($i,Qi),$i.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new to;throw Error("Unsupported browser")},$i.prototype.b=function(){return{}},(t=to.prototype).open=function(t,e,n){if(null!=n&&!n)throw Error("Only async requests are supported.");this.a.open(t,e)},t.send=function(t){if(t){if("string"!=typeof t)throw Error("Only string data is supported");this.a.send(t)}else this.a.send()},t.abort=function(){this.a.abort()},t.setRequestHeader=function(){},t.getResponseHeader=function(t){return"content-type"==t.toLowerCase()?this.a.contentType:""},t.bc=function(){this.status=200,this.responseText=this.a.responseText,eo(this,4)},t.zb=function(){this.status=500,this.responseText="",eo(this,4)},t.fc=function(){this.zb()},t.cc=function(){this.status=200,eo(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},no.prototype.a=null;function ro(t){this.f=t,this.b=this.c=this.a=null}function io(t,e){this.name=t,this.value=e}no.prototype.reset=function(t,e,n,r,i){"number"==typeof i||0,r||b(),delete this.a},io.prototype.toString=function(){return this.name};var oo=new io("SEVERE",1e3),ao=new io("WARNING",900),so=new io("CONFIG",700),uo=new io("FINE",500);ro.prototype.log=function(t,e,n){if(t.value>=function t(e){return e.c?e.c:e.a?t(e.a):(S("Root logger has no level set."),null)}(this).value)for(d(e)&&(e=e()),t=new no(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var co={},lo=null;function ho(t){var e;if(lo||(lo=new ro(""),co[""]=lo,lo.c=so),!(e=co[t])){e=new ro(t);var n=t.lastIndexOf("."),r=t.substr(n+1);(n=ho(t.substr(0,n))).b||(n.b={}),n.b[r]=e,e.a=n,co[t]=e}return e}function po(t,e){t&&t.log(uo,e,void 0)}function fo(t){this.f=t}function go(t){Ie.call(this),this.j=t,this.readyState=_o,this.status=0,this.responseText=this.statusText="",this.onreadystatechange=null,this.g=new Headers,this.b=null,this.h="GET",this.c="",this.a=!1,this.f=ho("goog.net.FetchXmlHttp")}w(fo,Qi),fo.prototype.a=function(){return new go(this.f)},fo.prototype.b=function(t){return function(){return t}}({}),w(go,Ie);var _o=0;function vo(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function mo(t){Ie.call(this),this.headers=new Ue,this.D=t||null,this.c=!1,this.B=this.a=null,this.h=this.N=this.l="",this.f=this.I=this.j=this.G=!1,this.g=0,this.s=null,this.o=yo,this.v=this.O=!1}(t=go.prototype).open=function(t,e){if(this.readyState!=_o)throw this.abort(),Error("Error reopening a connection");this.h=t,this.c=e,this.readyState=1,vo(this)},t.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var e={headers:this.g,method:this.h,credentials:void 0,cache:void 0};t&&(e.body=t),this.j.fetch(new Request(this.c,e)).then(this.ec.bind(this),this.Ab.bind(this))},t.abort=function(){this.responseText="",this.g=new Headers,this.status=0,1<=this.readyState&&this.a&&4!=this.readyState&&(this.readyState=4,this.a=!1,vo(this)),this.readyState=_o},t.ec=function(t){this.a&&(this.b||(this.b=t.headers,this.readyState=2,vo(this)),this.a&&(this.readyState=3,vo(this),this.a&&t.text().then(this.dc.bind(this,t),this.Ab.bind(this))))},t.dc=function(t,e){this.a&&(this.status=t.status,this.statusText=t.statusText,this.responseText=e,this.readyState=4,vo(this))},t.Ab=function(t){var e=this.f;e&&e.log(ao,"Failed to fetch url "+this.c,t instanceof Error?t:Error(t)),this.a&&(this.readyState=4,vo(this))},t.setRequestHeader=function(t,e){this.g.append(t,e)},t.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.f)&&t.log(ao,"Attempting to get response header but no headers have been received for url: "+this.c,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var t=this.f;return t&&t.log(ao,"Attempting to get all response headers but no headers have been received for url: "+this.c,void 0),""}t=[];for(var e=this.b.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},w(mo,Ie);var yo="";mo.prototype.b=ho("goog.net.XhrIo");var bo=/^https?$/i,wo=["POST","PUT"];function Co(t,e,n,r,a){if(t.a)throw Error("[goog.net.XhrIo] Object is active with another request="+t.l+"; newUri="+e);n=n?n.toUpperCase():"GET",t.l=e,t.h="",t.N=n,t.G=!1,t.c=!0,t.a=t.D?t.D.a():qi.a(),t.B=t.D?Ki(t.D):Ki(qi),t.a.onreadystatechange=m(t.Db,t);try{po(t.b,Oo(t,"Opening Xhr")),t.I=!0,t.a.open(n,String(e),!0),t.I=!1}catch(e){return po(t.b,Oo(t,"Error opening Xhr: "+e.message)),void xo(t,e)}e=r||"";var s=new Ue(t.headers);a&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(h(t)||o(t))D(t,e,void 0);else for(var n=je(t),r=Le(t),i=r.length,a=0;a<i;a++)e.call(void 0,r[a],n&&n[a],t)}(a,function(t,e){s.set(e,t)}),a=function(t){t:{for(var e=Eo,n=t.length,r=o(t)?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return 0>e?null:o(t)?t.charAt(e):t[e]}(s.U()),r=i.FormData&&e instanceof i.FormData,!j(wo,n)||a||r||s.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),s.forEach(function(t,e){this.a.setRequestHeader(e,t)},t),t.o&&(t.a.responseType=t.o),"withCredentials"in t.a&&t.a.withCredentials!==t.O&&(t.a.withCredentials=t.O);try{To(t),0<t.g&&(t.v=function(t){return Ht&&ee(9)&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(t.a),po(t.b,Oo(t,"Will abort after "+t.g+"ms if incomplete, xhr2 "+t.v)),t.v?(t.a.timeout=t.g,t.a.ontimeout=m(t.Fa,t)):t.s=De(t.Fa,t.g,t)),po(t.b,Oo(t,"Sending request")),t.j=!0,t.a.send(e),t.j=!1}catch(e){po(t.b,Oo(t,"Send error: "+e.message)),xo(t,e)}}function Eo(t){return"content-type"==t.toLowerCase()}function xo(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,Ao(t),ko(t)}function Ao(t){t.G||(t.G=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function So(t){if(t.c&&void 0!==r)if(t.B[1]&&4==Po(t)&&2==Io(t))po(t.b,Oo(t,"Local request error detected and ignored"));else if(t.j&&4==Po(t))De(t.Db,0,t);else if(t.dispatchEvent("readystatechange"),4==Po(t)){po(t.b,Oo(t,"Request complete")),t.c=!1;try{var e,n=Io(t);t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var o=!0;break t;default:o=!1}if(!(e=o)){var a;if(a=0===n){var s=String(t.l).match(Ve)[1]||null;if(!s&&i.self&&i.self.location){var u=i.self.location.protocol;s=u.substr(0,u.length-1)}a=!bo.test(s?s.toLowerCase():"")}e=a}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{try{var c=2<Po(t)?t.a.statusText:""}catch(e){po(t.b,"Can not get status: "+e.message),c=""}t.h=c+" ["+Io(t)+"]",Ao(t)}}finally{ko(t)}}}function ko(t,e){if(t.a){To(t);var n=t.a,r=t.B[0]?s:null;t.a=null,t.B=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(e){(t=t.b)&&t.log(oo,"Problem encountered resetting onreadystatechange: "+e.message,void 0)}}}function To(t){t.a&&t.v&&(t.a.ontimeout=null),t.s&&(i.clearTimeout(t.s),t.s=null)}function Po(t){return t.a?t.a.readyState:0}function Io(t){try{return 2<Po(t)?t.a.status:-1}catch(t){return-1}}function Oo(t,e){return e+" ["+t.N+" "+t.l+" "+Io(t)+"]"}function No(t,e){this.g=[],this.v=t,this.s=e||null,this.f=this.a=!1,this.c=void 0,this.u=this.B=this.j=!1,this.h=0,this.b=null,this.l=0}function Ro(t,e,n){t.a=!0,t.c=n,t.f=!e,jo(t)}function Do(t){if(t.a){if(!t.u)throw new Uo(t);t.u=!1}}function Mo(t,e,n,r){t.g.push([e,n,r]),t.a&&jo(t)}function Lo(t){return L(t.g,function(t){return d(t[1])})}function jo(t){if(t.h&&t.a&&Lo(t)){var e=t.h,n=Vo[e];n&&(i.clearTimeout(n.a),delete Vo[e]),t.h=0}t.b&&(t.b.l--,delete t.b),e=t.c;for(var r=n=!1;t.g.length&&!t.j;){var o=t.g.shift(),a=o[0],s=o[1];if(o=o[2],a=t.f?s:a)try{var u=a.call(o||t.s,e);void 0!==u&&(t.f=t.f&&(u==e||u instanceof Error),t.c=e=u),(E(e)||"function"==typeof i.Promise&&e instanceof i.Promise)&&(r=!0,t.j=!0)}catch(r){e=r,t.f=!0,Lo(t)||(n=!0)}}t.c=e,r&&(u=m(t.o,t,!0),r=m(t.o,t,!1),e instanceof No?(Mo(e,u,r),e.B=!0):e.then(u,r)),n&&(e=new Bo(e),Vo[e.a]=e,t.h=e.a)}function Uo(){x.call(this)}function Fo(){x.call(this)}function Bo(t){this.a=i.setTimeout(m(this.c,this),0),this.b=t}(t=mo.prototype).Fa=function(){void 0!==r&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",po(this.b,Oo(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(po(this.b,Oo(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),ko(this))},t.ua=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),ko(this,!0)),mo.lb.ua.call(this)},t.Db=function(){this.pa||(this.I||this.j||this.f?So(this):this.tc())},t.tc=function(){So(this)},t.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.o){case yo:case"text":return this.a.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in this.a)return this.a.mozResponseArrayBuffer}var t=this.b;return t&&t.log(oo,"Response type "+this.o+" is not supported on this browser",void 0),null}catch(t){return po(this.b,"Can not get response: "+t.message),null}},No.prototype.cancel=function(t){if(this.a)this.c instanceof No&&this.c.cancel();else{if(this.b){var e=this.b;delete this.b,t?e.cancel(t):(e.l--,0>=e.l&&e.cancel())}this.v?this.v.call(this.s,this):this.u=!0,this.a||(t=new Fo(this),Do(this),Ro(this,!1,t))}},No.prototype.o=function(t,e){this.j=!1,Ro(this,t,e)},No.prototype.D=function(){Do(this),Ro(this,!0,null)},No.prototype.then=function(t,e,n){var r,i,o=new _t(function(t,e){r=t,i=e});return Mo(this,r,function(t){t instanceof Fo?o.cancel():i(t)}),o.then(t,e,n)},C(No),w(Uo,x),Uo.prototype.message="Deferred has already fired",Uo.prototype.name="AlreadyCalledError",w(Fo,x),Fo.prototype.message="Deferred was canceled",Fo.prototype.name="CanceledError",Bo.prototype.c=function(){throw delete Vo[this.a],this.b};var Vo={};function Wo(t){var e={},n=e.document||document,r=mn(t),i=document.createElement("SCRIPT"),o={Fb:i,Fa:void 0},a=new No(Go,o),s=null,u=null!=e.timeout?e.timeout:5e3;return 0<u&&(s=window.setTimeout(function(){Ho(i,!0);var t=new qo(zo,"Timeout reached for loading script "+r);Do(a),Ro(a,!1,t)},u),o.Fa=s),i.onload=i.onreadystatechange=function(){i.readyState&&"loaded"!=i.readyState&&"complete"!=i.readyState||(Ho(i,e.bd||!1,s),a.D())},i.onerror=function(){Ho(i,!0,s);var t=new qo(Yo,"Error while loading script "+r);Do(a),Ro(a,!1,t)},lt(o=e.attributes||{},{type:"text/javascript",charset:"UTF-8"}),Rn(i,o),i.src=mn(t),function(t){var e;return(e=(t||document).getElementsByTagName("HEAD"))&&0!=e.length?e[0]:t.documentElement}(n).appendChild(i),a}function Go(){if(this&&this.Fb){var t=this.Fb;t&&"SCRIPT"==t.tagName&&Ho(t,!0,this.Fa)}}function Ho(t,e,n){null!=n&&i.clearTimeout(n),t.onload=s,t.onerror=s,t.onreadystatechange=s,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}var Yo=0,zo=1;function qo(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),x.call(this,n),this.code=t}function Xo(t){this.f=t}function Qo(t,n,r){if(this.b=t,t=n||{},this.j=t.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.l=t.secureTokenTimeout||Jo,this.f=at(t.secureTokenHeaders||$o),this.g=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.h=t.firebaseTimeout||ta,this.a=at(t.firebaseHeaders||ea),r&&(this.a["X-Client-Version"]=r,this.f["X-Client-Version"]=r),r="Node"==Jn(),!(r=i.XMLHttpRequest||r&&e.INTERNAL.node&&e.INTERNAL.node.XMLHttpRequest)&&!Zn())throw new jr("internal-error","The XMLHttpRequest compatibility library was not found.");this.c=void 0,Zn()?this.c=new fo(self):$n()?this.c=new Xo(r):this.c=new $i}w(qo,x),w(Xo,Qi),Xo.prototype.a=function(){return new this.f},Xo.prototype.b=function(){return{}};var Ko,Zo="idToken",Jo=new mr(3e4,6e4),$o={"Content-Type":"application/x-www-form-urlencoded"},ta=new mr(3e4,6e4),ea={"Content-Type":"application/json"};function na(t,e){e?t.a["X-Firebase-Locale"]=e:delete t.a["X-Firebase-Locale"]}function ra(t,e){e?(t.a["X-Client-Version"]=e,t.f["X-Client-Version"]=e):(delete t.a["X-Client-Version"],delete t.f["X-Client-Version"])}function ia(t,e,n,r,o,a,s){(function(){var t=or();return!((t=nr(t)!=er?null:(t=t.match(/\sChrome\/(\d+)/i))&&2==t.length?parseInt(t[1],10):null)&&30>t||Ht&&$t&&!(9<$t))})()||Zn()?t=m(t.o,t):(Ko||(Ko=new _t(function(t,e){!function(t,e){if(((window.gapi||{}).client||{}).request)t();else{i[aa]=function(){((window.gapi||{}).client||{}).request?t():e(Error("CORS_UNSUPPORTED"))};var n=yn(oa,{onload:aa});!function(t,e){Mo(t,null,e,void 0)}(Wo(n),function(){e(Error("CORS_UNSUPPORTED"))})}}(t,e)})),t=m(t.u,t)),t(e,n,r,o,a,s)}Qo.prototype.o=function(t,e,n,r,o,a){if(Zn()&&(void 0===i.fetch||void 0===i.Headers||void 0===i.Request))throw new jr("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var s=new mo(this.c);if(a){s.g=Math.max(0,a);var u=setTimeout(function(){s.dispatchEvent("timeout")},a)}Oe(s,"complete",function(){u&&clearTimeout(u);var t=null;try{t=JSON.parse(function(t){try{return t.a?t.a.responseText:""}catch(e){return po(t.b,"Can not get responseText: "+e.message),""}}(this))||null}catch(e){t=null}e&&e(t)}),Ne(s,"ready",function(){u&&clearTimeout(u),Ft(this)}),Ne(s,"timeout",function(){u&&clearTimeout(u),Ft(this),e&&e(null)}),Co(s,t,n,r,o)};var oa=_n("https://apis.google.com/js/client.js?onload=%{onload}"),aa="__fcb"+Math.floor(1e6*Math.random()).toString();function sa(t){if(!Xi.test(t.email))throw new jr("invalid-email")}function ua(t){"email"in t&&sa(t)}function ca(t){if(!t[Zo])throw new jr("internal-error")}function la(t){if(t.phoneNumber||t.temporaryProof){if(!t.phoneNumber||!t.temporaryProof)throw new jr("internal-error")}else{if(!t.sessionInfo)throw new jr("missing-verification-id");if(!t.code)throw new jr("missing-verification-code")}}Qo.prototype.u=function(t,e,n,r,i){var o=this;Ko.then(function(){window.gapi.client.setApiKey(o.b);var a=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:t,method:n,body:r,headers:i,authType:"none",callback:function(t){window.gapi.auth.setToken(a),e&&e(t)}})}).m(function(t){e&&e({error:{message:t&&t.message||"CORS_UNSUPPORTED"}})})},Qo.prototype.jb=function(){return Ya(this,La,{})},Qo.prototype.mb=function(t,e){return Ya(this,Da,{idToken:t,email:e})},Qo.prototype.nb=function(t,e){return Ya(this,Ma,{idToken:t,password:e})};var ha={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function da(t){if(!t.requestUri||!t.sessionId&&!t.postBody)throw new jr("internal-error")}function pa(t){var e=null;if(t.needConfirmation?(t.code="account-exists-with-different-credential",e=zi(t)):"FEDERATED_USER_ID_ALREADY_LINKED"==t.errorMessage?(t.code="credential-already-in-use",e=zi(t)):"EMAIL_EXISTS"==t.errorMessage?(t.code="email-already-in-use",e=zi(t)):t.errorMessage&&(e=za(t.errorMessage)),e)throw e;if(!t[Zo])throw new jr("internal-error")}function fa(t,e){return e.returnIdpCredential=!0,Ya(t,ja,e)}function ga(t,e){return e.returnIdpCredential=!0,Ya(t,Fa,e)}function _a(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,Ya(t,Ua,e)}function va(t){if(!t.oobCode)throw new jr("invalid-action-code")}(t=Qo.prototype).ob=function(t,e){var n={idToken:t},r=[];return it(ha,function(t,i){var o=e[i];null===o?r.push(t):i in e&&(n[i]=o)}),r.length&&(n.deleteAttribute=r),Ya(this,Da,n)},t.gb=function(t,e){return lt(t={requestType:"PASSWORD_RESET",email:t},e),Ya(this,Pa,t)},t.hb=function(t,e){return lt(t={requestType:"EMAIL_SIGNIN",email:t},e),Ya(this,ka,t)},t.fb=function(t,e){return lt(t={requestType:"VERIFY_EMAIL",idToken:t},e),Ya(this,Ta,t)},t.Sa=function(t){return Ya(this,Wa,t)},t.Wa=function(t,e){return Ya(this,Na,{oobCode:t,newPassword:e})},t.Ia=function(t){return Ya(this,ya,{oobCode:t})},t.Ua=function(t){return Ya(this,ma,{oobCode:t})};var ma={endpoint:"setAccountInfo",A:va,ba:"email"},ya={endpoint:"resetPassword",A:va,J:function(t){var e=t.requestType;if(!e||!t.email&&"EMAIL_SIGNIN"!=e)throw new jr("internal-error")}},ba={endpoint:"signupNewUser",A:function(t){if(sa(t),!t.password)throw new jr("weak-password")},J:ca,R:!0},wa={endpoint:"createAuthUri"},Ca={endpoint:"deleteAccount",T:["idToken"]},Ea={endpoint:"setAccountInfo",T:["idToken","deleteProvider"],A:function(t){if(!l(t.deleteProvider))throw new jr("internal-error")}},xa={endpoint:"emailLinkSignin",T:["email","oobCode"],A:sa,J:ca,R:!0},Aa={endpoint:"emailLinkSignin",T:["idToken","email","oobCode"],A:sa,J:ca,R:!0},Sa={endpoint:"getAccountInfo"},ka={endpoint:"getOobConfirmationCode",T:["requestType"],A:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new jr("internal-error");sa(t)},ba:"email"},Ta={endpoint:"getOobConfirmationCode",T:["idToken","requestType"],A:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new jr("internal-error")},ba:"email"},Pa={endpoint:"getOobConfirmationCode",T:["requestType"],A:function(t){if("PASSWORD_RESET"!=t.requestType)throw new jr("internal-error");sa(t)},ba:"email"},Ia={pb:!0,endpoint:"getProjectConfig",Cb:"GET"},Oa={pb:!0,endpoint:"getRecaptchaParam",Cb:"GET",J:function(t){if(!t.recaptchaSiteKey)throw new jr("internal-error")}},Na={endpoint:"resetPassword",A:va,ba:"email"},Ra={endpoint:"sendVerificationCode",T:["phoneNumber","recaptchaToken"],ba:"sessionInfo"},Da={endpoint:"setAccountInfo",T:["idToken"],A:ua,R:!0},Ma={endpoint:"setAccountInfo",T:["idToken"],A:function(t){if(ua(t),!t.password)throw new jr("weak-password")},J:ca,R:!0},La={endpoint:"signupNewUser",J:ca,R:!0},ja={endpoint:"verifyAssertion",A:da,J:pa,R:!0},Ua={endpoint:"verifyAssertion",A:da,J:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new jr("user-not-found");if(t.errorMessage)throw za(t.errorMessage);if(!t[Zo])throw new jr("internal-error")},R:!0},Fa={endpoint:"verifyAssertion",A:function(t){if(da(t),!t.idToken)throw new jr("internal-error")},J:pa,R:!0},Ba={endpoint:"verifyCustomToken",A:function(t){if(!t.token)throw new jr("invalid-custom-token")},J:ca,R:!0},Va={endpoint:"verifyPassword",A:function(t){if(sa(t),!t.password)throw new jr("wrong-password")},J:ca,R:!0},Wa={endpoint:"verifyPhoneNumber",A:la,J:ca},Ga={endpoint:"verifyPhoneNumber",A:function(t){if(!t.idToken)throw new jr("internal-error");la(t)},J:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",zi(t);ca(t)}},Ha={Tb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:la,J:ca};function Ya(t,e,n){if(!function(t,e){if(!e||!e.length)return!0;if(!t)return!1;for(var n=0;n<e.length;n++){var r=t[e[n]];if(void 0===r||null===r||""===r)return!1}return!0}(n,e.T))return xt(new jr("internal-error"));var r,i=e.Cb||"POST";return Et(n).then(e.A).then(function(){return e.R&&(n.returnSecureToken=!0),function(t,e,n,r,i,o){var a=Xe(t.g+e);ze(a,"key",t.b),o&&ze(a,"cb",b().toString());var s="GET"==n;if(s)for(var u in r)r.hasOwnProperty(u)&&ze(a,u,r[u]);return new _t(function(e,o){ia(t,a.toString(),function(t){t?t.error?o(qa(t,i||{})):e(t):o(new jr("network-request-failed"))},n,s?void 0:jn(pr(r)),t.a,t.h.get())})}(t,e.endpoint,i,n,e.Tb,e.pb||!1)}).then(function(t){return r=t}).then(e.J).then(function(){if(!e.ba)return r;if(!(e.ba in r))throw new jr("internal-error");return r[e.ba]})}function za(t){return qa({error:{errors:[{message:t}],code:400,message:t}})}function qa(t,e){var n=(t.error&&t.error.errors&&t.error.errors[0]||{}).reason||"",r={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(n=r[n]?new jr(r[n]):null)return n;for(var i in n=t.error&&t.error.message||"",lt(r={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",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",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash"},e||{}),e=(e=n.match(/^[^\s]+\s*:\s*(.*)$/))&&1<e.length?e[1]:void 0,r)if(0===n.indexOf(i))return new jr(r[i],e);return!e&&t&&(e=dr(t)),new jr("internal-error",e)}var Xa,Qa={Wc:{Ya:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",eb:"https://securetoken.googleapis.com/v1/token",id:"p"},Yc:{Ya:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",eb:"https://staging-securetoken.sandbox.googleapis.com/v1/token",id:"s"},Zc:{Ya:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",eb:"https://test-securetoken.sandbox.googleapis.com/v1/token",id:"t"}};function Ka(t){for(var e in Qa)if(Qa[e].id===t)return{firebaseEndpoint:(t=Qa[e]).Ya,secureTokenEndpoint:t.eb};return null}function Za(t){this.b=t,this.a=null,this.ab=function(t){return(ns||(ns=new _t(function(t,e){function n(){vr(),ar("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){vr(),e(Error("Network Error"))},timeout:ts.get()})}if(ar("gapi.iframes.Iframe"))t();else if(ar("gapi.load"))n();else{var r="__iframefcb"+Math.floor(1e6*Math.random()).toString();i[r]=function(){ar("gapi.load")?n():e(Error("Network Error"))},Et(Wo(r=yn($a,{onload:r}))).m(function(){e(Error("Network Error"))})}}).m(function(t){throw ns=null,t}))).then(function(){return new _t(function(e,n){ar("gapi.iframes.getContext")().open({where:document.body,url:t.b,messageHandlersFilter:ar("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},function(r){function i(){clearTimeout(o),e()}t.a=r,t.a.restyle({setHideOnLeave:!1});var o=setTimeout(function(){n(Error("Network Error"))},es.get());r.ping(i).then(i,function(){n(Error("Network Error"))})})})})}(this)}Xa=Ka("__EID__")?"__EID__":void 0;var Ja,$a=_n("https://apis.google.com/js/api.js?onload=%{onload}"),ts=new mr(3e4,6e4),es=new mr(5e3,15e3),ns=null;function rs(t,e,n){this.j=t,this.g=e,this.h=n,this.f=null,this.a=Qe(this.j,"/__/auth/iframe"),ze(this.a,"apiKey",this.g),ze(this.a,"appName",this.h),this.b=null,this.c=[]}function is(t,e,n,r,i){this.o=t,this.u=e,this.c=n,this.l=r,this.h=this.g=this.j=null,this.a=i,this.f=null}function os(t){try{return e.app(t).auth().Ka()}catch(t){return[]}}function as(t,e,n,r,i){this.u=t,this.f=e,this.b=n,this.c=r||null,this.h=i||null,this.o=this.s=this.v=null,this.g=[],this.l=this.a=null}function ss(t){var e=Wn();return function(t){return Ya(t,Ia,{}).then(function(t){return t.authorizedDomains||[]})}(t).then(function(t){t:{var n=Xe(e),r=n.c;n=n.b;for(var i=0;i<t.length;i++){var o=t[i],a=n,s=r;if(0==o.indexOf("chrome-extension://")?a=Xe(o).b==a&&"chrome-extension"==s:"http"!=s&&"https"!=s?a=!1:qn.test(o)?a=a==o:(o=o.split(".").join("\\."),a=new RegExp("^(.+\\."+o+"|"+o+")$","i").test(a)),a){t=!0;break t}}t=!1}if(!t)throw new Hi(Wn())})}function us(t){return t.l?t.l:(t.l=Xn().then(function(){if(!t.s){var e=t.c,n=t.h,r=os(t.b),i=new rs(t.u,t.f,t.b);i.f=e,i.b=n,i.c=V(r||[]),t.s=i.toString()}t.j=new Za(t.s),function(t){if(!t.j)throw Error("IfcHandler must be initialized!");!function(t,e){t.ab.then(function(){t.a.register("authEvent",e,ar("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}(t.j,function(e){var n={};if(e&&e.authEvent){var r=!1;for(e=Vi(e.authEvent),n=0;n<t.g.length;n++)r=t.g[n](e)||r;return(n={}).status=r?"ACK":"ERROR",Et(n)}return n.status="ERROR",Et(n)})}(t)}),t.l)}function cs(t){return t.o||(t.v=t.c?ir(t.c,os(t.b)):null,t.o=new Qo(t.f,Ka(t.h),t.v)),t.o}function ls(t,e,n,r,i,o,a,s,u,c){return(t=new is(t,e,n,r,i)).j=o,t.g=a,t.h=s,t.b=at(u||null),t.f=c,t.toString()}function hs(t){if(this.a=t||e.INTERNAL.reactNative&&e.INTERNAL.reactNative.AsyncStorage,!this.a)throw new jr("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function ds(){if(!gs())throw new jr("web-storage-unsupported");this.f={},this.a=[],this.b=0,this.g=i.indexedDB,this.type="indexedDB"}function ps(t){return new _t(function(e,n){var r=t.g.open("firebaseLocalStorageDb",1);r.onerror=function(t){try{t.preventDefault()}catch(t){}n(Error(t.target.error))},r.onupgradeneeded=function(t){t=t.target.result;try{t.createObjectStore("firebaseLocalStorage",{keyPath:"fbase_key"})}catch(t){n(t)}},r.onsuccess=function(r){(r=r.target.result).objectStoreNames.contains("firebaseLocalStorage")?e(r):function(t){return new _t(function(e,n){var r=t.g.deleteDatabase("firebaseLocalStorageDb");r.onsuccess=function(){e()},r.onerror=function(t){n(Error(t.target.error))}})}(t).then(function(){return ps(t)}).then(function(t){e(t)}).m(function(t){n(t)})}})}function fs(t){return t.h||(t.h=ps(t)),t.h}function gs(){try{return!!i.indexedDB}catch(t){return!1}}function _s(t){return t.objectStore("firebaseLocalStorage")}function vs(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function ms(t){return new _t(function(e,n){t.onsuccess=function(t){t&&t.target?e(t.target.result):e()},t.onerror=function(t){n(Error(t.target.errorCode))}})}function ys(t){var e=this,n=null;this.a=[],this.type="indexedDB",this.c=t,this.b=Et().then(function(){return gs()?(Ja||(Ja=new ds),(n=Ja).set("__sak","!").then(function(){return n.get("__sak")}).then(function(t){if("!"!==t)throw Error("indexedDB not supported!");return n.P("__sak")}).then(function(){return n}).m(function(){return e.c})):e.c}).then(function(t){return e.type=t.type,t.Y(function(t){D(e.a,function(e){e(t)})}),t})}function bs(){this.a={},this.type="inMemory"}function ws(){if(!function(){var t="Node"==Jn();if(!(t=Cs()||t&&e.INTERNAL.node&&e.INTERNAL.node.localStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==Jn())throw new jr("internal-error","The LocalStorage compatibility library was not found.");throw new jr("web-storage-unsupported")}this.a=Cs()||e.INTERNAL.node.localStorage,this.type="localStorage"}function Cs(){try{var t=i.localStorage,e=gr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Es(){this.type="nullStorage"}function xs(){if(!function(){var t="Node"==Jn();if(!(t=As()||t&&e.INTERNAL.node&&e.INTERNAL.node.sessionStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==Jn())throw new jr("internal-error","The SessionStorage compatibility library was not found.");throw new jr("web-storage-unsupported")}this.a=As()||e.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function As(){try{var t=i.sessionStorage,e=gr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}rs.prototype.toString=function(){return this.f?ze(this.a,"v",this.f):un(this.a.a,"v"),this.b?ze(this.a,"eid",this.b):un(this.a.a,"eid"),this.c.length?ze(this.a,"fw",this.c.join(",")):un(this.a.a,"fw"),this.a.toString()},is.prototype.toString=function(){var t=Qe(this.o,"/__/auth/handler");if(ze(t,"apiKey",this.u),ze(t,"appName",this.c),ze(t,"authType",this.l),this.a.isOAuthProvider){var n=this.a;try{var r=e.app(this.c).auth().ca()}catch(t){r=null}for(var i in n.Xa=r,ze(t,"providerId",this.a.providerId),r=pr((n=this.a).tb))r[i]=r[i].toString();i=n.Ac,r=at(r);for(var o=0;o<i.length;o++){var a=i[o];a in r&&delete r[a]}n.Za&&n.Xa&&!r[n.Za]&&(r[n.Za]=n.Xa),ot(r)||ze(t,"customParameters",dr(r))}if("function"==typeof this.a.yb&&((n=this.a.yb()).length&&ze(t,"scopes",n.join(","))),this.j?ze(t,"redirectUrl",this.j):un(t.a,"redirectUrl"),this.g?ze(t,"eventId",this.g):un(t.a,"eventId"),this.h?ze(t,"v",this.h):un(t.a,"v"),this.b)for(var s in this.b)this.b.hasOwnProperty(s)&&!qe(t,s)&&ze(t,s,this.b[s]);return this.f?ze(t,"eid",this.f):un(t.a,"eid"),(s=os(this.c)).length&&ze(t,"fw",s.join(",")),t.toString()},(t=as.prototype).Da=function(t,e,n){var r=new jr("popup-closed-by-user"),i=new jr("web-storage-unsupported"),o=this,a=!1;return this.ea().then(function(){(function(t){var e={type:"webStorageSupport"};return us(t).then(function(){return function(t,e){return t.ab.then(function(){return new _t(function(n){t.a.send(e.type,e,n,ar("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})})}(t.j,e)}).then(function(t){if(t&&t.length&&void 0!==t[0].webStorageSupport)return t[0].webStorageSupport;throw Error()})})(o).then(function(n){n||(t&&Yn(t),e(i),a=!0)})}).m(function(){}).then(function(){if(!a)return function(t){return new _t(function(e){return function n(){Me(2e3).then(function(){if(t&&!t.closed)return n();e()})}()})}(t)}).then(function(){if(!a)return Me(n).then(function(){e(r)})})},t.Gb=function(){var t=or();return!hr(t)&&!_r(t)},t.Bb=function(){return!1},t.xb=function(t,e,n,r,i,o,a){if(!t)return xt(new jr("popup-blocked"));if(a&&!hr())return this.ea().m(function(e){Yn(t),i(e)}),r(),Et();this.a||(this.a=ss(cs(this)));var s=this;return this.a.then(function(){var e=s.ea().m(function(e){throw Yn(t),i(e),e});return r(),e}).then(function(){(Fi(n),a)||Gn(ls(s.u,s.f,s.b,e,n,null,o,s.c,void 0,s.h),t)}).m(function(t){throw"auth/network-request-failed"==t.code&&(s.a=null),t})},t.Ba=function(t,e,n){this.a||(this.a=ss(cs(this)));var r=this;return this.a.then(function(){Fi(e),Gn(ls(r.u,r.f,r.b,t,e,Wn(),n,r.c,void 0,r.h))}).m(function(t){throw"auth/network-request-failed"==t.code&&(r.a=null),t})},t.ea=function(){var t=this;return us(this).then(function(){return t.j.ab}).m(function(){throw t.a=null,new jr("network-request-failed")})},t.Lb=function(){return!0},t.va=function(t){this.g.push(t)},t.Ja=function(t){F(this.g,function(e){return e==t})},(t=hs.prototype).get=function(t){return Et(this.a.getItem(t)).then(function(t){return t&&fr(t)})},t.set=function(t,e){return Et(this.a.setItem(t,dr(e)))},t.P=function(t){return Et(this.a.removeItem(t))},t.Y=function(){},t.aa=function(){},(t=ds.prototype).set=function(t,e){var n,r=!1,i=this;return fs(this).then(function(e){return ms((e=_s(vs(n=e,!0))).get(t))}).then(function(o){var a=_s(vs(n,!0));return o?(o.value=e,ms(a.put(o))):(i.b++,r=!0,(o={}).fbase_key=t,o.value=e,ms(a.add(o)))}).then(function(){i.f[t]=e}).ha(function(){r&&i.b--})},t.get=function(t){return fs(this).then(function(e){return ms(_s(vs(e,!1)).get(t))}).then(function(t){return t&&t.value})},t.P=function(t){var e=!1,n=this;return fs(this).then(function(r){return e=!0,n.b++,ms(_s(vs(r,!0)).delete(t))}).then(function(){delete n.f[t]}).ha(function(){e&&n.b--})},t.Jc=function(){var t=this;return fs(this).then(function(t){var e=_s(vs(t,!1));return e.getAll?ms(e.getAll()):new _t(function(t,n){var r=[],i=e.openCursor();i.onsuccess=function(e){(e=e.target.result)?(r.push(e.value),e.continue()):t(r)},i.onerror=function(t){n(Error(t.target.errorCode))}})}).then(function(e){var n={},r=[];if(0==t.b){for(r=0;r<e.length;r++)n[e[r].fbase_key]=e[r].value;r=function t(e,n){var r,i=[];for(r in e)if(r in n)if(typeof e[r]!=typeof n[r])i.push(r);else if(l(e[r])){t:{var o=void 0,a=e[r],s=n[r];for(o in a)if(!(o in s)||a[o]!==s[o]){o=!1;break t}for(o in s)if(!(o in a)){o=!1;break t}o=!0}o||i.push(r)}else"object"==typeof e[r]&&null!=e[r]&&null!=n[r]?0<t(e[r],n[r]).length&&i.push(r):e[r]!==n[r]&&i.push(r);else i.push(r);for(r in n)r in e||i.push(r);return i}(t.f,n),t.f=n}return r})},t.Y=function(t){0==this.a.length&&function(t){t.c&&t.c.cancel("STOP_EVENT"),function e(){t.c=Me(800).then(m(t.Jc,t)).then(function(e){0<e.length&&D(t.a,function(t){t(e)})}).then(e).m(function(t){"STOP_EVENT"!=t.message&&e()});return t.c}()}(this),this.a.push(t)},t.aa=function(t){F(this.a,function(e){return e==t}),0==this.a.length&&this.c&&this.c.cancel("STOP_EVENT")},(t=ys.prototype).get=function(t){return this.b.then(function(e){return e.get(t)})},t.set=function(t,e){return this.b.then(function(n){return n.set(t,e)})},t.P=function(t){return this.b.then(function(e){return e.P(t)})},t.Y=function(t){this.a.push(t)},t.aa=function(t){F(this.a,function(e){return e==t})},(t=bs.prototype).get=function(t){return Et(this.a[t])},t.set=function(t,e){return this.a[t]=e,Et()},t.P=function(t){return delete this.a[t],Et()},t.Y=function(){},t.aa=function(){},(t=ws.prototype).get=function(t){var e=this;return Et().then(function(){return fr(e.a.getItem(t))})},t.set=function(t,e){var n=this;return Et().then(function(){var r=dr(e);null===r?n.P(t):n.a.setItem(t,r)})},t.P=function(t){var e=this;return Et().then(function(){e.a.removeItem(t)})},t.Y=function(t){i.window&&me(i.window,"storage",t)},t.aa=function(t){i.window&&we(i.window,"storage",t)},(t=Es.prototype).get=function(){return Et(null)},t.set=function(){return Et()},t.P=function(){return Et()},t.Y=function(){},t.aa=function(){},(t=xs.prototype).get=function(t){var e=this;return Et().then(function(){return fr(e.a.getItem(t))})},t.set=function(t,e){var n=this;return Et().then(function(){var r=dr(e);null===r?n.P(t):n.a.setItem(t,r)})},t.P=function(t){var e=this;return Et().then(function(){e.a.removeItem(t)})},t.Y=function(){},t.aa=function(){};var Ss,ks,Ts={w:ws,Pa:xs},Ps={w:ws,Pa:xs},Is={w:hs,Pa:Es},Os={w:ws,Pa:Es},Ns={Vc:"local",NONE:"none",Xc:"session"};function Rs(){var t=!(_r(or())||!Kn()),e=hr(),n=sr();this.o=t,this.h=e,this.l=n,this.a={},Ss||(Ss=new function(){var t={};t.Browser=Ts,t.Node=Ps,t.ReactNative=Is,t.Worker=Os,this.a=t[Jn()]}),t=Ss;try{this.g=!Vn()&&wr()||!i.indexedDB?new t.a.w:new ys(Zn()?new bs:new t.a.w)}catch(t){this.g=new bs,this.h=!0}try{this.j=new t.a.Pa}catch(t){this.j=new bs}this.u=new bs,this.f=m(this.Kb,this),this.b={}}function Ds(){return ks||(ks=new Rs),ks}function Ms(t,e){switch(e){case"session":return t.j;case"none":return t.u;default:return t.g}}function Ls(t,e){return"firebase:"+t.name+(e?":"+e:"")}function js(t,e,n){return n=Ls(e,n),"local"==e.w&&(t.b[n]=null),Ms(t,e.w).P(n)}function Us(t){t.c&&(clearInterval(t.c),t.c=null)}(t=Rs.prototype).get=function(t,e){return Ms(this,t.w).get(Ls(t,e))},t.set=function(t,e,n){var r=Ls(t,n),i=this,o=Ms(this,t.w);return o.set(r,e).then(function(){return o.get(r)}).then(function(e){"local"==t.w&&(i.b[r]=e)})},t.addListener=function(t,e,n){t=Ls(t,e),this.l&&(this.b[t]=i.localStorage.getItem(t)),ot(this.a)&&(Ms(this,"local").Y(this.f),this.h||(Vn()||!wr())&&i.indexedDB||!this.l||function(t){Us(t),t.c=setInterval(function(){for(var e in t.a){var n=i.localStorage.getItem(e),r=t.b[e];n!=r&&(t.b[e]=n,n=new ue({type:"storage",key:e,target:window,oldValue:r,newValue:n,a:!0}),t.Kb(n))}},1e3)}(this)),this.a[t]||(this.a[t]=[]),this.a[t].push(n)},t.removeListener=function(t,e,n){t=Ls(t,e),this.a[t]&&(F(this.a[t],function(t){return t==n}),0==this.a[t].length&&delete this.a[t]),ot(this.a)&&(Ms(this,"local").aa(this.f),Us(this))},t.Kb=function(t){if(t&&t.f){var e=t.a.key;if(null==e)for(var n in this.a){var r=this.b[n];void 0===r&&(r=null);var o=i.localStorage.getItem(n);o!==r&&(this.b[n]=o,this.Va(n))}else if(0==e.indexOf("firebase:")&&this.a[e]){if(void 0!==t.a.a?Ms(this,"local").aa(this.f):Us(this),this.o)if(n=i.localStorage.getItem(e),(r=t.a.newValue)!==n)null!==r?i.localStorage.setItem(e,r):i.localStorage.removeItem(e);else if(this.b[e]===r&&void 0===t.a.a)return;var a=this;n=function(){void 0===t.a.a&&a.b[e]===i.localStorage.getItem(e)||(a.b[e]=i.localStorage.getItem(e),a.Va(e))},Ht&&$t&&10==$t&&i.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(n,10):n()}}else D(t,m(this.Va,this))},t.Va=function(t){this.a[t]&&D(this.a[t],function(t){t()})};var Fs,Bs={name:"authEvent",w:"local"};function Vs(t,e){this.b=-1,this.b=Ws,this.f=i.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.j=t,this.h=e,this.l=i.Int32Array?new Int32Array(64):Array(64),void 0!==Fs||(Fs=i.Int32Array?new Int32Array(Qs):Qs),this.reset()}w(Vs,function(){this.b=-1});for(var Ws=64,Gs=Ws-1,Hs=[],Ys=0;Ys<Gs;Ys++)Hs[Ys]=0;var zs=B(128,Hs);function qs(t){for(var e=t.f,n=t.l,r=0,i=0;i<e.length;)n[r++]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3],i=4*r;for(e=16;64>e;e++){i=0|n[e-15],r=0|n[e-2];var o=(0|n[e-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3)|0,a=(0|n[e-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[e]=o+a|0}r=0|t.a[0],i=0|t.a[1];var s=0|t.a[2],u=0|t.a[3],c=0|t.a[4],l=0|t.a[5],h=0|t.a[6];for(o=0|t.a[7],e=0;64>e;e++){var d=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&s^i&s)|0;a=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((a=(a=c&l^~c&h)+(0|Fs[e])|0)+(0|n[e])|0)|0,o=h,h=l,l=c,c=u+a|0,u=s,s=i,i=r,r=a+d|0}t.a[0]=t.a[0]+r|0,t.a[1]=t.a[1]+i|0,t.a[2]=t.a[2]+s|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+l|0,t.a[6]=t.a[6]+h|0,t.a[7]=t.a[7]+o|0}function Xs(t,e,n){void 0===n&&(n=e.length);var r=0,i=t.c;if(o(e))for(;r<n;)t.f[i++]=e.charCodeAt(r++),i==t.b&&(qs(t),i=0);else{if(!h(e))throw Error("message must be string or array");for(;r<n;){var a=e[r++];if(!("number"==typeof a&&0<=a&&255>=a&&a==(0|a)))throw Error("message must be a byte array");t.f[i++]=a,i==t.b&&(qs(t),i=0)}}t.c=i,t.g+=n}Vs.prototype.reset=function(){this.g=this.c=0,this.a=i.Int32Array?new Int32Array(this.h):V(this.h)};var Qs=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Ks(){Vs.call(this,8,Zs)}w(Ks,Vs);var Zs=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function Js(t,e,n,r,i){this.u=t,this.j=e,this.l=n,this.o=r||null,this.s=i||null,this.h=e+":"+n,this.v=new function(){this.a=Ds()},this.g=new function(t){this.a=t,this.b=Ds()}(this.h),this.f=null,this.b=[],this.a=this.c=null}function $s(t){return new jr("invalid-cordova-configuration",t)}function tu(t){var e=new Ks;Xs(e,t),t=[];var n=8*e.g;56>e.c?Xs(e,zs,56-e.c):Xs(e,zs,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(qs(e),r=n=0;r<e.j;r++)for(var i=24;0<=i;i-=8)t[n++]=e.a[r]>>i&255;return function(t){return M(t,function(t){return 1<(t=t.toString(16)).length?t:"0"+t}).join("")}(t)}function eu(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(t){}}function nu(t){return t.f||(t.f=t.ea().then(function(){return new _t(function(e){t.va(function n(r){return e(r),t.Ja(n),!1}),function(t){function e(e){r=!0,o&&o.cancel(),ru(t).then(function(r){var i=n;if(r&&e&&e.url){var o=null;-1!=(i=_i(e.url)).indexOf("/__/auth/callback")&&(o=(o="object"==typeof(o=fr(qe(o=Xe(i),"firebaseError")||null))?Ur(o):null)?new Bi(r.b,r.c,null,null,o):new Bi(r.b,r.c,i,r.g)),i=o||n}eu(t,i)})}var n=new Bi("unknown",null,null,null,new jr("no-auth-event")),r=!1,o=Me(500).then(function(){return ru(t).then(function(){r||eu(t,n)})}),a=i.handleOpenURL;i.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(ar("BuildInfo.packageName",i).toLowerCase()+"://")&&e({url:t}),"function"==typeof a)try{a(t)}catch(t){console.error(t)}},Gi||(Gi=new Wi),Gi.subscribe(e)}(t)})})),t.f}function ru(t){var e=null;return function(t){return t.b.get(Bs,t.a).then(function(t){return Vi(t)})}(t.g).then(function(n){return e=n,js((n=t.g).b,Bs,n.a)}).then(function(){return e})}(t=Js.prototype).ea=function(){return this.ya?this.ya:this.ya=(Qn(void 0)?Xn().then(function(){return new _t(function(t,e){var n=i.document,r=setTimeout(function(){e(Error("Cordova framework is not ready."))},1e3);n.addEventListener("deviceready",function(){clearTimeout(r),t()},!1)})}):xt(Error("Cordova must run in an Android or iOS file scheme."))).then(function(){if("function"!=typeof ar("universalLinks.subscribe",i))throw $s("cordova-universal-links-plugin is not installed");if(void 0===ar("BuildInfo.packageName",i))throw $s("cordova-plugin-buildinfo is not installed");if("function"!=typeof ar("cordova.plugins.browsertab.openUrl",i))throw $s("cordova-plugin-browsertab is not installed");if("function"!=typeof ar("cordova.InAppBrowser.open",i))throw $s("cordova-plugin-inappbrowser is not installed")},function(){throw new jr("cordova-not-ready")})},t.Da=function(t,e){return e(new jr("operation-not-supported-in-this-environment")),Et()},t.xb=function(){return xt(new jr("operation-not-supported-in-this-environment"))},t.Lb=function(){return!1},t.Gb=function(){return!0},t.Bb=function(){return!0},t.Ba=function(t,e,n){if(this.c)return xt(new jr("redirect-operation-pending"));var r=this,o=i.document,a=null,s=null,u=null,c=null;return this.c=Et().then(function(){return Fi(e),nu(r)}).then(function(){return function(t,e,n,r){var o=function(){for(var t=20,e=[];0<t;)e.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),t--;return e.join("")}(),a=new Bi(e,r,null,o,new jr("no-auth-event")),s=ar("BuildInfo.packageName",i);if("string"!=typeof s)throw new jr("invalid-cordova-configuration");var u=ar("BuildInfo.displayName",i),c={};if(or().toLowerCase().match(/iphone|ipad|ipod/))c.ibi=s;else{if(!or().toLowerCase().match(/android/))return xt(new jr("operation-not-supported-in-this-environment"));c.apn=s}u&&(c.appDisplayName=u),o=tu(o),c.sessionId=o;var l=ls(t.u,t.j,t.l,e,n,null,r,t.o,c,t.s);return t.ea().then(function(){var e=t.h;return t.v.a.set(Bs,a.C(),e)}).then(function(){var e=ar("cordova.plugins.browsertab.isAvailable",i);if("function"!=typeof e)throw new jr("invalid-cordova-configuration");var n=null;e(function(e){if(e){if("function"!=typeof(n=ar("cordova.plugins.browsertab.openUrl",i)))throw new jr("invalid-cordova-configuration");n(l)}else{if("function"!=typeof(n=ar("cordova.InAppBrowser.open",i)))throw new jr("invalid-cordova-configuration");e=!(!(e=or()).match(/(iPad|iPhone|iPod).*OS 7_\d/i)&&!e.match(/(iPad|iPhone|iPod).*OS 8_\d/i)),t.a=n(l,e?"_blank":"_system","location=yes")}})})}(r,t,e,n)}).then(function(){return new _t(function(t,e){s=function(){var e=ar("cordova.plugins.browsertab.close",i);return t(),"function"==typeof e&&e(),r.a&&"function"==typeof r.a.close&&(r.a.close(),r.a=null),!1},r.va(s),u=function(){a||(a=Me(2e3).then(function(){e(new jr("redirect-cancelled-by-user"))}))},c=function(){yr()&&u()},o.addEventListener("resume",u,!1),or().toLowerCase().match(/android/)||o.addEventListener("visibilitychange",c,!1)}).m(function(t){return ru(r).then(function(){throw t})})}).ha(function(){u&&o.removeEventListener("resume",u,!1),c&&o.removeEventListener("visibilitychange",c,!1),a&&a.cancel(),s&&r.Ja(s),r.c=null})},t.va=function(t){this.b.push(t),nu(this).m(function(e){"auth/invalid-cordova-configuration"===e.code&&(e=new Bi("unknown",null,null,null,new jr("no-auth-event")),t(e))})},t.Ja=function(t){F(this.b,function(e){return e==t})};var iu={name:"pendingRedirect",w:"session"};function ou(t){return js(t.b,iu,t.a)}function au(t,e,n){this.v=t,this.l=e,this.u=n,this.h=[],this.f=!1,this.j=m(this.o,this),this.c=new _u,this.s=new bu,this.g=new function(t){this.a=t,this.b=Ds()}(this.l+":"+this.u),this.b={},this.b.unknown=this.c,this.b.signInViaRedirect=this.c,this.b.linkViaRedirect=this.c,this.b.reauthViaRedirect=this.c,this.b.signInViaPopup=this.s,this.b.linkViaPopup=this.s,this.b.reauthViaPopup=this.s,this.a=su(this.v,this.l,this.u,Xa)}function su(t,n,r,i){var o=e.SDK_VERSION||null;return Qn()?new Js(t,n,r,o,i):new as(t,n,r,o,i)}function uu(t){t.f||(t.f=!0,t.a.va(t.j));var e=t.a;return t.a.ea().m(function(n){throw t.a==e&&t.reset(),n})}function cu(t){t.a.Gb()&&uu(t).m(function(e){var n=new Bi("unknown",null,null,null,new jr("operation-not-supported-in-this-environment"));pu(e)&&t.o(n)}),t.a.Bb()||vu(t.c)}au.prototype.reset=function(){this.f=!1,this.a.Ja(this.j),this.a=su(this.v,this.l,this.u)},au.prototype.subscribe=function(t){if(j(this.h,t)||this.h.push(t),!this.f){var e=this;(function(t){return t.b.get(iu,t.a).then(function(t){return"pending"==t})})(this.g).then(function(t){t?ou(e.g).then(function(){uu(e).m(function(t){var n=new Bi("unknown",null,null,null,new jr("operation-not-supported-in-this-environment"));pu(t)&&e.o(n)})}):cu(e)}).m(function(){cu(e)})}},au.prototype.unsubscribe=function(t){F(this.h,function(e){return e==t})},au.prototype.o=function(t){if(!t)throw new jr("invalid-auth-event");for(var e=!1,n=0;n<this.h.length;n++){var r=this.h[n];if(r.qb(t.b,t.c)){(e=this.b[t.b])&&e.h(t,r),e=!0;break}}return vu(this.c),e};var lu=new mr(2e3,1e4),hu=new mr(3e4,6e4);function du(t,e,n,r,i,o){return t.a.xb(e,n,r,function(){t.f||(t.f=!0,t.a.va(t.j))},function(){t.reset()},i,o)}function pu(t){return!(!t||"auth/cordova-not-ready"!=t.code)}au.prototype.da=function(){return this.c.da()},au.prototype.Ba=function(t,e,n){var r,i=this;return function(t){return t.b.set(iu,"pending",t.a)}(this.g).then(function(){return i.a.Ba(t,e,n).m(function(t){if(pu(t))throw new jr("operation-not-supported-in-this-environment");return r=t,ou(i.g).then(function(){throw r})}).then(function(){return i.a.Lb()?new _t(function(){}):ou(i.g).then(function(){return i.da()}).then(function(){}).m(function(){})})})},au.prototype.Da=function(t,e,n,r){return this.a.Da(n,function(n){t.ga(e,null,n,r)},lu.get())};var fu={};function gu(t,e,n){var r=e+":"+n;return fu[r]||(fu[r]=new au(t,e,n)),fu[r]}function _u(){this.b=null,this.f=[],this.c=[],this.a=null,this.g=!1}function vu(t){t.g||(t.g=!0,yu(t,!1,null,null))}function mu(t,e){if(t.b=function(){return Et(e)},t.f.length)for(var n=0;n<t.f.length;n++)t.f[n](e)}function yu(t,e,n,r){e?r?function(t,e){if(t.b=function(){return xt(e)},t.c.length)for(var n=0;n<t.c.length;n++)t.c[n](e)}(t,r):mu(t,n):mu(t,{user:null}),t.f=[],t.c=[]}function bu(){}function wu(t,e){this.a=e,Ar(this,"verificationId",t)}function Cu(t,e,n,r){return new Li(t).Sa(e,n).then(function(t){return new wu(t,r)})}function Eu(t,e,n){if(this.h=t,this.j=e,this.g=n,this.c=3e4,this.f=96e4,this.b=null,this.a=this.c,this.f<this.c)throw Error("Proactive refresh lower bound greater than upper bound!")}function xu(t){this.f=t,this.b=this.a=null,this.c=0}function Au(t,e){var n=e[Zo],r=e.refreshToken;e=Su(e.expiresIn),t.b=n,t.c=e,t.a=r}function Su(t){return b()+1e3*parseInt(t,10)}function ku(t,e){return function(t,e){return new _t(function(n,r){"refresh_token"==e.grant_type&&e.refresh_token||"authorization_code"==e.grant_type&&e.code?ia(t,t.j+"?key="+encodeURIComponent(t.b),function(t){t?t.error?r(qa(t)):t.access_token&&t.refresh_token?n(t):r(new jr("internal-error")):r(new jr("network-request-failed"))},"POST",sn(e).toString(),t.f,t.l.get()):r(new jr("internal-error"))})}(t.f,e).then(function(e){return t.b=e.access_token,t.c=Su(e.expires_in),t.a=e.refresh_token,{accessToken:t.b,expirationTime:t.c,refreshToken:t.a}}).m(function(e){throw"auth/user-token-expired"==e.code&&(t.a=null),e})}function Tu(t,e){this.a=t||null,this.b=e||null,Sr(this,{lastSignInTime:br(e||null),creationTime:br(t||null)})}function Pu(t,e){for(var n in se.call(this,t),e)this[n]=e[n]}function Iu(t,n,r){this.D=[],this.G=t.apiKey,this.s=t.appName,this.B=t.authDomain||null,t=e.SDK_VERSION?ir(e.SDK_VERSION):null,this.b=new Qo(this.G,Ka(Xa),t),this.h=new xu(this.b),ju(this,n[Zo]),Au(this.h,n),Ar(this,"refreshToken",this.h.a),Bu(this,r||{}),Ie.call(this),this.I=!1,this.B&&ur()&&(this.a=gu(this.B,this.G,this.s)),this.N=[],this.j=null,this.l=function(t){return new Eu(function(){return t.F(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var e=t.h.c-b()-3e5;return 0<e?e:0})}(this),this.V=m(this.Ga,this);var i=this;this.ia=null,this.sa=function(t){i.na(t.g)},this.X=null,this.O=[],this.ra=function(t){Nu(i,t.c)},this.W=null}function Ou(t,e){t.X&&we(t.X,"languageCodeChanged",t.sa),(t.X=e)&&me(e,"languageCodeChanged",t.sa)}function Nu(t,n){t.O=n,ra(t.b,e.SDK_VERSION?ir(e.SDK_VERSION,t.O):null)}function Ru(t,e){t.W&&we(t.W,"frameworkChanged",t.ra),(t.W=e)&&me(e,"frameworkChanged",t.ra)}function Du(t){try{return e.app(t.s).auth()}catch(e){throw new jr("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+t.s+"'!")}}function Mu(t){t.o||t.l.b||(t.l.start(),we(t,"tokenChanged",t.V),me(t,"tokenChanged",t.V))}function Lu(t){we(t,"tokenChanged",t.V),t.l.stop()}function ju(t,e){t.qa=e,Ar(t,"_lat",e)}function Uu(t){for(var e=[],n=0;n<t.N.length;n++)e.push(t.N[n](t));return function(t){return new _t(function(e){var n=t.length,r=[];if(n)for(var i=function(t,i,o){n--,r[t]=i?{Zb:!0,value:o}:{Zb:!1,reason:o},0==n&&e(r)},o=0;o<t.length;o++)At(t[o],y(i,o,!0),y(i,o,!1));else e(r)})}(e).then(function(){return t})}function Fu(t){t.a&&!t.I&&(t.I=!0,t.a.subscribe(t))}function Bu(t,e){Sr(t,{uid:e.uid,displayName:e.displayName||null,photoURL:e.photoURL||null,email:e.email||null,emailVerified:e.emailVerified||!1,phoneNumber:e.phoneNumber||null,isAnonymous:e.isAnonymous||!1,metadata:new Tu(e.createdAt,e.lastLoginAt),providerData:[]})}function Vu(){}function Wu(t){return Et().then(function(){if(t.o)throw new jr("app-deleted")})}function Gu(t){return M(t.providerData,function(t){return t.providerId})}function Hu(t,e){e&&(Yu(t,e.providerId),t.providerData.push(e))}function Yu(t,e){F(t.providerData,function(t){return t.providerId==e})}function zu(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&Ar(t,e,n)}function qu(t,e){t!=e&&(Sr(t,{uid:e.uid,displayName:e.displayName,photoURL:e.photoURL,email:e.email,emailVerified:e.emailVerified,phoneNumber:e.phoneNumber,isAnonymous:e.isAnonymous,providerData:[]}),e.metadata?Ar(t,"metadata",function(t){return new Tu(t.a,t.b)}(e.metadata)):Ar(t,"metadata",new Tu),D(e.providerData,function(e){Hu(t,e)}),t.h=e.h,Ar(t,"refreshToken",t.h.a))}function Xu(t){return t.F().then(function(e){var n=t.isAnonymous;return function(t,e){return Ya(t.b,Sa,{idToken:e}).then(m(t.uc,t))}(t,e).then(function(){return n||zu(t,"isAnonymous",!1),e})})}function Qu(t,e){e[Zo]&&t.qa!=e[Zo]&&(Au(t.h,e),t.dispatchEvent(new Pu("tokenChanged")),ju(t,e[Zo]),zu(t,"refreshToken",t.h.a))}function Ku(t,e){return Xu(t).then(function(){if(j(Gu(t),e))return Uu(t).then(function(){throw new jr("provider-already-linked")})})}function Zu(t,e,n){return kr({user:t,credential:Ui(e),additionalUserInfo:e=si(e),operationType:n})}function Ju(t,e){return Qu(t,e),t.reload().then(function(){return t})}function $u(t,n,r,i,o){if(!ur())return xt(new jr("operation-not-supported-in-this-environment"));if(t.j&&!o)return xt(t.j);var a=ai(r.providerId),s=gr(t.uid+":::"),u=null;(!hr()||Kn())&&t.B&&r.isOAuthProvider&&(u=ls(t.B,t.G,t.s,n,r,null,s,e.SDK_VERSION||null));var c=zn(u,a&&a.Aa,a&&a.za);return i=i().then(function(){if(ec(t),!o)return t.F().then(function(){})}).then(function(){return du(t.a,c,n,r,s,!!u)}).then(function(){return new _t(function(e,r){t.ga(n,null,new jr("cancelled-popup-request"),t.g||null),t.f=e,t.v=r,t.g=s,t.c=t.a.Da(t,n,c,s)})}).then(function(t){return c&&Yn(c),t?kr(t):null}).m(function(t){throw c&&Yn(c),t}),nc(t,i,o)}function tc(t,e,n,r,i){if(!ur())return xt(new jr("operation-not-supported-in-this-environment"));if(t.j&&!i)return xt(t.j);var o=null,a=gr(t.uid+":::");return r=r().then(function(){if(ec(t),!i)return t.F().then(function(){})}).then(function(){return t.$=a,Uu(t)}).then(function(e){return t.fa&&(e=(e=t.fa).b.set(ic,t.C(),e.a)),e}).then(function(){return t.a.Ba(e,n,a)}).m(function(e){if(o=e,t.fa)return oc(t.fa);throw o}).then(function(){if(o)throw o}),nc(t,r,i)}function ec(t){if(!t.a||!t.I){if(t.a&&!t.I)throw new jr("internal-error");throw new jr("auth-domain-config-required")}}function nc(t,e,n){var r=function(t,e,n){return t.j&&!n?(e.cancel(),xt(t.j)):e.m(function(e){throw!e||"auth/user-disabled"!=e.code&&"auth/user-token-expired"!=e.code||(t.j||t.dispatchEvent(new Pu("userInvalidated")),t.j=e),e})}(t,e,n);return t.D.push(r),r.ha(function(){U(t.D,r)}),r}function rc(t){if(!t.apiKey)return null;var e={apiKey:t.apiKey,authDomain:t.authDomain,appName:t.appName},n={};if(!(t.stsTokenManager&&t.stsTokenManager.accessToken&&t.stsTokenManager.expirationTime))return null;n[Zo]=t.stsTokenManager.accessToken,n.refreshToken=t.stsTokenManager.refreshToken||null,n.expiresIn=(t.stsTokenManager.expirationTime-b())/1e3;var r=new Iu(e,n,t);return t.providerData&&D(t.providerData,function(t){t&&Hu(r,kr(t))}),t.redirectEventId&&(r.$=t.redirectEventId),r}_u.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},_u.prototype.h=function(t,e){if(t){this.reset(),this.g=!0;var n=t.b,r=t.c,i=t.a&&"auth/web-storage-unsupported"==t.a.code,o=t.a&&"auth/operation-not-supported-in-this-environment"==t.a.code;"unknown"!=n||i||o?t.a?(yu(this,!0,null,t.a),Et()):e.wa(n,r)?function(t,e,n){n=n.wa(e.b,e.c);var r=e.f,i=e.g,o=!!e.b.match(/Redirect$/);n(r,i).then(function(e){yu(t,o,e,null)}).m(function(e){yu(t,o,null,e)})}(this,t,e):xt(new jr("invalid-auth-event")):(yu(this,!1,null,null),Et())}else xt(new jr("invalid-auth-event"))},_u.prototype.da=function(){var t=this;return new _t(function(e,n){t.b?t.b().then(e,n):(t.f.push(e),t.c.push(n),function(t){var e=new jr("timeout");t.a&&t.a.cancel(),t.a=Me(hu.get()).then(function(){t.b||yu(t,!0,null,e)})}(t))})},bu.prototype.h=function(t,e){if(t){var n=t.b,r=t.c;t.a?(e.ga(t.b,null,t.a,t.c),Et()):e.wa(n,r)?function(t,e){var n=t.c,r=t.b;e.wa(r,n)(t.f,t.g).then(function(t){e.ga(r,t,null,n)}).m(function(t){e.ga(r,null,t,n)})}(t,e):xt(new jr("invalid-auth-event"))}else xt(new jr("invalid-auth-event"))},wu.prototype.confirm=function(t){return t=ji(this.verificationId,t),this.a(t)},Eu.prototype.start=function(){this.a=this.c,function t(e,n){e.stop();e.b=Me(function(t,e){return e?(t.a=t.c,t.g()):(e=t.a,t.a*=2,t.a>t.f&&(t.a=t.f),e)}(e,n)).then(function(){return t=i.document,e=null,yr()||!t?Et():new _t(function(n){e=function(){yr()&&(t.removeEventListener("visibilitychange",e,!1),n())},t.addEventListener("visibilitychange",e,!1)}).m(function(n){throw t.removeEventListener("visibilitychange",e,!1),n});var t,e}).then(function(){return e.h()}).then(function(){t(e,!0)}).m(function(n){e.j(n)&&t(e,!1)})}(this,!0)},Eu.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},xu.prototype.C=function(){return{apiKey:this.f.b,refreshToken:this.a,accessToken:this.b,expirationTime:this.c}},xu.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?xt(new jr("user-token-expired")):t||!this.b||b()>this.c-3e4?this.a?ku(this,{grant_type:"refresh_token",refresh_token:this.a}):Et(null):Et({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},Tu.prototype.C=function(){return{lastLoginAt:this.b,createdAt:this.a}},w(Pu,se),w(Iu,Ie),Iu.prototype.na=function(t){this.ia=t,na(this.b,t)},Iu.prototype.ca=function(){return this.ia},Iu.prototype.Ka=function(){return V(this.O)},Iu.prototype.Ga=function(){this.l.b&&(this.l.stop(),this.l.start())},Ar(Iu.prototype,"providerId","firebase"),(t=Iu.prototype).reload=function(){var t=this;return nc(this,Wu(this).then(function(){return Xu(t).then(function(){return Uu(t)}).then(Vu)}))},t.ac=function(t){return this.F(t).then(function(t){return new function(t){var e=ni(t);if(!(e&&e.exp&&e.auth_time&&e.iat))throw new jr("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");Sr(this,{token:t,expirationTime:br(1e3*e.exp),authTime:br(1e3*e.auth_time),issuedAtTime:br(1e3*e.iat),signInProvider:e.firebase&&e.firebase.sign_in_provider?e.firebase.sign_in_provider:null,claims:e})}(t)})},t.F=function(t){var e=this;return nc(this,Wu(this).then(function(){return e.h.getToken(t)}).then(function(t){if(!t)throw new jr("internal-error");return t.accessToken!=e.qa&&(ju(e,t.accessToken),e.dispatchEvent(new Pu("tokenChanged"))),zu(e,"refreshToken",t.refreshToken),t.accessToken}))},t.getToken=function(t){return Er["firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead."]||(Er["firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead."]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead.")),this.F(t)},t.uc=function(t){if(!(t=t.users)||!t.length)throw new jr("internal-error");Bu(this,{uid:(t=t[0]).localId,displayName:t.displayName,photoURL:t.photoUrl,email:t.email,emailVerified:!!t.emailVerified,phoneNumber:t.phoneNumber,lastLoginAt:t.lastLoginAt,createdAt:t.createdAt});for(var e=function(t){return(t=t.providerUserInfo)&&t.length?M(t,function(t){return new function(t,e,n,r,i,o){Sr(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[]}(t),n=0;n<e.length;n++)Hu(this,e[n]);zu(this,"isAnonymous",!(this.email&&t.passwordHash||this.providerData&&this.providerData.length))},t.bb=function(t){var e=this,n=null;return nc(this,t.f(this.b,this.uid).then(function(t){return Qu(e,t),n=Zu(e,t,"reauthenticate"),e.j=null,e.reload()}).then(function(){return n}),!0)},t.vc=function(t){return this.bb(t).then(function(){})},t.$a=function(t){var e=this,n=null;return nc(this,Ku(this,t.providerId).then(function(){return e.F()}).then(function(n){return t.c(e.b,n)}).then(function(t){return n=Zu(e,t,"link"),Ju(e,t)}).then(function(){return n}))},t.mc=function(t){return this.$a(t).then(function(t){return t.user})},t.nc=function(t,e){var n=this;return nc(this,Ku(this,"phone").then(function(){return Cu(Du(n),t,e,m(n.$a,n))}))},t.wc=function(t,e){var n=this;return nc(this,Et().then(function(){return Cu(Du(n),t,e,m(n.bb,n))}),!0)},t.mb=function(t){var e=this;return nc(this,this.F().then(function(n){return e.b.mb(n,t)}).then(function(t){return Qu(e,t),e.reload()}))},t.Nc=function(t){var e=this;return nc(this,this.F().then(function(n){return t.c(e.b,n)}).then(function(t){return Qu(e,t),e.reload()}))},t.nb=function(t){var e=this;return nc(this,this.F().then(function(n){return e.b.nb(n,t)}).then(function(t){return Qu(e,t),e.reload()}))},t.ob=function(t){if(void 0===t.displayName&&void 0===t.photoURL)return Wu(this);var e=this;return nc(this,this.F().then(function(n){return e.b.ob(n,{displayName:t.displayName,photoUrl:t.photoURL})}).then(function(t){return Qu(e,t),zu(e,"displayName",t.displayName||null),zu(e,"photoURL",t.photoUrl||null),D(e.providerData,function(t){"password"===t.providerId&&(Ar(t,"displayName",e.displayName),Ar(t,"photoURL",e.photoURL))}),Uu(e)}).then(Vu))},t.Mc=function(t){var e=this;return nc(this,Xu(this).then(function(n){return j(Gu(e),t)?function(t,e,n){return Ya(t,Ea,{idToken:e,deleteProvider:n})}(e.b,n,[t]).then(function(t){var n={};return D(t.providerUserInfo||[],function(t){n[t.providerId]=!0}),D(Gu(e),function(t){n[t]||Yu(e,t)}),n[Li.PROVIDER_ID]||Ar(e,"phoneNumber",null),Uu(e)}):Uu(e).then(function(){throw new jr("no-such-provider")})}))},t.delete=function(){var t=this;return nc(this,this.F().then(function(e){return Ya(t.b,Ca,{idToken:e})}).then(function(){t.dispatchEvent(new Pu("userDeleted"))})).then(function(){for(var e=0;e<t.D.length;e++)t.D[e].cancel("app-deleted");Ou(t,null),Ru(t,null),t.D=[],t.o=!0,Lu(t),Ar(t,"refreshToken",null),t.a&&t.a.unsubscribe(t)})},t.qb=function(t,e){return!!("linkViaPopup"==t&&(this.g||null)==e&&this.f||"reauthViaPopup"==t&&(this.g||null)==e&&this.f||"linkViaRedirect"==t&&(this.$||null)==e||"reauthViaRedirect"==t&&(this.$||null)==e)},t.ga=function(t,e,n,r){"linkViaPopup"!=t&&"reauthViaPopup"!=t||r!=(this.g||null)||(n&&this.v?this.v(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.v)},t.wa=function(t,e){return"linkViaPopup"==t&&e==(this.g||null)?m(this.vb,this):"reauthViaPopup"==t&&e==(this.g||null)?m(this.wb,this):"linkViaRedirect"==t&&(this.$||null)==e?m(this.vb,this):"reauthViaRedirect"==t&&(this.$||null)==e?m(this.wb,this):null},t.oc=function(t){var e=this;return $u(this,"linkViaPopup",t,function(){return Ku(e,t.providerId).then(function(){return Uu(e)})},!1)},t.xc=function(t){return $u(this,"reauthViaPopup",t,function(){return Et()},!0)},t.pc=function(t){var e=this;return tc(this,"linkViaRedirect",t,function(){return Ku(e,t.providerId)},!1)},t.yc=function(t){return tc(this,"reauthViaRedirect",t,function(){return Et()},!0)},t.vb=function(t,e){var n=this;this.c&&(this.c.cancel(),this.c=null);var r=null;return nc(this,this.F().then(function(r){return ga(n.b,{requestUri:t,sessionId:e,idToken:r})}).then(function(t){return r=Zu(n,t,"link"),Ju(n,t)}).then(function(){return r}))},t.wb=function(t,e){var n=this;this.c&&(this.c.cancel(),this.c=null);var r=null;return nc(this,Et().then(function(){return vi(_a(n.b,{requestUri:t,sessionId:e}),n.uid)}).then(function(t){return r=Zu(n,t,"reauthenticate"),Qu(n,t),n.j=null,n.reload()}).then(function(){return r}),!0)},t.fb=function(t){var e=this,n=null;return nc(this,this.F().then(function(e){return n=e,void 0===t||ot(t)?{}:Kr(new Vr(t))}).then(function(t){return e.b.fb(n,t)}).then(function(t){if(e.email!=t)return e.reload()}).then(function(){}))},t.toJSON=function(){return this.C()},t.C=function(){var t={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,providerData:[],apiKey:this.G,appName:this.s,authDomain:this.B,stsTokenManager:this.h.C(),redirectEventId:this.$||null};return this.metadata&&lt(t,this.metadata.C()),D(this.providerData,function(e){t.providerData.push(function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(e))}),t};var ic={name:"redirectUser",w:"session"};function oc(t){return js(t.b,ic,t.a)}function ac(t){this.a=t,this.b=Ds(),this.c=null,this.f=function(t){var e=cc("local"),n=cc("session"),r=cc("none");return function(t,e,n){var r=Ls(e,n),o=Ms(t,e.w);return t.get(e,n).then(function(a){var s=null;try{s=fr(i.localStorage.getItem(r))}catch(t){}if(s&&!a)return i.localStorage.removeItem(r),t.set(e,s,n);s&&a&&"localStorage"!=o.type&&i.localStorage.removeItem(r)})}(t.b,e,t.a).then(function(){return t.b.get(n,t.a)}).then(function(i){return i?n:t.b.get(r,t.a).then(function(n){return n?r:t.b.get(e,t.a).then(function(n){return n?e:t.b.get(uc,t.a).then(function(t){return t?cc(t):e})})})}).then(function(e){return t.c=e,sc(t,e.w)}).m(function(){t.c||(t.c=e)})}(this),this.b.addListener(cc("local"),this.a,m(this.g,this))}function sc(t,e){var n,r=[];for(n in Ns)Ns[n]!==e&&r.push(js(t.b,cc(Ns[n]),t.a));return r.push(js(t.b,uc,t.a)),function(t){return new _t(function(e,n){var r=t.length,i=[];if(r)for(var o=function(t,n){r--,i[t]=n,0==r&&e(i)},a=function(t){n(t)},s=0;s<t.length;s++)At(t[s],y(o,s),a);else e(i)})}(r)}ac.prototype.g=function(){var t=this,e=cc("local");pc(this,function(){return Et().then(function(){return t.c&&"local"!=t.c.w?t.b.get(e,t.a):null}).then(function(n){if(n)return sc(t,"local").then(function(){t.c=e})})})};var uc={name:"persistence",w:"session"};function cc(t){return{name:"authUser",w:t}}function lc(t,e){return pc(t,function(){return t.b.set(t.c,e.C(),t.a)})}function hc(t){return pc(t,function(){return js(t.b,t.c,t.a)})}function dc(t,e){return pc(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),rc(t||{})})})}function pc(t,e){return t.f=t.f.then(e,e),t.f}function fc(t){if(this.l=!1,Ar(this,"app",t),!wc(this).options||!wc(this).options.apiKey)throw new jr("invalid-api-key");t=e.SDK_VERSION?ir(e.SDK_VERSION):null,this.b=new Qo(wc(this).options&&wc(this).options.apiKey,Ka(Xa),t),this.N=[],this.o=[],this.I=[],this.Ob=e.INTERNAL.createSubscribe(m(this.ic,this)),this.O=void 0,this.Pb=e.INTERNAL.createSubscribe(m(this.jc,this)),yc(this,null),this.h=new ac(wc(this).options.apiKey+":"+wc(this).name),this.G=new function(t){this.a=t,this.b=Ds()}(wc(this).options.apiKey+":"+wc(this).name),this.V=Ac(this,function(t){var e=wc(t).options.authDomain,n=function(t){var e=function(t,e){return t.b.get(ic,t.a).then(function(t){return t&&e&&(t.authDomain=e),rc(t||{})})}(t.G,wc(t).options.authDomain).then(function(e){return(t.B=e)&&(e.fa=t.G),oc(t.G)});return Ac(t,e)}(t).then(function(){return dc(t.h,e)}).then(function(e){return e?(e.fa=t.G,t.B&&(t.B.$||null)==(e.$||null)?e:e.reload().then(function(){return lc(t.h,e).then(function(){return e})}).m(function(n){return"auth/network-request-failed"==n.code?e:hc(t.h)})):null}).then(function(e){yc(t,e||null)});return Ac(t,n)}(this)),this.j=Ac(this,function(t){return t.V.then(function(){return t.da()}).m(function(){}).then(function(){if(!t.l)return t.ia()}).m(function(){}).then(function(){if(!t.l){t.X=!0;var e=t.h;e.b.addListener(cc("local"),e.a,t.ia)}})}(this)),this.X=!1,this.ia=m(this.Ic,this),this.Ga=m(this.ka,this),this.qa=m(this.Yb,this),this.ra=m(this.gc,this),this.sa=m(this.hc,this),function(t){var e=wc(t).options.authDomain,n=wc(t).options.apiKey;e&&ur()&&(t.Nb=t.V.then(function(){if(!t.l){if(t.a=gu(e,n,wc(t).name),t.a.subscribe(t),Cc(t)&&Fu(Cc(t)),t.B){Fu(t.B);var r=t.B;r.na(t.ca()),Ou(r,t),Nu(r=t.B,t.D),Ru(r,t),t.B=null}return t.a}}))}(this),this.INTERNAL={},this.INTERNAL.delete=m(this.delete,this),this.INTERNAL.logFramework=m(this.qc,this),this.s=0,Ie.call(this),function(t){Object.defineProperty(t,"lc",{get:function(){return this.ca()},set:function(t){this.na(t)},enumerable:!1}),t.W=null}(this),this.D=[]}function gc(t){se.call(this,"languageCodeChanged"),this.g=t}function _c(t){se.call(this,"frameworkChanged"),this.c=t}function vc(t){return t.Nb||xt(new jr("auth-domain-config-required"))}function mc(t,e){var n={};return n.apiKey=wc(t).options.apiKey,n.authDomain=wc(t).options.authDomain,n.appName=wc(t).name,t.V.then(function(){return function(t,e,n,r){var i=new Iu(t,e);return n&&(i.fa=n),r&&Nu(i,r),i.reload().then(function(){return i})}(n,e,t.G,t.Ka())}).then(function(e){return Cc(t)&&e.uid==Cc(t).uid?(qu(Cc(t),e),t.ka(e)):(yc(t,e),Fu(e),t.ka(e))}).then(function(){xc(t)})}function yc(t,e){Cc(t)&&(function(t,e){F(t.N,function(t){return t==e})}(Cc(t),t.Ga),we(Cc(t),"tokenChanged",t.qa),we(Cc(t),"userDeleted",t.ra),we(Cc(t),"userInvalidated",t.sa),Lu(Cc(t))),e&&(e.N.push(t.Ga),me(e,"tokenChanged",t.qa),me(e,"userDeleted",t.ra),me(e,"userInvalidated",t.sa),0<t.s&&Mu(e)),Ar(t,"currentUser",e),e&&(e.na(t.ca()),Ou(e,t),Nu(e,t.D),Ru(e,t))}function bc(t,e){var n=null,r=null;return Ac(t,e.then(function(e){return n=Ui(e),r=si(e),mc(t,e)}).then(function(){return kr({user:Cc(t),credential:n,additionalUserInfo:r,operationType:"signIn"})}))}function wc(t){return t.app}function Cc(t){return t.currentUser}function Ec(t){return Cc(t)&&Cc(t)._lat||null}function xc(t){if(t.X){for(var e=0;e<t.o.length;e++)t.o[e]&&t.o[e](Ec(t));if(t.O!==t.getUid()&&t.I.length)for(t.O=t.getUid(),e=0;e<t.I.length;e++)t.I[e]&&t.I[e](Ec(t))}}function Ac(t,e){return t.N.push(e),e.ha(function(){U(t.N,e)}),e}function Sc(t,e,n,r,o,a){if(Ar(this,"type","recaptcha"),this.b=this.c=null,this.o=!1,this.l=e,this.a=n||{theme:"light",type:"image"},this.g=[],this.a[Pc])throw new jr("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.h="invisible"===this.a[Ic],!i.document)throw new jr("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!Nn(e)||!this.h&&Nn(e).hasChildNodes())throw new jr("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.u=new Qo(t,a||null,o||null),this.s=r||function(){return null};var s=this;this.j=[];var u=this.a[kc];this.a[kc]=function(t){if(Oc(s,t),"function"==typeof u)u(t);else if("string"==typeof u){var e=ar(u,i);"function"==typeof e&&e(t)}};var c=this.a[Tc];this.a[Tc]=function(){if(Oc(s,null),"function"==typeof c)c();else if("string"==typeof c){var t=ar(c,i);"function"==typeof t&&t()}}}ac.prototype.ib=function(t){var e=null,n=this;return function(t){var e=new jr("invalid-persistence-type"),n=new jr("unsupported-persistence-type");t:{for(r in Ns)if(Ns[r]==t){var r=!0;break t}r=!1}if(!r||"string"!=typeof t)throw e;switch(Jn()){case"ReactNative":if("session"===t)throw n;break;case"Node":if("none"!==t)throw n;break;default:if(!sr()&&"none"!==t)throw n}}(t),pc(this,function(){return t!=n.c.w?n.b.get(n.c,n.a).then(function(r){return e=r,sc(n,t)}).then(function(){if(n.c=cc(t),e)return n.b.set(n.c,e,n.a)}):Et()})},w(fc,Ie),w(gc,se),w(_c,se),(t=fc.prototype).ib=function(t){return Ac(this,t=this.h.ib(t))},t.na=function(t){this.W===t||this.l||(this.W=t,na(this.b,this.W),this.dispatchEvent(new gc(this.ca())))},t.ca=function(){return this.W},t.Oc=function(){var t=i.navigator;this.na(t&&(t.languages&&t.languages[0]||t.language||t.userLanguage)||null)},t.qc=function(t){this.D.push(t),ra(this.b,e.SDK_VERSION?ir(e.SDK_VERSION,this.D):null),this.dispatchEvent(new _c(this.D))},t.Ka=function(){return V(this.D)},t.toJSON=function(){return{apiKey:wc(this).options.apiKey,authDomain:wc(this).options.authDomain,appName:wc(this).name,currentUser:Cc(this)&&Cc(this).C()}},t.qb=function(t,e){switch(t){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==e&&!!this.f;default:return!1}},t.ga=function(t,e,n,r){"signInViaPopup"==t&&this.g==r&&(n&&this.v?this.v(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.v)},t.wa=function(t,e){return"signInViaRedirect"==t||"signInViaPopup"==t&&this.g==e&&this.f?m(this.Xb,this):null},t.Xb=function(t,e){var n=this;t={requestUri:t,sessionId:e},this.c&&(this.c.cancel(),this.c=null);var r=null,i=null,o=fa(n.b,t).then(function(t){return r=Ui(t),i=si(t),t});return Ac(this,t=n.V.then(function(){return o}).then(function(t){return mc(n,t)}).then(function(){return kr({user:Cc(n),credential:r,additionalUserInfo:i,operationType:"signIn"})}))},t.Gc=function(t){if(!ur())return xt(new jr("operation-not-supported-in-this-environment"));var n=this,r=ai(t.providerId),i=gr(),o=null;(!hr()||Kn())&&wc(this).options.authDomain&&t.isOAuthProvider&&(o=ls(wc(this).options.authDomain,wc(this).options.apiKey,wc(this).name,"signInViaPopup",t,null,i,e.SDK_VERSION||null));var a=zn(o,r&&r.Aa,r&&r.za);return Ac(this,r=vc(this).then(function(e){return du(e,a,"signInViaPopup",t,i,!!o)}).then(function(){return new _t(function(t,e){n.ga("signInViaPopup",null,new jr("cancelled-popup-request"),n.g),n.f=t,n.v=e,n.g=i,n.c=n.a.Da(n,"signInViaPopup",a,i)})}).then(function(t){return a&&Yn(a),t?kr(t):null}).m(function(t){throw a&&Yn(a),t}))},t.Hc=function(t){if(!ur())return xt(new jr("operation-not-supported-in-this-environment"));var e=this;return Ac(this,vc(this).then(function(){return pc(t=e.h,function(){return t.b.set(uc,t.c.w,t.a)});var t}).then(function(){return e.a.Ba("signInViaRedirect",t)}))},t.da=function(){if(!ur())return xt(new jr("operation-not-supported-in-this-environment"));var t=this;return Ac(this,vc(this).then(function(){return t.a.da()}).then(function(t){return t?kr(t):null}))},t.kb=function(){var t=this;return Ac(this,this.j.then(function(){return Cc(t)?(yc(t,null),hc(t.h).then(function(){xc(t)})):Et()}))},t.Ic=function(){var t=this;return dc(this.h,wc(this).options.authDomain).then(function(e){if(!t.l){var n;if(n=Cc(t)&&e){n=Cc(t).uid;var r=e.uid;n=void 0!==n&&null!==n&&""!==n&&void 0!==r&&null!==r&&""!==r&&n==r}if(n)return qu(Cc(t),e),Cc(t).F();(Cc(t)||e)&&(yc(t,e),e&&(Fu(e),e.fa=t.G),t.a&&t.a.subscribe(t),xc(t))}})},t.ka=function(t){return lc(this.h,t)},t.Yb=function(){xc(this),this.ka(Cc(this))},t.gc=function(){this.kb()},t.hc=function(){this.kb()},t.ic=function(t){var e=this;this.addAuthTokenListener(function(){t.next(Cc(e))})},t.jc=function(t){var e=this;!function(t,e){t.I.push(e),Ac(t,t.j.then(function(){!t.l&&j(t.I,e)&&t.O!==t.getUid()&&(t.O=t.getUid(),e(Ec(t)))}))}(this,function(){t.next(Cc(e))})},t.sc=function(t,n,r){var i=this;return this.X&&e.Promise.resolve().then(function(){d(t)?t(Cc(i)):d(t.next)&&t.next(Cc(i))}),this.Ob(t,n,r)},t.rc=function(t,n,r){var i=this;return this.X&&e.Promise.resolve().then(function(){i.O=i.getUid(),d(t)?t(Cc(i)):d(t.next)&&t.next(Cc(i))}),this.Pb(t,n,r)},t.$b=function(t){var e=this;return Ac(this,this.j.then(function(){return Cc(e)?Cc(e).F(t).then(function(t){return{accessToken:t}}):null}))},t.Cc=function(t){return this.Hb(t).then(function(t){return t.user})},t.Hb=function(t){var e=this;return this.j.then(function(){return bc(e,Ya(e.b,Ba,{token:t}))}).then(function(t){var n=t.user;return zu(n,"isAnonymous",!1),e.ka(n),t})},t.Ib=function(t,e){var n=this;return this.j.then(function(){return bc(n,Ya(n.b,Va,{email:t,password:e}))})},t.Dc=function(t,e){return this.Ib(t,e).then(function(t){return t.user})},t.Sb=function(t,e){return this.sb(t,e).then(function(t){return t.user})},t.sb=function(t,e){var n=this;return this.j.then(function(){return bc(n,Ya(n.b,ba,{email:t,password:e}))})},t.Bc=function(t){return this.Oa(t).then(function(t){return t.user})},t.Oa=function(t){var e=this;return this.j.then(function(){return bc(e,t.xa(e.b))})},t.jb=function(){return this.Jb().then(function(t){return t.user})},t.Jb=function(){var t=this;return this.j.then(function(){var e=Cc(t);return e&&e.isAnonymous?kr({user:e,credential:null,additionalUserInfo:kr({providerId:null,isNewUser:!1}),operationType:"signIn"}):bc(t,t.b.jb()).then(function(e){var n=e.user;return zu(n,"isAnonymous",!0),t.ka(n),e})})},t.getUid=function(){return Cc(this)&&Cc(this).uid||null},t.Qb=function(t){this.addAuthTokenListener(t),this.s++,0<this.s&&Cc(this)&&Mu(Cc(this))},t.zc=function(t){var e=this;D(this.o,function(n){n==t&&e.s--}),0>this.s&&(this.s=0),0==this.s&&Cc(this)&&Lu(Cc(this)),this.removeAuthTokenListener(t)},t.addAuthTokenListener=function(t){var e=this;this.o.push(t),Ac(this,this.j.then(function(){e.l||j(e.o,t)&&t(Ec(e))}))},t.removeAuthTokenListener=function(t){F(this.o,function(e){return e==t})},t.delete=function(){this.l=!0;for(var t=0;t<this.N.length;t++)this.N[t].cancel("app-deleted");return this.N=[],this.h&&(t=this.h).b.removeListener(cc("local"),t.a,this.ia),this.a&&this.a.unsubscribe(this),e.Promise.resolve()},t.Vb=function(t){return Ac(this,function(t,e){return Ya(t,wa,{identifier:e,continueUri:cr()?Wn():"http://localhost"}).then(function(t){return t.allProviders||[]})}(this.b,t))},t.Wb=function(t){return Ac(this,function(t,e){return Ya(t,wa,{identifier:e,continueUri:cr()?Wn():"http://localhost"}).then(function(t){return t.signinMethods||[]})}(this.b,t))},t.kc=function(t){return!!Ri(t)},t.hb=function(t,e){var n=this;return Ac(this,Et().then(function(){var t=new Vr(e);if(!t.c)throw new jr("argument-error",Gr+" must be true when sending sign in link to email");return Kr(t)}).then(function(e){return n.b.hb(t,e)}).then(function(){}))},t.Pc=function(t){return this.Ia(t).then(function(t){return t.data.email})},t.Wa=function(t,e){return Ac(this,this.b.Wa(t,e).then(function(){}))},t.Ia=function(t){return Ac(this,this.b.Ia(t).then(function(t){return new function(t){var e={},n=t[Ir],r=t[Or];if(!(t=t[Nr])||t!=Pr&&!n)throw Error("Invalid provider user info!");e[Dr]=r||null,e[Rr]=n||null,Ar(this,Lr,t),Ar(this,Mr,Tr(e))}(t)}))},t.Ua=function(t){return Ac(this,this.b.Ua(t).then(function(){}))},t.gb=function(t,e){var n=this;return Ac(this,Et().then(function(){return void 0===e||ot(e)?{}:Kr(new Vr(e))}).then(function(e){return n.b.gb(t,e)}).then(function(){}))},t.Fc=function(t,e){return Ac(this,Cu(this,t,e,m(this.Oa,this)))},t.Ec=function(t,e){var n=this;return Ac(this,Et().then(function(){var r=Ni(t,e||Wn());return n.Oa(r)}))};var kc="callback",Tc="expired-callback",Pc="sitekey",Ic="size";function Oc(t,e){for(var n=0;n<t.j.length;n++)try{t.j[n](e)}catch(t){}}function Nc(t,e){return t.g.push(e),e.ha(function(){U(t.g,e)}),e}function Rc(t){if(t.o)throw new jr("internal-error","RecaptchaVerifier instance has been destroyed.")}(t=Sc.prototype).ya=function(){var t=this;return this.c?this.c:this.c=Nc(this,Et().then(function(){if(cr()&&!Zn())return Xn();throw new jr("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return function(t,e){return new _t(function(n,r){var o=setTimeout(function(){r(new jr("network-request-failed"))},Mc.get());if(!i.grecaptcha||e!==t.c&&!t.b){i[t.a]=function(){if(i.grecaptcha){t.c=e;var a=i.grecaptcha.render;i.grecaptcha.render=function(e,n){return e=a(e,n),t.b++,e},clearTimeout(o),n()}else clearTimeout(o),r(new jr("internal-error"));delete i[t.a]};var a=yn(Dc,{onload:t.a,hl:e||""});Et(Wo(a)).m(function(){clearTimeout(o),r(new jr("internal-error","Unable to load external reCAPTCHA dependencies!"))})}else clearTimeout(o),n()})}(jc(),t.s())}).then(function(){return Ya(t.u,Oa,{})}).then(function(e){t.a[Pc]=e.recaptchaSiteKey}).m(function(e){throw t.c=null,e}))},t.render=function(){Rc(this);var t=this;return Nc(this,this.ya().then(function(){if(null===t.b){var e=t.l;if(!t.h){var n=Nn(e);e=Mn("DIV"),n.appendChild(e)}t.b=grecaptcha.render(e,t.a)}return t.b}))},t.verify=function(){Rc(this);var t=this;return Nc(this,this.render().then(function(e){return new _t(function(n){var r=grecaptcha.getResponse(e);if(r)n(r);else{var i=function(e){e&&(function(t,e){F(t.j,function(t){return t==e})}(t,i),n(e))};t.j.push(i),t.h&&grecaptcha.execute(t.b)}})}))},t.reset=function(){Rc(this),null!==this.b&&grecaptcha.reset(this.b)},t.clear=function(){Rc(this),this.o=!0,jc().b--;for(var t=0;t<this.g.length;t++)this.g[t].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.h){t=Nn(this.l);for(var e;e=t.firstChild;)t.removeChild(e)}};var Dc=_n("https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}");var Mc=new mr(3e4,6e4);var Lc=null;function jc(){return Lc||(Lc=new function(){this.b=i.grecaptcha?1/0:0,this.c=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}),Lc}function Uc(t,n,r){try{this.f=r||e.app()}catch(t){throw new jr("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.f.options||!this.f.options.apiKey)throw new jr("invalid-api-key");r=this.f.options.apiKey;var i=this,o=null;try{o=this.f.auth().Ka()}catch(t){}o=e.SDK_VERSION?ir(e.SDK_VERSION,o):null,Sc.call(this,r,t,n,function(){try{var t=i.f.auth().ca()}catch(e){t=null}return t},o,Ka(Xa))}function Fc(t,e,n,r){t:{n=Array.prototype.slice.call(n);for(var i=0,o=!1,a=0;a<e.length;a++)if(e[a].optional)o=!0;else{if(o)throw new jr("internal-error","Argument validator encountered a required argument after an optional argument.");i++}if(o=e.length,n.length<i||o<n.length)r="Expected "+(i==o?1==i?"1 argument":i+" arguments":i+"-"+o+" arguments")+" but got "+n.length+".";else{for(i=0;i<n.length;i++)if(o=e[i].optional&&void 0===n[i],!e[i].M(n[i])&&!o){if(e=e[i],0>i||i>=Bc.length)throw new jr("internal-error","Argument validator received an unsupported number of arguments.");n=Bc[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.K+".";break t}r=null}}if(r)throw new jr("argument-error",t+" failed: "+r)}w(Uc,Sc);var Bc="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Vc(t,e){return{name:t||"",K:"a valid string",optional:!!e,M:o}}function Wc(){return{name:"opt_forceRefresh",K:"a boolean",optional:!0,M:a}}function Gc(t,e){return{name:t||"",K:"a valid object",optional:!!e,M:p}}function Hc(t,e){return{name:t||"",K:"a function",optional:!!e,M:d}}function Yc(t,e){return{name:t||"",K:"null",optional:!!e,M:c}}function zc(t){return{name:t?t+"Credential":"credential",K:t?"a valid "+t+" credential":"a valid credential",optional:!1,M:function(e){if(!e)return!1;var n=!t||e.providerId===t;return!(!e.xa||!n)}}}function qc(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(t){return!!(t&&o(t.type)&&d(t.verify))}}}function Xc(t,e,n,r){return{name:n||"",K:t.K+" or "+e.K,optional:!!r,M:function(n){return t.M(n)||e.M(n)}}}function Qc(t,e){for(var n in e){var r=e[n].name;t[r]=Zc(r,t[n],e[n].i)}}function Kc(t,e,n,r){t[e]=Zc(e,n,r)}function Zc(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return Fc(o,n,t),e.apply(this,t)}if(!n)return e;var i,o=function(t){return(t=t.split("."))[t.length-1]}(t);for(i in e)r[i]=e[i];for(i in e.prototype)r.prototype[i]=e.prototype[i];return r}Qc(fc.prototype,{Ua:{name:"applyActionCode",i:[Vc("code")]},Ia:{name:"checkActionCode",i:[Vc("code")]},Wa:{name:"confirmPasswordReset",i:[Vc("code"),Vc("newPassword")]},Sb:{name:"createUserWithEmailAndPassword",i:[Vc("email"),Vc("password")]},sb:{name:"createUserAndRetrieveDataWithEmailAndPassword",i:[Vc("email"),Vc("password")]},Vb:{name:"fetchProvidersForEmail",i:[Vc("email")]},Wb:{name:"fetchSignInMethodsForEmail",i:[Vc("email")]},da:{name:"getRedirectResult",i:[]},kc:{name:"isSignInWithEmailLink",i:[Vc("emailLink")]},rc:{name:"onAuthStateChanged",i:[Xc(Gc(),Hc(),"nextOrObserver"),Hc("opt_error",!0),Hc("opt_completed",!0)]},sc:{name:"onIdTokenChanged",i:[Xc(Gc(),Hc(),"nextOrObserver"),Hc("opt_error",!0),Hc("opt_completed",!0)]},gb:{name:"sendPasswordResetEmail",i:[Vc("email"),Xc(Gc("opt_actionCodeSettings",!0),Yc(null,!0),"opt_actionCodeSettings",!0)]},hb:{name:"sendSignInLinkToEmail",i:[Vc("email"),Gc("actionCodeSettings")]},ib:{name:"setPersistence",i:[Vc("persistence")]},Oa:{name:"signInAndRetrieveDataWithCredential",i:[zc()]},jb:{name:"signInAnonymously",i:[]},Jb:{name:"signInAnonymouslyAndRetrieveData",i:[]},Bc:{name:"signInWithCredential",i:[zc()]},Cc:{name:"signInWithCustomToken",i:[Vc("token")]},Hb:{name:"signInAndRetrieveDataWithCustomToken",i:[Vc("token")]},Dc:{name:"signInWithEmailAndPassword",i:[Vc("email"),Vc("password")]},Ec:{name:"signInWithEmailLink",i:[Vc("email"),Vc("emailLink",!0)]},Ib:{name:"signInAndRetrieveDataWithEmailAndPassword",i:[Vc("email"),Vc("password")]},Fc:{name:"signInWithPhoneNumber",i:[Vc("phoneNumber"),qc()]},Gc:{name:"signInWithPopup",i:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},Hc:{name:"signInWithRedirect",i:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},kb:{name:"signOut",i:[]},toJSON:{name:"toJSON",i:[Vc(null,!0)]},Oc:{name:"useDeviceLanguage",i:[]},Pc:{name:"verifyPasswordResetCode",i:[Vc("code")]}}),function(t,e){for(var n in e){var r=e[n].name;if(r!==n){var i=e[n].Rb;Object.defineProperty(t,r,{get:function(){return this[n]},set:function(t){Fc(r,[i],[t],!0),this[n]=t},enumerable:!0})}}}(fc.prototype,{lc:{name:"languageCode",Rb:Xc(Vc(),Yc(),"languageCode")}}),fc.Persistence=Ns,fc.Persistence.LOCAL="local",fc.Persistence.SESSION="session",fc.Persistence.NONE="none",Qc(Iu.prototype,{delete:{name:"delete",i:[]},ac:{name:"getIdTokenResult",i:[Wc()]},F:{name:"getIdToken",i:[Wc()]},getToken:{name:"getToken",i:[Wc()]},$a:{name:"linkAndRetrieveDataWithCredential",i:[zc()]},mc:{name:"linkWithCredential",i:[zc()]},nc:{name:"linkWithPhoneNumber",i:[Vc("phoneNumber"),qc()]},oc:{name:"linkWithPopup",i:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},pc:{name:"linkWithRedirect",i:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},bb:{name:"reauthenticateAndRetrieveDataWithCredential",i:[zc()]},vc:{name:"reauthenticateWithCredential",i:[zc()]},wc:{name:"reauthenticateWithPhoneNumber",i:[Vc("phoneNumber"),qc()]},xc:{name:"reauthenticateWithPopup",i:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},yc:{name:"reauthenticateWithRedirect",i:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},reload:{name:"reload",i:[]},fb:{name:"sendEmailVerification",i:[Xc(Gc("opt_actionCodeSettings",!0),Yc(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",i:[Vc(null,!0)]},Mc:{name:"unlink",i:[Vc("provider")]},mb:{name:"updateEmail",i:[Vc("email")]},nb:{name:"updatePassword",i:[Vc("password")]},Nc:{name:"updatePhoneNumber",i:[zc("phone")]},ob:{name:"updateProfile",i:[Gc("profile")]}}),Qc(_t.prototype,{ha:{name:"finally"},m:{name:"catch"},then:{name:"then"}}),Qc(wu.prototype,{confirm:{name:"confirm",i:[Vc("verificationCode")]}}),Kc(Oi,"credential",function(t,e){return new Ii(t,e)},[Vc("email"),Vc("password")]),Qc(Ci.prototype,{ta:{name:"addScope",i:[Vc("scope")]},Ca:{name:"setCustomParameters",i:[Gc("customOAuthParameters")]}}),Kc(Ci,"credential",Ei,[Xc(Vc(),Gc(),"token")]),Kc(Oi,"credentialWithLink",Ni,[Vc("email"),Vc("emailLink")]),Qc(xi.prototype,{ta:{name:"addScope",i:[Vc("scope")]},Ca:{name:"setCustomParameters",i:[Gc("customOAuthParameters")]}}),Kc(xi,"credential",Ai,[Xc(Vc(),Gc(),"token")]),Qc(Si.prototype,{ta:{name:"addScope",i:[Vc("scope")]},Ca:{name:"setCustomParameters",i:[Gc("customOAuthParameters")]}}),Kc(Si,"credential",ki,[Xc(Vc(),Xc(Gc(),Yc()),"idToken"),Xc(Vc(),Yc(),"accessToken",!0)]),Qc(Ti.prototype,{Ca:{name:"setCustomParameters",i:[Gc("customOAuthParameters")]}}),Kc(Ti,"credential",Pi,[Xc(Vc(),Gc(),"token"),Vc("secret",!0)]),Qc(wi.prototype,{ta:{name:"addScope",i:[Vc("scope")]},credential:{name:"credential",i:[Xc(Vc(),Yc(),"idToken",!0),Xc(Vc(),Yc(),"accessToken",!0)]},Ca:{name:"setCustomParameters",i:[Gc("customOAuthParameters")]}}),Kc(Li,"credential",ji,[Vc("verificationId"),Vc("verificationCode")]),Qc(Li.prototype,{Sa:{name:"verifyPhoneNumber",i:[Vc("phoneNumber"),qc()]}}),Qc(jr.prototype,{toJSON:{name:"toJSON",i:[Vc(null,!0)]}}),Qc(Yi.prototype,{toJSON:{name:"toJSON",i:[Vc(null,!0)]}}),Qc(Hi.prototype,{toJSON:{name:"toJSON",i:[Vc(null,!0)]}}),Qc(Uc.prototype,{clear:{name:"clear",i:[]},render:{name:"render",i:[]},verify:{name:"verify",i:[]}}),function(){if(void 0===e||!e.INTERNAL||!e.INTERNAL.registerService)throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");var t={Auth:fc,Error:jr};Kc(t,"EmailAuthProvider",Oi,[]),Kc(t,"FacebookAuthProvider",Ci,[]),Kc(t,"GithubAuthProvider",xi,[]),Kc(t,"GoogleAuthProvider",Si,[]),Kc(t,"TwitterAuthProvider",Ti,[]),Kc(t,"OAuthProvider",wi,[Vc("providerId")]),Kc(t,"PhoneAuthProvider",Li,[{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(t){return!!(t&&t instanceof fc)}}]),Kc(t,"RecaptchaVerifier",Uc,[Xc(Vc(),{name:"",K:"an HTML element",optional:!1,M:function(t){return!!(t&&t instanceof Element)}},"recaptchaContainer"),Gc("recaptchaParameters",!0),{name:"app",K:"an instance of Firebase App",optional:!0,M:function(t){return!!(t&&t instanceof e.app.App)}}]),e.INTERNAL.registerService("auth",function(t,e){return e({INTERNAL:{getUid:m((t=new fc(t)).getUid,t),getToken:m(t.$b,t),addAuthTokenListener:m(t.Qb,t),removeAuthTokenListener:m(t.zc,t)}}),t},t,function(t,e){if("create"===t)try{e.auth()}catch(t){}}),e.INTERNAL.extendNamespace({User:Iu})}()}).call(void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})}).call(e,n(9))},function(t,e,n){t.exports=n(58)},function(t,e,n){"use strict";(function(r){Object.defineProperty(e,"__esModule",{value:!0});var i,o,a=n(16),s=n(59),u=n(17),c=(i=n(7))&&"object"==typeof i&&"default"in i?i.default:i,l=function(){function t(t){this.domStorage_=t,this.prefix_="firebase:"}return t.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),a.stringify(e))},t.prototype.get=function(t){var e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:a.jsonEval(e)},t.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},t.prototype.prefixedName_=function(t){return this.prefix_+t},t.prototype.toString=function(){return this.domStorage_.toString()},t}(),h=function(){function t(){this.cache_={},this.isInMemoryStorage=!0}return t.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},t.prototype.get=function(t){return a.contains(this.cache_,t)?this.cache_[t]:null},t.prototype.remove=function(t){delete this.cache_[t]},t}(),d=function(t){try{if("undefined"!=typeof window&&void 0!==window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new l(e)}}catch(t){}return new h},p=d("localStorage"),f=d("sessionStorage"),g=new s.Logger("@firebase/database"),_=(o=1,function(){return o++}),v=function(t){var e=a.stringToByteArray(t),n=new a.Sha1;n.update(e);var r=n.digest();return a.base64.encodeByteArray(r)},m=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n="",r=0;r<t.length;r++)Array.isArray(t[r])||t[r]&&"object"==typeof t[r]&&"number"==typeof t[r].length?n+=m.apply(null,t[r]):"object"==typeof t[r]?n+=a.stringify(t[r]):n+=t[r],n+=" ";return n},y=null,b=!0,w=function(t,e){a.assert(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(g.logLevel=s.LogLevel.VERBOSE,y=g.log.bind(g),e&&f.set("logging_enabled",!0)):"function"==typeof t?y=t:(y=null,f.remove("logging_enabled"))},C=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!0===b&&(b=!1,null===y&&!0===f.get("logging_enabled")&&w(!0)),y){var n=m.apply(null,t);y(n)}},E=function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];C.apply(void 0,[t].concat(e))}},x=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+m.apply(void 0,t);g.error(n)},A=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+m.apply(void 0,t);throw g.error(n),new Error(n)},S=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+m.apply(void 0,t);g.warn(n)},k=function(t){return"number"==typeof t&&(t!=t||t==Number.POSITIVE_INFINITY||t==Number.NEGATIVE_INFINITY)},T="[MIN_NAME]",P="[MAX_NAME]",I=function(t,e){if(t===e)return 0;if(t===T||e===P)return-1;if(e===T||t===P)return 1;var n=U(t),r=U(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null!==r?1:t<e?-1:1},O=function(t,e){return t===e?0:t<e?-1:1},N=function(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+a.stringify(e))},R=function(t){if("object"!=typeof t||null===t)return a.stringify(t);var e=[];for(var n in t)e.push(n);e.sort();for(var r="{",i=0;i<e.length;i++)0!==i&&(r+=","),r+=a.stringify(e[i]),r+=":",r+=R(t[e[i]]);return r+="}"},D=function(t,e){var n=t.length;if(n<=e)return[t];for(var r=[],i=0;i<n;i+=e)i+e>n?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r},M=function(t,e){if(Array.isArray(t))for(var n=0;n<t.length;++n)e(n,t[n]);else a.forEach(t,function(t,n){return e(n,t)})},L=function(t){a.assert(!k(t),"Invalid JSON number");var e,n,r,i,o,s,u;for(0===t?(n=0,r=0,e=1/t==-1/0?1:0):(e=t<0,(t=Math.abs(t))>=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,r=Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,r=Math.round(t/Math.pow(2,-1074)))),s=[],o=52;o;o-=1)s.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;o-=1)s.push(n%2?1:0),n=Math.floor(n/2);s.push(e?1:0),s.reverse(),u=s.join("");var c="";for(o=0;o<64;o+=8){var l=parseInt(u.substr(o,8),2).toString(16);1===l.length&&(l="0"+l),c+=l}return c.toLowerCase()},j=new RegExp("^-?\\d{1,10}$"),U=function(t){if(j.test(t)){var e=Number(t);if(e>=-2147483648&&e<=2147483647)return e}return null},F=function(t){try{t()}catch(t){setTimeout(function(){var e=t.stack||"";throw S("Exception was thrown by user callback.",e),t},Math.floor(0))}},B=function(){return("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},V=function(t,e){var n=setTimeout(t,e);return"object"==typeof n&&n.unref&&n.unref(),n},W=function(){function t(t,e){if(void 0===e){this.pieces_=t.split("/");for(var n=0,r=0;r<this.pieces_.length;r++)this.pieces_[r].length>0&&(this.pieces_[n]=this.pieces_[r],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}return Object.defineProperty(t,"Empty",{get:function(){return new t("")},enumerable:!0,configurable:!0}),t.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},t.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},t.prototype.popFront=function(){var e=this.pieceNum_;return e<this.pieces_.length&&e++,new t(this.pieces_,e)},t.prototype.getBack=function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null},t.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},t.prototype.toUrlEncodedString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+encodeURIComponent(String(this.pieces_[e])));return t||"/"},t.prototype.slice=function(t){return void 0===t&&(t=0),this.pieces_.slice(this.pieceNum_+t)},t.prototype.parent=function(){if(this.pieceNum_>=this.pieces_.length)return null;for(var e=[],n=this.pieceNum_;n<this.pieces_.length-1;n++)e.push(this.pieces_[n]);return new t(e,0)},t.prototype.child=function(e){for(var n=[],r=this.pieceNum_;r<this.pieces_.length;r++)n.push(this.pieces_[r]);if(e instanceof t)for(r=e.pieceNum_;r<e.pieces_.length;r++)n.push(e.pieces_[r]);else{var i=e.split("/");for(r=0;r<i.length;r++)i[r].length>0&&n.push(i[r])}return new t(n,0)},t.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},t.relativePath=function(e,n){var r=e.getFront(),i=n.getFront();if(null===r)return n;if(r===i)return t.relativePath(e.popFront(),n.popFront());throw new Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+e+")")},t.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;i<n.length&&i<r.length;i++){var o=I(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1},t.prototype.equals=function(t){if(this.getLength()!==t.getLength())return!1;for(var e=this.pieceNum_,n=t.pieceNum_;e<=this.pieces_.length;e++,n++)if(this.pieces_[e]!==t.pieces_[n])return!1;return!0},t.prototype.contains=function(t){var e=this.pieceNum_,n=t.pieceNum_;if(this.getLength()>t.getLength())return!1;for(;e<this.pieces_.length;){if(this.pieces_[e]!==t.pieces_[n])return!1;++e,++n}return!0},t}(),G=function(){function t(t,e){this.errorPrefix_=e,this.parts_=t.slice(),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n<this.parts_.length;n++)this.byteLength_+=a.stringLength(this.parts_[n]);this.checkValid_()}return Object.defineProperty(t,"MAX_PATH_DEPTH",{get:function(){return 32},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MAX_PATH_LENGTH_BYTES",{get:function(){return 768},enumerable:!0,configurable:!0}),t.prototype.push=function(t){this.parts_.length>0&&(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=a.stringLength(t),this.checkValid_()},t.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=a.stringLength(t),this.parts_.length>0&&(this.byteLength_-=1)},t.prototype.checkValid_=function(){if(this.byteLength_>t.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+t.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>t.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+t.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},t.prototype.toErrorString=function(){return 0==this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},t}(),H="long_polling",Y=function(){function t(t,e,n,r,i){void 0===i&&(i=""),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=p.get("host:"+t)||this.host}return t.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()},t.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},t.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},t.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},t.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&p.set("host:"+this.host,this.internalHost))},t.prototype.connectionURL=function(t,e){var n;if(a.assert("string"==typeof t,"typeof type must == string"),a.assert("object"==typeof e,"typeof params must == object"),"websocket"===t)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==H)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e.ns=this.namespace);var r=[];return a.forEach(e,function(t,e){r.push(t+"="+e)}),n+r.join("&")},t.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},t.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},t}();var z,q,X,Q,K,Z=function(t){var e=J(t),n=e.subdomain;"firebase"===e.domain&&A(e.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),n&&"undefined"!=n||"localhost"===e.domain||A("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),e.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&S("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new Y(e.host,e.secure,n,r),path:new W(e.pathString)}},J=function(t){var e="",n="",r="",i="",o=!0,a="https",s=443;if("string"==typeof t){var u=t.indexOf("//");u>=0&&(a=t.substring(0,u-1),t=t.substring(u+2));var c=t.indexOf("/");-1===c&&(c=t.length);var l=t.indexOf("?");-1===l&&(l=t.length),e=t.substring(0,Math.min(c,l)),c<l&&(i=function(t){for(var e="",n=t.split("/"),r=0;r<n.length;r++)if(n[r].length>0){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}(t.substring(c,l)));var h=function(t){var e={};t.startsWith("?")&&(t=t.substring(1));for(var n=0,r=t.split("&");n<r.length;n++){var i=r[n];if(0!==i.length){var o=i.split("=");2===o.length?e[decodeURIComponent(o[0])]=decodeURIComponent(o[1]):S("Invalid query segment '"+i+"' in query '"+t+"'")}}return e}(t.substring(Math.min(t.length,l)));(u=e.indexOf(":"))>=0?(o="https"===a||"wss"===a,s=parseInt(e.substring(u+1),10)):u=t.length;var d=e.split(".");3===d.length?(n=d[1],r=d[0].toLowerCase()):2===d.length?n=d[0]:"localhost"===d[0].slice(0,u).toLowerCase()&&(n="localhost"),""===r&&"ns"in h&&(r=h.ns)}return{host:e,port:s,domain:n,subdomain:r,secure:o,scheme:a,pathString:i}},$=/[\[\].#$\/\u0000-\u001F\u007F]/,tt=/[\[\].#$\u0000-\u001F\u007F]/,et=function(t){return"string"==typeof t&&0!==t.length&&!$.test(t)},nt=function(t){return"string"==typeof t&&0!==t.length&&!tt.test(t)},rt=function(t){return null===t||"string"==typeof t||"number"==typeof t&&!k(t)||t&&"object"==typeof t&&a.contains(t,".sv")},it=function(t,e,n,r,i){i&&void 0===n||ot(a.errorPrefix(t,e,i),n,r)},ot=function(t,e,n){var r=n instanceof W?new G(n,t):n;if(void 0===e)throw new Error(t+"contains undefined "+r.toErrorString());if("function"==typeof e)throw new Error(t+"contains a function "+r.toErrorString()+" with contents = "+e.toString());if(k(e))throw new Error(t+"contains "+e.toString()+" "+r.toErrorString());if("string"==typeof e&&e.length>10485760/3&&a.stringLength(e)>10485760)throw new Error(t+"contains a string greater than 10485760 utf8 bytes "+r.toErrorString()+" ('"+e.substring(0,50)+"...')");if(e&&"object"==typeof e){var i=!1,o=!1;if(a.forEach(e,function(e,n){if(".value"===e)i=!0;else if(".priority"!==e&&".sv"!==e&&(o=!0,!et(e)))throw new Error(t+" contains an invalid key ("+e+") "+r.toErrorString()+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.push(e),ot(t,n,r),r.pop()}),i&&o)throw new Error(t+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},at=function(t,e,n,r,i){if(!i||void 0!==n){var o=a.errorPrefix(t,e,i);if(!n||"object"!=typeof n||Array.isArray(n))throw new Error(o+" must be an object containing the children to replace.");var s=[];a.forEach(n,function(t,e){var n=new W(t);if(ot(o,e,r.child(n)),".priority"===n.getBack()&&!rt(e))throw new Error(o+"contains an invalid value for '"+n.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(n)}),function(t,e){var n,r;for(n=0;n<e.length;n++)for(var i=(r=e[n]).slice(),o=0;o<i.length;o++)if(".priority"===i[o]&&o===i.length-1);else if(!et(i[o]))throw new Error(t+"contains an invalid key ("+i[o]+") in path "+r.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');e.sort(W.comparePaths);var a=null;for(n=0;n<e.length;n++){if(r=e[n],null!==a&&a.contains(r))throw new Error(t+"contains a path "+a.toString()+" that is ancestor of another path "+r.toString());a=r}}(o,s)}},st=function(t,e,n,r){if(!r||void 0!==n){if(k(n))throw new Error(a.errorPrefix(t,e,r)+"is "+n.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!rt(n))throw new Error(a.errorPrefix(t,e,r)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}},ut=function(t,e,n,r){if(!r||void 0!==n)switch(n){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw new Error(a.errorPrefix(t,e,r)+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}},ct=function(t,e,n,r){if(!(r&&void 0===n||et(n)))throw new Error(a.errorPrefix(t,e,r)+'was an invalid key = "'+n+'".  Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')},lt=function(t,e,n,r){if(!(r&&void 0===n||nt(n)))throw new Error(a.errorPrefix(t,e,r)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},ht=function(t,e){if(".info"===e.getFront())throw new Error(t+" failed = Can't modify data under /.info/")},dt=function(t,e,n){var r=n.path.toString();if("string"!=typeof n.repoInfo.host||0===n.repoInfo.host.length||!et(n.repoInfo.namespace)&&"localhost"!==n.repoInfo.host.split(":")[0]||0!==r.length&&!function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),nt(t)}(r))throw new Error(a.errorPrefix(t,e,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')},pt=function(){function t(t,e){this.repo_=t,this.path_=e}return t.prototype.cancel=function(t){a.validateArgCount("OnDisconnect.cancel",0,1,arguments.length),a.validateCallback("OnDisconnect.cancel",1,t,!0);var e=new a.Deferred;return this.repo_.onDisconnectCancel(this.path_,e.wrapCallback(t)),e.promise},t.prototype.remove=function(t){a.validateArgCount("OnDisconnect.remove",0,1,arguments.length),ht("OnDisconnect.remove",this.path_),a.validateCallback("OnDisconnect.remove",1,t,!0);var e=new a.Deferred;return this.repo_.onDisconnectSet(this.path_,null,e.wrapCallback(t)),e.promise},t.prototype.set=function(t,e){a.validateArgCount("OnDisconnect.set",1,2,arguments.length),ht("OnDisconnect.set",this.path_),it("OnDisconnect.set",1,t,this.path_,!1),a.validateCallback("OnDisconnect.set",2,e,!0);var n=new a.Deferred;return this.repo_.onDisconnectSet(this.path_,t,n.wrapCallback(e)),n.promise},t.prototype.setWithPriority=function(t,e,n){a.validateArgCount("OnDisconnect.setWithPriority",2,3,arguments.length),ht("OnDisconnect.setWithPriority",this.path_),it("OnDisconnect.setWithPriority",1,t,this.path_,!1),st("OnDisconnect.setWithPriority",2,e,!1),a.validateCallback("OnDisconnect.setWithPriority",3,n,!0);var r=new a.Deferred;return this.repo_.onDisconnectSetWithPriority(this.path_,t,e,r.wrapCallback(n)),r.promise},t.prototype.update=function(t,e){if(a.validateArgCount("OnDisconnect.update",1,2,arguments.length),ht("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,S("Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}at("OnDisconnect.update",1,t,this.path_,!1),a.validateCallback("OnDisconnect.update",2,e,!0);var i=new a.Deferred;return this.repo_.onDisconnectUpdate(this.path_,t,i.wrapCallback(e)),i.promise},t}(),ft=function(){function t(t,e){this.committed=t,this.snapshot=e}return t.prototype.toJSON=function(){return a.validateArgCount("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},t}(),gt=(z="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",q=0,X=[],function(t){var e,n=t===q;q=t;var r=new Array(8);for(e=7;e>=0;e--)r[e]=z.charAt(t%64),t=Math.floor(t/64);a.assert(0===t,"Cannot push at time == 0");var i=r.join("");if(n){for(e=11;e>=0&&63===X[e];e--)X[e]=0;X[e]++}else for(e=0;e<12;e++)X[e]=Math.floor(64*Math.random());for(e=0;e<12;e++)i+=z.charAt(X[e]);return a.assert(20===i.length,"nextPushId: Length should be 20."),i}),_t=function(){function t(t,e){this.name=t,this.node=e}return t.Wrap=function(e,n){return new t(e,n)},t}(),vt=function(){function t(){}return t.prototype.getCompare=function(){return this.compare.bind(this)},t.prototype.indexedValueChanged=function(t,e){var n=new _t(T,t),r=new _t(T,e);return 0!==this.compare(n,r)},t.prototype.minPost=function(){return _t.MIN},t}(),mt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u.__extends(e,t),Object.defineProperty(e,"__EMPTY_NODE",{get:function(){return Q},set:function(t){Q=t},enumerable:!0,configurable:!0}),e.prototype.compare=function(t,e){return I(t.name,e.name)},e.prototype.isDefinedOn=function(t){throw a.assertionError("KeyIndex.isDefinedOn not expected to be called.")},e.prototype.indexedValueChanged=function(t,e){return!1},e.prototype.minPost=function(){return _t.MIN},e.prototype.maxPost=function(){return new _t(P,Q)},e.prototype.makePost=function(t,e){return a.assert("string"==typeof t,"KeyIndex indexValue must always be a string."),new _t(t,Q)},e.prototype.toString=function(){return".key"},e}(vt),yt=new mt;var bt,wt,Ct,Et=function(t){return"number"==typeof t?"number:"+L(t):"string:"+t},xt=function(t){if(t.isLeafNode()){var e=t.val();a.assert("string"==typeof e||"number"==typeof e||"object"==typeof e&&a.contains(e,".sv"),"Priority must be a string or number.")}else a.assert(t===K||t.isEmpty(),"priority of unexpected type.");a.assert(t===K||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},At=function(){function t(e,n){void 0===n&&(n=t.__childrenNodeConstructor.EMPTY_NODE),this.value_=e,this.priorityNode_=n,this.lazyHash_=null,a.assert(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),xt(this.priorityNode_)}return Object.defineProperty(t,"__childrenNodeConstructor",{get:function(){return bt},set:function(t){bt=t},enumerable:!0,configurable:!0}),t.prototype.isLeafNode=function(){return!0},t.prototype.getPriority=function(){return this.priorityNode_},t.prototype.updatePriority=function(e){return new t(this.value_,e)},t.prototype.getImmediateChild=function(e){return".priority"===e?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.getChild=function(e){return e.isEmpty()?this:".priority"===e.getFront()?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.hasChild=function(){return!1},t.prototype.getPredecessorChildName=function(t,e){return null},t.prototype.updateImmediateChild=function(e,n){return".priority"===e?this.updatePriority(n):n.isEmpty()&&".priority"!==e?this:t.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,n).updatePriority(this.priorityNode_)},t.prototype.updateChild=function(e,n){var r=e.getFront();return null===r?n:n.isEmpty()&&".priority"!==r?this:(a.assert(".priority"!==r||1===e.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(r,t.__childrenNodeConstructor.EMPTY_NODE.updateChild(e.popFront(),n)))},t.prototype.isEmpty=function(){return!1},t.prototype.numChildren=function(){return 0},t.prototype.forEachChild=function(t,e){return!1},t.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},t.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.priorityNode_.isEmpty()||(t+="priority:"+Et(this.priorityNode_.val())+":");var e=typeof this.value_;t+=e+":",t+="number"===e?L(this.value_):this.value_,this.lazyHash_=v(t)}return this.lazyHash_},t.prototype.getValue=function(){return this.value_},t.prototype.compareTo=function(e){return e===t.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof t.__childrenNodeConstructor?-1:(a.assert(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))},t.prototype.compareToLeafNode_=function(e){var n=typeof e.value_,r=typeof this.value_,i=t.VALUE_TYPE_ORDER.indexOf(n),o=t.VALUE_TYPE_ORDER.indexOf(r);return a.assert(i>=0,"Unknown leaf type: "+n),a.assert(o>=0,"Unknown leaf type: "+r),i===o?"object"===r?0:this.value_<e.value_?-1:this.value_===e.value_?0:1:o-i},t.prototype.withIndex=function(){return this},t.prototype.isIndexed=function(){return!0},t.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode()){var e=t;return this.value_===e.value_&&this.priorityNode_.equals(e.priorityNode_)}return!1},t.VALUE_TYPE_ORDER=["object","boolean","number","string"],t}();var St,kt,Tt=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u.__extends(e,t),e.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),i=n.compareTo(r);return 0===i?I(t.name,e.name):i},e.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},e.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},e.prototype.minPost=function(){return _t.MIN},e.prototype.maxPost=function(){return new _t(P,new At("[PRIORITY-POST]",Ct))},e.prototype.makePost=function(t,e){var n=wt(t);return new _t(e,new At("[PRIORITY-POST]",n))},e.prototype.toString=function(){return".priority"},e}(vt)),Pt=function(){function t(t,e,n,r,i){void 0===i&&(i=null),this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];for(var o=1;!t.isEmpty();)if(t=t,o=e?n(t.key,e):1,r&&(o*=-1),o<0)t=this.isReverse_?t.left:t.right;else{if(0===o){this.nodeStack_.push(t);break}this.nodeStack_.push(t),t=this.isReverse_?t.right:t.left}}return t.prototype.getNext=function(){if(0===this.nodeStack_.length)return null;var t,e=this.nodeStack_.pop();if(t=this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value},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},t.prototype.hasNext=function(){return this.nodeStack_.length>0},t.prototype.peek=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}},t}(),It=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:Nt.EMPTY_NODE,this.right=null!=o?o:Nt.EMPTY_NODE}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.count=function(){return this.left.count()+1+this.right.count()},t.prototype.isEmpty=function(){return!1},t.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},t.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},t.prototype.minKey=function(){return this.min_().key},t.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},t.prototype.insert=function(t,e,n){var r,i;return(i=(r=n(t,(i=this).key))<0?i.copy(null,null,null,i.left.insert(t,e,n),null):0===r?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,n))).fixUp_()},t.prototype.removeMin_=function(){if(this.left.isEmpty())return Nt.EMPTY_NODE;var t=this;return t.left.isRed_()||t.left.left.isRed_()||(t=t.moveRedLeft_()),(t=t.copy(null,null,null,t.left.removeMin_(),null)).fixUp_()},t.prototype.remove=function(t,e){var n,r;if(e(t,(n=this).key)<0)n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===e(t,n.key)){if(n.right.isEmpty())return Nt.EMPTY_NODE;r=n.right.min_(),n=n.copy(r.key,r.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp_()},t.prototype.isRed_=function(){return this.color},t.prototype.fixUp_=function(){var t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t},t.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t.right.left.isRed_()&&(t=(t=(t=t.copy(null,null,null,null,t.right.rotateRight_())).rotateLeft_()).colorFlip_()),t},t.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&&(t=(t=t.rotateRight_()).colorFlip_()),t},t.prototype.rotateLeft_=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.rotateRight_=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.colorFlip_=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},t.prototype.check_=function(){var t;if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");if((t=this.left.check_())!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)},t.RED=!0,t.BLACK=!1,t}(),Ot=function(){function t(){}return t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.insert=function(t,e,n){return new It(t,e,null)},t.prototype.remove=function(t,e){return this},t.prototype.count=function(){return 0},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(t){return!1},t.prototype.reverseTraversal=function(t){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.check_=function(){return 0},t.prototype.isRed_=function(){return!1},t}(),Nt=function(){function t(e,n){void 0===n&&(n=t.EMPTY_NODE),this.comparator_=e,this.root_=n}return t.prototype.insert=function(e,n){return new t(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,It.BLACK,null,null))},t.prototype.remove=function(e){return new t(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,It.BLACK,null,null))},t.prototype.get=function(t){for(var e,n=this.root_;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key)))return n.value;e<0?n=n.left:e>0&&(n=n.right)}return null},t.prototype.getPredecessorKey=function(t){for(var e,n=this.root_,r=null;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}e<0?n=n.left:e>0&&(r=n,n=n.right)}throw new Error("Attempted to find predecessor key for a nonexistent key.  What gives?")},t.prototype.isEmpty=function(){return this.root_.isEmpty()},t.prototype.count=function(){return this.root_.count()},t.prototype.minKey=function(){return this.root_.minKey()},t.prototype.maxKey=function(){return this.root_.maxKey()},t.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},t.prototype.getIterator=function(t){return new Pt(this.root_,null,this.comparator_,!1,t)},t.prototype.getIteratorFrom=function(t,e){return new Pt(this.root_,t,this.comparator_,!1,e)},t.prototype.getReverseIteratorFrom=function(t,e){return new Pt(this.root_,t,this.comparator_,!0,e)},t.prototype.getReverseIterator=function(t){return new Pt(this.root_,null,this.comparator_,!0,t)},t.EMPTY_NODE=new Ot,t}(),Rt=Math.log(2),Dt=function(){function t(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/Rt,10)),this.current_=this.count-1;var n,r=(n=this.count,parseInt(Array(n+1).join("1"),2));this.bits_=t+1&r}return t.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<<this.current_);return this.current_--,t},t}(),Mt=function(t,e,n,r){t.sort(e);var i=function(e,r){var o,a,s=r-e;if(0==s)return null;if(1==s)return o=t[e],a=n?n(o):o,new It(a,o.node,It.BLACK,null,null);var u=parseInt(s/2,10)+e,c=i(e,u),l=i(u+1,r);return o=t[u],a=n?n(o):o,new It(a,o.node,It.BLACK,c,l)},o=function(e){for(var r=null,o=null,a=t.length,s=function(e,r){var o=a-e,s=a;a-=e;var c=i(o+1,s),l=t[o],h=n?n(l):l;u(new It(h,l.node,r,null,c))},u=function(t){r?(r.left=t,r=t):(o=t,r=t)},c=0;c<e.count;++c){var l=e.nextBitIsOne(),h=Math.pow(2,e.count-(c+1));l?s(h,It.BLACK):(s(h,It.BLACK),s(h,It.RED))}return o}(new Dt(t.length));return new Nt(r||e,o)},Lt={},jt=function(){function t(t,e){this.indexes_=t,this.indexSet_=e}return Object.defineProperty(t,"Default",{get:function(){return a.assert(Lt&&Tt,"ChildrenNode.ts has not been loaded"),St=St||new t({".priority":Lt},{".priority":Tt})},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var e=a.safeGet(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e===Lt?null:e},t.prototype.hasIndex=function(t){return a.contains(this.indexSet_,t.toString())},t.prototype.addIndex=function(e,n){a.assert(e!==yt,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var r,i=[],o=!1,s=n.getIterator(_t.Wrap),u=s.getNext();u;)o=o||e.isDefinedOn(u.node),i.push(u),u=s.getNext();r=o?Mt(i,e.getCompare()):Lt;var c=e.toString(),l=a.clone(this.indexSet_);l[c]=e;var h=a.clone(this.indexes_);return h[c]=r,new t(h,l)},t.prototype.addToIndexes=function(e,n){var r=this;return new t(a.map(this.indexes_,function(t,i){var o=a.safeGet(r.indexSet_,i);if(a.assert(o,"Missing index implementation for "+i),t===Lt){if(o.isDefinedOn(e.node)){for(var s=[],u=n.getIterator(_t.Wrap),c=u.getNext();c;)c.name!=e.name&&s.push(c),c=u.getNext();return s.push(e),Mt(s,o.getCompare())}return Lt}var l=n.get(e.name),h=t;return l&&(h=h.remove(new _t(e.name,l))),h.insert(e,e.node)}),this.indexSet_)},t.prototype.removeFromIndexes=function(e,n){return new t(a.map(this.indexes_,function(t){if(t===Lt)return t;var r=n.get(e.name);return r?t.remove(new _t(e.name,r)):t}),this.indexSet_)},t}();function Ut(t,e){return I(t.name,e.name)}function Ft(t,e){return I(t,e)}var Bt=function(){function t(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&xt(this.priorityNode_),this.children_.isEmpty()&&a.assert(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}return Object.defineProperty(t,"EMPTY_NODE",{get:function(){return kt||(kt=new t(new Nt(Ft),null,jt.Default))},enumerable:!0,configurable:!0}),t.prototype.isLeafNode=function(){return!1},t.prototype.getPriority=function(){return this.priorityNode_||kt},t.prototype.updatePriority=function(e){return this.children_.isEmpty()?this:new t(this.children_,e,this.indexMap_)},t.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();var e=this.children_.get(t);return null===e?kt:e},t.prototype.getChild=function(t){var e=t.getFront();return null===e?this:this.getImmediateChild(e).getChild(t.popFront())},t.prototype.hasChild=function(t){return null!==this.children_.get(t)},t.prototype.updateImmediateChild=function(e,n){if(a.assert(n,"We should always be passing snapshot nodes"),".priority"===e)return this.updatePriority(n);var r=new _t(e,n),i=void 0,o=void 0;return n.isEmpty()?(i=this.children_.remove(e),o=this.indexMap_.removeFromIndexes(r,this.children_)):(i=this.children_.insert(e,n),o=this.indexMap_.addToIndexes(r,this.children_)),new t(i,i.isEmpty()?kt:this.priorityNode_,o)},t.prototype.updateChild=function(t,e){var n=t.getFront();if(null===n)return e;a.assert(".priority"!==t.getFront()||1===t.getLength(),".priority must be the last token in a path");var r=this.getImmediateChild(n).updateChild(t.popFront(),e);return this.updateImmediateChild(n,r)},t.prototype.isEmpty=function(){return this.children_.isEmpty()},t.prototype.numChildren=function(){return this.children_.count()},t.prototype.val=function(e){if(this.isEmpty())return null;var n={},r=0,i=0,o=!0;if(this.forEachChild(Tt,function(a,s){n[a]=s.val(e),r++,o&&t.INTEGER_REGEXP_.test(a)?i=Math.max(i,Number(a)):o=!1}),!e&&o&&i<2*r){var a=[];for(var s in n)a[s]=n[s];return a}return e&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n},t.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.getPriority().isEmpty()||(t+="priority:"+Et(this.getPriority().val())+":"),this.forEachChild(Tt,function(e,n){var r=n.hash();""!==r&&(t+=":"+e+":"+r)}),this.lazyHash_=""===t?"":v(t)}return this.lazyHash_},t.prototype.getPredecessorChildName=function(t,e,n){var r=this.resolveIndex_(n);if(r){var i=r.getPredecessorKey(new _t(t,e));return i?i.name:null}return this.children_.getPredecessorKey(t)},t.prototype.getFirstChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.minKey();return n&&n.name}return this.children_.minKey()},t.prototype.getFirstChild=function(t){var e=this.getFirstChildName(t);return e?new _t(e,this.children_.get(e)):null},t.prototype.getLastChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.maxKey();return n&&n.name}return this.children_.maxKey()},t.prototype.getLastChild=function(t){var e=this.getLastChildName(t);return e?new _t(e,this.children_.get(e)):null},t.prototype.forEachChild=function(t,e){var n=this.resolveIndex_(t);return n?n.inorderTraversal(function(t){return e(t.name,t.node)}):this.children_.inorderTraversal(e)},t.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},t.prototype.getIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getIteratorFrom(t,function(t){return t});for(var r=this.children_.getIteratorFrom(t.name,_t.Wrap),i=r.peek();null!=i&&e.compare(i,t)<0;)r.getNext(),i=r.peek();return r},t.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},t.prototype.getReverseIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getReverseIteratorFrom(t,function(t){return t});for(var r=this.children_.getReverseIteratorFrom(t.name,_t.Wrap),i=r.peek();null!=i&&e.compare(i,t)>0;)r.getNext(),i=r.peek();return r},t.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===Vt?-1:0},t.prototype.withIndex=function(e){if(e===yt||this.indexMap_.hasIndex(e))return this;var n=this.indexMap_.addIndex(e,this.children_);return new t(this.children_,this.priorityNode_,n)},t.prototype.isIndexed=function(t){return t===yt||this.indexMap_.hasIndex(t)},t.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;var e=t;if(this.getPriority().equals(e.getPriority())){if(this.children_.count()===e.children_.count()){for(var n=this.getIterator(Tt),r=e.getIterator(Tt),i=n.getNext(),o=r.getNext();i&&o;){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=n.getNext(),o=r.getNext()}return null===i&&null===o}return!1}return!1},t.prototype.resolveIndex_=function(t){return t===yt?null:this.indexMap_.get(t.toString())},t.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,t}(),Vt=new(function(t){function e(){return t.call(this,new Nt(Ft),Bt.EMPTY_NODE,jt.Default)||this}return u.__extends(e,t),e.prototype.compareTo=function(t){return t===this?0:1},e.prototype.equals=function(t){return t===this},e.prototype.getPriority=function(){return this},e.prototype.getImmediateChild=function(t){return Bt.EMPTY_NODE},e.prototype.isEmpty=function(){return!1},e}(Bt));Object.defineProperties(_t,{MIN:{value:new _t(T,Bt.EMPTY_NODE)},MAX:{value:new _t(P,Vt)}}),mt.__EMPTY_NODE=Bt.EMPTY_NODE,At.__childrenNodeConstructor=Bt,K=Vt,function(t){Ct=t}(Vt);var Wt=!0;function Gt(t,e){if(void 0===e&&(e=null),null===t)return Bt.EMPTY_NODE;if("object"==typeof t&&".priority"in t&&(e=t[".priority"]),a.assert(null===e||"string"==typeof e||"number"==typeof e||"object"==typeof e&&".sv"in e,"Invalid priority type found: "+typeof e),"object"==typeof t&&".value"in t&&null!==t[".value"]&&(t=t[".value"]),"object"!=typeof t||".sv"in t)return new At(t,Gt(e));if(t instanceof Array||!Wt){var n=Bt.EMPTY_NODE,r=t;return a.forEach(r,function(t,e){if(a.contains(r,t)&&"."!==t.substring(0,1)){var i=Gt(e);!i.isLeafNode()&&i.isEmpty()||(n=n.updateImmediateChild(t,i))}}),n.updatePriority(Gt(e))}var i=[],o=!1,s=t;if(a.forEach(s,function(t,e){if("string"!=typeof t||"."!==t.substring(0,1)){var n=Gt(s[t]);n.isEmpty()||(o=o||!n.getPriority().isEmpty(),i.push(new _t(t,n)))}}),0==i.length)return Bt.EMPTY_NODE;var u=Mt(i,Ut,function(t){return t.name},Ft);if(o){var c=Mt(i,Tt.getCompare());return new Bt(u,Gt(e),new jt({".priority":c},{".priority":Tt}))}return new Bt(u,Gt(e),jt.Default)}!function(t){wt=t}(Gt);var Ht,Yt,zt=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u.__extends(e,t),e.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?I(t.name,e.name):n},e.prototype.isDefinedOn=function(t){return!0},e.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},e.prototype.minPost=function(){return _t.MIN},e.prototype.maxPost=function(){return _t.MAX},e.prototype.makePost=function(t,e){var n=Gt(t);return new _t(e,n)},e.prototype.toString=function(){return".value"},e}(vt)),qt=function(t){function e(e){var n=t.call(this)||this;return n.indexPath_=e,a.assert(!e.isEmpty()&&".priority"!==e.getFront(),"Can't create PathIndex with empty path or .priority key"),n}return u.__extends(e,t),e.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},e.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},e.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),i=n.compareTo(r);return 0===i?I(t.name,e.name):i},e.prototype.makePost=function(t,e){var n=Gt(t),r=Bt.EMPTY_NODE.updateChild(this.indexPath_,n);return new _t(e,r)},e.prototype.maxPost=function(){var t=Bt.EMPTY_NODE.updateChild(this.indexPath_,Vt);return new _t(P,t)},e.prototype.toString=function(){return this.indexPath_.slice().join("/")},e}(vt),Xt=function(){function t(t,e,n){this.node_=t,this.ref_=e,this.index_=n}return t.prototype.val=function(){return a.validateArgCount("DataSnapshot.val",0,0,arguments.length),this.node_.val()},t.prototype.exportVal=function(){return a.validateArgCount("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},t.prototype.toJSON=function(){return a.validateArgCount("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},t.prototype.exists=function(){return a.validateArgCount("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},t.prototype.child=function(e){a.validateArgCount("DataSnapshot.child",0,1,arguments.length),e=String(e),lt("DataSnapshot.child",1,e,!1);var n=new W(e),r=this.ref_.child(n);return new t(this.node_.getChild(n),r,Tt)},t.prototype.hasChild=function(t){a.validateArgCount("DataSnapshot.hasChild",1,1,arguments.length),lt("DataSnapshot.hasChild",1,t,!1);var e=new W(t);return!this.node_.getChild(e).isEmpty()},t.prototype.getPriority=function(){return a.validateArgCount("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},t.prototype.forEach=function(e){var n=this;return a.validateArgCount("DataSnapshot.forEach",1,1,arguments.length),a.validateCallback("DataSnapshot.forEach",1,e,!1),!this.node_.isLeafNode()&&!!this.node_.forEachChild(this.index_,function(r,i){return e(new t(i,n.ref_.child(r),Tt))})},t.prototype.hasChildren=function(){return a.validateArgCount("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(t.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!0,configurable:!0}),t.prototype.numChildren=function(){return a.validateArgCount("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},t.prototype.getRef=function(){return a.validateArgCount("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),Qt=function(){function t(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}return t.prototype.getPath=function(){var t=this.snapshot.getRef();return"value"===this.eventType?t.path:t.getParent().path},t.prototype.getEventType=function(){return this.eventType},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+a.stringify(this.snapshot.exportVal())},t}(),Kt=function(){function t(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}return t.prototype.getPath=function(){return this.path},t.prototype.getEventType=function(){return"cancel"},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.path.toString()+":cancel"},t}(),Zt=function(){function t(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){return"value"===t},t.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new Qt("value",this,new Xt(t.snapshotNode,e.getRef(),n))},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){a.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callback_;return function(){r.call(e,t.snapshot)}},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new Kt(this,t,e):null},t.prototype.matches=function(e){return e instanceof t&&(!e.callback_||!this.callback_||e.callback_===this.callback_&&e.context_===this.context_)},t.prototype.hasAnyCallback=function(){return null!==this.callback_},t}(),Jt=function(){function t(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){var e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,a.contains(this.callbacks_,e)},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new Kt(this,t,e):null},t.prototype.createEvent=function(t,e){a.assert(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),r=e.getQueryParams().getIndex();return new Qt(t.type,this,new Xt(t.snapshotNode,n,r),t.prevName)},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){a.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callbacks_[t.eventType];return function(){r.call(e,t.snapshot,t.prevName)}},t.prototype.matches=function(e){if(e instanceof t){if(!this.callbacks_||!e.callbacks_)return!0;if(this.context_===e.context_){var n=a.getCount(e.callbacks_);if(n===a.getCount(this.callbacks_)){if(1===n){var r=a.getAnyKey(e.callbacks_),i=a.getAnyKey(this.callbacks_);return!(i!==r||e.callbacks_[r]&&this.callbacks_[i]&&e.callbacks_[r]!==this.callbacks_[i])}return a.every(this.callbacks_,function(t,n){return e.callbacks_[t]===n})}}}return!1},t.prototype.hasAnyCallback=function(){return null!==this.callbacks_},t}(),$t=function(){function t(t,e,n,r){this.repo=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r}return Object.defineProperty(t,"__referenceConstructor",{get:function(){return a.assert(Ht,"Reference.ts has not been loaded"),Ht},set:function(t){Ht=t},enumerable:!0,configurable:!0}),t.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===yt){var r="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!=T)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!=P)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===Tt){if(null!=e&&!rt(e)||null!=n&&!rt(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(a.assert(t.getIndex()instanceof qt||t.getIndex()===zt,"unknown index type."),null!=e&&"object"==typeof e||null!=n&&"object"==typeof n)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},t.validateLimit_=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},t.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},t.prototype.getQueryParams=function(){return this.queryParams_},t.prototype.getRef=function(){return a.validateArgCount("Query.ref",0,0,arguments.length),new t.__referenceConstructor(this.repo,this.path)},t.prototype.on=function(e,n,r,i){a.validateArgCount("Query.on",2,4,arguments.length),ut("Query.on",1,e,!1),a.validateCallback("Query.on",2,n,!1);var o=t.getCancelAndContextArgs_("Query.on",r,i);if("value"===e)this.onValueEvent(n,o.cancel,o.context);else{var s={};s[e]=n,this.onChildEvent(s,o.cancel,o.context)}return n},t.prototype.onValueEvent=function(t,e,n){var r=new Zt(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,r)},t.prototype.onChildEvent=function(t,e,n){var r=new Jt(t,e,n);this.repo.addEventCallbackForQuery(this,r)},t.prototype.off=function(t,e,n){a.validateArgCount("Query.off",0,3,arguments.length),ut("Query.off",1,t,!0),a.validateCallback("Query.off",2,e,!0),a.validateContextObject("Query.off",3,n,!0);var r=null,i=null;"value"===t?r=new Zt(e||null,null,n||null):t&&(e&&((i={})[t]=e),r=new Jt(i,null,n||null));this.repo.removeEventCallbackForQuery(this,r)},t.prototype.once=function(e,n,r,i){var o=this;a.validateArgCount("Query.once",1,4,arguments.length),ut("Query.once",1,e,!1),a.validateCallback("Query.once",2,n,!0);var s=t.getCancelAndContextArgs_("Query.once",r,i),u=!0,c=new a.Deferred;c.promise.catch(function(){});var l=function(t){u&&(u=!1,o.off(e,l),n&&n.bind(s.context)(t),c.resolve(t))};return this.on(e,l,function(t){o.off(e,l),s.cancel&&s.cancel.bind(s.context)(t),c.reject(t)}),c.promise},t.prototype.limitToFirst=function(e){if(a.validateArgCount("Query.limitToFirst",1,1,arguments.length),"number"!=typeof e||Math.floor(e)!==e||e<=0)throw new Error("Query.limitToFirst: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.queryParams_.limitToFirst(e),this.orderByCalled_)},t.prototype.limitToLast=function(e){if(a.validateArgCount("Query.limitToLast",1,1,arguments.length),"number"!=typeof e||Math.floor(e)!==e||e<=0)throw new Error("Query.limitToLast: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.queryParams_.limitToLast(e),this.orderByCalled_)},t.prototype.orderByChild=function(e){if(a.validateArgCount("Query.orderByChild",1,1,arguments.length),"$key"===e)throw new Error('Query.orderByChild: "$key" is invalid.  Use Query.orderByKey() instead.');if("$priority"===e)throw new Error('Query.orderByChild: "$priority" is invalid.  Use Query.orderByPriority() instead.');if("$value"===e)throw new Error('Query.orderByChild: "$value" is invalid.  Use Query.orderByValue() instead.');lt("Query.orderByChild",1,e,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var n=new W(e);if(n.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path.  Use Query.orderByValue() instead.");var r=new qt(n),i=this.queryParams_.orderBy(r);return t.validateQueryEndpoints_(i),new t(this.repo,this.path,i,!0)},t.prototype.orderByKey=function(){a.validateArgCount("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var e=this.queryParams_.orderBy(yt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByPriority=function(){a.validateArgCount("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var e=this.queryParams_.orderBy(Tt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByValue=function(){a.validateArgCount("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var e=this.queryParams_.orderBy(zt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.startAt=function(e,n){void 0===e&&(e=null),a.validateArgCount("Query.startAt",0,2,arguments.length),it("Query.startAt",1,e,this.path,!0),ct("Query.startAt",2,n,!0);var r=this.queryParams_.startAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasStart())throw new Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===e&&(e=null,n=null),new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.endAt=function(e,n){void 0===e&&(e=null),a.validateArgCount("Query.endAt",0,2,arguments.length),it("Query.endAt",1,e,this.path,!0),ct("Query.endAt",2,n,!0);var r=this.queryParams_.endAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.equalTo=function(t,e){if(a.validateArgCount("Query.equalTo",1,2,arguments.length),it("Query.equalTo",1,t,this.path,!1),ct("Query.equalTo",2,e,!0),this.queryParams_.hasStart())throw new Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.queryParams_.hasEnd())throw new Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(t,e).endAt(t,e)},t.prototype.toString=function(){return a.validateArgCount("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},t.prototype.toJSON=function(){return a.validateArgCount("Query.toJSON",0,1,arguments.length),this.toString()},t.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},t.prototype.queryIdentifier=function(){var t=this.queryObject(),e=R(t);return"{}"===e?"default":e},t.prototype.isEqual=function(e){if(a.validateArgCount("Query.isEqual",1,1,arguments.length),!(e instanceof t)){throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.")}var n=this.repo===e.repo,r=this.path.equals(e.path),i=this.queryIdentifier()===e.queryIdentifier();return n&&r&&i},t.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,a.validateCallback(t,3,r.cancel,!0),r.context=n,a.validateContextObject(t,4,r.context,!0);else if(e)if("object"==typeof e&&null!==e)r.context=e;else{if("function"!=typeof e)throw new Error(a.errorPrefix(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),te=function(){function t(){this.set={}}return t.prototype.add=function(t,e){this.set[t]=null===e||e},t.prototype.contains=function(t){return a.contains(this.set,t)},t.prototype.get=function(t){return this.contains(t)?this.set[t]:void 0},t.prototype.remove=function(t){delete this.set[t]},t.prototype.clear=function(){this.set={}},t.prototype.isEmpty=function(){return a.isEmpty(this.set)},t.prototype.count=function(){return a.getCount(this.set)},t.prototype.each=function(t){a.forEach(this.set,function(e,n){return t(e,n)})},t.prototype.keys=function(){var t=[];return a.forEach(this.set,function(e){t.push(e)}),t},t}(),ee=function(){function t(){this.value_=null,this.children_=null}return t.prototype.find=function(t){if(null!=this.value_)return this.value_.getChild(t);if(t.isEmpty()||null==this.children_)return null;var e=t.getFront();return t=t.popFront(),this.children_.contains(e)?this.children_.get(e).find(t):null},t.prototype.remember=function(e,n){if(e.isEmpty())this.value_=n,this.children_=null;else if(null!==this.value_)this.value_=this.value_.updateChild(e,n);else{null==this.children_&&(this.children_=new te);var r=e.getFront();this.children_.contains(r)||this.children_.add(r,new t);var i=this.children_.get(r);e=e.popFront(),i.remember(e,n)}},t.prototype.forget=function(t){if(t.isEmpty())return this.value_=null,this.children_=null,!0;if(null!==this.value_){if(this.value_.isLeafNode())return!1;var e=this.value_;this.value_=null;var n=this;return e.forEachChild(Tt,function(t,e){n.remember(new W(t),e)}),this.forget(t)}if(null!==this.children_){var r=t.getFront();if(t=t.popFront(),this.children_.contains(r))this.children_.get(r).forget(t)&&this.children_.remove(r);return!!this.children_.isEmpty()&&(this.children_=null,!0)}return!0},t.prototype.forEachTree=function(t,e){null!==this.value_?e(t,this.value_):this.forEachChild(function(n,r){var i=new W(t.toString()+"/"+n);r.forEachTree(i,e)})},t.prototype.forEachChild=function(t){null!==this.children_&&this.children_.each(function(e,n){t(e,n)})},t}(),ne=function(t,e){return t&&"object"==typeof t?(a.assert(".sv"in t,"Unexpected leaf node or priority contents"),e[t[".sv"]]):t},re=function(t,e){var n,r=t.getPriority().val(),i=ne(r,e);if(t.isLeafNode()){var o=t,a=ne(o.getValue(),e);return a!==o.getValue()||i!==o.getPriority().val()?new At(a,Gt(i)):t}var s=t;return n=s,i!==s.getPriority().val()&&(n=n.updatePriority(new At(i))),s.forEachChild(Tt,function(t,r){var i=re(r,e);i!==r&&(n=n.updateImmediateChild(t,i))}),n};!function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(Yt||(Yt={}));var ie,oe,ae=function(){function t(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,a.assert(!r||e,"Tagged queries must be from server.")}return t.User=new t(!0,!1,null,!1),t.Server=new t(!1,!0,null,!1),t.forServerTaggedQuery=function(e){return new t(!1,!0,e,!0)},t}(),se=function(){function t(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=Yt.ACK_USER_WRITE,this.source=ae.User}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return a.assert(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var n=this.affectedTree.subtree(new W(e));return new t(W.Empty,n,this.revert)}return a.assert(this.path.getFront()===e,"operationForChild called for unrelated child."),new t(this.path.popFront(),this.affectedTree,this.revert)},t}(),ue=function(){return ie||(ie=new Nt(O)),ie},ce=function(){function t(t,e){void 0===e&&(e=ue()),this.value=t,this.children=e}return t.fromObject=function(e){var n=t.Empty;return a.forEach(e,function(t,e){n=n.set(new W(t),e)}),n},t.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},t.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:W.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null!==r){var i=r.findRootMostMatchingPathAndValue(t.popFront(),e);return null!=i?{path:new W(n).child(i.path),value:i.value}:null}return null},t.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},t.prototype.subtree=function(e){if(e.isEmpty())return this;var n=e.getFront(),r=this.children.get(n);return null!==r?r.subtree(e.popFront()):t.Empty},t.prototype.set=function(e,n){if(e.isEmpty())return new t(n,this.children);var r=e.getFront(),i=(this.children.get(r)||t.Empty).set(e.popFront(),n),o=this.children.insert(r,i);return new t(this.value,o)},t.prototype.remove=function(e){if(e.isEmpty())return this.children.isEmpty()?t.Empty:new t(null,this.children);var n=e.getFront(),r=this.children.get(n);if(r){var i=r.remove(e.popFront()),o=void 0;return o=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),null===this.value&&o.isEmpty()?t.Empty:new t(this.value,o)}return this},t.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),n=this.children.get(e);return n?n.get(t.popFront()):null},t.prototype.setTree=function(e,n){if(e.isEmpty())return n;var r=e.getFront(),i=(this.children.get(r)||t.Empty).setTree(e.popFront(),n),o=void 0;return o=i.isEmpty()?this.children.remove(r):this.children.insert(r,i),new t(this.value,o)},t.prototype.fold=function(t){return this.fold_(W.Empty,t)},t.prototype.fold_=function(t,e){var n={};return this.children.inorderTraversal(function(r,i){n[r]=i.fold_(t.child(r),e)}),e(t,this.value,n)},t.prototype.findOnPath=function(t,e){return this.findOnPath_(t,W.Empty,e)},t.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(t.isEmpty())return null;var i=t.getFront(),o=this.children.get(i);return o?o.findOnPath_(t.popFront(),e.child(i),n):null},t.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,W.Empty,e)},t.prototype.foreachOnPath_=function(e,n,r){if(e.isEmpty())return this;this.value&&r(n,this.value);var i=e.getFront(),o=this.children.get(i);return o?o.foreachOnPath_(e.popFront(),n.child(i),r):t.Empty},t.prototype.foreach=function(t){this.foreach_(W.Empty,t)},t.prototype.foreach_=function(t,e){this.children.inorderTraversal(function(n,r){r.foreach_(t.child(n),e)}),this.value&&e(t,this.value)},t.prototype.foreachChild=function(t){this.children.inorderTraversal(function(e,n){n.value&&t(e,n.value)})},t.Empty=new t(null),t}(),le=function(){function t(t,e){this.source=t,this.path=e,this.type=Yt.LISTEN_COMPLETE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,W.Empty):new t(this.source,this.path.popFront())},t}(),he=function(){function t(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=Yt.OVERWRITE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,W.Empty,this.snap.getImmediateChild(e)):new t(this.source,this.path.popFront(),this.snap)},t}(),de=function(){function t(t,e,n){this.source=t,this.path=e,this.children=n,this.type=Yt.MERGE}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){var n=this.children.subtree(new W(e));return n.isEmpty()?null:n.value?new he(this.source,W.Empty,n.value):new t(this.source,W.Empty,n)}return a.assert(this.path.getFront()===e,"Can't get a merge for a child not on the path of the operation"),new t(this.source,this.path.popFront(),this.children)},t.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},t}(),pe=function(){function t(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}return t.prototype.isFullyInitialized=function(){return this.fullyInitialized_},t.prototype.isFiltered=function(){return this.filtered_},t.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var e=t.getFront();return this.isCompleteForChild(e)},t.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},t.prototype.getNode=function(){return this.node_},t}(),fe=function(){function t(t,e){this.eventCache_=t,this.serverCache_=e}return t.prototype.updateEventSnap=function(e,n,r){return new t(new pe(e,n,r),this.serverCache_)},t.prototype.updateServerSnap=function(e,n,r){return new t(this.eventCache_,new pe(e,n,r))},t.prototype.getEventCache=function(){return this.eventCache_},t.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},t.prototype.getServerCache=function(){return this.serverCache_},t.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},t.Empty=new t(new pe(Bt.EMPTY_NODE,!1,!1),new pe(Bt.EMPTY_NODE,!1,!1)),t}(),ge=function(){function t(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}return t.valueChange=function(e){return new t(t.VALUE,e)},t.childAddedChange=function(e,n){return new t(t.CHILD_ADDED,n,e)},t.childRemovedChange=function(e,n){return new t(t.CHILD_REMOVED,n,e)},t.childChangedChange=function(e,n,r){return new t(t.CHILD_CHANGED,n,e,r)},t.childMovedChange=function(e,n){return new t(t.CHILD_MOVED,n,e)},t.CHILD_ADDED="child_added",t.CHILD_REMOVED="child_removed",t.CHILD_CHANGED="child_changed",t.CHILD_MOVED="child_moved",t.VALUE="value",t}(),_e=function(){function t(t){this.index_=t}return t.prototype.updateChild=function(t,e,n,r,i,o){a.assert(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");var s=t.getImmediateChild(e);return s.getChild(r).equals(n.getChild(r))&&s.isEmpty()==n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(ge.childRemovedChange(e,s)):a.assert(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(ge.childAddedChange(e,n)):o.trackChildChange(ge.childChangedChange(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},t.prototype.updateFullNode=function(t,e,n){return null!=n&&(t.isLeafNode()||t.forEachChild(Tt,function(t,r){e.hasChild(t)||n.trackChildChange(ge.childRemovedChange(t,r))}),e.isLeafNode()||e.forEachChild(Tt,function(e,r){if(t.hasChild(e)){var i=t.getImmediateChild(e);i.equals(r)||n.trackChildChange(ge.childChangedChange(e,r,i))}else n.trackChildChange(ge.childAddedChange(e,r))})),e.withIndex(this.index_)},t.prototype.updatePriority=function(t,e){return t.isEmpty()?Bt.EMPTY_NODE:t.updatePriority(e)},t.prototype.filtersNodes=function(){return!1},t.prototype.getIndexedFilter=function(){return this},t.prototype.getIndex=function(){return this.index_},t}(),ve=function(){function t(){this.changeMap_={}}return t.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;a.assert(e==ge.CHILD_ADDED||e==ge.CHILD_CHANGED||e==ge.CHILD_REMOVED,"Only child changes supported for tracking"),a.assert(".priority"!==n,"Only non-priority child changes can be tracked.");var r=a.safeGet(this.changeMap_,n);if(r){var i=r.type;if(e==ge.CHILD_ADDED&&i==ge.CHILD_REMOVED)this.changeMap_[n]=ge.childChangedChange(n,t.snapshotNode,r.snapshotNode);else if(e==ge.CHILD_REMOVED&&i==ge.CHILD_ADDED)delete this.changeMap_[n];else if(e==ge.CHILD_REMOVED&&i==ge.CHILD_CHANGED)this.changeMap_[n]=ge.childRemovedChange(n,r.oldSnap);else if(e==ge.CHILD_CHANGED&&i==ge.CHILD_ADDED)this.changeMap_[n]=ge.childAddedChange(n,t.snapshotNode);else{if(e!=ge.CHILD_CHANGED||i!=ge.CHILD_CHANGED)throw a.assertionError("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap_[n]=ge.childChangedChange(n,t.snapshotNode,r.oldSnap)}}else this.changeMap_[n]=t},t.prototype.getChanges=function(){return a.getValues(this.changeMap_)},t}(),me=new(function(){function t(){}return t.prototype.getCompleteChild=function(t){return null},t.prototype.getChildAfterChild=function(t,e,n){return null},t}()),ye=function(){function t(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}return t.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);var n=null!=this.optCompleteServerCache_?new pe(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,n)},t.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),i=this.writes_.calcIndexedSlice(r,e,1,n,t);return 0===i.length?null:i[0]},t}(),be=function(){return function(t,e){this.viewCache=t,this.changes=e}}(),we=function(){function t(t){this.filter_=t}return t.prototype.assertIndexed=function(t){a.assert(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),a.assert(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},t.prototype.applyOperation=function(e,n,r,i){var o,s,u=new ve;if(n.type===Yt.OVERWRITE){var c=n;c.source.fromUser?o=this.applyUserOverwrite_(e,c.path,c.snap,r,i,u):(a.assert(c.source.fromServer,"Unknown source."),s=c.source.tagged||e.getServerCache().isFiltered()&&!c.path.isEmpty(),o=this.applyServerOverwrite_(e,c.path,c.snap,r,i,s,u))}else if(n.type===Yt.MERGE){var l=n;l.source.fromUser?o=this.applyUserMerge_(e,l.path,l.children,r,i,u):(a.assert(l.source.fromServer,"Unknown source."),s=l.source.tagged||e.getServerCache().isFiltered(),o=this.applyServerMerge_(e,l.path,l.children,r,i,s,u))}else if(n.type===Yt.ACK_USER_WRITE){var h=n;o=h.revert?this.revertUserWrite_(e,h.path,r,i,u):this.ackUserWrite_(e,h.path,h.affectedTree,r,i,u)}else{if(n.type!==Yt.LISTEN_COMPLETE)throw a.assertionError("Unknown operation type: "+n.type);o=this.listenComplete_(e,n.path,r,u)}var d=u.getChanges();return t.maybeAddValueEvent_(e,o,d),new be(o,d)},t.maybeAddValueEvent_=function(t,e,n){var r=e.getEventCache();if(r.isFullyInitialized()){var i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=t.getCompleteEventSnap();(n.length>0||!t.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(ge.valueChange(e.getCompleteEventSnap()))}},t.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var s=void 0,u=void 0;if(e.isEmpty())if(a.assert(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var c=t.getCompleteServerSnap(),l=c instanceof Bt?c:Bt.EMPTY_NODE,h=n.calcCompleteEventChildren(l);s=this.filter_.updateFullNode(t.getEventCache().getNode(),h,i)}else{var d=n.calcCompleteEventCache(t.getCompleteServerSnap());s=this.filter_.updateFullNode(t.getEventCache().getNode(),d,i)}else{var p=e.getFront();if(".priority"==p){a.assert(1==e.getLength(),"Can't have a priority with additional path components");var f=o.getNode();u=t.getServerCache().getNode();var g=n.calcEventCacheAfterServerOverwrite(e,f,u);s=null!=g?this.filter_.updatePriority(f,g):o.getNode()}else{var _=e.popFront(),v=void 0;if(o.isCompleteForChild(p)){u=t.getServerCache().getNode();var m=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),u);v=null!=m?o.getNode().getImmediateChild(p).updateChild(_,m):o.getNode().getImmediateChild(p)}else v=n.calcCompleteChild(p,t.getServerCache());s=null!=v?this.filter_.updateChild(o.getNode(),p,v,_,r,i):o.getNode()}}return t.updateEventSnap(s,o.isFullyInitialized()||e.isEmpty(),this.filter_.filtersNodes())},t.prototype.applyServerOverwrite_=function(t,e,n,r,i,o,a){var s,u=t.getServerCache(),c=o?this.filter_:this.filter_.getIndexedFilter();if(e.isEmpty())s=c.updateFullNode(u.getNode(),n,null);else if(c.filtersNodes()&&!u.isFiltered()){var l=u.getNode().updateChild(e,n);s=c.updateFullNode(u.getNode(),l,null)}else{var h=e.getFront();if(!u.isCompleteForPath(e)&&e.getLength()>1)return t;var d=e.popFront(),p=u.getNode().getImmediateChild(h).updateChild(d,n);s=".priority"==h?c.updatePriority(u.getNode(),p):c.updateChild(u.getNode(),h,p,d,me,null)}var f=t.updateServerSnap(s,u.isFullyInitialized()||e.isEmpty(),c.filtersNodes()),g=new ye(r,f,i);return this.generateEventCacheAfterServerEvent_(f,e,r,g,a)},t.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var a,s,u=t.getEventCache(),c=new ye(r,t,i);if(e.isEmpty())s=this.filter_.updateFullNode(t.getEventCache().getNode(),n,o),a=t.updateEventSnap(s,!0,this.filter_.filtersNodes());else{var l=e.getFront();if(".priority"===l)s=this.filter_.updatePriority(t.getEventCache().getNode(),n),a=t.updateEventSnap(s,u.isFullyInitialized(),u.isFiltered());else{var h=e.popFront(),d=u.getNode().getImmediateChild(l),p=void 0;if(h.isEmpty())p=n;else{var f=c.getCompleteChild(l);p=null!=f?".priority"===h.getBack()&&f.getChild(h.parent()).isEmpty()?f:f.updateChild(h,n):Bt.EMPTY_NODE}if(d.equals(p))a=t;else{var g=this.filter_.updateChild(u.getNode(),l,p,h,c,o);a=t.updateEventSnap(g,u.isFullyInitialized(),this.filter_.filtersNodes())}}}return a},t.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},t.prototype.applyUserMerge_=function(e,n,r,i,o,a){var s=this,u=e;return r.foreach(function(r,c){var l=n.child(r);t.cacheHasChild_(e,l.getFront())&&(u=s.applyUserOverwrite_(u,l,c,i,o,a))}),r.foreach(function(r,c){var l=n.child(r);t.cacheHasChild_(e,l.getFront())||(u=s.applyUserOverwrite_(u,l,c,i,o,a))}),u},t.prototype.applyMerge_=function(t,e){return e.foreach(function(e,n){t=t.updateChild(e,n)}),t},t.prototype.applyServerMerge_=function(t,e,n,r,i,o,a){var s=this;if(t.getServerCache().getNode().isEmpty()&&!t.getServerCache().isFullyInitialized())return t;var u,c=t;u=e.isEmpty()?n:ce.Empty.setTree(e,n);var l=t.getServerCache().getNode();return u.children.inorderTraversal(function(e,n){if(l.hasChild(e)){var u=t.getServerCache().getNode().getImmediateChild(e),h=s.applyMerge_(u,n);c=s.applyServerOverwrite_(c,new W(e),h,r,i,o,a)}}),u.children.inorderTraversal(function(e,n){var u=!t.getServerCache().isCompleteForChild(e)&&null==n.value;if(!l.hasChild(e)&&!u){var h=t.getServerCache().getNode().getImmediateChild(e),d=s.applyMerge_(h,n);c=s.applyServerOverwrite_(c,new W(e),d,r,i,o,a)}}),c},t.prototype.ackUserWrite_=function(t,e,n,r,i,o){if(null!=r.shadowingWrite(e))return t;var a=t.getServerCache().isFiltered(),s=t.getServerCache();if(null!=n.value){if(e.isEmpty()&&s.isFullyInitialized()||s.isCompleteForPath(e))return this.applyServerOverwrite_(t,e,s.getNode().getChild(e),r,i,a,o);if(e.isEmpty()){var u=ce.Empty;return s.getNode().forEachChild(yt,function(t,e){u=u.set(new W(t),e)}),this.applyServerMerge_(t,e,u,r,i,a,o)}return t}var c=ce.Empty;return n.foreach(function(t,n){var r=e.child(t);s.isCompleteForPath(r)&&(c=c.set(t,s.getNode().getChild(r)))}),this.applyServerMerge_(t,e,c,r,i,a,o)},t.prototype.listenComplete_=function(t,e,n,r){var i=t.getServerCache(),o=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(o,e,n,me,r)},t.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var s=new ye(n,t,r),u=t.getEventCache().getNode(),c=void 0;if(e.isEmpty()||".priority"===e.getFront()){var l=void 0;if(t.getServerCache().isFullyInitialized())l=n.calcCompleteEventCache(t.getCompleteServerSnap());else{var h=t.getServerCache().getNode();a.assert(h instanceof Bt,"serverChildren would be complete if leaf node"),l=n.calcCompleteEventChildren(h)}l=l,c=this.filter_.updateFullNode(u,l,i)}else{var d=e.getFront(),p=n.calcCompleteChild(d,t.getServerCache());null==p&&t.getServerCache().isCompleteForChild(d)&&(p=u.getImmediateChild(d)),(c=null!=p?this.filter_.updateChild(u,d,p,e.popFront(),s,i):t.getEventCache().getNode().hasChild(d)?this.filter_.updateChild(u,d,Bt.EMPTY_NODE,e.popFront(),s,i):u).isEmpty()&&t.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(t.getCompleteServerSnap())).isLeafNode()&&(c=this.filter_.updateFullNode(c,o,i))}return o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(W.Empty),t.updateEventSnap(c,o,this.filter_.filtersNodes())},t}(),Ce=function(){function t(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}return t.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach(function(t){t.type===ge.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(ge.childMovedChange(t.childName,t.snapshotNode))}),this.generateEventsForType_(i,ge.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,ge.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,ge.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,ge.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,ge.VALUE,t,n,e),i},t.prototype.generateEventsForType_=function(t,e,n,r,i){var o=this,a=n.filter(function(t){return t.type===e});a.sort(this.compareChanges_.bind(this)),a.forEach(function(e){var n=o.materializeSingleChange_(e,i);r.forEach(function(r){r.respondsTo(e.type)&&t.push(r.createEvent(n,o.query_))})})},t.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type?t:(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_),t)},t.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw a.assertionError("Should only compare child_ events.");var n=new _t(t.childName,t.snapshotNode),r=new _t(e.childName,e.snapshotNode);return this.index_.compare(n,r)},t}(),Ee=function(){function t(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new _e(n.getIndex()),i=n.getNodeFilter();this.processor_=new we(i);var o=e.getServerCache(),a=e.getEventCache(),s=r.updateFullNode(Bt.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(Bt.EMPTY_NODE,a.getNode(),null),c=new pe(s,o.isFullyInitialized(),r.filtersNodes()),l=new pe(u,a.isFullyInitialized(),i.filtersNodes());this.viewCache_=new fe(l,c),this.eventGenerator_=new Ce(this.query_)}return t.prototype.getQuery=function(){return this.query_},t.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},t.prototype.getCompleteServerCache=function(t){var e=this.viewCache_.getCompleteServerSnap();return e&&(this.query_.getQueryParams().loadsAllData()||!t.isEmpty()&&!e.getImmediateChild(t.getFront()).isEmpty())?e.getChild(t):null},t.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},t.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},t.prototype.removeEventRegistration=function(t,e){var n=[];if(e){a.assert(null==t,"A cancel should cancel all event registrations.");var r=this.query_.path;this.eventRegistrations_.forEach(function(t){e=e;var i=t.createCancelEvent(e,r);i&&n.push(i)})}if(t){for(var i=[],o=0;o<this.eventRegistrations_.length;++o){var s=this.eventRegistrations_[o];if(s.matches(t)){if(t.hasAnyCallback()){i=i.concat(this.eventRegistrations_.slice(o+1));break}}else i.push(s)}this.eventRegistrations_=i}else this.eventRegistrations_=[];return n},t.prototype.applyOperation=function(t,e,n){t.type===Yt.MERGE&&null!==t.source.queryId&&(a.assert(this.viewCache_.getCompleteServerSnap(),"We should always have a full cache before handling merges"),a.assert(this.viewCache_.getCompleteEventSnap(),"Missing event cache, even though we have a server cache"));var r=this.viewCache_,i=this.processor_.applyOperation(r,t,e,n);return this.processor_.assertIndexed(i.viewCache),a.assert(i.viewCache.getServerCache().isFullyInitialized()||!r.getServerCache().isFullyInitialized(),"Once a server snap is complete, it should never go back"),this.viewCache_=i.viewCache,this.generateEventsForChanges_(i.changes,i.viewCache.getEventCache().getNode(),null)},t.prototype.getInitialEvents=function(t){var e=this.viewCache_.getEventCache(),n=[];e.getNode().isLeafNode()||e.getNode().forEachChild(Tt,function(t,e){n.push(ge.childAddedChange(t,e))});return e.isFullyInitialized()&&n.push(ge.valueChange(e.getNode())),this.generateEventsForChanges_(n,e.getNode(),t)},t.prototype.generateEventsForChanges_=function(t,e,n){var r=n?[n]:this.eventRegistrations_;return this.eventGenerator_.generateEventsForChanges(t,e,r)},t}(),xe=function(){function t(){this.views_={}}return Object.defineProperty(t,"__referenceConstructor",{get:function(){return a.assert(oe,"Reference.ts has not been loaded"),oe},set:function(t){a.assert(!oe,"__referenceConstructor has already been defined"),oe=t},enumerable:!0,configurable:!0}),t.prototype.isEmpty=function(){return a.isEmpty(this.views_)},t.prototype.applyOperation=function(t,e,n){var r=t.source.queryId;if(null!==r){var i=a.safeGet(this.views_,r);return a.assert(null!=i,"SyncTree gave us an op for an invalid query."),i.applyOperation(t,e,n)}var o=[];return a.forEach(this.views_,function(r,i){o=o.concat(i.applyOperation(t,e,n))}),o},t.prototype.addEventRegistration=function(t,e,n,r,i){var o=t.queryIdentifier(),s=a.safeGet(this.views_,o);if(!s){var u=n.calcCompleteEventCache(i?r:null),c=!1;u?c=!0:r instanceof Bt?(u=n.calcCompleteEventChildren(r),c=!1):(u=Bt.EMPTY_NODE,c=!1);var l=new fe(new pe(u,c,!1),new pe(r,i,!1));s=new Ee(t,l),this.views_[o]=s}return s.addEventRegistration(e),s.getInitialEvents(e)},t.prototype.removeEventRegistration=function(e,n,r){var i=e.queryIdentifier(),o=[],s=[],u=this.hasCompleteView();if("default"===i){var c=this;a.forEach(this.views_,function(t,e){s=s.concat(e.removeEventRegistration(n,r)),e.isEmpty()&&(delete c.views_[t],e.getQuery().getQueryParams().loadsAllData()||o.push(e.getQuery()))})}else{var l=a.safeGet(this.views_,i);l&&(s=s.concat(l.removeEventRegistration(n,r)),l.isEmpty()&&(delete this.views_[i],l.getQuery().getQueryParams().loadsAllData()||o.push(l.getQuery())))}return u&&!this.hasCompleteView()&&o.push(new t.__referenceConstructor(e.repo,e.path)),{removed:o,events:s}},t.prototype.getQueryViews=function(){var t=this;return Object.keys(this.views_).map(function(e){return t.views_[e]}).filter(function(t){return!t.getQuery().getQueryParams().loadsAllData()})},t.prototype.getCompleteServerCache=function(t){var e=null;return a.forEach(this.views_,function(n,r){e=e||r.getCompleteServerCache(t)}),e},t.prototype.viewForQuery=function(t){if(t.getQueryParams().loadsAllData())return this.getCompleteView();var e=t.queryIdentifier();return a.safeGet(this.views_,e)},t.prototype.viewExistsForQuery=function(t){return null!=this.viewForQuery(t)},t.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},t.prototype.getCompleteView=function(){return a.findValue(this.views_,function(t){return t.getQuery().getQueryParams().loadsAllData()})||null},t}(),Ae=function(){function t(t){this.writeTree_=t}return t.prototype.addWrite=function(e,n){if(e.isEmpty())return new t(new ce(n));var r=this.writeTree_.findRootMostValueAndPath(e);if(null!=r){var i=r.path,o=r.value,a=W.relativePath(i,e);return o=o.updateChild(a,n),new t(this.writeTree_.set(i,o))}var s=new ce(n);return new t(this.writeTree_.setTree(e,s))},t.prototype.addWrites=function(t,e){var n=this;return a.forEach(e,function(e,r){n=n.addWrite(t.child(e),r)}),n},t.prototype.removeWrite=function(e){return e.isEmpty()?t.Empty:new t(this.writeTree_.setTree(e,ce.Empty))},t.prototype.hasCompleteWrite=function(t){return null!=this.getCompleteNode(t)},t.prototype.getCompleteNode=function(t){var e=this.writeTree_.findRootMostValueAndPath(t);return null!=e?this.writeTree_.get(e.path).getChild(W.relativePath(e.path,t)):null},t.prototype.getCompleteChildren=function(){var t=[],e=this.writeTree_.value;return null!=e?e.isLeafNode()||e.forEachChild(Tt,function(e,n){t.push(new _t(e,n))}):this.writeTree_.children.inorderTraversal(function(e,n){null!=n.value&&t.push(new _t(e,n.value))}),t},t.prototype.childCompoundWrite=function(e){if(e.isEmpty())return this;var n=this.getCompleteNode(e);return new t(null!=n?new ce(n):this.writeTree_.subtree(e))},t.prototype.isEmpty=function(){return this.writeTree_.isEmpty()},t.prototype.apply=function(e){return t.applySubtreeWrite_(W.Empty,this.writeTree_,e)},t.Empty=new t(new ce(null)),t.applySubtreeWrite_=function(e,n,r){if(null!=n.value)return r.updateChild(e,n.value);var i=null;return n.children.inorderTraversal(function(n,o){".priority"===n?(a.assert(null!==o.value,"Priority writes must always be leaf nodes"),i=o.value):r=t.applySubtreeWrite_(e.child(n),o,r)}),r.getChild(e).isEmpty()||null===i||(r=r.updateChild(e.child(".priority"),i)),r},t}(),Se=function(){function t(){this.visibleWrites_=Ae.Empty,this.allWrites_=[],this.lastWriteId_=-1}return t.prototype.childWrites=function(t){return new ke(t,this)},t.prototype.addOverwrite=function(t,e,n,r){a.assert(n>this.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.allWrites_.push({path:t,snap:e,writeId:n,visible:r}),r&&(this.visibleWrites_=this.visibleWrites_.addWrite(t,e)),this.lastWriteId_=n},t.prototype.addMerge=function(t,e,n){a.assert(n>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:t,children:e,writeId:n,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(t,e),this.lastWriteId_=n},t.prototype.getWrite=function(t){for(var e=0;e<this.allWrites_.length;e++){var n=this.allWrites_[e];if(n.writeId===t)return n}return null},t.prototype.removeWrite=function(t){var e=this,n=this.allWrites_.findIndex(function(e){return e.writeId===t});a.assert(n>=0,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[n];this.allWrites_.splice(n,1);for(var i=r.visible,o=!1,s=this.allWrites_.length-1;i&&s>=0;){var u=this.allWrites_[s];u.visible&&(s>=n&&this.recordContainsPath_(u,r.path)?i=!1:r.path.contains(u.path)&&(o=!0)),s--}if(i){if(o)return this.resetTree_(),!0;if(r.snap)this.visibleWrites_=this.visibleWrites_.removeWrite(r.path);else{var c=r.children;a.forEach(c,function(t){e.visibleWrites_=e.visibleWrites_.removeWrite(r.path.child(t))})}return!0}return!1},t.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcCompleteEventCache=function(e,n,r,i){if(r||i){var o=this.visibleWrites_.childCompoundWrite(e);if(!i&&o.isEmpty())return n;if(i||null!=n||o.hasCompleteWrite(W.Empty)){var a=t.layerTree_(this.allWrites_,function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))},e);c=n||Bt.EMPTY_NODE;return a.apply(c)}return null}var s=this.visibleWrites_.getCompleteNode(e);if(null!=s)return s;var u=this.visibleWrites_.childCompoundWrite(e);if(u.isEmpty())return n;if(null!=n||u.hasCompleteWrite(W.Empty)){var c=n||Bt.EMPTY_NODE;return u.apply(c)}return null},t.prototype.calcCompleteEventChildren=function(t,e){var n=Bt.EMPTY_NODE,r=this.visibleWrites_.getCompleteNode(t);if(r)return r.isLeafNode()||r.forEachChild(Tt,function(t,e){n=n.updateImmediateChild(t,e)}),n;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(Tt,function(t,e){var r=i.childCompoundWrite(new W(t)).apply(e);n=n.updateImmediateChild(t,r)}),i.getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n}return this.visibleWrites_.childCompoundWrite(t).getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n},t.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){a.assert(n||r,"Either existingEventSnap or existingServerSnap must exist");var i=t.child(e);if(this.visibleWrites_.hasCompleteWrite(i))return null;var o=this.visibleWrites_.childCompoundWrite(i);return o.isEmpty()?r.getChild(e):o.apply(r.getChild(e))},t.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),i=this.visibleWrites_.getCompleteNode(r);return null!=i?i:n.isCompleteForChild(e)?this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e)):null},t.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var a,s=this.visibleWrites_.childCompoundWrite(t),u=s.getCompleteNode(W.Empty);if(null!=u)a=u;else{if(null==e)return[];a=s.apply(e)}if((a=a.withIndex(o)).isEmpty()||a.isLeafNode())return[];for(var c=[],l=o.getCompare(),h=i?a.getReverseIteratorFrom(n,o):a.getIteratorFrom(n,o),d=h.getNext();d&&c.length<r;)0!==l(d,n)&&c.push(d),d=h.getNext();return c},t.prototype.recordContainsPath_=function(t,e){return t.snap?t.path.contains(e):!!a.findKey(t.children,function(n,r){return t.path.child(r).contains(e)})},t.prototype.resetTree_=function(){this.visibleWrites_=t.layerTree_(this.allWrites_,t.DefaultFilter_,W.Empty),this.allWrites_.length>0?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},t.DefaultFilter_=function(t){return t.visible},t.layerTree_=function(t,e,n){for(var r=Ae.Empty,i=0;i<t.length;++i){var o=t[i];if(e(o)){var s=o.path,u=void 0;if(o.snap)n.contains(s)?(u=W.relativePath(n,s),r=r.addWrite(u,o.snap)):s.contains(n)&&(u=W.relativePath(s,n),r=r.addWrite(W.Empty,o.snap.getChild(u)));else{if(!o.children)throw a.assertionError("WriteRecord should have .snap or .children");if(n.contains(s))u=W.relativePath(n,s),r=r.addWrites(u,o.children);else if(s.contains(n))if((u=W.relativePath(s,n)).isEmpty())r=r.addWrites(W.Empty,o.children);else{var c=a.safeGet(o.children,u.getFront());if(c){var l=c.getChild(u.popFront());r=r.addWrite(W.Empty,l)}}}}}return r},t}(),ke=function(){function t(t,e){this.treePath_=t,this.writeTree_=e}return t.prototype.calcCompleteEventCache=function(t,e,n){return this.writeTree_.calcCompleteEventCache(this.treePath_,t,e,n)},t.prototype.calcCompleteEventChildren=function(t){return this.writeTree_.calcCompleteEventChildren(this.treePath_,t)},t.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n){return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_,t,e,n)},t.prototype.shadowingWrite=function(t){return this.writeTree_.shadowingWrite(this.treePath_.child(t))},t.prototype.calcIndexedSlice=function(t,e,n,r,i){return this.writeTree_.calcIndexedSlice(this.treePath_,t,e,n,r,i)},t.prototype.calcCompleteChild=function(t,e){return this.writeTree_.calcCompleteChild(this.treePath_,t,e)},t.prototype.child=function(e){return new t(this.treePath_.child(e),this.writeTree_)},t}(),Te=function(){function t(t){this.listenProvider_=t,this.syncPointTree_=ce.Empty,this.pendingWriteTree_=new Se,this.tagToQueryMap_={},this.queryToTagMap_={}}return t.prototype.applyUserOverwrite=function(t,e,n,r){return this.pendingWriteTree_.addOverwrite(t,e,n,r),r?this.applyOperationToSyncPoints_(new he(ae.User,t,e)):[]},t.prototype.applyUserMerge=function(t,e,n){this.pendingWriteTree_.addMerge(t,e,n);var r=ce.fromObject(e);return this.applyOperationToSyncPoints_(new de(ae.User,t,r))},t.prototype.ackUserWrite=function(t,e){void 0===e&&(e=!1);var n=this.pendingWriteTree_.getWrite(t);if(this.pendingWriteTree_.removeWrite(t)){var r=ce.Empty;return null!=n.snap?r=r.set(W.Empty,!0):a.forEach(n.children,function(t,e){r=r.set(new W(t),e)}),this.applyOperationToSyncPoints_(new se(n.path,r,e))}return[]},t.prototype.applyServerOverwrite=function(t,e){return this.applyOperationToSyncPoints_(new he(ae.Server,t,e))},t.prototype.applyServerMerge=function(t,e){var n=ce.fromObject(e);return this.applyOperationToSyncPoints_(new de(ae.Server,t,n))},t.prototype.applyListenComplete=function(t){return this.applyOperationToSyncPoints_(new le(ae.Server,t))},t.prototype.applyTaggedQueryOverwrite=function(e,n,r){var i=this.queryKeyForTag_(r);if(null!=i){var o=t.parseQueryKey_(i),a=o.path,s=o.queryId,u=W.relativePath(a,e),c=new he(ae.forServerTaggedQuery(s),u,n);return this.applyTaggedOperation_(a,c)}return[]},t.prototype.applyTaggedQueryMerge=function(e,n,r){var i=this.queryKeyForTag_(r);if(i){var o=t.parseQueryKey_(i),a=o.path,s=o.queryId,u=W.relativePath(a,e),c=ce.fromObject(n),l=new de(ae.forServerTaggedQuery(s),u,c);return this.applyTaggedOperation_(a,l)}return[]},t.prototype.applyTaggedListenComplete=function(e,n){var r=this.queryKeyForTag_(n);if(r){var i=t.parseQueryKey_(r),o=i.path,a=i.queryId,s=W.relativePath(o,e),u=new le(ae.forServerTaggedQuery(a),s);return this.applyTaggedOperation_(o,u)}return[]},t.prototype.addEventRegistration=function(e,n){var r=e.path,i=null,o=!1;this.syncPointTree_.foreachOnPath(r,function(t,e){var n=W.relativePath(t,r);i=i||e.getCompleteServerCache(n),o=o||e.hasCompleteView()});var s,u=this.syncPointTree_.get(r);(u?(o=o||u.hasCompleteView(),i=i||u.getCompleteServerCache(W.Empty)):(u=new xe,this.syncPointTree_=this.syncPointTree_.set(r,u)),null!=i)?s=!0:(s=!1,i=Bt.EMPTY_NODE,this.syncPointTree_.subtree(r).foreachChild(function(t,e){var n=e.getCompleteServerCache(W.Empty);n&&(i=i.updateImmediateChild(t,n))}));var c=u.viewExistsForQuery(e);if(!c&&!e.getQueryParams().loadsAllData()){var l=t.makeQueryKey_(e);a.assert(!(l in this.queryToTagMap_),"View does not exist, but we have a tag");var h=t.getNextQueryTag_();this.queryToTagMap_[l]=h,this.tagToQueryMap_["_"+h]=l}var d=this.pendingWriteTree_.childWrites(r),p=u.addEventRegistration(e,n,d,i,s);if(!c&&!o){var f=u.viewForQuery(e);p=p.concat(this.setupListener_(e,f))}return p},t.prototype.removeEventRegistration=function(e,n,r){var i=this,o=e.path,a=this.syncPointTree_.get(o),s=[];if(a&&("default"===e.queryIdentifier()||a.viewExistsForQuery(e))){var u=a.removeEventRegistration(e,n,r);a.isEmpty()&&(this.syncPointTree_=this.syncPointTree_.remove(o));var c=u.removed;s=u.events;var l=-1!==c.findIndex(function(t){return t.getQueryParams().loadsAllData()}),h=this.syncPointTree_.findOnPath(o,function(t,e){return e.hasCompleteView()});if(l&&!h){var d=this.syncPointTree_.subtree(o);if(!d.isEmpty())for(var p=this.collectDistinctViewsForSubTree_(d),f=0;f<p.length;++f){var g=p[f],_=g.getQuery(),v=this.createListenerForView_(g);this.listenProvider_.startListening(t.queryForListening_(_),this.tagForQuery_(_),v.hashFn,v.onComplete)}}if(!h&&c.length>0&&!r)if(l){this.listenProvider_.stopListening(t.queryForListening_(e),null)}else c.forEach(function(e){var n=i.queryToTagMap_[t.makeQueryKey_(e)];i.listenProvider_.stopListening(t.queryForListening_(e),n)});this.removeTags_(c)}return s},t.prototype.calcCompleteEventCache=function(t,e){var n=this.pendingWriteTree_,r=this.syncPointTree_.findOnPath(t,function(e,n){var r=W.relativePath(e,t),i=n.getCompleteServerCache(r);if(i)return i});return n.calcCompleteEventCache(t,r,e,!0)},t.prototype.collectDistinctViewsForSubTree_=function(t){return t.fold(function(t,e,n){if(e&&e.hasCompleteView())return[e.getCompleteView()];var r=[];return e&&(r=e.getQueryViews()),a.forEach(n,function(t,e){r=r.concat(e)}),r})},t.prototype.removeTags_=function(e){for(var n=0;n<e.length;++n){var r=e[n];if(!r.getQueryParams().loadsAllData()){var i=t.makeQueryKey_(r),o=this.queryToTagMap_[i];delete this.queryToTagMap_[i],delete this.tagToQueryMap_["_"+o]}}},t.queryForListening_=function(t){return t.getQueryParams().loadsAllData()&&!t.getQueryParams().isDefault()?t.getRef():t},t.prototype.setupListener_=function(e,n){var r=e.path,i=this.tagForQuery_(e),o=this.createListenerForView_(n),s=this.listenProvider_.startListening(t.queryForListening_(e),i,o.hashFn,o.onComplete),u=this.syncPointTree_.subtree(r);if(i)a.assert(!u.value.hasCompleteView(),"If we're adding a query, it shouldn't be shadowed");else for(var c=u.fold(function(t,e,n){if(!t.isEmpty()&&e&&e.hasCompleteView())return[e.getCompleteView().getQuery()];var r=[];return e&&(r=r.concat(e.getQueryViews().map(function(t){return t.getQuery()}))),a.forEach(n,function(t,e){r=r.concat(e)}),r}),l=0;l<c.length;++l){var h=c[l];this.listenProvider_.stopListening(t.queryForListening_(h),this.tagForQuery_(h))}return s},t.prototype.createListenerForView_=function(t){var e=this,n=t.getQuery(),r=this.tagForQuery_(n);return{hashFn:function(){return(t.getServerCache()||Bt.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return r?e.applyTaggedListenComplete(n.path,r):e.applyListenComplete(n.path);var i=function(t,e){var n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"==t?n="Client doesn't have permission to access the desired data.":"unavailable"==t&&(n="The service is unavailable");var r=new Error(t+" at "+e.path.toString()+": "+n);return r.code=t.toUpperCase(),r}(t,n);return e.removeEventRegistration(n,null,i)}}},t.makeQueryKey_=function(t){return t.path.toString()+"$"+t.queryIdentifier()},t.parseQueryKey_=function(t){var e=t.indexOf("$");return a.assert(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new W(t.substr(0,e))}},t.prototype.queryKeyForTag_=function(t){return this.tagToQueryMap_["_"+t]},t.prototype.tagForQuery_=function(e){var n=t.makeQueryKey_(e);return a.safeGet(this.queryToTagMap_,n)},t.getNextQueryTag_=function(){return t.nextQueryTag_++},t.prototype.applyTaggedOperation_=function(t,e){var n=this.syncPointTree_.get(t);a.assert(n,"Missing sync point for query tag that we're tracking");var r=this.pendingWriteTree_.childWrites(t);return n.applyOperation(e,r,null)},t.prototype.applyOperationToSyncPoints_=function(t){return this.applyOperationHelper_(t,this.syncPointTree_,null,this.pendingWriteTree_.childWrites(W.Empty))},t.prototype.applyOperationHelper_=function(t,e,n,r){if(t.path.isEmpty())return this.applyOperationDescendantsHelper_(t,e,n,r);var i=e.get(W.Empty);null==n&&null!=i&&(n=i.getCompleteServerCache(W.Empty));var o=[],a=t.path.getFront(),s=t.operationForChild(a),u=e.children.get(a);if(u&&s){var c=n?n.getImmediateChild(a):null,l=r.child(a);o=o.concat(this.applyOperationHelper_(s,u,c,l))}return i&&(o=o.concat(i.applyOperation(t,r,n))),o},t.prototype.applyOperationDescendantsHelper_=function(t,e,n,r){var i=this,o=e.get(W.Empty);null==n&&null!=o&&(n=o.getCompleteServerCache(W.Empty));var a=[];return e.children.inorderTraversal(function(e,o){var s=n?n.getImmediateChild(e):null,u=r.child(e),c=t.operationForChild(e);c&&(a=a.concat(i.applyOperationDescendantsHelper_(c,o,s,u)))}),o&&(a=a.concat(o.applyOperation(t,r,n))),a},t.nextQueryTag_=1,t}(),Pe=function(){function t(){this.rootNode_=Bt.EMPTY_NODE}return t.prototype.getNode=function(t){return this.rootNode_.getChild(t)},t.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},t}(),Ie=function(){function t(t){this.app_=t}return t.prototype.getToken=function(t){return this.app_.INTERNAL.getToken(t).then(null,function(t){return t&&"auth/token-not-initialized"===t.code?(C("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(t)})},t.prototype.addTokenChangeListener=function(t){this.app_.INTERNAL.addAuthTokenListener(t)},t.prototype.removeTokenChangeListener=function(t){this.app_.INTERNAL.removeAuthTokenListener(t)},t.prototype.notifyForInvalidToken=function(){var t='Provided authentication credentials for the app named "'+this.app_.name+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.app_.options?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.app_.options?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',S(t)},t}(),Oe=function(){function t(){this.counters_={}}return t.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),a.contains(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},t.prototype.get=function(){return a.deepCopy(this.counters_)},t}(),Ne=function(){function t(){}return t.getCollection=function(t){var e=t.toString();return this.collections_[e]||(this.collections_[e]=new Oe),this.collections_[e]},t.getOrCreateReporter=function(t,e){var n=t.toString();return this.reporters_[n]||(this.reporters_[n]=e()),this.reporters_[n]},t.collections_={},t.reporters_={},t}(),Re=function(){function t(t){this.collection_=t,this.last_=null}return t.prototype.get=function(){var t=this.collection_.get(),e=a.clone(t);return this.last_&&a.forEach(this.last_,function(t,n){e[t]=e[t]-n}),this.last_=t,e},t}(),De=1e4,Me=3e4,Le=function(){function t(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Re(t);var n=De+(Me-De)*Math.random();V(this.reportStats_.bind(this),Math.floor(n))}return t.prototype.includeStat=function(t){this.statsToReport_[t]=!0},t.prototype.reportStats_=function(){var t=this,e=this.statsListener_.get(),n={},r=!1;a.forEach(e,function(e,i){i>0&&a.contains(t.statsToReport_,e)&&(n[e]=i,r=!0)}),r&&this.server_.reportStats(n),V(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},t}(),je=function(){function t(){this.eventLists_=[],this.recursionDepth_=0}return t.prototype.queueEvents=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n],i=r.getPath();null===e||i.equals(e.getPath())||(this.eventLists_.push(e),e=null),null===e&&(e=new Ue(i)),e.add(r)}e&&this.eventLists_.push(e)},t.prototype.raiseEventsAtPath=function(t,e){this.queueEvents(e),this.raiseQueuedEventsMatchingPredicate_(function(e){return e.equals(t)})},t.prototype.raiseEventsForChangedPath=function(t,e){this.queueEvents(e),this.raiseQueuedEventsMatchingPredicate_(function(e){return e.contains(t)||t.contains(e)})},t.prototype.raiseQueuedEventsMatchingPredicate_=function(t){this.recursionDepth_++;for(var e=!0,n=0;n<this.eventLists_.length;n++){var r=this.eventLists_[n];if(r)t(r.getPath())?(this.eventLists_[n].raise(),this.eventLists_[n]=null):e=!1}e&&(this.eventLists_=[]),this.recursionDepth_--},t}(),Ue=function(){function t(t){this.path_=t,this.events_=[]}return t.prototype.add=function(t){this.events_.push(t)},t.prototype.raise=function(){for(var t=0;t<this.events_.length;t++){var e=this.events_[t];if(null!==e){this.events_[t]=null;var n=e.getEventRunner();y&&C("event: "+e.toString()),F(n)}}},t.prototype.getPath=function(){return this.path_},t}(),Fe=function(){function t(t){this.allowedEvents_=t,this.listeners_={},a.assert(Array.isArray(t)&&t.length>0,"Requires a non-empty array")}return t.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(Array.isArray(this.listeners_[t]))for(var r=this.listeners_[t].slice(),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,e)},t.prototype.on=function(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});var r=this.getInitialEvent(t);r&&e.apply(n,r)},t.prototype.off=function(t,e,n){this.validateEventType_(t);for(var r=this.listeners_[t]||[],i=0;i<r.length;i++)if(r[i].callback===e&&(!n||n===r[i].context))return void r.splice(i,1)},t.prototype.validateEventType_=function(t){a.assert(this.allowedEvents_.find(function(e){return e===t}),"Unknown event: "+t)},t}(),Be=function(t){function e(){var e,n,r=t.call(this,["visible"])||this;return"undefined"!=typeof document&&void 0!==document.addEventListener&&(void 0!==document.hidden?(n="visibilitychange",e="hidden"):void 0!==document.mozHidden?(n="mozvisibilitychange",e="mozHidden"):void 0!==document.msHidden?(n="msvisibilitychange",e="msHidden"):void 0!==document.webkitHidden&&(n="webkitvisibilitychange",e="webkitHidden")),r.visible_=!0,n&&document.addEventListener(n,function(){var t=!document[e];t!==r.visible_&&(r.visible_=t,r.trigger("visible",t))},!1),r}return u.__extends(e,t),e.getInstance=function(){return new e},e.prototype.getInitialEvent=function(t){return a.assert("visible"===t,"Unknown event type: "+t),[this.visible_]},e}(Fe),Ve=function(t){function e(){var e=t.call(this,["online"])||this;return e.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||a.isMobileCordova()||(window.addEventListener("online",function(){e.online_||(e.online_=!0,e.trigger("online",!0))},!1),window.addEventListener("offline",function(){e.online_&&(e.online_=!1,e.trigger("online",!1))},!1)),e}return u.__extends(e,t),e.getInstance=function(){return new e},e.prototype.getInitialEvent=function(t){return a.assert("online"===t,"Unknown event type: "+t),[this.online_]},e.prototype.currentlyOnline=function(){return this.online_},e}(Fe),We=function(){function t(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}return t.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},t.prototype.handleResponse=function(t,e){var n=this;this.pendingResponses[t]=e;for(var r=function(){var t=i.pendingResponses[i.currentResponseNum];delete i.pendingResponses[i.currentResponseNum];for(var e=function(e){t[e]&&F(function(){n.onMessage_(t[e])})},r=0;r<t.length;++r)e(r);if(i.currentResponseNum===i.closeAfterResponse)return i.onClose&&(i.onClose(),i.onClose=null),"break";i.currentResponseNum++},i=this;this.pendingResponses[this.currentResponseNum];){if("break"===r())break}},t}(),Ge="pLPCommand",He="pRTLPCB",Ye=function(){function t(t,e,n,r){this.connId=t,this.repoInfo=e,this.transportSessionId=n,this.lastSessionId=r,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=E(t),this.stats_=Ne.getCollection(e),this.urlFn=function(t){return e.connectionURL(H,t)}}return t.prototype.open=function(t,e){var n=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new We(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(function(){n.log_("Timed out trying to connect."),n.onClosed_(),n.connectTimeoutTimer_=null},Math.floor(3e4)),function(t){if(a.isNodeSdk()||"complete"===document.readyState)t();else{var e=!1,n=function(){document.body?e||(e=!0,t()):setTimeout(n,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&n()}),window.attachEvent("onload",n))}}(function(){if(!n.isClosed_){n.scriptTagHolder=new ze(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[0],i=t[1],o=t[2];if(n.incrementIncomingBytes_(t),n.scriptTagHolder)if(n.connectTimeoutTimer_&&(clearTimeout(n.connectTimeoutTimer_),n.connectTimeoutTimer_=null),n.everConnected_=!0,"start"==r)n.id=i,n.password=o;else{if("close"!==r)throw new Error("Unrecognized command received: "+r);i?(n.scriptTagHolder.sendNewPolls=!1,n.myPacketOrderer.closeAfter(i,function(){n.onClosed_()})):n.onClosed_()}},function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[0],i=t[1];n.incrementIncomingBytes_(t),n.myPacketOrderer.handleResponse(r,i)},function(){n.onClosed_()},n.urlFn);var t={start:"t"};t.ser=Math.floor(1e8*Math.random()),n.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=n.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",n.transportSessionId&&(t.s=n.transportSessionId),n.lastSessionId&&(t.ls=n.lastSessionId),!a.isNodeSdk()&&"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(t.r="f");var e=n.urlFn(t);n.log_("Connecting via long-poll to "+e),n.scriptTagHolder.addTag(e,function(){})}})},t.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},t.forceAllow=function(){t.forceAllow_=!0},t.forceDisallow=function(){t.forceDisallow_=!0},t.isAvailable=function(){return t.forceAllow_||!t.forceDisallow_&&"undefined"!=typeof document&&null!=document.createElement&&!("object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&!("object"==typeof Windows&&"object"==typeof Windows.UI)&&!a.isNodeSdk()},t.prototype.markConnectionHealthy=function(){},t.prototype.shutdown_=function(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)},t.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},t.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},t.prototype.send=function(t){var e=a.stringify(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);for(var n=a.base64Encode(e),r=D(n,1840),i=0;i<r.length;i++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,r.length,r[i]),this.curSegmentNum++},t.prototype.addDisconnectPingFrame=function(t,e){if(!a.isNodeSdk()){this.myDisconnFrame=document.createElement("iframe");var n={dframe:"t"};n.id=t,n.pw=e,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}},t.prototype.incrementIncomingBytes_=function(t){var e=a.stringify(t).length;this.bytesReceived+=e,this.stats_.incrementCounter("bytes_received",e)},t}(),ze=function(){function t(e,n,r,i){if(this.onDisconnect=r,this.urlFn=i,this.outstandingRequests=new te,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,a.isNodeSdk())this.commandCB=e,this.onMessageCB=n;else{this.uniqueCallbackIdentifier=_(),window[Ge+this.uniqueCallbackIdentifier]=e,window[He+this.uniqueCallbackIdentifier]=n,this.myIFrame=t.createIFrame_();var o="";if(this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length))o='<script>document.domain="'+document.domain+'";<\/script>';var s="<html><body>"+o+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(s),this.myIFrame.doc.close()}catch(t){C("frame writing exception"),t.stack&&C(t.stack),C(t)}}}return t.createIFrame_=function(){var t=document.createElement("iframe");if(t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{t.contentWindow.document||C("No IE domain setting required")}catch(n){var e=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+e+"';document.close();})())"}return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t},t.prototype.close=function(){var e=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==e.myIFrame&&(document.body.removeChild(e.myIFrame),e.myIFrame=null)},Math.floor(0))),a.isNodeSdk()&&this.myID){var n={disconn:"t"};n.id=this.myID,n.pw=this.myPW;var r=this.urlFn(n);t.nodeRestRequest(r)}var i=this.onDisconnect;i&&(this.onDisconnect=null,i())},t.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},t.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;for(var e=this.urlFn(t),n="",r=0;this.pendingSegs.length>0;){if(!(this.pendingSegs[0].d.length+30+n.length<=1870))break;var i=this.pendingSegs.shift();n=n+"&seg"+r+"="+i.seg+"&ts"+r+"="+i.ts+"&d"+r+"="+i.d,r++}return e+=n,this.addLongPollTag_(e,this.currentSerial),!0}return!1},t.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},t.prototype.addLongPollTag_=function(t,e){var n=this;this.outstandingRequests.add(e,1);var r=function(){n.outstandingRequests.remove(e),n.newRequest_()},i=setTimeout(r,Math.floor(25e3));this.addTag(t,function(){clearTimeout(i),r()})},t.prototype.addTag=function(t,e){var n=this;a.isNodeSdk()?this.doNodeLongPoll(t,e):setTimeout(function(){try{if(!n.sendNewPolls)return;var r=n.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=t,r.onload=r.onreadystatechange=function(){var t=r.readyState;t&&"loaded"!==t&&"complete"!==t||(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),e())},r.onerror=function(){C("Long-poll script failed to load: "+t),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(r)}catch(t){}},Math.floor(1))},t}(),qe=null;"undefined"!=typeof MozWebSocket?qe=MozWebSocket:"undefined"!=typeof WebSocket&&(qe=WebSocket);var Xe=function(){function t(e,n,r,i){this.connId=e,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=E(this.connId),this.stats_=Ne.getCollection(n),this.connURL=t.connectionURL_(n,r,i)}return t.connectionURL_=function(t,e,n){var r={v:"5"};return!a.isNodeSdk()&&"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),t.connectionURL("websocket",r)},t.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,p.set("previous_websocket_failure",!0);try{if(a.isNodeSdk()){var i=a.CONSTANTS.NODE_ADMIN?"AdminNode":"Node",o={headers:{"User-Agent":"Firebase/5/"+c.SDK_VERSION+"/"+r.platform+"/"+i}},s=r.env,u=0==this.connURL.indexOf("wss://")?s.HTTPS_PROXY||s.https_proxy:s.HTTP_PROXY||s.http_proxy;u&&(o.proxy={origin:u}),this.mySock=new qe(this.connURL,[],o)}else this.mySock=new qe(this.connURL)}catch(t){this.log_("Error instantiating WebSocket.");var l=t.message||t.data;return l&&this.log_(l),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(t){n.handleIncomingFrame(t)},this.mySock.onerror=function(t){n.log_("WebSocket error.  Closing connection.");var e=t.message||t.data;e&&n.log_(e),n.onClosed_()}},t.prototype.start=function(){},t.forceDisallow=function(){t.forceDisallow_=!0},t.isAvailable=function(){var e=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var n=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);n&&n.length>1&&parseFloat(n[1])<4.4&&(e=!0)}return!e&&null!==qe&&!t.forceDisallow_},t.previouslyFailed=function(){return p.isInMemoryStorage||!0===p.get("previous_websocket_failure")},t.prototype.markConnectionHealthy=function(){p.remove("previous_websocket_failure")},t.prototype.appendFrame_=function(t){if(this.frames.push(t),this.frames.length==this.totalFrames){var e=this.frames.join("");this.frames=null;var n=a.jsonEval(e);this.onMessage(n)}},t.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},t.prototype.extractFrameCount_=function(t){if(a.assert(null===this.frames,"We already have a frame buffer"),t.length<=6){var e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t},t.prototype.handleIncomingFrame=function(t){if(null!==this.mySock){var e=t.data;if(this.bytesReceived+=e.length,this.stats_.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(e);else{var n=this.extractFrameCount_(e);null!==n&&this.appendFrame_(n)}}},t.prototype.send=function(t){this.resetKeepAlive();var e=a.stringify(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);var n=D(e,16384);n.length>1&&this.sendString_(String(n.length));for(var r=0;r<n.length;r++)this.sendString_(n[r])},t.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},t.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},t.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},t.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},t.prototype.sendString_=function(t){try{this.mySock.send(t)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}},t.responsesRequiredToBeHealthy=2,t.healthyTimeout=3e4,t}(),Qe=function(){function t(t){this.initTransports_(t)}return Object.defineProperty(t,"ALL_TRANSPORTS",{get:function(){return[Ye,Xe]},enumerable:!0,configurable:!0}),t.prototype.initTransports_=function(e){var n=Xe&&Xe.isAvailable(),r=n&&!Xe.previouslyFailed();if(e.webSocketOnly&&(n||S("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),r=!0),r)this.transports_=[Xe];else{var i=this.transports_=[];M(t.ALL_TRANSPORTS,function(t,e){e&&e.isAvailable()&&i.push(e)})}},t.prototype.initialTransport=function(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")},t.prototype.upgradeTransport=function(){return this.transports_.length>1?this.transports_[1]:null},t}(),Ke=function(){function t(t,e,n,r,i,o,a){this.id=t,this.repoInfo_=e,this.onMessage_=n,this.onReady_=r,this.onDisconnect_=i,this.onKill_=o,this.lastSessionId=a,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=E("c:"+this.id+":"),this.transportManager_=new Qe(e),this.log_("Connection created"),this.start_()}return t.prototype.start_=function(){var t=this,e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,void 0,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(function(){t.conn_&&t.conn_.open(n,r)},Math.floor(0));var i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=V(function(){t.healthyTimeout_=null,t.isHealthy_||(t.conn_&&t.conn_.bytesReceived>102400?(t.log_("Connection exceeded healthy timeout but has received "+t.conn_.bytesReceived+" bytes.  Marking connection healthy."),t.isHealthy_=!0,t.conn_.markConnectionHealthy()):t.conn_&&t.conn_.bytesSent>10240?t.log_("Connection exceeded healthy timeout but has sent "+t.conn_.bytesSent+" bytes.  Leaving connection alive."):(t.log_("Closing unhealthy connection after timeout."),t.close()))},Math.floor(i)))},t.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},t.prototype.disconnReceiver_=function(t){var e=this;return function(n){t===e.conn_?e.onConnectionLost_(n):t===e.secondaryConn_?(e.log_("Secondary connection lost."),e.onSecondaryConnectionLost_()):e.log_("closing an old connection")}},t.prototype.connReceiver_=function(t){var e=this;return function(n){2!=e.state_&&(t===e.rx_?e.onPrimaryMessageReceived_(n):t===e.secondaryConn_?e.onSecondaryMessageReceived_(n):e.log_("message on old connection"))}},t.prototype.sendRequest=function(t){var e={t:"d",d:t};this.sendData_(e)},t.prototype.tryCleanupConnection=function(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)},t.prototype.onSecondaryControl_=function(t){if("t"in t){var e=t.t;"a"===e?this.upgradeIfSecondaryHealthy_():"r"===e?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===e&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},t.prototype.onSecondaryMessageReceived_=function(t){var e=N("t",t),n=N("d",t);if("c"==e)this.onSecondaryControl_(n);else{if("d"!=e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}},t.prototype.upgradeIfSecondaryHealthy_=function(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:"p",d:{}}}))},t.prototype.proceedWithUpgrade_=function(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()},t.prototype.onPrimaryMessageReceived_=function(t){var e=N("t",t),n=N("d",t);"c"==e?this.onControl_(n):"d"==e&&this.onDataMessage_(n)},t.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},t.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},t.prototype.onControl_=function(t){var e=N("t",t);if("d"in t){var n=t.d;if("h"===e)this.onHandshake_(n);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var r=0;r<this.pendingDataMessages.length;++r)this.onDataMessage_(this.pendingDataMessages[r]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(n):"r"===e?this.onReset_(n):"e"===e?x("Server Error: "+n):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):x("Unknown control packet command: "+e)}},t.prototype.onHandshake_=function(t){var e=t.ts,n=t.v,r=t.h;this.sessionId=t.s,this.repoInfo_.updateHost(r),0==this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),"5"!==n&&S("Protocol version mismatch detected"),this.tryStartUpgrade_())},t.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},t.prototype.startUpgrade_=function(t){var e=this;this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.secondaryConn_),r=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,r),V(function(){e.secondaryConn_&&(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())},Math.floor(6e4))},t.prototype.onReset_=function(t){this.log_("Reset packet received.  New host: "+t),this.repoInfo_.updateHost(t),1===this.state_?this.close():(this.closeConnections_(),this.start_())},t.prototype.onConnectionEstablished_=function(t,e){var n=this;this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(e,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):V(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))},t.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},t.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},t.prototype.onConnectionLost_=function(t){this.conn_=null,t||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(p.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},t.prototype.onConnectionShutdown_=function(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()},t.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},t.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},t.prototype.closeConnections_=function(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)},t}(),Ze=function(){function t(){}return t.prototype.put=function(t,e,n,r){},t.prototype.merge=function(t,e,n,r){},t.prototype.refreshAuthToken=function(t){},t.prototype.onDisconnectPut=function(t,e,n){},t.prototype.onDisconnectMerge=function(t,e,n){},t.prototype.onDisconnectCancel=function(t,e){},t.prototype.reportStats=function(t){},t}(),Je=1e3,$e=3e5,tn=function(t){function e(n,r,i,o,s,u){var c=t.call(this)||this;if(c.repoInfo_=n,c.onDataUpdate_=r,c.onConnectStatus_=i,c.onServerInfoUpdate_=o,c.authTokenProvider_=s,c.authOverride_=u,c.id=e.nextPersistentConnectionId_++,c.log_=E("p:"+c.id+":"),c.interruptReasons_={},c.listens_={},c.outstandingPuts_=[],c.outstandingPutCount_=0,c.onDisconnectRequestQueue_=[],c.connected_=!1,c.reconnectDelay_=Je,c.maxReconnectDelay_=$e,c.securityDebugCallback_=null,c.lastSessionId=null,c.establishConnectionTimer_=null,c.visible_=!1,c.requestCBHash_={},c.requestNumber_=0,c.realtime_=null,c.authToken_=null,c.forceTokenRefresh_=!1,c.invalidAuthTokenCount_=0,c.firstConnection_=!0,c.lastConnectionAttemptTime_=null,c.lastConnectionEstablishedTime_=null,u&&!a.isNodeSdk())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return c.scheduleConnect_(0),Be.getInstance().on("visible",c.onVisible_,c),-1===n.host.indexOf("fblocal")&&Ve.getInstance().on("online",c.onOnline_,c),c}return u.__extends(e,t),e.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,i={r:r,a:t,b:e};this.log_(a.stringify(i)),a.assert(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[r]=n)},e.prototype.listen=function(t,e,n,r){var i=t.queryIdentifier(),o=t.path.toString();this.log_("Listen called for "+o+" "+i),this.listens_[o]=this.listens_[o]||{},a.assert(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),a.assert(!this.listens_[o][i],"listen() called twice for same path/queryId.");var s={onComplete:r,hashFn:e,query:t,tag:n};this.listens_[o][i]=s,this.connected_&&this.sendListen_(s)},e.prototype.sendListen_=function(t){var n=this,r=t.query,i=r.path.toString(),o=r.queryIdentifier();this.log_("Listen on "+i+" for "+o);var a={p:i};t.tag&&(a.q=r.queryObject(),a.t=t.tag),a.h=t.hashFn(),this.sendRequest("q",a,function(a){var s=a.d,u=a.s;e.warnOnListenWarnings_(s,r),(n.listens_[i]&&n.listens_[i][o])===t&&(n.log_("listen response",a),"ok"!==u&&n.removeListen_(i,o),t.onComplete&&t.onComplete(u,s))})},e.warnOnListenWarnings_=function(t,e){if(t&&"object"==typeof t&&a.contains(t,"w")){var n=a.safeGet(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){var r='".indexOn": "'+e.getQueryParams().getIndex().toString()+'"',i=e.path.toString();S("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+r+" at "+i+" to your security rules for better performance.")}}},e.prototype.refreshAuthToken=function(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},function(){}),this.reduceReconnectDelayIfAdminCredential_(t)},e.prototype.reduceReconnectDelayIfAdminCredential_=function(t){(t&&40===t.length||a.isAdmin(t))&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},e.prototype.tryAuth=function(){var t=this;if(this.connected_&&this.authToken_){var e=this.authToken_,n=a.isValidFormat(e)?"auth":"gauth",r={cred:e};null===this.authOverride_?r.noauth=!0:"object"==typeof this.authOverride_&&(r.authvar=this.authOverride_),this.sendRequest(n,r,function(n){var r=n.s,i=n.d||"error";t.authToken_===e&&("ok"===r?t.invalidAuthTokenCount_=0:t.onAuthRevoked_(r,i))})}},e.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),a.assert(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,t.queryObject(),e)},e.prototype.sendUnlisten_=function(t,e,n,r){this.log_("Unlisten on "+t+" for "+e);var i={p:t};r&&(i.q=n,i.t=r),this.sendRequest("n",i)},e.prototype.onDisconnectPut=function(t,e,n){this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})},e.prototype.onDisconnectMerge=function(t,e,n){this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})},e.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},e.prototype.sendOnDisconnect_=function(t,e,n,r){var i={p:e,d:n};this.log_("onDisconnect "+t,i),this.sendRequest(t,i,function(t){r&&setTimeout(function(){r(t.s,t.d)},Math.floor(0))})},e.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},e.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},e.prototype.putInternal=function(t,e,n,r,i){var o={p:e,d:n};void 0!==i&&(o.h=i),this.outstandingPuts_.push({action:t,request:o,onComplete:r}),this.outstandingPutCount_++;var a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+e)},e.prototype.sendPut_=function(t){var e=this,n=this.outstandingPuts_[t].action,r=this.outstandingPuts_[t].request,i=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(n,r,function(r){e.log_(n+" response",r),delete e.outstandingPuts_[t],e.outstandingPutCount_--,0===e.outstandingPutCount_&&(e.outstandingPuts_=[]),i&&i(r.s,r.d)})},e.prototype.reportStats=function(t){var e=this;if(this.connected_){var n={c:t};this.log_("reportStats",n),this.sendRequest("s",n,function(t){if("ok"!==t.s){var n=t.d;e.log_("reportStats","Error sending stats: "+n)}})}},e.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+a.stringify(t));var e=t.r,n=this.requestCBHash_[e];n&&(delete this.requestCBHash_[e],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}},e.prototype.onDataPush_=function(t,e){this.log_("handleServerMessage",t,e),"d"===t?this.onDataUpdate_(e.p,e.d,!1,e.t):"m"===t?this.onDataUpdate_(e.p,e.d,!0,e.t):"c"===t?this.onListenRevoked_(e.p,e.q):"ac"===t?this.onAuthRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):x("Unrecognized action received from server: "+a.stringify(t)+"\nAre you using the latest client?")},e.prototype.onReady_=function(t,e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=e,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)},e.prototype.scheduleConnect_=function(t){var e=this;a.assert(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(function(){e.establishConnectionTimer_=null,e.establishConnection_()},Math.floor(t))},e.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=Je,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},e.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Je,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&&this.realtime_.close())},e.prototype.onRealtimeDisconnect_=function(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){if(this.visible_){if(this.lastConnectionEstablishedTime_){(new Date).getTime()-this.lastConnectionEstablishedTime_>3e4&&(this.reconnectDelay_=Je),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();var t=(new Date).getTime()-this.lastConnectionAttemptTime_,e=Math.max(0,this.reconnectDelay_-t);e=Math.random()*e,this.log_("Trying to reconnect in "+e+"ms"),this.scheduleConnect_(e),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},e.prototype.establishConnection_=function(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var t=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+e.nextConnectionId_++,o=this,s=this.lastSessionId,u=!1,c=null,l=function(){c?c.close():(u=!0,r())};this.realtime_={close:l,sendRequest:function(t){a.assert(c,"sendRequest call when we're not connected not allowed."),c.sendRequest(t)}};var h=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(h).then(function(e){u?C("getToken() completed but was canceled"):(C("getToken() completed. Creating connection."),o.authToken_=e&&e.accessToken,c=new Ke(i,o.repoInfo_,t,n,r,function(t){S(t+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")},s))}).then(null,function(t){o.log_("Failed to get token: "+t),u||(a.CONSTANTS.NODE_ADMIN&&S(t),l())})}},e.prototype.interrupt=function(t){C("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},e.prototype.resume=function(t){C("Resuming connection for reason: "+t),delete this.interruptReasons_[t],a.isEmpty(this.interruptReasons_)&&(this.reconnectDelay_=Je,this.realtime_||this.scheduleConnect_(0))},e.prototype.handleTimestamp_=function(t){var e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})},e.prototype.cancelSentTransactions_=function(){for(var t=0;t<this.outstandingPuts_.length;t++){var e=this.outstandingPuts_[t];e&&"h"in e.request&&e.queued&&(e.onComplete&&e.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])},e.prototype.onListenRevoked_=function(t,e){var n;n=e?e.map(function(t){return R(t)}).join("$"):"default";var r=this.removeListen_(t,n);r&&r.onComplete&&r.onComplete("permission_denied")},e.prototype.removeListen_=function(t,e){var n,r=new W(t).toString();return void 0!==this.listens_[r]?(n=this.listens_[r][e],delete this.listens_[r][e],0===a.getCount(this.listens_[r])&&delete this.listens_[r]):n=void 0,n},e.prototype.onAuthRevoked_=function(t,e){C("Auth token revoked: "+t+"/"+e),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))},e.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},e.prototype.restoreState_=function(){var t=this;this.tryAuth(),a.forEach(this.listens_,function(e,n){a.forEach(n,function(e,n){t.sendListen_(n)})});for(var e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){var n=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(n.action,n.pathString,n.data,n.onComplete)}},e.prototype.sendConnectStats_=function(){var t={},e="js";a.CONSTANTS.NODE_ADMIN?e="admin_node":a.CONSTANTS.NODE_CLIENT&&(e="node"),t["sdk."+e+"."+c.SDK_VERSION.replace(/\./g,"-")]=1,a.isMobileCordova()?t["framework.cordova"]=1:a.isReactNative()&&(t["framework.reactnative"]=1),this.reportStats(t)},e.prototype.shouldReconnect_=function(){var t=Ve.getInstance().currentlyOnline();return a.isEmpty(this.interruptReasons_)&&t},e.nextPersistentConnectionId_=0,e.nextConnectionId_=0,e}(Ze),en=function(t){function e(e,n,r){var i=t.call(this)||this;return i.repoInfo_=e,i.onDataUpdate_=n,i.authTokenProvider_=r,i.log_=E("p:rest:"),i.listens_={},i}return u.__extends(e,t),e.prototype.reportStats=function(t){throw new Error("Method not implemented.")},e.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(a.assert(t.getQueryParams().isDefault(),"should have a tag if it's not a default query."),t.path.toString())},e.prototype.listen=function(t,n,r,i){var o=this,s=t.path.toString();this.log_("Listen called for "+s+" "+t.queryIdentifier());var u=e.getListenId_(t,r),c={};this.listens_[u]=c;var l=t.getQueryParams().toRestQueryStringParameters();this.restRequest_(s+".json",l,function(t,e){var n=e;(404===t&&(n=null,t=null),null===t&&o.onDataUpdate_(s,n,!1,r),a.safeGet(o.listens_,u)===c)&&i(t?401==t?"permission_denied":"rest_error:"+t:"ok",null)})},e.prototype.unlisten=function(t,n){var r=e.getListenId_(t,n);delete this.listens_[r]},e.prototype.refreshAuthToken=function(t){},e.prototype.restRequest_=function(t,e,n){var r=this;void 0===e&&(e={}),e.format="export",this.authTokenProvider_.getToken(!1).then(function(i){var o=i&&i.accessToken;o&&(e.auth=o);var s=(r.repoInfo_.secure?"https://":"http://")+r.repoInfo_.host+t+"?"+a.querystring(e);r.log_("Sending REST request for "+s);var u=new XMLHttpRequest;u.onreadystatechange=function(){if(n&&4===u.readyState){r.log_("REST Response for "+s+" received. status:",u.status,"response:",u.responseText);var t=null;if(u.status>=200&&u.status<300){try{t=a.jsonEval(u.responseText)}catch(t){S("Failed to parse JSON response for "+s+": "+u.responseText)}n(null,t)}else 401!==u.status&&404!==u.status&&S("Got unsuccessful REST response for "+s+" Status: "+u.status),n(u.status);n=null}},u.open("GET",s,!0),u.send()})},e}(Ze),nn=function(){function t(t,e,n){var r=this;this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new je,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new ee,this.persistentConnection_=null;var i=new Ie(n);if(this.stats_=Ne.getCollection(t),e||B())this.server_=new en(this.repoInfo_,this.onDataUpdate_.bind(this),i),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var o=n.options.databaseAuthVariableOverride;if(void 0!==o&&null!==o){if("object"!=typeof o)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{a.stringify(o)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}this.persistentConnection_=new tn(this.repoInfo_,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),i,o),this.server_=this.persistentConnection_}i.addTokenChangeListener(function(t){r.server_.refreshAuthToken(t)}),this.statsReporter_=Ne.getOrCreateReporter(t,function(){return new Le(r.stats_,r.server_)}),this.transactions_init_(),this.infoData_=new Pe,this.infoSyncTree_=new Te({startListening:function(t,e,n,i){var o=[],a=r.infoData_.getNode(t.path);return a.isEmpty()||(o=r.infoSyncTree_.applyServerOverwrite(t.path,a),setTimeout(function(){i("ok")},0)),o},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new Te({startListening:function(t,e,n,i){return r.server_.listen(t,n,e,function(e,n){var o=i(e,n);r.eventQueue_.raiseEventsForChangedPath(t.path,o)}),[]},stopListening:function(t,e){r.server_.unlisten(t,e)}})}return t.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},t.prototype.name=function(){return this.repoInfo_.namespace},t.prototype.serverTime=function(){var t=this.infoData_.getNode(new W(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t},t.prototype.generateServerValues=function(){return(t=(t={timestamp:this.serverTime()})||{}).timestamp=t.timestamp||(new Date).getTime(),t;var t},t.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new W(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var o=[];if(r)if(n){var s=a.map(e,function(t){return Gt(t)});o=this.serverSyncTree_.applyTaggedQueryMerge(i,s,r)}else{var u=Gt(e);o=this.serverSyncTree_.applyTaggedQueryOverwrite(i,u,r)}else if(n){var c=a.map(e,function(t){return Gt(t)});o=this.serverSyncTree_.applyServerMerge(i,c)}else{var l=Gt(e);o=this.serverSyncTree_.applyServerOverwrite(i,l)}var h=i;o.length>0&&(h=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(h,o)},t.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},t.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&&this.runOnDisconnectEvents_()},t.prototype.onServerInfoUpdate_=function(t){var e=this;M(t,function(t,n){e.updateInfo_(n,t)})},t.prototype.updateInfo_=function(t,e){var n=new W("/.info/"+t),r=Gt(e);this.infoData_.updateSnapshot(n,r);var i=this.infoSyncTree_.applyServerOverwrite(n,r);this.eventQueue_.raiseEventsForChangedPath(n,i)},t.prototype.getNextWriteId_=function(){return this.nextWriteId_++},t.prototype.setWithPriority=function(t,e,n,r){var i=this;this.log_("set",{path:t.toString(),value:e,priority:n});var o=this.generateServerValues(),a=Gt(e,n),s=re(a,o),u=this.getNextWriteId_(),c=this.serverSyncTree_.applyUserOverwrite(t,s,u,!0);this.eventQueue_.queueEvents(c),this.server_.put(t.toString(),a.val(!0),function(e,n){var o="ok"===e;o||S("set at "+t+" failed: "+e);var a=i.serverSyncTree_.ackUserWrite(u,!o);i.eventQueue_.raiseEventsForChangedPath(t,a),i.callOnCompleteCallback(r,e,n)});var l=this.abortTransactions_(t);this.rerunTransactions_(l),this.eventQueue_.raiseEventsForChangedPath(l,[])},t.prototype.update=function(t,e,n){var r=this;this.log_("update",{path:t.toString(),value:e});var i=!0,o=this.generateServerValues(),s={};if(a.forEach(e,function(t,e){i=!1;var n=Gt(e);s[t]=re(n,o)}),i)C("update() called with empty data.  Don't do anything."),this.callOnCompleteCallback(n,"ok");else{var u=this.getNextWriteId_(),c=this.serverSyncTree_.applyUserMerge(t,s,u);this.eventQueue_.queueEvents(c),this.server_.merge(t.toString(),e,function(e,i){var o="ok"===e;o||S("update at "+t+" failed: "+e);var a=r.serverSyncTree_.ackUserWrite(u,!o),s=a.length>0?r.rerunTransactions_(t):t;r.eventQueue_.raiseEventsForChangedPath(s,a),r.callOnCompleteCallback(n,e,i)}),a.forEach(e,function(e){var n=r.abortTransactions_(t.child(e));r.rerunTransactions_(n)}),this.eventQueue_.raiseEventsForChangedPath(t,[])}},t.prototype.runOnDisconnectEvents_=function(){var t=this;this.log_("onDisconnectEvents");var e=this.generateServerValues(),n=[];(function(t,e){var n=new ee;return t.forEachTree(new W(""),function(t,r){n.remember(t,re(r,e))}),n})(this.onDisconnect_,e).forEachTree(W.Empty,function(e,r){n=n.concat(t.serverSyncTree_.applyServerOverwrite(e,r));var i=t.abortTransactions_(e);t.rerunTransactions_(i)}),this.onDisconnect_=new ee,this.eventQueue_.raiseEventsForChangedPath(W.Empty,n)},t.prototype.onDisconnectCancel=function(t,e){var n=this;this.server_.onDisconnectCancel(t.toString(),function(r,i){"ok"===r&&n.onDisconnect_.forget(t),n.callOnCompleteCallback(e,r,i)})},t.prototype.onDisconnectSet=function(t,e,n){var r=this,i=Gt(e);this.server_.onDisconnectPut(t.toString(),i.val(!0),function(e,o){"ok"===e&&r.onDisconnect_.remember(t,i),r.callOnCompleteCallback(n,e,o)})},t.prototype.onDisconnectSetWithPriority=function(t,e,n,r){var i=this,o=Gt(e,n);this.server_.onDisconnectPut(t.toString(),o.val(!0),function(e,n){"ok"===e&&i.onDisconnect_.remember(t,o),i.callOnCompleteCallback(r,e,n)})},t.prototype.onDisconnectUpdate=function(t,e,n){var r=this;if(a.isEmpty(e))return C("onDisconnect().update() called with empty data.  Don't do anything."),void this.callOnCompleteCallback(n,"ok");this.server_.onDisconnectMerge(t.toString(),e,function(i,o){"ok"===i&&a.forEach(e,function(e,n){var i=Gt(n);r.onDisconnect_.remember(t.child(e),i)}),r.callOnCompleteCallback(n,i,o)})},t.prototype.addEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.addEventRegistration(t,e):this.serverSyncTree_.addEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.removeEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.removeEventRegistration(t,e):this.serverSyncTree_.removeEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt("repo_interrupt")},t.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume("repo_interrupt")},t.prototype.stats=function(t){if(void 0===t&&(t=!1),"undefined"!=typeof console){var e;t?(this.statsListener_||(this.statsListener_=new Re(this.stats_)),e=this.statsListener_.get()):e=this.stats_.get();var n=Object.keys(e).reduce(function(t,e){return Math.max(e.length,t)},0);a.forEach(e,function(t,e){for(var r=t.length;r<n+2;r++)t+=" ";console.log(t+e)})}},t.prototype.statsIncrementCounter=function(t){this.stats_.incrementCounter(t),this.statsReporter_.includeStat(t)},t.prototype.log_=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="";this.persistentConnection_&&(n=this.persistentConnection_.id+":"),C.apply(void 0,[n].concat(t))},t.prototype.callOnCompleteCallback=function(t,e,n){t&&F(function(){if("ok"==e)t(null);else{var r=(e||"error").toUpperCase(),i=r;n&&(i+=": "+n);var o=new Error(i);o.code=r,t(o)}})},Object.defineProperty(t.prototype,"database",{get:function(){return this.__database||(this.__database=new pn(this))},enumerable:!0,configurable:!0}),t}(),rn=function(){function t(e){this.indexedFilter_=new _e(e.getIndex()),this.index_=e.getIndex(),this.startPost_=t.getStartPost_(e),this.endPost_=t.getEndPost_(e)}return t.prototype.getStartPost=function(){return this.startPost_},t.prototype.getEndPost=function(){return this.endPost_},t.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},t.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new _t(e,n))||(n=Bt.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},t.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=Bt.EMPTY_NODE);var r=e.withIndex(this.index_);r=r.updatePriority(Bt.EMPTY_NODE);var i=this;return e.forEachChild(Tt,function(t,e){i.matches(new _t(t,e))||(r=r.updateImmediateChild(t,Bt.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},t.prototype.updatePriority=function(t,e){return t},t.prototype.filtersNodes=function(){return!0},t.prototype.getIndexedFilter=function(){return this.indexedFilter_},t.prototype.getIndex=function(){return this.index_},t.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},t.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},t}(),on=function(){function t(t){this.rangedFilter_=new rn(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}return t.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new _t(e,n))||(n=Bt.EMPTY_NODE),t.getImmediateChild(e).equals(n)?t:t.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(t,e,n,r,i,o):this.fullLimitUpdateChild_(t,e,n,i,o)},t.prototype.updateFullNode=function(t,e,n){var r;if(e.isLeafNode()||e.isEmpty())r=Bt.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){r=Bt.EMPTY_NODE.withIndex(this.index_);var i=void 0;i=this.reverse_?e.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):e.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);for(var o=0;i.hasNext()&&o<this.limit_;){var a=i.getNext();if(!(this.reverse_?this.index_.compare(this.rangedFilter_.getStartPost(),a)<=0:this.index_.compare(a,this.rangedFilter_.getEndPost())<=0))break;r=r.updateImmediateChild(a.name,a.node),o++}}else{r=(r=e.withIndex(this.index_)).updatePriority(Bt.EMPTY_NODE);var s=void 0,u=void 0,c=void 0;i=void 0;if(this.reverse_){i=r.getReverseIterator(this.index_),s=this.rangedFilter_.getEndPost(),u=this.rangedFilter_.getStartPost();var l=this.index_.getCompare();c=function(t,e){return l(e,t)}}else i=r.getIterator(this.index_),s=this.rangedFilter_.getStartPost(),u=this.rangedFilter_.getEndPost(),c=this.index_.getCompare();o=0;for(var h=!1;i.hasNext();){a=i.getNext();!h&&c(s,a)<=0&&(h=!0),h&&o<this.limit_&&c(a,u)<=0?o++:r=r.updateImmediateChild(a.name,Bt.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},t.prototype.updatePriority=function(t,e){return t},t.prototype.filtersNodes=function(){return!0},t.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},t.prototype.getIndex=function(){return this.index_},t.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var o;if(this.reverse_){var s=this.index_.getCompare();o=function(t,e){return s(e,t)}}else o=this.index_.getCompare();var u=t;a.assert(u.numChildren()==this.limit_,"");var c=new _t(e,n),l=this.reverse_?u.getFirstChild(this.index_):u.getLastChild(this.index_),h=this.rangedFilter_.matches(c);if(u.hasChild(e)){for(var d=u.getImmediateChild(e),p=r.getChildAfterChild(this.index_,l,this.reverse_);null!=p&&(p.name==e||u.hasChild(p.name));)p=r.getChildAfterChild(this.index_,p,this.reverse_);var f=null==p?1:o(p,c);if(h&&!n.isEmpty()&&f>=0)return null!=i&&i.trackChildChange(ge.childChangedChange(e,n,d)),u.updateImmediateChild(e,n);null!=i&&i.trackChildChange(ge.childRemovedChange(e,d));var g=u.updateImmediateChild(e,Bt.EMPTY_NODE);return null!=p&&this.rangedFilter_.matches(p)?(null!=i&&i.trackChildChange(ge.childAddedChange(p.name,p.node)),g.updateImmediateChild(p.name,p.node)):g}return n.isEmpty()?t:h&&o(l,c)>=0?(null!=i&&(i.trackChildChange(ge.childRemovedChange(l.name,l.node)),i.trackChildChange(ge.childAddedChange(e,n))),u.updateImmediateChild(e,n).updateImmediateChild(l.name,Bt.EMPTY_NODE)):t},t}(),an=function(){function t(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Tt}return t.prototype.hasStart=function(){return this.startSet_},t.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},t.prototype.getIndexStartValue=function(){return a.assert(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},t.prototype.getIndexStartName=function(){return a.assert(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:T},t.prototype.hasEnd=function(){return this.endSet_},t.prototype.getIndexEndValue=function(){return a.assert(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},t.prototype.getIndexEndName=function(){return a.assert(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:P},t.prototype.hasLimit=function(){return this.limitSet_},t.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},t.prototype.getLimit=function(){return a.assert(this.limitSet_,"Only valid if limit has been set"),this.limit_},t.prototype.getIndex=function(){return this.index_},t.prototype.copy_=function(){var e=new t;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e},t.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},t.prototype.limitToFirst=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,n},t.prototype.limitToLast=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,n},t.prototype.startAt=function(t,e){var n=this.copy_();return n.startSet_=!0,void 0===t&&(t=null),n.indexStartValue_=t,null!=e?(n.startNameSet_=!0,n.indexStartName_=e):(n.startNameSet_=!1,n.indexStartName_=""),n},t.prototype.endAt=function(t,e){var n=this.copy_();return n.endSet_=!0,void 0===t&&(t=null),n.indexEndValue_=t,void 0!==e?(n.endNameSet_=!0,n.indexEndName_=e):(n.endNameSet_=!1,n.indexEndName_=""),n},t.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},t.prototype.getQueryObject=function(){var e=t.WIRE_PROTOCOL_CONSTANTS_,n={};if(this.startSet_&&(n[e.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(n[e.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(n[e.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(n[e.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){n[e.LIMIT]=this.limit_;var r=this.viewFrom_;""===r&&(r=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),n[e.VIEW_FROM]=r}return this.index_!==Tt&&(n[e.INDEX]=this.index_.toString()),n},t.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},t.prototype.isDefault=function(){return this.loadsAllData()&&this.index_==Tt},t.prototype.getNodeFilter=function(){return this.loadsAllData()?new _e(this.getIndex()):this.hasLimit()?new on(this):new rn(this)},t.prototype.toRestQueryStringParameters=function(){var e,n=t.REST_QUERY_CONSTANTS_,r={};return this.isDefault()?r:(this.index_===Tt?e=n.PRIORITY_INDEX:this.index_===zt?e=n.VALUE_INDEX:this.index_===yt?e=n.KEY_INDEX:(a.assert(this.index_ instanceof qt,"Unrecognized index type!"),e=this.index_.toString()),r[n.ORDER_BY]=a.stringify(e),this.startSet_&&(r[n.START_AT]=a.stringify(this.indexStartValue_),this.startNameSet_&&(r[n.START_AT]+=","+a.stringify(this.indexStartName_))),this.endSet_&&(r[n.END_AT]=a.stringify(this.indexEndValue_),this.endNameSet_&&(r[n.END_AT]+=","+a.stringify(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?r[n.LIMIT_TO_FIRST]=this.limit_:r[n.LIMIT_TO_LAST]=this.limit_),r)},t.WIRE_PROTOCOL_CONSTANTS_={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},t.REST_QUERY_CONSTANTS_={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},t.DEFAULT=new t,t}(),sn=function(t){function e(e,n){if(!(e instanceof nn))throw new Error("new Reference() no longer supported - use app.database().");return t.call(this,e,n,an.DEFAULT,!1)||this}return u.__extends(e,t),e.prototype.getKey=function(){return a.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},e.prototype.child=function(t){return a.validateArgCount("Reference.child",1,1,arguments.length),"number"==typeof t?t=String(t):t instanceof W||(null===this.path.getFront()?function(t,e,n,r){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),lt(t,e,n,r)}("Reference.child",1,t,!1):lt("Reference.child",1,t,!1)),new e(this.repo,this.path.child(t))},e.prototype.getParent=function(){a.validateArgCount("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new e(this.repo,t)},e.prototype.getRoot=function(){a.validateArgCount("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},e.prototype.databaseProp=function(){return this.repo.database},e.prototype.set=function(t,e){a.validateArgCount("Reference.set",1,2,arguments.length),ht("Reference.set",this.path),it("Reference.set",1,t,this.path,!1),a.validateCallback("Reference.set",2,e,!0);var n=new a.Deferred;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},e.prototype.update=function(t,e){if(a.validateArgCount("Reference.update",1,2,arguments.length),ht("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,S("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}at("Reference.update",1,t,this.path,!1),a.validateCallback("Reference.update",2,e,!0);var i=new a.Deferred;return this.repo.update(this.path,t,i.wrapCallback(e)),i.promise},e.prototype.setWithPriority=function(t,e,n){if(a.validateArgCount("Reference.setWithPriority",2,3,arguments.length),ht("Reference.setWithPriority",this.path),it("Reference.setWithPriority",1,t,this.path,!1),st("Reference.setWithPriority",2,e,!1),a.validateCallback("Reference.setWithPriority",3,n,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.setWithPriority failed: "+this.getKey()+" is a read-only object.";var r=new a.Deferred;return this.repo.setWithPriority(this.path,t,e,r.wrapCallback(n)),r.promise},e.prototype.remove=function(t){return a.validateArgCount("Reference.remove",0,1,arguments.length),ht("Reference.remove",this.path),a.validateCallback("Reference.remove",1,t,!0),this.set(null,t)},e.prototype.transaction=function(t,e,n){if(a.validateArgCount("Reference.transaction",1,3,arguments.length),ht("Reference.transaction",this.path),a.validateCallback("Reference.transaction",1,t,!1),a.validateCallback("Reference.transaction",2,e,!0),function(t,e,n,r){if((!r||void 0!==n)&&"boolean"!=typeof n)throw new Error(a.errorPrefix(t,e,r)+"must be a boolean.")}("Reference.transaction",3,n,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.transaction failed: "+this.getKey()+" is a read-only object.";void 0===n&&(n=!0);var r=new a.Deferred;"function"==typeof e&&r.promise.catch(function(){});return this.repo.startTransaction(this.path,t,function(t,n,i){t?r.reject(t):r.resolve(new ft(n,i)),"function"==typeof e&&e(t,n,i)},n),r.promise},e.prototype.setPriority=function(t,e){a.validateArgCount("Reference.setPriority",1,2,arguments.length),ht("Reference.setPriority",this.path),st("Reference.setPriority",1,t,!1),a.validateCallback("Reference.setPriority",2,e,!0);var n=new a.Deferred;return this.repo.setWithPriority(this.path.child(".priority"),t,null,n.wrapCallback(e)),n.promise},e.prototype.push=function(t,e){a.validateArgCount("Reference.push",0,2,arguments.length),ht("Reference.push",this.path),it("Reference.push",1,t,this.path,!0),a.validateCallback("Reference.push",2,e,!0);var n,r=this.repo.serverTime(),i=gt(r),o=this.child(i),s=this.child(i);return n=null!=t?o.set(t,e).then(function(){return s}):Promise.resolve(s),o.then=n.then.bind(n),o.catch=n.then.bind(n,void 0),"function"==typeof e&&n.catch(function(){}),o},e.prototype.onDisconnect=function(){return ht("Reference.onDisconnect",this.path),new pt(this.repo,this.path)},Object.defineProperty(e.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"key",{get:function(){return this.getKey()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.getParent()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this.getRoot()},enumerable:!0,configurable:!0}),e}($t);$t.__referenceConstructor=sn,xe.__referenceConstructor=sn;var un,cn=function(){return function(){this.children={},this.childCount=0,this.value=null}}(),ln=function(){function t(t,e,n){void 0===t&&(t=""),void 0===e&&(e=null),void 0===n&&(n=new cn),this.name_=t,this.parent_=e,this.node_=n}return t.prototype.subTree=function(e){for(var n,r=e instanceof W?e:new W(e),i=this;null!==(n=r.getFront());){i=new t(n,i,a.safeGet(i.node_.children,n)||new cn),r=r.popFront()}return i},t.prototype.getValue=function(){return this.node_.value},t.prototype.setValue=function(t){a.assert(void 0!==t,"Cannot set value to undefined"),this.node_.value=t,this.updateParents_()},t.prototype.clear=function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()},t.prototype.hasChildren=function(){return this.node_.childCount>0},t.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},t.prototype.forEachChild=function(e){var n=this;a.forEach(this.node_.children,function(r,i){e(new t(r,n,i))})},t.prototype.forEachDescendant=function(t,e,n){e&&!n&&t(this),this.forEachChild(function(e){e.forEachDescendant(t,!0,n)}),e&&n&&t(this)},t.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},t.prototype.forEachImmediateDescendantWithValue=function(t){this.forEachChild(function(e){null!==e.getValue()?t(e):e.forEachImmediateDescendantWithValue(t)})},t.prototype.path=function(){return new W(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},t.prototype.name=function(){return this.name_},t.prototype.parent=function(){return this.parent_},t.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},t.prototype.updateChild_=function(t,e){var n=e.isEmpty(),r=a.contains(this.node_.children,t);n&&r?(delete this.node_.children[t],this.node_.childCount--,this.updateParents_()):n||r||(this.node_.children[t]=e.node_,this.node_.childCount++,this.updateParents_())},t}();!function(t){t[t.RUN=0]="RUN",t[t.SENT=1]="SENT",t[t.COMPLETED=2]="COMPLETED",t[t.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",t[t.NEEDS_ABORT=4]="NEEDS_ABORT"}(un||(un={})),nn.MAX_TRANSACTION_RETRIES_=25,nn.prototype.transactions_init_=function(){this.transactionQueueTree_=new ln},nn.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);var i=function(){},o=new sn(this,t);o.on("value",i);var s={path:t,update:e,onComplete:n,status:null,order:_(),applyLocally:r,retryCount:0,unwatcher:function(){o.off("value",i)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},u=this.getLatestState_(t);s.currentInputSnapshot=u;var c=s.update(u.val());if(void 0===c){if(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete){var l=new Xt(s.currentInputSnapshot,new sn(this,s.path),Tt);s.onComplete(null,!1,l)}}else{ot("transaction failed: Data returned ",c,s.path),s.status=un.RUN;var h=this.transactionQueueTree_.subTree(t),d=h.getValue()||[];d.push(s),h.setValue(d);var p=void 0;if("object"==typeof c&&null!==c&&a.contains(c,".priority"))p=a.safeGet(c,".priority"),a.assert(rt(p),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.");else p=(this.serverSyncTree_.calcCompleteEventCache(t)||Bt.EMPTY_NODE).getPriority().val();p=p;var f=this.generateServerValues(),g=Gt(c,p),v=re(g,f);s.currentOutputSnapshotRaw=g,s.currentOutputSnapshotResolved=v,s.currentWriteId=this.getNextWriteId_();var m=this.serverSyncTree_.applyUserOverwrite(t,v,s.currentWriteId,s.applyLocally);this.eventQueue_.raiseEventsForChangedPath(t,m),this.sendReadyTransactions_()}},nn.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||Bt.EMPTY_NODE},nn.prototype.sendReadyTransactions_=function(t){var e=this;if(void 0===t&&(t=this.transactionQueueTree_),t||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()){var n=this.buildTransactionQueue_(t);a.assert(n.length>0,"Sending zero length transaction queue"),n.every(function(t){return t.status===un.RUN})&&this.sendTransactionQueue_(t.path(),n)}else t.hasChildren()&&t.forEachChild(function(t){e.sendReadyTransactions_(t)})},nn.prototype.sendTransactionQueue_=function(t,e){for(var n=this,r=e.map(function(t){return t.currentWriteId}),i=this.getLatestState_(t,r),o=i,s=i.hash(),u=0;u<e.length;u++){var c=e[u];a.assert(c.status===un.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),c.status=un.SENT,c.retryCount++;var l=W.relativePath(t,c.path);o=o.updateChild(l,c.currentOutputSnapshotRaw)}var h=o.val(!0),d=t;this.server_.put(d.toString(),h,function(r){n.log_("transaction put response",{path:d.toString(),status:r});var i=[];if("ok"===r){for(var o=[],a=0;a<e.length;a++){if(e[a].status=un.COMPLETED,i=i.concat(n.serverSyncTree_.ackUserWrite(e[a].currentWriteId)),e[a].onComplete){var s=e[a].currentOutputSnapshotResolved,u=new sn(n,e[a].path),c=new Xt(s,u,Tt);o.push(e[a].onComplete.bind(null,null,!0,c))}e[a].unwatcher()}n.pruneCompletedTransactionsBelowNode_(n.transactionQueueTree_.subTree(t)),n.sendReadyTransactions_(),n.eventQueue_.raiseEventsForChangedPath(t,i);for(a=0;a<o.length;a++)F(o[a])}else{if("datastale"===r)for(a=0;a<e.length;a++)e[a].status===un.SENT_NEEDS_ABORT?e[a].status=un.NEEDS_ABORT:e[a].status=un.RUN;else{S("transaction at "+d.toString()+" failed: "+r);for(a=0;a<e.length;a++)e[a].status=un.NEEDS_ABORT,e[a].abortReason=r}n.rerunTransactions_(t)}},s)},nn.prototype.rerunTransactions_=function(t){var e=this.getAncestorTransactionNode_(t),n=e.path(),r=this.buildTransactionQueue_(e);return this.rerunTransactionQueue_(r,n),n},nn.prototype.rerunTransactionQueue_=function(t,e){if(0!==t.length){for(var n,r=[],i=[],o=t.filter(function(t){return t.status===un.RUN}).map(function(t){return t.currentWriteId}),s=0;s<t.length;s++){var u=t[s],c=W.relativePath(e,u.path),l=!1,h=void 0;if(a.assert(null!==c,"rerunTransactionsUnderNode_: relativePath should not be null."),u.status===un.NEEDS_ABORT)l=!0,h=u.abortReason,i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0));else if(u.status===un.RUN)if(u.retryCount>=nn.MAX_TRANSACTION_RETRIES_)l=!0,h="maxretry",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0));else{var d=this.getLatestState_(u.path,o);u.currentInputSnapshot=d;var p=t[s].update(d.val());if(void 0!==p){ot("transaction failed: Data returned ",p,u.path);var f=Gt(p);"object"==typeof p&&null!=p&&a.contains(p,".priority")||(f=f.updatePriority(d.getPriority()));var g=u.currentWriteId,_=this.generateServerValues(),v=re(f,_);u.currentOutputSnapshotRaw=f,u.currentOutputSnapshotResolved=v,u.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(g),1),i=(i=i.concat(this.serverSyncTree_.applyUserOverwrite(u.path,v,u.currentWriteId,u.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(g,!0))}else l=!0,h="nodata",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,i),i=[],l&&(t[s].status=un.COMPLETED,n=t[s].unwatcher,setTimeout(n,Math.floor(0)),t[s].onComplete))if("nodata"===h){var m=new sn(this,t[s].path),y=t[s].currentInputSnapshot,b=new Xt(y,m,Tt);r.push(t[s].onComplete.bind(null,null,!1,b))}else r.push(t[s].onComplete.bind(null,new Error(h),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(s=0;s<r.length;s++)F(r[s]);this.sendReadyTransactions_()}},nn.prototype.getAncestorTransactionNode_=function(t){for(var e,n=this.transactionQueueTree_;null!==(e=t.getFront())&&null===n.getValue();)n=n.subTree(e),t=t.popFront();return n},nn.prototype.buildTransactionQueue_=function(t){var e=[];return this.aggregateTransactionQueuesForNode_(t,e),e.sort(function(t,e){return t.order-e.order}),e},nn.prototype.aggregateTransactionQueuesForNode_=function(t,e){var n=this,r=t.getValue();if(null!==r)for(var i=0;i<r.length;i++)e.push(r[i]);t.forEachChild(function(t){n.aggregateTransactionQueuesForNode_(t,e)})},nn.prototype.pruneCompletedTransactionsBelowNode_=function(t){var e=this,n=t.getValue();if(n){for(var r=0,i=0;i<n.length;i++)n[i].status!==un.COMPLETED&&(n[r]=n[i],r++);n.length=r,t.setValue(n.length>0?n:null)}t.forEachChild(function(t){e.pruneCompletedTransactionsBelowNode_(t)})},nn.prototype.abortTransactions_=function(t){var e=this,n=this.getAncestorTransactionNode_(t).path(),r=this.transactionQueueTree_.subTree(t);return r.forEachAncestor(function(t){e.abortTransactionsOnNode_(t)}),this.abortTransactionsOnNode_(r),r.forEachDescendant(function(t){e.abortTransactionsOnNode_(t)}),n},nn.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;o<e.length;o++)if(e[o].status===un.SENT_NEEDS_ABORT);else if(e[o].status===un.SENT)a.assert(i===o-1,"All SENT items should be at beginning of queue."),i=o,e[o].status=un.SENT_NEEDS_ABORT,e[o].abortReason="set";else if(a.assert(e[o].status===un.RUN,"Unexpected transaction status in abort"),e[o].unwatcher(),r=r.concat(this.serverSyncTree_.ackUserWrite(e[o].currentWriteId,!0)),e[o].onComplete){n.push(e[o].onComplete.bind(null,new Error("set"),!1,null))}-1===i?t.setValue(null):e.length=i+1,this.eventQueue_.raiseEventsForChangedPath(t.path(),r);for(o=0;o<n.length;o++)F(n[o])}};var hn,dn=function(){function t(){this.repos_={},this.useRestClient_=!1}return t.getInstance=function(){return hn||(hn=new t),hn},t.prototype.interrupt=function(){for(var t in this.repos_)for(var e in this.repos_[t])this.repos_[t][e].interrupt()},t.prototype.resume=function(){for(var t in this.repos_)for(var e in this.repos_[t])this.repos_[t][e].resume()},t.prototype.databaseFromApp=function(t,e){var n=e||t.options.databaseURL;void 0===n&&A("Can't determine Firebase Database URL.  Be sure to include databaseURL option when calling firebase.initializeApp().");var r=Z(n),i=r.repoInfo;return dt("Invalid Firebase Database URL",1,r),r.path.isEmpty()||A("Database URL must point to the root of a Firebase Database (not including a child path)."),this.createRepo(i,t).database},t.prototype.deleteRepo=function(t){var e=a.safeGet(this.repos_,t.app.name);e&&a.safeGet(e,t.repoInfo_.toURLString())===t||A("Database "+t.app.name+"("+t.repoInfo_+") has already been deleted."),t.interrupt(),delete e[t.repoInfo_.toURLString()]},t.prototype.createRepo=function(t,e){var n=a.safeGet(this.repos_,e.name);n||(n={},this.repos_[e.name]=n);var r=a.safeGet(n,t.toURLString());return r&&A("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),r=new nn(t,this.useRestClient_,e),n[t.toURLString()]=r,r},t.prototype.forceRestClient=function(t){this.useRestClient_=t},t}(),pn=function(){function t(t){this.repo_=t,t instanceof nn||A("Don't call new Database() directly - please use firebase.database()."),this.root_=new sn(t,W.Empty),this.INTERNAL=new fn(this)}return Object.defineProperty(t.prototype,"app",{get:function(){return this.repo_.app},enumerable:!0,configurable:!0}),t.prototype.ref=function(t){return this.checkDeleted_("ref"),a.validateArgCount("database.ref",0,1,arguments.length),t instanceof sn?this.refFromURL(t.toString()):void 0!==t?this.root_.child(t):this.root_},t.prototype.refFromURL=function(t){var e="database.refFromURL";this.checkDeleted_(e),a.validateArgCount(e,1,1,arguments.length);var n=Z(t);dt(e,1,n);var r=n.repoInfo;return r.host!==this.repo_.repoInfo_.host&&A(e+": Host name does not match the current database: (found "+r.host+" but expected "+this.repo_.repoInfo_.host+")"),this.ref(n.path.toString())},t.prototype.checkDeleted_=function(t){null===this.repo_&&A("Cannot call "+t+" on a deleted database.")},t.prototype.goOffline=function(){a.validateArgCount("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),this.repo_.interrupt()},t.prototype.goOnline=function(){a.validateArgCount("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),this.repo_.resume()},t.ServerValue={TIMESTAMP:{".sv":"timestamp"}},t}(),fn=function(){function t(t){this.database=t}return t.prototype.delete=function(){return u.__awaiter(this,void 0,void 0,function(){return u.__generator(this,function(t){return this.database.checkDeleted_("delete"),dn.getInstance().deleteRepo(this.database.repo_),this.database.repo_=null,this.database.root_=null,this.database.INTERNAL=null,this.database=null,[2]})})},t}(),gn=Object.freeze({forceLongPolling:function(){Xe.forceDisallow(),Ye.forceAllow()},forceWebSockets:function(){Ye.forceDisallow()},isWebSocketsAvailable:function(){return Xe.isAvailable()},setSecurityDebugCallback:function(t,e){t.repo.persistentConnection_.securityDebugCallback_=e},stats:function(t,e){t.repo.stats(e)},statsIncrementCounter:function(t,e){t.repo.statsIncrementCounter(e)},dataUpdateCount:function(t){return t.repo.dataUpdateCount},interceptServerData:function(t,e){return t.repo.interceptServerData_(e)}}),_n=tn;tn.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},tn.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var vn=Ke,mn=Y,yn=Object.freeze({DataConnection:_n,RealTimeConnection:vn,hijackHash:function(t){var e=tn.prototype.put;return tn.prototype.put=function(n,r,i,o){void 0!==o&&(o=t()),e.call(this,n,r,i,o)},function(){tn.prototype.put=e}},ConnectionTarget:mn,queryIdentifier:function(t){return t.queryIdentifier()},listens:function(t){return t.repo.persistentConnection_.listens_},forceRestClient:function(t){dn.getInstance().forceRestClient(t)}}),bn=pn.ServerValue;function wn(e){var n=e.INTERNAL.registerService("database",function(t,e,n){return dn.getInstance().databaseFromApp(t,n)},{Reference:sn,Query:$t,Database:pn,enableLogging:w,INTERNAL:gn,ServerValue:bn,TEST_ACCESS:yn},null,!0);a.isNodeSdk()&&(t.exports=n)}wn(c),e.registerDatabase=wn,e.Database=pn,e.Query=$t,e.Reference=sn,e.enableLogging=w,e.ServerValue=bn,e.DataSnapshot=Xt,e.OnDisconnect=pt}).call(e,n(24))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"setLogLevel",function(){return u}),n.d(e,"Logger",function(){return s}),n.d(e,"LogLevel",function(){return r});var r,i=[];!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(r||(r={}));var o=r.INFO,a=function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(!(e<t.logLevel)){var o=(new Date).toISOString();switch(e){case r.DEBUG:case r.VERBOSE:console.log.apply(console,["["+o+"]  "+t.name+":"].concat(n));break;case r.INFO:console.info.apply(console,["["+o+"]  "+t.name+":"].concat(n));break;case r.WARN:console.warn.apply(console,["["+o+"]  "+t.name+":"].concat(n));break;case r.ERROR:console.error.apply(console,["["+o+"]  "+t.name+":"].concat(n));break;default:throw new Error("Attempted to log a message with an invalid logType (value: "+e+")")}}},s=function(){function t(t){this.name=t,this._logLevel=o,this._logHandler=a,i.push(this)}return Object.defineProperty(t.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in r))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!0,configurable:!0}),t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.DEBUG].concat(t))},t.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.VERBOSE].concat(t))},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.INFO].concat(t))},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.WARN].concat(t))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.ERROR].concat(t))},t}();function u(t){i.forEach(function(e){e.logLevel=t})}},function(t,e,n){n(61)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"registerMessaging",function(){return O});var r,i,o,a=n(16),s=(n.n(a),n(17)),u=n(7),c={AVAILABLE_IN_WINDOW:"only-available-in-window",AVAILABLE_IN_SW:"only-available-in-sw",SHOULD_BE_INHERITED:"should-be-overriden",BAD_SENDER_ID:"bad-sender-id",INCORRECT_GCM_SENDER_ID:"incorrect-gcm-sender-id",PERMISSION_DEFAULT:"permission-default",PERMISSION_BLOCKED:"permission-blocked",UNSUPPORTED_BROWSER:"unsupported-browser",NOTIFICATIONS_BLOCKED:"notifications-blocked",FAILED_DEFAULT_REGISTRATION:"failed-serviceworker-registration",SW_REGISTRATION_EXPECTED:"sw-registration-expected",GET_SUBSCRIPTION_FAILED:"get-subscription-failed",INVALID_SAVED_TOKEN:"invalid-saved-token",SW_REG_REDUNDANT:"sw-reg-redundant",TOKEN_SUBSCRIBE_FAILED:"token-subscribe-failed",TOKEN_SUBSCRIBE_NO_TOKEN:"token-subscribe-no-token",TOKEN_SUBSCRIBE_NO_PUSH_SET:"token-subscribe-no-push-set",TOKEN_UNSUBSCRIBE_FAILED:"token-unsubscribe-failed",TOKEN_UPDATE_FAILED:"token-update-failed",TOKEN_UPDATE_NO_TOKEN:"token-update-no-token",USE_SW_BEFORE_GET_TOKEN:"use-sw-before-get-token",INVALID_DELETE_TOKEN:"invalid-delete-token",DELETE_TOKEN_NOT_FOUND:"delete-token-not-found",DELETE_SCOPE_NOT_FOUND:"delete-scope-not-found",BG_HANDLER_FUNCTION_EXPECTED:"bg-handler-function-expected",NO_WINDOW_CLIENT_TO_MSG:"no-window-client-to-msg",UNABLE_TO_RESUBSCRIBE:"unable-to-resubscribe",NO_FCM_TOKEN_FOR_RESUBSCRIBE:"no-fcm-token-for-resubscribe",FAILED_TO_DELETE_TOKEN:"failed-to-delete-token",NO_SW_IN_REG:"no-sw-in-reg",BAD_SCOPE:"bad-scope",BAD_VAPID_KEY:"bad-vapid-key",BAD_SUBSCRIPTION:"bad-subscription",BAD_TOKEN:"bad-token",BAD_PUSH_SET:"bad-push-set",FAILED_DELETE_VAPID_KEY:"failed-delete-vapid-key",INVALID_PUBLIC_VAPID_KEY:"invalid-public-vapid-key",USE_PUBLIC_KEY_BEFORE_GET_TOKEN:"use-public-key-before-get-token",PUBLIC_KEY_DECRYPTION_FAILED:"public-vapid-key-decryption-failed"},l=((r={})[c.AVAILABLE_IN_WINDOW]="This method is available in a Window context.",r[c.AVAILABLE_IN_SW]="This method is available in a service worker context.",r[c.SHOULD_BE_INHERITED]="This method should be overriden by extended classes.",r[c.BAD_SENDER_ID]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",r[c.PERMISSION_DEFAULT]="The required permissions were not granted and dismissed instead.",r[c.PERMISSION_BLOCKED]="The required permissions were not granted and blocked instead.",r[c.UNSUPPORTED_BROWSER]="This browser doesn't support the API's required to use the firebase SDK.",r[c.NOTIFICATIONS_BLOCKED]="Notifications have been blocked.",r[c.FAILED_DEFAULT_REGISTRATION]="We are unable to register the default service worker. {$browserErrorMessage}",r[c.SW_REGISTRATION_EXPECTED]="A service worker registration was the expected input.",r[c.GET_SUBSCRIPTION_FAILED]="There was an error when trying to get any existing Push Subscriptions.",r[c.INVALID_SAVED_TOKEN]="Unable to access details of the saved token.",r[c.SW_REG_REDUNDANT]="The service worker being used for push was made redundant.",r[c.TOKEN_SUBSCRIBE_FAILED]="A problem occured while subscribing the user to FCM: {$message}",r[c.TOKEN_SUBSCRIBE_NO_TOKEN]="FCM returned no token when subscribing the user to push.",r[c.TOKEN_SUBSCRIBE_NO_PUSH_SET]="FCM returned an invalid response when getting an FCM token.",r[c.TOKEN_UNSUBSCRIBE_FAILED]="A problem occured while unsubscribing the user from FCM: {$message}",r[c.TOKEN_UPDATE_FAILED]="A problem occured while updating the user from FCM: {$message}",r[c.TOKEN_UPDATE_NO_TOKEN]="FCM returned no token when updating the user to push.",r[c.USE_SW_BEFORE_GET_TOKEN]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",r[c.INVALID_DELETE_TOKEN]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",r[c.DELETE_TOKEN_NOT_FOUND]="The deletion attempt for token could not be performed as the token was not found.",r[c.DELETE_SCOPE_NOT_FOUND]="The deletion attempt for service worker scope could not be performed as the scope was not found.",r[c.BG_HANDLER_FUNCTION_EXPECTED]="The input to setBackgroundMessageHandler() must be a function.",r[c.NO_WINDOW_CLIENT_TO_MSG]="An attempt was made to message a non-existant window client.",r[c.UNABLE_TO_RESUBSCRIBE]="There was an error while re-subscribing the FCM token for push messaging. Will have to resubscribe the user on next visit. {$message}",r[c.NO_FCM_TOKEN_FOR_RESUBSCRIBE]="Could not find an FCM token and as a result, unable to resubscribe. Will have to resubscribe the user on next visit.",r[c.FAILED_TO_DELETE_TOKEN]="Unable to delete the currently saved token.",r[c.NO_SW_IN_REG]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",r[c.INCORRECT_GCM_SENDER_ID]="Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging.",r[c.BAD_SCOPE]="The service worker scope must be a string with at least one character.",r[c.BAD_VAPID_KEY]="The public VAPID key is not a Uint8Array with 65 bytes.",r[c.BAD_SUBSCRIPTION]="The subscription must be a valid PushSubscription.",r[c.BAD_TOKEN]="The FCM Token used for storage / lookup was not a valid token string.",r[c.BAD_PUSH_SET]="The FCM push set used for storage / lookup was not not a valid push set string.",r[c.FAILED_DELETE_VAPID_KEY]="The VAPID key could not be deleted.",r[c.INVALID_PUBLIC_VAPID_KEY]="The public VAPID key must be a string.",r[c.PUBLIC_KEY_DECRYPTION_FAILED]="The public VAPID key did not equal 65 bytes when decrypted.",r),h=new a.ErrorFactory("messaging","Messaging",l),d=new Uint8Array([4,51,148,247,223,161,235,177,220,3,162,94,21,113,219,72,211,46,237,237,178,52,219,183,71,58,12,143,196,204,225,111,60,140,132,223,171,182,102,62,242,12,212,139,254,227,249,118,47,20,28,99,8,106,111,45,177,26,149,176,206,55,192,156,110]),p="https://fcm.googleapis.com";function f(t,e){if(null==t||null==e)return!1;if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(var n=new DataView(t),r=new DataView(e),i=0;i<t.byteLength;i++)if(n.getUint8(i)!==r.getUint8(i))return!1;return!0}function g(t){return function(t){var e=new Uint8Array(t);return btoa(String.fromCharCode.apply(null,e))}(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}!function(t){t.TYPE_OF_MSG="firebase-messaging-msg-type",t.DATA="firebase-messaging-msg-data"}(i||(i={})),function(t){t.PUSH_MSG_RECEIVED="push-msg-received",t.NOTIFICATION_CLICKED="notification-clicked"}(o||(o={}));var _=function(){function t(){}return t.prototype.getToken=function(t,e,n){return Object(s.__awaiter)(this,void 0,void 0,function(){var r,i,o,a,u,l,f,_;return Object(s.__generator)(this,function(s){switch(s.label){case 0:r=g(e.getKey("p256dh")),i=g(e.getKey("auth")),o="authorized_entity="+t+"&endpoint="+e.endpoint+"&encryption_key="+r+"&encryption_auth="+i,n!==d&&(a=g(n),o+="&application_pub_key="+a),(u=new Headers).append("Content-Type","application/x-www-form-urlencoded"),l={method:"POST",headers:u,body:o},s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(p+"/fcm/connect/subscribe",l)];case 2:return[4,s.sent().json()];case 3:return f=s.sent(),[3,5];case 4:throw s.sent(),h.create(c.TOKEN_SUBSCRIBE_FAILED);case 5:if(f.error)throw _=f.error.message,h.create(c.TOKEN_SUBSCRIBE_FAILED,{message:_});if(!f.token)throw h.create(c.TOKEN_SUBSCRIBE_NO_TOKEN);if(!f.pushSet)throw h.create(c.TOKEN_SUBSCRIBE_NO_PUSH_SET);return[2,{token:f.token,pushSet:f.pushSet}]}})})},t.prototype.updateToken=function(t,e,n,r,i){return Object(s.__awaiter)(this,void 0,void 0,function(){var o,a,u,l,f,_,v,m;return Object(s.__generator)(this,function(s){switch(s.label){case 0:o=g(r.getKey("p256dh")),a=g(r.getKey("auth")),u="push_set="+n+"&token="+e+"&authorized_entity="+t+"&endpoint="+r.endpoint+"&encryption_key="+o+"&encryption_auth="+a,i!==d&&(l=g(i),u+="&application_pub_key="+l),(f=new Headers).append("Content-Type","application/x-www-form-urlencoded"),_={method:"POST",headers:f,body:u},s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(p+"/fcm/connect/subscribe",_)];case 2:return[4,s.sent().json()];case 3:return v=s.sent(),[3,5];case 4:throw s.sent(),h.create(c.TOKEN_UPDATE_FAILED);case 5:if(v.error)throw m=v.error.message,h.create(c.TOKEN_UPDATE_FAILED,{message:m});if(!v.token)throw h.create(c.TOKEN_UPDATE_NO_TOKEN);return[2,v.token]}})})},t.prototype.deleteToken=function(t,e,n){return Object(s.__awaiter)(this,void 0,void 0,function(){var r,i,o,a,u;return Object(s.__generator)(this,function(s){switch(s.label){case 0:r="authorized_entity="+t+"&token="+e+"&pushSet="+n,(i=new Headers).append("Content-Type","application/x-www-form-urlencoded"),o={method:"POST",headers:i,body:r},s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(p+"/fcm/connect/unsubscribe",o)];case 2:return[4,s.sent().json()];case 3:if((a=s.sent()).error)throw u=a.error.message,h.create(c.TOKEN_UNSUBSCRIBE_FAILED,{message:u});return[3,5];case 4:throw s.sent(),h.create(c.TOKEN_UNSUBSCRIBE_FAILED);case 5:return[2]}})})},t}();function v(t){for(var e=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=window.atob(e),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}var m="undefined",y="fcm_token_object_Store";function b(){var t=indexedDB.open(m);t.onerror=function(t){},t.onsuccess=function(e){!function(t){if(t.objectStoreNames.contains(y)){var e=t.transaction(y).objectStore(y),n=new _,r=e.openCursor();r.onerror=function(t){console.warn("Unable to cleanup old IDB.",t)},r.onsuccess=function(){var e=r.result;if(e){var i=e.value;n.deleteToken(i.fcmSenderId,i.fcmToken,i.fcmPushSet),e.continue()}else t.close(),indexedDB.deleteDatabase(m)}}}(t.result)}}var w=function(){function t(){this.dbPromise=null}return t.prototype.get=function(t){return this.createTransaction(function(e){return e.get(t)})},t.prototype.getIndex=function(t,e){return this.createTransaction(function(n){return n.index(t).get(e)})},t.prototype.put=function(t){return this.createTransaction(function(e){return e.put(t)},"readwrite")},t.prototype.delete=function(t){return this.createTransaction(function(e){return e.delete(t)},"readwrite")},t.prototype.closeDatabase=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){switch(t.label){case 0:return this.dbPromise?[4,this.dbPromise]:[3,2];case 1:t.sent().close(),this.dbPromise=null,t.label=2;case 2:return[2]}})})},t.prototype.createTransaction=function(t,e){return Object(s.__awaiter)(this,void 0,void 0,function(){var n,r,i,o;return Object(s.__generator)(this,function(a){switch(a.label){case 0:return[4,this.getDb()];case 1:return n=a.sent(),r=n.transaction(this.objectStoreName,e),i=r.objectStore(this.objectStoreName),[4,function(t){return new Promise(function(e,n){t.onsuccess=function(){e(t.result)},t.onerror=function(){n(t.error)}})}(t(i))];case 2:return o=a.sent(),[2,new Promise(function(t,e){r.oncomplete=function(){t(o)},r.onerror=function(){e(r.error)}})]}})})},t.prototype.getDb=function(){var t=this;return this.dbPromise||(this.dbPromise=new Promise(function(e,n){var r=indexedDB.open(t.dbName,t.dbVersion);r.onsuccess=function(){e(r.result)},r.onerror=function(){t.dbPromise=null,n(r.error)},r.onupgradeneeded=function(e){return t.onDbUpgrade(r,e)}})),this.dbPromise},t}();var C=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dbName="fcm_token_details_db",e.dbVersion=3,e.objectStoreName="fcm_token_object_Store",e}return Object(s.__extends)(e,t),e.prototype.onDbUpgrade=function(t,e){var n=t.result;switch(e.oldVersion){case 0:(r=n.createObjectStore(this.objectStoreName,{keyPath:"swScope"})).createIndex("fcmSenderId","fcmSenderId",{unique:!1}),r.createIndex("fcmToken","fcmToken",{unique:!0});case 1:b();case 2:var r,i=(r=t.transaction.objectStore(this.objectStoreName)).openCursor();i.onsuccess=function(){var t=i.result;if(t){var e=t.value,n=Object(s.__assign)({},e);e.createTime||(n.createTime=Date.now()),"string"==typeof e.vapidKey&&(n.vapidKey=v(e.vapidKey)),"string"==typeof e.auth&&(n.auth=v(e.auth).buffer),"string"==typeof e.auth&&(n.p256dh=v(e.p256dh).buffer),t.update(n),t.continue()}}}},e.prototype.getTokenDetailsFromToken=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(e){if(!t)throw h.create(c.BAD_TOKEN);return E({fcmToken:t}),[2,this.getIndex("fcmToken",t)]})})},e.prototype.getTokenDetailsFromSWScope=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(e){if(!t)throw h.create(c.BAD_SCOPE);return E({swScope:t}),[2,this.get(t)]})})},e.prototype.saveTokenDetails=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(e){if(!t.swScope)throw h.create(c.BAD_SCOPE);if(!t.vapidKey)throw h.create(c.BAD_VAPID_KEY);if(!t.endpoint||!t.auth||!t.p256dh)throw h.create(c.BAD_SUBSCRIPTION);if(!t.fcmSenderId)throw h.create(c.BAD_SENDER_ID);if(!t.fcmToken)throw h.create(c.BAD_TOKEN);if(!t.fcmPushSet)throw h.create(c.BAD_PUSH_SET);return E(t),[2,this.put(t)]})})},e.prototype.deleteToken=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:return"string"!=typeof t||0===t.length?[2,Promise.reject(h.create(c.INVALID_DELETE_TOKEN))]:[4,this.getTokenDetailsFromToken(t)];case 1:if(!(e=n.sent()))throw h.create(c.DELETE_TOKEN_NOT_FOUND);return[4,this.delete(e.swScope)];case 2:return n.sent(),[2,e]}})})},e}(w);function E(t){if(t.fcmToken&&("string"!=typeof t.fcmToken||0===t.fcmToken.length))throw h.create(c.BAD_TOKEN);if(t.swScope&&("string"!=typeof t.swScope||0===t.swScope.length))throw h.create(c.BAD_SCOPE);if(t.vapidKey&&(!(t.vapidKey instanceof Uint8Array)||65!==t.vapidKey.length))throw h.create(c.BAD_VAPID_KEY);if(t.endpoint&&("string"!=typeof t.endpoint||0===t.endpoint.length))throw h.create(c.BAD_SUBSCRIPTION);if(t.auth&&!(t.auth instanceof ArrayBuffer))throw h.create(c.BAD_SUBSCRIPTION);if(t.p256dh&&!(t.p256dh instanceof ArrayBuffer))throw h.create(c.BAD_SUBSCRIPTION);if(t.fcmSenderId&&("string"!=typeof t.fcmSenderId||0===t.fcmSenderId.length))throw h.create(c.BAD_SENDER_ID);if(t.fcmPushSet&&("string"!=typeof t.fcmPushSet||0===t.fcmPushSet.length))throw h.create(c.BAD_PUSH_SET)}var x=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dbName="fcm_vapid_details_db",e.dbVersion=1,e.objectStoreName="fcm_vapid_object_Store",e}return Object(s.__extends)(e,t),e.prototype.onDbUpgrade=function(t){t.result.createObjectStore(this.objectStoreName,{keyPath:"swScope"})},e.prototype.getVapidFromSWScope=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:if("string"!=typeof t||0===t.length)throw h.create(c.BAD_SCOPE);return[4,this.get(t)];case 1:return[2,(e=n.sent())?e.vapidKey:void 0]}})})},e.prototype.saveVapidDetails=function(t,e){return Object(s.__awaiter)(this,void 0,void 0,function(){var n;return Object(s.__generator)(this,function(r){if("string"!=typeof t||0===t.length)throw h.create(c.BAD_SCOPE);if(null===e||65!==e.length)throw h.create(c.BAD_VAPID_KEY);return n={swScope:t,vapidKey:e},[2,this.put(n)]})})},e.prototype.deleteVapidDetails=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:return[4,this.getVapidFromSWScope(t)];case 1:if(!(e=n.sent()))throw h.create(c.DELETE_SCOPE_NOT_FOUND);return[4,this.delete(t)];case 2:return n.sent(),[2,e]}})})},e}(w),A="messagingSenderId",S=function(){function t(t){var e=this;if(!t.options[A]||"string"!=typeof t.options[A])throw h.create(c.BAD_SENDER_ID);this.messagingSenderId=t.options[A],this.tokenDetailsModel=new C,this.vapidDetailsModel=new x,this.iidModel=new _,this.app=t,this.INTERNAL={delete:function(){return e.delete()}}}return t.prototype.getToken=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){var t,e,n,r,i;return Object(s.__generator)(this,function(o){switch(o.label){case 0:return"granted"!==(t=this.getNotificationPermission_())?"denied"===t?[2,Promise.reject(h.create(c.NOTIFICATIONS_BLOCKED))]:[2,Promise.resolve(null)]:[4,this.getSWRegistration_()];case 1:return e=o.sent(),[4,this.getPublicVapidKey_()];case 2:return n=o.sent(),[4,this.getPushSubscription(e,n)];case 3:return r=o.sent(),[4,this.tokenDetailsModel.getTokenDetailsFromSWScope(e.scope)];case 4:return(i=o.sent())?[2,this.manageExistingToken(e,r,n,i)]:[2,this.getNewToken(e,r,n)]}})})},t.prototype.manageExistingToken=function(t,e,n,r){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(i){switch(i.label){case 0:return function(t,e,n){if(!f(e.buffer,n.vapidKey.buffer))return!1;var r=t.endpoint===n.endpoint,i=f(t.getKey("auth"),n.auth),o=f(t.getKey("p256dh"),n.p256dh);return r&&i&&o}(e,n,r)?Date.now()<r.createTime+6048e5?[2,r.fcmToken]:[2,this.updateToken(t,e,n,r)]:[4,this.deleteTokenFromDB(r.fcmToken)];case 1:return i.sent(),[2,this.getNewToken(t,e,n)]}})})},t.prototype.updateToken=function(t,e,n,r){return Object(s.__awaiter)(this,void 0,void 0,function(){var i,o,a;return Object(s.__generator)(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,6]),[4,this.iidModel.updateToken(this.messagingSenderId,r.fcmToken,r.fcmPushSet,e,n)];case 1:return i=s.sent(),o={swScope:t.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:i,fcmPushSet:r.fcmPushSet,createTime:Date.now(),endpoint:e.endpoint,auth:e.getKey("auth"),p256dh:e.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(o)];case 2:return s.sent(),[4,this.vapidDetailsModel.saveVapidDetails(t.scope,n)];case 3:return s.sent(),[2,i];case 4:return a=s.sent(),[4,this.deleteToken(r.fcmToken)];case 5:throw s.sent(),a;case 6:return[2]}})})},t.prototype.getNewToken=function(t,e,n){return Object(s.__awaiter)(this,void 0,void 0,function(){var r,i;return Object(s.__generator)(this,function(o){switch(o.label){case 0:return[4,this.iidModel.getToken(this.messagingSenderId,e,n)];case 1:return r=o.sent(),i={swScope:t.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:r.token,fcmPushSet:r.pushSet,createTime:Date.now(),endpoint:e.endpoint,auth:e.getKey("auth"),p256dh:e.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(i)];case 2:return o.sent(),[4,this.vapidDetailsModel.saveVapidDetails(t.scope,n)];case 3:return o.sent(),[2,r.token]}})})},t.prototype.deleteToken=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n;return Object(s.__generator)(this,function(r){switch(r.label){case 0:return[4,this.deleteTokenFromDB(t)];case 1:return r.sent(),[4,this.getSWRegistration_()];case 2:return(e=r.sent())?[4,e.pushManager.getSubscription()]:[3,4];case 3:if(n=r.sent())return[2,n.unsubscribe()];r.label=4;case 4:return[2,!0]}})})},t.prototype.deleteTokenFromDB=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:return[4,this.tokenDetailsModel.deleteToken(t)];case 1:return e=n.sent(),[4,this.iidModel.deleteToken(e.fcmSenderId,e.fcmToken,e.fcmPushSet)];case 2:return n.sent(),[2]}})})},t.prototype.getPushSubscription=function(t,e){return t.pushManager.getSubscription().then(function(n){return n||t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e})})},t.prototype.requestPermission=function(){throw h.create(c.AVAILABLE_IN_WINDOW)},t.prototype.useServiceWorker=function(t){throw h.create(c.AVAILABLE_IN_WINDOW)},t.prototype.usePublicVapidKey=function(t){throw h.create(c.AVAILABLE_IN_WINDOW)},t.prototype.onMessage=function(t,e,n){throw h.create(c.AVAILABLE_IN_WINDOW)},t.prototype.onTokenRefresh=function(t,e,n){throw h.create(c.AVAILABLE_IN_WINDOW)},t.prototype.setBackgroundMessageHandler=function(t){throw h.create(c.AVAILABLE_IN_SW)},t.prototype.delete=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.tokenDetailsModel.closeDatabase(),this.vapidDetailsModel.closeDatabase()])];case 1:return t.sent(),[2]}})})},t.prototype.getNotificationPermission_=function(){return Notification.permission},t.prototype.getTokenDetailsModel=function(){return this.tokenDetailsModel},t.prototype.getVapidDetailsModel=function(){return this.vapidDetailsModel},t.prototype.getIIDModel=function(){return this.iidModel},t}();var k=function(t){function e(e){var n=t.call(this,e)||this;return n.bgMessageHandler=null,self.addEventListener("push",function(t){n.onPush(t)}),self.addEventListener("pushsubscriptionchange",function(t){n.onSubChange(t)}),self.addEventListener("notificationclick",function(t){n.onNotificationClick(t)}),n}return Object(s.__extends)(e,t),e.prototype.onPush=function(t){t.waitUntil(this.onPush_(t))},e.prototype.onSubChange=function(t){t.waitUntil(this.onSubChange_(t))},e.prototype.onNotificationClick=function(t){t.waitUntil(this.onNotificationClick_(t))},e.prototype.onPush_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n,r;return Object(s.__generator)(this,function(i){switch(i.label){case 0:if(!t.data)return[2];try{e=t.data.json()}catch(t){return[2]}return[4,this.hasVisibleClients_()];case 1:return i.sent()?e.notification||this.bgMessageHandler?[2,this.sendMessageToWindowClients_(e)]:[2]:(n=this.getNotificationData_(e))?(r=n.title||"",[4,this.getSWRegistration_()]):[3,3];case 2:return[2,i.sent().showNotification(r,n)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(e)]:[3,5];case 4:return i.sent(),[2];case 5:return[2]}})})},e.prototype.onSubChange_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var t,e,n,r;return Object(s.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return t=i.sent(),[3,3];case 2:throw e=i.sent(),h.create(c.UNABLE_TO_RESUBSCRIBE,{message:e});case 3:return i.trys.push([3,5,,8]),[4,t.pushManager.getSubscription()];case 4:return i.sent(),[3,8];case 5:return n=i.sent(),[4,this.getTokenDetailsModel().getTokenDetailsFromSWScope(t.scope)];case 6:if(!(r=i.sent()))throw n;return[4,this.deleteToken(r.fcmToken)];case 7:throw i.sent(),n;case 8:return[2]}})})},e.prototype.onNotificationClick_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n,r,i;return Object(s.__generator)(this,function(a){switch(a.label){case 0:return t.notification&&t.notification.data&&t.notification.data.FCM_MSG?(t.stopImmediatePropagation(),t.notification.close(),(e=t.notification.data.FCM_MSG).notification&&(n=e.notification.click_action)?[4,this.getWindowClient_(n)]:[2]):[2];case 1:return(r=a.sent())?[3,3]:[4,self.clients.openWindow(n)];case 2:return r=a.sent(),[3,5];case 3:return[4,r.focus()];case 4:r=a.sent(),a.label=5;case 5:return r?(delete e.notification,i=P(o.NOTIFICATION_CLICKED,e),[2,this.attemptToMessageClient_(r,i)]):[2]}})})},e.prototype.getNotificationData_=function(t){if(t&&"object"==typeof t.notification){var e,n=Object(s.__assign)({},t.notification);return n.data=((e={}).FCM_MSG=t,e),n}},e.prototype.setBackgroundMessageHandler=function(t){if(!t||"function"!=typeof t)throw h.create(c.BG_HANDLER_FUNCTION_EXPECTED);this.bgMessageHandler=t},e.prototype.getWindowClient_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n,r,i;return Object(s.__generator)(this,function(o){switch(o.label){case 0:return e=new URL(t,self.location.href).href,[4,T()];case 1:for(n=o.sent(),r=null,i=0;i<n.length;i++)if(new URL(n[i].url,self.location.href).href===e){r=n[i];break}return[2,r]}})})},e.prototype.attemptToMessageClient_=function(t,e){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(n){if(!t)throw h.create(c.NO_WINDOW_CLIENT_TO_MSG);return t.postMessage(e),[2]})})},e.prototype.hasVisibleClients_=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){switch(t.label){case 0:return[4,T()];case 1:return[2,t.sent().some(function(t){return"visible"===t.visibilityState})]}})})},e.prototype.sendMessageToWindowClients_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n,r=this;return Object(s.__generator)(this,function(i){switch(i.label){case 0:return[4,T()];case 1:return e=i.sent(),n=P(o.PUSH_MSG_RECEIVED,t),[4,Promise.all(e.map(function(t){return r.attemptToMessageClient_(t,n)}))];case 2:return i.sent(),[2]}})})},e.prototype.getSWRegistration_=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){return[2,self.registration]})})},e.prototype.getPublicVapidKey_=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){var t,e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:return[4,this.getSWRegistration_()];case 1:if(!(t=n.sent()))throw h.create(c.SW_REGISTRATION_EXPECTED);return[4,this.getVapidDetailsModel().getVapidFromSWScope(t.scope)];case 2:return null==(e=n.sent())?[2,d]:[2,e]}})})},e}(S);function T(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function P(t,e){return(n={})[i.TYPE_OF_MSG]=t,n[i.DATA]=e,n;var n}var I=function(t){function e(e){var n=t.call(this,e)||this;return n.registrationToUse=null,n.publicVapidKeyToUse=null,n.manifestCheckPromise=null,n.messageObserver=null,n.tokenRefreshObserver=null,n.onMessageInternal=Object(a.createSubscribe)(function(t){n.messageObserver=t}),n.onTokenRefreshInternal=Object(a.createSubscribe)(function(t){n.tokenRefreshObserver=t}),n.setupSWMessageListener_(),n}return Object(s.__extends)(e,t),e.prototype.getToken=function(){var e=this;return this.isSupported_()?this.manifestCheck_().then(function(){return t.prototype.getToken.call(e)}):Promise.reject(h.create(c.UNSUPPORTED_BROWSER))},e.prototype.manifestCheck_=function(){if(this.manifestCheckPromise)return this.manifestCheckPromise;var t=document.querySelector('link[rel="manifest"]');return this.manifestCheckPromise=t?fetch(t.href).then(function(t){return t.json()}).catch(function(){}).then(function(t){if(t&&t.gcm_sender_id&&"103953800507"!==t.gcm_sender_id)throw h.create(c.INCORRECT_GCM_SENDER_ID)}):Promise.resolve(),this.manifestCheckPromise},e.prototype.requestPermission=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){return"granted"===Notification.permission?[2]:[2,new Promise(function(t,e){var n=function(n){return"granted"===n?t():e("denied"===n?h.create(c.PERMISSION_BLOCKED):h.create(c.PERMISSION_DEFAULT))},r=Notification.requestPermission(n);r&&r.then(n)})]})})},e.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw h.create(c.SW_REGISTRATION_EXPECTED);if(null!=this.registrationToUse)throw h.create(c.USE_SW_BEFORE_GET_TOKEN);this.registrationToUse=t},e.prototype.usePublicVapidKey=function(t){if("string"!=typeof t)throw h.create(c.INVALID_PUBLIC_VAPID_KEY);if(null!=this.publicVapidKeyToUse)throw h.create(c.USE_PUBLIC_KEY_BEFORE_GET_TOKEN);var e=v(t);if(65!==e.length)throw h.create(c.PUBLIC_KEY_DECRYPTION_FAILED);this.publicVapidKeyToUse=e},e.prototype.onMessage=function(t,e,n){return"function"==typeof t?this.onMessageInternal(t,e,n):this.onMessageInternal(t)},e.prototype.onTokenRefresh=function(t,e,n){return"function"==typeof t?this.onTokenRefreshInternal(t,e,n):this.onTokenRefreshInternal(t)},e.prototype.waitForRegistrationToActivate_=function(t){var e=t.installing||t.waiting||t.active;return new Promise(function(n,r){if(e)if("activated"!==e.state)if("redundant"!==e.state){var i=function(){if("activated"===e.state)n(t);else{if("redundant"!==e.state)return;r(h.create(c.SW_REG_REDUNDANT))}e.removeEventListener("statechange",i)};e.addEventListener("statechange",i)}else r(h.create(c.SW_REG_REDUNDANT));else n(t);else r(h.create(c.NO_SW_IN_REG))})},e.prototype.getSWRegistration_=function(){var t=this;return this.registrationToUse?this.waitForRegistrationToActivate_(this.registrationToUse):(this.registrationToUse=null,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}).catch(function(t){throw h.create(c.FAILED_DEFAULT_REGISTRATION,{browserErrorMessage:t.message})}).then(function(e){return t.waitForRegistrationToActivate_(e).then(function(){return t.registrationToUse=e,e.update(),e})}))},e.prototype.getPublicVapidKey_=function(){return this.publicVapidKeyToUse?Promise.resolve(this.publicVapidKeyToUse):Promise.resolve(d)},e.prototype.setupSWMessageListener_=function(){var t=this;"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",function(e){if(e.data&&e.data[i.TYPE_OF_MSG]){var n=e.data;switch(n[i.TYPE_OF_MSG]){case o.PUSH_MSG_RECEIVED:case o.NOTIFICATION_CLICKED:var r=n[i.DATA];t.messageObserver&&t.messageObserver.next(r)}}},!1)},e.prototype.isSupported_=function(){return"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")},e}(S);function O(t){var e={Messaging:I};t.INTERNAL.registerService("messaging",function(t){return self&&"ServiceWorkerGlobalScope"in self?new k(t):new I(t)},e)}O(u.default)},function(t,e,n){n(63)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"registerStorage",function(){return Wt});var r=n(7),i="https://firebasestorage.googleapis.com",o="https://firebasestorage.googleapis.com",a="/v0",s="/v0",u=12e4,c=6e4,l=-9007199254740991,h=function(){function t(t,e){this.code_=p(t),this.message_="Firebase Storage: "+e,this.serverResponse_=null,this.name_="FirebaseError"}return t.prototype.codeProp=function(){return this.code},t.prototype.codeEquals=function(t){return p(t)===this.codeProp()},t.prototype.serverResponseProp=function(){return this.serverResponse_},t.prototype.setServerResponseProp=function(t){this.serverResponse_=t},Object.defineProperty(t.prototype,"name",{get:function(){return this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"code",{get:function(){return this.code_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"message",{get:function(){return this.message_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!0,configurable:!0}),t}(),d={UNKNOWN:"unknown",OBJECT_NOT_FOUND:"object-not-found",BUCKET_NOT_FOUND:"bucket-not-found",PROJECT_NOT_FOUND:"project-not-found",QUOTA_EXCEEDED:"quota-exceeded",UNAUTHENTICATED:"unauthenticated",UNAUTHORIZED:"unauthorized",RETRY_LIMIT_EXCEEDED:"retry-limit-exceeded",INVALID_CHECKSUM:"invalid-checksum",CANCELED:"canceled",INVALID_EVENT_NAME:"invalid-event-name",INVALID_URL:"invalid-url",INVALID_DEFAULT_BUCKET:"invalid-default-bucket",NO_DEFAULT_BUCKET:"no-default-bucket",CANNOT_SLICE_BLOB:"cannot-slice-blob",SERVER_FILE_WRONG_SIZE:"server-file-wrong-size",NO_DOWNLOAD_URL:"no-download-url",INVALID_ARGUMENT:"invalid-argument",INVALID_ARGUMENT_COUNT:"invalid-argument-count",APP_DELETED:"app-deleted",INVALID_ROOT_OPERATION:"invalid-root-operation",INVALID_FORMAT:"invalid-format",INTERNAL_ERROR:"internal-error"};function p(t){return"storage/"+t}function f(){return new h(d.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function g(){return new h(d.CANCELED,"User canceled the upload/download.")}function _(){return new h(d.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function v(t,e,n){return new h(d.INVALID_ARGUMENT,"Invalid argument in `"+e+"` at index "+t+": "+n)}function m(){return new h(d.APP_DELETED,"The Firebase app was deleted.")}function y(t,e){return new h(d.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function b(t){throw new h(d.INTERNAL_ERROR,"Internal error: "+t)}var w={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};function C(t){switch(t){case w.RAW:case w.BASE64:case w.BASE64URL:case w.DATA_URL:return;default:throw"Expected one of the event types: ["+w.RAW+", "+w.BASE64+", "+w.BASE64URL+", "+w.DATA_URL+"]."}}var E=function(){return function(t,e){this.data=t,this.contentType=e||null}}();function x(t,e){switch(t){case w.RAW:return new E(A(e));case w.BASE64:case w.BASE64URL:return new E(S(t,e));case w.DATA_URL:return new E(function(t){var e=new k(t);return e.base64?S(w.BASE64,e.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw y(w.DATA_URL,"Malformed data URL.")}return A(e)}(e.rest)}(e),function(t){return new k(t).contentType}(e))}throw f()}function A(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|63&r);else if(55296==(64512&r))if(n<t.length-1&&56320==(64512&t.charCodeAt(n+1)))r=65536|(1023&r)<<10|1023&t.charCodeAt(++n),e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r);else e.push(239,191,189);else 56320==(64512&r)?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(e)}function S(t,e){switch(t){case w.BASE64:var n=-1!==e.indexOf("-"),r=-1!==e.indexOf("_");if(n||r)throw y(t,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case w.BASE64URL:var i=-1!==e.indexOf("+"),o=-1!==e.indexOf("/");if(i||o)throw y(t,"Invalid character '"+(i?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/")}var a;try{a=atob(e)}catch(e){throw y(t,"Invalid character found")}for(var s=new Uint8Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);return s}var k=function(){return function(t){this.base64=!1,this.contentType=null;var e=t.match(/^data:([^,]+)?,/);if(null===e)throw y(w.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var n=e[1]||null;null!=n&&(this.base64=(r=n,i=";base64",r.length>=i.length&&r.substring(r.length-i.length)===i),this.contentType=this.base64?n.substring(0,n.length-";base64".length):n),this.rest=t.substring(t.indexOf(",")+1);var r,i}}();var T,P={STATE_CHANGED:"state_changed"},I={RUNNING:"running",PAUSING:"pausing",PAUSED:"paused",SUCCESS:"success",CANCELING:"canceling",CANCELED:"canceled",ERROR:"error"},O={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function N(t){switch(t){case I.RUNNING:case I.PAUSING:case I.CANCELING:return O.RUNNING;case I.PAUSED:return O.PAUSED;case I.SUCCESS:return O.SUCCESS;case I.CANCELED:return O.CANCELED;case I.ERROR:default:return O.ERROR}}function R(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function D(t,e){for(var n in t)R(t,n)&&e(n,t[n])}function M(t){if(null==t)return{};var e={};return D(t,function(t,n){e[t]=n}),e}function L(t){return new Promise(t)}function j(t){return Promise.resolve(t)}function U(t){return null!=t}function F(t){return void 0!==t}function B(t){return"function"==typeof t}function V(t){return"object"==typeof t}function W(t){return V(t)&&null!==t}function G(t){return"string"==typeof t||t instanceof String}function H(t){return Y()&&t instanceof Blob}function Y(){return"undefined"!=typeof Blob}!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(T||(T={}));var z=function(){function t(){var t=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=T.NO_ERROR,this.sendPromise_=L(function(e,n){t.xhr_.addEventListener("abort",function(n){t.errorCode_=T.ABORT,e(t)}),t.xhr_.addEventListener("error",function(n){t.errorCode_=T.NETWORK_ERROR,e(t)}),t.xhr_.addEventListener("load",function(n){e(t)})})}return t.prototype.send=function(t,e,n,r){var i=this;if(this.sent_)throw b("cannot .send() more than once");(this.sent_=!0,this.xhr_.open(e,t,!0),U(r))&&D(r,function(t,e){i.xhr_.setRequestHeader(t,e.toString())});return U(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},t.prototype.getErrorCode=function(){if(!this.sent_)throw b("cannot .getErrorCode() before sending");return this.errorCode_},t.prototype.getStatus=function(){if(!this.sent_)throw b("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},t.prototype.getResponseText=function(){if(!this.sent_)throw b("cannot .getResponseText() before sending");return this.xhr_.responseText},t.prototype.abort=function(){this.xhr_.abort()},t.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},t.prototype.addUploadProgressListener=function(t){U(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",t)},t.prototype.removeUploadProgressListener=function(t){U(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",t)},t}(),q=function(){function t(){}return t.prototype.createXhrIo=function(){return new z},t}();function X(t){var e,n;try{e=JSON.parse(t)}catch(t){return null}return V(n=e)&&!Array.isArray(n)?e:null}var Q=function(){function t(t,e){this.bucket=t,this.path_=e}return Object.defineProperty(t.prototype,"path",{get:function(){return this.path_},enumerable:!0,configurable:!0}),t.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},t.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},t.makeFromBucketSpec=function(e){var n,r;try{n=t.makeFromUrl(e)}catch(n){return new t(e,"")}if(""===n.path)return n;throw r=e,new h(d.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+r+"'.")},t.makeFromUrl=function(e){var n=null;for(var r=[{regex:new RegExp("^gs://([A-Za-z0-9.\\-]+)(/(.*))?$","i"),indices:{bucket:1,path:3},postModify:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}},{regex:new RegExp("^https?://firebasestorage\\.googleapis\\.com/v[A-Za-z0-9_]+/b/([A-Za-z0-9.\\-]+)/o(/([^?#]*).*)?$","i"),indices:{bucket:1,path:3},postModify:function(t){t.path_=decodeURIComponent(t.path)}}],i=0;i<r.length;i++){var o=r[i],a=o.regex.exec(e);if(a){var s=a[o.indices.bucket],u=a[o.indices.path];u||(u=""),n=new t(s,u),o.postModify(n);break}}if(null==n)throw function(t){return new h(d.INVALID_URL,"Invalid URL '"+t+"'.")}(e);return n},t}();function K(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function Z(t){return i+a+t}function J(t){return i+s+t}function $(t){var e=encodeURIComponent,n="?";return D(t,function(t,r){var i=e(t)+"="+e(r);n=n+i+"&"}),n=n.slice(0,-1)}function tt(t,e){return e}var et=function(){return function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||tt}}(),nt=null;function rt(){if(nt)return nt;var t=[];t.push(new et("bucket")),t.push(new et("generation")),t.push(new et("metageneration")),t.push(new et("name","fullPath",!0));var e=new et("name");e.xform=function(t,e){return function(t){return!G(t)||t.length<2?t:K(t=t)}(e)},t.push(e);var n=new et("size");return n.xform=function(t,e){return U(e)?+e:e},t.push(n),t.push(new et("timeCreated")),t.push(new et("updated")),t.push(new et("md5Hash",null,!0)),t.push(new et("cacheControl",null,!0)),t.push(new et("contentDisposition",null,!0)),t.push(new et("contentEncoding",null,!0)),t.push(new et("contentLanguage",null,!0)),t.push(new et("contentType",null,!0)),t.push(new et("metadata","customMetadata",!0)),t.push(new et("downloadTokens","downloadURLs",!1,function(t,e){if(!(G(e)&&e.length>0))return[];var n=encodeURIComponent;return e.split(",").map(function(e){var r=t.bucket,i=t.fullPath;return function(t){return o+a+t}("/b/"+n(r)+"/o/"+n(i))+$({alt:"media",token:e})})})),nt=t}function it(t,e,n){for(var r={type:"file"},i=n.length,o=0;o<i;o++){var a=n[o];r[a.local]=a.xform(r,e[a.server])}return function(t,e){Object.defineProperty(t,"ref",{get:function(){var n=t.bucket,r=t.fullPath,i=new Q(n,r);return e.makeStorageReference(i)}})}(r,t),r}function ot(t,e){for(var n={},r=e.length,i=0;i<r;i++){var o=e[i];o.writable&&(n[o.server]=t[o.local])}return JSON.stringify(n)}function at(t){if(!(t&&V(t)))throw"Expected Metadata object.";for(var e in t){var n=t[e];if("customMetadata"===e){if(!V(n))throw"Expected object for 'customMetadata' mapping."}else if(W(n))throw"Mapping for '"+e+"' cannot be an object."}}function st(t,e,n){for(var r=e.length,i=e.length,o=0;o<e.length;o++)if(e[o].optional){r=o;break}var a,s,u,c,l,p;if(!(r<=n.length&&n.length<=i))throw a=r,s=i,u=t,c=n.length,a===s?(l=a,p=1===a?"argument":"arguments"):(l="between "+a+" and "+s,p="arguments"),new h(d.INVALID_ARGUMENT_COUNT,"Invalid argument count in `"+u+"`: Expected "+l+" "+p+", received "+c+".");for(o=0;o<n.length;o++)try{e[o].validator(n[o])}catch(e){throw e instanceof Error?v(o,t,e.message):v(o,t,e)}}var ut=function(){return function(t,e){var n=this;this.validator=function(e){n.optional&&!F(e)||t(e)},this.optional=!!e}}();function ct(t,e){function n(t){if(!G(t))throw"Expected string."}var r,i,o;return t?(i=n,o=t,r=function(t){i(t),o(t)}):r=n,new ut(r,e)}function lt(t){return new ut(at,t)}function ht(){return new ut(function(t){if(!(function(t){return"number"==typeof t||t instanceof Number}(t)&&t>=0))throw"Expected a number 0 or greater."})}function dt(t,e){return new ut(function(e){if(!(null===e||U(e)&&e instanceof Object))throw"Expected an Object.";void 0!==t&&null!==t&&t(e)},e)}function pt(t){return new ut(function(t){if(null!==t&&!B(t))throw"Expected a Function."},t)}function ft(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}var gt=function(){function t(t,e){var n=0,r="";H(t)?(this.data_=t,n=t.size,r=t.type):t instanceof ArrayBuffer?(e?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),n=this.data_.length):t instanceof Uint8Array&&(e?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),n=t.length),this.size_=n,this.type_=r}return t.prototype.size=function(){return this.size_},t.prototype.type=function(){return this.type_},t.prototype.slice=function(e,n){if(H(this.data_)){var r=this.data_,i=(a=e,s=n,(o=r).webkitSlice?o.webkitSlice(a,s):o.mozSlice?o.mozSlice(a,s):o.slice?o.slice(a,s):null);return null===i?null:new t(i)}var o,a,s;return new t(new Uint8Array(this.data_.buffer,e,n-e),!0)},t.getBlob=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(Y()){var r=e.map(function(e){return e instanceof t?e.data_:e});return new t(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ft();if(void 0!==n){for(var r=new n,i=0;i<t.length;i++)r.append(t[i]);return r.getBlob()}if(Y())return new Blob(t);throw Error("This browser doesn't seem to support creating Blobs")}.apply(null,r))}var i=e.map(function(t){return G(t)?x(w.RAW,t).data:t.data_}),o=0;i.forEach(function(t){o+=t.byteLength});var a=new Uint8Array(o),s=0;return i.forEach(function(t){for(var e=0;e<t.length;e++)a[s++]=t[e]}),new t(a,!0)},t.prototype.uploadData=function(){return this.data_},t}();function _t(t,e){return-1!==t.indexOf(e)}var vt=function(){return function(t,e,n,r){this.url=t,this.method=e,this.handler=n,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}();function mt(t){if(!t)throw f()}function yt(t,e){return function(n,r){var i=function(t,e,n){var r=X(e);return null===r?null:it(t,r,n)}(t,r,e);return mt(null!==i),i}}function bt(t){return function(e,n){var r,i,o;return 401===e.getStatus()?r=new h(d.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===e.getStatus()?(o=t.bucket,r=new h(d.QUOTA_EXCEEDED,"Quota for bucket '"+o+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===e.getStatus()?(i=t.path,r=new h(d.UNAUTHORIZED,"User does not have permission to access '"+i+"'.")):r=n,r.setServerResponseProp(n.serverResponseProp()),r}}function wt(t){var e=bt(t);return function(n,r){var i,o=e(n,r);return 404===n.getStatus()&&(i=t.path,o=new h(d.OBJECT_NOT_FOUND,"Object '"+i+"' does not exist.")),o.setServerResponseProp(r.serverResponseProp()),o}}function Ct(t,e,n){var r=Z(e.fullServerUrl()),i=t.maxOperationRetryTime(),o=new vt(r,"GET",yt(t,n),i);return o.errorHandler=wt(e),o}function Et(t,e,n){var r=M(n);return r.fullPath=t.path,r.size=e.size(),r.contentType||(r.contentType=function(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}(null,e)),r}var xt=function(){return function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null}}();function At(t,e){var n;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){mt(!1)}return mt(_t(e||["active"],n)),n}function St(t,e,n,r,i,o,a,s){var u=new xt(0,0);if(a?(u.current=a.current,u.total=a.total):(u.current=0,u.total=r.size()),r.size()!==u.total)throw new h(d.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");var c=u.total-u.current,l=c;i>0&&(l=Math.min(l,i));var p=u.current,f=p+l,g={"X-Goog-Upload-Command":l===c?"upload, finalize":"upload","X-Goog-Upload-Offset":u.current},v=r.slice(p,f);if(null===v)throw _();var m=e.maxUploadRetryTime(),y=new vt(n,"POST",function(t,n){var i,a=At(t,["active","final"]),s=u.current+l,c=r.size();return i="final"===a?yt(e,o)(t,n):null,new xt(s,c,"final"===a,i)},m);return y.headers=g,y.body=v.uploadData(),y.progressCallback=s||null,y.errorHandler=bt(t),y}var kt=function(){return function(t,e,n){if(B(t)||U(e)||U(n))this.next=t,this.error=e||null,this.complete=n||null;else{var r=t;this.next=r.next||null,this.error=r.error||null,this.complete=r.complete||null}}}(),Tt=function(){function t(t,e,n,r,i,o){this.bytesTransferred=t,this.totalBytes=e,this.state=n,this.metadata=r,this.task=i,this.ref=o}return Object.defineProperty(t.prototype,"downloadURL",{get:function(){if(null!==this.metadata){var t=this.metadata.downloadURLs;return null!=t&&null!=t[0]?t[0]:null}return null},enumerable:!0,configurable:!0}),t}();function Pt(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];j(!0).then(function(){t.apply(null,e)})}}var It=function(){function t(t,e,n,r,i,o){void 0===o&&(o=null);var a=this;this.transferred_=0,this.needToFetchStatus_=!1,this.needToFetchMetadata_=!1,this.observers_=[],this.error_=null,this.uploadUrl_=null,this.request_=null,this.chunkMultiplier_=1,this.resolve_=null,this.reject_=null,this.ref_=t,this.authWrapper_=e,this.location_=n,this.blob_=i,this.metadata_=o,this.mappings_=r,this.resumable_=this.shouldDoResumable_(this.blob_),this.state_=I.RUNNING,this.errorHandler_=function(t){a.request_=null,a.chunkMultiplier_=1,t.codeEquals(d.CANCELED)?(a.needToFetchStatus_=!0,a.completeTransitions_()):(a.error_=t,a.transition_(I.ERROR))},this.metadataErrorHandler_=function(t){a.request_=null,t.codeEquals(d.CANCELED)?a.completeTransitions_():(a.error_=t,a.transition_(I.ERROR))},this.promise_=L(function(t,e){a.resolve_=t,a.reject_=e,a.start_()}),this.promise_.then(null,function(){})}return t.prototype.makeProgressCallback_=function(){var t=this,e=this.transferred_;return function(n,r){t.updateProgress_(e+n)}},t.prototype.shouldDoResumable_=function(t){return t.size()>262144},t.prototype.start_=function(){this.state_===I.RUNNING&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},t.prototype.resolveToken_=function(t){var e=this;this.authWrapper_.getAuthToken().then(function(n){switch(e.state_){case I.RUNNING:t(n);break;case I.CANCELING:e.transition_(I.CANCELED);break;case I.PAUSING:e.transition_(I.PAUSED)}})},t.prototype.createResumable_=function(){var t=this;this.resolveToken_(function(e){var n=function(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a=Et(e,r,i),s={name:a.fullPath},u=J(o),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":r.size(),"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},l=ot(a,n),h=t.maxUploadRetryTime(),d=new vt(u,"POST",function(t,e){var n;At(t);try{n=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){mt(!1)}return mt(G(n)),n},h);return d.urlParams=s,d.headers=c,d.body=l,d.errorHandler=bt(e),d}(t.authWrapper_,t.location_,t.mappings_,t.blob_,t.metadata_),r=t.authWrapper_.makeRequest(n,e);t.request_=r,r.getPromise().then(function(e){t.request_=null,t.uploadUrl_=e,t.needToFetchStatus_=!1,t.completeTransitions_()},t.errorHandler_)})},t.prototype.fetchStatus_=function(){var t=this,e=this.uploadUrl_;this.resolveToken_(function(n){var r=function(t,e,n,r){var i=t.maxUploadRetryTime(),o=new vt(n,"POST",function(t,e){var n,i=At(t,["active","final"]);try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){mt(!1)}var o=parseInt(n,10);return mt(!isNaN(o)),new xt(o,r.size(),"final"===i)},i);return o.headers={"X-Goog-Upload-Command":"query"},o.errorHandler=bt(e),o}(t.authWrapper_,t.location_,e,t.blob_),i=t.authWrapper_.makeRequest(r,n);t.request_=i,i.getPromise().then(function(e){e=e,t.request_=null,t.updateProgress_(e.current),t.needToFetchStatus_=!1,e.finalized&&(t.needToFetchMetadata_=!0),t.completeTransitions_()},t.errorHandler_)})},t.prototype.continueUpload_=function(){var t=this,e=262144*this.chunkMultiplier_,n=new xt(this.transferred_,this.blob_.size()),r=this.uploadUrl_;this.resolveToken_(function(i){var o;try{o=St(t.location_,t.authWrapper_,r,t.blob_,e,t.mappings_,n,t.makeProgressCallback_())}catch(e){return t.error_=e,void t.transition_(I.ERROR)}var a=t.authWrapper_.makeRequest(o,i);t.request_=a,a.getPromise().then(function(e){t.increaseMultiplier_(),t.request_=null,t.updateProgress_(e.current),e.finalized?(t.metadata_=e.metadata,t.transition_(I.SUCCESS)):t.completeTransitions_()},t.errorHandler_)})},t.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},t.prototype.fetchMetadata_=function(){var t=this;this.resolveToken_(function(e){var n=Ct(t.authWrapper_,t.location_,t.mappings_),r=t.authWrapper_.makeRequest(n,e);t.request_=r,r.getPromise().then(function(e){t.request_=null,t.metadata_=e,t.transition_(I.SUCCESS)},t.metadataErrorHandler_)})},t.prototype.oneShotUpload_=function(){var t=this;this.resolveToken_(function(e){var n=function(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"},s=function(){for(var t="",e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();a["Content-Type"]="multipart/related; boundary="+s;var u=Et(e,r,i),c="--"+s+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+ot(u,n)+"\r\n--"+s+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",l="\r\n--"+s+"--",h=gt.getBlob(c,r,l);if(null===h)throw _();var d={name:u.fullPath},p=J(o),f=t.maxUploadRetryTime(),g=new vt(p,"POST",yt(t,n),f);return g.urlParams=d,g.headers=a,g.body=h.uploadData(),g.errorHandler=bt(e),g}(t.authWrapper_,t.location_,t.mappings_,t.blob_,t.metadata_),r=t.authWrapper_.makeRequest(n,e);t.request_=r,r.getPromise().then(function(e){t.request_=null,t.metadata_=e,t.updateProgress_(t.blob_.size()),t.transition_(I.SUCCESS)},t.errorHandler_)})},t.prototype.updateProgress_=function(t){var e=this.transferred_;this.transferred_=t,this.transferred_!==e&&this.notifyObservers_()},t.prototype.transition_=function(t){if(this.state_!==t)switch(t){case I.CANCELING:case I.PAUSING:this.state_=t,null!==this.request_&&this.request_.cancel();break;case I.RUNNING:var e=this.state_===I.PAUSED;this.state_=t,e&&(this.notifyObservers_(),this.start_());break;case I.PAUSED:this.state_=t,this.notifyObservers_();break;case I.CANCELED:this.error_=g(),this.state_=t,this.notifyObservers_();break;case I.ERROR:case I.SUCCESS:this.state_=t,this.notifyObservers_()}},t.prototype.completeTransitions_=function(){switch(this.state_){case I.PAUSING:this.transition_(I.PAUSED);break;case I.CANCELING:this.transition_(I.CANCELED);break;case I.RUNNING:this.start_()}},Object.defineProperty(t.prototype,"snapshot",{get:function(){var t=N(this.state_);return new Tt(this.transferred_,this.blob_.size(),t,this.metadata_,this,this.ref_)},enumerable:!0,configurable:!0}),t.prototype.on=function(t,e,n,r){void 0===e&&(e=void 0),void 0===n&&(n=void 0),void 0===r&&(r=void 0);var i="Expected a function or an Object with one of `next`, `error`, `complete` properties.",o=pt(!0).validator,a=dt(null,!0).validator;function s(t){try{return void o(t)}catch(t){}try{if(a(t),!(F(t.next)||F(t.error)||F(t.complete)))throw"";return}catch(t){throw i}}st("on",[ct(function(e){if(t!==P.STATE_CHANGED)throw"Expected one of the event types: ["+P.STATE_CHANGED+"]."}),dt(s,!0),pt(!0),pt(!0)],arguments);var u=this;function c(t){return function(e,n,i){null!==t&&st("on",t,arguments);var o=new kt(e,n,r);return u.addObserver_(o),function(){u.removeObserver_(o)}}}var l=[dt(function(t){if(null===t)throw i;s(t)}),pt(!0),pt(!0)];return!(F(e)||F(n)||F(r))?c(l):c(null)(e,n,r)},t.prototype.then=function(t,e){return this.promise_.then(t,e)},t.prototype.catch=function(t){return this.then(null,t)},t.prototype.addObserver_=function(t){this.observers_.push(t),this.notifyObserver_(t)},t.prototype.removeObserver_=function(t){var e,n,r;e=this.observers_,n=t,-1!==(r=e.indexOf(n))&&e.splice(r,1)},t.prototype.notifyObservers_=function(){var t,e=this;this.finishPromise_(),(t=this.observers_,Array.prototype.slice.call(t)).forEach(function(t){e.notifyObserver_(t)})},t.prototype.finishPromise_=function(){if(null!==this.resolve_){var t=!0;switch(N(this.state_)){case O.SUCCESS:Pt(this.resolve_.bind(null,this.snapshot))();break;case O.CANCELED:case O.ERROR:Pt(this.reject_.bind(null,this.error_))();break;default:t=!1}t&&(this.resolve_=null,this.reject_=null)}},t.prototype.notifyObserver_=function(t){switch(N(this.state_)){case O.RUNNING:case O.PAUSED:null!==t.next&&Pt(t.next.bind(t,this.snapshot))();break;case O.SUCCESS:null!==t.complete&&Pt(t.complete.bind(t))();break;case O.CANCELED:case O.ERROR:null!==t.error&&Pt(t.error.bind(t,this.error_))();break;default:null!==t.error&&Pt(t.error.bind(t,this.error_))()}},t.prototype.resume=function(){st("resume",[],arguments);var t=this.state_===I.PAUSED||this.state_===I.PAUSING;return t&&this.transition_(I.RUNNING),t},t.prototype.pause=function(){st("pause",[],arguments);var t=this.state_===I.RUNNING;return t&&this.transition_(I.PAUSING),t},t.prototype.cancel=function(){st("cancel",[],arguments);var t=this.state_===I.RUNNING||this.state_===I.PAUSING;return t&&this.transition_(I.CANCELING),t},t}(),Ot=function(){function t(t,e){this.authWrapper=t,this.location=e instanceof Q?e:Q.makeFromUrl(e)}return t.prototype.toString=function(){return st("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},t.prototype.newRef=function(e,n){return new t(e,n)},t.prototype.mappings=function(){return rt()},t.prototype.child=function(t){st("child",[ct()],arguments);var e=function(t,e){var n=e.split("/").filter(function(t){return t.length>0}).join("/");return 0===t.length?n:t+"/"+n}(this.location.path,t),n=new Q(this.location.bucket,e);return this.newRef(this.authWrapper,n)},Object.defineProperty(t.prototype,"parent",{get:function(){var t=function(t){if(0==t.length)return null;var e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this.location.path);if(null===t)return null;var e=new Q(this.location.bucket,t);return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){var t=new Q(this.location.bucket,"");return this.newRef(this.authWrapper,t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return K(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"storage",{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),t.prototype.put=function(t,e){return void 0===e&&(e=null),st("put",[new ut(function(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer||Y()&&t instanceof Blob))throw"Expected Blob or File."}),lt(!0)],arguments),this.throwIfRoot_("put"),new It(this,this.authWrapper,this.location,this.mappings(),new gt(t),e)},t.prototype.putString=function(t,e,n){void 0===e&&(e=w.RAW),st("putString",[ct(),ct(C,!0),lt(!0)],arguments),this.throwIfRoot_("putString");var r=x(e,t),i=M(n);return!U(i.contentType)&&U(r.contentType)&&(i.contentType=r.contentType),new It(this,this.authWrapper,this.location,this.mappings(),new gt(r.data,!0),i)},t.prototype.delete=function(){st("delete",[],arguments),this.throwIfRoot_("delete");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=function(t,e){var n=Z(e.fullServerUrl()),r=t.maxOperationRetryTime(),i=new vt(n,"DELETE",function(t,e){},r);return i.successCodes=[200,204],i.errorHandler=wt(e),i}(t.authWrapper,t.location);return t.authWrapper.makeRequest(n,e).getPromise()})},t.prototype.getMetadata=function(){st("getMetadata",[],arguments),this.throwIfRoot_("getMetadata");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=Ct(t.authWrapper,t.location,t.mappings());return t.authWrapper.makeRequest(n,e).getPromise()})},t.prototype.updateMetadata=function(t){st("updateMetadata",[lt()],arguments),this.throwIfRoot_("updateMetadata");var e=this;return this.authWrapper.getAuthToken().then(function(n){var r=function(t,e,n,r){var i=Z(e.fullServerUrl()),o=ot(n,r),a=t.maxOperationRetryTime(),s=new vt(i,"PATCH",yt(t,r),a);return s.headers={"Content-Type":"application/json; charset=utf-8"},s.body=o,s.errorHandler=wt(e),s}(e.authWrapper,e.location,t,e.mappings());return e.authWrapper.makeRequest(r,n).getPromise()})},t.prototype.getDownloadURL=function(){return st("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL"),this.getMetadata().then(function(t){var e=t.downloadURLs[0];if(U(e))return e;throw new h(d.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")})},t.prototype.throwIfRoot_=function(t){if(""===this.location.path)throw function(t){return new h(d.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(t)},t}(),Nt=function(){function t(t){this.promise_=function(t){return Promise.reject(t)}(t)}return t.prototype.getPromise=function(){return this.promise_},t.prototype.cancel=function(t){void 0===t&&(t=!1)},t}(),Rt=function(){function t(){this.map_={},this.id_=l}return t.prototype.addRequest=function(t){var e=this.id_;this.id_++,this.map_[e]=t;var n=this;function r(){delete n.map_[e]}t.getPromise().then(r,r)},t.prototype.clear=function(){D(this.map_,function(t,e){e&&e.cancel(!0)}),this.map_={}},t}(),Dt=function(){function t(e,n,r,i,o){if(this.bucket_=null,this.deleted_=!1,this.app_=e,null!==this.app_){var a=this.app_.options;U(a)&&(this.bucket_=t.extractBucket_(a))}this.storageRefMaker_=n,this.requestMaker_=r,this.pool_=o,this.service_=i,this.maxOperationRetryTime_=u,this.maxUploadRetryTime_=c,this.requestMap_=new Rt}return t.extractBucket_=function(t){var e=t.storageBucket||null;return null==e?null:Q.makeFromBucketSpec(e).bucket},t.prototype.getAuthToken=function(){return null!==this.app_&&U(this.app_.INTERNAL)&&U(this.app_.INTERNAL.getToken)?this.app_.INTERNAL.getToken().then(function(t){return null!==t?t.accessToken:null},function(t){return null}):j(null)},t.prototype.bucket=function(){if(this.deleted_)throw m();return this.bucket_},t.prototype.service=function(){return this.service_},t.prototype.makeStorageReference=function(t){return this.storageRefMaker_(this,t)},t.prototype.makeRequest=function(t,e){if(this.deleted_)return new Nt(m());var n=this.requestMaker_(t,e,this.pool_);return this.requestMap_.addRequest(n),n},t.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requestMap_.clear()},t.prototype.maxUploadRetryTime=function(){return this.maxUploadRetryTime_},t.prototype.setMaxUploadRetryTime=function(t){this.maxUploadRetryTime_=t},t.prototype.maxOperationRetryTime=function(){return this.maxOperationRetryTime_},t.prototype.setMaxOperationRetryTime=function(t){this.maxOperationRetryTime_=t},t}();var Mt=function(){function t(t,e,n,r,i,o,a,s,u,c,l){this.pendingXhr_=null,this.backoffId_=null,this.resolve_=null,this.reject_=null,this.canceled_=!1,this.appDelete_=!1,this.url_=t,this.method_=e,this.headers_=n,this.body_=r,this.successCodes_=i.slice(),this.additionalRetryCodes_=o.slice(),this.callback_=a,this.errorCallback_=s,this.progressCallback_=c,this.timeout_=u,this.pool_=l;var h=this;this.promise_=L(function(t,e){h.resolve_=t,h.reject_=e,h.start_()})}return t.prototype.start_=function(){var t=this;function e(e,n){var r,i=t.resolve_,o=t.reject_,a=n.xhr;if(n.wasSuccessCode)try{var s=t.callback_(a,a.getResponseText());F(s)?i(s):i()}catch(t){o(t)}else null!==a?((r=f()).setServerResponseProp(a.getResponseText()),t.errorCallback_?o(t.errorCallback_(a,r)):o(r)):n.canceled?o(r=t.appDelete_?m():g()):o(r=new h(d.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again."))}this.canceled_?e(0,new Lt(!1,null,!0)):this.backoffId_=function(t,e,n){var r=1,i=null,o=!1,a=0;function s(){return 2===a}var u=!1;function c(){u||(u=!0,e.apply(null,arguments))}function l(e){i=setTimeout(function(){i=null,t(h,s())},e)}function h(t){for(var e,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];u||(t?c.apply(null,arguments):s()||o?c.apply(null,arguments):(r<64&&(r*=2),1===a?(a=2,e=0):e=1e3*(r+Math.random()),l(e)))}var d=!1;function p(t){d||(d=!0,u||(null!==i?(t||(a=2),clearTimeout(i),l(0)):t||(a=1)))}return l(0),setTimeout(function(){o=!0,p(!0)},n),p}(function(e,n){if(n)e(!1,new Lt(!1,null,!0));else{var r=t.pool_.createXhrIo();t.pendingXhr_=r,null!==t.progressCallback_&&r.addUploadProgressListener(i),r.send(t.url_,t.method_,t.body_,t.headers_).then(function(n){null!==t.progressCallback_&&n.removeUploadProgressListener(i),t.pendingXhr_=null;var r=(n=n).getErrorCode()===T.NO_ERROR,o=n.getStatus();if(r&&!t.isRetryStatusCode_(o)){var a=_t(t.successCodes_,o);e(!0,new Lt(a,n))}else{var s=n.getErrorCode()===T.ABORT;e(!1,new Lt(!1,null,s))}})}function i(e){var n=e.loaded,r=e.lengthComputable?e.total:-1;null!==t.progressCallback_&&t.progressCallback_(n,r)}},e,this.timeout_)},t.prototype.getPromise=function(){return this.promise_},t.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingXhr_&&this.pendingXhr_.abort()},t.prototype.isRetryStatusCode_=function(t){var e=t>=500&&t<600,n=_t([408,429],t),r=_t(this.additionalRetryCodes_,t);return e||n||r},t}(),Lt=function(){return function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n}}();function jt(t,e,n){var i=$(t.urlParams),o=t.url+i,a=M(t.headers);return function(t,e){null!==e&&e.length>0&&(t.Authorization="Firebase "+e)}(a,e),function(t){var e=void 0!==r.default?r.default.SDK_VERSION:"AppManager";t["X-Firebase-Storage-Version"]="webjs/"+e}(a),new Mt(o,t.method,a,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,n)}var Ut=function(){function t(t,e,n){if(this.bucket_=null,this.authWrapper_=new Dt(t,function(t,e){return new Ot(t,e)},jt,this,e),this.app_=t,null!=n)this.bucket_=Q.makeFromBucketSpec(n);else{var r=this.authWrapper_.bucket();null!=r&&(this.bucket_=new Q(r,""))}this.internals_=new Ft(this)}return t.prototype.ref=function(t){if(st("ref",[ct(function(t){if(/^[A-Za-z]+:\/\//.test(t))throw"Expected child path but got a URL, use refFromURL instead."},!0)],arguments),null==this.bucket_)throw new Error("No Storage Bucket defined in Firebase Options.");var e=new Ot(this.authWrapper_,this.bucket_);return null!=t?e.child(t):e},t.prototype.refFromURL=function(t){return st("refFromURL",[ct(function(t){if(!/^[A-Za-z]+:\/\//.test(t))throw"Expected full URL but got a child path, use ref instead.";try{Q.makeFromUrl(t)}catch(t){throw"Expected valid full URL but got an invalid one."}},!1)],arguments),new Ot(this.authWrapper_,t)},Object.defineProperty(t.prototype,"maxUploadRetryTime",{get:function(){return this.authWrapper_.maxUploadRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxUploadRetryTime=function(t){st("setMaxUploadRetryTime",[ht()],arguments),this.authWrapper_.setMaxUploadRetryTime(t)},Object.defineProperty(t.prototype,"maxOperationRetryTime",{get:function(){return this.authWrapper_.maxOperationRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxOperationRetryTime=function(t){st("setMaxOperationRetryTime",[ht()],arguments),this.authWrapper_.setMaxOperationRetryTime(t)},Object.defineProperty(t.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"INTERNAL",{get:function(){return this.internals_},enumerable:!0,configurable:!0}),t}(),Ft=function(){function t(t){this.service_=t}return t.prototype.delete=function(){return this.service_.authWrapper_.deleteApp(),j(void 0)},t}(),Bt="storage";function Vt(t,e,n){return new Ut(t,new q,n)}function Wt(t){var e={TaskState:O,TaskEvent:P,StringFormat:w,Storage:Ut,Reference:Ot};t.INTERNAL.registerService(Bt,Vt,e,void 0,!0)}Wt(r.default)}])});