Files
DinQuant/frontend/dist/js/949.d0ed1179.js
T
Dinger 05117f3f5b v3.0.1
Signed-off-by: Dinger <quantdinger@gmail.com>
2026-03-25 18:07:47 +08:00

18 lines
434 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(self["webpackChunkvue_antd_pro"]=self["webpackChunkvue_antd_pro"]||[]).push([[949],{53338:function(t,e,a){"use strict";a.r(e),a.d(e,{default:function(){return ur}});var i=function(){var t=this,e=t._self._c;return e("div",{staticClass:"chart-container",class:{"theme-dark":t.isDarkTheme}},[e("div",{staticClass:"chart-header"},[e("div",{staticClass:"header-top"},[e("div",{staticClass:"header-left"},[e("div",{staticClass:"search-section"},[e("a-select",{staticClass:"symbol-select",attrs:{"show-search":"",placeholder:t.$t("dashboard.indicator.selectSymbol"),dropdownClassName:"dark-dropdown","filter-option":t.filterSymbolOption,"not-found-content":null,open:t.symbolSearchOpen},on:{search:t.handleSymbolSearch,change:t.handleSymbolSelect,dropdownVisibleChange:t.handleDropdownVisibleChange},model:{value:t.searchSymbol,callback:function(e){t.searchSymbol=e},expression:"searchSymbol"}},[e("a-icon",{staticStyle:{color:"#999"},attrs:{slot:"suffixIcon",type:"search"},slot:"suffixIcon"}),t._l(t.symbolSuggestions,function(a){return e("a-select-option",{key:a.value,attrs:{value:a.value}},[e("div",{staticClass:"symbol-option"},[e("a-tag",{staticStyle:{"margin-right":"8px","margin-bottom":"0"},attrs:{color:t.getMarketColor(a.market)}},[t._v(" "+t._s(t.getMarketName(a.market))+" ")]),e("span",{staticClass:"symbol-name"},[t._v(t._s(a.symbol))]),a.name?e("span",{staticClass:"symbol-name-extra"},[t._v(t._s(a.name))]):t._e()],1)])}),e("a-select-option",{key:"add-stock-option",staticClass:"add-stock-option",attrs:{value:"__add_stock_option__"}},[e("div",{staticStyle:{width:"100%","text-align":"center",padding:"4px 0",color:"#1890ff",cursor:"pointer"}},[e("a-icon",{staticStyle:{"margin-right":"4px"},attrs:{type:"plus"}}),e("span",[t._v(t._s(t.$t("dashboard.analysis.watchlist.add")))])],1)])],2)],1),e("div",{staticClass:"timeframe-group"},t._l(["1m","5m","15m","30m","1H","4H","1D","1W"],function(a){return e("div",{key:a,staticClass:"timeframe-item",class:{active:t.timeframe===a},on:{click:function(e){return t.setTimeframe(a)}}},[t._v(" "+t._s(a)+" ")])}),0)]),t.currentSymbol?e("div",{staticClass:"current-symbol"},[e("div",{staticClass:"symbol-info"},[e("span",{staticClass:"symbol-label"},[t._v(t._s(t.currentSymbol))]),e("span",{staticClass:"market-tag"},[t._v(t._s(t.currentMarket))])]),e("div",{staticClass:"price-info",class:t.priceChangeClass},[e("span",{staticClass:"symbol-price"},[t._v(t._s(t.currentPrice))]),e("span",{staticClass:"symbol-change"},[t._v(" "+t._s(t.priceChange>0?"+":"")+t._s(t.priceChange.toFixed(2))+"% ")])]),t.isCryptoMarket?e("a-button",{staticClass:"qt-header-btn",attrs:{size:"small"},on:{click:t.openQuickTrade}},[e("a-icon",{attrs:{type:"thunderbolt",theme:"filled"}}),t._v(" "+t._s(t.$t("quickTrade.openPanel"))+" ")],1):t._e()],1):t._e()])]),e("div",{staticClass:"chart-content"},[e("div",{staticClass:"chart-main-row"},[t.currentSymbol?e("div",{staticClass:"mobile-symbol-price"},[e("div",{staticClass:"mobile-symbol-info"},[e("span",{staticClass:"mobile-market-tag"},[t._v(t._s(t.currentMarket))]),e("span",[t._v("-")]),e("span",{staticClass:"mobile-symbol-label"},[t._v(t._s(t.currentSymbol))])]),e("div",{staticClass:"mobile-price-info",class:t.priceChangeClass},[e("span",{staticClass:"mobile-symbol-price"},[t._v(t._s(t.currentPrice))]),e("span",{staticClass:"mobile-symbol-change"},[t._v(" "+t._s(t.priceChange>0?"+":"")+t._s(t.priceChange.toFixed(2))+"% ")])])]):t._e(),e("kline-chart",{ref:"klineChart",attrs:{symbol:t.currentSymbol,market:t.currentMarket,timeframe:t.timeframe,theme:t.chartTheme,activeIndicators:t.activeIndicators,realtimeEnabled:t.realtimeEnabled},on:{"price-change":t.handlePriceChange,retry:t.handleChartRetry,"indicator-toggle":t.handleIndicatorToggle}}),e("div",{staticClass:"chart-right"},[e("div",{staticClass:"indicators-panel"},[e("div",{staticClass:"panel-header"},[e("span",[t._v(t._s(t.$t("dashboard.indicator.panel.title")))]),e("div",{staticStyle:{display:"flex","align-items":"center","margin-left":"auto",gap:"8px"}},[t.isMobile?e("a-button",{staticClass:"mobile-header-create-btn",attrs:{type:"primary",size:"small",icon:"plus"},on:{click:t.handleCreateIndicator}},[t._v(" "+t._s(t.$t("dashboard.indicator.create"))+" ")]):t._e(),e("a-tooltip",{attrs:{title:t.realtimeEnabled?t.$t("dashboard.indicator.panel.realtimeOn"):t.$t("dashboard.indicator.panel.realtimeOff")}},[e("a-button",{staticClass:"realtime-toggle-btn",class:{active:t.realtimeEnabled},attrs:{type:"text"},on:{click:t.toggleRealtime}},[e("a-icon",{attrs:{type:t.realtimeEnabled?"sync":"pause-circle",spin:t.realtimeEnabled}})],1)],1)],1)]),e("div",{staticClass:"panel-body"},[t.isMobile?[e("div",{staticClass:"mobile-tab-content"},[e("div",{staticClass:"section-content custom-scrollbar"},[t._l(t.customIndicators,function(a){return e("div",{key:"custom-"+a.id,class:["indicator-card",{"indicator-active":t.isIndicatorActive("custom-"+a.id)}],on:{click:function(e){return t.toggleIndicator(a,"custom")}}},[e("div",{staticClass:"card-content"},[e("div",{staticClass:"card-header"},[e("span",{staticClass:"card-name"},[t._v(t._s(a.name))]),e("div",{staticClass:"card-actions"},[e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.action.edit")}},[e("a-icon",{staticClass:"action-icon edit-icon",attrs:{type:"edit"},on:{click:function(e){return e.stopPropagation(),t.handleEditIndicator(a)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.action.delete")}},[e("a-icon",{staticClass:"action-icon delete-icon",attrs:{type:"delete"},on:{click:function(e){return e.stopPropagation(),t.handleDeleteIndicator(a)}}})],1),e("a-tooltip",{attrs:{title:t.isIndicatorActive("custom-"+a.id)?t.$t("dashboard.indicator.action.stop"):t.$t("dashboard.indicator.action.start")}},[e("a-icon",{class:["action-icon","toggle-icon",{active:t.isIndicatorActive("custom-"+a.id)}],attrs:{type:t.isIndicatorActive("custom-"+a.id)?"pause-circle":"play-circle"},on:{click:function(e){return e.stopPropagation(),t.toggleIndicator(a,"custom")}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.title")}},[e("a-icon",{staticClass:"action-icon backtest-icon",attrs:{type:"experiment"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktest(a)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.historyTitle")}},[e("a-icon",{staticClass:"action-icon backtest-history-icon",attrs:{type:"clock-circle"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktestHistory(a)}}})],1),e("a-tooltip",{attrs:{title:a.publish_to_community?t.$t("dashboard.indicator.action.unpublish"):t.$t("dashboard.indicator.action.publish")}},[e("a-icon",{class:["action-icon","publish-icon",{published:a.publish_to_community}],attrs:{type:a.publish_to_community?"cloud":"cloud-upload"},on:{click:function(e){return e.stopPropagation(),t.handlePublishIndicator(a)}}})],1)],1)]),e("span",{staticClass:"card-desc"},[t._v(t._s(a.description||""))])])])}),0===t.customIndicators.length?e("div",{staticClass:"empty-indicators"},[e("a-icon",{attrs:{type:"info-circle"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.empty")))])],1):t._e()],2)])]:[e("div",{staticClass:"indicator-section",class:{"section-empty":0===t.customIndicators.length}},[e("div",{staticClass:"section-label"},[e("div",{staticClass:"section-label-left",on:{click:t.toggleCustomSection}},[e("a-icon",{staticClass:"collapse-icon",attrs:{type:t.customSectionCollapsed?"right":"down"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.section.myCreated"))+" ("+t._s(t.customIndicators.length)+")")])],1),e("a-button",{staticClass:"create-indicator-btn",attrs:{type:"primary",size:"small",icon:"plus"},on:{click:function(e){return e.stopPropagation(),t.handleCreateIndicator.apply(null,arguments)}}},[t._v(" "+t._s(t.$t("dashboard.indicator.create"))+" ")])],1),e("div",{directives:[{name:"show",rawName:"v-show",value:!t.customSectionCollapsed,expression:"!customSectionCollapsed"}],staticClass:"section-content custom-scrollbar"},[t._l(t.customIndicators,function(a){return e("div",{key:"custom-"+a.id,class:["indicator-card",{"indicator-active":t.isIndicatorActive("custom-"+a.id)}],on:{click:function(e){return t.toggleIndicator(a,"custom")}}},[e("div",{staticClass:"card-content"},[e("div",{staticClass:"card-header"},[e("span",{staticClass:"card-name"},[t._v(t._s(a.name))]),e("div",{staticClass:"card-actions"},[e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.action.edit")}},[e("a-icon",{staticClass:"action-icon edit-icon",attrs:{type:"edit"},on:{click:function(e){return e.stopPropagation(),t.handleEditIndicator(a)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.action.delete")}},[e("a-icon",{staticClass:"action-icon delete-icon",attrs:{type:"delete"},on:{click:function(e){return e.stopPropagation(),t.handleDeleteIndicator(a)}}})],1),e("a-tooltip",{attrs:{title:t.isIndicatorActive("custom-"+a.id)?t.$t("dashboard.indicator.action.stop"):t.$t("dashboard.indicator.action.start")}},[e("a-icon",{class:["action-icon","toggle-icon",{active:t.isIndicatorActive("custom-"+a.id)}],attrs:{type:t.isIndicatorActive("custom-"+a.id)?"pause-circle":"play-circle"},on:{click:function(e){return e.stopPropagation(),t.toggleIndicator(a,"custom")}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.title")}},[e("a-icon",{staticClass:"action-icon backtest-icon",attrs:{type:"experiment"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktest(a)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.historyTitle")}},[e("a-icon",{staticClass:"action-icon backtest-history-icon",attrs:{type:"clock-circle"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktestHistory(a)}}})],1),e("a-tooltip",{attrs:{title:a.publish_to_community?t.$t("dashboard.indicator.action.unpublish"):t.$t("dashboard.indicator.action.publish")}},[e("a-icon",{class:["action-icon","publish-icon",{published:a.publish_to_community}],attrs:{type:a.publish_to_community?"cloud":"cloud-upload"},on:{click:function(e){return e.stopPropagation(),t.handlePublishIndicator(a)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.action.createStrategy")}},[e("a-icon",{staticClass:"action-icon create-strategy-icon",attrs:{type:"rocket"},on:{click:function(e){return e.stopPropagation(),t.handleCreateStrategyFromIndicator(a)}}})],1)],1)]),e("span",{staticClass:"card-desc"},[t._v(t._s(a.description||""))])])])}),0===t.customIndicators.length?e("div",{staticClass:"empty-indicators"},[e("a-icon",{attrs:{type:"info-circle"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.empty")))])],1):t._e()],2)]),e("div",{staticClass:"indicator-section",class:{"section-empty":0===t.purchasedIndicators.length}},[e("div",{staticClass:"section-label"},[e("div",{staticClass:"section-label-left",on:{click:function(e){t.purchasedSectionCollapsed=!t.purchasedSectionCollapsed}}},[e("a-icon",{staticClass:"collapse-icon",attrs:{type:t.purchasedSectionCollapsed?"right":"down"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.section.purchased"))+" ("+t._s(t.purchasedIndicators.length)+")")])],1),e("a-button",{staticClass:"buy-indicator-btn",attrs:{type:"link",size:"small",icon:"shop"},on:{click:function(e){return e.stopPropagation(),t.goToIndicatorMarket.apply(null,arguments)}}},[t._v(" "+t._s(t.$t("menu.dashboard.community"))+" ")])],1),e("div",{directives:[{name:"show",rawName:"v-show",value:!t.purchasedSectionCollapsed,expression:"!purchasedSectionCollapsed"}],staticClass:"section-content custom-scrollbar"},[t._l(t.purchasedIndicators,function(a){return e("div",{key:"purchased-"+a.id,class:["indicator-card","purchased-indicator",{"indicator-active":t.isIndicatorActive("purchased-"+a.id)}],on:{click:function(e){return t.toggleIndicator(a,"purchased")}}},[e("div",{staticClass:"card-content"},[e("div",{staticClass:"card-header"},[e("span",{staticClass:"card-name"},[e("a-icon",{staticClass:"purchased-icon",attrs:{type:"shopping"}}),t._v(" "+t._s(a.name)+" ")],1),e("div",{staticClass:"card-actions"},[e("a-tooltip",{attrs:{title:t.isIndicatorActive("purchased-"+a.id)?t.$t("dashboard.indicator.action.stop"):t.$t("dashboard.indicator.action.start")}},[e("a-icon",{class:["action-icon","toggle-icon",{active:t.isIndicatorActive("purchased-"+a.id)}],attrs:{type:t.isIndicatorActive("purchased-"+a.id)?"pause-circle":"play-circle"},on:{click:function(e){return e.stopPropagation(),t.toggleIndicator(a,"purchased")}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.title")}},[e("a-icon",{staticClass:"action-icon backtest-icon",attrs:{type:"experiment"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktest(a)}}})],1),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.backtest.historyTitle")}},[e("a-icon",{staticClass:"action-icon backtest-history-icon",attrs:{type:"clock-circle"},on:{click:function(e){return e.stopPropagation(),t.handleOpenBacktestHistory(a)}}})],1)],1)]),e("span",{staticClass:"card-desc"},[t._v(t._s(a.description||""))])])])}),0===t.purchasedIndicators.length?e("div",{staticClass:"empty-indicators"},[e("a-icon",{attrs:{type:"shopping"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.emptyPurchased")))])],1):t._e()],2)])]],2)])])],1),e("indicator-editor",{ref:"indicatorEditor",attrs:{visible:t.showIndicatorEditor,indicator:t.editingIndicator,userId:t.userId},on:{run:t.handleRunIndicator,save:t.handleSaveIndicator,cancel:function(e){t.showIndicatorEditor=!1,t.editingIndicator=null}}}),e("backtest-modal",{attrs:{visible:t.showBacktestModal,userId:t.userId,indicator:t.backtestIndicator,symbol:t.selectedSymbol,market:t.selectedMarket,timeframe:t.selectedTimeframe},on:{cancel:function(e){t.showBacktestModal=!1,t.backtestIndicator=null}}}),e("a-modal",{attrs:{visible:t.showParamsModal,title:t.$t("dashboard.indicator.paramsConfig.title"),confirmLoading:t.loadingParams,width:500,maskClosable:!1,keyboard:!1},on:{ok:t.confirmIndicatorParams,cancel:t.cancelIndicatorParams,afterClose:t.handleParamsModalAfterClose}},[t.pendingIndicator?e("div",{staticClass:"params-config-modal"},[e("div",{staticClass:"indicator-info"},[e("span",{staticClass:"indicator-name"},[t._v(t._s(t.pendingIndicator.name))])]),e("a-divider"),t.indicatorParams.length>0?e("div",{staticClass:"params-form"},t._l(t.indicatorParams,function(a){return e("div",{key:a.name,staticClass:"param-item"},[e("div",{staticClass:"param-header"},[e("label",{staticClass:"param-label"},[t._v(t._s(a.name))]),a.description?e("a-tooltip",{attrs:{title:a.description}},[e("a-icon",{staticStyle:{color:"#999","margin-left":"4px"},attrs:{type:"question-circle"}})],1):t._e()],1),"int"===a.type?e("a-input-number",{staticStyle:{width:"100%"},attrs:{precision:0},model:{value:t.indicatorParamValues[a.name],callback:function(e){t.$set(t.indicatorParamValues,a.name,e)},expression:"indicatorParamValues[param.name]"}}):"float"===a.type?e("a-input-number",{staticStyle:{width:"100%"},attrs:{precision:4},model:{value:t.indicatorParamValues[a.name],callback:function(e){t.$set(t.indicatorParamValues,a.name,e)},expression:"indicatorParamValues[param.name]"}}):"bool"===a.type?e("a-switch",{model:{value:t.indicatorParamValues[a.name],callback:function(e){t.$set(t.indicatorParamValues,a.name,e)},expression:"indicatorParamValues[param.name]"}}):e("a-input",{model:{value:t.indicatorParamValues[a.name],callback:function(e){t.$set(t.indicatorParamValues,a.name,e)},expression:"indicatorParamValues[param.name]"}})],1)}),0):e("a-empty",{attrs:{description:t.$t("dashboard.indicator.paramsConfig.noParams")}})],1):t._e()]),e("backtest-history-drawer",{attrs:{visible:t.showBacktestHistoryDrawer,userId:t.userId,indicatorId:t.backtestHistoryIndicator?t.backtestHistoryIndicator.id:null,symbol:t.selectedSymbol,market:t.selectedMarket,timeframe:t.selectedTimeframe,isMobile:t.isMobile},on:{cancel:function(e){t.showBacktestHistoryDrawer=!1,t.backtestHistoryIndicator=null},view:t.handleViewBacktestRun}}),e("backtest-run-viewer",{attrs:{visible:t.showBacktestRunViewer,run:t.selectedBacktestRun},on:{cancel:function(e){t.showBacktestRunViewer=!1,t.selectedBacktestRun=null}}}),e("a-modal",{attrs:{title:t.publishIndicator&&t.publishIndicator.publish_to_community?t.$t("dashboard.indicator.publish.editTitle"):t.$t("dashboard.indicator.publish.title"),visible:t.showPublishModal,confirmLoading:t.publishing,width:"500px",okText:t.publishIndicator&&t.publishIndicator.publish_to_community?t.$t("dashboard.indicator.publish.update"):t.$t("dashboard.indicator.publish.confirm"),cancelText:t.$t("common.cancel")},on:{ok:t.handleConfirmPublish,cancel:function(e){t.showPublishModal=!1,t.publishIndicator=null}}},[e("a-form-model",{ref:"publishForm",attrs:{model:t.publishForm,rules:t.publishRules,layout:"vertical"}},[e("a-alert",{staticStyle:{"margin-bottom":"16px"},attrs:{type:"info","show-icon":"",message:t.$t("dashboard.indicator.publish.hint")}}),e("a-form-model-item",{attrs:{label:t.$t("dashboard.indicator.publish.pricingType"),prop:"pricingType"}},[e("a-radio-group",{model:{value:t.publishPricingType,callback:function(e){t.publishPricingType=e},expression:"publishPricingType"}},[e("a-radio",{attrs:{value:"free"}},[t._v(t._s(t.$t("dashboard.indicator.publish.free")))]),e("a-radio",{attrs:{value:"paid"}},[t._v(t._s(t.$t("dashboard.indicator.publish.paid")))])],1)],1),"paid"===t.publishPricingType?e("a-form-model-item",{attrs:{label:t.$t("dashboard.indicator.publish.price"),prop:"price"}},[e("a-input-number",{staticStyle:{width:"200px"},attrs:{min:1,max:1e4,precision:0},model:{value:t.publishPrice,callback:function(e){t.publishPrice=e},expression:"publishPrice"}}),e("span",{staticStyle:{"margin-left":"8px"}},[t._v(t._s(t.$t("community.credits")))])],1):t._e(),"paid"===t.publishPricingType?e("a-form-model-item",{attrs:{label:t.$t("dashboard.indicator.publish.vipFree")}},[e("a-switch",{model:{value:t.publishVipFree,callback:function(e){t.publishVipFree=e},expression:"publishVipFree"}}),e("div",{staticStyle:{"margin-top":"6px",color:"rgba(0,0,0,0.45)","font-size":"12px"}},[t._v(" "+t._s(t.$t("dashboard.indicator.publish.vipFreeHint"))+" ")])],1):t._e(),e("a-form-model-item",{attrs:{label:t.$t("dashboard.indicator.publish.description"),prop:"description"}},[e("a-textarea",{attrs:{placeholder:t.$t("dashboard.indicator.publish.descriptionPlaceholder"),rows:4,maxLength:500},model:{value:t.publishDescription,callback:function(e){t.publishDescription=e},expression:"publishDescription"}})],1),t.publishIndicator&&t.publishIndicator.publish_to_community?e("div",{staticStyle:{"margin-top":"16px"}},[e("a-button",{attrs:{type:"danger",ghost:"",loading:t.unpublishing},on:{click:t.handleUnpublish}},[e("a-icon",{attrs:{type:"close-circle"}}),t._v(" "+t._s(t.$t("dashboard.indicator.publish.unpublish"))+" ")],1)],1):t._e()],1)],1),e("a-modal",{attrs:{title:t.$t("dashboard.analysis.modal.addStock.title"),visible:t.showAddStockModal,confirmLoading:t.addingStock,width:"600px",okText:t.$t("dashboard.analysis.modal.addStock.confirm"),cancelText:t.$t("dashboard.analysis.modal.addStock.cancel")},on:{ok:t.handleAddStock,cancel:t.handleCloseAddStockModal}},[e("div",{staticClass:"add-stock-modal-content"},[e("a-tabs",{staticClass:"market-tabs",on:{change:t.handleMarketTabChange},model:{value:t.selectedMarketTab,callback:function(e){t.selectedMarketTab=e},expression:"selectedMarketTab"}},t._l(t.marketTypes,function(a){return e("a-tab-pane",{key:a.value,attrs:{tab:t.$t(a.i18nKey||"dashboard.analysis.market.".concat(a.value))}})}),1),e("div",{staticClass:"symbol-search-section"},[e("a-input-search",{attrs:{placeholder:t.$t("dashboard.analysis.modal.addStock.searchOrInputPlaceholder"),loading:t.searchingSymbols,size:"large","allow-clear":""},on:{search:t.handleSearchOrInput,change:t.handleSymbolSearchInput},model:{value:t.symbolSearchKeyword,callback:function(e){t.symbolSearchKeyword=e},expression:"symbolSearchKeyword"}},[e("a-button",{attrs:{slot:"enterButton",type:"primary",icon:"search"},slot:"enterButton"},[t._v(" "+t._s(t.$t("dashboard.analysis.modal.addStock.search"))+" ")])],1)],1),t.symbolSearchResults.length>0?e("div",{staticClass:"search-results-section"},[e("div",{staticClass:"section-title"},[e("a-icon",{staticStyle:{"margin-right":"4px"},attrs:{type:"search"}}),t._v(" "+t._s(t.$t("dashboard.analysis.modal.addStock.searchResults"))+" ")],1),e("a-list",{staticClass:"symbol-list",attrs:{"data-source":t.symbolSearchResults,loading:t.searchingSymbols,size:"small"},scopedSlots:t._u([{key:"renderItem",fn:function(a){return e("a-list-item",{staticClass:"symbol-list-item",on:{click:function(e){return t.selectSymbol(a)}}},[e("a-list-item-meta",[e("template",{slot:"title"},[e("div",{staticClass:"symbol-item-content"},[e("span",{staticClass:"symbol-code"},[t._v(t._s(a.symbol))]),e("span",{staticClass:"symbol-name"},[t._v(t._s(a.name))]),a.exchange?e("a-tag",{staticStyle:{"margin-left":"8px"},attrs:{size:"small",color:"blue"}},[t._v(" "+t._s(a.exchange)+" ")]):t._e()],1)])],2)],1)}}],null,!1,1074844145)})],1):t._e(),e("div",{staticClass:"hot-symbols-section"},[e("div",{staticClass:"section-title"},[e("a-icon",{staticStyle:{color:"#ff4d4f","margin-right":"4px"},attrs:{type:"fire"}}),t._v(" "+t._s(t.$t("dashboard.analysis.modal.addStock.hotSymbols"))+" ")],1),e("a-spin",{attrs:{spinning:t.loadingHotSymbols}},[t.hotSymbols.length>0?e("a-list",{staticClass:"symbol-list",attrs:{"data-source":t.hotSymbols,size:"small"},scopedSlots:t._u([{key:"renderItem",fn:function(a){return e("a-list-item",{staticClass:"symbol-list-item",on:{click:function(e){return t.selectSymbol(a)}}},[e("a-list-item-meta",[e("template",{slot:"title"},[e("div",{staticClass:"symbol-item-content"},[e("span",{staticClass:"symbol-code"},[t._v(t._s(a.symbol))]),e("span",{staticClass:"symbol-name"},[t._v(t._s(a.name))]),a.exchange?e("a-tag",{staticStyle:{"margin-left":"8px"},attrs:{size:"small",color:"orange"}},[t._v(" "+t._s(a.exchange)+" ")]):t._e()],1)])],2)],1)}}],null,!1,2177647935)}):e("a-empty",{attrs:{description:t.$t("dashboard.analysis.modal.addStock.noHotSymbols"),image:!1}})],1)],1),t.selectedSymbolForAdd?e("div",{staticClass:"selected-symbol-section"},[e("a-alert",{attrs:{message:t.$t("dashboard.analysis.modal.addStock.selectedSymbol"),type:"info","show-icon":"",closable:""},on:{close:function(e){t.selectedSymbolForAdd=null}}},[e("template",{slot:"description"},[e("div",{staticClass:"selected-symbol-info"},[e("a-tag",{staticStyle:{"margin-right":"8px"},attrs:{color:t.getMarketColor(t.selectedSymbolForAdd.market)}},[t._v(" "+t._s(t.$t("dashboard.analysis.market.".concat(t.selectedSymbolForAdd.market)))+" ")]),e("strong",[t._v(t._s(t.selectedSymbolForAdd.symbol))]),t.selectedSymbolForAdd.name?e("span",{staticStyle:{color:"#999","margin-left":"8px"}},[t._v(t._s(t.selectedSymbolForAdd.name))]):e("span",{staticStyle:{color:"#999","margin-left":"8px","font-style":"italic"}},[t._v(t._s(t.$t("dashboard.analysis.modal.addStock.nameWillBeFetched")))])],1)])],2)],1):t._e()],1)])],1),e("a-tooltip",{attrs:{title:t.$t("quickTrade.openPanel"),placement:"left"}},[!t.showQuickTrade&&t.currentSymbol&&t.isCryptoMarket?e("div",{staticClass:"qt-floating-btn",on:{click:t.openQuickTrade}},[e("a-icon",{attrs:{type:"thunderbolt",theme:"filled"}})],1):t._e()]),e("quick-trade-panel",{attrs:{visible:t.showQuickTrade,symbol:t.qtSymbol,"preset-side":t.qtSide,"preset-price":t.qtPrice,source:"indicator","market-type":"swap"},on:{close:function(e){t.showQuickTrade=!1},"order-success":t.onQuickTradeSuccess,"update:symbol":t.handleQuickTradeSymbolChange}})],1)},n=[],r=(a(62621),a(43898)),o=a(44735),s=a(15863),l=a(81127),c=a(56252),u=(a(6011),a(18787)),d=a(76338),h=(a(74423),a(85471)),p=a(95353),v=a(75769),f=a(35038),g=a(505),m=function(){var t=this,e=t._self._c;return e("div",[e("a-modal",{staticClass:"indicator-editor-modal",style:t.isMobile?{top:0,paddingBottom:0}:{top:"2%"},attrs:{title:t.$t("dashboard.indicator.editor.title"),visible:t.visible,width:t.isMobile?"100%":"95vw",confirmLoading:t.saving,okText:t.$t("dashboard.indicator.editor.save"),cancelText:t.$t("dashboard.indicator.editor.cancel"),maskClosable:!1,centered:!1},on:{ok:t.handleSave,cancel:t.handleCancel,afterClose:t.handleAfterClose}},[e("div",{staticClass:"editor-content"},[e("a-row",{staticClass:"editor-layout",class:{"mobile-layout":t.isMobile},attrs:{gutter:16}},[e("a-col",{staticClass:"code-editor-column",attrs:{span:24,xs:24,sm:24,md:24}},[e("div",{staticClass:"code-section"},[e("div",{staticClass:"section-header"},[e("div",{staticClass:"header-left"},[e("span",{staticClass:"section-title"},[t._v(t._s(t.$t("dashboard.indicator.editor.code")))])]),e("div",{staticClass:"section-actions"},[e("a-button",{staticStyle:{padding:"0 8px",color:"#52c41a","font-weight":"bold"},attrs:{type:"link",size:"small",loading:t.verifying},on:{click:t.handleVerifyCode}},[e("a-icon",{attrs:{type:"check-circle"}}),t._v(" "+t._s(t.$t("dashboard.indicator.editor.verifyCode"))+" ")],1),e("a-button",{staticStyle:{padding:"0"},attrs:{type:"link",size:"small"},on:{click:t.goToDocs}},[e("a-icon",{attrs:{type:"book"}}),t._v(" "+t._s(t.$t("dashboard.indicator.editor.guide"))+" ")],1)],1)]),e("a-alert",{staticStyle:{"margin-bottom":"12px"},attrs:{type:"info","show-icon":"",message:t.$t("dashboard.indicator.boundary.message"),description:t.$t("dashboard.indicator.boundary.indicatorRule")}}),e("div",{staticClass:"code-mode-split"},[e("a-row",{staticClass:"code-mode-row",attrs:{gutter:16}},[e("a-col",{staticClass:"code-pane",attrs:{xs:24,sm:24,md:18}},[e("div",{ref:"codeEditorContainer",staticClass:"code-editor-container"})]),e("a-col",{staticClass:"ai-pane",attrs:{xs:24,sm:24,md:6}},[e("div",{staticClass:"ai-panel"},[e("div",{staticClass:"ai-panel-title"},[e("a-icon",{attrs:{type:"robot"}}),e("span",[t._v(t._s(t.$t("dashboard.indicator.editor.aiGenerate")))])],1),e("a-textarea",{attrs:{placeholder:t.$t("dashboard.indicator.editor.aiPromptPlaceholder"),rows:12,"auto-size":{minRows:12,maxRows:20}},model:{value:t.aiPrompt,callback:function(e){t.aiPrompt=e},expression:"aiPrompt"}}),e("a-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"primary",block:"",loading:t.aiGenerating,size:"large"},on:{click:t.handleAIGenerate}},[t._v(" "+t._s(t.$t("dashboard.indicator.editor.aiGenerateBtn"))+" ")])],1)])],1)],1)],1)])],1)],1),e("div",{staticClass:"editor-footer",attrs:{slot:"footer"},slot:"footer"},[e("a-button",{on:{click:t.handleCancel}},[t._v(" "+t._s(t.$t("dashboard.indicator.editor.cancel"))+" ")]),e("a-button",{attrs:{type:"primary",loading:t.saving},on:{click:t.handleSave}},[t._v(" "+t._s(t.$t("dashboard.indicator.editor.save"))+" ")])],1)])],1)},y=[],b=a(57532),_=a(15237),x=a.n(_),w=(a(74806),a(55218),a(97923),a(50436),a(74053)),S=a.n(w),k=a(75314),C={name:"IndicatorEditor",props:{visible:{type:Boolean,default:!1},indicator:{type:Object,default:null},userId:{type:Number,default:null}},data:function(){return{saving:!1,codeEditor:null,aiPrompt:"",aiGenerating:!1,verifying:!1,isMobile:!1}},computed:{},watch:{visible:function(t){var e=this;t?this.$nextTick(function(){setTimeout(function(){!e.codeEditor&&e.$refs.codeEditorContainer&&e.initCodeEditor(),e.initFormData()},200)}):this.codeEditor&&this.codeEditor.refresh()},indicator:{handler:function(t){var e=this;t&&this.visible&&this.$nextTick(function(){setTimeout(function(){e.initFormData()},100)})},deep:!0}},mounted:function(){var t=this;this.checkMobile(),window.addEventListener("resize",this.checkMobile),this.visible&&this.$nextTick(function(){setTimeout(function(){t.initCodeEditor()},100)})},beforeDestroy:function(){if(window.removeEventListener("resize",this.checkMobile),this.codeEditor)try{if("function"===typeof this.codeEditor.toTextArea)this.codeEditor.toTextArea();else if("function"===typeof this.codeEditor.getWrapperElement){var t=this.codeEditor.getWrapperElement();t&&t.parentNode&&t.parentNode.removeChild(t)}}catch(e){}finally{this.codeEditor=null}},methods:{getDefaultIndicatorCode:function(){return'#Demo Code:\n#my_indicator_name = "My Buy/Sell Indicator"\n#my_indicator_description = "Buy/Sell only; execution is normalized in backend."\n\n#df = df.copy()\n#sma = df["close"].rolling(14).mean()\n#buy = (df["close"] > sma) & (df["close"].shift(1) <= sma.shift(1))\n#sell = (df["close"] < sma) & (df["close"].shift(1) >= sma.shift(1))\n#df["buy"] = buy.fillna(False).astype(bool)\n#df["sell"] = sell.fillna(False).astype(bool)\n\n#buy_marks = [df["low"].iloc[i] * 0.995 if df["buy"].iloc[i] else None for i in range(len(df))]\n#sell_marks = [df["high"].iloc[i] * 1.005 if df["sell"].iloc[i] else None for i in range(len(df))]\n\n#output = {\n# "name": my_indicator_name,\n# "plots": [],\n# "signals": [\n# {"type": "buy", "text": "B", "data": buy_marks, "color": "#00E676"},\n# {"type": "sell", "text": "S", "data": sell_marks, "color": "#FF5252"}\n# ]\n#}\n'},checkMobile:function(){this.isMobile=window.innerWidth<=768},goToDocs:function(){window.open("https://github.com/brokermr810/QuantDinger/blob/main/docs/STRATEGY_DEV_GUIDE.md","_blank")},handleVerifyCode:function(){var t=this,e=this.codeEditor?this.codeEditor.getValue():"";e&&e.trim()?(this.verifying=!0,(0,v.Ay)({url:"/api/indicator/verifyCode",method:"post",data:{code:e}}).then(function(e){if(1===e.code){var a=e.data||{};t.$message.success("".concat(t.$t("dashboard.indicator.editor.verifyCodeSuccess")," (").concat(a.plots_count||0," plots, ").concat(a.signals_count||0," signals)"))}else{var i=e.data||{};t.$error({title:t.$t("dashboard.indicator.editor.verifyCodeFailed"),width:600,content:function(t){return t("div",[t("p",{style:{fontWeight:"bold",color:"#ff4d4f"}},e.msg),i.details?t("pre",{style:{background:"#f5f5f5",padding:"8px",overflow:"auto",maxHeight:"300px",marginTop:"8px",fontSize:"12px",fontFamily:"monospace"}},i.details):null])}})}}).catch(function(e){t.$message.error("Request Failed: "+(e.message||"Unknown Error"))}).finally(function(){t.verifying=!1})):this.$message.warning(this.$t("dashboard.indicator.editor.verifyCodeEmpty"))},cleanMarkdownCodeBlocks:function(t){if(!t||"string"!==typeof t)return t;var e=t.trim(),a=/```/.test(e);return a?(e=e.replace(/^```[\w]*\s*\n?/i,""),e.startsWith("```")&&(e=e.replace(/^```\s*\n?/g,"")),e.endsWith("```")&&(e=e.replace(/\n?```\s*$/g,"")),e=e.replace(/^\s*```[\w]*\s*$/gm,""),e=e.replace(/^\s*```\s*$/gm,""),e=e.replace(/\n{3,}/g,"\n\n"),e=e.trim(),e):e},initFormData:function(){var t=this;if(this.visible){var e=this.indicator&&this.indicator.code||"";e&&String(e).trim()||(e=this.getDefaultIndicatorCode()),this.$nextTick(function(){setTimeout(function(){t.aiPrompt="",t.codeEditor&&(t.codeEditor.setValue(e),t.codeEditor.refresh())},50)})}},initCodeEditor:function(){var t=this;if(this.$refs.codeEditorContainer){if(this.codeEditor){try{if("function"===typeof this.codeEditor.toTextArea)this.codeEditor.toTextArea();else if("function"===typeof this.codeEditor.getWrapperElement){var e=this.codeEditor.getWrapperElement();e&&e.parentNode&&e.parentNode.removeChild(e)}}catch(a){}this.codeEditor=null}try{this.$refs.codeEditorContainer.innerHTML="",this.codeEditor=x()(this.$refs.codeEditorContainer,{value:function(){var e=t.indicator&&t.indicator.code||"";return e&&String(e).trim()?e:t.getDefaultIndicatorCode()}(),mode:"python",theme:"eclipse",lineNumbers:!0,lineWrapping:!0,indentUnit:4,indentWithTabs:!1,smartIndent:!0,matchBrackets:!0,autoCloseBrackets:!0,styleActiveLine:!0,foldGutter:!1,gutters:["CodeMirror-linenumbers"],tabSize:4,viewportMargin:1/0}),this.codeEditor.on("change",function(t){t.getValue()}),this.$nextTick(function(){t.codeEditor&&t.codeEditor.refresh()})}catch(i){}}},handleSave:function(){var t=this.codeEditor?this.codeEditor.getValue():"",e=t||"";e.trim()?(this.saving=!0,this.$emit("save",{id:this.indicator?this.indicator.id:0,code:e,userid:this.userId})):this.$message.warning(this.$t("dashboard.indicator.editor.codeRequired"))},handleCancel:function(){this.codeEditor&&this.codeEditor.setValue(""),this.$emit("cancel")},handleAfterClose:function(){var t=this;this.codeEditor&&this.$nextTick(function(){t.codeEditor&&t.codeEditor.refresh()}),this.aiPrompt=""},handleAIGenerate:function(){var t=this;return(0,c.A)((0,l.A)().m(function e(){var a,i,n,r,o,s,c,u,d,h,p,v,f,g,m,y,_,x,w,C,I,E,A,P,D;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.aiPrompt&&t.aiPrompt.trim()){e.n=1;break}return t.$message.warning(t.$t("dashboard.indicator.editor.aiPromptRequired")),e.a(2);case 1:return t.aiGenerating=!0,a="",t.codeEditor&&(a=t.codeEditor.getValue()||""),t.codeEditor&&(t.codeEditor.setValue("# AI generating...\n"),t.codeEditor.refresh()),i="",e.p=2,n="/api/indicator/aiGenerate",r=S().get(k.Xh),o={prompt:t.aiPrompt.trim()},a.trim()&&(o.existingCode=a.trim()),e.n=3,fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:r?"Bearer ".concat(r):"","Access-Token":r||"",Token:r||""},body:JSON.stringify(o),credentials:"include"});case 3:if(s=e.v,s.ok){e.n=5;break}return e.n=4,s.text().catch(function(){return""});case 4:throw c=e.v,new Error(c||"HTTP error! status: ".concat(s.status));case 5:if(s.body&&"function"===typeof s.body.getReader){e.n=6;break}throw new Error("AI 服务未返回可读取的流(response.body 不存在)");case 6:u=s.body.getReader(),d=new TextDecoder,h="";case 7:return e.n=8,u.read();case 8:if(p=e.v,v=p.done,f=p.value,!v){e.n=9;break}return e.a(3,21);case 9:h+=d.decode(f,{stream:!0}),g=h.split("\n\n"),h=g.pop()||"",m=(0,b.A)(g),e.p=10,m.s();case 11:if((y=m.n()).done){e.n=17;break}if(_=y.value,_.trim()&&_.startsWith("data: ")){e.n=12;break}return e.a(3,16);case 12:if(x=_.substring(6),"[DONE]"!==x){e.n=13;break}return e.a(3,17);case 13:if(e.p=13,w=JSON.parse(x),!w.error){e.n=14;break}throw new Error(w.error);case 14:w.content&&(i+=w.content,C=t.cleanMarkdownCodeBlocks(i),t.codeEditor&&(t.codeEditor.setValue(C),I=t.codeEditor.lineCount(),t.codeEditor.setCursor({line:I-1,ch:0}),t.codeEditor.refresh())),e.n=16;break;case 15:e.p=15,e.v;case 16:e.n=11;break;case 17:e.n=19;break;case 18:e.p=18,P=e.v,m.e(P);case 19:return e.p=19,m.f(),e.f(19);case 20:e.n=7;break;case 21:t.codeEditor&&i?(E=t.cleanMarkdownCodeBlocks(i),t.codeEditor.setValue(E),t.codeEditor.refresh(),t.$message.success(t.$t("dashboard.indicator.editor.aiGenerateSuccess"))):i||t.$message.warning("未生成任何代码,请尝试更详细的提示词"),e.n=23;break;case 22:e.p=22,D=e.v,t.$message.error(D.message||t.$t("dashboard.indicator.editor.aiGenerateError")),i&&t.codeEditor&&(A=t.cleanMarkdownCodeBlocks(i),t.codeEditor.setValue(A));case 23:return e.p=23,t.aiGenerating=!1,e.f(23);case 24:return e.a(2)}},e,null,[[13,15],[10,18,19,20],[2,22,23,24]])}))()}}},I=C,E=a(845),A=(0,E.A)(I,m,y,!1,null,"4fea1865",null),P=A.exports,D=function(){var t=this,e=t._self._c;return e("div",{staticClass:"chart-left",class:{"theme-dark":"dark"===t.chartTheme}},[e("div",{staticClass:"chart-wrapper"},[e("div",{staticClass:"drawing-toolbar"},[t._l(t.drawingTools,function(a){return e("a-tooltip",{key:a.name,attrs:{title:a.title,placement:"right"}},[e("div",{staticClass:"drawing-tool-btn",class:{active:t.activeDrawingTool===a.name},on:{click:function(e){return t.selectDrawingTool(a.name)}}},[e("a-icon",{attrs:{type:a.icon}})],1)])}),e("a-divider",{attrs:{type:"vertical"}}),e("a-tooltip",{attrs:{title:t.$t("dashboard.indicator.drawing.clearAll"),placement:"right"}},[e("div",{staticClass:"drawing-tool-btn",on:{click:t.clearAllDrawings}},[e("a-icon",{attrs:{type:"delete"}})],1)])],2),e("div",{staticClass:"chart-content-area"},[e("div",{staticClass:"indicator-toolbar"},t._l(t.indicatorButtons,function(a){return e("div",{key:a.id,staticClass:"indicator-btn",class:{active:t.isIndicatorActive(a.id)},attrs:{title:a.name},on:{click:function(e){return t.toggleIndicator(a)}}},[t._v(" "+t._s(a.shortName)+" ")])}),0),e("div",{staticClass:"kline-chart-container",attrs:{id:"kline-chart-container"}})]),t.loading?e("div",{staticClass:"chart-overlay"},[e("a-spin",{attrs:{size:"large"}},[e("a-icon",{staticStyle:{"font-size":"24px",color:"#13c2c2"},attrs:{slot:"indicator",type:"loading",spin:""},slot:"indicator"})],1)],1):t._e(),t.error?e("div",{staticClass:"chart-overlay"},[e("div",{staticClass:"error-box"},[e("a-icon",{staticStyle:{"font-size":"24px",color:"#ef5350","margin-bottom":"10px"},attrs:{type:"warning"}}),e("span",[t._v(t._s(t.error))]),e("a-button",{staticStyle:{"margin-top":"12px"},attrs:{type:"primary",size:"small",ghost:""},on:{click:t.handleRetry}},[t._v(" "+t._s(t.$t("dashboard.indicator.retry"))+" ")])],1)]):t._e(),t.pyodideLoadFailed?e("div",{staticClass:"chart-overlay pyodide-warning"},[e("div",{staticClass:"warning-box"},[e("a-icon",{staticStyle:{"font-size":"32px",color:"#faad14","margin-bottom":"12px"},attrs:{type:"warning"}}),e("div",{staticClass:"warning-title"},[t._v(t._s(t.$t("dashboard.indicator.warning.pyodideLoadFailed")))]),e("div",{staticClass:"warning-desc"},[t._v(t._s(t.$t("dashboard.indicator.warning.pyodideLoadFailedDesc")))])],1)]):t._e(),t.symbol||t.loading||t.error||t.pyodideLoadFailed?t._e():e("div",{staticClass:"chart-overlay initial-hint"},[e("div",{staticClass:"hint-box"},[e("a-icon",{staticStyle:{"font-size":"48px",color:"#1890ff","margin-bottom":"16px"},attrs:{type:"line-chart"}}),e("div",{staticClass:"hint-title"},[t._v(t._s(t.$t("dashboard.indicator.hint.selectSymbol")))]),e("div",{staticClass:"hint-desc"},[t._v(t._s(t.$t("dashboard.indicator.hint.selectSymbolDesc")))])],1)])])])},T=[],M=a(21560),R=a(26297),F=a(2403),B=function(t,e){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])},B(t,e)};function L(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function a(){this.constructor=t}B(t,e),t.prototype=null===e?Object.create(e):(a.prototype=e.prototype,new a)}var N,$,z,V,O,W,H,Y,K,X=function(){return X=Object.assign||function(t){for(var e,a=1,i=arguments.length;a<i;a++)for(var n in e=arguments[a],e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},X.apply(this,arguments)};function q(t,e,a,i){function n(t){return t instanceof a?t:new a(function(e){e(t)})}return new(a||(a=Promise))(function(a,r){function o(t){try{l(i.next(t))}catch(e){r(e)}}function s(t){try{l(i["throw"](t))}catch(e){r(e)}}function l(t){t.done?a(t.value):n(t.value).then(o,s)}l((i=i.apply(t,e||[])).next())})}function U(t,e){var a,i,n,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"===typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o["throw"]=s(1),o["return"]=s(2),"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(e){return l([t,e])}}function l(s){if(a)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(r=0)),r)try{if(a=1,i&&(n=2&s[0]?i["return"]:s[0]?i["throw"]||((n=i["return"])&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){r=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){r.label=s[1];break}if(6===s[0]&&r.label<n[1]){r.label=n[1],n=s;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(s);break}n[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}catch(l){s=[6,l],i=0}finally{a=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function j(t){var e="function"===typeof Symbol&&Symbol.iterator,a=e&&t[e],i=0;if(a)return a.call(t);if(t&&"number"===typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function G(t,e){var a="function"===typeof Symbol&&t[Symbol.iterator];if(!a)return t;var i,n,r=a.call(t),o=[];try{while((void 0===e||e-- >0)&&!(i=r.next()).done)o.push(i.value)}catch(s){n={error:s}}finally{try{i&&!i.done&&(a=r["return"])&&a.call(r)}finally{if(n)throw n.error}}return o}function Z(t,e,a){if(a||2===arguments.length)for(var i,n=0,r=e.length;n<r;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}"function"===typeof SuppressedError&&SuppressedError,function(t){t["Dashed"]="dashed",t["Solid"]="solid"}(N||(N={})),function(t){t["Stroke"]="stroke",t["Fill"]="fill",t["StrokeFill"]="stroke_fill"}($||($={})),function(t){t["Always"]="always",t["FollowCross"]="follow_cross",t["None"]="none"}(z||(z={})),function(t){t["Standard"]="standard",t["Rect"]="rect"}(V||(V={})),function(t){t["Left"]="left",t["Middle"]="middle",t["Right"]="right"}(O||(O={})),function(t){t["Fixed"]="fixed",t["Pointer"]="pointer"}(W||(W={})),function(t){t["CandleSolid"]="candle_solid",t["CandleStroke"]="candle_stroke",t["CandleUpStroke"]="candle_up_stroke",t["CandleDownStroke"]="candle_down_stroke",t["Ohlc"]="ohlc",t["Area"]="area"}(H||(H={})),function(t){t["Left"]="left",t["Right"]="right"}(Y||(Y={})),function(t){t["Normal"]="normal",t["Percentage"]="percentage",t["Log"]="log"}(K||(K={}));var J="#F92855",Q="rgba(249, 40, 85, .7)",tt="#2DC08E",et="rgba(45, 192, 142, .7)",at="#888888",it="#FFFFFF",nt="#1677FF",rt="#76808F",ot="#DDDDDD";function st(t){return"rgba(22, 119, 255, ".concat(t,")")}function lt(){function t(){return{show:!0,size:1,color:"#EDEDED",style:N.Dashed,dashedValue:[2,2]}}return{show:!0,horizontal:t(),vertical:t()}}function ct(){var t={show:!0,color:rt,textOffset:5,textSize:10,textFamily:"Helvetica Neue",textWeight:"normal"};return{type:H.CandleSolid,bar:{upColor:tt,downColor:J,noChangeColor:at,upBorderColor:tt,downBorderColor:J,noChangeBorderColor:at,upWickColor:tt,downWickColor:J,noChangeWickColor:at},area:{lineSize:2,lineColor:nt,smooth:!1,value:"close",backgroundColor:[{offset:0,color:st(.01)},{offset:1,color:st(.2)}],point:{show:!0,color:nt,radius:4,rippleColor:st(.3),rippleRadius:8,animation:!0,animationDuration:1e3}},priceMark:{show:!0,high:X({},t),low:X({},t),last:{show:!0,upColor:tt,downColor:J,noChangeColor:at,line:{show:!0,style:N.Dashed,dashedValue:[4,4],size:1},text:{show:!0,style:$.Fill,size:12,paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderColor:"transparent",borderStyle:N.Solid,borderSize:0,borderDashedValue:[2,2],color:it,family:"Helvetica Neue",weight:"normal",borderRadius:2}}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:z.Always,showType:V.Standard,custom:[{title:"time",value:"{time}"},{title:"open",value:"{open}"},{title:"high",value:"{high}"},{title:"low",value:"{low}"},{title:"close",value:"{close}"},{title:"volume",value:"{volume}"}],defaultValue:"n/a",rect:{position:W.Fixed,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,offsetLeft:4,offsetTop:4,offsetRight:4,offsetBottom:4,borderRadius:4,borderSize:1,borderColor:"#F2F3F5",color:"#FEFEFE"},text:{size:12,family:"Helvetica Neue",weight:"normal",color:rt,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]}}}function ut(){var t=["#FF9600","#935EBD",nt,"#E11D74","#01C5C4"].map(function(t){return{style:N.Solid,smooth:!1,size:1,dashedValue:[2,2],color:t}});return{ohlc:{upColor:et,downColor:Q,noChangeColor:at},bars:[{style:$.Fill,borderStyle:N.Solid,borderSize:1,borderDashedValue:[2,2],upColor:et,downColor:Q,noChangeColor:at}],lines:t,circles:[{style:$.Fill,borderStyle:N.Solid,borderSize:1,borderDashedValue:[2,2],upColor:et,downColor:Q,noChangeColor:at}],lastValueMark:{show:!1,text:{show:!1,style:$.Fill,color:it,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:N.Solid,borderColor:"transparent",borderSize:0,borderDashedValue:[2,2],paddingLeft:4,paddingTop:4,paddingRight:4,paddingBottom:4,borderRadius:2}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:z.Always,showType:V.Standard,showName:!0,showParams:!0,defaultValue:"n/a",text:{size:12,family:"Helvetica Neue",weight:"normal",color:rt,marginLeft:8,marginTop:4,marginRight:8,marginBottom:4},icons:[]}}}function dt(){return{show:!0,size:"auto",axisLine:{show:!0,color:ot,size:1},tickText:{show:!0,color:rt,size:12,family:"Helvetica Neue",weight:"normal",marginStart:4,marginEnd:4},tickLine:{show:!0,size:1,length:3,color:ot}}}function ht(){var t=dt();return t.type=K.Normal,t.position=Y.Right,t.inside=!1,t.reverse=!1,t}function pt(){function t(){return{show:!0,line:{show:!0,style:N.Dashed,dashedValue:[4,2],size:1,color:rt},text:{show:!0,style:$.Fill,color:it,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:N.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:rt,borderRadius:2,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:rt}}}return{show:!0,horizontal:t(),vertical:t()}}function vt(){var t=st(.35),e=st(.25);function a(){return{style:$.Fill,color:it,size:12,family:"Helvetica Neue",weight:"normal",borderStyle:N.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:nt,paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:nt}}return{point:{color:nt,borderColor:t,borderSize:1,radius:5,activeColor:nt,activeBorderColor:t,activeBorderSize:3,activeRadius:5},line:{style:N.Solid,smooth:!1,color:nt,size:1,dashedValue:[2,2]},rect:{style:$.Fill,color:e,borderColor:nt,borderSize:1,borderRadius:0,borderStyle:N.Solid,borderDashedValue:[2,2]},polygon:{style:$.Fill,color:nt,borderColor:nt,borderSize:1,borderStyle:N.Solid,borderDashedValue:[2,2]},circle:{style:$.Fill,color:e,borderColor:nt,borderSize:1,borderStyle:N.Solid,borderDashedValue:[2,2]},arc:{style:N.Solid,color:nt,size:1,dashedValue:[2,2]},text:a(),rectText:a()}}function ft(){return{size:1,color:ot,fill:!0,activeBackgroundColor:st(.08)}}function gt(){return{grid:lt(),candle:ct(),indicator:ut(),xAxis:dt(),yAxis:ht(),separator:ft(),crosshair:pt(),overlay:vt()}}var mt=!1;function yt(t,e,a,i,n,r){if(mt){var o=""!==i?"Call api `".concat(i,"`").concat(""!==n||""!==r?", ":"."):"",s=""!==n?"invalid parameter `".concat(n,"`").concat(""!==r?", ":"."):"",l=""!==r?r:"";console.log(t,e,a,o,s,l)}}function bt(t,e,a){yt("%c😑 klinecharts warning%c %s%s%s","padding:3px 4px;border-radius:2px;color:#ffffff;background-color:#FF9600","color:#FF9600",t,e,null!==a&&void 0!==a?a:"")}function _t(t,e,a){yt("%c😟 klinecharts error%c %s%s%s","padding:3px 4px;border-radius:2px;color:#ffffff;background-color:#F92855;","color:#F92855;",t,e,a)}function xt(){yt("%c❤️ Welcome to klinecharts. Version is 9.8.12","border-radius:4px;border:dashed 1px #1677FF;line-height:70px;padding:0 20px;margin:16px 0;font-size:14px;color:#1677FF;","","","","")}function wt(t,e){if(It(t)||It(e))for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=t[a],n=e[a];It(n)&&It(i)?wt(i,n):At(e[a])&&(t[a]=St(e[a]))}}function St(t){if(!It(t))return t;var e;for(var a in e=kt(t)?[]:{},t)if(Object.prototype.hasOwnProperty.call(t,a)){var i=t[a];It(i)?e[a]=St(i):e[a]=i}return e}function kt(t){return"[object Array]"===Object.prototype.toString.call(t)}function Ct(t){return"function"===typeof t}function It(t){return"object"===typeof t&&At(t)}function Et(t){return"number"===typeof t&&!isNaN(t)}function At(t){return null!==t&&void 0!==t}function Pt(t){return"boolean"===typeof t}function Dt(t){return"string"===typeof t}var Tt,Mt,Rt=/\\(\\)?/g,Ft=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g");function Bt(t,e,a){if(At(t)){var i=[];e.replace(Ft,function(t){for(var e=[],a=1;a<arguments.length;a++)e[a-1]=arguments[a];var n=t;return At(e[1])?n=e[2].replace(Rt,"$1"):At(e[0])&&(n=e[0].trim()),i.push(n),""});var n=t,r=0,o=i.length;while(At(n)&&r<o)n=null===n||void 0===n?void 0:n[i[r++]];return At(n)?n:null!==a&&void 0!==a?a:"--"}return null!==a&&void 0!==a?a:"--"}function Lt(t,e,a){var i={};return t.formatToParts(new Date(e)).forEach(function(t){var e=t.type,a=t.value;switch(e){case"year":i.YYYY=a;break;case"month":i.MM=a;break;case"day":i.DD=a;break;case"hour":i.HH="24"===a?"00":a;break;case"minute":i.mm=a;break;case"second":i.ss=a;break}}),a.replace(/YYYY|MM|DD|HH|mm|ss/g,function(t){return i[t]})}function Nt(t,e){var a=+t;return Et(a)?a.toFixed(null!==e&&void 0!==e?e:2):"".concat(t)}function $t(t){var e=+t;if(Et(e)){if(e>1e9)return"".concat(+(e/1e9).toFixed(3),"B");if(e>1e6)return"".concat(+(e/1e6).toFixed(3),"M");if(e>1e3)return"".concat(+(e/1e3).toFixed(3),"K")}return"".concat(t)}function zt(t,e){var a="".concat(t);if(0===e.length)return a;if(a.includes(".")){var i=a.split(".");return"".concat(i[0].replace(/(\d)(?=(\d{3})+$)/g,function(t){return"".concat(t).concat(e)}),".").concat(i[1])}return a.replace(/(\d)(?=(\d{3})+$)/g,function(t){return"".concat(t).concat(e)})}function Vt(t,e){var a="".concat(t),i=new RegExp("\\.0{"+e+",}[1-9][0-9]*$");if(i.test(a)){var n=a.split("."),r=n[n.length-1],o=r.match(/0*/);if(At(o)){var s=o[0].length;return n[n.length-1]=r.replace(/0*/,"0{".concat(s,"}")),n.join(".")}}return a}function Ot(t){var e,a,i;return null!==(i=null===(a=null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView)||void 0===a?void 0:a.devicePixelRatio)&&void 0!==i?i:1}function Wt(t,e,a){return"".concat(null!==e&&void 0!==e?e:"normal"," ").concat(null!==t&&void 0!==t?t:12,"px ").concat(null!==a&&void 0!==a?a:"Helvetica Neue")}function Ht(t,e,a,i){if(!At(Tt)){var n=document.createElement("canvas"),r=Ot(n);Tt=n.getContext("2d"),Tt.scale(r,r)}return Tt.font=Wt(e,a,i),Math.round(Tt.measureText(t).width)}(function(t){t["OnDataReady"]="onDataReady",t["OnZoom"]="onZoom",t["OnScroll"]="onScroll",t["OnVisibleRangeChange"]="onVisibleRangeChange",t["OnTooltipIconClick"]="onTooltipIconClick",t["OnCrosshairChange"]="onCrosshairChange",t["OnCandleBarClick"]="onCandleBarClick",t["OnPaneDrag"]="onPaneDrag"})(Mt||(Mt={}));var Yt,Kt,Xt=function(){function t(){this._callbacks=[]}return t.prototype.subscribe=function(t){var e,a=null!==(e=this._callbacks.indexOf(t))&&void 0!==e?e:-1;a<0&&this._callbacks.push(t)},t.prototype.unsubscribe=function(t){var e;if(Ct(t)){var a=null!==(e=this._callbacks.indexOf(t))&&void 0!==e?e:-1;a>-1&&this._callbacks.splice(a,1)}else this._callbacks=[]},t.prototype.execute=function(t){this._callbacks.forEach(function(e){e(t)})},t.prototype.isEmpty=function(){return 0===this._callbacks.length},t}();function qt(t,e,a,i,n){var r,o=e.result,s=e.figures,l=e.styles,c=Bt(l,"circles",i.circles),u=c.length,d=Bt(l,"bars",i.bars),h=d.length,p=Bt(l,"lines",i.lines),v=p.length,f=0,g=0,m=0,y=0;s.forEach(function(s){var l;switch(s.type){case"circle":y=f;var b=c[f%u];r=X(X({},b),{color:b.noChangeColor}),f++;break;case"bar":y=g;var _=d[g%h];r=X(X({},_),{color:_.noChangeColor}),g++;break;case"line":y=m,r=p[m%v],m++;break}if(At(r)){var x={prev:{kLineData:t[a-1],indicatorData:o[a-1]},current:{kLineData:t[a],indicatorData:o[a]},next:{kLineData:t[a+1],indicatorData:o[a+1]}},w=null===(l=s.styles)||void 0===l?void 0:l.call(s,x,e,i);n(s,X(X({},r),w),y)}})}(function(t){t["Init"]="init",t["Forward"]="forward",t["Backward"]="backward"})(Yt||(Yt={})),function(t){t["Normal"]="normal",t["Price"]="price",t["Volume"]="volume"}(Kt||(Kt={}));var Ut,jt=function(){function t(t){this.result=[],this._precisionFlag=!1;var e=t.name,a=t.shortName,i=t.series,n=t.calcParams,r=t.figures,o=t.precision,s=t.shouldOhlc,l=t.shouldFormatBigNumber,c=t.visible,u=t.zLevel,d=t.minValue,h=t.maxValue,p=t.styles,v=t.extendData,f=t.regenerateFigures,g=t.createTooltipDataSource,m=t.draw;this.name=e,this.shortName=null!==a&&void 0!==a?a:e,this.series=null!==i&&void 0!==i?i:Kt.Normal,this.precision=null!==o&&void 0!==o?o:4,this.calcParams=null!==n&&void 0!==n?n:[],this.figures=null!==r&&void 0!==r?r:[],this.shouldOhlc=null!==s&&void 0!==s&&s,this.shouldFormatBigNumber=null!==l&&void 0!==l&&l,this.visible=null===c||void 0===c||c,this.zLevel=null!==u&&void 0!==u?u:0,this.minValue=null!==d&&void 0!==d?d:null,this.maxValue=null!==h&&void 0!==h?h:null,this.styles=St(null!==p&&void 0!==p?p:{}),this.extendData=v,this.regenerateFigures=null!==f&&void 0!==f?f:null,this.createTooltipDataSource=null!==g&&void 0!==g?g:null,this.draw=null!==m&&void 0!==m?m:null}return t.prototype.setShortName=function(t){return this.shortName!==t&&(this.shortName=t,!0)},t.prototype.setSeries=function(t){return this.series!==t&&(this.series=t,!0)},t.prototype.setPrecision=function(t,e){var a=null!==e&&void 0!==e&&e,i=Math.floor(t);return!(!(i!==this.precision&&t>=0)||a&&(!a||this._precisionFlag))&&(this.precision=i,a||(this._precisionFlag=!0),!0)},t.prototype.setCalcParams=function(t){var e,a;return this.calcParams=t,this.figures=null!==(a=null===(e=this.regenerateFigures)||void 0===e?void 0:e.call(this,t))&&void 0!==a?a:this.figures,!0},t.prototype.setShouldOhlc=function(t){return this.shouldOhlc!==t&&(this.shouldOhlc=t,!0)},t.prototype.setShouldFormatBigNumber=function(t){return this.shouldFormatBigNumber!==t&&(this.shouldFormatBigNumber=t,!0)},t.prototype.setVisible=function(t){return this.visible!==t&&(this.visible=t,!0)},t.prototype.setZLevel=function(t){return this.zLevel!==t&&(this.zLevel=t,!0)},t.prototype.setStyles=function(t){return wt(this.styles,t),!0},t.prototype.setExtendData=function(t){return this.extendData!==t&&(this.extendData=t,!0)},t.prototype.setFigures=function(t){return this.figures!==t&&(this.figures=t,!0)},t.prototype.setMinValue=function(t){return this.minValue!==t&&(this.minValue=t,!0)},t.prototype.setMaxValue=function(t){return this.maxValue!==t&&(this.maxValue=t,!0)},t.prototype.setRegenerateFigures=function(t){return this.regenerateFigures!==t&&(this.regenerateFigures=t,!0)},t.prototype.setCreateTooltipDataSource=function(t){return this.createTooltipDataSource!==t&&(this.createTooltipDataSource=t,!0)},t.prototype.setDraw=function(t){return this.draw!==t&&(this.draw=t,!0)},t.prototype.calcIndicator=function(t){return q(this,void 0,void 0,function(){var e;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.calc(t,this)];case 1:return e=a.sent(),this.result=e,[2,!0];case 2:return a.sent(),[2,!1];case 3:return[2]}})})},t.extend=function(e){var a=function(t){function a(){return t.call(this,e)||this}return L(a,t),a.prototype.calc=function(t,a){return e.calc(t,a)},a}(t);return a},t}();function Gt(){return["mouseClickEvent","mouseDoubleClickEvent","mouseRightClickEvent","tapEvent","doubleTapEvent","mouseDownEvent","touchStartEvent","mouseMoveEvent","touchMoveEvent"]}(function(t){t["Normal"]="normal",t["WeakMagnet"]="weak_magnet",t["StrongMagnet"]="strong_magnet"})(Ut||(Ut={}));var Zt,Jt=1,Qt=-1,te="overlay_",ee="overlay_figure_",ae=function(){function t(t){this.currentStep=Jt,this.points=[],this._prevPressedPoint=null,this._prevPressedPoints=[];var e=t.mode,a=t.modeSensitivity,i=t.extendData,n=t.styles,r=t.name,o=t.totalStep,s=t.lock,l=t.visible,c=t.zLevel,u=t.needDefaultPointFigure,d=t.needDefaultXAxisFigure,h=t.needDefaultYAxisFigure,p=t.createPointFigures,v=t.createXAxisFigures,f=t.createYAxisFigures,g=t.performEventPressedMove,m=t.performEventMoveForDrawing,y=t.onDrawStart,b=t.onDrawing,_=t.onDrawEnd,x=t.onClick,w=t.onDoubleClick,S=t.onRightClick,k=t.onPressedMoveStart,C=t.onPressedMoving,I=t.onPressedMoveEnd,E=t.onMouseEnter,A=t.onMouseLeave,P=t.onRemoved,D=t.onSelected,T=t.onDeselected;this.name=r,this.totalStep=!Et(o)||o<2?1:o,this.lock=null!==s&&void 0!==s&&s,this.visible=null===l||void 0===l||l,this.zLevel=null!==c&&void 0!==c?c:0,this.needDefaultPointFigure=null!==u&&void 0!==u&&u,this.needDefaultXAxisFigure=null!==d&&void 0!==d&&d,this.needDefaultYAxisFigure=null!==h&&void 0!==h&&h,this.mode=null!==e&&void 0!==e?e:Ut.Normal,this.modeSensitivity=null!==a&&void 0!==a?a:8,this.extendData=i,this.styles=St(null!==n&&void 0!==n?n:{}),this.createPointFigures=null!==p&&void 0!==p?p:null,this.createXAxisFigures=null!==v&&void 0!==v?v:null,this.createYAxisFigures=null!==f&&void 0!==f?f:null,this.performEventPressedMove=null!==g&&void 0!==g?g:null,this.performEventMoveForDrawing=null!==m&&void 0!==m?m:null,this.onDrawStart=null!==y&&void 0!==y?y:null,this.onDrawing=null!==b&&void 0!==b?b:null,this.onDrawEnd=null!==_&&void 0!==_?_:null,this.onClick=null!==x&&void 0!==x?x:null,this.onDoubleClick=null!==w&&void 0!==w?w:null,this.onRightClick=null!==S&&void 0!==S?S:null,this.onPressedMoveStart=null!==k&&void 0!==k?k:null,this.onPressedMoving=null!==C&&void 0!==C?C:null,this.onPressedMoveEnd=null!==I&&void 0!==I?I:null,this.onMouseEnter=null!==E&&void 0!==E?E:null,this.onMouseLeave=null!==A&&void 0!==A?A:null,this.onRemoved=null!==P&&void 0!==P?P:null,this.onSelected=null!==D&&void 0!==D?D:null,this.onDeselected=null!==T&&void 0!==T?T:null}return t.prototype.setId=function(t){return!Dt(this.id)&&(this.id=t,!0)},t.prototype.setGroupId=function(t){return!Dt(this.groupId)&&(this.groupId=t,!0)},t.prototype.setPaneId=function(t){this.paneId=t},t.prototype.setExtendData=function(t){return t!==this.extendData&&(this.extendData=t,!0)},t.prototype.setStyles=function(t){return wt(this.styles,t),!0},t.prototype.setPoints=function(t){if(t.length>0){var e=void 0;if(this.points=Z([],G(t),!1),t.length>=this.totalStep-1?(this.currentStep=Qt,e=this.totalStep-1):(this.currentStep=t.length+1,e=t.length),null!==this.performEventMoveForDrawing)for(var a=0;a<e;a++)this.performEventMoveForDrawing({currentStep:a+2,mode:this.mode,points:this.points,performPointIndex:a,performPoint:this.points[a]});return this.currentStep===Qt&&null!==this.performEventPressedMove&&this.performEventPressedMove({currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:this.points.length-1,performPoint:this.points[this.points.length-1]}),!0}return!1},t.prototype.setLock=function(t){return this.lock!==t&&(this.lock=t,!0)},t.prototype.setVisible=function(t){return this.visible!==t&&(this.visible=t,!0)},t.prototype.setZLevel=function(t){return this.zLevel!==t&&(this.zLevel=t,!0)},t.prototype.setMode=function(t){return this.mode!==t&&(this.mode=t,!0)},t.prototype.setModeSensitivity=function(t){return this.modeSensitivity!==t&&(this.modeSensitivity=t,!0)},t.prototype.setOnDrawStartCallback=function(t){return this.onDrawStart!==t&&(this.onDrawStart=t,!0)},t.prototype.setOnDrawingCallback=function(t){return this.onDrawing!==t&&(this.onDrawing=t,!0)},t.prototype.setOnDrawEndCallback=function(t){return this.onDrawEnd!==t&&(this.onDrawEnd=t,!0)},t.prototype.setOnClickCallback=function(t){return this.onClick!==t&&(this.onClick=t,!0)},t.prototype.setOnDoubleClickCallback=function(t){return this.onDoubleClick!==t&&(this.onDoubleClick=t,!0)},t.prototype.setOnRightClickCallback=function(t){return this.onRightClick!==t&&(this.onRightClick=t,!0)},t.prototype.setOnPressedMoveStartCallback=function(t){return this.onPressedMoveStart!==t&&(this.onPressedMoveStart=t,!0)},t.prototype.setOnPressedMovingCallback=function(t){return this.onPressedMoving!==t&&(this.onPressedMoving=t,!0)},t.prototype.setOnPressedMoveEndCallback=function(t){return this.onPressedMoveEnd!==t&&(this.onPressedMoveEnd=t,!0)},t.prototype.setOnMouseEnterCallback=function(t){return this.onMouseEnter!==t&&(this.onMouseEnter=t,!0)},t.prototype.setOnMouseLeaveCallback=function(t){return this.onMouseLeave!==t&&(this.onMouseLeave=t,!0)},t.prototype.setOnRemovedCallback=function(t){return this.onRemoved!==t&&(this.onRemoved=t,!0)},t.prototype.setOnSelectedCallback=function(t){return this.onSelected!==t&&(this.onSelected=t,!0)},t.prototype.setOnDeselectedCallback=function(t){return this.onDeselected!==t&&(this.onDeselected=t,!0)},t.prototype.nextStep=function(){this.currentStep===this.totalStep-1?this.currentStep=Qt:this.currentStep++},t.prototype.forceComplete=function(){this.currentStep=Qt},t.prototype.isDrawing=function(){return this.currentStep!==Qt},t.prototype.isStart=function(){return this.currentStep===Jt},t.prototype.eventMoveForDrawing=function(t){var e,a=this.currentStep-1,i={};Et(t.timestamp)&&(i.timestamp=t.timestamp),Et(t.dataIndex)&&(i.dataIndex=t.dataIndex),Et(t.value)&&(i.value=t.value),this.points[a]=i,null===(e=this.performEventMoveForDrawing)||void 0===e||e.call(this,{currentStep:this.currentStep,mode:this.mode,points:this.points,performPointIndex:a,performPoint:i})},t.prototype.eventPressedPointMove=function(t,e){var a;Et(t.dataIndex)&&(this.points[e].dataIndex=t.dataIndex,this.points[e].timestamp=t.timestamp),Et(t.value)&&(this.points[e].value=t.value),null===(a=this.performEventPressedMove)||void 0===a||a.call(this,{currentStep:this.currentStep,points:this.points,mode:this.mode,performPointIndex:e,performPoint:this.points[e]})},t.prototype.startPressedMove=function(t){this._prevPressedPoint=X({},t),this._prevPressedPoints=St(this.points)},t.prototype.eventPressedOtherMove=function(t,e){var a,i;null!==this._prevPressedPoint&&(Et(t.dataIndex)&&Et(this._prevPressedPoint.dataIndex)&&(a=t.dataIndex-this._prevPressedPoint.dataIndex),Et(t.value)&&Et(this._prevPressedPoint.value)&&(i=t.value-this._prevPressedPoint.value),this.points=this._prevPressedPoints.map(function(t){var n;Et(t.timestamp)&&(t.dataIndex=e.timestampToDataIndex(t.timestamp));var r=X({},t);return Et(a)&&Et(t.dataIndex)&&(r.dataIndex=t.dataIndex+a,r.timestamp=null!==(n=e.dataIndexToTimestamp(r.dataIndex))&&void 0!==n?n:void 0),Et(i)&&Et(t.value)&&(r.value=t.value+i),r}))},t.extend=function(e){var a=function(t){function a(){return t.call(this,e)||this}return L(a,t),a}(t);return a},t}();function ie(){return{formatDate:Lt,formatBigNumber:$t}}(function(t){t[t["Tooltip"]=0]="Tooltip",t[t["Crosshair"]=1]="Crosshair",t[t["XAxis"]=2]="XAxis"})(Zt||(Zt={}));var ne="en-US",re=-1;function oe(t){return Ct(window.requestAnimationFrame)?window.requestAnimationFrame(t):window.setTimeout(t,20)}function se(t){Ct(window.cancelAnimationFrame)?window.cancelAnimationFrame(t):window.clearTimeout(t)}var le=function(){function t(t){this._options={duration:500,iterationCount:1},this._currentIterationCount=0,this._running=!1,this._time=0,wt(this._options,t)}return t.prototype._loop=function(){var t=this;this._running=!0;var e=function(){var a;if(t._running){var i=(new Date).getTime()-t._time;i<t._options.duration?(null===(a=t._doFrameCallback)||void 0===a||a.call(t,i),oe(e)):(t.stop(),t._currentIterationCount++,t._currentIterationCount<t._options.iterationCount&&t.start())}};oe(e)},t.prototype.doFrame=function(t){return this._doFrameCallback=t,this},t.prototype.setDuration=function(t){return this._options.duration=t,this},t.prototype.setIterationCount=function(t){return this._options.iterationCount=t,this},t.prototype.start=function(){this._running||(this._time=(new Date).getTime(),this._loop())},t.prototype.stop=function(){var t;this._running&&(null===(t=this._doFrameCallback)||void 0===t||t.call(this,this._options.duration)),this._running=!1},t}(),ce=1,ue=(new Date).getTime();function de(t){var e=(new Date).getTime();return e===ue?++ce:ce=1,ue=e,"".concat(null!==t&&void 0!==t?t:"").concat(e,"_").concat(ce)}function he(t,e){var a,i=document.createElement(t),n=null!==e&&void 0!==e?e:{};for(var r in n)i.style[r]=null!==(a=n[r])&&void 0!==a?a:"";return i}function pe(t,e,a){var i=0,n=0;for(n=t.length-1;i!==n;){var r=Math.floor((n+i)/2),o=n-i,s=t[r][e];if(a===t[i][e])return i;if(a===t[n][e])return n;if(a===s)return r;if(a>s?i=r:n=r,o<=2)break}return i}function ve(t){var e=Math.floor(ye(t)),a=be(e),i=t/a,n=0;return n=i<1.5?1:i<2.5?2:i<3.5?3:i<4.5?4:i<5.5?5:i<6.5?6:8,t=n*a,e>=-20?+t.toFixed(e<0?-e:0):t}function fe(t,e){null==e&&(e=10),e=Math.min(Math.max(0,e),20);var a=(+t).toFixed(e);return+a}function ge(t){var e=t.toString(),a=e.indexOf("e");if(a>0){var i=+e.slice(a+1);return i<0?-i:0}var n=e.indexOf(".");return n<0?0:e.length-1-n}function me(t,e,a){var i=[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER];return t.forEach(function(t){var n,r;i[0]=Math.max(null!==(n=t[e])&&void 0!==n?n:t,i[0]),i[1]=Math.min(null!==(r=t[a])&&void 0!==r?r:t,i[1])}),i}function ye(t){return Math.log(t)/Math.log(10)}function be(t){return Math.pow(10,t)}function _e(){return{from:0,to:0,realFrom:0,realTo:0}}var xe={MIN:1,MAX:50},we=8,Se=80,ke=.88,Ce=10,Ie=function(){function t(t){this._dateTimeFormat=this._buildDateTimeFormat(),this._zoomEnabled=!0,this._scrollEnabled=!0,this._totalBarSpace=0,this._barSpace=we,this._offsetRightDistance=Se,this._startLastBarRightSideDiffBarCount=0,this._scrollLimitRole=0,this._minVisibleBarCount={left:2,right:2},this._maxOffsetDistance={left:50,right:50},this._visibleRange=_e(),this._chartStore=t,this._gapBarSpace=this._calcGapBarSpace(),this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace}return t.prototype._calcGapBarSpace=function(){var t;return this._barSpace>3?t=Math.floor(this._barSpace*ke):(t=Math.floor(this._barSpace),t===this._barSpace&&t--),t%2===0&&t--,t=Math.max(1,t),t},t.prototype.adjustVisibleRange=function(){var t,e,a,i,n=this._chartStore.getDataList(),r=n.length,o=this._totalBarSpace/this._barSpace;1===this._scrollLimitRole?(a=(this._totalBarSpace-this._maxOffsetDistance.right)/this._barSpace,i=(this._totalBarSpace-this._maxOffsetDistance.left)/this._barSpace):(a=this._minVisibleBarCount.left,i=this._minVisibleBarCount.right),a=Math.max(0,a),i=Math.max(0,i);var s=o-Math.min(a,r);this._lastBarRightSideDiffBarCount>s&&(this._lastBarRightSideDiffBarCount=s);var l=-r+Math.min(i,r);this._lastBarRightSideDiffBarCount<l&&(this._lastBarRightSideDiffBarCount=l);var c=Math.round(this._lastBarRightSideDiffBarCount+r+.5),u=c;c>r&&(c=r);var d=Math.round(c-o)-1;d<0&&(d=0);var h=this._lastBarRightSideDiffBarCount>0?Math.round(r+this._lastBarRightSideDiffBarCount-o)-1:d;if(this._visibleRange={from:d,to:c,realFrom:h,realTo:u},this._chartStore.getActionStore().execute(Mt.OnVisibleRangeChange,this._visibleRange),this._chartStore.adjustVisibleDataList(),0===d){var p=n[0];this._chartStore.executeLoadMoreCallback(null!==(t=null===p||void 0===p?void 0:p.timestamp)&&void 0!==t?t:null),this._chartStore.executeLoadDataCallback({type:Yt.Forward,data:null!==p&&void 0!==p?p:null})}c===r&&this._chartStore.executeLoadDataCallback({type:Yt.Backward,data:null!==(e=n[r-1])&&void 0!==e?e:null})},t.prototype.getDateTimeFormat=function(){return this._dateTimeFormat},t.prototype._buildDateTimeFormat=function(t){var e={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"};Dt(t)&&(e.timeZone=t);var a=null;try{a=new Intl.DateTimeFormat("en",e)}catch(i){bt("","","Timezone is error!!!")}return a},t.prototype.setTimezone=function(t){var e=this._buildDateTimeFormat(t);null!==e&&(this._dateTimeFormat=e)},t.prototype.getTimezone=function(){return this._dateTimeFormat.resolvedOptions().timeZone},t.prototype.getBarSpace=function(){return{bar:this._barSpace,halfBar:this._barSpace/2,gapBar:this._gapBarSpace,halfGapBar:Math.floor(this._gapBarSpace/2)}},t.prototype.setBarSpace=function(t,e){t<xe.MIN||t>xe.MAX||this._barSpace===t||(this._barSpace=t,this._gapBarSpace=this._calcGapBarSpace(),null===e||void 0===e||e(),this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0))},t.prototype.setTotalBarSpace=function(t){return this._totalBarSpace!==t&&(this._totalBarSpace=t,this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0)),this},t.prototype.setOffsetRightDistance=function(t,e){return this._offsetRightDistance=1===this._scrollLimitRole?Math.min(this._maxOffsetDistance.right,t):t,this._lastBarRightSideDiffBarCount=this._offsetRightDistance/this._barSpace,null!==e&&void 0!==e&&e&&(this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0)),this},t.prototype.resetOffsetRightDistance=function(){this.setOffsetRightDistance(this._offsetRightDistance)},t.prototype.getInitialOffsetRightDistance=function(){return this._offsetRightDistance},t.prototype.getOffsetRightDistance=function(){return Math.max(0,this._lastBarRightSideDiffBarCount*this._barSpace)},t.prototype.getLastBarRightSideDiffBarCount=function(){return this._lastBarRightSideDiffBarCount},t.prototype.setLastBarRightSideDiffBarCount=function(t){return this._lastBarRightSideDiffBarCount=t,this},t.prototype.setMaxOffsetLeftDistance=function(t){return this._scrollLimitRole=1,this._maxOffsetDistance.left=t,this},t.prototype.setMaxOffsetRightDistance=function(t){return this._scrollLimitRole=1,this._maxOffsetDistance.right=t,this},t.prototype.setLeftMinVisibleBarCount=function(t){return this._scrollLimitRole=0,this._minVisibleBarCount.left=t,this},t.prototype.setRightMinVisibleBarCount=function(t){return this._scrollLimitRole=0,this._minVisibleBarCount.right=t,this},t.prototype.getVisibleRange=function(){return this._visibleRange},t.prototype.startScroll=function(){this._startLastBarRightSideDiffBarCount=this._lastBarRightSideDiffBarCount},t.prototype.scroll=function(t){if(this._scrollEnabled){var e=t/this._barSpace,a=this._lastBarRightSideDiffBarCount*this._barSpace;this._lastBarRightSideDiffBarCount=this._startLastBarRightSideDiffBarCount-e,this.adjustVisibleRange(),this._chartStore.getTooltipStore().recalculateCrosshair(!0),this._chartStore.getChart().adjustPaneViewport(!1,!0,!0,!0);var i=Math.round(a-this._lastBarRightSideDiffBarCount*this._barSpace);0!==i&&this._chartStore.getActionStore().execute(Mt.OnScroll,{distance:i})}},t.prototype.getDataByDataIndex=function(t){var e;return null!==(e=this._chartStore.getDataList()[t])&&void 0!==e?e:null},t.prototype.coordinateToFloatIndex=function(t){var e=this._chartStore.getDataList().length,a=(this._totalBarSpace-t)/this._barSpace,i=e+this._lastBarRightSideDiffBarCount-a;return Math.round(1e6*i)/1e6},t.prototype.dataIndexToTimestamp=function(t){var e,a=this.getDataByDataIndex(t);return null!==(e=null===a||void 0===a?void 0:a.timestamp)&&void 0!==e?e:null},t.prototype.timestampToDataIndex=function(t){var e=this._chartStore.getDataList();return 0===e.length?0:pe(e,"timestamp",t)},t.prototype.dataIndexToCoordinate=function(t){var e=this._chartStore.getDataList().length,a=e+this._lastBarRightSideDiffBarCount-t;return Math.floor(this._totalBarSpace-(a-.5)*this._barSpace)},t.prototype.coordinateToDataIndex=function(t){return Math.ceil(this.coordinateToFloatIndex(t))-1},t.prototype.zoom=function(t,e){var a,i=this;if(this._zoomEnabled){var n=null!==e&&void 0!==e?e:null;if(!Et(null===n||void 0===n?void 0:n.x)){var r=this._chartStore.getTooltipStore().getCrosshair();n={x:null!==(a=null===r||void 0===r?void 0:r.x)&&void 0!==a?a:this._totalBarSpace/2}}var o=n.x,s=this.coordinateToFloatIndex(o),l=this._barSpace,c=this._barSpace+t*(this._barSpace/Ce);this.setBarSpace(c,function(){i._lastBarRightSideDiffBarCount+=s-i.coordinateToFloatIndex(o)});var u=this._barSpace/l;1!==u&&this._chartStore.getActionStore().execute(Mt.OnZoom,{scale:u})}},t.prototype.setZoomEnabled=function(t){return this._zoomEnabled=t,this},t.prototype.getZoomEnabled=function(){return this._zoomEnabled},t.prototype.setScrollEnabled=function(t){return this._scrollEnabled=t,this},t.prototype.getScrollEnabled=function(){return this._scrollEnabled},t.prototype.clear=function(){this._visibleRange=_e()},t}(),Ee={name:"AVP",shortName:"AVP",series:Kt.Price,precision:2,figures:[{key:"avp",title:"AVP: ",type:"line"}],calc:function(t){var e=0,a=0;return t.map(function(t){var i,n,r={},o=null!==(i=null===t||void 0===t?void 0:t.turnover)&&void 0!==i?i:0,s=null!==(n=null===t||void 0===t?void 0:t.volume)&&void 0!==n?n:0;return e+=o,a+=s,0!==a&&(r.avp=e/a),r})}},Ae={name:"AO",shortName:"AO",calcParams:[5,34],figures:[{key:"ao",title:"AO: ",type:"bar",baseValue:0,styles:function(t,e,a){var i,n,r,o,s,l=t.prev,c=t.current,u=null!==(n=null===(i=l.indicatorData)||void 0===i?void 0:i.ao)&&void 0!==n?n:Number.MIN_SAFE_INTEGER,d=null!==(o=null===(r=c.indicatorData)||void 0===r?void 0:r.ao)&&void 0!==o?o:Number.MIN_SAFE_INTEGER;s=d>u?Bt(e.styles,"bars[0].upColor",a.bars[0].upColor):Bt(e.styles,"bars[0].downColor",a.bars[0].downColor);var h=d>u?$.Stroke:$.Fill;return{color:s,style:h,borderColor:s}}}],calc:function(t,e){var a=e.calcParams,i=Math.max(a[0],a[1]),n=0,r=0,o=0,s=0;return t.map(function(e,l){var c={},u=(e.low+e.high)/2;if(n+=u,r+=u,l>=a[0]-1){o=n/a[0];var d=t[l-(a[0]-1)];n-=(d.low+d.high)/2}if(l>=a[1]-1){s=r/a[1];d=t[l-(a[1]-1)];r-=(d.low+d.high)/2}return l>=i-1&&(c.ao=o-s),c})}},Pe={name:"BIAS",shortName:"BIAS",calcParams:[6,12,24],figures:[{key:"bias1",title:"BIAS6: ",type:"line"},{key:"bias2",title:"BIAS12: ",type:"line"},{key:"bias3",title:"BIAS24: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){return{key:"bias".concat(e+1),title:"BIAS".concat(t,": "),type:"line"}})},calc:function(t,e){var a=e.calcParams,i=e.figures,n=[];return t.map(function(e,r){var o={},s=e.close;return a.forEach(function(e,l){var c;if(n[l]=(null!==(c=n[l])&&void 0!==c?c:0)+s,r>=e-1){var u=n[l]/a[l];o[i[l].key]=(s-u)/u*100,n[l]-=t[r-(e-1)].close}}),o})}};function De(t,e){var a=t.length,i=0;return t.forEach(function(t){var a=t.close-e;i+=a*a}),i=Math.abs(i),Math.sqrt(i/a)}var Te={name:"BOLL",shortName:"BOLL",series:Kt.Price,calcParams:[20,2],precision:2,shouldOhlc:!0,figures:[{key:"up",title:"UP: ",type:"line"},{key:"mid",title:"MID: ",type:"line"},{key:"dn",title:"DN: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=a[0]-1,n=0;return t.map(function(e,r){var o=e.close,s={};if(n+=o,r>=i){s.mid=n/a[0];var l=De(t.slice(r-i,r+1),s.mid);s.up=s.mid+a[1]*l,s.dn=s.mid-a[1]*l,n-=t[r-i].close}return s})}},Me={name:"BRAR",shortName:"BRAR",calcParams:[26],figures:[{key:"br",title:"BR: ",type:"line"},{key:"ar",title:"AR: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=0,n=0,r=0,o=0;return t.map(function(e,s){var l,c,u={},d=e.high,h=e.low,p=e.open,v=(null!==(l=t[s-1])&&void 0!==l?l:e).close;if(r+=d-p,o+=p-h,i+=d-v,n+=v-h,s>=a[0]-1){u.ar=0!==o?r/o*100:0,u.br=0!==n?i/n*100:0;var f=t[s-(a[0]-1)],g=f.high,m=f.low,y=f.open,b=(null!==(c=t[s-a[0]])&&void 0!==c?c:t[s-(a[0]-1)]).close;i-=g-b,n-=b-m,r-=g-y,o-=y-m}return u})}},Re={name:"BBI",shortName:"BBI",series:Kt.Price,precision:2,calcParams:[3,6,12,24],shouldOhlc:!0,figures:[{key:"bbi",title:"BBI: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=Math.max.apply(Math,Z([],G(a),!1)),n=[],r=[];return t.map(function(e,o){var s={},l=e.close;if(a.forEach(function(e,a){var i;n[a]=(null!==(i=n[a])&&void 0!==i?i:0)+l,o>=e-1&&(r[a]=n[a]/e,n[a]-=t[o-(e-1)].close)}),o>=i-1){var c=0;r.forEach(function(t){c+=t}),s.bbi=c/4}return s})}},Fe={name:"CCI",shortName:"CCI",calcParams:[20],figures:[{key:"cci",title:"CCI: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=a[0]-1,n=0,r=[];return t.map(function(e,o){var s={},l=(e.high+e.low+e.close)/3;if(n+=l,r.push(l),o>=i){var c=n/a[0],u=r.slice(o-i,o+1),d=0;u.forEach(function(t){d+=Math.abs(t-c)});var h=d/a[0];s.cci=0!==h?(l-c)/h/.015:0;var p=(t[o-i].high+t[o-i].low+t[o-i].close)/3;n-=p}return s})}},Be={name:"CR",shortName:"CR",calcParams:[26,10,20,40,60],figures:[{key:"cr",title:"CR: ",type:"line"},{key:"ma1",title:"MA1: ",type:"line"},{key:"ma2",title:"MA2: ",type:"line"},{key:"ma3",title:"MA3: ",type:"line"},{key:"ma4",title:"MA4: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=Math.ceil(a[1]/2.5+1),n=Math.ceil(a[2]/2.5+1),r=Math.ceil(a[3]/2.5+1),o=Math.ceil(a[4]/2.5+1),s=0,l=[],c=0,u=[],d=0,h=[],p=0,v=[],f=[];return t.forEach(function(e,g){var m,y,b,_,x,w={},S=null!==(m=t[g-1])&&void 0!==m?m:e,k=(S.high+S.close+S.low+S.open)/4,C=Math.max(0,e.high-k),I=Math.max(0,k-e.low);g>=a[0]-1&&(w.cr=0!==I?C/I*100:0,s+=w.cr,c+=w.cr,d+=w.cr,p+=w.cr,g>=a[0]+a[1]-2&&(l.push(s/a[1]),g>=a[0]+a[1]+i-3&&(w.ma1=l[l.length-1-i]),s-=null!==(y=f[g-(a[1]-1)].cr)&&void 0!==y?y:0),g>=a[0]+a[2]-2&&(u.push(c/a[2]),g>=a[0]+a[2]+n-3&&(w.ma2=u[u.length-1-n]),c-=null!==(b=f[g-(a[2]-1)].cr)&&void 0!==b?b:0),g>=a[0]+a[3]-2&&(h.push(d/a[3]),g>=a[0]+a[3]+r-3&&(w.ma3=h[h.length-1-r]),d-=null!==(_=f[g-(a[3]-1)].cr)&&void 0!==_?_:0),g>=a[0]+a[4]-2&&(v.push(p/a[4]),g>=a[0]+a[4]+o-3&&(w.ma4=v[v.length-1-o]),p-=null!==(x=f[g-(a[4]-1)].cr)&&void 0!==x?x:0)),f.push(w)}),f}},Le={name:"DMA",shortName:"DMA",calcParams:[10,50,10],figures:[{key:"dma",title:"DMA: ",type:"line"},{key:"ama",title:"AMA: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=Math.max(a[0],a[1]),n=0,r=0,o=0,s=[];return t.forEach(function(e,l){var c,u={},d=e.close;n+=d,r+=d;var h=0,p=0;if(l>=a[0]-1&&(h=n/a[0],n-=t[l-(a[0]-1)].close),l>=a[1]-1&&(p=r/a[1],r-=t[l-(a[1]-1)].close),l>=i-1){var v=h-p;u.dma=v,o+=v,l>=i+a[2]-2&&(u.ama=o/a[2],o-=null!==(c=s[l-(a[2]-1)].dma)&&void 0!==c?c:0)}s.push(u)}),s}},Ne={name:"DMI",shortName:"DMI",calcParams:[14,6],figures:[{key:"pdi",title:"PDI: ",type:"line"},{key:"mdi",title:"MDI: ",type:"line"},{key:"adx",title:"ADX: ",type:"line"},{key:"adxr",title:"ADXR: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=0,n=0,r=0,o=0,s=0,l=0,c=0,u=0,d=[];return t.forEach(function(e,h){var p,v,f={},g=null!==(p=t[h-1])&&void 0!==p?p:e,m=g.close,y=e.high,b=e.low,_=y-b,x=Math.abs(y-m),w=Math.abs(m-b),S=y-g.high,k=g.low-b,C=Math.max(Math.max(_,x),w),I=S>0&&S>k?S:0,E=k>0&&k>S?k:0;if(i+=C,n+=I,r+=E,h>=a[0]-1){h>a[0]-1?(o=o-o/a[0]+C,s=s-s/a[0]+I,l=l-l/a[0]+E):(o=i,s=n,l=r);var A=0,P=0;0!==o&&(A=100*s/o,P=100*l/o),f.pdi=A,f.mdi=P;var D=0;P+A!==0&&(D=Math.abs(P-A)/(P+A)*100),c+=D,h>=2*a[0]-2&&(u=h>2*a[0]-2?(u*(a[0]-1)+D)/a[0]:c/a[0],f.adx=u,h>=2*a[0]+a[1]-3&&(f.adxr=((null!==(v=d[h-(a[1]-1)].adx)&&void 0!==v?v:0)+u)/2))}d.push(f)}),d}},$e={name:"EMV",shortName:"EMV",calcParams:[14,9],figures:[{key:"emv",title:"EMV: ",type:"line"},{key:"maEmv",title:"MAEMV: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=0,n=[];return t.map(function(e,r){var o,s={};if(r>0){var l=t[r-1],c=e.high,u=e.low,d=null!==(o=e.volume)&&void 0!==o?o:0,h=(c+u)/2-(l.high+l.low)/2;if(0===d||c-u===0)s.emv=0;else{var p=d/1e8/(c-u);s.emv=h/p}i+=s.emv,n.push(s.emv),r>=a[0]&&(s.maEmv=i/a[0],i-=n[r-a[0]])}return s})}},ze={name:"EMA",shortName:"EMA",series:Kt.Price,calcParams:[6,12,20],precision:2,shouldOhlc:!0,figures:[{key:"ema1",title:"EMA6: ",type:"line"},{key:"ema2",title:"EMA12: ",type:"line"},{key:"ema3",title:"EMA20: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){return{key:"ema".concat(e+1),title:"EMA".concat(t,": "),type:"line"}})},calc:function(t,e){var a=e.calcParams,i=e.figures,n=0,r=[];return t.map(function(t,e){var o={},s=t.close;return n+=s,a.forEach(function(t,a){e>=t-1&&(r[a]=e>t-1?(2*s+(t-1)*r[a])/(t+1):n/t,o[i[a].key]=r[a])}),o})}},Ve={name:"MTM",shortName:"MTM",calcParams:[12,6],figures:[{key:"mtm",title:"MTM: ",type:"line"},{key:"maMtm",title:"MAMTM: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=0,n=[];return t.forEach(function(e,r){var o,s={};if(r>=a[0]){var l=e.close,c=t[r-a[0]].close;s.mtm=l-c,i+=s.mtm,r>=a[0]+a[1]-1&&(s.maMtm=i/a[1],i-=null!==(o=n[r-(a[1]-1)].mtm)&&void 0!==o?o:0)}n.push(s)}),n}},Oe={name:"MA",shortName:"MA",series:Kt.Price,calcParams:[5,10,30,60],precision:2,shouldOhlc:!0,figures:[{key:"ma5",title:"MA5: ",type:"line"},{key:"ma10",title:"MA10: ",type:"line"},{key:"ma30",title:"MA30: ",type:"line"},{key:"ma60",title:"MA60: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}})},calc:function(t,e){var a=e.calcParams,i=e.figures,n=[];return t.map(function(e,r){var o={},s=e.close;return a.forEach(function(e,a){var l;n[a]=(null!==(l=n[a])&&void 0!==l?l:0)+s,r>=e-1&&(o[i[a].key]=n[a]/e,n[a]-=t[r-(e-1)].close)}),o})}},We={name:"MACD",shortName:"MACD",calcParams:[12,26,9],figures:[{key:"dif",title:"DIF: ",type:"line"},{key:"dea",title:"DEA: ",type:"line"},{key:"macd",title:"MACD: ",type:"bar",baseValue:0,styles:function(t,e,a){var i,n,r,o,s,l=t.prev,c=t.current,u=null!==(n=null===(i=l.indicatorData)||void 0===i?void 0:i.macd)&&void 0!==n?n:Number.MIN_SAFE_INTEGER,d=null!==(o=null===(r=c.indicatorData)||void 0===r?void 0:r.macd)&&void 0!==o?o:Number.MIN_SAFE_INTEGER;s=d>0?Bt(e.styles,"bars[0].upColor",a.bars[0].upColor):d<0?Bt(e.styles,"bars[0].downColor",a.bars[0].downColor):Bt(e.styles,"bars[0].noChangeColor",a.bars[0].noChangeColor);var h=u<d?$.Stroke:$.Fill;return{style:h,color:s,borderColor:s}}}],calc:function(t,e){var a,i,n=e.calcParams,r=0,o=0,s=0,l=0,c=Math.max(n[0],n[1]);return t.map(function(t,e){var u={},d=t.close;return r+=d,e>=n[0]-1&&(a=e>n[0]-1?(2*d+(n[0]-1)*a)/(n[0]+1):r/n[0]),e>=n[1]-1&&(i=e>n[1]-1?(2*d+(n[1]-1)*i)/(n[1]+1):r/n[1]),e>=c-1&&(o=a-i,u.dif=o,s+=o,e>=c+n[2]-2&&(l=e>c+n[2]-2?(2*o+l*(n[2]-1))/(n[2]+1):s/n[2],u.macd=2*(o-l),u.dea=l)),u})}},He={name:"OBV",shortName:"OBV",calcParams:[30],figures:[{key:"obv",title:"OBV: ",type:"line"},{key:"maObv",title:"MAOBV: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=0,n=0,r=[];return t.forEach(function(e,o){var s,l,c,u,d=null!==(s=t[o-1])&&void 0!==s?s:e;e.close<d.close?n-=null!==(l=e.volume)&&void 0!==l?l:0:e.close>d.close&&(n+=null!==(c=e.volume)&&void 0!==c?c:0);var h={obv:n};i+=n,o>=a[0]-1&&(h.maObv=i/a[0],i-=null!==(u=r[o-(a[0]-1)].obv)&&void 0!==u?u:0),r.push(h)}),r}},Ye={name:"PVT",shortName:"PVT",figures:[{key:"pvt",title:"PVT: ",type:"line"}],calc:function(t){var e=0;return t.map(function(a,i){var n,r,o={},s=a.close,l=null!==(n=a.volume)&&void 0!==n?n:1,c=(null!==(r=t[i-1])&&void 0!==r?r:a).close,u=0,d=c*l;return 0!==d&&(u=(s-c)/d),e+=u,o.pvt=e,o})}},Ke={name:"PSY",shortName:"PSY",calcParams:[12,6],figures:[{key:"psy",title:"PSY: ",type:"line"},{key:"maPsy",title:"MAPSY: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=0,n=0,r=[],o=[];return t.forEach(function(e,s){var l,c,u={},d=(null!==(l=t[s-1])&&void 0!==l?l:e).close,h=e.close-d>0?1:0;r.push(h),i+=h,s>=a[0]-1&&(u.psy=i/a[0]*100,n+=u.psy,s>=a[0]+a[1]-2&&(u.maPsy=n/a[1],n-=null!==(c=o[s-(a[1]-1)].psy)&&void 0!==c?c:0),i-=r[s-(a[0]-1)]),o.push(u)}),o}},Xe={name:"ROC",shortName:"ROC",calcParams:[12,6],figures:[{key:"roc",title:"ROC: ",type:"line"},{key:"maRoc",title:"MAROC: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=[],n=0;return t.forEach(function(e,r){var o,s,l={};if(r>=a[0]-1){var c=e.close,u=(null!==(o=t[r-a[0]])&&void 0!==o?o:t[r-(a[0]-1)]).close;l.roc=0!==u?(c-u)/u*100:0,n+=l.roc,r>=a[0]-1+a[1]-1&&(l.maRoc=n/a[1],n-=null!==(s=i[r-(a[1]-1)].roc)&&void 0!==s?s:0)}i.push(l)}),i}},qe={name:"RSI",shortName:"RSI",calcParams:[6,12,24],figures:[{key:"rsi1",title:"RSI1: ",type:"line"},{key:"rsi2",title:"RSI2: ",type:"line"},{key:"rsi3",title:"RSI3: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){var a=e+1;return{key:"rsi".concat(a),title:"RSI".concat(a,": "),type:"line"}})},calc:function(t,e){var a=e.calcParams,i=e.figures,n=[],r=[];return t.map(function(e,o){var s,l={},c=(null!==(s=t[o-1])&&void 0!==s?s:e).close,u=e.close-c;return a.forEach(function(e,a){var s,c,d;if(u>0?n[a]=(null!==(s=n[a])&&void 0!==s?s:0)+u:r[a]=(null!==(c=r[a])&&void 0!==c?c:0)+Math.abs(u),o>=e-1){0!==r[a]?l[i[a].key]=100-100/(1+n[a]/r[a]):l[i[a].key]=0;var h=t[o-(e-1)],p=null!==(d=t[o-e])&&void 0!==d?d:h,v=h.close-p.close;v>0?n[a]-=v:r[a]-=Math.abs(v)}}),l})}},Ue={name:"SMA",shortName:"SMA",series:Kt.Price,calcParams:[12,2],precision:2,figures:[{key:"sma",title:"SMA: ",type:"line"}],shouldOhlc:!0,calc:function(t,e){var a=e.calcParams,i=0,n=0;return t.map(function(t,e){var r={},o=t.close;return i+=o,e>=a[0]-1&&(n=e>a[0]-1?(o*a[1]+n*(a[0]-a[1]+1))/(a[0]+1):i/a[0],r.sma=n),r})}},je={name:"KDJ",shortName:"KDJ",calcParams:[9,3,3],figures:[{key:"k",title:"K: ",type:"line"},{key:"d",title:"D: ",type:"line"},{key:"j",title:"J: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=[];return t.forEach(function(e,n){var r,o,s,l,c={},u=e.close;if(n>=a[0]-1){var d=me(t.slice(n-(a[0]-1),n+1),"high","low"),h=d[0],p=d[1],v=h-p,f=(u-p)/(0===v?1:v)*100;c.k=((a[1]-1)*(null!==(o=null===(r=i[n-1])||void 0===r?void 0:r.k)&&void 0!==o?o:50)+f)/a[1],c.d=((a[2]-1)*(null!==(l=null===(s=i[n-1])||void 0===s?void 0:s.d)&&void 0!==l?l:50)+c.k)/a[2],c.j=3*c.k-2*c.d}i.push(c)}),i}},Ge={name:"SAR",shortName:"SAR",series:Kt.Price,calcParams:[2,2,20],precision:2,shouldOhlc:!0,figures:[{key:"sar",title:"SAR: ",type:"circle",styles:function(t,e,a){var i,n,r=t.current,o=null!==(n=null===(i=r.indicatorData)||void 0===i?void 0:i.sar)&&void 0!==n?n:Number.MIN_SAFE_INTEGER,s=r.kLineData,l=((null===s||void 0===s?void 0:s.high)+(null===s||void 0===s?void 0:s.low))/2,c=o<l?Bt(e.styles,"circles[0].upColor",a.circles[0].upColor):Bt(e.styles,"circles[0].downColor",a.circles[0].downColor);return{color:c}}}],calc:function(t,e){var a=e.calcParams,i=a[0]/100,n=a[1]/100,r=a[2]/100,o=i,s=-100,l=!1,c=0;return t.map(function(e,a){var u=c,d=e.high,h=e.low;if(l){(-100===s||s<d)&&(s=d,o=Math.min(o+n,r)),c=u+o*(s-u);var p=Math.min(t[Math.max(1,a)-1].low,h);c>e.low?(c=s,o=i,s=-100,l=!l):c>p&&(c=p)}else{(-100===s||s>h)&&(s=h,o=Math.min(o+n,r)),c=u+o*(s-u);var v=Math.max(t[Math.max(1,a)-1].high,d);c<e.high?(c=s,o=0,s=-100,l=!l):c<v&&(c=v)}return{sar:c}})}},Ze={name:"TRIX",shortName:"TRIX",calcParams:[12,9],figures:[{key:"trix",title:"TRIX: ",type:"line"},{key:"maTrix",title:"MATRIX: ",type:"line"}],calc:function(t,e){var a,i,n,r=e.calcParams,o=0,s=0,l=0,c=0,u=[];return t.forEach(function(t,e){var d,h={},p=t.close;if(o+=p,e>=r[0]-1&&(a=e>r[0]-1?(2*p+(r[0]-1)*a)/(r[0]+1):o/r[0],s+=a,e>=2*r[0]-2&&(i=e>2*r[0]-2?(2*a+(r[0]-1)*i)/(r[0]+1):s/r[0],l+=i,e>=3*r[0]-3))){var v=void 0,f=0;e>3*r[0]-3?(v=(2*i+(r[0]-1)*n)/(r[0]+1),f=(v-n)/n*100):v=l/r[0],n=v,h.trix=f,c+=f,e>=3*r[0]+r[1]-4&&(h.maTrix=c/r[1],c-=null!==(d=u[e-(r[1]-1)].trix)&&void 0!==d?d:0)}u.push(h)}),u}};function Je(){return{key:"volume",title:"VOLUME: ",type:"bar",baseValue:0,styles:function(t,e,a){var i=t.current.kLineData,n=Bt(e.styles,"bars[0].noChangeColor",a.bars[0].noChangeColor);return At(i)&&(i.close>i.open?n=Bt(e.styles,"bars[0].upColor",a.bars[0].upColor):i.close<i.open&&(n=Bt(e.styles,"bars[0].downColor",a.bars[0].downColor))),{color:n}}}}var Qe={name:"VOL",shortName:"VOL",series:Kt.Volume,calcParams:[5,10,20],shouldFormatBigNumber:!0,precision:0,minValue:0,figures:[{key:"ma1",title:"MA5: ",type:"line"},{key:"ma2",title:"MA10: ",type:"line"},{key:"ma3",title:"MA20: ",type:"line"},Je()],regenerateFigures:function(t){var e=t.map(function(t,e){return{key:"ma".concat(e+1),title:"MA".concat(t,": "),type:"line"}});return e.push(Je()),e},calc:function(t,e){var a=e.calcParams,i=e.figures,n=[];return t.map(function(e,r){var o,s=null!==(o=e.volume)&&void 0!==o?o:0,l={volume:s};return a.forEach(function(e,a){var o,c;n[a]=(null!==(o=n[a])&&void 0!==o?o:0)+s,r>=e-1&&(l[i[a].key]=n[a]/e,n[a]-=null!==(c=t[r-(e-1)].volume)&&void 0!==c?c:0)}),l})}},ta={name:"VR",shortName:"VR",calcParams:[26,6],figures:[{key:"vr",title:"VR: ",type:"line"},{key:"maVr",title:"MAVR: ",type:"line"}],calc:function(t,e){var a=e.calcParams,i=0,n=0,r=0,o=0,s=[];return t.forEach(function(e,l){var c,u,d,h,p,v={},f=e.close,g=(null!==(c=t[l-1])&&void 0!==c?c:e).close,m=null!==(u=e.volume)&&void 0!==u?u:0;if(f>g?i+=m:f<g?n+=m:r+=m,l>=a[0]-1){var y=r/2;v.vr=n+y===0?0:(i+y)/(n+y)*100,o+=v.vr,l>=a[0]+a[1]-2&&(v.maVr=o/a[1],o-=null!==(d=s[l-(a[1]-1)].vr)&&void 0!==d?d:0);var b=t[l-(a[0]-1)],_=null!==(h=t[l-a[0]])&&void 0!==h?h:b,x=b.close,w=null!==(p=b.volume)&&void 0!==p?p:0;x>_.close?i-=w:x<_.close?n-=w:r-=w}s.push(v)}),s}},ea={name:"WR",shortName:"WR",calcParams:[6,10,14],figures:[{key:"wr1",title:"WR1: ",type:"line"},{key:"wr2",title:"WR2: ",type:"line"},{key:"wr3",title:"WR3: ",type:"line"}],regenerateFigures:function(t){return t.map(function(t,e){return{key:"wr".concat(e+1),title:"WR".concat(e+1,": "),type:"line"}})},calc:function(t,e){var a=e.calcParams,i=e.figures;return t.map(function(e,n){var r={},o=e.close;return a.forEach(function(e,a){var s=e-1;if(n>=s){var l=me(t.slice(n-s,n+1),"high","low"),c=l[0],u=l[1],d=c-u;r[i[a].key]=0===d?0:(o-c)/d*100}}),r})}},aa={},ia=[Ee,Ae,Pe,Te,Me,Re,Fe,Be,Le,Ne,$e,ze,Ve,Oe,We,He,Ye,Ke,Xe,qe,Ue,je,Ge,Ze,Qe,ta,ea];function na(t){aa[t.name]=jt.extend(t)}function ra(t){var e;return null!==(e=aa[t])&&void 0!==e?e:null}ia.forEach(function(t){aa[t.name]=jt.extend(t)});var oa=function(){function t(t){this._instances=new Map,this._chartStore=t}return t.prototype._overrideInstance=function(t,e){var a=e.shortName,i=e.series,n=e.calcParams,r=e.precision,o=e.figures,s=e.minValue,l=e.maxValue,c=e.shouldOhlc,u=e.shouldFormatBigNumber,d=e.visible,h=e.zLevel,p=e.styles,v=e.extendData,f=e.regenerateFigures,g=e.createTooltipDataSource,m=e.draw,y=e.calc,b=!1;Dt(a)&&t.setShortName(a)&&(b=!0),At(i)&&t.setSeries(i)&&(b=!0);var _=!1;kt(n)&&t.setCalcParams(n)&&(b=!0,_=!0),kt(o)&&t.setFigures(o)&&(b=!0,_=!0),void 0!==s&&t.setMinValue(s)&&(b=!0),void 0!==l&&t.setMinValue(l)&&(b=!0),Et(r)&&t.setPrecision(r)&&(b=!0),Pt(c)&&t.setShouldOhlc(c)&&(b=!0),Pt(u)&&t.setShouldFormatBigNumber(u)&&(b=!0),Pt(d)&&t.setVisible(d)&&(b=!0);var x=!1;return Et(h)&&t.setZLevel(h)&&(b=!0,x=!0),At(p)&&t.setStyles(p)&&(b=!0),void 0!==v&&t.setExtendData(v)&&(b=!0,_=!0),void 0!==f&&t.setRegenerateFigures(f)&&(b=!0),void 0!==g&&t.setCreateTooltipDataSource(g)&&(b=!0),void 0!==m&&t.setDraw(m)&&(b=!0),Ct(y)&&(t.calc=y,_=!0),[b,_,x]},t.prototype._sort=function(t){var e;Dt(t)?null===(e=this._instances.get(t))||void 0===e||e.sort(function(t,e){return t.zLevel-e.zLevel}):this._instances.forEach(function(t){t.sort(function(t,e){return t.zLevel-e.zLevel})})},t.prototype.addInstance=function(t,e,a){return q(this,void 0,void 0,function(){var i,n,r,o,s;return U(this,function(l){switch(l.label){case 0:return i=t.name,n=this._instances.get(e),At(n)?(r=n.find(function(t){return t.name===i}),At(r)?[4,Promise.reject(new Error("Duplicate indicators."))]:[3,2]):[3,2];case 1:return[2,l.sent()];case 2:return At(n)||(n=[]),o=ra(i),s=new o,this.synchronizeSeriesPrecision(s),this._overrideInstance(s,t),a||(n=[]),n.push(s),this._instances.set(e,n),this._sort(e),[4,s.calcIndicator(this._chartStore.getDataList())];case 3:return[2,l.sent()]}})})},t.prototype.getInstances=function(t){var e;return null!==(e=this._instances.get(t))&&void 0!==e?e:[]},t.prototype.removeInstance=function(t,e){var a,i=!1,n=this._instances.get(t);if(At(n)){if(Dt(e)){var r=n.findIndex(function(t){return t.name===e});r>-1&&(n.splice(r,1),i=!0)}else this._instances.set(t,[]),i=!0;0===(null===(a=this._instances.get(t))||void 0===a?void 0:a.length)&&this._instances.delete(t)}return i},t.prototype.hasInstances=function(t){return this._instances.has(t)},t.prototype.calcInstance=function(t,e){return q(this,void 0,void 0,function(){var a,i,n,r,o=this;return U(this,function(s){switch(s.label){case 0:return a=[],Dt(t)?Dt(e)?(i=this._instances.get(e),At(i)&&(n=i.find(function(e){return e.name===t}),At(n)&&a.push(n.calcIndicator(this._chartStore.getDataList())))):this._instances.forEach(function(e){var i=e.find(function(e){return e.name===t});At(i)&&a.push(i.calcIndicator(o._chartStore.getDataList()))}):this._instances.forEach(function(t){t.forEach(function(t){a.push(t.calcIndicator(o._chartStore.getDataList()))})}),[4,Promise.all(a)];case 1:return r=s.sent(),[2,r.includes(!0)]}})})},t.prototype.getInstanceByPaneId=function(t,e){var a,i,n=function(t){var e=new Map;return t.forEach(function(t){e.set(t.name,t)}),e};if(Dt(t)){var r=null!==(a=this._instances.get(t))&&void 0!==a?a:[];return Dt(e)?null!==(i=null===r||void 0===r?void 0:r.find(function(t){return t.name===e}))&&void 0!==i?i:null:n(r)}var o=new Map;return this._instances.forEach(function(t,e){o.set(e,n(t))}),o},t.prototype.synchronizeSeriesPrecision=function(t){var e=this._chartStore.getPrecision(),a=e.price,i=e.volume,n=function(t){switch(t.series){case Kt.Price:t.setPrecision(a,!0);break;case Kt.Volume:t.setPrecision(i,!0);break}};At(t)?n(t):this._instances.forEach(function(t){t.forEach(function(t){n(t)})})},t.prototype.override=function(t,e){return q(this,void 0,void 0,function(){var a,i,n,r,o,s,l,c=this;return U(this,function(u){switch(u.label){case 0:return a=t.name,i=new Map,null!==e?(n=this._instances.get(e),At(n)&&i.set(e,n)):i=this._instances,r=!1,o=[],s=!1,i.forEach(function(e){var i=e.find(function(t){return t.name===a});if(At(i)){var n=c._overrideInstance(i,t);n[2]&&(s=!0),n[1]?o.push(i.calcIndicator(c._chartStore.getDataList())):n[0]&&(r=!0)}}),s&&this._sort(),[4,Promise.all(o)];case 1:return l=u.sent(),[2,[r,l.includes(!0)]]}})})},t}(),sa=function(){function t(t){this._crosshair={},this._activeIcon=null,this._chartStore=t}return t.prototype.setCrosshair=function(t,e){var a,i,n=null!==e&&void 0!==e?e:{},r=n.notInvalidate,o=n.notExecuteAction,s=this._chartStore.getDataList(),l=null!==t&&void 0!==t?t:{};Et(l.x)?(a=this._chartStore.getTimeScaleStore().coordinateToDataIndex(l.x),i=a<0?0:a>s.length-1?s.length-1:a):(a=s.length-1,i=a);var c=s[i],u=this._chartStore.getTimeScaleStore().dataIndexToCoordinate(a),d={x:this._crosshair.x,y:this._crosshair.y,paneId:this._crosshair.paneId};this._crosshair=X(X({},l),{realX:u,kLineData:c,realDataIndex:a,dataIndex:i}),d.x===l.x&&d.y===l.y&&d.paneId===l.paneId||(null===c||null!==o&&void 0!==o&&o||this._chartStore.getChart().crosshairChange(this._crosshair),null!==r&&void 0!==r&&r||this._chartStore.getChart().updatePane(1))},t.prototype.recalculateCrosshair=function(t){this.setCrosshair(this._crosshair,{notInvalidate:t})},t.prototype.getCrosshair=function(){return this._crosshair},t.prototype.setActiveIcon=function(t){this._activeIcon=null!==t&&void 0!==t?t:null},t.prototype.getActiveIcon=function(){return this._activeIcon},t.prototype.clear=function(){this.setCrosshair({},{notInvalidate:!0}),this.setActiveIcon()},t}(),la={name:"fibonacciLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e,a=t.coordinates,i=t.bounding,n=t.overlay,r=t.precision,o=t.thousandsSeparator,s=t.decimalFoldThreshold,l=t.yAxis,c=n.points;if(a.length>0){var u=null===(e=null===l||void 0===l?void 0:l.isInCandle())||void 0===e||e?r.price:r.excludePriceVolumeMax,d=[],h=[],p=0,v=i.width;if(a.length>1&&Et(c[0].value)&&Et(c[1].value)){var f=[1,.786,.618,.5,.382,.236,0],g=a[0].y-a[1].y,m=c[0].value-c[1].value;f.forEach(function(t){var e,i=a[1].y+g*t,n=Vt(zt(((null!==(e=c[1].value)&&void 0!==e?e:0)+m*t).toFixed(u),o),s);d.push({coordinates:[{x:p,y:i},{x:v,y:i}]}),h.push({x:p,y:i,text:"".concat(n," (").concat((100*t).toFixed(1),"%)"),baseline:"bottom"})})}return[{type:"line",attrs:d},{type:"text",isCheckEvent:!1,attrs:h}]}return[]}},ca={name:"horizontalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,a=t.bounding,i={x:0,y:e[0].y};return At(e[1])&&e[0].x<e[1].x&&(i.x=a.width),[{type:"line",attrs:{coordinates:[e[0],i]}}]},performEventPressedMove:function(t){var e=t.points,a=t.performPoint;e[0].value=a.value,e[1].value=a.value},performEventMoveForDrawing:function(t){var e=t.currentStep,a=t.points,i=t.performPoint;2===e&&(a[0].value=i.value)}},ua={name:"horizontalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,a=[];return 2===e.length&&a.push({coordinates:e}),[{type:"line",attrs:a}]},performEventPressedMove:function(t){var e=t.points,a=t.performPoint;e[0].value=a.value,e[1].value=a.value},performEventMoveForDrawing:function(t){var e=t.currentStep,a=t.points,i=t.performPoint;2===e&&(a[0].value=i.value)}},da={name:"horizontalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,a=t.bounding;return[{type:"line",attrs:{coordinates:[{x:0,y:e[0].y},{x:a.width,y:e[0].y}]}}]}},ha=function(){function t(){this._children=[],this._callbacks=new Map}return t.prototype.registerEvent=function(t,e){return this._callbacks.set(t,e),this},t.prototype.onEvent=function(t,e,a){var i=this._callbacks.get(t);return!(!At(i)||!this.checkEventOn(e))&&i(e,a)},t.prototype.checkEventOn=function(t){var e,a;try{for(var i=j(this._children),n=i.next();!n.done;n=i.next()){var r=n.value;if(r.checkEventOn(t))return!0}}catch(o){e={error:o}}finally{try{n&&!n.done&&(a=i.return)&&a.call(i)}finally{if(e)throw e.error}}return!1},t.prototype.dispatchEvent=function(t,e,a){var i=this._children.length-1;if(i>-1)for(var n=i;n>-1;n--)if(this._children[n].dispatchEvent(t,e,a))return!0;return this.onEvent(t,e,a)},t.prototype.addChild=function(t){return this._children.push(t),this},t.prototype.clear=function(){this._children=[]},t}(),pa=2,va=function(t){function e(e){var a=t.call(this)||this;return a.attrs=e.attrs,a.styles=e.styles,a}return L(e,t),e.prototype.checkEventOn=function(t){return this.checkEventOnImp(t,this.attrs,this.styles)},e.prototype.setAttrs=function(t){return this.attrs=t,this},e.prototype.setStyles=function(t){return this.styles=t,this},e.prototype.draw=function(t){this.drawImp(t,this.attrs,this.styles)},e.extend=function(t){var a=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return L(a,e),a.prototype.checkEventOnImp=function(e,a,i){return t.checkEventOn(e,a,i)},a.prototype.drawImp=function(e,a,i){t.draw(e,a,i)},a}(e);return a},e}(ha);function fa(t,e){var a=[];a=a.concat(e);for(var i=0;i<a.length;i++){var n=a[i].coordinates;if(n.length>1)for(var r=1;r<n.length;r++){var o=n[r-1],s=n[r];if(o.x===s.x){if(Math.abs(o.y-t.y)+Math.abs(s.y-t.y)-Math.abs(o.y-s.y)<pa+pa&&Math.abs(t.x-o.x)<pa)return!0}else{var l=ya(o,s),c=ga(l,t),u=Math.abs(c-t.y);if(Math.abs(o.x-t.x)+Math.abs(s.x-t.x)-Math.abs(o.x-s.x)<pa+pa&&u*u/(l[0]*l[0]+1)<pa*pa)return!0}}}return!1}function ga(t,e){return null!==t?e.x*t[0]+t[1]:e.y}function ma(t,e,a){var i=ya(t,e);return ga(i,a)}function ya(t,e){var a=t.x-e.x;if(0!==a){var i=(t.y-e.y)/a,n=t.y-i*t.x;return[i,n]}return null}function ba(t,e,a){var i=e.length,n=Et(a)?a>0&&a<1?a:0:a?.5:0;if(n>0&&i>2){for(var r=e[0].x,o=e[0].y,s=1;s<i-1;s++){var l=e[s-1],c=e[s],u=e[s+1],d=c.x-l.x,h=c.y-l.y,p=u.x-c.x,v=u.y-c.y,f=u.x-l.x,g=u.y-l.y,m=Math.sqrt(d*d+h*h),y=Math.sqrt(p*p+v*v),b=y/(y+m),_=c.x+f*n*b,x=c.y+g*n*b;_=Math.min(_,Math.max(u.x,c.x)),x=Math.min(x,Math.max(u.y,c.y)),_=Math.max(_,Math.min(u.x,c.x)),x=Math.max(x,Math.min(u.y,c.y)),f=_-c.x,g=x-c.y;var w=c.x-f*m/y,S=c.y-g*m/y;w=Math.min(w,Math.max(l.x,c.x)),S=Math.min(S,Math.max(l.y,c.y)),w=Math.max(w,Math.min(l.x,c.x)),S=Math.max(S,Math.min(l.y,c.y)),f=c.x-w,g=c.y-S,_=c.x+f*y/m,x=c.y+g*y/m,t.bezierCurveTo(r,o,w,S,c.x,c.y),r=_,o=x}var k=e[i-1];t.bezierCurveTo(r,o,k.x,k.y,k.x,k.y)}else for(s=1;s<i;s++)t.lineTo(e[s].x,e[s].y)}function _a(t,e,a){var i=[];i=i.concat(e);var n=a.style,r=void 0===n?N.Solid:n,o=a.smooth,s=void 0!==o&&o,l=a.size,c=void 0===l?1:l,u=a.color,d=void 0===u?"currentColor":u,h=a.dashedValue,p=void 0===h?[2,2]:h;t.lineWidth=c,t.strokeStyle=d,r===N.Dashed?t.setLineDash(p):t.setLineDash([]);var v=c%2===1?.5:0;i.forEach(function(e){var a=e.coordinates;a.length>1&&(2!==a.length||a[0].x!==a[1].x&&a[0].y!==a[1].y?(t.save(),c%2===1&&t.translate(.5,.5),t.beginPath(),t.moveTo(a[0].x,a[0].y),ba(t,a,s),t.stroke(),t.closePath(),t.restore()):(t.beginPath(),a[0].x===a[1].x?(t.moveTo(a[0].x+v,a[0].y),t.lineTo(a[1].x+v,a[1].y)):(t.moveTo(a[0].x,a[0].y+v),t.lineTo(a[1].x,a[1].y+v)),t.stroke(),t.closePath()))})}var xa={name:"line",checkEventOn:fa,draw:function(t,e,a){_a(t,e,a)}};function wa(t,e,a){var i=null!==a&&void 0!==a?a:0,n=[];if(t.length>1)if(t[0].x===t[1].x){var r=0,o=e.height;if(n.push({coordinates:[{x:t[0].x,y:r},{x:t[0].x,y:o}]}),t.length>2){n.push({coordinates:[{x:t[2].x,y:r},{x:t[2].x,y:o}]});for(var s=t[0].x-t[2].x,l=0;l<i;l++){var c=s*(l+1);n.push({coordinates:[{x:t[0].x+c,y:r},{x:t[0].x+c,y:o}]})}}}else{var u=0,d=e.width,h=ya(t[0],t[1]),p=h[0],v=h[1];if(n.push({coordinates:[{x:u,y:u*p+v},{x:d,y:d*p+v}]}),t.length>2){var f=t[2].y-p*t[2].x;n.push({coordinates:[{x:u,y:u*p+f},{x:d,y:d*p+f}]});for(s=v-f,l=0;l<i;l++){var g=v+s*(l+1);n.push({coordinates:[{x:u,y:u*p+g},{x:d,y:d*p+g}]})}}}return n}var Sa={name:"parallelStraightLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,a=t.bounding;return[{type:"line",attrs:wa(e,a)}]}},ka={name:"priceChannelLine",totalStep:4,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,a=t.bounding;return[{type:"line",attrs:wa(e,a,1)}]}},Ca={name:"priceLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e,a=t.coordinates,i=t.bounding,n=t.precision,r=t.overlay,o=t.thousandsSeparator,s=t.decimalFoldThreshold,l=t.yAxis,c=r.points[0].value,u=void 0===c?0:c,d=null===(e=null===l||void 0===l?void 0:l.isInCandle())||void 0===e||e?n.price:n.excludePriceVolumeMax;return[{type:"line",attrs:{coordinates:[a[0],{x:i.width,y:a[0].y}]}},{type:"text",ignoreEvent:!0,attrs:{x:a[0].x,y:a[0].y,text:Vt(zt(u.toFixed(d),o),s),baseline:"bottom"}}]}};function Ia(t,e){if(t.length>1){var a=void 0;return a=t[0].x===t[1].x&&t[0].y!==t[1].y?t[0].y<t[1].y?{x:t[0].x,y:e.height}:{x:t[0].x,y:0}:t[0].x>t[1].x?{x:0,y:ma(t[0],t[1],{x:0,y:t[0].y})}:{x:e.width,y:ma(t[0],t[1],{x:e.width,y:t[0].y})},{coordinates:[t[0],a]}}return[]}var Ea={name:"rayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,a=t.bounding;return[{type:"line",attrs:Ia(e,a)}]}},Aa={name:"segment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]}},Pa={name:"straightLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,a=t.bounding;return 2===e.length?e[0].x===e[1].x?[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:a.height}]}}]:[{type:"line",attrs:{coordinates:[{x:0,y:ma(e[0],e[1],{x:0,y:e[0].y})},{x:a.width,y:ma(e[0],e[1],{x:a.width,y:e[0].y})}]}}]:[]}},Da={name:"verticalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,a=t.bounding;if(2===e.length){var i={x:e[0].x,y:0};return e[0].y<e[1].y&&(i.y=a.height),[{type:"line",attrs:{coordinates:[e[0],i]}}]}return[]},performEventPressedMove:function(t){var e=t.points,a=t.performPoint;e[0].timestamp=a.timestamp,e[0].dataIndex=a.dataIndex,e[1].timestamp=a.timestamp,e[1].dataIndex=a.dataIndex},performEventMoveForDrawing:function(t){var e=t.currentStep,a=t.points,i=t.performPoint;2===e&&(a[0].timestamp=i.timestamp,a[0].dataIndex=i.dataIndex)}},Ta={name:"verticalSegment",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates;return 2===e.length?[{type:"line",attrs:{coordinates:e}}]:[]},performEventPressedMove:function(t){var e=t.points,a=t.performPoint;e[0].timestamp=a.timestamp,e[0].dataIndex=a.dataIndex,e[1].timestamp=a.timestamp,e[1].dataIndex=a.dataIndex},performEventMoveForDrawing:function(t){var e=t.currentStep,a=t.points,i=t.performPoint;2===e&&(a[0].timestamp=i.timestamp,a[0].dataIndex=i.dataIndex)}},Ma={name:"verticalStraightLine",totalStep:2,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,a=t.bounding;return[{type:"line",attrs:{coordinates:[{x:e[0].x,y:0},{x:e[0].x,y:a.height}]}}]}},Ra={name:"simpleAnnotation",totalStep:2,styles:{line:{style:N.Dashed}},createPointFigures:function(t){var e,a,i=t.overlay,n=t.coordinates;At(i.extendData)&&(a=Ct(i.extendData)?i.extendData(i):null!==(e=i.extendData)&&void 0!==e?e:"");var r=n[0].x,o=n[0].y-6,s=o-50,l=s-5;return[{type:"line",attrs:{coordinates:[{x:r,y:o},{x:r,y:s}]},ignoreEvent:!0},{type:"polygon",attrs:{coordinates:[{x:r,y:s},{x:r-4,y:l},{x:r+4,y:l}]},ignoreEvent:!0},{type:"text",attrs:{x:r,y:l,text:null!==a&&void 0!==a?a:"",align:"center",baseline:"bottom"},ignoreEvent:!0}]}},Fa={name:"simpleTag",totalStep:2,styles:{line:{style:N.Dashed}},createPointFigures:function(t){var e=t.bounding,a=t.coordinates;return{type:"line",attrs:{coordinates:[{x:0,y:a[0].y},{x:e.width,y:a[0].y}]},ignoreEvent:!0}},createYAxisFigures:function(t){var e,a,i,n,r,o=t.overlay,s=t.coordinates,l=t.bounding,c=t.yAxis,u=t.precision,d=null!==(e=null===c||void 0===c?void 0:c.isFromZero())&&void 0!==e&&e;return d?(i="left",n=0):(i="right",n=l.width),At(o.extendData)&&(r=Ct(o.extendData)?o.extendData(o):null!==(a=o.extendData)&&void 0!==a?a:""),!At(r)&&Et(o.points[0].value)&&(r=Nt(o.points[0].value,u.price)),{type:"text",attrs:{x:n,y:s[0].y,text:null!==r&&void 0!==r?r:"",align:i,baseline:"middle"}}}},Ba={},La=[la,ca,ua,da,Sa,ka,Ca,Ea,Aa,Pa,Da,Ta,Ma,Ra,Fa];function Na(t){Ba[t.name]=ae.extend(t)}function $a(t){var e;return null!==(e=Ba[t])&&void 0!==e?e:null}La.forEach(function(t){Ba[t.name]=ae.extend(t)});var za=30,Va=100,Oa={CANDLE:"candle_pane",INDICATOR:"indicator_pane_",X_AXIS:"x_axis_pane"},Wa=function(){function t(t){this._instances=new Map,this._progressInstanceInfo=null,this._pressedInstanceInfo={paneId:"",instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._hoverInstanceInfo={paneId:"",instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._clickInstanceInfo={paneId:"",instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},this._chartStore=t}return t.prototype._overrideInstance=function(t,e){var a=e.id,i=e.groupId,n=e.points,r=e.styles,o=e.lock,s=e.visible,l=e.zLevel,c=e.mode,u=e.modeSensitivity,d=e.extendData,h=e.onDrawStart,p=e.onDrawing,v=e.onDrawEnd,f=e.onClick,g=e.onDoubleClick,m=e.onRightClick,y=e.onPressedMoveStart,b=e.onPressedMoving,_=e.onPressedMoveEnd,x=e.onMouseEnter,w=e.onMouseLeave,S=e.onRemoved,k=e.onSelected,C=e.onDeselected,I=!1,E=!1;return Dt(a)&&t.setId(a),Dt(i)&&t.setGroupId(i),kt(n)&&t.setPoints(n)&&(I=!0),At(r)&&t.setStyles(r)&&(I=!0),Pt(o)&&t.setLock(o),Pt(s)&&t.setVisible(s)&&(I=!0),Et(l)&&t.setZLevel(l)&&(I=!0,E=!0),At(c)&&t.setMode(c),Et(u)&&t.setModeSensitivity(u),void 0!==d&&t.setExtendData(d)&&(I=!0),void 0!==h&&t.setOnDrawStartCallback(h),void 0!==p&&t.setOnDrawingCallback(p),void 0!==v&&t.setOnDrawEndCallback(v),void 0!==f&&t.setOnClickCallback(f),void 0!==g&&t.setOnDoubleClickCallback(g),void 0!==m&&t.setOnRightClickCallback(m),void 0!==y&&t.setOnPressedMoveStartCallback(y),void 0!==b&&t.setOnPressedMovingCallback(b),void 0!==_&&t.setOnPressedMoveEndCallback(_),void 0!==x&&t.setOnMouseEnterCallback(x),void 0!==w&&t.setOnMouseLeaveCallback(w),void 0!==S&&t.setOnRemovedCallback(S),void 0!==k&&t.setOnSelectedCallback(k),void 0!==C&&t.setOnDeselectedCallback(C),[I,E]},t.prototype.getInstanceById=function(t){var e,a;try{for(var i=j(this._instances),n=i.next();!n.done;n=i.next()){var r=n.value,o=r[1],s=o.find(function(e){return e.id===t});if(At(s))return s}}catch(l){e={error:l}}finally{try{n&&!n.done&&(a=i.return)&&a.call(i)}finally{if(e)throw e.error}}return null!==this._progressInstanceInfo&&this._progressInstanceInfo.instance.id===t?this._progressInstanceInfo.instance:null},t.prototype._sort=function(t){var e;Dt(t)?null===(e=this._instances.get(t))||void 0===e||e.sort(function(t,e){return t.zLevel-e.zLevel}):this._instances.forEach(function(t){t.sort(function(t,e){return t.zLevel-e.zLevel})})},t.prototype.addInstances=function(t,e,a){var i=this,n=t.map(function(t){var n,r,o,s,l=null!==(n=t.id)&&void 0!==n?n:de(te);if(null===i.getInstanceById(l)){var c=$a(t.name);if(null!==c){var u=new c;u.setPaneId(e);var d=null!==(r=t.groupId)&&void 0!==r?r:l;return t.id=l,t.groupId=d,i._overrideInstance(u,t),u.isDrawing()?i._progressInstanceInfo={paneId:e,instance:u,appointPaneFlag:a}:(i._instances.has(e)||i._instances.set(e,[]),null===(o=i._instances.get(e))||void 0===o||o.push(u)),u.isStart()&&(null===(s=u.onDrawStart)||void 0===s||s.call(u,{overlay:u})),l}}return null});if(n.some(function(t){return null!==t})){this._sort();var r=this._chartStore.getChart();r.updatePane(1,e),r.updatePane(1,Oa.X_AXIS)}return n},t.prototype.getProgressInstanceInfo=function(){return this._progressInstanceInfo},t.prototype.progressInstanceComplete=function(){var t;if(null!==this._progressInstanceInfo){var e=this._progressInstanceInfo,a=e.instance,i=e.paneId;a.isDrawing()||(this._instances.has(i)||this._instances.set(i,[]),null===(t=this._instances.get(i))||void 0===t||t.push(a),this._sort(i),this._progressInstanceInfo=null)}},t.prototype.updateProgressInstanceInfo=function(t,e){null!==this._progressInstanceInfo&&(Pt(e)&&e&&(this._progressInstanceInfo.appointPaneFlag=e),this._progressInstanceInfo.paneId=t,this._progressInstanceInfo.instance.setPaneId(t))},t.prototype.getInstances=function(t){var e;if(!Dt(t)){var a=[];return this._instances.forEach(function(t){a=a.concat(t)}),a}return null!==(e=this._instances.get(t))&&void 0!==e?e:[]},t.prototype.override=function(t){var e=this,a=t.id,i=t.groupId,n=t.name,r=!1,o=!1,s=function(a){var i=e._overrideInstance(a,t);i[0]&&(r=!0),i[1]&&(o=!0)};if(Dt(a)){var l=this.getInstanceById(a);null!==l&&s(l)}else{var c=Dt(n),u=Dt(i);if(this._instances.forEach(function(t){t.forEach(function(t){(c&&t.name===n||u&&t.groupId===i||!c&&!u)&&s(t)})}),null!==this._progressInstanceInfo){var d=this._progressInstanceInfo.instance;(c&&d.name===n||u&&d.groupId===i||!c&&!u)&&s(d)}}o&&this._sort(),r&&this._chartStore.getChart().updatePane(1)},t.prototype.removeInstance=function(t){var e,a,i,n=function(t,e){if(Dt(t.id)){if(e.id!==t.id)return!1}else if(Dt(t.groupId)){if(e.groupId!==t.groupId)return!1}else if(Dt(t.name)&&e.name!==t.name)return!1;return!0},r=[],o=At(t);if(null!==this._progressInstanceInfo){var s=this._progressInstanceInfo.instance;(!o||o&&n(t,s))&&(r.push(this._progressInstanceInfo.paneId),null===(i=s.onRemoved)||void 0===i||i.call(s,{overlay:s}),this._progressInstanceInfo=null)}if(o){var l=new Map,c=function(e){var a=e[1],i=a.filter(function(a){var i;return!n(t,a)||(r.includes(e[0])||r.push(e[0]),null===(i=a.onRemoved)||void 0===i||i.call(a,{overlay:a}),!1)});i.length>0&&l.set(e[0],i)};try{for(var u=j(this._instances),d=u.next();!d.done;d=u.next()){var h=d.value;c(h)}}catch(v){e={error:v}}finally{try{d&&!d.done&&(a=u.return)&&a.call(u)}finally{if(e)throw e.error}}this._instances=l}else this._instances.forEach(function(t,e){r.push(e),t.forEach(function(t){var e;null===(e=t.onRemoved)||void 0===e||e.call(t,{overlay:t})})}),this._instances.clear();if(r.length>0){var p=this._chartStore.getChart();r.forEach(function(t){p.updatePane(1,t)}),p.updatePane(1,Oa.X_AXIS)}},t.prototype.setPressedInstanceInfo=function(t){this._pressedInstanceInfo=t},t.prototype.getPressedInstanceInfo=function(){return this._pressedInstanceInfo},t.prototype.updatePointPosition=function(t,e){if(t>0){var a=this._chartStore.getDataList();this._instances.forEach(function(i){i.forEach(function(i){var n=i.points;n.forEach(function(i){if(!At(i.timestamp)&&At(i.dataIndex)){e===Yt.Forward&&(i.dataIndex=i.dataIndex+t);var n=a[i.dataIndex];i.timestamp=null===n||void 0===n?void 0:n.timestamp}})})})}},t.prototype.setHoverInstanceInfo=function(t,e){var a,i,n=this._hoverInstanceInfo,r=n.instance,o=n.figureType,s=n.figureKey,l=n.figureIndex;if(((null===r||void 0===r?void 0:r.id)!==(null===(a=t.instance)||void 0===a?void 0:a.id)||o!==t.figureType||l!==t.figureIndex)&&(this._hoverInstanceInfo=t,(null===r||void 0===r?void 0:r.id)!==(null===(i=t.instance)||void 0===i?void 0:i.id))){var c=!1,u=!1;null!==r&&(u=!0,Ct(r.onMouseLeave)&&(r.onMouseLeave(X({overlay:r,figureKey:s,figureIndex:l},e)),c=!0)),null!==t.instance&&(u=!0,Ct(t.instance.onMouseEnter)&&(t.instance.onMouseEnter(X({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),c=!0)),u&&this._sort(),c||this._chartStore.getChart().updatePane(1)}},t.prototype.getHoverInstanceInfo=function(){return this._hoverInstanceInfo},t.prototype.setClickInstanceInfo=function(t,e){var a,i,n,r,o,s,l,c,u,d=this._clickInstanceInfo,h=d.paneId,p=d.instance,v=d.figureType,f=d.figureKey,g=d.figureIndex;if(null!==(i=null===(a=t.instance)||void 0===a?void 0:a.isDrawing())&&void 0!==i&&i||null===(r=null===(n=t.instance)||void 0===n?void 0:n.onClick)||void 0===r||r.call(n,X({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e)),((null===p||void 0===p?void 0:p.id)!==(null===(o=t.instance)||void 0===o?void 0:o.id)||v!==t.figureType||g!==t.figureIndex)&&(this._clickInstanceInfo=t,(null===p||void 0===p?void 0:p.id)!==(null===(s=t.instance)||void 0===s?void 0:s.id))){null===(l=null===p||void 0===p?void 0:p.onDeselected)||void 0===l||l.call(p,X({overlay:p,figureKey:f,figureIndex:g},e)),null===(u=null===(c=t.instance)||void 0===c?void 0:c.onSelected)||void 0===u||u.call(c,X({overlay:t.instance,figureKey:t.figureKey,figureIndex:t.figureIndex},e));var m=this._chartStore.getChart();m.updatePane(1,t.paneId),h!==t.paneId&&m.updatePane(1,h),m.updatePane(1,Oa.X_AXIS)}},t.prototype.getClickInstanceInfo=function(){return this._clickInstanceInfo},t.prototype.isEmpty=function(){return 0===this._instances.size&&null===this._progressInstanceInfo},t.prototype.isDrawing=function(){var t,e;return null!==this._progressInstanceInfo&&null!==(e=null===(t=this._progressInstanceInfo)||void 0===t?void 0:t.instance.isDrawing())&&void 0!==e&&e},t}(),Ha=function(){function t(){this._actions=new Map}return t.prototype.execute=function(t,e){var a;null===(a=this._actions.get(t))||void 0===a||a.execute(e)},t.prototype.subscribe=function(t,e){var a;this._actions.has(t)||this._actions.set(t,new Xt),null===(a=this._actions.get(t))||void 0===a||a.subscribe(e)},t.prototype.unsubscribe=function(t,e){var a=this._actions.get(t);At(a)&&(a.unsubscribe(e),a.isEmpty()&&this._actions.delete(t))},t.prototype.has=function(t){var e=this._actions.get(t);return At(e)&&!e.isEmpty()},t}(),Ya={grid:{horizontal:{color:"#EDEDED"},vertical:{color:"#EDEDED"}},candle:{priceMark:{high:{color:"#76808F"},low:{color:"#76808F"}},tooltip:{rect:{color:"#FEFEFE",borderColor:"#F2F3F5"},text:{color:"#76808F"}}},indicator:{tooltip:{text:{color:"#76808F"}}},xAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},yAxis:{axisLine:{color:"#DDDDDD"},tickText:{color:"#76808F"},tickLine:{color:"#DDDDDD"}},separator:{color:"#DDDDDD"},crosshair:{horizontal:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}},vertical:{line:{color:"#76808F"},text:{borderColor:"#686D76",backgroundColor:"#686D76"}}}},Ka={grid:{horizontal:{color:"#292929"},vertical:{color:"#292929"}},candle:{priceMark:{high:{color:"#929AA5"},low:{color:"#929AA5"}},tooltip:{rect:{color:"rgba(10, 10, 10, .6)",borderColor:"rgba(10, 10, 10, .6)"},text:{color:"#929AA5"}}},indicator:{tooltip:{text:{color:"#929AA5"}}},xAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},yAxis:{axisLine:{color:"#333333"},tickText:{color:"#929AA5"},tickLine:{color:"#333333"}},separator:{color:"#333333"},crosshair:{horizontal:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}},vertical:{line:{color:"#929AA5"},text:{borderColor:"#373a40",backgroundColor:"#373a40"}}}},Xa={light:Ya,dark:Ka};function qa(t){var e;return null!==(e=Xa[t])&&void 0!==e?e:null}var Ua=function(){function t(t,e){this._styles=gt(),this._customApi=ie(),this._locale=ne,this._precision={price:2,volume:0},this._thousandsSeparator=",",this._decimalFoldThreshold=3,this._dataList=[],this._loadMoreCallback=null,this._loadDataCallback=null,this._loading=!0,this._forwardMore=!0,this._backwardMore=!0,this._timeScaleStore=new Ie(this),this._indicatorStore=new oa(this),this._overlayStore=new Wa(this),this._tooltipStore=new sa(this),this._actionStore=new Ha,this._visibleDataList=[],this._chart=t,this.setOptions(e)}return t.prototype.adjustVisibleDataList=function(){this._visibleDataList=[];for(var t=this._timeScaleStore.getVisibleRange(),e=t.realFrom,a=t.realTo,i=e;i<a;i++){var n=this._dataList[i],r=this._timeScaleStore.dataIndexToCoordinate(i);this._visibleDataList.push({dataIndex:i,x:r,data:n})}},t.prototype.setOptions=function(t){var e,a,i,n;if(At(t)){var r=t.locale,o=t.timezone,s=t.styles,l=t.customApi,c=t.thousandsSeparator,u=t.decimalFoldThreshold;if(Dt(r)&&(this._locale=r),Dt(o)&&this._timeScaleStore.setTimezone(o),At(s)){var d=null;d=Dt(s)?qa(s):s,wt(this._styles,d),kt(null===(a=null===(e=null===d||void 0===d?void 0:d.candle)||void 0===e?void 0:e.tooltip)||void 0===a?void 0:a.custom)&&(this._styles.candle.tooltip.custom=null===(n=null===(i=null===d||void 0===d?void 0:d.candle)||void 0===i?void 0:i.tooltip)||void 0===n?void 0:n.custom)}At(l)&&wt(this._customApi,l),Dt(c)&&(this._thousandsSeparator=c),Et(u)&&u>0&&(this._decimalFoldThreshold=u)}return this},t.prototype.getStyles=function(){return this._styles},t.prototype.getLocale=function(){return this._locale},t.prototype.getCustomApi=function(){return this._customApi},t.prototype.getThousandsSeparator=function(){return this._thousandsSeparator},t.prototype.getDecimalFoldThreshold=function(){return this._decimalFoldThreshold},t.prototype.getPrecision=function(){return this._precision},t.prototype.setPrecision=function(t){return this._precision=t,this._indicatorStore.synchronizeSeriesPrecision(),this},t.prototype.getDataList=function(){return this._dataList},t.prototype.getVisibleFirstData=function(){var t,e=this._timeScaleStore.getVisibleRange().from;return null!==(t=this._dataList[e])&&void 0!==t?t:null},t.prototype.getVisibleDataList=function(){return this._visibleDataList},t.prototype.addData=function(t,e,a){return q(this,void 0,void 0,function(){var i,n,r,o,s,l,c;return U(this,function(u){switch(u.label){case 0:if(i=!1,n=!1,r=0,kt(t)){switch(r=t.length,e){case Yt.Init:this.clear(),this._dataList=t,this._forwardMore=null===a||void 0===a||a,this._timeScaleStore.resetOffsetRightDistance(),n=!0;break;case Yt.Backward:this._dataList=this._dataList.concat(t),this._backwardMore=null!==a&&void 0!==a&&a,n=r>0;break;case Yt.Forward:this._dataList=t.concat(this._dataList),this._forwardMore=null!==a&&void 0!==a&&a,n=r>0}this._loading=!1,i=!0}else o=this._dataList.length,s=t.timestamp,l=Bt(this._dataList[o-1],"timestamp",0),s>l?(this._dataList.push(t),c=this._timeScaleStore.getLastBarRightSideDiffBarCount(),c<0&&this._timeScaleStore.setLastBarRightSideDiffBarCount(--c),r=1,i=!0,n=!0):s===l&&(this._dataList[o-1]=t,i=!0,n=!0);if(!i)return[3,5];u.label=1;case 1:return u.trys.push([1,4,,5]),this._overlayStore.updatePointPosition(r,e),n?(this._timeScaleStore.adjustVisibleRange(),this._tooltipStore.recalculateCrosshair(!0),[4,this._indicatorStore.calcInstance()]):[3,3];case 2:u.sent(),this._chart.adjustPaneViewport(!1,!0,!0,!0),u.label=3;case 3:return this._actionStore.execute(Mt.OnDataReady),[3,5];case 4:return u.sent(),[3,5];case 5:return[2]}})})},t.prototype.setLoadMoreCallback=function(t){this._loadMoreCallback=t},t.prototype.executeLoadMoreCallback=function(t){this._forwardMore&&!this._loading&&At(this._loadMoreCallback)&&(this._loading=!0,this._loadMoreCallback(t))},t.prototype.setLoadDataCallback=function(t){this._loadDataCallback=t},t.prototype.executeLoadDataCallback=function(t){var e=this;if(!this._loading&&At(this._loadDataCallback)&&(this._forwardMore&&t.type===Yt.Forward||this._backwardMore&&t.type===Yt.Backward)){var a=function(a,i){e.addData(a,t.type,i).then(function(){}).catch(function(){})};this._loading=!0,this._loadDataCallback(X(X({},t),{callback:a}))}},t.prototype.clear=function(){this._forwardMore=!0,this._backwardMore=!0,this._loading=!0,this._dataList=[],this._visibleDataList=[],this._timeScaleStore.clear(),this._tooltipStore.clear()},t.prototype.getTimeScaleStore=function(){return this._timeScaleStore},t.prototype.getIndicatorStore=function(){return this._indicatorStore},t.prototype.getOverlayStore=function(){return this._overlayStore},t.prototype.getTooltipStore=function(){return this._tooltipStore},t.prototype.getActionStore=function(){return this._actionStore},t.prototype.getChart=function(){return this._chart},t}(),ja={MAIN:"main",X_AXIS:"xAxis",Y_AXIS:"yAxis",SEPARATOR:"separator"},Ga=7;function Za(){return q(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){var e=new ResizeObserver(function(a){t(a.every(function(t){return"devicePixelContentBoxSize"in t})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})];case 1:return[2,t.sent()]}})})}var Ja=function(){function t(t,e){var a=this;this._supportedDevicePixelContentBox=!1,this._width=0,this._height=0,this._pixelWidth=0,this._pixelHeight=0,this._nextPixelWidth=0,this._nextPixelHeight=0,this._requestAnimationId=re,this._mediaQueryListener=function(){var t=Ot(a._element);a._nextPixelWidth=Math.round(a._element.clientWidth*t),a._nextPixelHeight=Math.round(a._element.clientHeight*t),a._resetPixelRatio()},this._listener=e,this._element=he("canvas",t),this._ctx=this._element.getContext("2d",{willReadFrequently:!0}),Za().then(function(t){a._supportedDevicePixelContentBox=t,t?(a._resizeObserver=new ResizeObserver(function(t){var e,i=t.find(function(t){return t.target===a._element}),n=null===(e=null===i||void 0===i?void 0:i.devicePixelContentBoxSize)||void 0===e?void 0:e[0];At(n)&&(a._nextPixelWidth=n.inlineSize,a._nextPixelHeight=n.blockSize,a._pixelWidth===a._nextPixelWidth&&a._pixelHeight===a._nextPixelHeight||a._resetPixelRatio())}),a._resizeObserver.observe(a._element,{box:"device-pixel-content-box"})):(a._mediaQueryList=window.matchMedia("(resolution: ".concat(Ot(a._element),"dppx)")),a._mediaQueryList.addListener(a._mediaQueryListener))}).catch(function(t){return!1})}return t.prototype._resetPixelRatio=function(){var t=this;this._executeListener(function(){var e=t._element.clientWidth,a=t._element.clientHeight,i=t._nextPixelWidth/e,n=t._nextPixelHeight/a;t._width=e,t._height=a,t._pixelWidth=t._nextPixelWidth,t._pixelHeight=t._nextPixelHeight,t._element.width=t._nextPixelWidth,t._element.height=t._nextPixelHeight,t._ctx.scale(i,n)})},t.prototype._executeListener=function(t){var e=this;this._requestAnimationId===re&&(this._requestAnimationId=oe(function(){e._ctx.clearRect(0,0,e._width,e._height),null===t||void 0===t||t(),e._listener(),e._requestAnimationId=re}))},t.prototype.update=function(t,e){if(this._width!==t||this._height!==e){if(this._element.style.width="".concat(t,"px"),this._element.style.height="".concat(e,"px"),!this._supportedDevicePixelContentBox){var a=Ot(this._element);this._nextPixelWidth=Math.round(t*a),this._nextPixelHeight=Math.round(e*a),this._resetPixelRatio()}}else this._executeListener()},t.prototype.getElement=function(){return this._element},t.prototype.getContext=function(){return this._ctx},t.prototype.destroy=function(){At(this._resizeObserver)&&this._resizeObserver.unobserve(this._element),At(this._mediaQueryList)&&this._mediaQueryList.removeListener(this._mediaQueryListener)},t}();function Qa(t){var e={width:0,height:0,left:0,right:0,top:0,bottom:0};return At(t)&&wt(e,t),e}var ti=function(t){function e(e,a){var i=t.call(this)||this;return i._bounding=Qa(),i._pane=a,i._rootContainer=e,i._container=i.createContainer(),e.appendChild(i._container),i}return L(e,t),e.prototype.setBounding=function(t){return wt(this._bounding,t),this},e.prototype.getContainer=function(){return this._container},e.prototype.getBounding=function(){return this._bounding},e.prototype.getPane=function(){return this._pane},e.prototype.update=function(t){this.updateImp(this._container,this._bounding,null!==t&&void 0!==t?t:3)},e.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},e}(ha),ei=function(t){function e(e,a){var i=t.call(this,e,a)||this;i._mainCanvas=new Ja({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},function(){i.updateMain(i._mainCanvas.getContext())}),i._overlayCanvas=new Ja({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},function(){i.updateOverlay(i._overlayCanvas.getContext())});var n=i.getContainer();return n.appendChild(i._mainCanvas.getElement()),n.appendChild(i._overlayCanvas.getElement()),i}return L(e,t),e.prototype.createContainer=function(){return he("div",{margin:"0",padding:"0",position:"absolute",top:"0",overflow:"hidden",boxSizing:"border-box",zIndex:"1"})},e.prototype.updateImp=function(t,e,a){var i=e.width,n=e.height,r=e.left;t.style.left="".concat(r,"px");var o=a,s=t.clientWidth,l=t.clientHeight;switch(i===s&&n===l||(t.style.width="".concat(i,"px"),t.style.height="".concat(n,"px"),o=3),o){case 0:this._mainCanvas.update(i,n);break;case 1:this._overlayCanvas.update(i,n);break;case 3:case 4:this._mainCanvas.update(i,n),this._overlayCanvas.update(i,n);break}},e.prototype.destroy=function(){this._mainCanvas.destroy(),this._overlayCanvas.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),a=e.width,i=e.height,n=he("canvas",{width:"".concat(a,"px"),height:"".concat(i,"px"),boxSizing:"border-box"}),r=n.getContext("2d"),o=Ot(n);return n.width=a*o,n.height=i*o,r.scale(o,o),r.drawImage(this._mainCanvas.getElement(),0,0,a,i),t&&r.drawImage(this._overlayCanvas.getElement(),0,0,a,i),n},e}(ti);function ai(t){return"transparent"===t||"none"===t||/^[rR][gG][Bb][Aa]\(([\s]*(2[0-4][0-9]|25[0-5]|[01]?[0-9][0-9]?)[\s]*,){3}[\s]*0[\s]*\)$/.test(t)||/^[hH][Ss][Ll][Aa]\(([\s]*(3603[0-5][0-9]|[012]?[0-9][0-9]?)[\s]*,)([\s]*((100|[0-9][0-9]?)%|0)[\s]*,){2}([\s]*0[\s]*)\)$/.test(t)}function ii(t,e){var a=[];a=a.concat(e);for(var i=0;i<a.length;i++){var n=a[i],r=n.x,o=n.y,s=n.r,l=t.x-r,c=t.y-o;if(!(l*l+c*c>s*s))return!0}return!1}function ni(t,e,a){var i=[];i=i.concat(e);var n=a.style,r=void 0===n?$.Fill:n,o=a.color,s=void 0===o?"currentColor":o,l=a.borderSize,c=void 0===l?1:l,u=a.borderColor,d=void 0===u?"currentColor":u,h=a.borderStyle,p=void 0===h?N.Solid:h,v=a.borderDashedValue,f=void 0===v?[2,2]:v,g=(r===$.Fill||a.style===$.StrokeFill)&&(!Dt(s)||!ai(s));g&&(t.fillStyle=s,i.forEach(function(e){var a=e.x,i=e.y,n=e.r;t.beginPath(),t.arc(a,i,n,0,2*Math.PI),t.closePath(),t.fill()})),(r===$.Stroke||a.style===$.StrokeFill)&&c>0&&!ai(d)&&(t.strokeStyle=d,t.lineWidth=c,p===N.Dashed?t.setLineDash(f):t.setLineDash([]),i.forEach(function(e){var a=e.x,i=e.y,n=e.r;(!g||n>c)&&(t.beginPath(),t.arc(a,i,n,0,2*Math.PI),t.closePath(),t.stroke())}))}var ri={name:"circle",checkEventOn:ii,draw:function(t,e,a){ni(t,e,a)}};function oi(t,e){var a=[];a=a.concat(e);for(var i=0;i<a.length;i++){for(var n=!1,r=a[i].coordinates,o=0,s=r.length-1;o<r.length;s=o++)r[o].y>t.y!==r[s].y>t.y&&t.x<(r[s].x-r[o].x)*(t.y-r[o].y)/(r[s].y-r[o].y)+r[o].x&&(n=!n);if(n)return!0}return!1}function si(t,e,a){var i=[];i=i.concat(e);var n=a.style,r=void 0===n?$.Fill:n,o=a.color,s=void 0===o?"currentColor":o,l=a.borderSize,c=void 0===l?1:l,u=a.borderColor,d=void 0===u?"currentColor":u,h=a.borderStyle,p=void 0===h?N.Solid:h,v=a.borderDashedValue,f=void 0===v?[2,2]:v;r!==$.Fill&&a.style!==$.StrokeFill||Dt(s)&&ai(s)||(t.fillStyle=s,i.forEach(function(e){var a=e.coordinates;t.beginPath(),t.moveTo(a[0].x,a[0].y);for(var i=1;i<a.length;i++)t.lineTo(a[i].x,a[i].y);t.closePath(),t.fill()})),(r===$.Stroke||a.style===$.StrokeFill)&&c>0&&!ai(d)&&(t.strokeStyle=d,t.lineWidth=c,p===N.Dashed?t.setLineDash(f):t.setLineDash([]),i.forEach(function(e){var a=e.coordinates;t.beginPath(),t.moveTo(a[0].x,a[0].y);for(var i=1;i<a.length;i++)t.lineTo(a[i].x,a[i].y);t.closePath(),t.stroke()}))}var li={name:"polygon",checkEventOn:oi,draw:function(t,e,a){si(t,e,a)}};function ci(t,e){var a=[];a=a.concat(e);for(var i=0;i<a.length;i++){var n=a[i],r=n.x,o=n.width;o<2*pa&&(r-=pa,o=2*pa);var s=n.y,l=n.height;if(l<2*pa&&(s-=pa,l=2*pa),t.x>=r&&t.x<=r+o&&t.y>=s&&t.y<=s+l)return!0}return!1}function ui(t,e,a){var i,n=[];n=n.concat(e);var r=a.style,o=void 0===r?$.Fill:r,s=a.color,l=void 0===s?"transparent":s,c=a.borderSize,u=void 0===c?1:c,d=a.borderColor,h=void 0===d?"transparent":d,p=a.borderStyle,v=void 0===p?N.Solid:p,f=a.borderRadius,g=void 0===f?0:f,m=a.borderDashedValue,y=void 0===m?[2,2]:m,b=null!==(i=t.roundRect)&&void 0!==i?i:t.rect,_=(o===$.Fill||a.style===$.StrokeFill)&&(!Dt(l)||!ai(l));if(_&&(t.fillStyle=l,n.forEach(function(e){var a=e.x,i=e.y,n=e.width,r=e.height;t.beginPath(),b.call(t,a,i,n,r,g),t.closePath(),t.fill()})),(o===$.Stroke||a.style===$.StrokeFill)&&u>0&&!ai(h)){t.strokeStyle=h,t.fillStyle=h,t.lineWidth=u,v===N.Dashed?t.setLineDash(y):t.setLineDash([]);var x=u%2===1?.5:0,w=Math.round(2*x);n.forEach(function(e){var a=e.x,i=e.y,n=e.width,r=e.height;n>2*u&&r>2*u?(t.beginPath(),b.call(t,a+x,i+x,n-w,r-w,g),t.closePath(),t.stroke()):_||t.fillRect(a,i,n,r)})}}var di={name:"rect",checkEventOn:ci,draw:function(t,e,a){ui(t,e,a)}};function hi(t,e){var a,i,n=e.size,r=void 0===n?12:n,o=e.paddingLeft,s=void 0===o?0:o,l=e.paddingTop,c=void 0===l?0:l,u=e.paddingRight,d=void 0===u?0:u,h=e.paddingBottom,p=void 0===h?0:h,v=e.weight,f=void 0===v?"normal":v,g=e.family,m=t.x,y=t.y,b=t.text,_=t.align,x=void 0===_?"left":_,w=t.baseline,S=void 0===w?"top":w,k=t.width,C=t.height,I=null!==k&&void 0!==k?k:s+Ht(b,r,f,g)+d,E=null!==C&&void 0!==C?C:c+r+p;switch(x){case"left":case"start":a=m;break;case"right":case"end":a=m-I;break;default:a=m-I/2;break}switch(S){case"top":case"hanging":i=y;break;case"bottom":case"ideographic":case"alphabetic":i=y-E;break;default:i=y-E/2;break}return{x:a,y:i,width:I,height:E}}function pi(t,e,a){var i=[];i=i.concat(e);for(var n=0;n<i.length;n++){var r=hi(i[n],a),o=r.x,s=r.y,l=r.width,c=r.height;if(t.x>=o&&t.x<=o+l&&t.y>=s&&t.y<=s+c)return!0}return!1}function vi(t,e,a){var i=[];i=i.concat(e);var n=a.color,r=void 0===n?"currentColor":n,o=a.size,s=void 0===o?12:o,l=a.family,c=a.weight,u=a.paddingLeft,d=void 0===u?0:u,h=a.paddingTop,p=void 0===h?0:h,v=a.paddingRight,f=void 0===v?0:v,g=i.map(function(t){return hi(t,a)});ui(t,g,X(X({},a),{color:a.backgroundColor})),t.textAlign="left",t.textBaseline="top",t.font=Wt(s,c,l),t.fillStyle=r,i.forEach(function(e,a){var i=g[a];t.fillText(e.text,i.x+d,i.y+p,i.width-d-f)})}var fi={name:"text",checkEventOn:pi,draw:function(t,e,a){vi(t,e,a)}},gi=fi;function mi(t,e){var a=t.x-e.x,i=t.y-e.y;return Math.sqrt(a*a+i*i)}function yi(t,e){var a=[];a=a.concat(e);for(var i=0;i<a.length;i++){var n=a[i];if(Math.abs(mi(t,n)-n.r)<pa){var r=n.r,o=n.startAngle,s=n.endAngle,l=r*Math.cos(o)+n.x,c=r*Math.sin(o)+n.y,u=r*Math.cos(s)+n.x,d=r*Math.sin(s)+n.y;if(t.x<=Math.max(l,u)+pa&&t.x>=Math.min(l,u)-pa&&t.y<=Math.max(c,d)+pa&&t.y>=Math.min(c,d)-pa)return!0}}return!1}function bi(t,e,a){var i=[];i=i.concat(e);var n=a.style,r=void 0===n?N.Solid:n,o=a.size,s=void 0===o?1:o,l=a.color,c=void 0===l?"currentColor":l,u=a.dashedValue,d=void 0===u?[2,2]:u;t.lineWidth=s,t.strokeStyle=c,r===N.Dashed?t.setLineDash(d):t.setLineDash([]),i.forEach(function(e){var a=e.x,i=e.y,n=e.r,r=e.startAngle,o=e.endAngle;t.beginPath(),t.arc(a,i,n,r,o),t.stroke(),t.closePath()})}var _i={name:"arc",checkEventOn:yi,draw:function(t,e,a){bi(t,e,a)}},xi={},wi=[ri,xa,li,di,fi,gi,_i];function Si(t){var e;return null!==(e=xi[t])&&void 0!==e?e:null}wi.forEach(function(t){xi[t.name]=va.extend(t)});var ki=function(t){function e(e){var a=t.call(this)||this;return a._widget=e,a}return L(e,t),e.prototype.getWidget=function(){return this._widget},e.prototype.createFigure=function(t,e){var a=Si(t.name);if(null!==a){var i=new a(t);if(At(e)){for(var n in e)e.hasOwnProperty(n)&&i.registerEvent(n,e[n]);this.addChild(i)}return i}return null},e.prototype.draw=function(t){this.clear(),this.drawImp(t)},e}(ha),Ci=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.drawImp=function(t){var e,a,i=this.getWidget(),n=this.getWidget().getPane(),r=n.getChart(),o=i.getBounding(),s=r.getStyles().grid,l=s.show;if(l){t.save(),t.globalCompositeOperation="destination-over";var c=s.horizontal,u=c.show;if(u){var d=n.getAxisComponent(),h=d.getTicks().map(function(t){return{coordinates:[{x:0,y:t.coord},{x:o.width,y:t.coord}]}});null===(e=this.createFigure({name:"line",attrs:h,styles:c}))||void 0===e||e.draw(t)}var p=s.vertical,v=p.show;if(v){var f=r.getXAxisPane().getAxisComponent();h=f.getTicks().map(function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:o.height}]}});null===(a=this.createFigure({name:"line",attrs:h,styles:p}))||void 0===a||a.draw(t)}t.restore()}},e}(ki),Ii=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.eachChildren=function(t){var e=this.getWidget().getPane(),a=e.getChart().getChartStore(),i=a.getVisibleDataList(),n=a.getTimeScaleStore().getBarSpace();i.forEach(function(e,a){t(e,n,a)})},e}(ki),Ei=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundCandleBarClickEvent=function(t){return function(){return e.getWidget().getPane().getChart().getChartStore().getActionStore().execute(Mt.OnCandleBarClick,t),!1}},e}return L(e,t),e.prototype.drawImp=function(t){var e=this,a=this.getWidget().getPane(),i=a.getId()===Oa.CANDLE,n=a.getChart().getChartStore(),r=this.getCandleBarOptions(n);if(null!==r){var o=0,s=0;if(r.type===H.Ohlc){var l=n.getTimeScaleStore().getBarSpace().gapBar;o=Math.min(Math.max(Math.round(.2*l),1),8),o>2&&o%2===1&&o--,s=Math.floor(s/2)}var c=a.getAxisComponent();this.eachChildren(function(a,n){var l=a.data,u=a.x;if(At(l)){var d=l.open,h=l.high,p=l.low,v=l.close,f=r.type,g=r.styles,m=[];v>d?(m[0]=g.upColor,m[1]=g.upBorderColor,m[2]=g.upWickColor):v<d?(m[0]=g.downColor,m[1]=g.downBorderColor,m[2]=g.downWickColor):(m[0]=g.noChangeColor,m[1]=g.noChangeBorderColor,m[2]=g.noChangeWickColor);var y=c.convertToPixel(d),b=c.convertToPixel(v),_=[y,b,c.convertToPixel(h),c.convertToPixel(p)];_.sort(function(t,e){return t-e});var x=[];switch(f){case H.CandleSolid:x=e._createSolidBar(u,_,n,m);break;case H.CandleStroke:x=e._createStrokeBar(u,_,n,m);break;case H.CandleUpStroke:x=v>d?e._createStrokeBar(u,_,n,m):e._createSolidBar(u,_,n,m);break;case H.CandleDownStroke:x=d>v?e._createStrokeBar(u,_,n,m):e._createSolidBar(u,_,n,m);break;case H.Ohlc:x=[{name:"rect",attrs:[{x:u-s,y:_[0],width:o,height:_[3]-_[0]},{x:u-n.halfGapBar,y:y+o>_[3]?_[3]-o:y,width:n.halfGapBar,height:o},{x:u+s,y:b+o>_[3]?_[3]-o:b,width:n.halfGapBar-s,height:o}],styles:{color:m[0]}}];break}x.forEach(function(n){var r,o;i&&(o={mouseClickEvent:e._boundCandleBarClickEvent(a)}),null===(r=e.createFigure(n,o))||void 0===r||r.draw(t)})}})}},e.prototype.getCandleBarOptions=function(t){var e=t.getStyles().candle;return{type:e.type,styles:e.bar}},e.prototype._createSolidBar=function(t,e,a,i){return[{name:"rect",attrs:{x:t,y:e[0],width:1,height:e[3]-e[0]},styles:{color:i[2]}},{name:"rect",attrs:{x:t-a.halfGapBar,y:e[1],width:a.gapBar,height:Math.max(1,e[2]-e[1])},styles:{style:$.StrokeFill,color:i[0],borderColor:i[1]}}]},e.prototype._createStrokeBar=function(t,e,a,i){return[{name:"rect",attrs:[{x:t,y:e[0],width:1,height:e[1]-e[0]},{x:t,y:e[2],width:1,height:e[3]-e[2]}],styles:{color:i[2]}},{name:"rect",attrs:{x:t-a.halfGapBar,y:e[1],width:a.gapBar,height:Math.max(1,e[2]-e[1])},styles:{style:$.Stroke,borderColor:i[1]}}]},e}(Ii),Ai=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.getCandleBarOptions=function(t){var e,a,i=this.getWidget().getPane(),n=i.getAxisComponent();if(!n.isInCandle()){var r=t.getIndicatorStore().getInstances(i.getId());try{for(var o=j(r),s=o.next();!s.done;s=o.next()){var l=s.value;if(l.shouldOhlc&&l.visible){var c=l.styles,u=t.getStyles().indicator,d=Bt(c,"ohlc.upColor",u.ohlc.upColor),h=Bt(c,"ohlc.downColor",u.ohlc.downColor),p=Bt(c,"ohlc.noChangeColor",u.ohlc.noChangeColor);return{type:H.Ohlc,styles:{upColor:d,downColor:h,noChangeColor:p,upBorderColor:d,downBorderColor:h,noChangeBorderColor:p,upWickColor:d,downWickColor:h,noChangeWickColor:p}}}}}catch(v){e={error:v}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(e)throw e.error}}}return null},e.prototype.drawImp=function(e){var a=this;t.prototype.drawImp.call(this,e);var i=this.getWidget(),n=i.getPane(),r=n.getChart(),o=i.getBounding(),s=r.getXAxisPane().getAxisComponent(),l=n.getAxisComponent(),c=r.getChartStore(),u=c.getDataList(),d=c.getTimeScaleStore(),h=d.getVisibleRange(),p=c.getIndicatorStore().getInstances(n.getId()),v=c.getStyles().indicator;e.save(),p.forEach(function(t){var i;if(t.visible){t.zLevel<0?e.globalCompositeOperation="destination-over":e.globalCompositeOperation="source-over";var n=!1;if(null!==t.draw&&(e.save(),n=null!==(i=t.draw({ctx:e,kLineDataList:u,indicator:t,visibleRange:h,bounding:o,barSpace:d.getBarSpace(),defaultStyles:v,xAxis:s,yAxis:l}))&&void 0!==i&&i,e.restore()),!n){var r=t.result,c=[];a.eachChildren(function(i,n){var d,h,p,f=n.halfGapBar,g=i.dataIndex,m=i.x,y=s.convertToPixel(g-1),b=s.convertToPixel(g+1),_=null!==(d=r[g-1])&&void 0!==d?d:null,x=null!==(h=r[g])&&void 0!==h?h:null,w=null!==(p=r[g+1])&&void 0!==p?p:null,S={x:y},k={x:m},C={x:b};t.figures.forEach(function(t){var e=t.key,a=null===_||void 0===_?void 0:_[e];Et(a)&&(S[e]=l.convertToPixel(a));var i=null===x||void 0===x?void 0:x[e];Et(i)&&(k[e]=l.convertToPixel(i));var n=null===w||void 0===w?void 0:w[e];Et(n)&&(C[e]=l.convertToPixel(n))}),qt(u,t,g,v,function(t,i,r){var u,d,h;if(At(null===x||void 0===x?void 0:x[t.key])){var p=k[t.key],v=null===(u=t.attrs)||void 0===u?void 0:u.call(t,{data:{prev:_,current:x,next:w},coordinate:{prev:S,current:k,next:C},bounding:o,barSpace:n,xAxis:s,yAxis:l});if(!At(v))switch(t.type){case"circle":v={x:m,y:p,r:Math.max(1,f)};break;case"rect":case"bar":var g=null!==(d=t.baseValue)&&void 0!==d?d:l.getRange().from,y=l.convertToPixel(g),b=Math.abs(y-p);g!==(null===x||void 0===x?void 0:x[t.key])&&(b=Math.max(1,b));var I=void 0;I=p>y?y:p,v={x:m-f,y:I,width:Math.max(1,2*f),height:b};break;case"line":At(c[r])||(c[r]=[]),Et(k[t.key])&&Et(C[t.key])&&c[r].push({coordinates:[{x:k.x,y:k[t.key]},{x:C.x,y:C[t.key]}],styles:i});break}var E=t.type;At(v)&&"line"!==E&&(null===(h=a.createFigure({name:"bar"===E?"rect":E,attrs:v,styles:i}))||void 0===h||h.draw(e))}})}),c.forEach(function(t){if(t.length>1){for(var i=[{coordinates:[t[0].coordinates[0],t[0].coordinates[1]],styles:t[0].styles}],n=1;n<t.length;n++){var r=i[i.length-1],o=t[n],s=r.coordinates[r.coordinates.length-1];s.x===o.coordinates[0].x&&s.y===o.coordinates[0].y&&r.styles.style===o.styles.style&&r.styles.color===o.styles.color&&r.styles.size===o.styles.size&&r.styles.smooth===o.styles.smooth&&r.styles.dashedValue[0]===o.styles.dashedValue[0]&&r.styles.dashedValue[1]===o.styles.dashedValue[1]?r.coordinates.push(o.coordinates[1]):i.push({coordinates:[o.coordinates[0],o.coordinates[1]],styles:o.styles})}i.forEach(function(t){var i,n=t.coordinates,r=t.styles;null===(i=a.createFigure({name:"line",attrs:{coordinates:n},styles:r}))||void 0===i||i.draw(e)})}})}}}),e.restore()},e}(Ei),Pi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),a=e.getPane(),i=e.getBounding(),n=e.getPane().getChart().getChartStore(),r=n.getTooltipStore().getCrosshair(),o=n.getStyles().crosshair;if(Dt(r.paneId)&&o.show){if(r.paneId===a.getId()){var s=r.y;this._drawLine(t,[{x:0,y:s},{x:i.width,y:s}],o.horizontal)}var l=r.realX;this._drawLine(t,[{x:l,y:0},{x:l,y:i.height}],o.vertical)}},e.prototype._drawLine=function(t,e,a){var i;if(a.show){var n=a.line;n.show&&(null===(i=this.createFigure({name:"line",attrs:{coordinates:e},styles:n}))||void 0===i||i.draw(t))}},e}(ki),Di=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundIconClickEvent=function(t){return function(){var a=e.getWidget().getPane();return a.getChart().getChartStore().getActionStore().execute(Mt.OnTooltipIconClick,X({},t)),!0}},e._boundIconMouseMoveEvent=function(t){return function(){var a=e.getWidget().getPane(),i=a.getChart().getChartStore().getTooltipStore();return i.setActiveIcon(X({},t)),!0}},e}return L(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),a=e.getPane(),i=a.getChart().getChartStore(),n=i.getTooltipStore().getCrosshair();if(At(n.kLineData)){var r=e.getBounding(),o=i.getCustomApi(),s=i.getThousandsSeparator(),l=i.getDecimalFoldThreshold(),c=i.getIndicatorStore().getInstances(a.getId()),u=i.getTooltipStore().getActiveIcon(),d=i.getStyles().indicator,h=d.tooltip,p=h.offsetLeft,v=h.offsetTop,f=h.offsetRight;this.drawIndicatorTooltip(t,a.getId(),i.getDataList(),n,u,c,o,s,l,p,v,r.width-f,d)}},e.prototype.drawIndicatorTooltip=function(t,e,a,i,n,r,o,s,l,c,u,d,h){var p=this,v=h.tooltip;if(this.isDrawTooltip(i,v)){var f=v.text;r.forEach(function(r){var g=0,m={x:c,y:u},y=p.getIndicatorTooltipData(a,i,r,o,s,l,h),b=y.name,_=y.calcParamsText,x=y.values,w=y.icons,S=b.length>0,k=x.length>0;if(S||k){var C=G(p.classifyTooltipIcons(w),3),I=C[0],E=C[1],A=C[2];if(g=p.drawStandardTooltipIcons(t,n,I,m,e,r.name,c,g,d),S){var P=b;_.length>0&&(P="".concat(P).concat(_)),g=p.drawStandardTooltipLegends(t,[{title:{text:"",color:f.color},value:{text:P,color:f.color}}],m,c,g,d,f)}g=p.drawStandardTooltipIcons(t,n,E,m,e,r.name,c,g,d),k&&(g=p.drawStandardTooltipLegends(t,x,m,c,g,d,v.text)),g=p.drawStandardTooltipIcons(t,n,A,m,e,r.name,c,g,d),u=m.y+g}})}return u},e.prototype.drawStandardTooltipIcons=function(t,e,a,i,n,r,o,s,l){var c=this;if(a.length>0){var u=0,d=0;a.forEach(function(e){var a=e.marginLeft,i=void 0===a?0:a,n=e.marginTop,r=void 0===n?0:n,o=e.marginRight,s=void 0===o?0:o,l=e.marginBottom,c=void 0===l?0:l,h=e.paddingLeft,p=void 0===h?0:h,v=e.paddingTop,f=void 0===v?0:v,g=e.paddingRight,m=void 0===g?0:g,y=e.paddingBottom,b=void 0===y?0:y,_=e.size,x=e.fontFamily,w=e.icon;t.font=Wt(_,"normal",x),u+=i+p+t.measureText(w).width+m+s,d=Math.max(d,r+f+_+b+c)}),i.x+u>l?(i.x=o,i.y+=s,s=d):s=Math.max(s,d),a.forEach(function(a){var o,s=a.marginLeft,l=void 0===s?0:s,u=a.marginTop,d=void 0===u?0:u,h=a.marginRight,p=void 0===h?0:h,v=a.paddingLeft,f=void 0===v?0:v,g=a.paddingTop,m=void 0===g?0:g,y=a.paddingRight,b=void 0===y?0:y,_=a.paddingBottom,x=void 0===_?0:_,w=a.color,S=a.activeColor,k=a.size,C=a.fontFamily,I=a.icon,E=a.backgroundColor,A=a.activeBackgroundColor,P=(null===e||void 0===e?void 0:e.paneId)===n&&(null===e||void 0===e?void 0:e.indicatorName)===r&&(null===e||void 0===e?void 0:e.iconId)===a.id;null===(o=c.createFigure({name:"text",attrs:{text:I,x:i.x+l,y:i.y+d},styles:{paddingLeft:f,paddingTop:m,paddingRight:b,paddingBottom:x,color:P?S:w,size:k,family:C,backgroundColor:P?A:E}},{mouseClickEvent:c._boundIconClickEvent({paneId:n,indicatorName:r,iconId:a.id}),mouseMoveEvent:c._boundIconMouseMoveEvent({paneId:n,indicatorName:r,iconId:a.id})}))||void 0===o||o.draw(t),i.x+=l+f+t.measureText(I).width+b+p})}return s},e.prototype.drawStandardTooltipLegends=function(t,e,a,i,n,r,o){var s=this;if(e.length>0){var l=o.marginLeft,c=o.marginTop,u=o.marginRight,d=o.marginBottom,h=o.size,p=o.family,v=o.weight;t.font=Wt(h,v,p),e.forEach(function(e){var o,f,g=e.title,m=e.value,y=t.measureText(g.text).width,b=t.measureText(m.text).width,_=y+b,x=c+h+d;a.x+l+_+u>r?(a.x=i,a.y+=n,n=x):n=Math.max(n,x),g.text.length>0&&(null===(o=s.createFigure({name:"text",attrs:{x:a.x+l,y:a.y+c,text:g.text},styles:{color:g.color,size:h,family:p,weight:v}}))||void 0===o||o.draw(t)),null===(f=s.createFigure({name:"text",attrs:{x:a.x+l+y,y:a.y+c,text:m.text},styles:{color:m.color,size:h,family:p,weight:v}}))||void 0===f||f.draw(t),a.x+=l+_+u})}return n},e.prototype.isDrawTooltip=function(t,e){var a=e.showRule;return a===z.Always||a===z.FollowCross&&Dt(t.paneId)},e.prototype.getIndicatorTooltipData=function(t,e,a,i,n,r,o){var s,l,c=o.tooltip,u=c.showName?a.shortName:"",d="",h=a.calcParams;h.length>0&&c.showParams&&(d="(".concat(h.join(","),")"));var p={name:u,calcParamsText:d,values:[],icons:c.icons},v=e.dataIndex,f=null!==(s=a.result)&&void 0!==s?s:[],g=[];if(a.visible){var m=null!==(l=f[v])&&void 0!==l?l:{};qt(t,a,v,o,function(t,e){var o;if(Dt(t.title)){var s=e.color,l=null!==(o=m[t.key])&&void 0!==o?o:c.defaultValue;Et(l)&&(l=Nt(l,a.precision),a.shouldFormatBigNumber&&(l=i.formatBigNumber(l)),l=Vt(zt(l,n),r)),g.push({title:{text:t.title,color:s},value:{text:l,color:s}})}}),p.values=g}if(null!==a.createTooltipDataSource){var y=this.getWidget(),b=y.getPane(),_=b.getChart().getChartStore(),x=a.createTooltipDataSource({kLineDataList:t,indicator:a,visibleRange:_.getTimeScaleStore().getVisibleRange(),bounding:y.getBounding(),crosshair:e,defaultStyles:o,xAxis:b.getChart().getXAxisPane().getAxisComponent(),yAxis:b.getAxisComponent()}),w=x.name,S=x.calcParamsText,k=x.values,C=x.icons;if(Dt(w)&&c.showName&&(p.name=w),Dt(S)&&c.showParams&&(p.calcParamsText=S),At(C)&&(p.icons=C),At(k)&&a.visible){var I=[],E=o.tooltip.text.color;k.forEach(function(t){var e,o={text:"",color:E};It(t.title)?o=t.title:o.text=t.title;var s={text:"",color:E};if(It(t.value)?s=t.value:s.text=null!==(e=t.value)&&void 0!==e?e:c.defaultValue,Et(s.text)){var l=Nt(s.text,a.precision);a.shouldFormatBigNumber&&(l=i.formatBigNumber(l)),l=Vt(zt(l,n),r),s.text=l}I.push({title:o,value:s})}),p.values=I}}return p},e.prototype.classifyTooltipIcons=function(t){var e=[],a=[],i=[];return t.forEach(function(t){switch(t.position){case O.Left:e.push(t);break;case O.Middle:a.push(t);break;case O.Right:i.push(t);break}}),[e,a,i]},e}(ki),Ti=function(t){function e(e){var a=t.call(this,e)||this;return a._initEvent(),a}return L(e,t),e.prototype._initEvent=function(){var t=this,e=this.getWidget().getPane(),a=e.getId(),i=e.getChart().getChartStore().getOverlayStore();this.registerEvent("mouseMoveEvent",function(e){var n,r=i.getProgressInstanceInfo();if(null!==r){var o=r.instance,s=r.paneId;o.isStart()&&(i.updateProgressInstanceInfo(a),s=a);var l=o.points.length-1,c="".concat(ee,"point_").concat(l);return o.isDrawing()&&s===a&&(o.eventMoveForDrawing(t._coordinateToPoint(r.instance,e)),null===(n=o.onDrawing)||void 0===n||n.call(o,X({overlay:o,figureKey:c,figureIndex:l},e))),t._figureMouseMoveEvent(o,1,c,l,0)(e)}return i.setHoverInstanceInfo({paneId:a,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1}).registerEvent("mouseClickEvent",function(e){var n,r,o=i.getProgressInstanceInfo();if(null!==o){var s=o.instance,l=o.paneId;s.isStart()&&(i.updateProgressInstanceInfo(a,!0),l=a);var c=s.points.length-1,u="".concat(ee,"point_").concat(c);return s.isDrawing()&&l===a&&(s.eventMoveForDrawing(t._coordinateToPoint(s,e)),null===(n=s.onDrawing)||void 0===n||n.call(s,X({overlay:s,figureKey:u,figureIndex:c},e)),s.nextStep(),s.isDrawing()||(i.progressInstanceComplete(),null===(r=s.onDrawEnd)||void 0===r||r.call(s,X({overlay:s,figureKey:u,figureIndex:c},e)))),t._figureMouseClickEvent(s,1,u,c,0)(e)}return i.setClickInstanceInfo({paneId:a,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1}).registerEvent("mouseDoubleClickEvent",function(e){var n,r=i.getProgressInstanceInfo();if(null!==r){var o=r.instance,s=r.paneId;if(o.isDrawing()&&s===a&&(o.forceComplete(),!o.isDrawing())){i.progressInstanceComplete();var l=o.points.length-1,c="".concat(ee,"point_").concat(l);null===(n=o.onDrawEnd)||void 0===n||n.call(o,X({overlay:o,figureKey:c,figureIndex:l},e))}var u=o.points.length-1;return t._figureMouseClickEvent(o,1,"".concat(ee,"point_").concat(u),u,0)(e)}return!1}).registerEvent("mouseRightClickEvent",function(e){var a=i.getProgressInstanceInfo();if(null!==a){var n=a.instance;if(n.isDrawing()){var r=n.points.length-1;return t._figureMouseRightClickEvent(n,1,"".concat(ee,"point_").concat(r),r,0)(e)}}return!1}).registerEvent("mouseUpEvent",function(t){var e,n=i.getPressedInstanceInfo(),r=n.instance,o=n.figureIndex,s=n.figureKey;return null!==r&&(null===(e=r.onPressedMoveEnd)||void 0===e||e.call(r,X({overlay:r,figureKey:s,figureIndex:o},t))),i.setPressedInstanceInfo({paneId:a,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1}),!1}).registerEvent("pressedMouseMoveEvent",function(e){var a,n,r=i.getPressedInstanceInfo(),o=r.instance,s=r.figureType,l=r.figureIndex,c=r.figureKey;if(null!==o){if(!o.lock&&(null===(n=null===(a=o.onPressedMoving)||void 0===a?void 0:a.call(o,X({overlay:o,figureIndex:l,figureKey:c},e)))||void 0===n||!n)){var u=t._coordinateToPoint(o,e);1===s?o.eventPressedPointMove(u,l):o.eventPressedOtherMove(u,t.getWidget().getPane().getChart().getChartStore().getTimeScaleStore())}return!0}return!1})},e.prototype._createFigureEvents=function(t,e,a,i,n,r){var o;if(!t.isDrawing()){var s=[];if(At(r)&&(Pt(r)?r&&(s=Gt()):s=r),0===s.length)return{mouseMoveEvent:this._figureMouseMoveEvent(t,e,a,i,n),mouseDownEvent:this._figureMouseDownEvent(t,e,a,i,n),mouseClickEvent:this._figureMouseClickEvent(t,e,a,i,n),mouseRightClickEvent:this._figureMouseRightClickEvent(t,e,a,i,n),mouseDoubleClickEvent:this._figureMouseDoubleClickEvent(t,e,a,i,n)};o={},s.includes("mouseMoveEvent")||s.includes("touchMoveEvent")||(o.mouseMoveEvent=this._figureMouseMoveEvent(t,e,a,i,n)),s.includes("mouseDownEvent")||s.includes("touchStartEvent")||(o.mouseDownEvent=this._figureMouseDownEvent(t,e,a,i,n)),s.includes("mouseClickEvent")||s.includes("tapEvent")||(o.mouseClickEvent=this._figureMouseClickEvent(t,e,a,i,n)),s.includes("mouseDoubleClickEvent")||s.includes("doubleTapEvent")||(o.mouseDoubleClickEvent=this._figureMouseDoubleClickEvent(t,e,a,i,n)),s.includes("mouseRightClickEvent")||(o.mouseRightClickEvent=this._figureMouseRightClickEvent(t,e,a,i,n))}return o},e.prototype._figureMouseMoveEvent=function(t,e,a,i,n){var r=this;return function(o){var s=r.getWidget().getPane(),l=s.getChart().getChartStore().getOverlayStore();return l.setHoverInstanceInfo({paneId:s.getId(),instance:t,figureType:e,figureKey:a,figureIndex:i,attrsIndex:n},o),!0}},e.prototype._figureMouseDownEvent=function(t,e,a,i,n){var r=this;return function(o){var s,l=r.getWidget().getPane(),c=l.getId(),u=l.getChart().getChartStore().getOverlayStore();return t.startPressedMove(r._coordinateToPoint(t,o)),null===(s=t.onPressedMoveStart)||void 0===s||s.call(t,X({overlay:t,figureIndex:i,figureKey:a},o)),u.setPressedInstanceInfo({paneId:c,instance:t,figureType:e,figureKey:a,figureIndex:i,attrsIndex:n}),!0}},e.prototype._figureMouseClickEvent=function(t,e,a,i,n){var r=this;return function(o){var s=r.getWidget().getPane(),l=s.getId(),c=s.getChart().getChartStore().getOverlayStore();return c.setClickInstanceInfo({paneId:l,instance:t,figureType:e,figureKey:a,figureIndex:i,attrsIndex:n},o),!0}},e.prototype._figureMouseDoubleClickEvent=function(t,e,a,i,n){return function(e){var n;return null===(n=t.onDoubleClick)||void 0===n||n.call(t,X(X({},e),{figureIndex:i,figureKey:a,overlay:t})),!0}},e.prototype._figureMouseRightClickEvent=function(t,e,a,i,n){var r=this;return function(e){var n,o;if(null===(o=null===(n=t.onRightClick)||void 0===n?void 0:n.call(t,X({overlay:t,figureIndex:i,figureKey:a},e)))||void 0===o||!o){var s=r.getWidget().getPane(),l=s.getChart().getChartStore().getOverlayStore();l.removeInstance(t)}return!0}},e.prototype._coordinateToPoint=function(t,e){var a,i={},n=this.getWidget().getPane(),r=n.getChart(),o=n.getId(),s=r.getChartStore().getTimeScaleStore();if(this.coordinateToPointTimestampDataIndexFlag()){var l=r.getXAxisPane().getAxisComponent(),c=l.convertFromPixel(e.x),u=null!==(a=s.dataIndexToTimestamp(c))&&void 0!==a?a:void 0;i.dataIndex=c,i.timestamp=u}if(this.coordinateToPointValueFlag()){var d=n.getAxisComponent(),h=d.convertFromPixel(e.y);if(t.mode!==Ut.Normal&&o===Oa.CANDLE&&Et(i.dataIndex)){var p=s.getDataByDataIndex(i.dataIndex);if(null!==p){var v=t.modeSensitivity;if(h>p.high)if(t.mode===Ut.WeakMagnet){var f=d.convertToPixel(p.high),g=d.convertFromPixel(f-v);h<g&&(h=p.high)}else h=p.high;else if(h<p.low)if(t.mode===Ut.WeakMagnet){var m=d.convertToPixel(p.low);g=d.convertFromPixel(m-v);h>g&&(h=p.low)}else h=p.low;else{var y=Math.max(p.open,p.close),b=Math.min(p.open,p.close);h=h>y?h-y<p.high-h?y:p.high:h<b?h-p.low<b-h?p.low:b:y-h<h-b?y:b}}}i.value=h}return i},e.prototype.coordinateToPointValueFlag=function(){return!0},e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},e.prototype.dispatchEvent=function(e,a,i){return this.getWidget().getPane().getChart().getChartStore().getOverlayStore().isDrawing()?this.onEvent(e,a,i):t.prototype.dispatchEvent.call(this,e,a,i)},e.prototype.checkEventOn=function(){return!0},e.prototype.drawImp=function(t){var e=this,a=this.getWidget(),i=a.getPane(),n=i.getId(),r=i.getChart(),o=i.getAxisComponent(),s=r.getXAxisPane().getAxisComponent(),l=a.getBounding(),c=r.getChartStore(),u=c.getCustomApi(),d=c.getThousandsSeparator(),h=c.getDecimalFoldThreshold(),p=c.getTimeScaleStore(),v=p.getDateTimeFormat(),f=p.getBarSpace(),g=c.getPrecision(),m=c.getStyles().overlay,y=c.getOverlayStore(),b=y.getHoverInstanceInfo(),_=y.getClickInstanceInfo(),x=this.getCompleteOverlays(y,n),w=c.getIndicatorStore().getInstances(n),S=w.reduce(function(t,e){var a=e.precision;return t[e.name]=a,t.max=Math.max(t.max,a),t.min=Math.min(t.min,a),t.excludePriceVolumeMax=Math.max(t.excludePriceVolumeMax,a),t.excludePriceVolumeMin=Math.min(t.excludePriceVolumeMin,a),t},X(X({},g),{max:Math.max(g.price,g.volume),min:Math.min(g.price,g.volume),excludePriceVolumeMax:Number.MIN_SAFE_INTEGER,excludePriceVolumeMin:Number.MAX_SAFE_INTEGER}));x.forEach(function(a){a.visible&&e._drawOverlay(t,a,l,f,S,v,u,d,h,m,s,o,b,_,p)});var k=y.getProgressInstanceInfo();if(null!==k){var C=this.getProgressOverlay(k,n);null!==C&&C.visible&&this._drawOverlay(t,C,l,f,S,v,u,d,h,m,s,o,b,_,p)}},e.prototype._drawOverlay=function(t,e,a,i,n,r,o,s,l,c,u,d,h,p,v){var f=e.points,g=f.map(function(t){var e,a,i=t.dataIndex;Et(t.timestamp)&&(i=v.timestampToDataIndex(t.timestamp));var n={x:0,y:0};return Et(i)&&(n.x=null!==(e=null===u||void 0===u?void 0:u.convertToPixel(i))&&void 0!==e?e:0),Et(t.value)&&(n.y=null!==(a=null===d||void 0===d?void 0:d.convertToPixel(t.value))&&void 0!==a?a:0),n});if(g.length>0){var m=(new Array).concat(this.getFigures(e,g,a,i,n,s,l,r,c,u,d));this.drawFigures(t,e,m,c)}this.drawDefaultFigures(t,e,g,a,n,r,o,s,l,c,u,d,h,p)},e.prototype.drawFigures=function(t,e,a,i){var n=this;a.forEach(function(a,r){var o=a.type,s=a.styles,l=a.attrs,c=a.ignoreEvent,u=[].concat(l);u.forEach(function(l,u){var d,h,p,v=n._createFigureEvents(e,2,null!==(d=a.key)&&void 0!==d?d:"",r,u,c),f=X(X(X({},i[o]),null===(h=e.styles)||void 0===h?void 0:h[o]),s);null===(p=n.createFigure({name:o,attrs:l,styles:f},v))||void 0===p||p.draw(t)})})},e.prototype.getCompleteOverlays=function(t,e){return t.getInstances(e)},e.prototype.getProgressOverlay=function(t,e){return t.paneId===e?t.instance:null},e.prototype.getFigures=function(t,e,a,i,n,r,o,s,l,c,u){var d,h;return null!==(h=null===(d=t.createPointFigures)||void 0===d?void 0:d.call(t,{overlay:t,coordinates:e,bounding:a,barSpace:i,precision:n,thousandsSeparator:r,decimalFoldThreshold:o,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==h?h:[]},e.prototype.drawDefaultFigures=function(t,e,a,i,n,r,o,s,l,c,u,d,h,p){var v,f,g=this;if(e.needDefaultPointFigure&&((null===(v=h.instance)||void 0===v?void 0:v.id)===e.id&&0!==h.figureType||(null===(f=p.instance)||void 0===f?void 0:f.id)===e.id&&0!==p.figureType)){var m=e.styles,y=X(X({},c.point),null===m||void 0===m?void 0:m.point);a.forEach(function(a,i){var n,r,o,s=a.x,l=a.y,c=y.radius,u=y.color,d=y.borderColor,p=y.borderSize;(null===(n=h.instance)||void 0===n?void 0:n.id)===e.id&&1===h.figureType&&h.figureIndex===i&&(c=y.activeRadius,u=y.activeColor,d=y.activeBorderColor,p=y.activeBorderSize),null===(r=g.createFigure({name:"circle",attrs:{x:s,y:l,r:c+p},styles:{color:d}},g._createFigureEvents(e,1,"".concat(ee,"point_").concat(i),i,0)))||void 0===r||r.draw(t),null===(o=g.createFigure({name:"circle",attrs:{x:s,y:l,r:c},styles:{color:u}}))||void 0===o||o.draw(t)})}},e}(ki),Mi=function(t){function e(e,a){var i=t.call(this,e,a)||this;return i._gridView=new Ci(i),i._indicatorView=new Ai(i),i._crosshairLineView=new Pi(i),i._tooltipView=i.createTooltipView(),i._overlayView=new Ti(i),i.addChild(i._tooltipView),i.addChild(i._overlayView),i.getContainer().style.cursor="crosshair",i.registerEvent("mouseMoveEvent",function(){return a.getChart().getChartStore().getTooltipStore().setActiveIcon(),!1}),i}return L(e,t),e.prototype.getName=function(){return ja.MAIN},e.prototype.updateMain=function(t){this.updateMainContent(t),this._indicatorView.draw(t),this._gridView.draw(t)},e.prototype.createTooltipView=function(){return new Di(this)},e.prototype.updateMainContent=function(t){},e.prototype.updateOverlay=function(t){this._overlayView.draw(t),this._crosshairLineView.draw(t),this._tooltipView.draw(t)},e}(ei),Ri=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._ripplePoint=e.createFigure({name:"circle",attrs:{x:0,y:0,r:0},styles:{style:"fill"}}),e._animationFrameTime=0,e._animation=new le({iterationCount:1/0}).doFrame(function(t){e._animationFrameTime=t;var a=e.getWidget().getPane();a.getChart().updatePane(0,a.getId())}),e}return L(e,t),e.prototype.drawImp=function(t){var e,a,i,n=this.getWidget(),r=n.getPane(),o=r.getChart(),s=o.getDataList(),l=s.length-1,c=n.getBounding(),u=r.getAxisComponent(),d=o.getStyles().candle.area,h=[],p=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER,f=null;if(this.eachChildren(function(t){var e=t.data,a=t.x,i=null===e||void 0===e?void 0:e[d.value];if(Et(i)){var n=u.convertToPixel(i);v===Number.MIN_SAFE_INTEGER&&(v=a),h.push({x:a,y:n}),p=Math.min(p,n),t.dataIndex===l&&(f={x:a,y:n})}}),h.length>0){null===(e=this.createFigure({name:"line",attrs:{coordinates:h},styles:{color:d.lineColor,size:d.lineSize,smooth:d.smooth}}))||void 0===e||e.draw(t);var g=d.backgroundColor,m=void 0;if(kt(g)){var y=t.createLinearGradient(0,c.height,0,p);try{g.forEach(function(t){var e=t.offset,a=t.color;y.addColorStop(e,a)})}catch(x){}m=y}else m=g;t.fillStyle=m,t.beginPath(),t.moveTo(v,c.height),t.lineTo(h[0].x,h[0].y),ba(t,h,d.smooth),t.lineTo(h[h.length-1].x,c.height),t.closePath(),t.fill()}var b=d.point;if(b.show&&At(f)){null===(a=this.createFigure({name:"circle",attrs:{x:f.x,y:f.y,r:b.radius},styles:{style:"fill",color:b.color}}))||void 0===a||a.draw(t);var _=b.rippleRadius;b.animation&&(_=b.radius+this._animationFrameTime/b.animationDuration*(b.rippleRadius-b.radius),this._animation.setDuration(b.animationDuration).start()),null===(i=this._ripplePoint)||void 0===i||i.setAttrs({x:f.x,y:f.y,r:_}).setStyles({style:"fill",color:b.rippleColor}).draw(t)}else this.stopAnimation()},e.prototype.stopAnimation=function(){this._animation.stop()},e}(Ii),Fi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),a=e.getPane(),i=a.getChart().getChartStore(),n=i.getStyles().candle.priceMark,r=n.high,o=n.low;if(n.show&&(r.show||o.show)){var s=i.getThousandsSeparator(),l=i.getDecimalFoldThreshold(),c=i.getPrecision(),u=a.getAxisComponent(),d=Number.MIN_SAFE_INTEGER,h=0,p=Number.MAX_SAFE_INTEGER,v=0;this.eachChildren(function(t){var e=t.data,a=t.x;At(e)&&(d<e.high&&(d=e.high,h=a),p>e.low&&(p=e.low,v=a))});var f=u.convertToPixel(d),g=u.convertToPixel(p);r.show&&d!==Number.MIN_SAFE_INTEGER&&this._drawMark(t,Vt(zt(Nt(d,c.price),s),l),{x:h,y:f},f<g?[-2,-5]:[2,5],r),o.show&&p!==Number.MAX_SAFE_INTEGER&&this._drawMark(t,Vt(zt(Nt(p,c.price),s),l),{x:v,y:g},f<g?[2,5]:[-2,-5],o)}},e.prototype._drawMark=function(t,e,a,i,n){var r,o,s,l,c,u,d=a.x,h=a.y+i[0];null===(r=this.createFigure({name:"line",attrs:{coordinates:[{x:d-2,y:h+i[0]},{x:d,y:h},{x:d+2,y:h+i[0]}]},styles:{color:n.color}}))||void 0===r||r.draw(t);var p=this.getWidget().getBounding().width;d>p/2?(l=d-5,c=l-n.textOffset,u="right"):(l=d+5,u="left",c=l+n.textOffset);var v=h+i[1];null===(o=this.createFigure({name:"line",attrs:{coordinates:[{x:d,y:h},{x:d,y:v},{x:l,y:v}]},styles:{color:n.color}}))||void 0===o||o.draw(t),null===(s=this.createFigure({name:"text",attrs:{x:c,y:v,text:e,align:u,baseline:"middle"},styles:{color:n.color,size:n.textSize,family:n.textFamily,weight:n.textWeight}}))||void 0===s||s.draw(t)},e}(Ii),Bi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.drawImp=function(t){var e,a=this.getWidget(),i=a.getPane(),n=a.getBounding(),r=i.getChart().getChartStore(),o=r.getStyles().candle.priceMark,s=o.last,l=s.line;if(o.show&&s.show&&l.show){var c=i.getAxisComponent(),u=r.getDataList(),d=u[u.length-1];if(null!=d){var h=d.close,p=d.open,v=c.convertToNicePixel(h),f=void 0;f=h>p?s.upColor:h<p?s.downColor:s.noChangeColor,null===(e=this.createFigure({name:"line",attrs:{coordinates:[{x:0,y:v},{x:n.width,y:v}]},styles:{style:l.style,color:f,size:l.size,dashedValue:l.dashedValue}}))||void 0===e||e.draw(t)}}},e}(ki),Li={time:"时间:",open:"开:",high:"高:",low:"低:",close:"收:",volume:"成交量:",turnover:"成交额:",change:"涨幅:"},Ni={time:"Time: ",open:"Open: ",high:"High: ",low:"Low: ",close:"Close: ",volume:"Volume: ",turnover:"Turnover: ",change:"Change: "},$i={"zh-CN":Li,"en-US":Ni};function zi(t,e){var a,i;return null!==(i=null===(a=$i[e])||void 0===a?void 0:a[t])&&void 0!==i?i:t}var Vi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),a=e.getPane(),i=a.getId(),n=a.getChart().getChartStore(),r=n.getTooltipStore().getCrosshair();if(At(r.kLineData)){var o=e.getBounding(),s=a.getYAxisWidget().getBounding(),l=n.getDataList(),c=n.getPrecision(),u=n.getLocale(),d=n.getCustomApi(),h=n.getThousandsSeparator(),p=n.getDecimalFoldThreshold(),v=n.getTooltipStore().getActiveIcon(),f=n.getIndicatorStore().getInstances(a.getId()),g=n.getTimeScaleStore().getDateTimeFormat(),m=n.getStyles(),y=m.candle,b=m.indicator;if(y.tooltip.showType===V.Rect&&b.tooltip.showType===V.Rect){var _=this.isDrawTooltip(r,y.tooltip),x=this.isDrawTooltip(r,b.tooltip);this._drawRectTooltip(t,l,f,o,s,r,c,g,u,d,h,p,_,x,y.tooltip.offsetTop,m)}else if(y.tooltip.showType===V.Standard&&b.tooltip.showType===V.Standard){var w=y.tooltip,S=w.offsetLeft,k=w.offsetTop,C=w.offsetRight,I=o.width-C,E=this._drawCandleStandardTooltip(t,l,i,r,v,c,g,u,d,h,p,S,k,I,y);this.drawIndicatorTooltip(t,i,l,r,v,f,d,h,p,S,E,I,b)}else if(y.tooltip.showType===V.Rect&&b.tooltip.showType===V.Standard){var A=y.tooltip,P=(S=A.offsetLeft,k=A.offsetTop,C=A.offsetRight,I=o.width-C,this.drawIndicatorTooltip(t,i,l,r,v,f,d,h,p,S,k,I,b));_=this.isDrawTooltip(r,y.tooltip);this._drawRectTooltip(t,l,f,o,s,r,c,g,u,d,h,p,_,!1,P,m)}else{var D=y.tooltip,T=(S=D.offsetLeft,k=D.offsetTop,C=D.offsetRight,I=o.width-C,this._drawCandleStandardTooltip(t,l,i,r,v,c,g,u,d,h,p,S,k,I,y));x=this.isDrawTooltip(r,b.tooltip);this._drawRectTooltip(t,l,f,o,s,r,c,g,u,d,h,p,!1,x,T,m)}}},e.prototype._drawCandleStandardTooltip=function(t,e,a,i,n,r,o,s,l,c,u,d,h,p,v){var f,g,m,y=v.tooltip,b=y.text,_=0,x={x:d,y:h};if(this.isDrawTooltip(i,y)){var w=null!==(f=i.dataIndex)&&void 0!==f?f:0,S=this._getCandleTooltipLegends({prev:null!==(g=e[w-1])&&void 0!==g?g:null,current:i.kLineData,next:null!==(m=e[w+1])&&void 0!==m?m:null},r,o,s,l,c,u,v),k=G(this.classifyTooltipIcons(y.icons),3),C=k[0],I=k[1],E=k[2];_=this.drawStandardTooltipIcons(t,n,C,x,a,"",d,_,p),_=this.drawStandardTooltipIcons(t,n,I,x,a,"",d,_,p),S.length>0&&(_=this.drawStandardTooltipLegends(t,S,x,d,_,p,b)),_=this.drawStandardTooltipIcons(t,n,E,x,a,"",d,_,p)}return x.y+_},e.prototype._drawRectTooltip=function(t,e,a,i,n,r,o,s,l,c,u,d,h,p,v,f){var g,m,y,b,_,x=this,w=f.candle,S=f.indicator,k=w.tooltip,C=S.tooltip;if(h||p){var I=null!==(g=r.dataIndex)&&void 0!==g?g:0,E=this._getCandleTooltipLegends({prev:null!==(m=e[I-1])&&void 0!==m?m:null,current:r.kLineData,next:null!==(y=e[I+1])&&void 0!==y?y:null},o,s,l,c,u,d,w),A=k.offsetLeft,P=k.offsetTop,D=k.offsetRight,T=k.offsetBottom,M=k.text,R=M.marginLeft,F=M.marginRight,B=M.marginTop,L=M.marginBottom,N=M.size,z=M.weight,V=M.family,O=k.rect,H=O.position,K=O.paddingLeft,X=O.paddingRight,q=O.paddingTop,U=O.paddingBottom,j=O.offsetLeft,G=O.offsetRight,Z=O.offsetTop,J=O.offsetBottom,Q=O.borderSize,tt=O.borderRadius,et=O.borderColor,at=O.color,it=0,nt=0,rt=0;h&&(t.font=Wt(N,z,V),E.forEach(function(e){var a=e.title,i=e.value,n="".concat(a.text).concat(i.text),r=t.measureText(n).width+R+F;it=Math.max(it,r)}),rt+=(L+B+N)*E.length);var ot=C.text,st=ot.marginLeft,lt=ot.marginRight,ct=ot.marginTop,ut=ot.marginBottom,dt=ot.size,ht=ot.weight,pt=ot.family,vt=[];if(p&&(t.font=Wt(dt,ht,pt),a.forEach(function(a){var i,n=null!==(i=x.getIndicatorTooltipData(e,r,a,c,u,d,S).values)&&void 0!==i?i:[];vt.push(n),n.forEach(function(e){var a=e.title,i=e.value,n="".concat(a.text).concat(i.text),r=t.measureText(n).width+st+lt;it=Math.max(it,r),rt+=ct+ut+dt})})),nt+=it,0!==nt&&0!==rt){nt+=2*Q+K+X,rt+=2*Q+q+U;var ft=i.width/2,gt=H===W.Pointer&&r.paneId===Oa.CANDLE,mt=(null!==(b=r.realX)&&void 0!==b?b:0)>ft,yt=0;if(gt){var bt=r.realX;yt=mt?bt-G-nt:bt+j}else mt?(yt=j+A,f.yAxis.inside&&f.yAxis.position===Y.Left&&(yt+=n.width)):(yt=i.width-G-nt-D,f.yAxis.inside&&f.yAxis.position===Y.Right&&(yt-=n.width));var _t=v+Z;if(gt){var xt=r.y;_t=xt-rt/2,_t+rt>i.height-J-T&&(_t=i.height-J-rt-T),_t<v+Z&&(_t=v+Z+P)}null===(_=this.createFigure({name:"rect",attrs:{x:yt,y:_t,width:nt,height:rt},styles:{style:$.StrokeFill,color:at,borderColor:et,borderSize:Q,borderRadius:tt}}))||void 0===_||_.draw(t);var wt=yt+Q+K+R,St=_t+Q+q;if(h&&E.forEach(function(e){var a,i;St+=B;var n=e.title;null===(a=x.createFigure({name:"text",attrs:{x:wt,y:St,text:n.text},styles:{color:n.color,size:N,family:V,weight:z}}))||void 0===a||a.draw(t);var r=e.value;null===(i=x.createFigure({name:"text",attrs:{x:yt+nt-Q-F-X,y:St,text:r.text,align:"right"},styles:{color:r.color,size:N,family:V,weight:z}}))||void 0===i||i.draw(t),St+=N+L}),p){var kt=yt+Q+K+st;vt.forEach(function(e){e.forEach(function(e){var a,i;St+=ct;var n=e.title,r=e.value;null===(a=x.createFigure({name:"text",attrs:{x:kt,y:St,text:n.text},styles:{color:n.color,size:dt,family:pt,weight:ht}}))||void 0===a||a.draw(t),null===(i=x.createFigure({name:"text",attrs:{x:yt+nt-Q-lt-X,y:St,text:r.text,align:"right"},styles:{color:r.color,size:dt,family:pt,weight:ht}}))||void 0===i||i.draw(t),St+=dt+ut})})}}}},e.prototype._getCandleTooltipLegends=function(t,e,a,i,n,r,o,s){var l,c,u,d,h,p=s.tooltip,v=p.text.color,f=t.current,g=null!==(c=null===(l=t.prev)||void 0===l?void 0:l.close)&&void 0!==c?c:f.close,m=f.close-g,y=e.price,b=e.volume,_={"{time}":n.formatDate(a,f.timestamp,"YYYY-MM-DD HH:mm",Zt.Tooltip),"{open}":Vt(zt(Nt(f.open,y),r),o),"{high}":Vt(zt(Nt(f.high,y),r),o),"{low}":Vt(zt(Nt(f.low,y),r),o),"{close}":Vt(zt(Nt(f.close,y),r),o),"{volume}":Vt(zt(n.formatBigNumber(Nt(null!==(u=f.volume)&&void 0!==u?u:p.defaultValue,b)),r),o),"{turnover}":Vt(zt(Nt(null!==(d=f.turnover)&&void 0!==d?d:p.defaultValue,y),r),o),"{change}":0===g?p.defaultValue:"".concat(zt(Nt(m/g*100),r),"%")},x=null!==(h=Ct(p.custom)?p.custom(t,s):p.custom)&&void 0!==h?h:[];return x.map(function(t){var e,a=t.title,n=t.value,r={text:"",color:""};It(a)?r=X({},a):(r.text=a,r.color=v),r.text=zi(r.text,i);var o={text:p.defaultValue,color:""};It(n)?o=X({},n):(o.text=n,o.color=v);var l=o.text.match(/{(\S*)}/);if(null!==l&&l.length>1){var c="{".concat(l[1],"}");o.text=o.text.replace(c,null!==(e=_[c])&&void 0!==e?e:p.defaultValue),"{change}"===c&&(o.color=0===m?s.priceMark.last.noChangeColor:m>0?s.priceMark.last.upColor:s.priceMark.last.downColor)}return{title:r,value:o}})},e}(Di),Oi=function(t){function e(e,a){var i=t.call(this,e,a)||this;return i._candleBarView=new Ei(i),i._candleAreaView=new Ri(i),i._candleHighLowPriceView=new Fi(i),i._candleLastPriceLineView=new Bi(i),i.addChild(i._candleBarView),i}return L(e,t),e.prototype.updateMainContent=function(t){var e=this.getPane().getChart().getStyles().candle;e.type!==H.Area?(this._candleBarView.draw(t),this._candleHighLowPriceView.draw(t),this._candleAreaView.stopAnimation()):this._candleAreaView.draw(t),this._candleLastPriceLineView.draw(t)},e.prototype.createTooltipView=function(){return new Vi(this)},e}(Mi),Wi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.drawImp=function(t){var e,a,i=this,n=this.getWidget(),r=n.getPane(),o=n.getBounding(),s=r.getAxisComponent(),l=this.getAxisStyles(r.getChart().getStyles());if(l.show){l.axisLine.show&&(null===(e=this.createFigure({name:"line",attrs:this.createAxisLine(o,l),styles:l.axisLine}))||void 0===e||e.draw(t));var c=s.getTicks();if(l.tickLine.show){var u=this.createTickLines(c,o,l);u.forEach(function(e){var a;null===(a=i.createFigure({name:"line",attrs:e,styles:l.tickLine}))||void 0===a||a.draw(t)})}if(l.tickText.show){var d=this.createTickTexts(c,o,l);null===(a=this.createFigure({name:"text",attrs:d,styles:l.tickText}))||void 0===a||a.draw(t)}}},e}(ki),Hi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.getAxisStyles=function(t){return t.yAxis},e.prototype.createAxisLine=function(t,e){var a,i=this.getWidget().getPane().getAxisComponent(),n=e.axisLine.size;return a=i.isFromZero()?0:t.width-n,{coordinates:[{x:a,y:0},{x:a,y:t.height}]}},e.prototype.createTickLines=function(t,e,a){var i=this.getWidget().getPane().getAxisComponent(),n=a.axisLine,r=a.tickLine,o=0,s=0;return i.isFromZero()?(o=0,n.show&&(o+=n.size),s=o+r.length):(o=e.width,n.show&&(o-=n.size),s=o-r.length),t.map(function(t){return{coordinates:[{x:o,y:t.coord},{x:s,y:t.coord}]}})},e.prototype.createTickTexts=function(t,e,a){var i=this.getWidget().getPane().getAxisComponent(),n=a.axisLine,r=a.tickLine,o=a.tickText,s=0;i.isFromZero()?(s=o.marginStart,n.show&&(s+=n.size),r.show&&(s+=r.length)):(s=e.width-o.marginEnd,n.show&&(s-=n.size),r.show&&(s-=r.length));var l=this.getWidget().getPane().getAxisComponent().isFromZero()?"left":"right";return t.map(function(t){return{x:s,y:t.coord,text:t.text,align:l,baseline:"middle"}})},e}(Wi),Yi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.drawImp=function(t){var e,a=this.getWidget(),i=a.getPane(),n=a.getBounding(),r=i.getChart().getChartStore(),o=r.getStyles().candle.priceMark,s=o.last,l=s.text;if(o.show&&s.show&&l.show){var c=r.getPrecision(),u=i.getAxisComponent(),d=r.getDataList(),h=d[d.length-1];if(At(h)){var p=h.close,v=h.open,f=u.convertToNicePixel(p),g=void 0;g=p>v?s.upColor:p<v?s.downColor:s.noChangeColor;var m=void 0;if(u.getType()===K.Percentage){var y=r.getVisibleFirstData(),b=y.close;m="".concat(((p-b)/b*100).toFixed(2),"%")}else m=Nt(p,c.price);m=Vt(zt(m,r.getThousandsSeparator()),r.getDecimalFoldThreshold());var _=void 0,x=void 0;u.isFromZero()?(_=0,x="left"):(_=n.width,x="right"),null===(e=this.createFigure({name:"text",attrs:{x:_,y:f,text:m,align:x,baseline:"middle"},styles:X(X({},l),{backgroundColor:g})}))||void 0===e||e.draw(t)}}},e}(ki),Ki=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.drawImp=function(t){var e=this,a=this.getWidget(),i=a.getPane(),n=a.getBounding(),r=i.getChart().getChartStore(),o=r.getCustomApi(),s=r.getStyles().indicator,l=s.lastValueMark,c=l.text;if(l.show){var u=i.getAxisComponent(),d=r.getDataList(),h=d.length-1,p=r.getIndicatorStore().getInstances(i.getId()),v=r.getThousandsSeparator(),f=r.getDecimalFoldThreshold();p.forEach(function(a){var i=a.result,r=i[h];if(At(r)&&a.visible){var l=a.precision;qt(d,a,h,s,function(i,s){var d,h=r[i.key];if(Et(h)){var p=u.convertToNicePixel(h),g=Nt(h,l);a.shouldFormatBigNumber&&(g=o.formatBigNumber(g)),g=Vt(zt(g,v),f);var m=void 0,y=void 0;u.isFromZero()?(m=0,y="left"):(m=n.width,y="right"),null===(d=e.createFigure({name:"text",attrs:{x:m,y:p,text:g,align:y,baseline:"middle"},styles:X(X({},c),{backgroundColor:s.color})}))||void 0===d||d.draw(t)}})}})}},e}(ki),Xi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!1},e.prototype.drawDefaultFigures=function(t,e,a,i,n,r,o,s,l,c,u,d,h,p){this.drawFigures(t,e,this.getDefaultFigures(e,a,i,n,r,o,s,l,u,d,p),c)},e.prototype.getDefaultFigures=function(t,e,a,i,n,r,o,s,l,c,u){var d,h,p=[];if(t.needDefaultYAxisFigure&&t.id===(null===(d=u.instance)||void 0===d?void 0:d.id)&&u.paneId===this.getWidget().getPane().getId()){var v,f,g=Number.MAX_SAFE_INTEGER,m=Number.MIN_SAFE_INTEGER,y=null!==(h=null===c||void 0===c?void 0:c.isFromZero())&&void 0!==h&&h;y?(v="left",f=0):(v="right",f=a.width),e.forEach(function(e,a){var n=t.points[a];if(Et(n.value)){g=Math.min(g,e.y),m=Math.max(m,e.y);var r=Vt(zt(Nt(n.value,i.price),o),s);p.push({type:"text",attrs:{x:f,y:e.y,text:r,align:v,baseline:"middle"},ignoreEvent:!0})}}),e.length>1&&p.unshift({type:"rect",attrs:{x:0,y:g,width:a.width,height:m-g},ignoreEvent:!0})}return p},e.prototype.getFigures=function(t,e,a,i,n,r,o,s,l,c,u){var d,h;return null!==(h=null===(d=t.createYAxisFigures)||void 0===d?void 0:d.call(t,{overlay:t,coordinates:e,bounding:a,barSpace:i,precision:n,thousandsSeparator:r,decimalFoldThreshold:o,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==h?h:[]},e}(Ti),qi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.drawImp=function(t){var e,a=this.getWidget(),i=a.getPane(),n=a.getBounding(),r=a.getPane().getChart().getChartStore(),o=r.getTooltipStore().getCrosshair(),s=r.getStyles().crosshair;if(Dt(o.paneId)&&this.compare(o,i.getId())&&s.show){var l=this.getDirectionStyles(s),c=l.text;if(l.show&&c.show){var u=i.getAxisComponent(),d=this.getText(o,r,u);t.font=Wt(c.size,c.weight,c.family),null===(e=this.createFigure({name:"text",attrs:this.getTextAttrs(d,t.measureText(d).width,o,n,u,c),styles:c}))||void 0===e||e.draw(t)}}},e.prototype.compare=function(t,e){return t.paneId===e},e.prototype.getDirectionStyles=function(t){return t.horizontal},e.prototype.getText=function(t,e,a){var i,n=a,r=a.convertFromPixel(t.y);if(n.getType()===K.Percentage){var o=e.getVisibleFirstData();i="".concat(((r-o.close)/o.close*100).toFixed(2),"%")}else{var s=e.getIndicatorStore().getInstances(t.paneId),l=0,c=!1;n.isInCandle()?l=e.getPrecision().price:s.forEach(function(t){l=Math.max(t.precision,l),c||(c=t.shouldFormatBigNumber)}),i=Nt(r,l),c&&(i=e.getCustomApi().formatBigNumber(i))}return Vt(zt(i,e.getThousandsSeparator()),e.getDecimalFoldThreshold())},e.prototype.getTextAttrs=function(t,e,a,i,n,r){var o,s,l=n;return l.isFromZero()?(o=0,s="left"):(o=i.width,s="right"),{x:o,y:a.y,text:t,align:s,baseline:"middle"}},e}(ki),Ui=function(t){function e(e,a){var i=t.call(this,e,a)||this;return i._yAxisView=new Hi(i),i._candleLastPriceLabelView=new Yi(i),i._indicatorLastValueView=new Ki(i),i._overlayYAxisView=new Xi(i),i._crosshairHorizontalLabelView=new qi(i),i.getContainer().style.cursor="ns-resize",i.addChild(i._overlayYAxisView),i}return L(e,t),e.prototype.getName=function(){return ja.Y_AXIS},e.prototype.updateMain=function(t){this._yAxisView.draw(t),this.getPane().getAxisComponent().isInCandle()&&this._candleLastPriceLabelView.draw(t),this._indicatorLastValueView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayYAxisView.draw(t),this._crosshairHorizontalLabelView.draw(t)},e}(ei),ji=function(){function t(t){this._range={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0},this._prevRange={from:0,to:0,range:0,realFrom:0,realTo:0,realRange:0},this._ticks=[],this._autoCalcTickFlag=!0,this._parent=t}return t.prototype.getParent=function(){return this._parent},t.prototype.buildTicks=function(t){if(this._autoCalcTickFlag&&(this._range=this.calcRange()),this._prevRange.from!==this._range.from||this._prevRange.to!==this._range.to||t){this._prevRange=this._range;var e=this.optimalTicks(this._calcTicks());return this._ticks=this.createTicks({range:this._range,bounding:this.getSelfBounding(),defaultTicks:e}),!0}return!1},t.prototype.getTicks=function(){return this._ticks},t.prototype.getScrollZoomEnabled=function(){var t;return null===(t=this.getParent().getOptions().axisOptions.scrollZoomEnabled)||void 0===t||t},t.prototype.setRange=function(t){this._autoCalcTickFlag=!1,this._range=t},t.prototype.getRange=function(){return this._range},t.prototype.setAutoCalcTickFlag=function(t){this._autoCalcTickFlag=t},t.prototype.getAutoCalcTickFlag=function(){return this._autoCalcTickFlag},t.prototype._calcTicks=function(){var t=this._range,e=t.realFrom,a=t.realTo,i=t.realRange,n=[];if(i>=0){var r=G(this._calcTickInterval(i),2),o=r[0],s=r[1],l=fe(Math.ceil(e/o)*o,s),c=fe(Math.floor(a/o)*o,s),u=0,d=l;if(0!==o)while(d<=c){var h=d.toFixed(s);n[u]={text:h,coord:0,value:h},++u,d+=o}}return n},t.prototype._calcTickInterval=function(t){var e=ve(t/8),a=ge(e);return[e,a]},t}(),Gi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.calcRange=function(){var t,e,a,i,n=this.getParent(),r=n.getChart(),o=r.getChartStore(),s=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER,c=[],u=!1,d=Number.MAX_SAFE_INTEGER,h=Number.MIN_SAFE_INTEGER,p=Number.MAX_SAFE_INTEGER,v=o.getIndicatorStore().getInstances(n.getId());v.forEach(function(t){var e,a,i;u||(u=null!==(e=t.shouldOhlc)&&void 0!==e&&e),p=Math.min(p,t.precision),Et(t.minValue)&&(d=Math.min(d,t.minValue)),Et(t.maxValue)&&(h=Math.max(h,t.maxValue)),c.push({figures:null!==(a=t.figures)&&void 0!==a?a:[],result:null!==(i=t.result)&&void 0!==i?i:[]})});var f=4,g=this.isInCandle();if(g){var m=o.getPrecision().price;f=p!==Number.MAX_SAFE_INTEGER?Math.min(p,m):m}else p!==Number.MAX_SAFE_INTEGER&&(f=p);var y=o.getVisibleDataList(),b=r.getStyles().candle,_=b.type===H.Area,x=b.area.value,w=g&&!_||!g&&u;y.forEach(function(t){var e=t.dataIndex,a=t.data;if(At(a)&&(w&&(s=Math.min(s,a.low),l=Math.max(l,a.high)),g&&_)){var i=a[x];Et(i)&&(s=Math.min(s,i),l=Math.max(l,i))}c.forEach(function(t){var a,i=t.figures,n=t.result,r=null!==(a=n[e])&&void 0!==a?a:{};i.forEach(function(t){var e=r[t.key];Et(e)&&(s=Math.min(s,e),l=Math.max(l,e))})})}),s!==Number.MAX_SAFE_INTEGER&&l!==Number.MIN_SAFE_INTEGER?(s=Math.min(d,s),l=Math.max(h,l)):(s=0,l=10);var S,k=this.getType();switch(k){case K.Percentage:var C=o.getVisibleFirstData();At(C)&&Et(C.close)&&(s=(s-C.close)/C.close*100,l=(l-C.close)/C.close*100),S=Math.pow(10,-2);break;case K.Log:s=ye(s),l=ye(l),S=.05*be(-f);break;default:S=be(-f)}if(s===l||Math.abs(s-l)<S){var I=d===s,E=h===l;s=I?s:E?s-8*S:s-4*S,l=E?l:I?l+8*S:l+4*S}var A=null!==(e=null===(t=this.getParent().getYAxisWidget())||void 0===t?void 0:t.getBounding().height)&&void 0!==e?e:0,P=n.getOptions().gap,D=null!==(a=null===P||void 0===P?void 0:P.top)&&void 0!==a?a:.2;D>=1&&(D/=A);var T=null!==(i=null===P||void 0===P?void 0:P.bottom)&&void 0!==i?i:.1;T>=1&&(T/=A);var M,R,F,B=Math.abs(l-s);return s-=B*T,l+=B*D,B=Math.abs(l-s),k===K.Log?(M=be(s),R=be(l),F=Math.abs(R-M)):(M=s,R=l,F=B),{from:s,to:l,range:B,realFrom:M,realTo:R,realRange:F}},e.prototype._innerConvertToPixel=function(t){var e,a,i=null!==(a=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==a?a:0,n=this.getRange(),r=n.from,o=n.range,s=(t-r)/o;return this.isReverse()?Math.round(s*i):Math.round((1-s)*i)},e.prototype.isInCandle=function(){return this.getParent().getId()===Oa.CANDLE},e.prototype.getType=function(){return this.isInCandle()?this.getParent().getChart().getStyles().yAxis.type:K.Normal},e.prototype.getPosition=function(){return this.getParent().getChart().getStyles().yAxis.position},e.prototype.isReverse=function(){return!!this.isInCandle()&&this.getParent().getChart().getStyles().yAxis.reverse},e.prototype.isFromZero=function(){var t=this.getParent().getChart().getStyles().yAxis,e=t.inside;return t.position===Y.Left&&e||t.position===Y.Right&&!e},e.prototype.optimalTicks=function(t){var e,a,i=this,n=this.getParent(),r=null!==(a=null===(e=n.getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==a?a:0,o=n.getChart().getChartStore(),s=o.getCustomApi(),l=[],c=this.getType(),u=o.getIndicatorStore().getInstances(n.getId()),d=o.getThousandsSeparator(),h=o.getDecimalFoldThreshold(),p=0,v=!1;this.isInCandle()?p=o.getPrecision().price:u.forEach(function(t){p=Math.max(p,t.precision),v||(v=t.shouldFormatBigNumber)});var f,g=o.getStyles().xAxis.tickText.size;return t.forEach(function(t){var e,a=t.value,n=i._innerConvertToPixel(+a);switch(c){case K.Percentage:e="".concat(Nt(a,2),"%");break;case K.Log:n=i._innerConvertToPixel(ye(+a)),e=Nt(a,p);break;default:e=Nt(a,p),v&&(e=s.formatBigNumber(a));break}e=Vt(zt(e,d),h);var o=Et(f);n>g&&n<r-g&&(o&&Math.abs(f-n)>2*g||!o)&&(l.push({text:e,coord:n,value:a}),f=n)}),l},e.prototype.getAutoSize=function(){var t=this.getParent(),e=t.getChart(),a=e.getStyles(),i=a.yAxis,n=i.size;if("auto"!==n)return n;var r=e.getChartStore(),o=r.getCustomApi(),s=0;if(i.show&&(i.axisLine.show&&(s+=i.axisLine.size),i.tickLine.show&&(s+=i.tickLine.length),i.tickText.show)){var l=0;this.getTicks().forEach(function(t){l=Math.max(l,Ht(t.text,i.tickText.size,i.tickText.weight,i.tickText.family))}),s+=i.tickText.marginStart+i.tickText.marginEnd+l}var c=a.crosshair,u=0;if(c.show&&c.horizontal.show&&c.horizontal.text.show){var d=r.getIndicatorStore().getInstances(t.getId()),h=0,p=!1;d.forEach(function(t){h=Math.max(t.precision,h),p||(p=t.shouldFormatBigNumber)});var v=2;if(this.getType()!==K.Percentage)if(this.isInCandle()){var f=r.getPrecision().price,g=a.indicator.lastValueMark;v=g.show&&g.text.show?Math.max(h,f):f}else v=h;var m=Nt(this.getRange().to,v);p&&(m=o.formatBigNumber(m)),m=Vt(m,r.getDecimalFoldThreshold()),u+=c.horizontal.text.paddingLeft+c.horizontal.text.paddingRight+2*c.horizontal.text.borderSize+Ht(m,c.horizontal.text.size,c.horizontal.text.weight,c.horizontal.text.family)}return Math.max(s,u)},e.prototype.getSelfBounding=function(){return this.getParent().getYAxisWidget().getBounding()},e.prototype.convertFromPixel=function(t){var e,a,i=null!==(a=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==a?a:0,n=this.getRange(),r=n.from,o=n.range,s=this.isReverse()?t/i:1-t/i,l=s*o+r;switch(this.getType()){case K.Percentage:var c=this.getParent().getChart().getChartStore().getVisibleFirstData();return At(c)&&Et(c.close)?c.close*l/100+c.close:0;case K.Log:return be(l);default:return l}},e.prototype.convertToRealValue=function(t){var e=t;return this.getType()===K.Log&&(e=be(t)),e},e.prototype.convertToPixel=function(t){var e=t;switch(this.getType()){case K.Percentage:var a=this.getParent().getChart().getChartStore().getVisibleFirstData();At(a)&&Et(a.close)&&(e=(t-a.close)/a.close*100);break;case K.Log:e=ye(t);break;default:e=t}return this._innerConvertToPixel(e)},e.prototype.convertToNicePixel=function(t){var e,a,i=null!==(a=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==a?a:0,n=this.convertToPixel(t);return Math.round(Math.max(.05*i,Math.min(n,.98*i)))},e.extend=function(t){var a=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return L(a,e),a.prototype.createTicks=function(e){return t.createTicks(e)},a}(e);return a},e}(ji),Zi={name:"default",createTicks:function(t){var e=t.defaultTicks;return e}},Ji={default:Gi.extend(Zi)};function Qi(t){var e;return null!==(e=Ji[t])&&void 0!==e?e:Ji.default}var tn=function(){function t(t,e,a,i){this._bounding=Qa(),this._chart=a,this._id=i,this._init(t,e)}return t.prototype._init=function(t,e){this._rootContainer=t,this._container=he("div",{width:"100%",margin:"0",padding:"0",position:"relative",overflow:"hidden",boxSizing:"border-box"}),null!==e?t.insertBefore(this._container,e):t.appendChild(this._container)},t.prototype.getContainer=function(){return this._container},t.prototype.getId=function(){return this._id},t.prototype.getChart=function(){return this._chart},t.prototype.getBounding=function(){return this._bounding},t.prototype.update=function(t){this._bounding.height!==this._container.clientHeight&&(this._container.style.height="".concat(this._bounding.height,"px")),this.updateImp(null!==t&&void 0!==t?t:3,this._container,this._bounding)},t.prototype.destroy=function(){this._rootContainer.removeChild(this._container)},t}(),en=function(t){function e(e,a,i,n,r){var o=t.call(this,e,a,i,n)||this;o._yAxisWidget=null,o._options={minHeight:za,dragEnabled:!0,gap:{top:.2,bottom:.1},axisOptions:{name:"default",scrollZoomEnabled:!0}};var s=o.getContainer();return o._mainWidget=o.createMainWidget(s),o._yAxisWidget=o.createYAxisWidget(s),o.setOptions(r),o}return L(e,t),e.prototype.setOptions=function(t){var e,a,i,n,r,o=null===(e=t.axisOptions)||void 0===e?void 0:e.name;return(this._options.axisOptions.name!==o&&Dt(o)||!At(this._axis))&&(this._axis=this.createAxisComponent(null!==o&&void 0!==o?o:"default")),wt(this._options,t),this.getId()===Oa.X_AXIS?(n=this.getMainWidget().getContainer(),r="ew-resize"):(n=this.getYAxisWidget().getContainer(),r="ns-resize"),null===(i=null===(a=t.axisOptions)||void 0===a?void 0:a.scrollZoomEnabled)||void 0===i||i?n.style.cursor=r:n.style.cursor="default",this},e.prototype.getOptions=function(){return this._options},e.prototype.getAxisComponent=function(){return this._axis},e.prototype.setBounding=function(t,e,a){var i,n;wt(this.getBounding(),t);var r={};return At(t.height)&&(r.height=t.height),At(t.top)&&(r.top=t.top),this._mainWidget.setBounding(r),null===(i=this._yAxisWidget)||void 0===i||i.setBounding(r),At(e)&&this._mainWidget.setBounding(e),At(a)&&(null===(n=this._yAxisWidget)||void 0===n||n.setBounding(a)),this},e.prototype.getMainWidget=function(){return this._mainWidget},e.prototype.getYAxisWidget=function(){return this._yAxisWidget},e.prototype.updateImp=function(t){var e;this._mainWidget.update(t),null===(e=this._yAxisWidget)||void 0===e||e.update(t)},e.prototype.destroy=function(){var e;t.prototype.destroy.call(this),this._mainWidget.destroy(),null===(e=this._yAxisWidget)||void 0===e||e.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),a=e.width,i=e.height,n=he("canvas",{width:"".concat(a,"px"),height:"".concat(i,"px"),boxSizing:"border-box"}),r=n.getContext("2d"),o=Ot(n);n.width=a*o,n.height=i*o,r.scale(o,o);var s=this._mainWidget.getBounding();if(r.drawImage(this._mainWidget.getImage(t),s.left,0,s.width,s.height),null!==this._yAxisWidget){var l=this._yAxisWidget.getBounding();r.drawImage(this._yAxisWidget.getImage(t),l.left,0,l.width,l.height)}return n},e.prototype.createYAxisWidget=function(t){return null},e}(tn),an=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.createAxisComponent=function(t){var e=Qi(null!==t&&void 0!==t?t:"default");return new e(this)},e.prototype.createMainWidget=function(t){return new Mi(t,this)},e.prototype.createYAxisWidget=function(t){return new Ui(t,this)},e}(en),nn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.createMainWidget=function(t){return new Oi(t,this)},e}(an),rn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.getAxisStyles=function(t){return t.xAxis},e.prototype.createAxisLine=function(t){return{coordinates:[{x:0,y:0},{x:t.width,y:0}]}},e.prototype.createTickLines=function(t,e,a){var i=a.tickLine,n=a.axisLine.size;return t.map(function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:n+i.length}]}})},e.prototype.createTickTexts=function(t,e,a){var i=a.tickText,n=a.axisLine.size,r=a.tickLine.length;return t.map(function(t){return{x:t.coord,y:n+r+i.marginStart,text:t.text,align:"center",baseline:"top"}})},e}(Wi),on=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.coordinateToPointTimestampDataIndexFlag=function(){return!0},e.prototype.coordinateToPointValueFlag=function(){return!1},e.prototype.getCompleteOverlays=function(t){return t.getInstances()},e.prototype.getProgressOverlay=function(t){return t.instance},e.prototype.getDefaultFigures=function(t,e,a,i,n,r,o,s,l,c,u){var d,h=[];if(t.needDefaultXAxisFigure&&t.id===(null===(d=u.instance)||void 0===d?void 0:d.id)){var p=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER;e.forEach(function(e,a){p=Math.min(p,e.x),v=Math.max(v,e.x);var i=t.points[a];if(Et(i.timestamp)){var o=r.formatDate(n,i.timestamp,"YYYY-MM-DD HH:mm",Zt.Crosshair);h.push({type:"text",attrs:{x:e.x,y:0,text:o,align:"center"},ignoreEvent:!0})}}),e.length>1&&h.unshift({type:"rect",attrs:{x:p,y:0,width:v-p,height:a.height},ignoreEvent:!0})}return h},e.prototype.getFigures=function(t,e,a,i,n,r,o,s,l,c,u){var d,h;return null!==(h=null===(d=t.createXAxisFigures)||void 0===d?void 0:d.call(t,{overlay:t,coordinates:e,bounding:a,barSpace:i,precision:n,thousandsSeparator:r,decimalFoldThreshold:o,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==h?h:[]},e}(Xi),sn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.compare=function(t){return At(t.kLineData)&&t.dataIndex===t.realDataIndex},e.prototype.getDirectionStyles=function(t){return t.vertical},e.prototype.getText=function(t,e){var a,i=null===(a=t.kLineData)||void 0===a?void 0:a.timestamp;return e.getCustomApi().formatDate(e.getTimeScaleStore().getDateTimeFormat(),i,"YYYY-MM-DD HH:mm",Zt.Crosshair)},e.prototype.getTextAttrs=function(t,e,a,i,n,r){var o,s=a.realX,l="center";return s-e/2-r.paddingLeft<0?(o=0,l="left"):s+e/2+r.paddingRight>i.width?(o=i.width,l="right"):o=s,{x:o,y:0,text:t,align:l,baseline:"top"}},e}(qi),ln=function(t){function e(e,a){var i=t.call(this,e,a)||this;return i._xAxisView=new rn(i),i._overlayXAxisView=new on(i),i._crosshairVerticalLabelView=new sn(i),i.getContainer().style.cursor="ew-resize",i.addChild(i._overlayXAxisView),i}return L(e,t),e.prototype.getName=function(){return ja.X_AXIS},e.prototype.updateMain=function(t){this._xAxisView.draw(t)},e.prototype.updateOverlay=function(t){this._overlayXAxisView.draw(t),this._crosshairVerticalLabelView.draw(t)},e}(ei),cn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.calcRange=function(){var t=this.getParent().getChart().getChartStore(),e=t.getTimeScaleStore().getVisibleRange(),a=e.from,i=e.to,n=a,r=i-1,o=i-a;return{from:n,to:r,range:o,realFrom:n,realTo:r,realRange:o}},e.prototype.optimalTicks=function(t){var e,a,i=this.getParent().getChart(),n=i.getChartStore(),r=n.getCustomApi().formatDate,o=[],s=t.length,l=n.getDataList();if(s>0){var c=n.getTimeScaleStore().getDateTimeFormat(),u=i.getStyles().xAxis.tickText,d=Ht("00-00 00:00",u.size,u.weight,u.family),h=parseInt(t[0].value,10),p=this.convertToPixel(h),v=1;if(s>1){var f=parseInt(t[1].value,10),g=this.convertToPixel(f),m=Math.abs(g-p);m<d&&(v=Math.ceil(d/m))}for(var y=0;y<s;y+=v){var b=parseInt(t[y].value,10),_=l[b],x=_.timestamp,w=r(c,x,"HH:mm",Zt.XAxis);if(0!==y){var S=parseInt(t[y-v].value,10),k=l[S],C=k.timestamp;w=null!==(e=this._optimalTickLabel(r,c,x,C))&&void 0!==e?e:w}var I=this.convertToPixel(b);o.push({text:w,coord:I,value:x})}var E=o.length;if(1===E)o[0].text=r(c,o[0].value,"YYYY-MM-DD HH:mm",Zt.XAxis);else{var A=o[0].value,P=o[1].value;if(At(o[2])){var D=o[2].text;/^[0-9]{2}-[0-9]{2}$/.test(D)?o[0].text=r(c,A,"MM-DD",Zt.XAxis):/^[0-9]{4}-[0-9]{2}$/.test(D)?o[0].text=r(c,A,"YYYY-MM",Zt.XAxis):/^[0-9]{4}$/.test(D)&&(o[0].text=r(c,A,"YYYY",Zt.XAxis))}else o[0].text=null!==(a=this._optimalTickLabel(r,c,A,P))&&void 0!==a?a:o[0].text}}return o},e.prototype._optimalTickLabel=function(t,e,a,i){var n=t(e,a,"YYYY",Zt.XAxis),r=t(e,a,"YYYY-MM",Zt.XAxis),o=t(e,a,"MM-DD",Zt.XAxis);return n!==t(e,i,"YYYY",Zt.XAxis)?n:r!==t(e,i,"YYYY-MM",Zt.XAxis)?r:o!==t(e,i,"MM-DD",Zt.XAxis)?o:null},e.prototype.getAutoSize=function(){var t=this.getParent().getChart().getStyles(),e=t.xAxis,a=e.size;if("auto"!==a)return a;var i=t.crosshair,n=0;e.show&&(e.axisLine.show&&(n+=e.axisLine.size),e.tickLine.show&&(n+=e.tickLine.length),e.tickText.show&&(n+=e.tickText.marginStart+e.tickText.marginEnd+e.tickText.size));var r=0;return i.show&&i.vertical.show&&i.vertical.text.show&&(r+=i.vertical.text.paddingTop+i.vertical.text.paddingBottom+2*i.vertical.text.borderSize+i.vertical.text.size),Math.max(n,r)},e.prototype.getSelfBounding=function(){return this.getParent().getMainWidget().getBounding()},e.prototype.convertTimestampFromPixel=function(t){var e=this.getParent().getChart().getChartStore().getTimeScaleStore(),a=e.coordinateToDataIndex(t);return e.dataIndexToTimestamp(a)},e.prototype.convertTimestampToPixel=function(t){var e=this.getParent().getChart().getChartStore().getTimeScaleStore(),a=e.timestampToDataIndex(t);return e.dataIndexToCoordinate(a)},e.prototype.convertFromPixel=function(t){return this.getParent().getChart().getChartStore().getTimeScaleStore().coordinateToDataIndex(t)},e.prototype.convertToPixel=function(t){return this.getParent().getChart().getChartStore().getTimeScaleStore().dataIndexToCoordinate(t)},e.extend=function(t){var a=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}return L(a,e),a.prototype.createTicks=function(e){return t.createTicks(e)},a}(e);return a},e}(ji),un={name:"default",createTicks:function(t){var e=t.defaultTicks;return e}},dn={default:cn.extend(un)};function hn(t){var e;return null!==(e=dn[t])&&void 0!==e?e:dn.default}var pn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return L(e,t),e.prototype.createAxisComponent=function(t){var e=hn(t);return new e(this)},e.prototype.createMainWidget=function(t){return new ln(t,this)},e}(en);function vn(t,e){var a=0;return function(){var i=Date.now();i-a>e&&(t.apply(this,arguments),a=i)}}var fn=function(t){function e(e,a){var i=t.call(this,e,a)||this;return i._dragFlag=!1,i._dragStartY=0,i._topPaneHeight=0,i._bottomPaneHeight=0,i._pressedMouseMoveEvent=vn(i._pressedTouchMouseMoveEvent,20),i.registerEvent("touchStartEvent",i._mouseDownEvent.bind(i)).registerEvent("touchMoveEvent",i._pressedMouseMoveEvent.bind(i)).registerEvent("touchEndEvent",i._mouseUpEvent.bind(i)).registerEvent("mouseDownEvent",i._mouseDownEvent.bind(i)).registerEvent("mouseUpEvent",i._mouseUpEvent.bind(i)).registerEvent("pressedMouseMoveEvent",i._pressedMouseMoveEvent.bind(i)).registerEvent("mouseEnterEvent",i._mouseEnterEvent.bind(i)).registerEvent("mouseLeaveEvent",i._mouseLeaveEvent.bind(i)),i}return L(e,t),e.prototype.getName=function(){return ja.SEPARATOR},e.prototype.checkEventOn=function(){return!0},e.prototype._mouseDownEvent=function(t){this._dragFlag=!0,this._dragStartY=t.pageY;var e=this.getPane();return this._topPaneHeight=e.getTopPane().getBounding().height,this._bottomPaneHeight=e.getBottomPane().getBounding().height,!0},e.prototype._mouseUpEvent=function(){return this._dragFlag=!1,this._mouseLeaveEvent()},e.prototype._pressedTouchMouseMoveEvent=function(t){var e=t.pageY-this._dragStartY,a=this.getPane(),i=a.getTopPane(),n=a.getBottomPane(),r=e<0;if(null!==i&&(null===n||void 0===n?void 0:n.getOptions().dragEnabled)){var o=void 0,s=void 0,l=void 0,c=void 0;r?(o=i,s=n,l=this._topPaneHeight,c=this._bottomPaneHeight):(o=n,s=i,l=this._bottomPaneHeight,c=this._topPaneHeight);var u=o.getOptions().minHeight;if(l>u){var d=Math.max(l-Math.abs(e),u),h=l-d;o.setBounding({height:d}),s.setBounding({height:c+h});var p=a.getChart();p.getChartStore().getActionStore().execute(Mt.OnPaneDrag,{paneId:a.getId()}),p.adjustPaneViewport(!0,!0,!0,!0,!0)}}return!0},e.prototype._mouseEnterEvent=function(){var t,e=this.getPane(),a=e.getBottomPane();if(null!==(t=null===a||void 0===a?void 0:a.getOptions().dragEnabled)&&void 0!==t&&t){var i=e.getChart(),n=i.getStyles().separator;return this.getContainer().style.background=n.activeBackgroundColor,!0}return!1},e.prototype._mouseLeaveEvent=function(){return!this._dragFlag&&(this.getContainer().style.background="",!0)},e.prototype.createContainer=function(){return he("div",{width:"100%",height:"".concat(Ga,"px"),margin:"0",padding:"0",position:"absolute",top:"-3px",zIndex:"20",boxSizing:"border-box",cursor:"ns-resize"})},e.prototype.updateImp=function(t,e,a){if(4===a||2===a){var i=this.getPane().getChart().getStyles().separator;t.style.top="".concat(-Math.floor((Ga-i.size)/2),"px"),t.style.height="".concat(Ga,"px")}},e}(ti),gn=function(t){function e(e,a,i,n,r,o){var s=t.call(this,e,a,i,n)||this;return s.getContainer().style.overflow="",s._topPane=r,s._bottomPane=o,s._separatorWidget=new fn(s.getContainer(),s),s}return L(e,t),e.prototype.setBounding=function(t){return wt(this.getBounding(),t),this},e.prototype.getTopPane=function(){return this._topPane},e.prototype.setTopPane=function(t){return this._topPane=t,this},e.prototype.getBottomPane=function(){return this._bottomPane},e.prototype.setBottomPane=function(t){return this._bottomPane=t,this},e.prototype.getWidget=function(){return this._separatorWidget},e.prototype.getImage=function(t){var e=this.getBounding(),a=e.width,i=e.height,n=this.getChart().getStyles().separator,r=he("canvas",{width:"".concat(a,"px"),height:"".concat(i,"px"),boxSizing:"border-box"}),o=r.getContext("2d"),s=Ot(r);return r.width=a*s,r.height=i*s,o.scale(s,s),o.fillStyle=n.color,o.fillRect(0,0,a,i),r},e.prototype.updateImp=function(t,e,a){if(4===t||2===t){var i=this.getChart().getStyles().separator;e.style.backgroundColor=i.color,e.style.height="".concat(a.height,"px"),e.style.marginLeft="".concat(a.left,"px"),e.style.width="".concat(a.width,"px"),this._separatorWidget.update(t)}},e}(tn);function mn(){var t;return"undefined"!==typeof window&&(null!==(t=window.navigator.userAgent.toLowerCase().indexOf("firefox"))&&void 0!==t?t:-1)>-1}function yn(){return"undefined"!==typeof window&&/iPhone|iPad|iPod/.test(window.navigator.platform)}var bn,_n=10,xn=function(){function t(t,e,a){var i=this;this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartCoordinate=null,this._touchMoveStartCoordinate=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeMouseWheel=null,this._unsubscribeContextMenu=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._startPinchMiddleCoordinate=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!yn(),this._onFirefoxOutsideMouseUp=function(t){i._mouseUpHandler(t)},this._onMobileSafariDoubleClick=function(t){if(i._firesTouchEvents(t)){if(++i._tapCount,null!==i._tapTimeoutId&&i._tapCount>1){var e=i._mouseTouchMoveWithDownInfo(i._getCoordinate(t),i._tapCoordinate).manhattanDistance;e<30&&!i._cancelTap&&i._processEvent(i._makeCompatEvent(t),i._handler.doubleTapEvent),i._resetTapTimeout()}}else if(++i._clickCount,null!==i._clickTimeoutId&&i._clickCount>1){e=i._mouseTouchMoveWithDownInfo(i._getCoordinate(t),i._clickCoordinate).manhattanDistance;e<5&&!i._cancelClick&&i._processEvent(i._makeCompatEvent(t),i._handler.mouseDoubleClickEvent),i._resetClickTimeout()}},this._target=t,this._handler=e,this._options=a,this._init()}return t.prototype.destroy=function(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeMouseWheel&&(this._unsubscribeMouseWheel(),this._unsubscribeMouseWheel=null),null!==this._unsubscribeContextMenu&&(this._unsubscribeContextMenu(),this._unsubscribeContextMenu=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()},t.prototype._mouseEnterHandler=function(t){var e,a,i,n=this;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(a=this._unsubscribeMouseWheel)||void 0===a||a.call(this),null===(i=this._unsubscribeContextMenu)||void 0===i||i.call(this);var r=this._mouseMoveHandler.bind(this);this._unsubscribeMousemove=function(){n._target.removeEventListener("mousemove",r)},this._target.addEventListener("mousemove",r);var o=this._mouseWheelHandler.bind(this);this._unsubscribeMouseWheel=function(){n._target.removeEventListener("wheel",o)},this._target.addEventListener("wheel",o,{passive:!1});var s=this._contextMenuHandler.bind(this);this._unsubscribeContextMenu=function(){n._target.removeEventListener("contextmenu",s)},this._target.addEventListener("contextmenu",s,{passive:!1}),this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseEnterEvent),this._acceptMouseLeave=!0)},t.prototype._resetClickTimeout=function(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._resetTapTimeout=function(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapCoordinate={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}},t.prototype._mouseMoveHandler=function(t){this._mousePressed||null!==this._touchMoveStartCoordinate||this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseMoveEvent),this._acceptMouseLeave=!0)},t.prototype._mouseWheelHandler=function(t){if(Math.abs(t.deltaX)>Math.abs(t.deltaY)){if(!At(this._handler.mouseWheelHortEvent))return;if(this._preventDefault(t),0===Math.abs(t.deltaX))return;this._handler.mouseWheelHortEvent(this._makeCompatEvent(t),-t.deltaX)}else{if(!At(this._handler.mouseWheelVertEvent))return;var e=-t.deltaY/100;if(0===e)return;switch(this._preventDefault(t),t.deltaMode){case t.DOM_DELTA_PAGE:e*=120;break;case t.DOM_DELTA_LINE:e*=32;break}if(0!==e){var a=Math.sign(e)*Math.min(1,Math.abs(e));this._handler.mouseWheelVertEvent(this._makeCompatEvent(t),a)}}},t.prototype._contextMenuHandler=function(t){this._preventDefault(t)},t.prototype._touchMoveHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null!==e&&(this._lastTouchEventTimeStamp=this._eventTimeStamp(t),null===this._startPinchMiddleCoordinate&&!this._preventTouchDragProcess)){this._pinchPrevented=!0;var a=this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._touchMoveStartCoordinate),i=a.xOffset,n=a.yOffset,r=a.manhattanDistance;if(this._touchMoveExceededManhattanDistance||!(r<5)){if(!this._touchMoveExceededManhattanDistance){var o=.5*i,s=n>=o&&!this._options.treatVertDragAsPageScroll(),l=o>n&&!this._options.treatHorzDragAsPageScroll();s||l||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}this._preventTouchDragProcess||this._processEvent(this._makeCompatEvent(t,e),this._handler.touchMoveEvent)}}},t.prototype._mouseMoveWithDownHandler=function(t){if(0===t.button){var e=this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._mouseMoveStartCoordinate),a=e.manhattanDistance;a>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick&&this._processEvent(this._makeCompatEvent(t),this._handler.pressedMouseMoveEvent)}},t.prototype._mouseTouchMoveWithDownInfo=function(t,e){var a=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y),n=a+i;return{xOffset:a,yOffset:i,manhattanDistance:n}},t.prototype._touchEndHandler=function(t){var e=this._touchWithId(t.changedTouches,this._activeTouchId);if(null===e&&0===t.touches.length&&(e=t.changedTouches[0]),null!==e){this._activeTouchId=null,this._lastTouchEventTimeStamp=this._eventTimeStamp(t),this._clearLongTapTimeout(),this._touchMoveStartCoordinate=null,null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var a=this._makeCompatEvent(t,e);if(this._processEvent(a,this._handler.touchEndEvent),++this._tapCount,null!==this._tapTimeoutId&&this._tapCount>1){var i=this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._tapCoordinate).manhattanDistance;i<30&&!this._cancelTap&&this._processEvent(a,this._handler.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processEvent(a,this._handler.tapEvent),At(this._handler.tapEvent)&&this._preventDefault(t));0===this._tapCount&&this._preventDefault(t),0===t.touches.length&&this._longTapActive&&(this._longTapActive=!1,this._preventDefault(t))}},t.prototype._mouseUpHandler=function(t){if(0===t.button){var e=this._makeCompatEvent(t);if(this._mouseMoveStartCoordinate=null,this._mousePressed=!1,null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),mn()){var a=this._target.ownerDocument.documentElement;a.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(t))if(this._processEvent(e,this._handler.mouseUpEvent),++this._clickCount,null!==this._clickTimeoutId&&this._clickCount>1){var i=this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._clickCoordinate).manhattanDistance;i<5&&!this._cancelClick&&this._processEvent(e,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processEvent(e,this._handler.mouseClickEvent)}},t.prototype._clearLongTapTimeout=function(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)},t.prototype._touchStartHandler=function(t){if(null===this._activeTouchId){var e=t.changedTouches[0];this._activeTouchId=e.identifier,this._lastTouchEventTimeStamp=this._eventTimeStamp(t);var a=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartCoordinate=this._getCoordinate(e),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);var i=this._touchMoveHandler.bind(this),n=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=function(){a.removeEventListener("touchmove",i),a.removeEventListener("touchend",n)},a.addEventListener("touchmove",i,{passive:!1}),a.addEventListener("touchend",n,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),500),this._processEvent(this._makeCompatEvent(t,e),this._handler.touchStartEvent),null===this._tapTimeoutId&&(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapCoordinate=this._getCoordinate(e))}},t.prototype._mouseDownHandler=function(t){if(2===t.button)return this._preventDefault(t),void this._processEvent(this._makeCompatEvent(t),this._handler.mouseRightClickEvent);if(0===t.button){var e=this._target.ownerDocument.documentElement;mn()&&e.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartCoordinate=this._getCoordinate(t),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);var a=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=function(){e.removeEventListener("mousemove",a),e.removeEventListener("mouseup",i)},e.addEventListener("mousemove",a),e.addEventListener("mouseup",i),this._mousePressed=!0,this._firesTouchEvents(t)||(this._processEvent(this._makeCompatEvent(t),this._handler.mouseDownEvent),null===this._clickTimeoutId&&(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickCoordinate=this._getCoordinate(t)))}},t.prototype._init=function(){var t=this;this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));var e=this._target.ownerDocument,a=function(e){null!=t._handler.mouseDownOutsideEvent&&(e.composed&&t._target.contains(e.composedPath()[0])||null!==e.target&&t._target.contains(e.target)||t._handler.mouseDownOutsideEvent({x:0,y:0,pageX:0,pageY:0}))};this._unsubscribeOutsideTouchEvents=function(){e.removeEventListener("touchstart",a)},this._unsubscribeOutsideMouseEvents=function(){e.removeEventListener("mousedown",a)},e.addEventListener("mousedown",a),e.addEventListener("touchstart",a,{passive:!0}),yn()&&(this._unsubscribeMobileSafariEvents=function(){t._target.removeEventListener("dblclick",t._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),this._target.addEventListener("mousedown",function(t){if(1===t.button)return t.preventDefault(),!1}),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",function(){},{passive:!1})},t.prototype._initPinch=function(){var t=this;(At(this._handler.pinchStartEvent)||At(this._handler.pinchEvent)||At(this._handler.pinchEndEvent))&&(this._target.addEventListener("touchstart",function(e){t._checkPinchState(e.touches)},{passive:!0}),this._target.addEventListener("touchmove",function(e){if(2===e.touches.length&&null!==t._startPinchMiddleCoordinate&&At(t._handler.pinchEvent)){var a=t._getTouchDistance(e.touches[0],e.touches[1]),i=a/t._startPinchDistance;t._handler.pinchEvent(X(X({},t._startPinchMiddleCoordinate),{pageX:0,pageY:0}),i),t._preventDefault(e)}},{passive:!1}),this._target.addEventListener("touchend",function(e){t._checkPinchState(e.touches)}))},t.prototype._checkPinchState=function(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)},t.prototype._startPinch=function(t){var e,a=null!==(e=this._target.getBoundingClientRect())&&void 0!==e?e:{left:0,top:0};this._startPinchMiddleCoordinate={x:(t[0].clientX-a.left+(t[1].clientX-a.left))/2,y:(t[0].clientY-a.top+(t[1].clientY-a.top))/2},this._startPinchDistance=this._getTouchDistance(t[0],t[1]),At(this._handler.pinchStartEvent)&&this._handler.pinchStartEvent({x:0,y:0,pageX:0,pageY:0}),this._clearLongTapTimeout()},t.prototype._stopPinch=function(){null!==this._startPinchMiddleCoordinate&&(this._startPinchMiddleCoordinate=null,At(this._handler.pinchEndEvent)&&this._handler.pinchEndEvent({x:0,y:0,pageX:0,pageY:0}))},t.prototype._mouseLeaveHandler=function(t){var e,a,i;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(a=this._unsubscribeMouseWheel)||void 0===a||a.call(this),null===(i=this._unsubscribeContextMenu)||void 0===i||i.call(this),this._firesTouchEvents(t)||this._acceptMouseLeave&&(this._processEvent(this._makeCompatEvent(t),this._handler.mouseLeaveEvent),this._acceptMouseLeave=!yn())},t.prototype._longTapHandler=function(t){var e=this._touchWithId(t.touches,this._activeTouchId);null!==e&&(this._processEvent(this._makeCompatEvent(t,e),this._handler.longTapEvent),this._cancelTap=!0,this._longTapActive=!0)},t.prototype._firesTouchEvents=function(t){var e;return At(null===(e=t.sourceCapabilities)||void 0===e?void 0:e.firesTouchEvents)?t.sourceCapabilities.firesTouchEvents:this._eventTimeStamp(t)<this._lastTouchEventTimeStamp+500},t.prototype._processEvent=function(t,e){null===e||void 0===e||e.call(this._handler,t)},t.prototype._makeCompatEvent=function(t,e){var a,i=this,n=null!==e&&void 0!==e?e:t,r=null!==(a=this._target.getBoundingClientRect())&&void 0!==a?a:{left:0,top:0};return{x:n.clientX-r.left,y:n.clientY-r.top,pageX:n.pageX,pageY:n.pageY,isTouch:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type&&"wheel"!==t.type,preventDefault:function(){"touchstart"!==t.type&&i._preventDefault(t)}}},t.prototype._getTouchDistance=function(t,e){var a=t.clientX-e.clientX,i=t.clientY-e.clientY;return Math.sqrt(a*a+i*i)},t.prototype._preventDefault=function(t){t.cancelable&&t.preventDefault()},t.prototype._getCoordinate=function(t){return{x:t.pageX,y:t.pageY}},t.prototype._eventTimeStamp=function(t){var e;return null!==(e=t.timeStamp)&&void 0!==e?e:performance.now()},t.prototype._touchWithId=function(t,e){for(var a=0;a<t.length;++a)if(t[a].identifier===e)return t[a];return null},t}(),wn=function(){function t(t,e){var a=this;this._flingStartTime=(new Date).getTime(),this._flingScrollRequestId=null,this._startScrollCoordinate=null,this._touchCoordinate=null,this._touchCancelCrosshair=!1,this._touchZoomed=!1,this._pinchScale=1,this._mouseDownWidget=null,this._prevYAxisRange=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,this._mouseMoveTriggerWidgetInfo={pane:null,widget:null},this._boundKeyBoardDownEvent=function(t){if(t.shiftKey)switch(t.code){case"Equal":a._chart.getChartStore().getTimeScaleStore().zoom(.5);break;case"Minus":a._chart.getChartStore().getTimeScaleStore().zoom(-.5);break;case"ArrowLeft":var e=a._chart.getChartStore().getTimeScaleStore();e.startScroll(),e.scroll(-3*e.getBarSpace().bar);break;case"ArrowRight":e=a._chart.getChartStore().getTimeScaleStore();e.startScroll(),e.scroll(3*e.getBarSpace().bar);break}},this._container=t,this._chart=e,this._event=new xn(t,this,{treatVertDragAsPageScroll:function(){return!1},treatHorzDragAsPageScroll:function(){return!1}}),t.addEventListener("keydown",this._boundKeyBoardDownEvent)}return t.prototype.pinchStartEvent=function(){return this._touchZoomed=!0,this._pinchScale=1,!0},t.prototype.pinchEvent=function(t,e){var a=this._findWidgetByEvent(t),i=a.pane,n=a.widget;if((null===i||void 0===i?void 0:i.getId())!==Oa.X_AXIS&&(null===n||void 0===n?void 0:n.getName())===ja.MAIN){var r=this._makeWidgetEvent(t,n),o=5*(e-this._pinchScale);return this._pinchScale=e,this._chart.getChartStore().getTimeScaleStore().zoom(o,{x:r.x,y:r.y}),!0}return!1},t.prototype.mouseWheelHortEvent=function(t,e){var a=this._chart.getChartStore().getTimeScaleStore();return a.startScroll(),a.scroll(e),!0},t.prototype.mouseWheelVertEvent=function(t,e){var a=this._findWidgetByEvent(t).widget,i=this._makeWidgetEvent(t,a),n=null===a||void 0===a?void 0:a.getName();return n===ja.MAIN&&(this._chart.getChartStore().getTimeScaleStore().zoom(e,{x:i.x,y:i.y}),!0)},t.prototype.mouseDownEvent=function(t){var e,a,i=this._findWidgetByEvent(t),n=i.pane,r=i.widget;if(this._mouseDownWidget=r,null!==r){var o=this._makeWidgetEvent(t,r),s=r.getName();switch(s){case ja.SEPARATOR:return r.dispatchEvent("mouseDownEvent",o);case ja.MAIN:var l=null!==(e=n.getAxisComponent().getRange())&&void 0!==e?e:null;return this._prevYAxisRange=null===l?l:X({},l),this._startScrollCoordinate={x:o.x,y:o.y},this._chart.getChartStore().getTimeScaleStore().startScroll(),r.dispatchEvent("mouseDownEvent",o);case ja.X_AXIS:var c=r.dispatchEvent("mouseDownEvent",o);return c&&this._chart.updatePane(1),this._xAxisStartScaleCoordinate={x:o.x,y:o.y},this._xAxisStartScaleDistance=o.pageX,c;case ja.Y_AXIS:c=r.dispatchEvent("mouseDownEvent",o);c&&this._chart.updatePane(1);l=null!==(a=n.getAxisComponent().getRange())&&void 0!==a?a:null;return this._prevYAxisRange=null===l?l:X({},l),this._yAxisStartScaleDistance=o.pageY,c}}return!1},t.prototype.mouseMoveEvent=function(t){var e,a,i,n=this._findWidgetByEvent(t),r=n.pane,o=n.widget,s=this._makeWidgetEvent(t,o);if((null===(e=this._mouseMoveTriggerWidgetInfo.pane)||void 0===e?void 0:e.getId())===(null===r||void 0===r?void 0:r.getId())&&(null===(a=this._mouseMoveTriggerWidgetInfo.widget)||void 0===a?void 0:a.getName())===(null===o||void 0===o?void 0:o.getName())||(null===o||void 0===o||o.dispatchEvent("mouseEnterEvent",s),null===(i=this._mouseMoveTriggerWidgetInfo.widget)||void 0===i||i.dispatchEvent("mouseLeaveEvent",s),this._mouseMoveTriggerWidgetInfo={pane:r,widget:o}),null!==o){var l=o.getName();switch(l){case ja.MAIN:var c=o.dispatchEvent("mouseMoveEvent",s),u=this._chart.getChartStore(),d={x:s.x,y:s.y,paneId:null===r||void 0===r?void 0:r.getId()};return c&&null!==u.getTooltipStore().getActiveIcon()&&(d=void 0,null!==o&&(o.getContainer().style.cursor="pointer")),this._chart.getChartStore().getTooltipStore().setCrosshair(d),c;case ja.SEPARATOR:case ja.X_AXIS:case ja.Y_AXIS:c=o.dispatchEvent("mouseMoveEvent",s);return this._chart.getChartStore().getTooltipStore().setCrosshair(),c}}return!1},t.prototype.pressedMouseMoveEvent=function(t){var e,a,i,n,r;if(null!==this._mouseDownWidget&&this._mouseDownWidget.getName()===ja.SEPARATOR)return this._mouseDownWidget.dispatchEvent("pressedMouseMoveEvent",t);var o=this._findWidgetByEvent(t),s=o.pane,l=o.widget;if(null!==l&&(null===(e=this._mouseDownWidget)||void 0===e?void 0:e.getPane().getId())===(null===s||void 0===s?void 0:s.getId())&&(null===(a=this._mouseDownWidget)||void 0===a?void 0:a.getName())===l.getName()){var c=this._makeWidgetEvent(t,l),u=l.getName();switch(u){case ja.MAIN:var d=l.getBounding(),h=l.dispatchEvent("pressedMouseMoveEvent",c);if(!h&&null!==this._startScrollCoordinate){var p=s.getAxisComponent();if(null!==this._prevYAxisRange&&!p.getAutoCalcTickFlag()&&p.getScrollZoomEnabled()){var v,f=this._prevYAxisRange,g=f.from,m=f.to,y=f.range;v=null!==(i=null===p||void 0===p?void 0:p.isReverse())&&void 0!==i&&i?this._startScrollCoordinate.y-c.y:c.y-this._startScrollCoordinate.y;var b=v/d.height,_=y*b,x=g+_,w=m+_,S=p.convertToRealValue(x),k=p.convertToRealValue(w);p.setRange({from:x,to:w,range:w-x,realFrom:S,realTo:k,realRange:k-S})}var C=c.x-this._startScrollCoordinate.x;this._chart.getChartStore().getTimeScaleStore().scroll(C)}return this._chart.getChartStore().getTooltipStore().setCrosshair({x:c.x,y:c.y,paneId:null===s||void 0===s?void 0:s.getId()}),h;case ja.X_AXIS:h=l.dispatchEvent("pressedMouseMoveEvent",c);if(h)this._chart.updatePane(1);else{var I=s.getAxisComponent();if(null===(n=null===I||void 0===I?void 0:I.getScrollZoomEnabled())||void 0===n||n){b=this._xAxisStartScaleDistance/c.pageX;if(Number.isFinite(b)){var E=10*(b-this._xAxisScale);this._xAxisScale=b,this._chart.getChartStore().getTimeScaleStore().zoom(E,null!==(r=this._xAxisStartScaleCoordinate)&&void 0!==r?r:void 0)}}}return h;case ja.Y_AXIS:h=l.dispatchEvent("pressedMouseMoveEvent",c);if(h)this._chart.updatePane(1);else{p=s.getAxisComponent();if(null!==this._prevYAxisRange&&p.getScrollZoomEnabled()){var A=this._prevYAxisRange,P=(g=A.from,m=A.to,y=A.range,b=c.pageY/this._yAxisStartScaleDistance,y*b);_=(P-y)/2,x=g-_,w=m+_,S=p.convertToRealValue(x),k=p.convertToRealValue(w);p.setRange({from:x,to:w,range:P,realFrom:S,realTo:k,realRange:k-S}),this._chart.adjustPaneViewport(!1,!0,!0,!0)}}return h}}return!1},t.prototype.mouseUpEvent=function(t){var e=this._findWidgetByEvent(t).widget,a=!1;if(null!==e){var i=this._makeWidgetEvent(t,e),n=e.getName();switch(n){case ja.MAIN:case ja.SEPARATOR:case ja.X_AXIS:case ja.Y_AXIS:a=e.dispatchEvent("mouseUpEvent",i);break}a&&this._chart.updatePane(1)}return this._mouseDownWidget=null,this._startScrollCoordinate=null,this._prevYAxisRange=null,this._xAxisStartScaleCoordinate=null,this._xAxisStartScaleDistance=0,this._xAxisScale=1,this._yAxisStartScaleDistance=0,a},t.prototype.mouseClickEvent=function(t){var e=this._findWidgetByEvent(t).widget;if(null!==e){var a=this._makeWidgetEvent(t,e);return e.dispatchEvent("mouseClickEvent",a)}return!1},t.prototype.mouseRightClickEvent=function(t){var e=this._findWidgetByEvent(t).widget,a=!1;if(null!==e){var i=this._makeWidgetEvent(t,e),n=e.getName();switch(n){case ja.MAIN:case ja.X_AXIS:case ja.Y_AXIS:a=e.dispatchEvent("mouseRightClickEvent",i);break}a&&this._chart.updatePane(1)}return!1},t.prototype.mouseDoubleClickEvent=function(t){var e=this._findWidgetByEvent(t),a=e.pane,i=e.widget;if(null!==i){var n=i.getName();switch(n){case ja.MAIN:var r=this._makeWidgetEvent(t,i);return i.dispatchEvent("mouseDoubleClickEvent",r);case ja.Y_AXIS:var o=a.getAxisComponent();if(!o.getAutoCalcTickFlag())return o.setAutoCalcTickFlag(!0),this._chart.adjustPaneViewport(!1,!0,!0,!0),!0;break}}return!1},t.prototype.mouseLeaveEvent=function(){return this._chart.getChartStore().getTooltipStore().setCrosshair(),!0},t.prototype.touchStartEvent=function(t){var e=this._findWidgetByEvent(t),a=e.pane,i=e.widget;if(null!==i){var n=this._makeWidgetEvent(t,i),r=i.getName();switch(r){case ja.MAIN:var o=this._chart.getChartStore(),s=o.getTooltipStore();if(i.dispatchEvent("mouseDownEvent",n))return this._touchCancelCrosshair=!0,this._touchCoordinate=null,s.setCrosshair(void 0,{notInvalidate:!0}),this._chart.updatePane(1),!0;if(null!==this._flingScrollRequestId&&(se(this._flingScrollRequestId),this._flingScrollRequestId=null),this._flingStartTime=(new Date).getTime(),this._startScrollCoordinate={x:n.x,y:n.y},o.getTimeScaleStore().startScroll(),this._touchZoomed=!1,null!==this._touchCoordinate){var l=n.x-this._touchCoordinate.x,c=n.y-this._touchCoordinate.y,u=Math.sqrt(l*l+c*c);u<_n?(this._touchCoordinate={x:n.x,y:n.y},s.setCrosshair({x:n.x,y:n.y,paneId:null===a||void 0===a?void 0:a.getId()})):(this._touchCoordinate=null,this._touchCancelCrosshair=!0,s.setCrosshair())}return!0;case ja.X_AXIS:case ja.Y_AXIS:var d=i.dispatchEvent("mouseDownEvent",n);return d&&this._chart.updatePane(1),d}}return!1},t.prototype.touchMoveEvent=function(t){var e,a,i,n=this._findWidgetByEvent(t),r=n.pane,o=n.widget;if(null!==o){var s=this._makeWidgetEvent(t,o),l=o.getName(),c=this._chart.getChartStore(),u=c.getTooltipStore();switch(l){case ja.MAIN:if(o.dispatchEvent("pressedMouseMoveEvent",s))return null===(e=s.preventDefault)||void 0===e||e.call(s),u.setCrosshair(void 0,{notInvalidate:!0}),this._chart.updatePane(1),!0;if(null!==this._touchCoordinate)null===(a=s.preventDefault)||void 0===a||a.call(s),u.setCrosshair({x:s.x,y:s.y,paneId:null===r||void 0===r?void 0:r.getId()});else if(null!==this._startScrollCoordinate&&Math.abs(this._startScrollCoordinate.x-s.x)>this._startScrollCoordinate.y-s.y){var d=s.x-this._startScrollCoordinate.x;c.getTimeScaleStore().scroll(d)}return!0;case ja.X_AXIS:case ja.Y_AXIS:var h=o.dispatchEvent("pressedMouseMoveEvent",s);return h&&(null===(i=s.preventDefault)||void 0===i||i.call(s),this._chart.updatePane(1)),h}}return!1},t.prototype.touchEndEvent=function(t){var e=this,a=this._findWidgetByEvent(t).widget;if(null!==a){var i=this._makeWidgetEvent(t,a),n=a.getName();switch(n){case ja.MAIN:if(a.dispatchEvent("mouseUpEvent",i),null!==this._startScrollCoordinate){var r=(new Date).getTime()-this._flingStartTime,o=i.x-this._startScrollCoordinate.x,s=o/(r>0?r:1)*20;if(r<200&&Math.abs(s)>0){var l=this._chart.getChartStore().getTimeScaleStore(),c=function(){e._flingScrollRequestId=oe(function(){l.startScroll(),l.scroll(s),s*=.975,Math.abs(s)<1?null!==e._flingScrollRequestId&&(se(e._flingScrollRequestId),e._flingScrollRequestId=null):c()})};c()}}return!0;case ja.X_AXIS:case ja.Y_AXIS:var u=a.dispatchEvent("mouseUpEvent",i);u&&this._chart.updatePane(1)}}return!1},t.prototype.tapEvent=function(t){var e=this._findWidgetByEvent(t),a=e.pane,i=e.widget,n=!1;if(null!==i){var r=this._makeWidgetEvent(t,i),o=i.dispatchEvent("mouseClickEvent",r);if(i.getName()===ja.MAIN){var s=this._makeWidgetEvent(t,i),l=this._chart.getChartStore(),c=l.getTooltipStore();o?(this._touchCancelCrosshair=!0,this._touchCoordinate=null,c.setCrosshair(void 0,{notInvalidate:!0}),n=!0):(this._touchCancelCrosshair||this._touchZoomed||(this._touchCoordinate={x:s.x,y:s.y},c.setCrosshair({x:s.x,y:s.y,paneId:null===a||void 0===a?void 0:a.getId()},{notInvalidate:!0}),n=!0),this._touchCancelCrosshair=!1)}(n||o)&&this._chart.updatePane(1)}return n},t.prototype.doubleTapEvent=function(t){return this.mouseDoubleClickEvent(t)},t.prototype.longTapEvent=function(t){var e=this._findWidgetByEvent(t),a=e.pane,i=e.widget;if(null!==i&&i.getName()===ja.MAIN){var n=this._makeWidgetEvent(t,i);return this._touchCoordinate={x:n.x,y:n.y},this._chart.getChartStore().getTooltipStore().setCrosshair({x:n.x,y:n.y,paneId:null===a||void 0===a?void 0:a.getId()}),!0}return!1},t.prototype._findWidgetByEvent=function(t){var e,a,i,n,r=t.x,o=t.y,s=this._chart.getAllSeparatorPanes(),l=this._chart.getChartStore().getStyles().separator.size;try{for(var c=j(s),u=c.next();!u.done;u=c.next()){var d=G(u.value,2),h=d[1],p=h.getBounding(),v=p.top-Math.round((Ga-l)/2);if(r>=p.left&&r<=p.left+p.width&&o>=v&&o<=v+Ga)return{pane:h,widget:h.getWidget()}}}catch(C){e={error:C}}finally{try{u&&!u.done&&(a=c.return)&&a.call(c)}finally{if(e)throw e.error}}var f=this._chart.getAllDrawPanes(),g=null;try{for(var m=j(f),y=m.next();!y.done;y=m.next()){var b=y.value;p=b.getBounding();if(r>=p.left&&r<=p.left+p.width&&o>=p.top&&o<=p.top+p.height){g=b;break}}}catch(I){i={error:I}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(i)throw i.error}}var _=null;if(null!==g){if(null===_){var x=g.getMainWidget(),w=x.getBounding();r>=w.left&&r<=w.left+w.width&&o>=w.top&&o<=w.top+w.height&&(_=x)}if(null===_){var S=g.getYAxisWidget();if(null!==S){var k=S.getBounding();r>=k.left&&r<=k.left+k.width&&o>=k.top&&o<=k.top+k.height&&(_=S)}}}return{pane:g,widget:_}},t.prototype._makeWidgetEvent=function(t,e){var a,i,n,r=null!==(a=null===e||void 0===e?void 0:e.getBounding())&&void 0!==a?a:null;return X(X({},t),{x:t.x-(null!==(i=null===r||void 0===r?void 0:r.left)&&void 0!==i?i:0),y:t.y-(null!==(n=null===r||void 0===r?void 0:r.top)&&void 0!==n?n:0)})},t.prototype.destroy=function(){this._container.removeEventListener("keydown",this._boundKeyBoardDownEvent),this._event.destroy()},t}();(function(t){t["Root"]="root",t["Main"]="main",t["YAxis"]="yAxis"})(bn||(bn={}));var Sn=function(){function t(t,e){this._drawPanes=[],this._separatorPanes=new Map,this._initContainer(t),this._chartEvent=new wn(this._chartContainer,this),this._chartStore=new Ua(this,e),this._initPanes(e),this.adjustPaneViewport(!0,!0,!0)}return t.prototype._initContainer=function(t){this._container=t,this._chartContainer=he("div",{position:"relative",width:"100%",outline:"none",borderStyle:"none",cursor:"crosshair",boxSizing:"border-box",userSelect:"none",webkitUserSelect:"none",msUserSelect:"none",MozUserSelect:"none",webkitTapHighlightColor:"transparent"}),this._chartContainer.tabIndex=1,t.appendChild(this._chartContainer)},t.prototype._initPanes=function(t){var e,a=this,i=null!==(e=null===t||void 0===t?void 0:t.layout)&&void 0!==e?e:[{type:"candle"}],n=!1,r=!1,o=function(t){if(!r){var e=a._createPane(pn,Oa.X_AXIS,null!==t&&void 0!==t?t:{});a._xAxisPane=e,r=!0}};i.forEach(function(t){var e,i,r;switch(t.type){case"candle":if(!n){var s=null!==(e=t.options)&&void 0!==e?e:{};wt(s,{id:Oa.CANDLE}),a._candlePane=a._createPane(nn,Oa.CANDLE,s);var l=null!==(i=t.content)&&void 0!==i?i:[];l.forEach(function(t){a.createIndicator(t,!0,s)}),n=!0}break;case"indicator":var c;l=null!==(r=t.content)&&void 0!==r?r:[];if(l.length>0)l.forEach(function(e){At(c)?a.createIndicator(e,!0,{id:c}):c=a.createIndicator(e,!0,t.options)});break;case"xAxis":o(t.options);break}}),o({position:"bottom"})},t.prototype._createPane=function(t,e,a){var i,n=null,r=null,o=null===a||void 0===a?void 0:a.position;switch(o){case"top":var s=this._drawPanes[0];At(s)&&(r=new t(this._chartContainer,s.getContainer(),this,e,null!==a&&void 0!==a?a:{}),n=0);break;case"bottom":break;default:for(var l=this._drawPanes.length-1;l>-1;l--){var c=this._drawPanes[l],u=this._drawPanes[l-1];if("bottom"===(null===c||void 0===c?void 0:c.getOptions().position)&&"bottom"!==(null===u||void 0===u?void 0:u.getOptions().position)){r=new t(this._chartContainer,c.getContainer(),this,e,null!==a&&void 0!==a?a:{}),n=l;break}}}if(At(r)||(r=new t(this._chartContainer,null,this,e,null!==a&&void 0!==a?a:{})),Et(n)?(this._drawPanes.splice(n,0,r),i=n):(this._drawPanes.push(r),i=this._drawPanes.length-1),r.getId()!==Oa.X_AXIS){var d=this._drawPanes[i+1];if(At(d)&&d.getId()===Oa.X_AXIS&&(d=this._drawPanes[i+2]),At(d)){var h=this._separatorPanes.get(d);At(h)?h.setTopPane(r):(h=new gn(this._chartContainer,d.getContainer(),this,"",r,d),this._separatorPanes.set(d,h))}var p=this._drawPanes[i-1];if(At(p)&&p.getId()===Oa.X_AXIS&&(p=this._drawPanes[i-2]),At(p)){h=new gn(this._chartContainer,r.getContainer(),this,"",p,r);this._separatorPanes.set(r,h)}}return r},t.prototype._measurePaneHeight=function(){var t,e=this,a=Math.floor(this._container.clientHeight),i=this._chartStore.getStyles().separator.size,n=this._xAxisPane.getAxisComponent().getAutoSize(),r=a-n-this._separatorPanes.size*i;r<0&&(r=0);var o=0;this._drawPanes.forEach(function(t){if(t.getId()!==Oa.CANDLE&&t.getId()!==Oa.X_AXIS){var e=t.getBounding().height,a=t.getOptions().minHeight;e<a&&(e=a),o+e>r?(o=r,e=Math.max(r-o,0)):o+=e,t.setBounding({height:e})}});var s=r-o;null===(t=this._candlePane)||void 0===t||t.setBounding({height:s}),this._xAxisPane.setBounding({height:n});var l=0;this._drawPanes.forEach(function(t){var a=e._separatorPanes.get(t);At(a)&&(a.setBounding({height:i,top:l}),l+=i),t.setBounding({top:l}),l+=t.getBounding().height})},t.prototype._measurePaneWidth=function(){var t=this,e=Math.floor(this._container.clientWidth),a=this._chartStore.getStyles(),i=a.yAxis,n=i.position===Y.Left,r=!i.inside,o=0,s=0,l=0,c=0;this._drawPanes.forEach(function(t){t.getId()!==Oa.X_AXIS&&(s=Math.max(s,t.getAxisComponent().getAutoSize()))}),s>e&&(s=e),r?(o=e-s,n?(l=0,c=s):(l=e-s,c=0)):(o=e,c=0,l=n?0:e-s),this._chartStore.getTimeScaleStore().setTotalBarSpace(o);var u,d={width:e},h={width:o,left:c},p={width:s,left:l},v=a.separator.fill;u=r&&!v?h:d,this._drawPanes.forEach(function(e){var a;null===(a=t._separatorPanes.get(e))||void 0===a||a.setBounding(u),e.setBounding(d,h,p)})},t.prototype._setPaneOptions=function(t,e){var a,i;if(Dt(t.id)){var n=this.getDrawPaneById(t.id),r=!1;if(null!==n){var o=e;if(t.id!==Oa.CANDLE&&Et(t.height)&&t.height>0){var s=Math.max(null!==(a=t.minHeight)&&void 0!==a?a:n.getOptions().minHeight,0),l=Math.max(s,t.height);n.setBounding({height:l}),o=!0,r=!0}(Dt(null===(i=t.axisOptions)||void 0===i?void 0:i.name)||At(t.gap))&&(o=!0),n.setOptions(t),o&&this.adjustPaneViewport(r,!0,!0,!0,!0)}}},t.prototype.getDrawPaneById=function(t){if(t===Oa.CANDLE)return this._candlePane;if(t===Oa.X_AXIS)return this._xAxisPane;var e=this._drawPanes.find(function(e){return e.getId()===t});return null!==e&&void 0!==e?e:null},t.prototype.getContainer=function(){return this._container},t.prototype.getChartStore=function(){return this._chartStore},t.prototype.getXAxisPane=function(){return this._xAxisPane},t.prototype.getAllDrawPanes=function(){return this._drawPanes},t.prototype.getAllSeparatorPanes=function(){return this._separatorPanes},t.prototype.adjustPaneViewport=function(t,e,a,i,n){t&&this._measurePaneHeight();var r=e,o=null!==i&&void 0!==i&&i,s=null!==n&&void 0!==n&&n;(o||s)&&this._drawPanes.forEach(function(t){var e=t.getAxisComponent().buildTicks(s);r||(r=e)}),r&&this._measurePaneWidth(),null!==a&&void 0!==a&&a&&(this._xAxisPane.getAxisComponent().buildTicks(!0),this.updatePane(4))},t.prototype.updatePane=function(t,e){if(At(e)){var a=this.getDrawPaneById(e);null===a||void 0===a||a.update(t)}else this._separatorPanes.forEach(function(e){e.update(t)}),this._drawPanes.forEach(function(e){e.update(t)})},t.prototype.crosshairChange=function(t){var e=this,a=this._chartStore.getActionStore();if(a.has(Mt.OnCrosshairChange)){var i={};this._drawPanes.forEach(function(a){var n=a.getId(),r={},o=e._chartStore.getIndicatorStore().getInstances(n);o.forEach(function(e){var a,i=e.result;r[e.name]=i[null!==(a=t.dataIndex)&&void 0!==a?a:i.length-1]}),i[n]=r}),Dt(t.paneId)&&a.execute(Mt.OnCrosshairChange,X(X({},t),{indicatorData:i}))}},t.prototype.getDom=function(t,e){var a,i;if(!Dt(t))return this._chartContainer;var n=this.getDrawPaneById(t);if(null!==n){var r=null!==e&&void 0!==e?e:bn.Root;switch(r){case bn.Root:return n.getContainer();case bn.Main:return n.getMainWidget().getContainer();case bn.YAxis:return null!==(i=null===(a=n.getYAxisWidget())||void 0===a?void 0:a.getContainer())&&void 0!==i?i:null}}return null},t.prototype.getSize=function(t,e){var a,i;if(!At(t))return{width:Math.floor(this._chartContainer.clientWidth),height:Math.floor(this._chartContainer.clientHeight),left:0,top:0,right:0,bottom:0};var n=this.getDrawPaneById(t);if(null!==n){var r=null!==e&&void 0!==e?e:bn.Root;switch(r){case bn.Root:return n.getBounding();case bn.Main:return n.getMainWidget().getBounding();case bn.YAxis:return null!==(i=null===(a=n.getYAxisWidget())||void 0===a?void 0:a.getBounding())&&void 0!==i?i:null}}return null},t.prototype.setStyles=function(t){var e,a,i;this._chartStore.setOptions({styles:t}),i=Dt(t)?qa(t):t,At(null===(e=null===i||void 0===i?void 0:i.yAxis)||void 0===e?void 0:e.type)&&(null===(a=this._candlePane)||void 0===a||a.getAxisComponent().setAutoCalcTickFlag(!0)),this.adjustPaneViewport(!0,!0,!0,!0,!0)},t.prototype.getStyles=function(){return this._chartStore.getStyles()},t.prototype.setLocale=function(t){this._chartStore.setOptions({locale:t}),this.adjustPaneViewport(!0,!0,!0,!0,!0)},t.prototype.getLocale=function(){return this._chartStore.getLocale()},t.prototype.setCustomApi=function(t){this._chartStore.setOptions({customApi:t}),this.adjustPaneViewport(!0,!0,!0,!0,!0)},t.prototype.setPriceVolumePrecision=function(t,e){this._chartStore.setPrecision({price:t,volume:e})},t.prototype.getPriceVolumePrecision=function(){return this._chartStore.getPrecision()},t.prototype.setTimezone=function(t){this._chartStore.setOptions({timezone:t}),this._xAxisPane.getAxisComponent().buildTicks(!0),this._xAxisPane.update(3)},t.prototype.getTimezone=function(){return this._chartStore.getTimeScaleStore().getTimezone()},t.prototype.setOffsetRightDistance=function(t){this._chartStore.getTimeScaleStore().setOffsetRightDistance(t,!0)},t.prototype.getOffsetRightDistance=function(){return this._chartStore.getTimeScaleStore().getOffsetRightDistance()},t.prototype.setMaxOffsetLeftDistance=function(t){t<0?bt("setMaxOffsetLeftDistance","distance","distance must greater than zero!!!"):this._chartStore.getTimeScaleStore().setMaxOffsetLeftDistance(t)},t.prototype.setMaxOffsetRightDistance=function(t){t<0?bt("setMaxOffsetRightDistance","distance","distance must greater than zero!!!"):this._chartStore.getTimeScaleStore().setMaxOffsetRightDistance(t)},t.prototype.setLeftMinVisibleBarCount=function(t){t<0?bt("setLeftMinVisibleBarCount","barCount","barCount must greater than zero!!!"):this._chartStore.getTimeScaleStore().setLeftMinVisibleBarCount(Math.ceil(t))},t.prototype.setRightMinVisibleBarCount=function(t){t<0?bt("setRightMinVisibleBarCount","barCount","barCount must greater than zero!!!"):this._chartStore.getTimeScaleStore().setRightMinVisibleBarCount(Math.ceil(t))},t.prototype.setBarSpace=function(t){this._chartStore.getTimeScaleStore().setBarSpace(t)},t.prototype.getBarSpace=function(){return this._chartStore.getTimeScaleStore().getBarSpace().bar},t.prototype.getVisibleRange=function(){return this._chartStore.getTimeScaleStore().getVisibleRange()},t.prototype.clearData=function(){this._chartStore.clear()},t.prototype.getDataList=function(){return this._chartStore.getDataList()},t.prototype.applyNewData=function(t,e,a){At(a)&&bt("applyNewData","","param `callback` has been deprecated since version 9.8.0, use `subscribeAction('onDataReady')` instead."),this._chartStore.addData(t,Yt.Init,e).then(function(){}).catch(function(){}).finally(function(){null===a||void 0===a||a()})},t.prototype.applyMoreData=function(t,e,a){bt("","","Api `applyMoreData` has been deprecated since version 9.8.0."),this._chartStore.addData(t,Yt.Forward,null===e||void 0===e||e).then(function(){}).catch(function(){}).finally(function(){null===a||void 0===a||a()})},t.prototype.updateData=function(t,e){At(e)&&bt("updateData","","param `callback` has been deprecated since version 9.8.0, use `subscribeAction('onDataReady')` instead."),this._chartStore.addData(t).then(function(){}).catch(function(){}).finally(function(){null===e||void 0===e||e()})},t.prototype.loadMore=function(t){bt("","","Api `loadMore` has been deprecated since version 9.8.0, use `setLoadDataCallback` instead."),this._chartStore.setLoadMoreCallback(t)},t.prototype.setLoadDataCallback=function(t){this._chartStore.setLoadDataCallback(t)},t.prototype.createIndicator=function(t,e,a,i){var n,r=this,o=Dt(t)?{name:t}:t;if(null===ra(o.name))return bt("createIndicator","value","indicator not supported, you may need to use registerIndicator to add one!!!"),null;var s=null===a||void 0===a?void 0:a.id,l=this.getDrawPaneById(null!==s&&void 0!==s?s:"");if(null!==l)this._chartStore.getIndicatorStore().addInstance(o,null!==s&&void 0!==s?s:"",null!==e&&void 0!==e&&e).then(function(t){var e;r._setPaneOptions(null!==a&&void 0!==a?a:{},null!==(e=l.getAxisComponent().buildTicks(!0))&&void 0!==e&&e)}).catch(function(t){});else{null!==s&&void 0!==s||(s=de(Oa.INDICATOR));var c=this._createPane(an,s,null!==a&&void 0!==a?a:{}),u=null!==(n=null===a||void 0===a?void 0:a.height)&&void 0!==n?n:Va;c.setBounding({height:u}),this._chartStore.getIndicatorStore().addInstance(o,s,null!==e&&void 0!==e&&e).finally(function(){r.adjustPaneViewport(!0,!0,!0,!0,!0),null===i||void 0===i||i()})}return null!==s&&void 0!==s?s:null},t.prototype.overrideIndicator=function(t,e,a){var i=this;this._chartStore.getIndicatorStore().override(t,null!==e&&void 0!==e?e:null).then(function(t){var e=G(t,2),n=e[0],r=e[1];(n||r)&&(i.adjustPaneViewport(!1,r,!0,r),null===a||void 0===a||a())}).catch(function(){})},t.prototype.getIndicatorByPaneId=function(t,e){return this._chartStore.getIndicatorStore().getInstanceByPaneId(t,e)},t.prototype.removeIndicator=function(t,e){var a,i,n,r=this._chartStore.getIndicatorStore(),o=r.removeInstance(t,e);if(o){var s=!1;if(t!==Oa.CANDLE&&!r.hasInstances(t)){var l=this.getDrawPaneById(t),c=this._drawPanes.findIndex(function(e){return e.getId()===t});if(null!==l){s=!0;var u=this._separatorPanes.get(l);if(At(u)){var d=null===u||void 0===u?void 0:u.getTopPane();try{for(var h=j(this._separatorPanes),p=h.next();!p.done;p=h.next()){var v=p.value;if(v[1].getTopPane().getId()===l.getId()){v[1].setTopPane(d);break}}}catch(g){a={error:g}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(a)throw a.error}}u.destroy(),this._separatorPanes.delete(l)}this._drawPanes.splice(c,1),l.destroy();var f=this._drawPanes[0];At(f)&&f.getId()===Oa.X_AXIS&&(f=this._drawPanes[1]),null===(n=this._separatorPanes.get(f))||void 0===n||n.destroy(),this._separatorPanes.delete(f)}}this.adjustPaneViewport(s,!0,!0,!0,!0)}},t.prototype.createOverlay=function(t,e){var a=[];if(Dt(t))a=[{name:t}];else if(kt(t))a=t.map(function(t){return Dt(t)?{name:t}:t});else{var i=t;a=[i]}var n=!0;At(e)&&null!==this.getDrawPaneById(e)||(e=Oa.CANDLE,n=!1);var r=this._chartStore.getOverlayStore().addInstances(a,e,n);return kt(t)?r:r[0]},t.prototype.getOverlayById=function(t){return this._chartStore.getOverlayStore().getInstanceById(t)},t.prototype.overrideOverlay=function(t){this._chartStore.getOverlayStore().override(t)},t.prototype.removeOverlay=function(t){var e;At(t)&&(e=Dt(t)?{id:t}:t),this._chartStore.getOverlayStore().removeInstance(e)},t.prototype.setPaneOptions=function(t){this._setPaneOptions(t,!1)},t.prototype.setZoomEnabled=function(t){this._chartStore.getTimeScaleStore().setZoomEnabled(t)},t.prototype.isZoomEnabled=function(){return this._chartStore.getTimeScaleStore().getZoomEnabled()},t.prototype.setScrollEnabled=function(t){this._chartStore.getTimeScaleStore().setScrollEnabled(t)},t.prototype.isScrollEnabled=function(){return this._chartStore.getTimeScaleStore().getScrollEnabled()},t.prototype.scrollByDistance=function(t,e){var a=Et(e)&&e>0?e:0,i=this._chartStore.getTimeScaleStore();if(i.startScroll(),a>0){var n=new le({duration:a});n.doFrame(function(e){var n=t*(e/a);i.scroll(n)}),n.start()}else i.scroll(t)},t.prototype.scrollToRealTime=function(t){var e=this._chartStore.getTimeScaleStore(),a=e.getBarSpace().bar,i=e.getLastBarRightSideDiffBarCount()-e.getInitialOffsetRightDistance()/a,n=i*a;this.scrollByDistance(n,t)},t.prototype.scrollToDataIndex=function(t,e){var a=this._chartStore.getTimeScaleStore(),i=(a.getLastBarRightSideDiffBarCount()+(this.getDataList().length-1-t))*a.getBarSpace().bar;this.scrollByDistance(i,e)},t.prototype.scrollToTimestamp=function(t,e){var a=pe(this.getDataList(),"timestamp",t);this.scrollToDataIndex(a,e)},t.prototype.zoomAtCoordinate=function(t,e,a){var i=Et(a)&&a>0?a:0,n=this._chartStore.getTimeScaleStore(),r=n.getBarSpace().bar,o=r*t,s=o-r;if(i>0){var l=0,c=new le({duration:i});c.doFrame(function(t){var a=s*(t/i),r=(a-l)/n.getBarSpace().bar*Ce;n.zoom(r,e),l=a}),c.start()}else n.zoom(s/r*Ce,e)},t.prototype.zoomAtDataIndex=function(t,e,a){var i=this._chartStore.getTimeScaleStore().dataIndexToCoordinate(e);this.zoomAtCoordinate(t,{x:i,y:0},a)},t.prototype.zoomAtTimestamp=function(t,e,a){var i=pe(this.getDataList(),"timestamp",e);this.zoomAtDataIndex(t,i,a)},t.prototype.convertToPixel=function(t,e){var a,i=e.paneId,n=void 0===i?Oa.CANDLE:i,r=e.absolute,o=void 0!==r&&r,s=[];if(n!==Oa.X_AXIS){var l=this.getDrawPaneById(n);if(null!==l){var c=this._chartStore.getTimeScaleStore(),u=l.getBounding(),d=(new Array).concat(t),h=this._xAxisPane.getAxisComponent(),p=l.getAxisComponent();s=d.map(function(t){var e={},a=t.dataIndex;if(Et(t.timestamp)&&(a=c.timestampToDataIndex(t.timestamp)),Et(a)&&(e.x=null===h||void 0===h?void 0:h.convertToPixel(a)),Et(t.value)){var i=null===p||void 0===p?void 0:p.convertToPixel(t.value);e.y=o?u.top+i:i}return e})}}return kt(t)?s:null!==(a=s[0])&&void 0!==a?a:{}},t.prototype.convertFromPixel=function(t,e){var a,i=e.paneId,n=void 0===i?Oa.CANDLE:i,r=e.absolute,o=void 0!==r&&r,s=[];if(n!==Oa.X_AXIS){var l=this.getDrawPaneById(n);if(null!==l){var c=this._chartStore.getTimeScaleStore(),u=l.getBounding(),d=(new Array).concat(t),h=this._xAxisPane.getAxisComponent(),p=l.getAxisComponent();s=d.map(function(t){var e,a,i={};if(Et(t.x)){var n=null!==(e=null===h||void 0===h?void 0:h.convertFromPixel(t.x))&&void 0!==e?e:-1;i.dataIndex=n,i.timestamp=null!==(a=c.dataIndexToTimestamp(n))&&void 0!==a?a:void 0}if(Et(t.y)){var r=o?t.y-u.top:t.y;i.value=p.convertFromPixel(r)}return i})}}return kt(t)?s:null!==(a=s[0])&&void 0!==a?a:{}},t.prototype.executeAction=function(t,e){var a;switch(t){case Mt.OnCrosshairChange:var i=X({},e);i.paneId=null!==(a=i.paneId)&&void 0!==a?a:Oa.CANDLE,this._chartStore.getTooltipStore().setCrosshair(i,{notExecuteAction:!0});break}},t.prototype.subscribeAction=function(t,e){this._chartStore.getActionStore().subscribe(t,e)},t.prototype.unsubscribeAction=function(t,e){this._chartStore.getActionStore().unsubscribe(t,e)},t.prototype.getConvertPictureUrl=function(t,e,a){var i=this,n=this._chartContainer.clientWidth,r=this._chartContainer.clientHeight,o=he("canvas",{width:"".concat(n,"px"),height:"".concat(r,"px"),boxSizing:"border-box"}),s=o.getContext("2d"),l=Ot(o);o.width=n*l,o.height=r*l,s.scale(l,l),s.fillStyle=null!==a&&void 0!==a?a:"#FFFFFF",s.fillRect(0,0,n,r);var c=null!==t&&void 0!==t&&t;return this._drawPanes.forEach(function(t){var e=i._separatorPanes.get(t);if(At(e)){var a=e.getBounding();s.drawImage(e.getImage(c),a.left,a.top,a.width,a.height)}var r=t.getBounding();s.drawImage(t.getImage(c),0,r.top,n,r.height)}),o.toDataURL("image/".concat(null!==e&&void 0!==e?e:"jpeg"))},t.prototype.resize=function(){this.adjustPaneViewport(!0,!0,!0,!0,!0)},t.prototype.destroy=function(){this._chartEvent.destroy(),this._drawPanes.forEach(function(t){t.destroy()}),this._drawPanes=[],this._separatorPanes.forEach(function(t){t.destroy()}),this._separatorPanes.clear(),this._container.removeChild(this._chartContainer)},t}(),kn=new Map,Cn=1;function In(t,e){var a;if(xt(),a=Dt(t)?document.getElementById(t):t,null===a)return _t("","","The chart cannot be initialized correctly. Please check the parameters. The chart container cannot be null and child elements need to be added!!!"),null;var i=kn.get(a.id);if(At(i))return bt("","","The chart has been initialized on the dom!!!"),i;var n="k_line_chart_".concat(Cn++);return i=new Sn(a,e),i.id=n,a.setAttribute("k-line-chart-id",n),kn.set(n,i),i}var En=a(21396),An=a.n(En);function Pn(t,e,a,i){if(!t||!e||!a||!i)return t;try{var n=An().enc.Base64.parse(t),r=An().lib.WordArray.create(n.words.slice(0,4)),o=An().lib.WordArray.create(n.words.slice(4)),s=An().enc.Base64.parse(i),l=An().AES.decrypt({ciphertext:o},s,{iv:r,mode:An().mode.CBC,padding:An().pad.Pkcs7}),c=l.toString(An().enc.Utf8);return c||t}catch(u){return t}}function Dn(t,e){return Tn.apply(this,arguments)}function Tn(){return Tn=(0,c.A)((0,l.A)().m(function t(e,a){var i,n;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e&&a){t.n=1;break}throw new Error("用户ID和指标ID不能为空");case 1:return t.p=1,t.n=2,(0,v.Ay)({url:"/api/indicator/getDecryptKey",method:"post",data:{userid:e,indicatorId:a}});case 2:if(i=t.v,1!==i.code||!i.data||!i.data.key){t.n=3;break}return t.a(2,i.data.key);case 3:throw new Error(i.msg||"获取解密密钥失败");case 4:t.n=6;break;case 5:throw t.p=5,n=t.v,new Error("无法获取解密密钥,请检查网络连接或联系管理员: "+(n.message||"未知错误"));case 6:return t.a(2)}},t,null,[[1,5]])})),Tn.apply(this,arguments)}function Mn(t,e,a){return Rn.apply(this,arguments)}function Rn(){return Rn=(0,c.A)((0,l.A)().m(function t(e,a,i){var n;return(0,l.A)().w(function(t){while(1)switch(t.n){case 0:return t.n=1,Dn(a,i);case 1:return n=t.v,t.a(2,Pn(e,a,i,n))}},t)})),Rn.apply(this,arguments)}function Fn(t,e){if(1===e||!0===e)return!0;if(t&&t.length>100)try{var a=atob(t);if(a.length>50)return!0}catch(i){}return!1}var Bn={name:"KlineChart",props:{symbol:{type:String,default:""},market:{type:String,default:""},timeframe:{type:String,default:"1H"},theme:{type:String,default:"light"},activeIndicators:{type:Array,default:function(){return[]}},realtimeEnabled:{type:Boolean,default:!1},userId:{type:Number,default:null}},emits:["retry","price-change","load","indicator-toggle"],setup:function(t,e){var a=e.emit,i=(0,h.IJ)([]),n=(0,h.KR)(!1),r=(0,h.KR)(null),s=(0,h.KR)(!1),u=(0,h.KR)(!0),p=null,f=(0,h.KR)(!1),g=(0,h.IJ)(null),m=(0,h.KR)(t.theme||"light"),y=(0,h.KR)(null),_=(0,h.KR)(5e3),x=(0,h.KR)(!1),w=(0,h.KR)(1e4),S=(0,h.KR)(0),k=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(g.value){var e=Date.now(),a=Number(w.value||1e4);(t||!S.value||e-S.value>=a)&&(S.value=e,xt())}},C=(0,h.KR)([]),I=(0,h.KR)([]),E=(0,h.KR)([]),A=(0,h.KR)(null),P=(0,h.nI)(),D=P.proxy,T=(0,h.EW)(function(){return[{name:"line",title:D.$t("dashboard.indicator.drawing.line"),icon:"line"},{name:"horizontalLine",title:D.$t("dashboard.indicator.drawing.horizontalLine"),icon:"minus"},{name:"verticalLine",title:D.$t("dashboard.indicator.drawing.verticalLine"),icon:"column-width"},{name:"ray",title:D.$t("dashboard.indicator.drawing.ray"),icon:"arrow-right"},{name:"straightLine",title:D.$t("dashboard.indicator.drawing.straightLine"),icon:"menu"},{name:"parallelStraightLine",title:D.$t("dashboard.indicator.drawing.parallelLine"),icon:"menu"},{name:"priceLine",title:D.$t("dashboard.indicator.drawing.priceLine"),icon:"dollar"},{name:"priceChannelLine",title:D.$t("dashboard.indicator.drawing.priceChannel"),icon:"border"},{name:"fibonacciLine",title:D.$t("dashboard.indicator.drawing.fibonacciLine"),icon:"rise"},{name:"measure",title:D.$t("dashboard.indicator.drawing.measure"),icon:"drag"}]}),B=(0,h.KR)([{id:"sma",name:"SMA (简单移动平均)",shortName:"SMA",type:"line",defaultParams:{length:20}},{id:"ema",name:"EMA (指数移动平均)",shortName:"EMA",type:"line",defaultParams:{length:20}},{id:"rsi",name:"RSI (相对强弱)",shortName:"RSI",type:"line",defaultParams:{length:14}},{id:"macd",name:"MACD",shortName:"MACD",type:"macd",defaultParams:{fast:12,slow:26,signal:9}},{id:"bb",name:"布林带 (Bollinger Bands)",shortName:"BB",type:"band",defaultParams:{length:20,mult:2}},{id:"atr",name:"ATR (平均真实波幅)",shortName:"ATR",type:"line",defaultParams:{period:14}},{id:"cci",name:"CCI (商品通道指数)",shortName:"CCI",type:"line",defaultParams:{length:20}},{id:"williams",name:"Williams %R (威廉指标)",shortName:"W%R",type:"line",defaultParams:{length:14}},{id:"mfi",name:"MFI (资金流量指标)",shortName:"MFI",type:"line",defaultParams:{length:14}},{id:"adx",name:"ADX (平均趋向指数)",shortName:"ADX",type:"adx",defaultParams:{length:14}},{id:"obv",name:"OBV (能量潮)",shortName:"OBV",type:"line",defaultParams:{}},{id:"adosc",name:"ADOSC (积累/派发振荡器)",shortName:"ADOSC",type:"line",defaultParams:{fast:3,slow:10}},{id:"ad",name:"AD (积累/派发线)",shortName:"AD",type:"line",defaultParams:{}},{id:"kdj",name:"KDJ (随机指标)",shortName:"KDJ",type:"line",defaultParams:{period:9,k:3,d:3}}]),L=function(e){return t.activeIndicators.some(function(t){return t.id===e})},N=function(t){if(g.value){var e={line:"segment",horizontalLine:"horizontalStraightLine",verticalLine:"verticalStraightLine",ray:"rayLine",straightLine:"straightLine",parallelStraightLine:"parallelStraightLine",priceLine:"priceLine",priceChannelLine:"priceChannelLine",fibonacciLine:"fibonacciLine",measure:"priceRangeMeasure"},a=e[t]||t;if(A.value!==t){A.value=t;try{var i=["priceRangeMeasure"];if(i.includes(a)){if("function"!==typeof g.value.overrideOverlay)return void(A.value=null);g.value.overrideOverlay({name:a,lock:!1})}else{var n={name:a,lock:!1,extendData:{isDrawing:!0}},r=g.value.createOverlay(n);r?E.value.push(r):A.value=null}}catch(o){A.value=null}}else{A.value=null;try{"function"===typeof g.value.overrideOverlay&&g.value.overrideOverlay(null)}catch(s){}}}},$=function(){if(g.value)try{E.value.forEach(function(t){try{"function"===typeof g.value.removeOverlay?g.value.removeOverlay(t):"function"===typeof g.value.removeOverlayById&&g.value.removeOverlayById(t)}catch(e){}}),E.value=[],A.value=null,"function"===typeof g.value.overrideOverlay&&g.value.overrideOverlay(null)}catch(t){}},z=function(t){var e=L(t.id);if(e)a("indicator-toggle",{action:"remove",indicator:{id:t.id}});else{var i=(0,d.A)((0,d.A)({},t),{},{params:(0,d.A)({},t.defaultParams),calculate:null});a("indicator-toggle",{action:"add",indicator:i})}},V=(0,h.KR)(null),O=(0,h.KR)(!1),W=(0,h.KR)(!1),H=(0,h.KR)(!1),Y=(0,h.EW)(function(){return"dark"===m.value?{backgroundColor:"#141414",textColor:"#d1d4dc",textColorSecondary:"#787b86",borderColor:"#2a2a2a",gridLineColor:"#252525",gridLineColorDashed:"#363c4e",tooltipBg:"rgba(25, 27, 32, 0.95)",tooltipBorder:"#333",tooltipText:"#ccc",tooltipTextSecondary:"#888",axisLabelColor:"#787b86",splitAreaColor:["rgba(250,250,250,0.05)","rgba(200,200,200,0.02)"],dataZoomBorder:"#2a2a2a",dataZoomFiller:"rgba(41, 98, 255, 0.15)",dataZoomHandle:"#13c2c2",dataZoomText:"transparent",dataZoomBg:"#252525"}:{backgroundColor:"#fff",textColor:"#333",textColorSecondary:"#666",borderColor:"#e8e8e8",gridLineColor:"#e8e8e8",gridLineColorDashed:"#e8e8e8",tooltipBg:"rgba(255, 255, 255, 0.95)",tooltipBorder:"#e8e8e8",tooltipText:"#333",tooltipTextSecondary:"#666",axisLabelColor:"#666",splitAreaColor:["rgba(250,250,250,0.05)","rgba(200,200,200,0.02)"],dataZoomBorder:"#e8e8e8",dataZoomFiller:"rgba(24, 144, 255, 0.15)",dataZoomHandle:"#1890ff",dataZoomText:"#999",dataZoomBg:"#f0f2f5"}}),K=function(t){return"dark"===m.value?["#13c2c2","#e040fb","#ffeb3b","#00e676","#ff6d00","#9c27b0"][t%6]:["#13c2c2","#9c27b0","#f57c00","#1976d2","#c2185b","#7b1fa2"][t%6]},X=function(){return new Promise(function(t,e){if(window.pyodide)return V.value=window.pyodide,W.value=!0,void t(window.pyodide);O.value=!0;var a="0.25.0",i=function(t){return t&&t.endsWith("/")?t:t?t+"/":t},n="/assets/pyodide/v".concat(a,"/full/"),r="https://cdn.jsdelivr.net/pyodide/v".concat(a,"/full/"),o=i({NODE_ENV:"production",VUE_APP_API_BASE_URL:"/api",VUE_APP_PREVIEW:"false",BASE_URL:"/"}.VUE_APP_PYODIDE_LOCAL_BASE||n),s=i({NODE_ENV:"production",VUE_APP_API_BASE_URL:"/api",VUE_APP_PREVIEW:"false",BASE_URL:"/"}.VUE_APP_PYODIDE_CDN_BASE||r),u=({NODE_ENV:"production",VUE_APP_API_BASE_URL:"/api",VUE_APP_PREVIEW:"false",BASE_URL:"/"}.VUE_APP_PYODIDE_PREFER_CDN||"").toString().toLowerCase(),d=!u||("true"===u||"1"===u||"yes"===u),h=function(t){return new Promise(function(e,a){var i=document.querySelector('script[data-pyodide-src="'.concat(t,'"]'));if(i)return"function"===typeof window.loadPyodide?e():(i.addEventListener("load",function(){return e()},{once:!0}),void i.addEventListener("error",function(){return a(new Error("Pyodide 脚本加载失败"))},{once:!0}));var n=document.createElement("script");n.dataset.pyodideSrc=t,n.src=t,n.onload=function(){return e()},n.onerror=function(){return a(new Error("Pyodide 脚本加载失败"))},document.head.appendChild(n)})},p=function(){var e=(0,c.A)((0,l.A)().m(function e(a){return(0,l.A)().w(function(e){while(1)switch(e.n){case 0:if("function"===typeof window.loadPyodide){e.n=1;break}throw new Error("loadPyodide 函数未找到");case 1:return e.n=2,window.loadPyodide({indexURL:a});case 2:return window.pyodide=e.v,e.n=3,window.pyodide.loadPackage(["pandas","numpy"]);case 3:V.value=window.pyodide,W.value=!0,O.value=!1,t(window.pyodide);case 4:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}();(0,c.A)((0,l.A)().m(function t(){var e,a,i;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e=function(){var t=(0,c.A)((0,l.A)().m(function t(e){return(0,l.A)().w(function(t){while(1)switch(t.n){case 0:return t.n=1,h(e+"pyodide.js");case 1:return t.n=2,p(e);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),t.p=1,!d){t.n=3;break}return t.n=2,e(s);case 2:t.n=4;break;case 3:return t.n=4,e(o);case 4:t.n=9;break;case 5:return t.p=5,a=t.v,t.p=6,t.n=7,e(d?o:s);case 7:t.n=9;break;case 8:throw t.p=8,i=t.v,i||a;case 9:return t.a(2)}},t,null,[[6,8],[1,5]])}))().catch(function(t){O.value=!1,H.value=!0,e(t)})})},q=function(t){if(!t||"string"!==typeof t)return null;try{var e={},a=t.match(/(\w+)\s*=\s*(\d+\.?\d*)/g);return a&&a.forEach(function(t){var a=t.split("=");if(2===a.length){var i=a[0].trim(),n=parseFloat(a[1].trim());isNaN(n)||(e[i]=n)}}),{params:e,plots:[],success:!0}}catch(i){return{params:{},plots:[],success:!1}}},U=function(){var e=(0,c.A)((0,l.A)().m(function e(a,i){var n,r,s,c,u,d,h,p,v,f,g,m,y,b,_,x,w,S,k=arguments;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(n=k.length>2&&void 0!==k[2]?k[2]:{},r=k.length>3&&void 0!==k[3]?k[3]:{},W.value&&V.value){e.n=5;break}if(!O.value){e.n=4;break}s=0;case 1:if(!(O.value&&s<30)){e.n=4;break}return e.n=2,new Promise(function(t){return setTimeout(t,500)});case 2:if(s++,!W.value||!V.value){e.n=3;break}return e.a(3,4);case 3:e.n=1;break;case 4:if(W.value&&V.value){e.n=5;break}throw O.value?(O.value=!1,H.value=!0):H.value=!0,new Error("Python 引擎未就绪,请等待加载完成");case 5:if(e.p=5,c=a,u=r.is_encrypted||r.isEncrypted||0,!u&&!Fn(a,u)){e.n=11;break}if(d=r.user_id||r.userId||t.userId||n.userId,h=r.originalId||r.id||n.indicatorId,!d||!h){e.n=10;break}return e.p=6,e.n=7,Mn(c,d,h);case 7:c=e.v,e.n=9;break;case 8:throw e.p=8,x=e.v,new Error("代码解密失败,无法执行指标: "+(x.message||"未知错误"));case 9:e.n=11;break;case 10:throw new Error("缺少必要的解密参数(用户ID或指标ID),无法执行加密指标");case 11:return p=i.map(function(t){var e=t.timestamp||t.time;return e<1e10&&(e*=1e3),{time:Math.floor(e/1e3),open:parseFloat(t.open)||0,high:parseFloat(t.high)||0,low:parseFloat(t.low)||0,close:parseFloat(t.close)||0,volume:parseFloat(t.volume)||0}}),v=JSON.stringify(p),f=JSON.stringify(n||{}),g=v.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),m=f.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),y="\nimport json\nimport pandas as pd\nimport numpy as np\n\n# 递归清理 NaN 值的函数\ndef clean_nan(obj):\n if isinstance(obj, dict):\n return {k: clean_nan(v) for k, v in obj.items()}\n elif isinstance(obj, list):\n return [clean_nan(item) for item in obj]\n elif isinstance(obj, (pd.Series, np.ndarray)):\n return [None if (isinstance(x, float) and (np.isnan(x) or np.isinf(x))) else x for x in obj]\n elif isinstance(obj, (float, np.floating)):\n if np.isnan(obj) or np.isinf(obj):\n return None\n return float(obj)\n elif pd.isna(obj):\n return None\n else:\n return obj\n\n# 接收 JSON 数据\nraw_data = json.loads('".concat(g,"')\nparams = json.loads('").concat(m,"')\n\n# 将前端参数注入为指标代码可直接使用的变量(对齐回测/实盘执行环境)\n# 兼容多种命名(snake_case / camelCase\ndef _get_param(key, default=None):\n if key in params:\n return params.get(key, default)\n # camelCase fallback\n camel = ''.join([key.split('_')[0]] + [p.capitalize() for p in key.split('_')[1:]])\n return params.get(camel, default)\n\ntry:\n leverage = float(_get_param('leverage', 1) or 1)\nexcept Exception:\n leverage = 1\n\ntrade_direction = _get_param('trade_direction', _get_param('tradeDirection', 'both')) or 'both'\n\ntry:\n initial_position = int(_get_param('initial_position', 0) or 0)\nexcept Exception:\n initial_position = 0\n\ntry:\n initial_avg_entry_price = float(_get_param('initial_avg_entry_price', 0.0) or 0.0)\nexcept Exception:\n initial_avg_entry_price = 0.0\n\ntry:\n initial_position_count = int(_get_param('initial_position_count', 0) or 0)\nexcept Exception:\n initial_position_count = 0\n\ntry:\n initial_last_add_price = float(_get_param('initial_last_add_price', 0.0) or 0.0)\nexcept Exception:\n initial_last_add_price = 0.0\n\ntry:\n initial_highest_price = float(_get_param('initial_highest_price', 0.0) or 0.0)\nexcept Exception:\n initial_highest_price = 0.0\n\n# 转换为 DataFrame\ndf = pd.DataFrame(raw_data)\n\n# 转换数据类型\ndf['open'] = df['open'].astype(float)\ndf['high'] = df['high'].astype(float)\ndf['low'] = df['low'].astype(float)\ndf['close'] = df['close'].astype(float)\ndf['volume'] = df['volume'].astype(float)\n\n# 用户代码(已解密)\n").concat(c,"\n\n# 构造输出(如果用户没有定义 output,则尝试从 result_json 获取)\nif 'output' not in locals():\n if 'result_json' in locals():\n output = json.loads(result_json)\n else:\n output = {\"plots\": []}\nelse:\n # 确保 output 是字典格式\n if isinstance(output, str):\n output = json.loads(output)\n\n# 清理 output 中的所有 NaN 值\noutput = clean_nan(output)\n\n# 返回 JSON 字符串\njson.dumps(output)\n"),e.n=12,V.value.runPythonAsync(y);case 12:if(b=e.v,b&&"string"===typeof b){e.n=13;break}throw new Error("Python 代码执行后未返回有效的 JSON 字符串,返回类型: ".concat((0,o.A)(b)));case 13:e.p=13,_=JSON.parse(b),e.n=15;break;case 14:throw e.p=14,w=e.v,new Error("JSON 解析失败: ".concat(w.message,"。可能是数据中包含 NaN 或其他无效值。"));case 15:if(_){e.n=16;break}return e.a(2,{plots:[],signals:[],calculatedVars:{}});case 16:return _.plots&&Array.isArray(_.plots)||(_.plots=[]),_.plots=_.plots.map(function(t){return t.data&&Array.isArray(t.data)&&(t.data=t.data.map(function(t){return null===t||void 0===t||"number"===typeof t&&isNaN(t)?null:t})),t}),_.signals&&Array.isArray(_.signals)&&(_.signals=_.signals.map(function(t){return t.data&&Array.isArray(t.data)&&(t.data=t.data.map(function(t){return null===t||void 0===t||"number"===typeof t&&isNaN(t)?null:t})),t})),_.calculatedVars||(_.calculatedVars={}),e.a(2,_);case 17:throw e.p=17,S=e.v,new Error("Python 执行失败: ".concat(S.message));case 18:return e.a(2)}},e,null,[[13,14],[6,8],[5,17]])}));return function(t,a){return e.apply(this,arguments)}}();function j(t,e){for(var a=[],i=0;i<t.length;i++)if(i<e-1)a.push(null);else{for(var n=0,r=i-e+1;r<=i;r++)n+=t[r].close;a.push(n/e)}return a}function G(t,e){for(var a=[],i=2/(e+1),n=null,r=0;r<t.length;r++)n=0===r?t[r].close:(t[r].close-n)*i+n,a.push(n);return a}function Z(t,e,a){for(var i=[],n=0;n<t.length;n++)if(n<e-1)i.push(null);else{for(var r=0,o=n-e+1;o<=n;o++)r+=t[o].close;i.push(r/e)}for(var s=[],l=0;l<t.length;l++)if(l<e-1)s.push({upper:null,middle:null,lower:null});else{for(var c=0,u=l-e+1;u<=l;u++)c+=Math.pow(t[u].close-i[l],2);var d=Math.sqrt(c/e);s.push({upper:i[l]+a*d,middle:i[l],lower:i[l]-a*d})}return s}function J(t,e){for(var a=[],i=0;i<t.length;i++)if(0===i)a.push(t[i].high-t[i].low);else{var n=t[i].high-t[i].low,r=Math.abs(t[i].high-t[i-1].close),o=Math.abs(t[i].low-t[i-1].close);a.push(Math.max(n,r,o))}for(var s=[],l=0;l<t.length;l++)if(l<e-1)s.push(null);else{for(var c=0,u=l-e+1;u<=l;u++)c+=a[u];s.push(c/e)}return s}function Q(t,e){for(var a=[],i=function(){if(n<e-1)a.push(null);else{for(var i=[],r=n-e+1;r<=n;r++)i.push((t[r].high+t[r].low+t[r].close)/3);var o=i.reduce(function(t,e){return t+e},0)/e,s=i.reduce(function(t,e){return t+Math.abs(e-o)},0)/e,l=(t[n].high+t[n].low+t[n].close)/3,c=0===s?0:(l-o)/(.015*s);a.push(c)}},n=0;n<t.length;n++)i();return a}function tt(t,e){for(var a=[],i=0;i<t.length;i++)if(i<e-1)a.push(null);else{for(var n=-1/0,r=1/0,o=i-e+1;o<=i;o++)n=Math.max(n,t[o].high),r=Math.min(r,t[o].low);var s=n-r===0?-50:(n-t[i].close)/(n-r)*-100;a.push(s)}return a}function et(t,e){for(var a=[],i=0;i<t.length;i++)if(i<e)a.push(null);else{for(var n=0,r=0,o=i-e+1;o<=i;o++){var s=(t[o].high+t[o].low+t[o].close)/3,l=s*t[o].volume;if(o>i-e+1){var c=(t[o-1].high+t[o-1].low+t[o-1].close)/3;s>c?n+=l:s<c&&(r+=l)}}var u=0===r?100:n/r,d=100-100/(1+u);a.push(d)}return a}function at(t,e){for(var a=[],i=[],n=[],r=[],o=[],s=[],l=0;l<t.length;l++)if(0===l)r.push(t[l].high-t[l].low),o.push(0),s.push(0);else{var c=t[l].high-t[l].low,u=Math.abs(t[l].high-t[l-1].close),d=Math.abs(t[l].low-t[l-1].close);r.push(Math.max(c,u,d));var h=t[l].high-t[l-1].high,p=t[l-1].low-t[l].low;h>p&&h>0?o.push(h):o.push(0),p>h&&p>0?s.push(p):s.push(0)}for(var v=[],f=[],g=[],m=0;m<t.length;m++){if(m<e-1)v.push(null),f.push(null),g.push(null),a.push(null),i.push(null),n.push(null);else if(m===e-1){for(var y=0,b=0,_=0,x=0;x<=m;x++)y+=r[x],b+=o[x],_+=s[x];v.push(y),f.push(b),g.push(_)}else v.push(v[m-1]-v[m-1]/e+r[m]),f.push(f[m-1]-f[m-1]/e+o[m]),g.push(g[m-1]-g[m-1]/e+s[m]);if(m>=e-1){var w=v[m],S=f[m],k=g[m];if(0===w?(a.push(0),i.push(0)):(a.push(S/w*100),i.push(k/w*100)),m>=e-1){var C=a[m]+i[m],I=0===C?0:Math.abs(a[m]-i[m])/C*100;if(m===e-1)n.push(I);else if(m===e){var E=Math.abs(a[m-1]-i[m-1])/(a[m-1]+i[m-1])*100;n.push((E+I)/2)}else n.push((n[m-1]*(e-1)+I)/e)}}}return{adx:n,plusDI:a,minusDI:i}}function it(t){for(var e=[],a=0,i=0;i<t.length;i++)0===i?a=t[i].volume:t[i].close>t[i-1].close?a+=t[i].volume:t[i].close<t[i-1].close&&(a-=t[i].volume),e.push(a);return e}function nt(t){for(var e=[],a=0,i=0;i<t.length;i++){var n=t[i].high,r=t[i].low,o=t[i].close,s=t[i].volume;if(n!==r){var l=(o-r-(n-o))/(n-r);a+=l*s}e.push(a)}return e}function rt(t,e,a){for(var i=nt(t),n=[],r=[],o=[],s=2/(e+1),l=2/(a+1),c=i[0],u=i[0],d=0;d<i.length;d++)0===d?(n.push(i[0]),r.push(i[0]),o.push(0)):(c=(i[d]-c)*s+c,u=(i[d]-u)*l+u,n.push(c),r.push(u),o.push(c-u));return o}function ot(t,e,a,i){for(var n=[],r=[],o=[],s=0;s<t.length;s++)if(s<e-1)n.push(null),r.push(null),o.push(null);else{for(var l=-1/0,c=1/0,u=s-e+1;u<=s;u++)l=Math.max(l,t[u].high),c=Math.min(c,t[u].low);var d=l-c===0?50:(t[s].close-c)/(l-c)*100;null===n[s-1]?n.push(d):n.push((2*d+n[s-1]*(a-2))/a),null===r[s-1]?r.push(n[s]):r.push((2*n[s]+r[s-1]*(i-2))/i),o.push(3*n[s]-2*r[s])}return{k:n,d:r,j:o}}Na({name:"signalTag",totalStep:1,lock:!0,needDefaultPointFigure:!1,needDefaultXAxisFigure:!1,needDefaultYAxisFigure:!1,checkEventOn:function(){return!1},createPointFigures:function(t){var e,a,i,n=t.coordinates,r=t.overlay,o=r.extendData||{},s=o.text,l=(null===(e=r.extendData)||void 0===e?void 0:e.color)||"#555555";if(!n[0])return[];var c=n[0].x,u=n[0].y,d=n[1]?n[1].y:u,h=8,p=4,v=12,f=String(s||""),g=f.split("").reduce(function(t,e){return t+(e.charCodeAt(0)>255?12:7)},0),m=g+2*h,y=v+2*p,b=(null===(a=r.extendData)||void 0===a?void 0:a.side)||(null===(i=r.extendData)||void 0===i?void 0:i.type)||"buy",_="buy"===b,x=_?u:u-y,w=d,S=w,k=_?x:x+y;return[{type:"line",attrs:{coordinates:[{x:c,y:S},{x:c,y:k}]},styles:{style:"stroke",color:l,dashedValue:[2,2]},ignoreEvent:!0},{type:"circle",attrs:{x:c,y:w,r:4},styles:{style:"fill",color:l},ignoreEvent:!0},{type:"rect",attrs:{x:c-m/2,y:x,width:m,height:y,r:4},styles:{style:"fill",color:l,borderSize:0},ignoreEvent:!0},{type:"text",attrs:{x:c,y:x+y/2,text:f,align:"center",baseline:"middle"},styles:{color:"#ffffff",size:v,weight:"bold",backgroundColor:l,borderRadius:5},ignoreEvent:!0}]}}),Na({name:"priceRangeMeasure",totalStep:2,lock:!1,needDefaultPointFigure:!1,needDefaultXAxisFigure:!1,needDefaultYAxisFigure:!1,createPointFigures:function(t){var e=t.coordinates,a=t.overlay,i=t.ctx;if(!e[0]||!e[1])return[];var n=a.points[0],r=a.points[1];if(!n||!r)return[];var o=n.value,s=r.value,l=s-o,c=l/o*100,u=n.timestamp,d=r.timestamp,h=Math.abs(d-u),p="",v=Math.floor(h/864e5),f=Math.floor(h%864e5/36e5),g=Math.floor(h%36e5/6e4),m=Math.floor(h%6e4/1e3);p=v>0?"".concat(v,"天").concat(f>0?f+"小时":""):f>0?"".concat(f,"小时").concat(g>0?g+"分钟":""):g>0?"".concat(g,"分钟"):"".concat(m,"秒");var y=0;try{if(i&&i.chart){var b=i.chart.getData();if(b&&Array.isArray(b)&&b.length>0){var _=b.findIndex(function(t){return Math.abs(t.timestamp-u)<1e3}),x=b.findIndex(function(t){return Math.abs(t.timestamp-d)<1e3});_>=0&&x>=0&&(y=Math.abs(x-_))}}}catch(z){}var w=c>=0?"+".concat(c.toFixed(2),"%"):"".concat(c.toFixed(2),"%"),S=l>=0?"+".concat(l.toFixed(2)):"".concat(l.toFixed(2)),k="".concat(w," ").concat(S);y>0?(k+=" (".concat(y,"根"),p&&(k+=" / ".concat(p)),k+=")"):p&&(k+=" (".concat(p,")"));var C=l>=0,I=C?"#0ecb81":"#f6465d",E=C?"#0ecb81":"#f6465d",A=C?"rgba(14, 203, 129, 0.1)":"rgba(246, 70, 93, 0.1)",P=e[0].x,D=e[0].y,T=e[1].x,M=e[1].y,R=(P+T)/2,F=(D+M)/2,B=-20,L=12,N=7*k.length+16,$=L+8;return[{type:"line",attrs:{coordinates:[{x:P,y:D},{x:T,y:M}]},styles:{style:"stroke",color:I,size:2,dashedValue:[4,4]},ignoreEvent:!1},{type:"circle",attrs:{x:P,y:D,r:4},styles:{style:"fill",color:I},ignoreEvent:!1},{type:"circle",attrs:{x:T,y:M,r:4},styles:{style:"fill",color:I},ignoreEvent:!1},{type:"rect",attrs:{x:R-N/2,y:F+B-$/2,width:N,height:$,r:4},styles:{style:"fill",color:A,borderSize:1,borderColor:I},ignoreEvent:!1},{type:"text",attrs:{x:R,y:F+B,text:k,align:"center",baseline:"middle"},styles:{color:E,size:L,weight:"bold"},ignoreEvent:!1}]}});var st=function(t){return t.map(function(t){var e=t.time||t.timestamp;return"string"===typeof e&&(e=parseInt(e)),e<1e10&&(e*=1e3),{timestamp:e,open:parseFloat(t.open),high:parseFloat(t.high),low:parseFloat(t.low),close:parseFloat(t.close),volume:parseFloat(t.volume||0)}}).filter(function(t){return t.timestamp&&!isNaN(t.open)&&!isNaN(t.high)&&!isNaN(t.low)&&!isNaN(t.close)}).sort(function(t,e){return t.timestamp-e.timestamp})},lt=function(t){if(t.length>0){var e=t[t.length-1];if(t.length>1){var i=t[t.length-2],n=e.close.toFixed(2),r=(e.close-i.close)/i.close*100;a("price-change",{price:n,change:r})}else{var o=e.close.toFixed(2);a("price-change",{price:o,change:0})}}},ct=function(t){return t.map(function(t){return{time:Math.floor(t.timestamp/1e3),open:t.open,high:t.high,low:t.low,close:t.close,volume:t.volume}})},ut=function(t,e,a){var i=new Date(1e3*t),n=new Date(1e3*e);switch(a){case"1m":return i.getFullYear()===n.getFullYear()&&i.getMonth()===n.getMonth()&&i.getDate()===n.getDate()&&i.getHours()===n.getHours()&&i.getMinutes()===n.getMinutes();case"5m":return i.getFullYear()===n.getFullYear()&&i.getMonth()===n.getMonth()&&i.getDate()===n.getDate()&&i.getHours()===n.getHours()&&Math.floor(i.getMinutes()/5)===Math.floor(n.getMinutes()/5);case"15m":return i.getFullYear()===n.getFullYear()&&i.getMonth()===n.getMonth()&&i.getDate()===n.getDate()&&i.getHours()===n.getHours()&&Math.floor(i.getMinutes()/15)===Math.floor(n.getMinutes()/15);case"30m":return i.getFullYear()===n.getFullYear()&&i.getMonth()===n.getMonth()&&i.getDate()===n.getDate()&&i.getHours()===n.getHours()&&Math.floor(i.getMinutes()/30)===Math.floor(n.getMinutes()/30);case"1H":return i.getFullYear()===n.getFullYear()&&i.getMonth()===n.getMonth()&&i.getDate()===n.getDate()&&i.getHours()===n.getHours();case"4H":return i.getFullYear()===n.getFullYear()&&i.getMonth()===n.getMonth()&&i.getDate()===n.getDate()&&Math.floor(i.getHours()/4)===Math.floor(n.getHours()/4);case"1D":return i.getFullYear()===n.getFullYear()&&i.getMonth()===n.getMonth()&&i.getDate()===n.getDate();case"1W":var r=Math.floor((i.getTime()-new Date(i.getFullYear(),0,1).getTime())/6048e5),o=Math.floor((n.getTime()-new Date(n.getFullYear(),0,1).getTime())/6048e5);return i.getFullYear()===n.getFullYear()&&r===o;default:return t===e}},dt=function(){var e=(0,c.A)((0,l.A)().m(function e(){var a,o,s,c,d,p,f,m=arguments;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(a=m.length>0&&void 0!==m[0]&&m[0],t.symbol){e.n=1;break}return e.a(2);case 1:if(!n.value||a){e.n=2;break}return e.a(2);case 2:return n.value=!0,r.value=null,e.p=3,o=[],e.p=4,e.n=5,(0,v.Ay)({url:"/api/indicator/kline",method:"get",params:{market:t.market,symbol:t.symbol,timeframe:t.timeframe,limit:500}});case 5:if(s=e.v,1!==s.code||!s.data||!Array.isArray(s.data)){e.n=6;break}o=st(s.data),e.n=7;break;case 6:throw c=s.msg||"获取K线数据失败","tiingo_subscription"===s.hint&&(c=D.$t("dashboard.indicator.error.tiingoSubscription")||"Forex 1-minute data requires Tiingo paid subscription"),new Error(c);case 7:e.n=9;break;case 8:throw e.p=8,p=e.v,p;case 9:if(o&&0!==o.length){e.n=10;break}throw new Error("未获取到K线数据");case 10:i.value=o,u.value=!0,d=ct(o),lt(d),(0,h.dY)(function(){if(g.value){var e=i.value.filter(function(t){return t.timestamp&&!isNaN(t.open)&&!isNaN(t.high)&&!isNaN(t.low)&&!isNaN(t.close)});if(e.length>0&&g.value){try{g.value.applyNewData(e)}catch(a){g.value.applyNewData(e)}setTimeout(function(){g.value&&xt()},100)}}else mt();t.realtimeEnabled&&(gt(),ft())}),e.n=12;break;case 11:if(e.p=11,f=e.v,r.value=D.$t("dashboard.indicator.error.loadDataFailed")+": "+(f.message||D.$t("dashboard.indicator.error.loadDataFailedDesc")),i.value=[],g.value)try{g.value.applyNewData([])}catch(l){}case 12:return e.p=12,n.value=!1,e.f(12);case 13:return e.a(2)}},e,null,[[4,8],[3,11,12,13]])}));return function(){return e.apply(this,arguments)}}(),ht=function(){var e=(0,c.A)((0,l.A)().m(function e(a){return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.symbol&&i.value&&0!==i.value.length){e.n=1;break}return e.a(2);case 1:if(!s.value&&!p){e.n=6;break}if(!p){e.n=5;break}return e.p=2,e.n=3,p;case 3:e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2);case 6:if(u.value){e.n=7;break}return g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData(),e.a(2);case 7:return s.value=!0,p=(0,c.A)((0,l.A)().m(function e(){var n,r,o,c,d,f;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.n=1,(0,h.dY)();case 1:return e.p=1,n=Math.floor(a/1e3),e.n=2,(0,v.Ay)({url:"/api/indicator/kline",method:"get",params:{market:t.market,symbol:t.symbol,timeframe:t.timeframe,limit:500,before_time:n}});case 2:if(r=e.v,1!==r.code||!r.data||!Array.isArray(r.data)){e.n=5;break}if(o=st(r.data),0!==o.length){e.n=3;break}return u.value=!1,g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData(),e.a(2);case 3:if(c=o.filter(function(t){return t.timestamp<a}),0!==c.length){e.n=4;break}return u.value=!1,g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData(),e.a(2);case 4:d=null;try{g.value&&"function"===typeof g.value.getVisibleRange&&(d=g.value.getVisibleRange())}catch(l){}f=c.length,i.value=[].concat((0,F.A)(c),(0,F.A)(i.value)),(0,h.dY)(function(){if(g.value){if(g.value.applyNewData(i.value),d&&"number"===typeof d.from){var t=d.from+f,e=d.to+f;setTimeout(function(){try{g.value&&("function"===typeof g.value.scrollToDataIndex?g.value.scrollToDataIndex(t):"function"===typeof g.value.setVisibleRange&&g.value.setVisibleRange(t,e))}catch(l){}},50)}xt()}}),e.n=6;break;case 5:g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData();case 6:e.n=8;break;case 7:e.p=7,e.v,g.value&&"function"===typeof g.value.noMoreData&&g.value.noMoreData();case 8:return e.p=8,s.value=!1,p=null,e.f(8);case 9:return e.a(2)}},e,null,[[1,7,8,9]])}))(),e.p=8,e.n=9,p;case 9:e.n=11;break;case 10:e.p=10,e.v;case 11:return e.a(2)}},e,null,[[8,10],[2,4]])}));return function(t){return e.apply(this,arguments)}}(),pt=function(){var e=(0,c.A)((0,l.A)().m(function e(){var a,n,r,o,c;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.symbol&&i.value&&0!==i.value.length){e.n=1;break}return e.a(2);case 1:if(!s.value&&u.value){e.n=2;break}return e.a(2);case 2:return s.value=!0,e.p=3,a=i.value[0].timestamp,n=Math.floor(a/1e3),e.n=4,(0,v.Ay)({url:"/api/indicator/kline",method:"get",params:{market:t.market,symbol:t.symbol,timeframe:t.timeframe,limit:500,before_time:n}});case 4:if(r=e.v,1!==r.code||!r.data||!Array.isArray(r.data)){e.n=7;break}if(o=st(r.data),0!==o.length){e.n=5;break}return u.value=!1,s.value=!1,e.a(2);case 5:if(c=o.filter(function(t){return t.timestamp<a}),0!==c.length){e.n=6;break}return u.value=!1,s.value=!1,e.a(2);case 6:i.value=[].concat((0,F.A)(c),(0,F.A)(i.value)),(0,h.dY)(function(){g.value&&(g.value.applyNewData(i.value),xt())}),e.n=7;break;case 7:e.n=9;break;case 8:e.p=8,e.v;case 9:return e.p=9,s.value=!1,e.f(9);case 10:return e.a(2)}},e,null,[[3,8,9,10]])}));return function(){return e.apply(this,arguments)}}(),vt=function(){var e=(0,c.A)((0,l.A)().m(function e(){var a,n,r,o,s,c,u,d,h,p,f;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.symbol&&i.value&&0!==i.value.length){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,(0,v.Ay)({url:"/api/indicator/kline",method:"get",params:{market:t.market,symbol:t.symbol,timeframe:t.timeframe,limit:5}});case 2:a=e.v,1===a.code&&a.data&&Array.isArray(a.data)&&a.data.length>0&&(n=st(a.data),r=(0,F.A)(i.value),n.length>0&&(o=Math.floor(n[n.length-1].timestamp/1e3),s=Math.floor(r[r.length-1].timestamp/1e3),ut(o,s,t.timeframe)?(c=r[r.length-1],u=n[n.length-1],r[r.length-1]={timestamp:c.timestamp,open:c.open,high:Math.max(c.high,u.high),low:Math.min(c.low,u.low),close:u.close,volume:u.volume},i.value=r,d=ct(i.value),lt(d),g.value&&"function"===typeof g.value.updateData?(h=i.value.length-1,g.value.updateData(r[h]),k(!1)):g.value&&(g.value.applyNewData(i.value),k(!1))):o>s&&(p=n.filter(function(e){var a=Math.floor(e.timestamp/1e3);return!r.some(function(e){var i=Math.floor(e.timestamp/1e3);return ut(a,i,t.timeframe)})}),p.length>0&&(i.value=[].concat((0,F.A)(r),(0,F.A)(p)),i.value.length>500&&(i.value=i.value.slice(-500)),f=ct(i.value),lt(f),g.value&&"function"===typeof g.value.applyMoreData?(g.value.applyMoreData(p),k(!0)):g.value&&(g.value.applyNewData(i.value),k(!0)))))),e.n=4;break;case 3:e.p=3,e.v;case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),ft=function(){y.value&&clearInterval(y.value);var e={"1m":5e3,"5m":1e4,"15m":15e3,"30m":3e4,"1H":6e4,"4H":3e5,"1D":6e5,"1W":18e5},a=e[t.timeframe]||1e4;_.value=Math.min(a,1e3),t.realtimeEnabled&&t.symbol&&i.value.length>0&&(y.value=setInterval(function(){!n.value&&t.symbol&&i.value&&i.value.length>0&&vt()},_.value))},gt=function(){y.value&&(clearInterval(y.value),y.value=null)},mt=function(){var t=document.getElementById("kline-chart-container");if(t)if(0!==t.clientWidth&&0!==t.clientHeight){if(g.value){try{g.value.destroy()}catch(y){}g.value=null}try{var e=document.getElementById("kline-chart-container");if(!e)throw new Error("容器元素不存在");try{g.value=In(e,{drawingBarVisible:!0,overlay:{visible:!0}})}catch(y){g.value=In(e)}if(g.value&&"function"===typeof g.value.setDrawingBarVisible?g.value.setDrawingBarVisible(!0):g.value&&"function"===typeof g.value.setDrawingBar?g.value.setDrawingBar(!0):g.value&&"function"===typeof g.value.enableDrawing&&g.value.enableDrawing(!0),!g.value)throw new Error("图表初始化失败:无法创建图表实例");if(g.value&&("function"===typeof g.value.setDrawingBarVisible&&g.value.setDrawingBarVisible(!0),"function"===typeof g.value.setDrawingBar&&g.value.setDrawingBar(!0),"function"===typeof g.value.enableDrawing&&g.value.enableDrawing(!0)),bt(),g.value&&"function"===typeof g.value.subscribeAction){if(g.value.subscribeAction("onOverlayCreated",function(t){if(A.value&&t&&t.id){var e={line:"segment",horizontalLine:"horizontalStraightLine",verticalLine:"verticalStraightLine",ray:"rayLine",straightLine:"straightLine",parallelStraightLine:"parallelStraightLine",priceLine:"priceLine",priceChannelLine:"priceChannelLine",fibonacciLine:"fibonacciLine",measure:"priceRangeMeasure"},a=e[A.value];if(!t.name||t.name===a||"priceRangeMeasure"===a){E.value.push(t.id),A.value=null;try{"function"===typeof g.value.overrideOverlay&&g.value.overrideOverlay(null)}catch(y){}}}}),"function"===typeof g.value.subscribeAction)try{g.value.subscribeAction("onOverlayComplete",function(t){A.value&&t&&t.id&&(E.value.push(t.id),A.value=null)})}catch(y){}g.value.subscribeAction("onOverlayRemoved",function(t){var e=E.value.indexOf(t);e>-1&&E.value.splice(e,1)})}if(g.value&&"function"===typeof g.value.subscribeAction){var a=null,n=!1;g.value.subscribeAction("onVisibleRangeChange",function(){var t=(0,c.A)((0,l.A)().m(function t(e){var r,o,c,d,h,v;return(0,l.A)().w(function(t){while(1)switch(t.n){case 0:if(!e||"number"!==typeof e.from){t.n=5;break}if(n){t.n=1;break}return a=e.from,n=!0,setTimeout(function(){f.value=!0},1e3),t.a(2);case 1:if(f.value){t.n=2;break}return a=e.from,t.a(2);case 2:if(!(s.value&&e.from<=0)){t.n=3;break}try{g.value&&"function"===typeof g.value.setVisibleRange&&(r=i.value.length,r>0&&(o=g.value.getVisibleRange(),o&&(c=Math.ceil((o.to-o.from)*r/100),d=.1,h=Math.min(100,d+c/r*100),g.value.setVisibleRange(d,h))))}catch(y){}return t.a(2);case 3:if(!(e.from<=5&&!s.value&&!p&&u.value&&f.value)){t.n=4;break}if(!(null!==a&&a>e.from)){t.n=4;break}if(!(i.value.length>0)){t.n=4;break}return v=i.value[0].timestamp,t.n=4,ht(v);case 4:a=e.from;case 5:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}())}if(i.value&&i.value.length>0){var o=i.value.filter(function(t){return t.timestamp&&!isNaN(t.open)&&!isNaN(t.high)&&!isNaN(t.low)&&!isNaN(t.close)});if(o.length>0){try{g.value.applyNewData(o)}catch(y){try{g.value.applyNewData(o)}catch(b){}}try{g.value.createIndicator("VOL",!1,{height:100,dragEnabled:!0})}catch(y){}(0,h.dY)(function(){xt()})}}window.addEventListener("resize",yt)}catch(r){r.value=D.$t("dashboard.indicator.error.chartInitFailed")+": "+(r.message||"未知错误")}}else{var d=0,v=10,m=function(){var t=document.getElementById("kline-chart-container");t&&t.clientWidth>0&&t.clientHeight>0?mt():d<v?(d++,setTimeout(m,200)):mt()};setTimeout(m,200)}},yt=function(){if(g.value)setTimeout(function(){g.value&&g.value.resize()},100);else{var t=document.getElementById("kline-chart-container");t&&t.clientWidth>0&&t.clientHeight>0&&mt()}},bt=function(){if(g.value){var t=Y.value,e="dark"===m.value;g.value.setStyles({grid:{show:!0,horizontal:{show:!0,color:t.gridLineColor,style:"dashed",size:1},vertical:{show:!1}},candle:{priceMark:{show:!0,high:{show:!0,color:t.axisLabelColor},low:{show:!0,color:t.axisLabelColor}},tooltip:{showRule:"always",showType:"standard",labels:[D.$t("dashboard.indicator.tooltip.time"),D.$t("dashboard.indicator.tooltip.open"),D.$t("dashboard.indicator.tooltip.high"),D.$t("dashboard.indicator.tooltip.low"),D.$t("dashboard.indicator.tooltip.close"),D.$t("dashboard.indicator.tooltip.volume")],values:function(t){var e=new Date(t.timestamp);return["".concat(e.getFullYear(),"-").concat(e.getMonth()+1,"-").concat(e.getDate()," ").concat(e.getHours(),":").concat(e.getMinutes()),t.open.toFixed(2),t.high.toFixed(2),t.low.toFixed(2),t.close.toFixed(2),t.volume.toFixed(0)]}},bar:{upColor:e?"#0ecb81":"#13c2c2",downColor:e?"#f6465d":"#fa541c",noChangeColor:t.borderColor}},indicator:{tooltip:{showRule:"always",showType:"standard"}},xAxis:{show:!0,axisLine:{show:!0,color:t.borderColor}},yAxis:{show:!0,axisLine:{show:!1}},crosshair:{show:!0,horizontal:{show:!0,line:{show:!0,style:"dashed",color:t.gridLineColor,size:1}},vertical:{show:!0,line:{show:!0,style:"dashed",color:t.gridLineColor,size:1}}},watermark:{show:!1}})}},_t=function(t,e,a){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];try{var o={name:t,shortName:t,calc:e,figures:a,calcParams:i,precision:n,series:r?"price":"normal"};return na(o),!0}catch(s){return!(!s.message||!s.message.includes("already registered"))}},xt=function(){var e=(0,c.A)((0,l.A)().m(function e(){var a,n,r,o;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!x.value){e.n=1;break}return e.a(2);case 1:if(g.value&&0!==i.value.length){e.n=2;break}return e.a(2);case 2:x.value=!0,e.p=3;try{I.value.length>0&&g.value&&(I.value.forEach(function(t){try{"function"===typeof g.value.removeOverlay?g.value.removeOverlay(t):"function"===typeof g.value.removeOverlayById&&g.value.removeOverlayById(t)}catch(e){}}),I.value=[])}catch(s){}try{C.value.length>0&&(C.value.forEach(function(t){var e="string"===typeof t?t:t.name,a="string"===typeof t?void 0:t.paneId;a?g.value.removeIndicator(a,e):(g.value.removeIndicator("candle_pane",e),g.value.removeIndicator(e))}),C.value=[])}catch(s){}a=ct(i.value),n=(0,l.A)().m(function e(){var i,n,r,s,c,u,d,h,p,v,f,m,y,_,x,w,S,k,E,A,P,D,T,M,B,L,N,$,z,V,W,Y,X,q,st,lt,ct,ut,dt,ht,pt,vt,ft,gt,mt,yt,bt,xt,wt,St,kt,Ct,It,Et,At,Pt,Dt,Tt,Mt,Rt,Ft,Bt,Lt,Nt,$t,zt,Vt,Ot,Wt,Ht,Yt,Kt,Xt,qt,Ut,jt,Gt,Zt,Jt,Qt,te,ee,ae,ie,ne,re,oe,se,le,ce,ue,de,he,pe,ve,fe,ge,me,ye,be,_e,xe,we,Se,ke,Ce,Ie,Ee,Ae,Pe,De,Te,Me,Re,Fe,Be,Le,Ne,$e,ze,Ve,Oe,We,He,Ye,Ke,Xe,qe,Ue,je,Ge,Ze,Je,Qe,ta,ea,aa,ia,na,ra,oa,sa,la,ca,ua,da,ha,pa,va,fa,ga,ma,ya,ba;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(i=t.activeIndicators[o],e.p=1,"python"!==i.type){e.n=31;break}if(i.code){e.n=2;break}return e.a(2,0);case 2:if(e.p=2,!i.calculate||"function"!==typeof i.calculate){e.n=15;break}return e.n=3,i.calculate(a,i.params||{});case 3:if(n=e.v,r=[],n&&n.plots&&Array.isArray(n.plots)&&(r=(0,F.A)(n.plots)),!(n&&n.signals&&Array.isArray(n.signals))){e.n=14;break}s=(0,b.A)(n.signals),e.p=4,s.s();case 5:if((c=s.n()).done){e.n=11;break}if(u=c.value,!(u.data&&Array.isArray(u.data)&&u.data.length>0)){e.n=10;break}for(d=[],h=0;h<Math.min(u.data.length,20);h++)p=u.data[h],null===p||void 0===p||isNaN(p)||d.length<5&&d.push({index:h,value:p});v=[],f=0;case 6:if(!(f<u.data.length&&f<a.length)){e.n=9;break}if(m=u.data[f],null===m||void 0===m||isNaN(m)){e.n=8;break}if(y=a[f],_=y.timestamp||y.time,x=y.high,w=y.low,S=u.type||"buy",k=String(S).toLowerCase(),E=["buy","sell"],E.includes(k)){e.n=7;break}return e.a(3,8);case 7:A="buy"===k,P=u.text||(A?"B":"S"),u.textData&&null!=u.textData[f]&&(P=u.textData[f]),v.push({timestamp:_,price:m,anchorPrice:A?w:x,side:A?"buy":"sell",action:k,color:u.color||(A?"#00E676":"#FF5252"),text:P});case 8:f++,e.n=6;break;case 9:if(v.length>0&&g.value){D=(0,b.A)(v);try{for(D.s();!(T=D.n()).done;){M=T.value;try{B=M.timestamp,B<1e10&&(B*=1e3),L=M.text,"function"===typeof g.value.createOverlay&&(N=g.value.createOverlay({name:"signalTag",points:[{timestamp:B,value:M.price},{timestamp:B,value:M.anchorPrice}],extendData:{text:L,color:M.color,side:M.side,action:M.action,price:M.price},lock:!0},"candle_pane"),N&&I.value.push(N))}catch(l){}}}catch(_a){D.e(_a)}finally{D.f()}}case 10:e.n=5;break;case 11:e.n=13;break;case 12:e.p=12,ma=e.v,s.e(ma);case 13:return e.p=13,s.f(),e.f(13);case 14:if(r.length>0&&($=r.filter(function(t){return t.data&&Array.isArray(t.data)&&t.data.length>0}),$.length>0)){for(z=[],V={},W=0;W<$.length;W++)Y=$[W],X=Y.name||"PLOT_".concat(W,"_").concat(o),q=X.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"_"),st=Y.color||K(W),lt=Y.type||"line",z.push({key:q,title:Y.name||X,type:lt,color:st}),V[q]=Y.data;ct=$.every(function(t){return!1!==t.overlay}),ut="".concat(i.id,"_combined"),n&&n.name&&(ut=n.name);try{dt=_t(ut,function(t){for(var e=[],a=0;a<t.length;a++){var i={};for(var n in V){var r=V[n];i[n]=a<r.length?r[a]:null}e.push(i)}return e},z,[],2,ct),dt&&(ct?(ht=g.value.createIndicator(ut,!1,{id:"candle_pane"}),ht?C.value.push({paneId:ht,name:ut}):C.value.push({paneId:"candle_pane",name:ut})):(pt=g.value.createIndicator(ut,!1,{height:100,dragEnabled:!0}),pt&&C.value.push({paneId:pt,name:ut})))}catch(xa){}}e.n=28;break;case 15:return vt={id:i.originalId||i.id,user_id:i.user_id||i.userId,is_encrypted:i.is_encrypted||i.isEncrypted||0},e.n=16,U(i.code,a,i.params||{},vt);case 16:if(ft=e.v,gt=[],ft&&ft.plots&&Array.isArray(ft.plots)&&(gt=(0,F.A)(ft.plots)),!(ft&&ft.signals&&Array.isArray(ft.signals))){e.n=27;break}mt=(0,b.A)(ft.signals),e.p=17,mt.s();case 18:if((yt=mt.n()).done){e.n=24;break}if(bt=yt.value,!(bt.data&&Array.isArray(bt.data)&&bt.data.length>0)){e.n=23;break}for(xt=[],wt=0;wt<Math.min(bt.data.length,20);wt++)St=bt.data[wt],null===St||void 0===St||isNaN(St)||xt.length<5&&xt.push({index:wt,value:St});kt=[],Ct=0;case 19:if(!(Ct<bt.data.length&&Ct<a.length)){e.n=22;break}if(It=bt.data[Ct],null===It||void 0===It||isNaN(It)){e.n=21;break}if(Et=a[Ct],At=Et.timestamp||Et.time,Pt=Et.high,Dt=Et.low,Tt=bt.type||"buy",Mt=String(Tt).toLowerCase(),Rt=["buy","sell"],Rt.includes(Mt)){e.n=20;break}return e.a(3,21);case 20:Ft="buy"===Mt,Bt=bt.text||(Ft?"B":"S"),bt.textData&&null!=bt.textData[Ct]&&(Bt=bt.textData[Ct]),kt.push({timestamp:At,price:It,anchorPrice:Ft?Dt:Pt,side:Ft?"buy":"sell",action:Mt,color:bt.color||(Ft?"#00E676":"#FF5252"),text:Bt});case 21:Ct++,e.n=19;break;case 22:if(kt.length>0&&g.value){Lt=(0,b.A)(kt);try{for(Lt.s();!(Nt=Lt.n()).done;){$t=Nt.value;try{zt=$t.timestamp,zt<1e10&&(zt*=1e3),Vt=$t.text,"function"===typeof g.value.createOverlay&&(Ot=g.value.createOverlay({name:"signalTag",points:[{timestamp:zt,value:$t.price},{timestamp:zt,value:$t.anchorPrice}],extendData:{text:Vt,color:$t.color,side:$t.side,action:$t.action,price:$t.price},lock:!0},"candle_pane"),Ot&&I.value.push(Ot))}catch(l){}}}catch(_a){Lt.e(_a)}finally{Lt.f()}}case 23:e.n=18;break;case 24:e.n=26;break;case 25:e.p=25,ya=e.v,mt.e(ya);case 26:return e.p=26,mt.f(),e.f(26);case 27:if(gt.length>0&&(Wt=gt.filter(function(t){return t.data&&Array.isArray(t.data)&&t.data.length>0}),Wt.length>0)){for(Ht=[],Yt={},Kt=0;Kt<Wt.length;Kt++)Xt=Wt[Kt],qt=Xt.name||"PLOT_".concat(Kt),Ut=qt.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"_"),jt=Xt.color||K(Kt),Gt=Xt.type||"line",Ht.push({key:Ut,title:Xt.name||qt,type:Gt,color:jt}),Yt[Ut]=Xt.data;Zt=Wt.every(function(t){return!1!==t.overlay}),Jt="".concat(i.id,"_combined"),ft&&ft.name&&(Jt=ft.name);try{Qt=_t(Jt,function(t){for(var e=[],a=0;a<t.length;a++){var i={};for(var n in Yt){var r=Yt[n];i[n]=a<r.length?r[a]:null}e.push(i)}return e},Ht,[],2,Zt),Qt&&(Zt?(te=g.value.createIndicator(Jt,!1,{id:"candle_pane"}),te?C.value.push({paneId:te,name:Jt}):C.value.push({paneId:"candle_pane",name:Jt})):(ee=g.value.createIndicator(Jt,!1,{height:100,dragEnabled:!0}),ee&&C.value.push({paneId:ee,name:Jt})))}catch(xa){}}case 28:e.n=30;break;case 29:e.p=29,ba=e.v,ba.message&&ba.message.includes("Python 引擎未就绪")&&(O.value||(H.value=!0));case 30:return e.a(2,0);case 31:if(ae=K(o),"sma"===i.id||"ema"===i.id){re="sma"===i.id?"SMA":"EMA",oe=(null===(ie=i.params)||void 0===ie?void 0:ie.length)||(null===(ne=i.params)||void 0===ne?void 0:ne.period)||20,se="".concat(re,"_").concat(oe),le=re.toLowerCase(),ce=oe;try{ue=_t(se,function(t,e){var a=e.calcParams[0]||ce,i="SMA"===re?j(t,a):G(t,a);return i.map(function(t){return(0,R.A)({},le,t)})},[{key:le,title:"".concat(re,"(").concat(oe,")"),type:"line"}],[oe],2,!0),ue&&(de=g.value.createIndicator(se,!1,{id:"candle_pane"}),de?C.value.push({paneId:de,name:se}):C.value.push({paneId:"candle_pane",name:se}))}catch(_a){}}else if("macd"===i.id)he=g.value.createIndicator("MACD",!1,{height:100,dragEnabled:!0}),he&&C.value.push({paneId:he,name:"MACD"});else if("rsi"===i.id)pe=g.value.createIndicator("RSI",!1,{height:100,dragEnabled:!0}),pe&&C.value.push({paneId:pe,name:"RSI"});else if("bollinger_bands"===i.id||"bb"===i.id){ge=(null===(ve=i.params)||void 0===ve?void 0:ve.length)||20,me=(null===(fe=i.params)||void 0===fe?void 0:fe.mult)||2,ye="BOLL_".concat(ge,"_").concat(me);try{be=_t(ye,function(t,e){for(var a=e.calcParams[0]||20,i=e.calcParams[1]||2,n=Z(t,a,i),r=[],o=0;o<n.length;o++){var s,l,c,u,d,h;r.push({upper:null!==(s=null===(l=n[o])||void 0===l?void 0:l.upper)&&void 0!==s?s:null,middle:null!==(c=null===(u=n[o])||void 0===u?void 0:u.middle)&&void 0!==c?c:null,lower:null!==(d=null===(h=n[o])||void 0===h?void 0:h.lower)&&void 0!==d?d:null})}return r},[{key:"upper",title:"上轨(".concat(ge,",").concat(me,")"),type:"line"},{key:"middle",title:"中轨(".concat(ge,")"),type:"line"},{key:"lower",title:"下轨(".concat(ge,",").concat(me,")"),type:"line"}],[ge,me],2,!0),be&&(_e=g.value.createIndicator(ye,!1,{id:"candle_pane"}),_e?C.value.push({paneId:_e,name:ye}):C.value.push({paneId:"candle_pane",name:ye}))}catch(_a){}}else if("atr"===i.id){Se=(null===(xe=i.params)||void 0===xe?void 0:xe.period)||(null===(we=i.params)||void 0===we?void 0:we.length)||14,ke="ATR_".concat(Se);try{Ce=_t(ke,function(t,e){var a=e.calcParams[0]||14,i=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),n=J(i,a);return n.map(function(t){return{atr:t}})},[{key:"atr",title:"ATR(".concat(Se,")"),type:"line",color:ae}],[Se]),Ce&&(Ie=g.value.createIndicator(ke,!1,{height:100,dragEnabled:!0}),Ie&&C.value.push({paneId:Ie,name:ke}))}catch(_a){}}else if("williams"===i.id||"williams_r"===i.id){Ae=(null===(Ee=i.params)||void 0===Ee?void 0:Ee.length)||14,Pe="WPR_".concat(Ae);try{De=_t(Pe,function(t,e){var a=e.calcParams[0]||14,i=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),n=tt(i,a);return n.map(function(t){return{wr:t}})},[{key:"wr",title:"W%R(".concat(Ae,")"),type:"line",color:ae}],[Ae]),De&&(Te=g.value.createIndicator(Pe,!1,{height:100,dragEnabled:!0}),Te&&C.value.push({paneId:Te,name:Pe}))}catch(_a){}}else if("mfi"===i.id){Re=(null===(Me=i.params)||void 0===Me?void 0:Me.length)||14,Fe="MFI_".concat(Re);try{Be=_t(Fe,function(t,e){var a=e.calcParams[0]||14,i=t.map(function(t){return{high:t.high,low:t.low,close:t.close,volume:t.volume}}),n=et(i,a);return n.map(function(t){return{mfi:t}})},[{key:"mfi",title:"MFI(".concat(Re,")"),type:"line",color:ae}],[Re]),Be&&(Le=g.value.createIndicator(Fe,!1,{height:100,dragEnabled:!0}),Le&&C.value.push({paneId:Le,name:Fe}))}catch(_a){}}else if("cci"===i.id){$e=(null===(Ne=i.params)||void 0===Ne?void 0:Ne.length)||20,ze="CCI_".concat($e);try{Ve=_t(ze,function(t,e){var a=e.calcParams[0]||20,i=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),n=Q(i,a);return n.map(function(t){return{cci:t}})},[{key:"cci",title:"CCI(".concat($e,")"),type:"line",color:ae}],[$e]),Ve&&(Oe=g.value.createIndicator(ze,!1,{height:100,dragEnabled:!0}),Oe&&C.value.push({paneId:Oe,name:ze}))}catch(_a){}}else if("adx"===i.id){He=(null===(We=i.params)||void 0===We?void 0:We.length)||14,Ye="ADX_".concat(He);try{Ke=_t(Ye,function(t,e){var a=e.calcParams[0]||14,i=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),n=at(i,a);return n.adx.map(function(t){return{adx:t}})},[{key:"adx",title:"ADX(".concat(He,")"),type:"line",color:ae}],[He]),Ke&&(Xe=g.value.createIndicator(Ye,!1,{height:100,dragEnabled:!0}),Xe&&C.value.push({paneId:Xe,name:Ye}))}catch(_a){}}else if("obv"===i.id){qe="OBV";try{Ue=_t(qe,function(t,e){var a=t.map(function(t){return{close:t.close,volume:t.volume||0}}),i=it(a);return i.map(function(t){return{obv:t}})},[{key:"obv",title:"OBV",type:"line",color:ae}],[]),Ue&&(je=g.value.createIndicator(qe,!1,{height:100,dragEnabled:!0}),je&&C.value.push({paneId:je,name:qe}))}catch(_a){}}else if("adosc"===i.id){Je=(null===(Ge=i.params)||void 0===Ge?void 0:Ge.fast)||3,Qe=(null===(Ze=i.params)||void 0===Ze?void 0:Ze.slow)||10,ta="ADOSC_".concat(Je,"_").concat(Qe);try{ea=_t(ta,function(t,e){var a=e.calcParams[0]||3,i=e.calcParams[1]||10,n=t.map(function(t){return{high:t.high,low:t.low,close:t.close,volume:t.volume||0}}),r=rt(n,a,i);return r.map(function(t){return{adosc:t}})},[{key:"adosc",title:"ADOSC(".concat(Je,",").concat(Qe,")"),type:"line",color:ae}],[Je,Qe]),ea&&(aa=g.value.createIndicator(ta,!1,{height:100,dragEnabled:!0}),aa&&C.value.push({paneId:aa,name:ta}))}catch(_a){}}else if("ad"===i.id){ia="AD";try{na=_t(ia,function(t,e){var a=t.map(function(t){return{high:t.high,low:t.low,close:t.close,volume:t.volume||0}}),i=nt(a);return i.map(function(t){return{ad:t}})},[{key:"ad",title:"AD",type:"line",color:ae}],[]),na&&(ra=g.value.createIndicator(ia,!1,{height:100,dragEnabled:!0}),ra&&C.value.push({paneId:ra,name:ia}))}catch(_a){}}else if("kdj"===i.id){ca=(null===(oa=i.params)||void 0===oa?void 0:oa.period)||9,ua=(null===(sa=i.params)||void 0===sa?void 0:sa.k)||3,da=(null===(la=i.params)||void 0===la?void 0:la.d)||3,ha="KDJ_".concat(ca,"_").concat(ua,"_").concat(da);try{pa=_t(ha,function(t,e){var a=e.calcParams[0]||9,i=e.calcParams[1]||3,n=e.calcParams[2]||3,r=t.map(function(t){return{high:t.high,low:t.low,close:t.close}}),o=ot(r,a,i,n);return o.k.map(function(t,e){return{k:t,d:o.d[e],j:o.j[e]}})},[{key:"k",title:"K(".concat(ca,",").concat(ua,")"),type:"line",color:"#FF6B6B"},{key:"d",title:"D(".concat(da,")"),type:"line",color:"#4ECDC4"},{key:"j",title:"J",type:"line",color:"#95E1D3"}],[ca,ua,da]),pa&&(va=g.value.createIndicator(ha,!1,{height:100,dragEnabled:!0}),va&&C.value.push({paneId:va,name:ha}))}catch(_a){}}else try{fa=i.id.toUpperCase(),ga=g.value.createIndicator(fa,!1,{height:100,dragEnabled:!0}),ga&&C.value.push({paneId:ga,name:fa})}catch(_a){}e.n=33;break;case 32:e.p=32,e.v;case 33:return e.a(2)}},e,null,[[17,25,26,27],[4,12,13,14],[2,29],[1,32]])}),o=0;case 4:if(!(o<t.activeIndicators.length)){e.n=7;break}return e.d((0,M.A)(n()),5);case 5:if(r=e.v,0!==r){e.n=6;break}return e.a(3,6);case 6:o++,e.n=4;break;case 7:return e.p=7,x.value=!1,e.f(7);case 8:return e.a(2)}},e,null,[[3,,7,8]])}));return function(){return e.apply(this,arguments)}}(),wt=function(){dt()};return(0,h.wB)(function(){return t.symbol},function(){t.symbol&&dt()}),(0,h.wB)(function(){return t.theme},function(t){m.value=t,g.value&&(bt(),xt())}),(0,h.wB)(function(){return t.symbol},function(){t.symbol&&dt()}),(0,h.wB)(function(){return t.market},function(){t.symbol&&dt()}),(0,h.wB)(function(){return t.timeframe},function(){t.symbol&&dt(),t.realtimeEnabled&&(gt(),ft())}),(0,h.wB)(function(){return t.activeIndicators},function(t,e){g.value&&i.value.length>0&&(0,h.dY)(function(){g.value&&xt()})},{deep:!0}),(0,h.wB)(function(){return t.realtimeEnabled},function(t){t?ft():gt()}),(0,h.sV)((0,c.A)((0,l.A)().m(function e(){return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.n=1,(0,h.dY)();case 1:return!t.theme||"dark"!==t.theme&&"light"!==t.theme||(m.value=t.theme),e.p=2,e.n=3,X();case 3:e.n=5;break;case 4:e.p=4,e.v,H.value=!0;case 5:(0,h.dY)(function(){setTimeout(function(){!g.value&&t.symbol&&mt()},300)});case 6:return e.a(2)}},e,null,[[2,4]])}))),(0,h.xo)(function(){gt(),g.value&&(g.value.destroy(),g.value=null),window.removeEventListener("resize",yt)}),{klineData:i,loading:n,error:r,loadingHistory:s,chartRef:g,chartTheme:m,themeConfig:Y,getIndicatorColor:K,handleRetry:wt,loadingPython:O,pythonReady:W,pyodideLoadFailed:H,formatKlineData:st,updatePricePanel:lt,isSameTimeframe:ut,loadKlineData:dt,loadMoreHistoryData:pt,updateKlineRealtime:vt,startRealtime:ft,stopRealtime:gt,initChart:mt,handleResize:yt,updateChartTheme:bt,updateIndicators:xt,executePythonStrategy:U,parsePythonStrategy:q,indicatorButtons:B,isIndicatorActive:L,toggleIndicator:z,drawingTools:T,activeDrawingTool:A,selectDrawingTool:N,clearAllDrawings:$}}},Ln=Bn,Nn=(0,E.A)(Ln,D,T,!1,null,"58f93984",null),$n=Nn.exports,zn=function(){var t=this,e=t._self._c;return e("a-modal",{staticClass:"backtest-modal",attrs:{title:t.$t("dashboard.indicator.backtest.title"),visible:t.visible,width:1100,maskClosable:!1},on:{cancel:t.handleCancel}},[e("div",{staticClass:"backtest-content"},[e("a-steps",{staticStyle:{"margin-bottom":"16px"},attrs:{current:t.currentStep,size:"small"}},[e("a-step",{attrs:{title:t.$t("dashboard.indicator.backtest.steps.strategy.title"),description:t.$t("dashboard.indicator.backtest.steps.strategy.desc")}}),e("a-step",{attrs:{title:t.$t("dashboard.indicator.backtest.steps.trading.title"),description:t.$t("dashboard.indicator.backtest.steps.trading.desc")}}),e("a-step",{attrs:{title:t.$t("dashboard.indicator.backtest.steps.results.title"),description:t.$t("dashboard.indicator.backtest.steps.results.desc")}})],1),e("div",{directives:[{name:"show",rawName:"v-show",value:2!==t.currentStep,expression:"currentStep !== 2"}],staticClass:"config-section"},[e("a-form",{attrs:{form:t.form,"label-col":t.labelCol,"wrapper-col":t.wrapperCol}},[e("div",{directives:[{name:"show",rawName:"v-show",value:0===t.currentStep,expression:"currentStep === 0"}]},[e("a-collapse",{staticStyle:{background:"#fafafa"},attrs:{bordered:!1},model:{value:t.step1CollapseKeys,callback:function(e){t.step1CollapseKeys=e},expression:"step1CollapseKeys"}},[e("a-collapse-panel",{key:"risk",attrs:{header:t.$t("dashboard.indicator.backtest.panel.risk")}},[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.stopLossPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["stopLossPct",{initialValue:0}],expression:"['stopLossPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.01,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.takeProfitPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["takeProfitPct",{initialValue:0}],expression:"['takeProfitPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trailingEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["trailingEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['trailingEnabled', { valuePropName: 'checked', initialValue: false }]"}],on:{change:t.onTrailingToggle}})],1)],1),e("a-col",{attrs:{span:12}})],1),t.trailingEnabledUi?[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trailingStopPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trailingStopPct",{initialValue:0}],expression:"['trailingStopPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.01,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trailingActivationPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trailingActivationPct",{initialValue:0}],expression:"['trailingActivationPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4}})],1)],1)],1)]:t._e()],2),e("a-collapse-panel",{key:"scale",attrs:{header:t.$t("dashboard.indicator.backtest.panel.scale")}},[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendAddEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendAddEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['trendAddEnabled', { valuePropName: 'checked', initialValue: false }]"}],on:{change:t.onTrendAddToggle}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.dcaAddEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["dcaAddEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['dcaAddEnabled', { valuePropName: 'checked', initialValue: false }]"}],on:{change:t.onDcaAddToggle}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendAddStepPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendAddStepPct",{initialValue:0}],expression:"['trendAddStepPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4},on:{change:t.onScaleParamsChange}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.dcaAddStepPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["dcaAddStepPct",{initialValue:0}],expression:"['dcaAddStepPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4},on:{change:t.onScaleParamsChange}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendAddSizePct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendAddSizePct",{initialValue:0}],expression:"['trendAddSizePct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.1,precision:4},on:{change:t.onScaleParamsChange}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.dcaAddSizePct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["dcaAddSizePct",{initialValue:0}],expression:"['dcaAddSizePct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.1,precision:4},on:{change:t.onScaleParamsChange}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendAddMaxTimes")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendAddMaxTimes",{initialValue:0}],expression:"['trendAddMaxTimes', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:50,step:1,precision:0},on:{change:t.onScaleParamsChange}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.dcaAddMaxTimes")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["dcaAddMaxTimes",{initialValue:0}],expression:"['dcaAddMaxTimes', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:50,step:1,precision:0},on:{change:t.onScaleParamsChange}})],1)],1)],1)],1),e("a-collapse-panel",{key:"reduce",attrs:{header:t.$t("dashboard.indicator.backtest.panel.reduce")}},[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendReduceEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendReduceEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['trendReduceEnabled', { valuePropName: 'checked', initialValue: false }]"}]})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.adverseReduceEnabled")}},[e("a-switch",{directives:[{name:"decorator",rawName:"v-decorator",value:["adverseReduceEnabled",{valuePropName:"checked",initialValue:!1}],expression:"['adverseReduceEnabled', { valuePropName: 'checked', initialValue: false }]"}]})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendReduceStepPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendReduceStepPct",{initialValue:0}],expression:"['trendReduceStepPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.adverseReduceStepPct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["adverseReduceStepPct",{initialValue:0}],expression:"['adverseReduceStepPct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:1e3,step:.01,precision:4}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendReduceSizePct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendReduceSizePct",{initialValue:0}],expression:"['trendReduceSizePct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.1,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.adverseReduceSizePct")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["adverseReduceSizePct",{initialValue:0}],expression:"['adverseReduceSizePct', { initialValue: 0 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:100,step:.1,precision:4}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.trendReduceMaxTimes")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["trendReduceMaxTimes",{initialValue:0}],expression:"['trendReduceMaxTimes', { initialValue: 0 }]"}],staticStyle:{width:"100%"},attrs:{min:0,max:50,step:1,precision:0}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.adverseReduceMaxTimes")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["adverseReduceMaxTimes",{initialValue:0}],expression:"['adverseReduceMaxTimes', { initialValue: 0 }]"}],staticStyle:{width:"100%"},attrs:{min:0,max:50,step:1,precision:0}})],1)],1)],1)],1),e("a-collapse-panel",{key:"position",attrs:{header:t.$t("dashboard.indicator.backtest.panel.position")}},[e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.entryPct"),help:t.$t("dashboard.indicator.backtest.hint.entryPctMax",{maxPct:Number(t.entryPctMaxUi||0).toFixed(0)})}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["entryPct",{initialValue:100}],expression:"['entryPct', { initialValue: 100 }]"}],staticStyle:{width:"220px"},attrs:{min:0,max:t.entryPctMaxUi,step:.1,precision:4},on:{change:t.onEntryPctChange}})],1)],1),e("a-col",{attrs:{span:12}})],1)],1)],1)],1),e("div",{directives:[{name:"show",rawName:"v-show",value:1===t.currentStep,expression:"currentStep === 1"}]},[e("a-alert",{staticStyle:{"margin-bottom":"12px"},attrs:{type:t.combinedAlertType,"show-icon":""}},[e("template",{slot:"message"},[e("div",{staticStyle:{display:"flex","align-items":"center","flex-wrap":"wrap",gap:"8px"}},[e("span",[e("strong",[t._v("Symbol:")]),t._v(" "+t._s(t.symbol||"-")+" "),e("span",{staticStyle:{color:"#999",margin:"0 6px"}},[t._v("|")]),e("strong",[t._v("Market:")]),t._v(" "+t._s(t.market||"-")+" "),e("span",{staticStyle:{color:"#999",margin:"0 6px"}},[t._v("|")]),e("strong",[t._v("Timeframe:")]),t._v(" "+t._s(t.selectedTimeframe||t.timeframe||"-")+" ")]),t.precisionInfo&&t.precisionInfo.enabled?e("span",{staticStyle:{"margin-left":"12px","border-left":"1px solid #d9d9d9","padding-left":"12px"}},[e("a-icon",{staticStyle:{"margin-right":"4px"},attrs:{type:"high"===t.precisionInfo.precision?"thunderbolt":"clock-circle"}}),t._v(" "+t._s(t.$t("dashboard.indicator.backtest.precisionMode"))+": "),e("a-tag",{staticStyle:{"margin-left":"4px"},attrs:{color:"high"===t.precisionInfo.precision?"green":"blue",size:"small"}},[t._v(" "+t._s(t.precisionInfo.timeframe)+" ")]),e("span",{staticStyle:{color:"#666","margin-left":"6px"}},[t._v(" ("+t._s(t.$t("dashboard.indicator.backtest.estimatedCandles",{count:t.precisionInfo.estimated_candles?t.precisionInfo.estimated_candles.toLocaleString():"-"}))+") ")])],1):t.precisionInfo&&!t.precisionInfo.enabled&&t.market&&"crypto"===t.market.toLowerCase()?e("span",{staticStyle:{"margin-left":"12px","border-left":"1px solid #d9d9d9","padding-left":"12px",color:"#faad14"}},[e("a-icon",{staticStyle:{"margin-right":"4px"},attrs:{type:"warning"}}),t._v(" "+t._s(t.$t("dashboard.indicator.backtest.standardModeWarning"))+" ")],1):t._e()])]),e("template",{slot:"description"},[t.precisionInfo&&t.precisionInfo.enabled?e("span",{staticStyle:{"font-size":"12px",color:"#888"}},[t._v(" "+t._s("high"===t.precisionInfo.precision?t.$t("dashboard.indicator.backtest.highPrecisionDesc"):t.$t("dashboard.indicator.backtest.mediumPrecisionDesc"))+" ")]):t.precisionInfo&&!t.precisionInfo.enabled&&t.market&&"crypto"===t.market.toLowerCase()?e("span",{staticStyle:{"font-size":"12px",color:"#888"}},[t._v(" "+t._s(t.precisionInfo.message||t.$t("dashboard.indicator.backtest.standardModeDesc"))+" ")]):t._e()])],2),e("div",{staticClass:"date-quick-select",staticStyle:{"margin-bottom":"12px"}},[e("span",{staticStyle:{"margin-right":"8px",color:"#666","font-size":"13px"}},[t._v(t._s(t.$t("dashboard.indicator.backtest.quickSelect")||"快速选择")+":")]),e("a-button-group",{attrs:{size:"small"}},t._l(t.datePresets,function(a){return e("a-button",{key:a.key,attrs:{type:t.selectedDatePreset===a.key?"primary":"default"},on:{click:function(e){return t.applyDatePreset(a)}}},[t._v(t._s(a.label))])}),1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.startDate")}},[e("a-date-picker",{directives:[{name:"decorator",rawName:"v-decorator",value:["startDate",{rules:[{required:!0,message:t.$t("dashboard.indicator.backtest.startDateRequired")}],initialValue:t.defaultStartDate}],expression:"['startDate', { rules: [{ required: true, message: $t('dashboard.indicator.backtest.startDateRequired') }], initialValue: defaultStartDate }]"}],staticStyle:{width:"100%"},attrs:{"disabled-date":t.disabledStartDate,placeholder:t.$t("dashboard.indicator.backtest.selectStartDate")},on:{change:t.onDateChange}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.endDate")}},[e("a-date-picker",{directives:[{name:"decorator",rawName:"v-decorator",value:["endDate",{rules:[{required:!0,message:t.$t("dashboard.indicator.backtest.endDateRequired")}],initialValue:t.defaultEndDate}],expression:"['endDate', { rules: [{ required: true, message: $t('dashboard.indicator.backtest.endDateRequired') }], initialValue: defaultEndDate }]"}],staticStyle:{width:"100%"},attrs:{"disabled-date":t.disabledEndDate,placeholder:t.$t("dashboard.indicator.backtest.selectEndDate")},on:{change:t.onDateChange}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.initialCapital")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["initialCapital",{rules:[{required:!0,message:t.$t("dashboard.indicator.backtest.initialCapitalRequired")}],initialValue:1e4}],expression:"['initialCapital', { rules: [{ required: true, message: $t('dashboard.indicator.backtest.initialCapitalRequired') }], initialValue: 10000 }]"}],staticStyle:{width:"100%"},attrs:{min:1e3,step:1e4,precision:2,formatter:function(t){return"$ ".concat(t).replace(/\B(?=(\d{3})+(?!\d))/g,",")},parser:function(t){return t.replace(/\$\s?|(,*)/g,"")}}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.commission")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["commission",{initialValue:.02}],expression:"['commission', { initialValue: 0.02 }]"}],staticStyle:{width:"100%"},attrs:{min:0,max:10,step:.01,precision:4}}),e("div",{staticClass:"field-hint"},[t._v(t._s(t.$t("dashboard.indicator.backtest.commissionHint")))])],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.field.slippage")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["slippage",{initialValue:0}],expression:"['slippage', { initialValue: 0 }]"}],staticStyle:{width:"100%"},attrs:{min:0,max:10,step:.01,precision:4}})],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.leverage")}},[e("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["leverage",{initialValue:1}],expression:"['leverage', { initialValue: 1 }]"}],staticStyle:{width:"100%"},attrs:{min:1,max:125,step:1,precision:0,formatter:function(t){return"".concat(t,"x")},parser:function(t){return t.replace("x","")}}})],1)],1)],1),e("a-row",{attrs:{gutter:24}},[e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.tradeDirection")}},[e("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["tradeDirection",{initialValue:"long"}],expression:"['tradeDirection', { initialValue: 'long' }]"}],staticStyle:{width:"100%"}},[e("a-select-option",{attrs:{value:"long"}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.longOnly"))+" ")]),e("a-select-option",{attrs:{value:"short"}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.shortOnly"))+" ")]),e("a-select-option",{attrs:{value:"both"}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.both"))+" ")])],1)],1)],1),e("a-col",{attrs:{span:12}},[e("a-form-item",{attrs:{label:t.$t("dashboard.indicator.backtest.timeframe")}},[e("a-select",{staticStyle:{width:"100%"},on:{change:t.onTimeframeChange},model:{value:t.selectedTimeframe,callback:function(e){t.selectedTimeframe=e},expression:"selectedTimeframe"}},[e("a-select-option",{attrs:{value:"1m"}},[t._v("1m")]),e("a-select-option",{attrs:{value:"5m"}},[t._v("5m")]),e("a-select-option",{attrs:{value:"15m"}},[t._v("15m")]),e("a-select-option",{attrs:{value:"30m"}},[t._v("30m")]),e("a-select-option",{attrs:{value:"1H"}},[t._v("1H")]),e("a-select-option",{attrs:{value:"4H"}},[t._v("4H")]),e("a-select-option",{attrs:{value:"1D"}},[t._v("1D")]),e("a-select-option",{attrs:{value:"1W"}},[t._v("1W")])],1)],1)],1)],1)],1)])],1),e("div",{directives:[{name:"show",rawName:"v-show",value:2===t.currentStep&&t.hasResult,expression:"currentStep === 2 && hasResult"}],staticClass:"result-section"},[t.backtestRunId?e("a-alert",{staticStyle:{"margin-bottom":"12px"},attrs:{type:"success","show-icon":"",message:t.$t("dashboard.indicator.backtest.savedRunId",{id:t.backtestRunId})}}):t._e(),e("div",{staticClass:"metrics-cards"},[e("div",{staticClass:"metric-card",class:{positive:t.result.totalReturn>0,negative:t.result.totalReturn<0}},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.totalReturn")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.formatPercent(t.result.totalReturn)))]),e("div",{staticClass:"metric-amount"},[t._v(t._s(t.formatMoney(t.result.totalProfit)))])]),e("div",{staticClass:"metric-card",class:{positive:t.result.annualReturn>0,negative:t.result.annualReturn<0}},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.annualReturn")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.formatPercent(t.result.annualReturn)))])]),e("div",{staticClass:"metric-card negative"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.maxDrawdown")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.formatPercent(t.result.maxDrawdown)))])]),e("div",{staticClass:"metric-card"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.sharpeRatio")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.result.sharpeRatio.toFixed(2)))])]),e("div",{staticClass:"metric-card"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.winRate")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.formatPercent(t.result.winRate)))])]),e("div",{staticClass:"metric-card",class:{positive:t.result.profitFactor>=1.5,negative:t.result.profitFactor<1}},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.profitFactor")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.result.profitFactor.toFixed(2)))])]),e("div",{staticClass:"metric-card"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.totalTrades")))]),e("div",{staticClass:"metric-value"},[t._v(t._s(t.result.totalTrades))])]),e("div",{staticClass:"metric-card negative"},[e("div",{staticClass:"metric-label"},[t._v(t._s(t.$t("dashboard.indicator.backtest.totalCommission")))]),e("div",{staticClass:"metric-value"},[t._v("-$"+t._s(t.result.totalCommission?t.result.totalCommission.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"))])])]),e("div",{staticClass:"chart-section"},[e("div",{staticClass:"chart-title"},[t._v(t._s(t.$t("dashboard.indicator.backtest.equityCurve")))]),e("div",{ref:"equityChartRef",staticClass:"equity-chart"})]),e("div",{staticClass:"trades-section"},[e("div",{staticClass:"chart-title"},[t._v(t._s(t.$t("dashboard.indicator.backtest.tradeHistory")))]),e("a-table",{attrs:{columns:t.tradeColumns,"data-source":t.result.trades,pagination:{pageSize:5,size:"small"},size:"small",scroll:{x:600}},scopedSlots:t._u([{key:"type",fn:function(a){return[e("a-tag",{attrs:{color:t.getTradeTypeColor(a)}},[t._v(" "+t._s(t.getTradeTypeText(a))+" ")])]}},{key:"balance",fn:function(a){return[e("span",{staticStyle:{color:"#1890ff","font-weight":"500"}},[t._v(" $"+t._s(a?a.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"--")+" ")])]}},{key:"profit",fn:function(a){return[e("span",{style:{color:a>0?"#52c41a":a<0?"#f5222d":"#666"}},[t._v(" "+t._s(t.formatMoney(a))+" ")])]}}])})],1)],1),t.loading?e("div",{staticClass:"loading-overlay"},[e("div",{staticClass:"loading-content"},[e("div",{staticClass:"loading-animation"},[e("div",{staticClass:"chart-bars"},[e("div",{staticClass:"bar bar1"}),e("div",{staticClass:"bar bar2"}),e("div",{staticClass:"bar bar3"}),e("div",{staticClass:"bar bar4"}),e("div",{staticClass:"bar bar5"})])]),e("div",{staticClass:"loading-text"},[t._v(t._s(t.$t("dashboard.indicator.backtest.running")))]),e("div",{staticClass:"loading-subtext"},[t._v(t._s(t.loadingTip))])])]):t._e()],1),e("template",{slot:"footer"},[e("div",{staticStyle:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},[e("div",[t.currentStep>0?e("a-button",{attrs:{disabled:t.loading},on:{click:t.handlePrev}},[t._v(t._s(t.$t("dashboard.indicator.backtest.prev")))]):t._e()],1),e("div",[e("a-button",{attrs:{disabled:t.loading},on:{click:t.handleCancel}},[t._v(t._s(t.$t("dashboard.indicator.backtest.close")))]),t.currentStep<1?e("a-button",{staticStyle:{"margin-left":"8px"},attrs:{type:"primary",disabled:t.loading},on:{click:t.handleNext}},[t._v(t._s(t.$t("dashboard.indicator.backtest.next")))]):1===t.currentStep?e("a-button",{staticStyle:{"margin-left":"8px"},attrs:{type:"primary",loading:t.loading},on:{click:t.handleRunBacktest}},[t._v(t._s(t.$t("dashboard.indicator.backtest.run")))]):e("a-button",{staticStyle:{"margin-left":"8px"},attrs:{type:"primary",disabled:t.loading},on:{click:t.handleRerun}},[t._v(t._s(t.$t("dashboard.indicator.backtest.rerun")))])],1)])])],2)},Vn=[],On=a(95093),Wn=a.n(On),Hn=a(29362),Yn={name:"BacktestModal",props:{visible:{type:Boolean,default:!1},userId:{type:[Number,String],default:1},indicator:{type:Object,default:null},symbol:{type:String,default:""},market:{type:String,default:""},timeframe:{type:String,default:"1D"}},data:function(){return{form:this.$form.createForm(this),loading:!1,loadingTip:"",loadingTimer:null,currentStep:0,hasResult:!1,backtestRunId:null,step1CollapseKeys:["risk"],trailingEnabledUi:!1,entryPctMaxUi:100,precisionInfo:null,selectedDatePreset:null,selectedTimeframe:"1D",result:{totalReturn:0,annualReturn:0,maxDrawdown:0,sharpeRatio:0,winRate:0,profitFactor:0,totalTrades:0,totalProfit:0,totalCommission:0,trades:[],equityCurve:[]},equityChart:null,tradeColumns:[]}},computed:{maxBacktestRange:function(){var t=this.selectedTimeframe||this.timeframe||"1D";return"1m"===t?{days:30,label:"1个月"}:"5m"===t?{days:180,label:"6个月"}:["15m","30m"].includes(t)?{days:365,label:"1年"}:{days:1095,label:"3年"}},recommendedRange:function(){return{days:30,label:"30天",key:"30d"}},combinedAlertType:function(){return this.precisionInfo&&this.precisionInfo.enabled?"high"===this.precisionInfo.precision?"success":"info":this.precisionInfo&&!this.precisionInfo.enabled&&this.market&&"crypto"===this.market.toLowerCase()?"warning":"info"},datePresets:function(){var t=[],e=this.selectedTimeframe||this.timeframe||"1D";return"1m"===e?(t.push({key:"7d",days:7,label:"7D"}),t.push({key:"14d",days:14,label:"14D"}),t.push({key:"30d",days:30,label:"30D"})):"5m"===e?(t.push({key:"14d",days:14,label:"14D"}),t.push({key:"30d",days:30,label:"30D"}),t.push({key:"90d",days:90,label:"3M"}),t.push({key:"180d",days:180,label:"6M"})):(["15m","30m"].includes(e),t.push({key:"30d",days:30,label:"30D"}),t.push({key:"90d",days:90,label:"3M"}),t.push({key:"180d",days:180,label:"6M"}),t.push({key:"365d",days:365,label:"1Y"})),t},defaultStartDate:function(){return Wn()().subtract(this.recommendedRange.days,"days")},defaultEndDate:function(){return Wn()()},earliestDate:function(){return Wn()().subtract(this.maxBacktestRange.days,"days")},labelCol:function(){return 0===this.currentStep?{span:9}:{span:6}},wrapperCol:function(){return 0===this.currentStep?{span:15}:{span:18}}},watch:{visible:function(t){var e=this;t?(this.currentStep=0,this.hasResult=!1,this.backtestRunId=null,this.step1CollapseKeys=["risk"],this.trailingEnabledUi=!1,this.entryPctMaxUi=100,this.precisionInfo=null,this.selectedDatePreset=null,this.selectedTimeframe=this.timeframe||"1D",this.result={totalReturn:0,annualReturn:0,maxDrawdown:0,sharpeRatio:0,winRate:0,profitFactor:0,totalTrades:0,totalProfit:0,totalCommission:0,trades:[],equityCurve:[]},this.$nextTick(function(){e.form&&(e.form.resetFields(),e.trailingEnabledUi=!!e.form.getFieldValue("trailingEnabled"),e.recalcEntryPctMaxUi(),e.selectedDatePreset="30d",e.fetchPrecisionInfo())})):this.equityChart&&(this.equityChart.dispose(),this.equityChart=null)}},created:function(){this.tradeColumns=[{title:this.$t("dashboard.indicator.backtest.tradeTime"),dataIndex:"time",key:"time",width:160},{title:this.$t("dashboard.indicator.backtest.tradeType"),dataIndex:"type",key:"type",width:120,scopedSlots:{customRender:"type"}},{title:this.$t("dashboard.indicator.backtest.price"),dataIndex:"price",key:"price",width:110},{title:this.$t("dashboard.indicator.backtest.amount"),dataIndex:"amount",key:"amount",width:100,customRender:function(t){return t?t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:4}):"--"}},{title:this.$t("dashboard.indicator.backtest.profit"),dataIndex:"profit",key:"profit",width:110,scopedSlots:{customRender:"profit"}},{title:this.$t("dashboard.indicator.backtest.balance"),dataIndex:"balance",key:"balance",width:130,scopedSlots:{customRender:"balance"}}]},methods:{recalcEntryPctMaxUi:function(){if(this.form){var t=!!this.form.getFieldValue("trendAddEnabled"),e=!!this.form.getFieldValue("dcaAddEnabled"),a=Number(this.form.getFieldValue("trendAddMaxTimes")||0),i=Number(this.form.getFieldValue("dcaAddMaxTimes")||0),n=Number(this.form.getFieldValue("trendAddSizePct")||0),r=Number(this.form.getFieldValue("dcaAddSizePct")||0),o=(t?a*n:0)+(e?i*r:0),s=Math.max(0,Math.min(100,100-o));this.entryPctMaxUi=s}else this.entryPctMaxUi=100},normalizeEntryPct:function(){if(this.form){var t=Number(this.form.getFieldValue("entryPct")||0),e=Number(this.entryPctMaxUi||100);t>e&&this.form.setFieldsValue({entryPct:e})}},onTrendAddToggle:function(t){var e=this;this.form&&(t&&this.form.setFieldsValue({dcaAddEnabled:!1}),this.$nextTick(function(){e.recalcEntryPctMaxUi(),e.normalizeEntryPct()}))},onDcaAddToggle:function(t){var e=this;this.form&&(t&&this.form.setFieldsValue({trendAddEnabled:!1}),this.$nextTick(function(){e.recalcEntryPctMaxUi(),e.normalizeEntryPct()}))},onScaleParamsChange:function(){var t=this;this.$nextTick(function(){t.recalcEntryPctMaxUi(),t.normalizeEntryPct()})},onEntryPctChange:function(){var t=this;this.$nextTick(function(){return t.normalizeEntryPct()})},onTrailingToggle:function(t){this.form&&(this.trailingEnabledUi=!!t,t||this.form.setFieldsValue({trailingStopPct:0,trailingActivationPct:0}))},getTradeTypeColor:function(t){var e={buy:"green",sell:"red",liquidation:"orange",open_long:"green",add_long:"cyan",close_long:"orange",close_long_stop:"red",close_long_profit:"lime",close_long_trailing:"gold",reduce_long:"volcano",open_short:"red",add_short:"magenta",close_short:"blue",close_short_stop:"red",close_short_profit:"cyan",close_short_trailing:"gold",reduce_short:"volcano"};return e[t]||"default"},getTradeTypeText:function(t){var e={buy:this.$t("dashboard.indicator.backtest.buy"),sell:this.$t("dashboard.indicator.backtest.sell"),liquidation:this.$t("dashboard.indicator.backtest.liquidation"),open_long:this.$t("dashboard.indicator.backtest.openLong"),add_long:this.$t("dashboard.indicator.backtest.addLong"),close_long:this.$t("dashboard.indicator.backtest.closeLong"),close_long_stop:this.$t("dashboard.indicator.backtest.closeLongStop"),close_long_profit:this.$t("dashboard.indicator.backtest.closeLongProfit"),close_long_trailing:this.$t("dashboard.indicator.backtest.closeLongTrailing"),reduce_long:this.$t("dashboard.indicator.backtest.reduceLong"),open_short:this.$t("dashboard.indicator.backtest.openShort"),add_short:this.$t("dashboard.indicator.backtest.addShort"),close_short:this.$t("dashboard.indicator.backtest.closeShort"),close_short_stop:this.$t("dashboard.indicator.backtest.closeShortStop"),close_short_profit:this.$t("dashboard.indicator.backtest.closeShortProfit"),close_short_trailing:this.$t("dashboard.indicator.backtest.closeShortTrailing"),reduce_short:this.$t("dashboard.indicator.backtest.reduceShort")};return e[t]||t},disabledStartDate:function(t){return!!t&&(t>Wn()().endOf("day")||t<this.earliestDate.startOf("day"))},disabledEndDate:function(t){if(!t)return!1;if(t>Wn()().endOf("day"))return!0;if(t<this.earliestDate.startOf("day"))return!0;var e=this.form.getFieldValue("startDate");if(e){var a=this.maxBacktestRange.days||365,i=Wn()(e).add(a,"days");if(t>i.endOf("day"))return!0}return!1},applyDatePreset:function(t){this.selectedDatePreset=t.key;var e=Wn()(),a=Wn()().subtract(t.days,"days");this.form.setFieldsValue({startDate:a,endDate:e}),this.fetchPrecisionInfo(a,e)},fetchPrecisionInfo:function(t,e){var a=this;return(0,c.A)((0,l.A)().m(function i(){var n;return(0,l.A)().w(function(i){while(1)switch(i.p=i.n){case 0:if(t&&e||(t=a.form?a.form.getFieldValue("startDate"):null,e=a.form?a.form.getFieldValue("endDate"):null),t||(t=a.defaultStartDate),e||(e=a.defaultEndDate),a.market&&"crypto"===a.market.toLowerCase()){i.n=1;break}return a.precisionInfo={enabled:!1,reason:"only_crypto",message:a.$t("dashboard.indicator.backtest.onlyCryptoSupported")},i.a(2);case 1:return i.p=1,i.n=2,(0,v.Ay)({url:"/api/indicator/backtest/precision-info",method:"get",params:{market:a.market,startDate:t.format("YYYY-MM-DD"),endDate:e.format("YYYY-MM-DD")},timeout:3e4});case 2:n=i.v,1===n.code&&n.data&&(a.precisionInfo=n.data),i.n=4;break;case 3:i.p=3,i.v,a.precisionInfo=null;case 4:return i.a(2)}},i,null,[[1,3]])}))()},onTimeframeChange:function(){this.selectedDatePreset="30d";var t=Wn()(),e=Wn()().subtract(30,"days");this.form.setFieldsValue({startDate:e,endDate:t}),this.fetchPrecisionInfo(e,t)},onDateChange:function(){var t=this;this.selectedDatePreset=null,this.$nextTick(function(){t.fetchPrecisionInfo()})},validateDateRange:function(t,e){if(!t||!e)return!0;var a=e.diff(t,"days"),i=this.maxBacktestRange.days||365;return!(a>i)||(this.$message.error(this.$t("dashboard.indicator.backtest.dateRangeExceededDays",{timeframe:this.selectedTimeframe||this.timeframe,maxRange:this.maxBacktestRange.label,maxDays:i})),!1)},formatPercent:function(t){if(null===t||void 0===t)return"--";var e=t>=0?"+":"";return"".concat(e).concat(t.toFixed(2),"%")},formatMoney:function(t){if(null===t||void 0===t)return"--";var e=t>=0?"+":"-";return"".concat(e,"$").concat(Math.abs(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}))},handleCancel:function(){this.$emit("cancel")},handlePrev:function(){this.loading||this.currentStep>0&&(this.currentStep-=1)},handleNext:function(){this.loading||(0!==this.currentStep?1===this.currentStep&&this.handleRunBacktest():this.currentStep=1)},handleRerun:function(){this.loading||(this.currentStep=1,this.hasResult=!1,this.backtestRunId=null)},startLoadingAnimation:function(){var t=this,e=[this.$t("dashboard.indicator.backtest.loadingTip1")||"正在获取历史K线数据...",this.$t("dashboard.indicator.backtest.loadingTip2")||"正在执行策略信号计算...",this.$t("dashboard.indicator.backtest.loadingTip3")||"正在模拟交易执行...",this.$t("dashboard.indicator.backtest.loadingTip4")||"正在计算回测指标...",this.$t("dashboard.indicator.backtest.loadingTip5")||"即将完成,请稍候..."],a=0;this.loadingTip=e[0],this.loadingTimer=setInterval(function(){a=(a+1)%e.length,t.loadingTip=e[a]},2e3)},stopLoadingAnimation:function(){this.loadingTimer&&(clearInterval(this.loadingTimer),this.loadingTimer=null),this.loadingTip=""},handleRunBacktest:function(){var t=this;return(0,c.A)((0,l.A)().m(function e(){var a;return(0,l.A)().w(function(e){while(1)switch(e.n){case 0:a=["startDate","endDate","initialCapital","commission","leverage","tradeDirection","slippage"],t.form.validateFields(a,function(){var e=(0,c.A)((0,l.A)().m(function e(a,i){var n,r,o,s,c,u,h,p,f;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!a){e.n=1;break}return e.a(2);case 1:if(n=(0,d.A)((0,d.A)({},t.form.getFieldsValue()||{}),i||{}),r=Date.now(),t.indicator&&t.indicator.id){e.n=2;break}return t.$message.error(t.$t("dashboard.indicator.backtest.noIndicatorCode")),e.a(2);case 2:if(t.symbol){e.n=3;break}return t.$message.error(t.$t("dashboard.indicator.backtest.noSymbol")),e.a(2);case 3:if(t.validateDateRange(i.startDate,i.endDate)){e.n=4;break}return e.a(2);case 4:return t.loading=!0,t.hasResult=!1,t.startLoadingAnimation(),e.p=5,o=function(t){return Number(t||0)/100},s={risk:{stopLossPct:o(n.stopLossPct),takeProfitPct:o(n.takeProfitPct),trailing:{enabled:!!n.trailingEnabled,pct:o(n.trailingStopPct),activationPct:o(n.trailingActivationPct)}},position:{entryPct:o(n.entryPct||0)},scale:{trendAdd:{enabled:!!n.trendAddEnabled,stepPct:o(n.trendAddStepPct),sizePct:o(n.trendAddSizePct),maxTimes:n.trendAddMaxTimes||0},dcaAdd:{enabled:!!n.dcaAddEnabled,stepPct:o(n.dcaAddStepPct),sizePct:o(n.dcaAddSizePct),maxTimes:n.dcaAddMaxTimes||0},trendReduce:{enabled:!!n.trendReduceEnabled,stepPct:o(n.trendReduceStepPct),sizePct:o(n.trendReduceSizePct),maxTimes:n.trendReduceMaxTimes||0},adverseReduce:{enabled:!!n.adverseReduceEnabled,stepPct:o(n.adverseReduceStepPct),sizePct:o(n.adverseReduceSizePct),maxTimes:n.adverseReduceMaxTimes||0}}},c={userid:t.userId||1,indicatorId:t.indicator.id,symbol:t.symbol,market:t.market,timeframe:t.selectedTimeframe||t.timeframe,startDate:i.startDate.format("YYYY-MM-DD"),endDate:i.endDate.format("YYYY-MM-DD"),initialCapital:i.initialCapital,commission:o(i.commission||0),slippage:o(i.slippage||0),leverage:i.leverage||1,tradeDirection:i.tradeDirection||"long",strategyConfig:s,enableMtf:t.market&&"crypto"===t.market.toLowerCase()},e.n=6,(0,v.Ay)({url:"/api/indicator/backtest",method:"post",data:c,timeout:6e5});case 6:u=e.v,((Date.now()-r)/1e3).toFixed(1),1===u.code&&u.data?(u.data.runId&&(t.backtestRunId=u.data.runId),t.result=u.data.result||u.data,t.hasResult=!0,t.currentStep=2,t.$nextTick(function(){t.renderEquityChart()}),t.$message.success(t.$t("dashboard.indicator.backtest.success"))):t.$message.error(u.msg||t.$t("dashboard.indicator.backtest.failed")),e.n=8;break;case 7:e.p=7,f=e.v,h=t.$t("dashboard.indicator.backtest.failed"),"ECONNABORTED"===f.code||f.message&&f.message.includes("timeout")?h="回测超时,请减少回测时间范围或使用更大的时间周期":f.response?h=(null===(p=f.response.data)||void 0===p?void 0:p.msg)||f.response.statusText||h:f.message&&(h=f.message),t.$message.error(h);case 8:return e.p=8,t.stopLoadingAnimation(),t.loading=!1,e.f(8);case 9:return e.a(2)}},e,null,[[5,7,8,9]])}));return function(t,a){return e.apply(this,arguments)}}());case 1:return e.a(2)}},e)}))()},renderEquityChart:function(){var t=this;if(this.$refs.equityChartRef){this.equityChart&&this.equityChart.dispose(),this.equityChart=Hn.init(this.$refs.equityChartRef);var e=this.result.equityCurve||[],a=e.map(function(t){return t.time||t.date}),i=e.map(function(t){return void 0!==t.value?t.value:t.equity}),n=i[0]||1e5,r=i[i.length-1]||n,o=r>=n,s=o?"#52c41a":"#f5222d",l=o?[{offset:0,color:"rgba(82, 196, 26, 0.35)"},{offset:1,color:"rgba(82, 196, 26, 0.02)"}]:[{offset:0,color:"rgba(245, 34, 45, 0.35)"},{offset:1,color:"rgba(245, 34, 45, 0.02)"}],c={tooltip:{trigger:"axis",backgroundColor:"rgba(255, 255, 255, 0.96)",borderColor:"#e8e8e8",borderWidth:1,textStyle:{color:"#333"},formatter:function(t){var e='<div style="font-weight: 600; margin-bottom: 8px; color: #262626;">'.concat(t[0].axisValue,"</div>");return t.forEach(function(t){if(void 0!==t.value&&null!==t.value){var a=t.value.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});e+='<div style="display: flex; justify-content: space-between; gap: 24px; margin: 4px 0;">\n <span>'.concat(t.marker," ").concat(t.seriesName,'</span>\n <span style="font-weight: 600; color: ').concat(s,';">$').concat(a,"</span>\n </div>")}}),e}},legend:{show:!1},grid:{left:"3%",right:"4%",bottom:"12%",top:"8%",containLabel:!0},xAxis:{type:"category",data:a,boundaryGap:!1,axisLine:{lineStyle:{color:"#e8e8e8"}},axisTick:{show:!1},axisLabel:{color:"#8c8c8c",fontSize:11,rotate:0,interval:Math.floor(a.length/6)}},yAxis:{type:"value",splitLine:{lineStyle:{color:"#f5f5f5",type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#8c8c8c",fontSize:11,formatter:function(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(0)+"K":t}}},series:[{name:this.$t("dashboard.indicator.backtest.strategy"),type:"line",data:i,smooth:.4,symbol:"none",sampling:"lttb",lineStyle:{width:2.5,color:s,cap:"round",join:"round"},areaStyle:{color:new Hn.graphic.LinearGradient(0,0,0,1,l)},emphasis:{lineStyle:{width:3}}}],animation:!0,animationDuration:800,animationEasing:"cubicOut"};this.equityChart.setOption(c),window.addEventListener("resize",function(){t.equityChart&&t.equityChart.resize()})}}},beforeDestroy:function(){this.equityChart&&(this.equityChart.dispose(),this.equityChart=null)}},Kn=Yn,Xn=(0,E.A)(Kn,zn,Vn,!1,null,"473e449c",null),qn=Xn.exports,Un=function(){var t=this,e=t._self._c;return e("a-drawer",{attrs:{title:t.$t("dashboard.indicator.backtest.historyTitle"),visible:t.visible,width:t.isMobile?"100%":980,maskClosable:!0},on:{close:function(e){return t.$emit("cancel")}}},[e("div",{staticStyle:{display:"flex",gap:"12px","margin-bottom":"12px","align-items":"center","flex-wrap":"wrap"}},[e("a-switch",{model:{value:t.useCurrentFilters,callback:function(e){t.useCurrentFilters=e},expression:"useCurrentFilters"}}),e("span",{staticStyle:{color:"#8c8c8c"}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.historyUseCurrent"))+" ")]),e("a-button",{attrs:{type:"primary",loading:t.loading},on:{click:t.loadRuns}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.historyRefresh"))+" ")]),e("a-button",{attrs:{type:"primary",disabled:0===t.selectedRowKeys.length,loading:t.analyzing},on:{click:t.handleAIAnalyze}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.historyAIAnalyze"))+" ")])],1),t.useCurrentFilters?t._e():e("div",{staticStyle:{display:"flex",gap:"12px","margin-bottom":"12px","align-items":"center","flex-wrap":"wrap"}},[e("a-input",{staticStyle:{width:"220px"},attrs:{placeholder:t.$t("dashboard.indicator.backtest.historyFilterSymbol")},model:{value:t.filterSymbol,callback:function(e){t.filterSymbol=e},expression:"filterSymbol"}}),e("a-select",{staticStyle:{width:"140px"},attrs:{placeholder:t.$t("dashboard.indicator.backtest.historyFilterTimeframe"),allowClear:""},model:{value:t.filterTimeframe,callback:function(e){t.filterTimeframe=e},expression:"filterTimeframe"}},t._l(t.timeframes,function(a){return e("a-select-option",{key:a,attrs:{value:a}},[t._v(t._s(a))])}),1),e("a-button",{attrs:{loading:t.loading},on:{click:t.loadRuns}},[t._v(t._s(t.$t("dashboard.indicator.backtest.historyApply")))]),e("span",{staticStyle:{color:"#8c8c8c"}},[t._v(t._s(t.filterLabel))])],1),e("a-table",{attrs:{columns:t.columns,"data-source":t.runs,loading:t.loading,size:"small",pagination:{pageSize:10,size:"small"},rowKey:"id",scroll:{x:900},rowSelection:{selectedRowKeys:t.selectedRowKeys,onChange:t.onRowSelectionChange}},scopedSlots:t._u([{key:"range",fn:function(a,i){return[e("span",[t._v(t._s(i.start_date||"")+" ~ "+t._s(i.end_date||""))])]}},{key:"status",fn:function(a){return[e("a-tag",{attrs:{color:"success"===a?"green":"failed"===a?"red":"blue"}},[t._v(" "+t._s("success"===a?t.$t("dashboard.indicator.backtest.historyStatusSuccess"):"failed"===a?t.$t("dashboard.indicator.backtest.historyStatusFailed"):a)+" ")])]}},{key:"actions",fn:function(a,i){return[e("a-button",{attrs:{type:"link",size:"small",loading:t.detailLoadingId===i.id},on:{click:function(e){return t.viewRun(i)}}},[t._v(" "+t._s(t.$t("dashboard.indicator.backtest.historyView"))+" ")])]}}])}),t.loading||0!==t.runs.length?t._e():e("a-empty",{attrs:{description:t.$t("dashboard.indicator.backtest.historyNoData")}}),e("a-modal",{attrs:{title:t.$t("dashboard.indicator.backtest.historyAIAnalyzeTitle"),visible:t.showAIResult,footer:null,width:t.isMobile?"100%":900},on:{cancel:function(e){t.showAIResult=!1}}},[t.analyzing?e("div",{staticStyle:{padding:"12px 0"}},[e("a-spin")],1):e("div",{staticStyle:{"white-space":"pre-wrap","font-family":"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"}},[t._v(" "+t._s(t.aiResult||t.$t("dashboard.indicator.backtest.historyNoAIResult"))+" ")])])],1)},jn=[],Gn={name:"BacktestHistoryDrawer",props:{visible:{type:Boolean,default:!1},userId:{type:[Number,String],default:1},indicatorId:{type:[Number,String],default:null},symbol:{type:String,default:""},market:{type:String,default:""},timeframe:{type:String,default:""},isMobile:{type:Boolean,default:!1}},data:function(){return{loading:!1,detailLoadingId:null,analyzing:!1,showAIResult:!1,aiResult:"",useCurrentFilters:!0,filterSymbol:"",filterTimeframe:"",timeframes:["1m","5m","15m","30m","1H","4H","1D","1W"],runs:[],columns:[],selectedRowKeys:[]}},computed:{filterLabel:function(){var t=[];this.indicatorId&&t.push("indicatorId=".concat(this.indicatorId));var e=this.useCurrentFilters?this.market:this.market||"",a=this.useCurrentFilters?this.symbol:this.filterSymbol||"",i=this.useCurrentFilters?this.timeframe:this.filterTimeframe||"";return e&&t.push("market=".concat(e)),a&&t.push("symbol=".concat(a)),i&&t.push("timeframe=".concat(i)),t.length?t.join(" | "):""}},watch:{visible:function(t){t&&(this.initColumns(),this.useCurrentFilters=!0,this.filterSymbol=this.symbol||"",this.filterTimeframe=this.timeframe||"",this.selectedRowKeys=[],this.aiResult="",this.showAIResult=!1,this.loadRuns())}},methods:{onRowSelectionChange:function(t){this.selectedRowKeys=t||[]},initColumns:function(){this.columns.length||(this.columns=[{title:this.$t("dashboard.indicator.backtest.historyRunId"),dataIndex:"id",key:"id",width:90},{title:this.$t("dashboard.indicator.backtest.historyCreatedAt"),dataIndex:"created_at",key:"created_at",width:140},{title:this.$t("dashboard.indicator.backtest.tradeDirection"),dataIndex:"trade_direction",key:"trade_direction",width:90},{title:this.$t("dashboard.indicator.backtest.leverage"),dataIndex:"leverage",key:"leverage",width:90},{title:this.$t("dashboard.indicator.backtest.historyRange"),key:"range",width:220,scopedSlots:{customRender:"range"}},{title:this.$t("dashboard.indicator.backtest.historyStatus"),dataIndex:"status",key:"status",width:90,scopedSlots:{customRender:"status"}},{title:this.$t("dashboard.indicator.backtest.historyActions"),key:"actions",width:90,scopedSlots:{customRender:"actions"}}])},loadRuns:function(){var t=this;return(0,c.A)((0,l.A)().m(function e(){var a,i,n,r;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.userId){e.n=1;break}return e.a(2);case 1:return t.loading=!0,e.p=2,a=t.useCurrentFilters?t.symbol:t.filterSymbol||"",i=t.useCurrentFilters?t.timeframe:t.filterTimeframe||"",n=t.market||"",e.n=3,(0,v.Ay)({url:"/api/indicator/backtest/history",method:"get",params:{userid:t.userId,limit:100,offset:0,indicatorId:t.indicatorId,symbol:a,market:n,timeframe:i}});case 3:r=e.v,r&&1===r.code&&Array.isArray(r.data)?t.runs=r.data:t.runs=[];case 4:return e.p=4,t.loading=!1,e.f(4);case 5:return e.a(2)}},e,null,[[2,,4,5]])}))()},viewRun:function(t){var e=this;return(0,c.A)((0,l.A)().m(function a(){var i;return(0,l.A)().w(function(a){while(1)switch(a.p=a.n){case 0:if(t&&t.id){a.n=1;break}return a.a(2);case 1:return e.detailLoadingId=t.id,a.p=2,a.n=3,(0,v.Ay)({url:"/api/indicator/backtest/get",method:"get",params:{userid:e.userId,runId:t.id}});case 3:i=a.v,i&&1===i.code&&i.data&&e.$emit("view",i.data);case 4:return a.p=4,e.detailLoadingId=null,a.f(4);case 5:return a.a(2)}},a,null,[[2,,4,5]])}))()},handleAIAnalyze:function(){var t=this;return(0,c.A)((0,l.A)().m(function e(){var a,i;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.userId&&t.selectedRowKeys.length){e.n=1;break}return e.a(2);case 1:return t.analyzing=!0,t.showAIResult=!0,t.aiResult="",e.p=2,a=t.$i18n&&t.$i18n.locale?t.$i18n.locale:"zh-CN",e.n=3,(0,v.Ay)({url:"/api/indicator/backtest/aiAnalyze",method:"post",data:{userid:t.userId,runIds:t.selectedRowKeys,lang:a}});case 3:i=e.v,i&&1===i.code&&i.data&&i.data.analysis?t.aiResult=i.data.analysis:t.aiResult=i.msg||t.$t("dashboard.indicator.backtest.historyNoAIResult");case 4:return e.p=4,t.analyzing=!1,e.f(4);case 5:return e.a(2)}},e,null,[[2,,4,5]])}))()}}},Zn=Gn,Jn=(0,E.A)(Zn,Un,jn,!1,null,null,null),Qn=Jn.exports,tr=function(){var t,e,a,i=this,n=i._self._c;return n("a-modal",{staticClass:"backtest-run-viewer",attrs:{title:i.modalTitle,visible:i.visible,width:1100,maskClosable:!1},on:{cancel:function(t){return i.$emit("cancel")}}},[i.run&&i.run.result?n("div",[i.run.id?n("a-alert",{staticStyle:{"margin-bottom":"12px"},attrs:{type:"info","show-icon":"",message:i.$t("dashboard.indicator.backtest.savedRunId",{id:i.run.id})}}):i._e(),n("div",{staticClass:"metrics-cards"},[n("div",{staticClass:"metric-card",class:{positive:i.result.totalReturn>0,negative:i.result.totalReturn<0}},[n("div",{staticClass:"metric-label"},[i._v(i._s(i.$t("dashboard.indicator.backtest.totalReturn")))]),n("div",{staticClass:"metric-value"},[i._v(i._s(i.formatPercent(i.result.totalReturn)))]),n("div",{staticClass:"metric-amount"},[i._v(i._s(i.formatMoney(i.result.totalProfit)))])]),n("div",{staticClass:"metric-card",class:{positive:i.result.annualReturn>0,negative:i.result.annualReturn<0}},[n("div",{staticClass:"metric-label"},[i._v(i._s(i.$t("dashboard.indicator.backtest.annualReturn")))]),n("div",{staticClass:"metric-value"},[i._v(i._s(i.formatPercent(i.result.annualReturn)))])]),n("div",{staticClass:"metric-card negative"},[n("div",{staticClass:"metric-label"},[i._v(i._s(i.$t("dashboard.indicator.backtest.maxDrawdown")))]),n("div",{staticClass:"metric-value"},[i._v(i._s(i.formatPercent(i.result.maxDrawdown)))])]),n("div",{staticClass:"metric-card"},[n("div",{staticClass:"metric-label"},[i._v(i._s(i.$t("dashboard.indicator.backtest.sharpeRatio")))]),n("div",{staticClass:"metric-value"},[i._v(i._s((null!==(t=i.result.sharpeRatio)&&void 0!==t?t:0).toFixed(2)))])]),n("div",{staticClass:"metric-card"},[n("div",{staticClass:"metric-label"},[i._v(i._s(i.$t("dashboard.indicator.backtest.winRate")))]),n("div",{staticClass:"metric-value"},[i._v(i._s(i.formatPercent(i.result.winRate)))])]),n("div",{staticClass:"metric-card",class:{positive:i.result.profitFactor>=1.5,negative:i.result.profitFactor<1}},[n("div",{staticClass:"metric-label"},[i._v(i._s(i.$t("dashboard.indicator.backtest.profitFactor")))]),n("div",{staticClass:"metric-value"},[i._v(i._s((null!==(e=i.result.profitFactor)&&void 0!==e?e:0).toFixed(2)))])]),n("div",{staticClass:"metric-card"},[n("div",{staticClass:"metric-label"},[i._v(i._s(i.$t("dashboard.indicator.backtest.totalTrades")))]),n("div",{staticClass:"metric-value"},[i._v(i._s(null!==(a=i.result.totalTrades)&&void 0!==a?a:0))])]),n("div",{staticClass:"metric-card negative"},[n("div",{staticClass:"metric-label"},[i._v(i._s(i.$t("dashboard.indicator.backtest.totalCommission")))]),n("div",{staticClass:"metric-value"},[i._v("-$"+i._s(i.result.totalCommission?i.result.totalCommission.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"))])])]),n("div",{staticClass:"chart-section"},[n("div",{staticClass:"chart-title"},[i._v(i._s(i.$t("dashboard.indicator.backtest.equityCurve")))]),n("div",{ref:"equityChartRef",staticClass:"equity-chart"})]),n("div",{staticClass:"trades-section"},[n("div",{staticClass:"chart-title"},[i._v(i._s(i.$t("dashboard.indicator.backtest.tradeHistory")))]),n("a-table",{attrs:{columns:i.tradeColumns,"data-source":i.result.trades||[],pagination:{pageSize:10,size:"small"},size:"small",scroll:{x:800},rowKey:i.rowKey},scopedSlots:i._u([{key:"type",fn:function(t){return[n("a-tag",{attrs:{color:i.getTradeTypeColor(t)}},[i._v(" "+i._s(i.getTradeTypeText(t))+" ")])]}},{key:"balance",fn:function(t){return[n("span",{staticStyle:{color:"#1890ff","font-weight":"500"}},[i._v(" $"+i._s(t?t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"--")+" ")])]}},{key:"profit",fn:function(t){return[n("span",{style:{color:t>0?"#52c41a":t<0?"#f5222d":"#666"}},[i._v(" "+i._s(i.formatMoney(t))+" ")])]}}])})],1)],1):n("div",{staticStyle:{padding:"12px 0"}},[n("a-empty",{attrs:{description:i.$t("dashboard.indicator.backtest.historyNoData")}})],1),n("template",{slot:"footer"},[n("a-button",{on:{click:function(t){return i.$emit("cancel")}}},[i._v(i._s(i.$t("dashboard.indicator.backtest.close")))])],1)],2)},er=[],ar={name:"BacktestRunViewer",props:{visible:{type:Boolean,default:!1},run:{type:Object,default:null}},data:function(){return{equityChart:null,tradeColumns:[]}},computed:{result:function(){return this.run&&this.run.result?this.run.result:{}},modalTitle:function(){var t=this.run&&this.run.id?"#".concat(this.run.id):"";return"".concat(this.$t("dashboard.indicator.backtest.historyTitle")," ").concat(t).trim()}},watch:{visible:function(t){var e=this;t?this.$nextTick(function(){e.initColumns(),e.renderEquityChart()}):this.equityChart&&(this.equityChart.dispose(),this.equityChart=null)}},methods:{rowKey:function(t,e){return e},initColumns:function(){this.tradeColumns.length||(this.tradeColumns=[{title:this.$t("dashboard.indicator.backtest.tradeTime"),dataIndex:"time",key:"time",width:160},{title:this.$t("dashboard.indicator.backtest.tradeType"),dataIndex:"type",key:"type",width:150,scopedSlots:{customRender:"type"}},{title:this.$t("dashboard.indicator.backtest.price"),dataIndex:"price",key:"price",width:110},{title:this.$t("dashboard.indicator.backtest.amount"),dataIndex:"amount",key:"amount",width:100},{title:this.$t("dashboard.indicator.backtest.profit"),dataIndex:"profit",key:"profit",width:110,scopedSlots:{customRender:"profit"}},{title:this.$t("dashboard.indicator.backtest.balance"),dataIndex:"balance",key:"balance",width:120,scopedSlots:{customRender:"balance"}}])},getTradeTypeColor:function(t){var e={buy:"green",sell:"red",liquidation:"orange",open_long:"green",add_long:"cyan",close_long:"orange",close_long_stop:"red",close_long_profit:"lime",close_long_trailing:"gold",reduce_long:"volcano",open_short:"red",add_short:"magenta",close_short:"blue",close_short_stop:"red",close_short_profit:"cyan",close_short_trailing:"gold",reduce_short:"volcano"};return e[t]||"default"},getTradeTypeText:function(t){var e={open_long:this.$t("dashboard.indicator.backtest.openLong"),add_long:this.$t("dashboard.indicator.backtest.addLong"),close_long:this.$t("dashboard.indicator.backtest.closeLong"),close_long_stop:this.$t("dashboard.indicator.backtest.closeLongStop"),close_long_profit:this.$t("dashboard.indicator.backtest.closeLongProfit"),close_long_trailing:this.$t("dashboard.indicator.backtest.closeLongTrailing"),reduce_long:this.$t("dashboard.indicator.backtest.reduceLong"),open_short:this.$t("dashboard.indicator.backtest.openShort"),add_short:this.$t("dashboard.indicator.backtest.addShort"),close_short:this.$t("dashboard.indicator.backtest.closeShort"),close_short_stop:this.$t("dashboard.indicator.backtest.closeShortStop"),close_short_profit:this.$t("dashboard.indicator.backtest.closeShortProfit"),close_short_trailing:this.$t("dashboard.indicator.backtest.closeShortTrailing"),reduce_short:this.$t("dashboard.indicator.backtest.reduceShort"),liquidation:this.$t("dashboard.indicator.backtest.liquidation")};return e[t]||t},formatPercent:function(t){if(null===t||void 0===t)return"--";var e=t>=0?"+":"";return"".concat(e).concat(Number(t).toFixed(2),"%")},formatMoney:function(t){if(null===t||void 0===t)return"--";var e=t>=0?"+":"-";return"".concat(e,"$").concat(Math.abs(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}))},renderEquityChart:function(){var t=this;if(this.$refs.equityChartRef){this.equityChart&&this.equityChart.dispose(),this.equityChart=Hn.init(this.$refs.equityChartRef);var e=this.result.equityCurve||[],a=e.map(function(t){return t.time||t.date}),i=e.map(function(t){return void 0!==t.value?t.value:t.equity}),n=i[0]||1e5,r=i[i.length-1]||n,o=r>=n,s=o?"#52c41a":"#f5222d",l=o?[{offset:0,color:"rgba(82, 196, 26, 0.35)"},{offset:1,color:"rgba(82, 196, 26, 0.02)"}]:[{offset:0,color:"rgba(245, 34, 45, 0.35)"},{offset:1,color:"rgba(245, 34, 45, 0.02)"}],c={tooltip:{trigger:"axis"},grid:{left:"3%",right:"4%",bottom:"12%",top:"8%",containLabel:!0},xAxis:{type:"category",data:a,boundaryGap:!1},yAxis:{type:"value"},series:[{name:this.$t("dashboard.indicator.backtest.strategy"),type:"line",data:i,smooth:.4,symbol:"none",sampling:"lttb",lineStyle:{width:2.5,color:s},areaStyle:{color:new Hn.graphic.LinearGradient(0,0,0,1,l)}}]};this.equityChart.setOption(c),window.addEventListener("resize",function(){return t.equityChart&&t.equityChart.resize()})}}}},ir=ar,nr=(0,E.A)(ir,tr,er,!1,null,"a484239a",null),rr=nr.exports,or=a(62611),sr={name:"DashboardIndicator",components:{IndicatorEditor:P,KlineChart:$n,BacktestModal:qn,BacktestHistoryDrawer:Qn,BacktestRunViewer:rr,QuickTradePanel:or.A},computed:(0,d.A)((0,d.A)({},(0,p.aH)({navTheme:function(t){return t.app.theme}})),{},{chartTheme:function(){return"dark"===this.navTheme||"realdark"===this.navTheme?"dark":"light"},isDarkTheme:function(){return"dark"===this.navTheme||"realdark"===this.navTheme}}),setup:function(){var t=(0,h.nI)(),e=t||{},a=e.proxy,i=(0,h.KR)(1),n=(0,h.KR)(!1),p=(0,h.KR)(void 0),m=(0,h.KR)([]),y=(0,h.KR)([]),b=(0,h.KR)(!1),_=(0,h.KR)(""),x=(0,h.KR)(!1),w=(0,h.KR)(!1),S=(0,h.KR)(!1),k=(0,h.KR)(""),C=(0,h.KR)(""),I=(0,h.KR)([]),E=(0,h.KR)(!1),A=(0,h.KR)([]),P=(0,h.KR)(!1),D=(0,h.KR)(null),T=(0,h.KR)(null),M=(0,h.KR)([]),R=(0,h.KR)(!1),F=(0,h.KR)(!1),B=(0,h.KR)(""),L=(0,h.KR)(""),N=(0,h.KR)(0),$=(0,h.EW)(function(){return"crypto"===(Y.value||"").toLowerCase()}),z=function(){$.value?(B.value=H.value||"",N.value=parseFloat(K.value)||0,L.value="",F.value=!0):u.A.warning(a.$t("quickTrade.cryptoOnly"))},V=function(){u.A.success(a.$t("quickTrade.orderSuccess"))},O=function(t){t&&$.value&&(B.value=t)},W=function(){a&&a.$router&&a.$router.push("/indicator-community")},H=(0,h.KR)(""),Y=(0,h.KR)(""),K=(0,h.KR)("--"),X=(0,h.KR)(0),q=(0,h.EW)(function(){return X.value>0?"color-up":X.value<0?"color-down":""}),U=(0,h.KR)("1D"),j=(0,h.KR)([]),G=(0,h.KR)(!1),Z=[{id:"sma5",name:"SMA5 (5日均线)",shortName:"SMA5",type:"line",defaultParams:{length:5}},{id:"sma10",name:"SMA10 (10日均线)",shortName:"SMA10",type:"line",defaultParams:{length:10}},{id:"sma20",name:"SMA20 (20日均线)",shortName:"SMA20",type:"line",defaultParams:{length:20}},{id:"sma30",name:"SMA30 (30日均线)",shortName:"SMA30",type:"line",defaultParams:{length:30}}],J=[{id:"ema5",name:"EMA5 (5日指数均线)",shortName:"EMA5",type:"line",defaultParams:{length:5}},{id:"ema10",name:"EMA10 (10日指数均线)",shortName:"EMA10",type:"line",defaultParams:{length:10}},{id:"ema20",name:"EMA20 (20日指数均线)",shortName:"EMA20",type:"line",defaultParams:{length:20}},{id:"ema30",name:"EMA30 (30日指数均线)",shortName:"EMA30",type:"line",defaultParams:{length:30}}],Q=(0,h.KR)([]),tt=(0,h.KR)([]),et=(0,h.KR)(!1),at=(0,h.KR)(!1),it=(0,h.KR)(null),nt=(0,h.KR)(""),rt=(0,h.KR)([]),ot=(0,h.KR)({}),st=(0,h.KR)(!1),lt=(0,h.KR)({}),ct=(0,h.KR)(!1),ut=(0,h.KR)(!1),dt=(0,h.KR)(!1),ht=(0,h.KR)(null),pt=(0,h.KR)(!1),vt=(0,h.KR)(null),ft=(0,h.KR)(!1),gt=(0,h.KR)(null),mt=(0,h.KR)(!1),yt=(0,h.KR)(null),bt=(0,h.KR)(!1),_t=(0,h.KR)(null),xt=(0,h.KR)(!1),wt=(0,h.KR)(!1),St=(0,h.KR)("free"),kt=(0,h.KR)(10),Ct=(0,h.KR)(""),It=(0,h.KR)(!1),Et={price:[{required:!0,message:"请输入价格",trigger:"blur",type:"number"}]},At=(0,h.KR)(!1),Pt=function(t){var e=t.price,a=t.change;K.value=e,X.value=a},Dt=function(){},Tt=(0,h.KR)([]),Mt=(0,h.KR)([]),Rt=function(t){U.value=t},Ft=function(t){return t?Object.values(t).join(", "):""},Bt=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,a,r,o,s,c;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value=!0,t.p=1,r=(0,h.nI)(),o=null===r||void 0===r||null===(e=r.proxy)||void 0===e?void 0:e.$store,s=(null===o||void 0===o||null===(a=o.getters)||void 0===a?void 0:a.userInfo)||{},!s||!s.email){t.n=2;break}return i.value=s.id,n.value=!1,Lt(),ne(),t.a(2);case 2:return t.n=3,(0,g.ug)();case 3:c=t.v,c&&1===c.code&&c.data&&(i.value=c.data.id,o&&o.commit("SET_INFO",c.data),Lt(),ne()),t.n=5;break;case 4:t.p=4,t.v;case 5:return t.p=5,n.value=!1,t.f(5);case 6:return t.a(2)}},t,null,[[1,4,5,6]])}));return function(){return t.apply(this,arguments)}}(),Lt=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,n;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(i.value){t.n=1;break}return t.a(2);case 1:return b.value=!0,t.p=2,t.n=3,(0,f.Qo)({userid:i.value});case 3:e=t.v,e&&1===e.code&&e.data&&(y.value=e.data.map(function(t){return(0,d.A)((0,d.A)({},t),{},{label:t.symbol+(t.name?" (".concat(t.name,")"):""),value:"".concat(t.market,":").concat(t.symbol)})}),Nt(),y.value.length>0&&!H.value&&(n=y.value[0],Y.value=n.market,H.value=n.symbol,p.value=n.value)),t.n=5;break;case 4:t.p=4,t.v,u.A.error(a.$t("dashboard.indicator.error.loadWatchlistFailed"));case 5:return t.p=5,b.value=!1,t.f(5);case 6:return t.a(2)}},t,null,[[2,4,5,6]])}));return function(){return t.apply(this,arguments)}}(),Nt=function(){_.value?m.value=y.value.filter(function(t){return t.symbol.toLowerCase().includes(_.value.toLowerCase())||t.name&&t.name.toLowerCase().includes(_.value.toLowerCase())}):m.value=y.value},$t=function(t){_.value=t,0===y.value.length&&t&&(x.value=!0),Nt()},zt=function(t){x.value=t,t||(_.value="")},Vt=function(t){if("__empty_watchlist_hint__"!==t){if("__add_stock_option__"===t)return w.value=!0,void setTimeout(function(){p.value=void 0},0);var e=y.value.find(function(e){return e.value===t});if(e||(e=m.value.find(function(e){return e.value===t})),!e&&t.includes(":")){var a=t.split(":"),i=(0,s.A)(a,2),n=i[0],r=i[1];e={market:n,symbol:r,value:t}}e&&(Y.value=e.market,H.value=e.symbol,p.value=e.value)}},Ot=function(t,e){var a,i=(null===(a=e.componentOptions)||void 0===a||null===(a=a.propsData)||void 0===a?void 0:a.value)||"";return"__empty_watchlist_hint__"===i||"__add_stock_option__"===i||i.toLowerCase().includes(t.toLowerCase())},Wt=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:return t.p=0,t.n=1,(0,f.iO)();case 1:e=t.v,e&&1===e.code&&e.data&&Array.isArray(e.data)?M.value=e.data.map(function(t){return{value:t.value,i18nKey:t.i18nKey||"dashboard.analysis.market.".concat(t.value)}}):e&&1===e.code&&e.data&&"object"===(0,o.A)(e.data)?M.value=Object.keys(e.data).map(function(t){return{value:t,i18nKey:"dashboard.analysis.market.".concat(t)}}):M.value=[{value:"USStock",i18nKey:"dashboard.analysis.market.USStock"},{value:"Crypto",i18nKey:"dashboard.analysis.market.Crypto"},{value:"Forex",i18nKey:"dashboard.analysis.market.Forex"},{value:"Futures",i18nKey:"dashboard.analysis.market.Futures"}],M.value.length>0&&!k.value&&(k.value=M.value[0].value),t.n=3;break;case 2:t.p=2,t.v,M.value=[{value:"USStock",i18nKey:"dashboard.analysis.market.USStock"},{value:"Crypto",i18nKey:"dashboard.analysis.market.Crypto"},{value:"Forex",i18nKey:"dashboard.analysis.market.Forex"},{value:"Futures",i18nKey:"dashboard.analysis.market.Futures"}];case 3:return t.a(2)}},t,null,[[0,2]])}));return function(){return t.apply(this,arguments)}}(),Ht=function(){w.value=!1,D.value=null,C.value="",I.value=[],R.value=!1,k.value=M.value.length>0?M.value[0].value:""},Yt=function(t){k.value=t,C.value="",I.value=[],D.value=null,R.value=!1,Gt(t)},Kt=function(t){var e=t.target.value;if(C.value=e,T.value&&clearTimeout(T.value),!e||""===e.trim())return I.value=[],R.value=!1,void(D.value=null);T.value=setTimeout(function(){qt(e)},500)},Xt=function(t){t&&t.trim()&&(k.value?I.value.length>0||(R.value&&0===I.value.length?Ut():qt(t)):u.A.warning(a.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")))},qt=function(){var t=(0,c.A)((0,l.A)().m(function t(e){var i;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e&&""!==e.trim()){t.n=1;break}return I.value=[],R.value=!1,t.a(2);case 1:if(k.value){t.n=2;break}return u.A.warning(a.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")),t.a(2);case 2:return E.value=!0,R.value=!0,t.p=3,t.n=4,(0,f._3)({market:k.value,keyword:e.trim(),limit:20});case 4:i=t.v,i&&1===i.code&&i.data&&i.data.length>0?I.value=i.data:(I.value=[],D.value={market:k.value,symbol:e.trim().toUpperCase(),name:""}),t.n=6;break;case 5:t.p=5,t.v,I.value=[],D.value={market:k.value,symbol:e.trim().toUpperCase(),name:""};case 6:return t.p=6,E.value=!1,t.f(6);case 7:return t.a(2)}},t,null,[[3,5,6,7]])}));return function(e){return t.apply(this,arguments)}}(),Ut=function(){C.value&&C.value.trim()?k.value?D.value={market:k.value,symbol:C.value.trim().toUpperCase(),name:""}:u.A.warning(a.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")):u.A.warning(a.$t("dashboard.analysis.modal.addStock.pleaseEnterSymbol"))},jt=function(t){D.value={market:t.market,symbol:t.symbol,name:t.name||t.symbol}},Gt=function(){var t=(0,c.A)((0,l.A)().m(function t(e){var a;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e||(e=k.value||(M.value.length>0?M.value[0].value:"")),e){t.n=1;break}return t.a(2);case 1:return P.value=!0,t.p=2,t.n=3,(0,f.z6)({market:e,limit:10});case 3:a=t.v,a&&1===a.code&&a.data?A.value=a.data:A.value=[],t.n=5;break;case 4:t.p=4,t.v,A.value=[];case 5:return t.p=5,P.value=!1,t.f(5);case 6:return t.a(2)}},t,null,[[2,4,5,6]])}));return function(e){return t.apply(this,arguments)}}(),Zt=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,n,r,o,s,c;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e="",n="",!D.value){t.n=1;break}e=D.value.market,n=D.value.symbol.toUpperCase(),t.n=4;break;case 1:if(!C.value||!C.value.trim()){t.n=3;break}if(k.value){t.n=2;break}return u.A.warning(a.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")),t.a(2);case 2:e=k.value,n=C.value.trim().toUpperCase(),t.n=4;break;case 3:return u.A.warning(a.$t("dashboard.analysis.modal.addStock.pleaseSelectOrEnterSymbol")),t.a(2);case 4:return S.value=!0,t.p=5,t.n=6,(0,f.dp)({userid:i.value,market:e,symbol:n});case 6:if(r=t.v,!r||1!==r.code){t.n=8;break}return u.A.success(a.$t("dashboard.analysis.message.addStockSuccess")),Ht(),t.n=7,Lt();case 7:t.n=9;break;case 8:u.A.error((null===r||void 0===r?void 0:r.msg)||a.$t("dashboard.analysis.message.addStockFailed"));case 9:t.n=11;break;case 10:t.p=10,c=t.v,s=(null===c||void 0===c||null===(o=c.response)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.msg)||(null===c||void 0===c?void 0:c.message)||a.$t("dashboard.analysis.message.addStockFailed"),u.A.error(s);case 11:return t.p=11,S.value=!1,t.f(11);case 12:return t.a(2)}},t,null,[[5,10,11,12]])}));return function(){return t.apply(this,arguments)}}(),Jt=function(t){if(!ae(t.id)){var e=t.params||t.defaultParams||{};j.value.push((0,d.A)((0,d.A)({},t),{},{id:t.id,params:(0,d.A)({},e)}))}},Qt=function(t){j.value=j.value.filter(function(e){return e.id!==t})},te=function(t){var e=t.action,a=t.indicator;if("add"===e){var i=(0,d.A)((0,d.A)({},a),{},{calculate:ee(a.id)});Jt(i)}else"remove"===e&&Qt(a.id)},ee=function(t){return null},ae=function(t){return"sma"===t?Z.some(function(t){return j.value.some(function(e){return e.id===t.id})}):"ema"===t?J.some(function(t){return j.value.some(function(e){return e.id===t.id})}):j.value.some(function(e){return e.id===t})},ie=function(){var t=new Set;return Z.forEach(function(e){return t.add(e.id)}),J.forEach(function(e){return t.add(e.id)}),j.value.filter(function(e){return!t.has(e.id)})},ne=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,a,n;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(i.value){t.n=1;break}return t.a(2);case 1:return et.value=!0,t.p=2,t.n=3,(0,v.Ay)({url:"/api/indicator/getIndicators",method:"get",params:{userid:i.value}});case 3:e=t.v,1===e.code&&e.data&&(a=e.data.filter(function(t){return!t.is_buy||0===t.is_buy||"0"===t.is_buy}),n=e.data.filter(function(t){return 1===t.is_buy||"1"===t.is_buy}),Q.value=a.map(function(t){return(0,d.A)((0,d.A)({},t),{},{type:"python",source:"custom"})}),tt.value=n.map(function(t){return(0,d.A)((0,d.A)({},t),{},{type:"python",source:"purchased"})})),t.n=5;break;case 4:t.p=4,t.v;case 5:return t.p=5,et.value=!1,t.f(5);case 6:return t.a(2)}},t,null,[[2,4,5,6]])}));return function(){return t.apply(this,arguments)}}(),re=(0,h.KR)(null),oe=function(){var t=(0,c.A)((0,l.A)().m(function t(e,i){var n,r,o,s,c,h,p,v,f;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n="".concat(i,"-").concat(e.id),!ae(n)){t.n=1;break}return Qt(n),t.a(2);case 1:if(t.p=1,r=e.code||"",re.value){t.n=2;break}return u.A.error(a.$t("dashboard.indicator.error.chartNotReady")),t.a(2);case 2:if("function"===typeof re.value.parsePythonStrategy){t.n=3;break}return u.A.error(a.$t("dashboard.indicator.error.chartMethodNotReady")),t.a(2);case 3:if("function"===typeof re.value.executePythonStrategy){t.n=4;break}return u.A.error(a.$t("dashboard.indicator.error.chartExecuteNotReady")),t.a(2);case 4:if(o=re.value.parsePythonStrategy(r),o){t.n=5;break}return u.A.error(a.$t("dashboard.indicator.error.parseFailed")),t.a(2);case 5:s=e.userParams||{},c=r,h=(0,d.A)({},s),p={id:n,name:e.name,type:"python",code:c,description:e.description,parsed:o,userParams:h,originalId:e.id,user_id:e.user_id||e.userId,is_encrypted:e.is_encrypted||e.isEncrypted||0,calculate:function(t,a){return re.value.executePythonStrategy(c,t,(0,d.A)((0,d.A)({},a),h),{id:e.id,user_id:e.user_id||e.userId,is_encrypted:e.is_encrypted||e.isEncrypted||0})}},v=(0,d.A)((0,d.A)({},o.params),s),j.value.push((0,d.A)((0,d.A)({},p),{},{params:v})),t.n=7;break;case 6:t.p=6,f=t.v,u.A.error(a.$t("dashboard.indicator.error.addIndicatorFailed")+": "+(f.message||"未知错误"));case 7:return t.a(2)}},t,null,[[1,6]])}));return function(e,a){return t.apply(this,arguments)}}(),se=function(){var t=(0,c.A)((0,l.A)().m(function t(e,i){var n,r,o,s,c;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n="".concat(i,"-").concat(e.id),!ae(n)){t.n=1;break}Qt(n),t.n=5;break;case 1:return t.p=1,st.value=!0,t.n=2,a.$http.get("/api/indicator/getIndicatorParams",{params:{indicator_id:e.id}});case 2:r=t.v,r&&1===r.code&&Array.isArray(r.data)&&r.data.length>0?(rt.value=r.data,o="".concat(i,"-").concat(e.id),s=lt.value[o],c={},r.data.forEach(function(t){var e=s&&void 0!==s[t.name]?s[t.name]:t.default;e="int"===t.type?parseInt(e)||0:"float"===t.type?parseFloat(e)||0:"bool"===t.type?!0===e||"true"===e||1===e||"1"===e:e||"",c[t.name]=e}),ot.value=c,it.value=e,nt.value=i,at.value=!0):oe(e,i),t.n=4;break;case 3:t.p=3,t.v,oe(e,i);case 4:return t.p=4,st.value=!1,t.f(4);case 5:return t.a(2)}},t,null,[[1,3,4,5]])}));return function(e,a){return t.apply(this,arguments)}}(),le=function(){if(it.value){var t="".concat(nt.value,"-").concat(it.value.id);lt.value[t]=(0,d.A)({},ot.value);var e=(0,d.A)((0,d.A)({},it.value),{},{userParams:(0,d.A)({},ot.value)});oe(e,nt.value)}at.value=!1,it.value=null,nt.value=""},ce=function(){ue(),at.value=!1,setTimeout(function(){it.value=null,nt.value=""},100)},ue=function(){if(it.value&&nt.value){var t="".concat(nt.value,"-").concat(it.value.id);lt.value[t]=JSON.parse(JSON.stringify(ot.value))}},de=function(){ue()},he=function(t){var e=t.code,i=t.name;if(e&&e.trim())try{if(!re.value)return void u.A.error(a.$t("dashboard.indicator.error.chartNotReady"));if("function"!==typeof re.value.parsePythonStrategy)return void u.A.error(a.$t("dashboard.indicator.error.chartMethodNotReady"));if("function"!==typeof re.value.executePythonStrategy)return void u.A.error(a.$t("dashboard.indicator.error.chartExecuteNotReady"));var n=re.value.parsePythonStrategy(e);if(!n)return void u.A.error(a.$t("dashboard.indicator.error.parseFailedCheck"));var r={id:"temp-editor-indicator",name:i||"临时指标",type:"python",code:e,description:"",parsed:n,calculate:function(t,a){var i=e;return re.value.executePythonStrategy(i,t,a)}},o=j.value.findIndex(function(t){return"temp-editor-indicator"===t.id});o>=0&&j.value.splice(o,1),j.value.push((0,d.A)((0,d.A)({},r),{},{params:(0,d.A)({},n.params)})),u.A.success(a.$t("dashboard.indicator.success.runIndicator"))}catch(s){u.A.error(a.$t("dashboard.indicator.error.runIndicatorFailed")+": "+(s.message||"未知错误"))}else u.A.warning(a.$t("dashboard.indicator.warning.enterCode"))},pe=function(){ht.value=null,dt.value=!0},ve=function(t){ht.value=t,dt.value=!0},fe=function(){ct.value=!ct.value},ge=function(t){r.A.confirm({title:a.$t("dashboard.indicator.delete.confirmTitle"),content:a.$t("dashboard.indicator.delete.confirmContent",{name:t.name}),okText:a.$t("dashboard.indicator.delete.confirmOk"),okType:"danger",cancelText:a.$t("dashboard.indicator.delete.confirmCancel"),onOk:function(){var e=(0,c.A)((0,l.A)().m(function e(){var n,r,o;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:return e.p=0,e.n=1,(0,v.Ay)({url:"/api/indicator/deleteIndicator",method:"post",data:{id:t.id,userid:i.value}});case 1:if(n=e.v,1!==n.code){e.n=3;break}return u.A.success(a.$t("dashboard.indicator.delete.success")),r="custom-"+t.id,ae(r)&&Qt(r),e.n=2,ne();case 2:e.n=4;break;case 3:u.A.error(n.msg||a.$t("dashboard.indicator.delete.failed"));case 4:e.n=6;break;case 5:e.p=5,o=e.v,u.A.error(a.$t("dashboard.indicator.delete.failed")+": "+(o.message||"未知错误"));case 6:return e.a(2)}},e,null,[[0,5]])}));function n(){return e.apply(this,arguments)}return n}()})},me=function(t){vt.value=(0,d.A)({},t),pt.value=!0},ye=function(t){gt.value=(0,d.A)({},t),ft.value=!0},be=function(t){yt.value=t,mt.value=!0},_e=function(t){_t.value=(0,d.A)({},t),St.value=t.pricing_type||"free",kt.value=t.price||10,Ct.value=t.description||"",It.value=!!t.vip_free,bt.value=!0},xe=function(t){a.$router.push({path:"/trading-assistant",query:{mode:"create",indicator_id:String(t.id)}})},we=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,n;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(i.value){t.n=1;break}return u.A.error(a.$t("dashboard.indicator.error.pleaseLogin")),t.a(2);case 1:return xt.value=!0,t.p=2,t.n=3,(0,v.Ay)({url:"/api/indicator/saveIndicator",method:"post",data:{userid:i.value,id:_t.value.id,code:_t.value.code,name:_t.value.name,description:Ct.value,publishToCommunity:!0,pricingType:St.value,price:"paid"===St.value?kt.value:0,vipFree:"paid"===St.value&&It.value}});case 3:if(e=t.v,1!==e.code){t.n=5;break}return u.A.success(a.$t("dashboard.indicator.publish.success")),bt.value=!1,_t.value=null,t.n=4,ne();case 4:t.n=6;break;case 5:u.A.error(e.msg||a.$t("dashboard.indicator.publish.failed"));case 6:t.n=8;break;case 7:t.p=7,n=t.v,u.A.error(a.$t("dashboard.indicator.publish.failed")+": "+(n.message||""));case 8:return t.p=8,xt.value=!1,t.f(8);case 9:return t.a(2)}},t,null,[[2,7,8,9]])}));return function(){return t.apply(this,arguments)}}(),Se=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(i.value&&_t.value){t.n=1;break}return t.a(2);case 1:return wt.value=!0,t.p=2,t.n=3,(0,v.Ay)({url:"/api/indicator/saveIndicator",method:"post",data:{userid:i.value,id:_t.value.id,code:_t.value.code,name:_t.value.name,description:_t.value.description,publishToCommunity:!1,pricingType:"free",price:0,vipFree:!1}});case 3:if(e=t.v,1!==e.code){t.n=5;break}return u.A.success(a.$t("dashboard.indicator.publish.unpublishSuccess")),bt.value=!1,_t.value=null,t.n=4,ne();case 4:t.n=6;break;case 5:u.A.error(e.msg||a.$t("dashboard.indicator.publish.unpublishFailed"));case 6:t.n=8;break;case 7:t.p=7,t.v,u.A.error(a.$t("dashboard.indicator.publish.unpublishFailed"));case 8:return t.p=8,wt.value=!1,t.f(8);case 9:return t.a(2)}},t,null,[[2,7,8,9]])}));return function(){return t.apply(this,arguments)}}(),ke=function(){var t=(0,c.A)((0,l.A)().m(function t(e){var n,r,o;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(i.value){t.n=1;break}return u.A.error(a.$t("dashboard.indicator.error.pleaseLogin")),t.a(2);case 1:return n=a.$refs.indicatorEditor,n&&(n.saving=!0),t.p=2,t.n=3,(0,v.Ay)({url:"/api/indicator/saveIndicator",method:"post",data:{userid:i.value,id:e.id||0,code:e.code}});case 3:if(r=t.v,1!==r.code){t.n=5;break}return u.A.success(a.$t("dashboard.indicator.save.success")),dt.value=!1,ht.value=null,t.n=4,ne();case 4:t.n=6;break;case 5:u.A.error(r.msg||a.$t("dashboard.indicator.save.failed"));case 6:t.n=8;break;case 7:t.p=7,o=t.v,u.A.error(a.$t("dashboard.indicator.save.failed")+": "+(o.message||"未知错误"));case 8:return t.p=8,n&&(n.saving=!1),t.f(8);case 9:return t.a(2)}},t,null,[[2,7,8,9]])}));return function(e){return t.apply(this,arguments)}}(),Ce=function(t){var e=t.end_time;if(1===e||"1"===e)return a.$t("dashboard.indicator.status.normalPermanent");if(!e||0===e)return a.$t("dashboard.indicator.status.normal");var i=Math.floor(Date.now()/1e3);return e<i?a.$t("dashboard.indicator.status.expired"):a.$t("dashboard.indicator.status.normal")},Ie=function(t){var e=t.end_time;if(1===e||"1"===e)return"check-circle";if(!e||0===e)return"check-circle";var a=Math.floor(Date.now()/1e3);return e<a?"close-circle":"check-circle"},Ee=function(t){var e=t.end_time;if(1===e||"1"===e)return"status-normal";if(!e||0===e)return"status-normal";var a=Math.floor(Date.now()/1e3);return e<a?"status-expired":"status-normal"},Ae=function(t){var e=t.end_time;if(1===e||"1"===e)return a.$t("dashboard.indicator.expiry.permanent");if(!e||0===e)return a.$t("dashboard.indicator.expiry.noExpiry");var i=Math.floor(Date.now()/1e3),n=new Date(1e3*e).toLocaleString("zh-CN"===a.$i18n.locale?"zh-CN":"zh-TW"===a.$i18n.locale?"zh-TW":"en-US");return e<i?a.$t("dashboard.indicator.expiry.expired",{date:n}):a.$t("dashboard.indicator.expiry.expiresOn",{date:n})},Pe=function(t){var e={USStock:"dashboard.indicator.market.USStock",Crypto:"dashboard.indicator.market.Crypto",Forex:"dashboard.indicator.market.Forex",Futures:"dashboard.indicator.market.Futures"},i=e[t];return i&&null!==a&&void 0!==a&&a.$t?a.$t(i):t},De=function(t){var e={USStock:"green",Crypto:"purple",Forex:"gold",Futures:"cyan"};return e[t]||"default"},Te=function(){At.value=!At.value,localStorage.setItem("realtimeEnabled",At.value.toString())},Me=function(){G.value=window.innerWidth<=768};return(0,h.sV)(function(){var t=localStorage.getItem("realtimeEnabled");null!==t&&(At.value="true"===t),Me(),window.addEventListener("resize",Me),Wt(),Bt(),Lt(),ne()}),(0,h.xo)(function(){window.removeEventListener("resize",Me),T.value&&clearTimeout(T.value)}),(0,h.wB)(w,function(t){t?(M.value.length>0&&!k.value&&(k.value=M.value[0].value),k.value&&Gt(k.value)):(D.value=null,C.value="",I.value=[],R.value=!1,T.value&&(clearTimeout(T.value),T.value=null))}),(0,h.wB)(function(){return ot.value},function(t){if(at.value&&it.value&&nt.value){var e="".concat(nt.value,"-").concat(it.value.id);lt.value[e]=JSON.parse(JSON.stringify(t))}},{deep:!0,immediate:!1}),(0,h.wB)(at,function(t){t||ue()}),{userId:i,klineChart:re,searchSymbol:p,symbolSuggestions:m,watchlist:y,symbolSearchValue:_,symbolSearchOpen:x,currentSymbol:H,currentMarket:Y,currentPrice:K,priceChange:X,priceChangeClass:q,timeframe:U,loadingWatchlist:b,activeIndicators:j,trendIndicators:Tt,oscillatorIndicators:Mt,customIndicators:Q,purchasedIndicators:tt,loadingIndicators:et,realtimeEnabled:At,toggleRealtime:Te,handleSymbolSearch:$t,handleSymbolSelect:Vt,handleDropdownVisibleChange:zt,filterSymbolOption:Ot,getMarketName:Pe,getMarketColor:De,setTimeframe:Rt,addIndicator:Jt,removeIndicator:Qt,isIndicatorActive:ae,loadIndicators:ne,addPythonIndicator:oe,toggleIndicator:se,getIndicatorStatus:Ce,getIndicatorStatusIcon:Ie,getIndicatorStatusClass:Ee,getExpiryTimeText:Ae,formatParams:Ft,loadWatchlist:Lt,getCustomActiveIndicators:ie,showIndicatorEditor:dt,editingIndicator:ht,handleCreateIndicator:pe,handleRunIndicator:he,handleSaveIndicator:ke,handleEditIndicator:ve,handleDeleteIndicator:ge,toggleCustomSection:fe,customSectionCollapsed:ct,purchasedSectionCollapsed:ut,handlePriceChange:Pt,handleChartRetry:Dt,handleIndicatorToggle:te,showParamsModal:at,pendingIndicator:it,indicatorParams:rt,indicatorParamValues:ot,loadingParams:st,confirmIndicatorParams:le,cancelIndicatorParams:ce,handleParamsModalAfterClose:de,showBacktestModal:pt,backtestIndicator:vt,handleOpenBacktest:me,showBacktestHistoryDrawer:ft,backtestHistoryIndicator:gt,handleOpenBacktestHistory:ye,showBacktestRunViewer:mt,selectedBacktestRun:yt,handleViewBacktestRun:be,showPublishModal:bt,publishIndicator:_t,publishing:xt,unpublishing:wt,publishPricingType:St,publishPrice:kt,publishDescription:Ct,publishVipFree:It,publishRules:Et,handlePublishIndicator:_e,handleCreateStrategyFromIndicator:xe,handleConfirmPublish:we,handleUnpublish:Se,selectedSymbol:H,selectedMarket:Y,selectedTimeframe:U,isMobile:G,showAddStockModal:w,addingStock:S,selectedMarketTab:k,symbolSearchKeyword:C,symbolSearchResults:I,searchingSymbols:E,hotSymbols:A,loadingHotSymbols:P,selectedSymbolForAdd:D,marketTypes:M,hasSearched:R,handleCloseAddStockModal:Ht,handleMarketTabChange:Yt,handleSymbolSearchInput:Kt,handleSearchOrInput:Xt,searchSymbolsInModal:qt,selectSymbol:jt,loadHotSymbols:Gt,handleAddStock:Zt,handleDirectAdd:Ut,loadMarketTypes:Wt,showQuickTrade:F,qtSymbol:B,qtSide:L,qtPrice:N,isCryptoMarket:$,openQuickTrade:z,onQuickTradeSuccess:V,handleQuickTradeSymbolChange:O,goToIndicatorMarket:W}}},lr=sr,cr=(0,E.A)(lr,i,n,!1,null,"0bec23f2",null),ur=cr.exports},40955:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(80754),a(84636),a(39506),a(57165))})(0,function(t){return function(){var e=t,a=e.lib,i=a.BlockCipher,n=e.algo,r=[],o=[],s=[],l=[],c=[],u=[],d=[],h=[],p=[],v=[];(function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var a=0,i=0;for(e=0;e<256;e++){var n=i^i<<1^i<<2^i<<3^i<<4;n=n>>>8^255&n^99,r[a]=n,o[n]=a;var f=t[a],g=t[f],m=t[g],y=257*t[n]^16843008*n;s[a]=y<<24|y>>>8,l[a]=y<<16|y>>>16,c[a]=y<<8|y>>>24,u[a]=y;y=16843009*m^65537*g^257*f^16843008*a;d[n]=y<<24|y>>>8,h[n]=y<<16|y>>>16,p[n]=y<<8|y>>>24,v[n]=y,a?(a=f^t[t[t[m^f]]],i^=t[t[i]]):a=i=1}})();var f=[0,1,2,4,8,16,32,64,128,27,54],g=n.AES=i.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,a=t.sigBytes/4,i=this._nRounds=a+6,n=4*(i+1),o=this._keySchedule=[],s=0;s<n;s++)s<a?o[s]=e[s]:(u=o[s-1],s%a?a>6&&s%a==4&&(u=r[u>>>24]<<24|r[u>>>16&255]<<16|r[u>>>8&255]<<8|r[255&u]):(u=u<<8|u>>>24,u=r[u>>>24]<<24|r[u>>>16&255]<<16|r[u>>>8&255]<<8|r[255&u],u^=f[s/a|0]<<24),o[s]=o[s-a]^u);for(var l=this._invKeySchedule=[],c=0;c<n;c++){s=n-c;if(c%4)var u=o[s];else u=o[s-4];l[c]=c<4||s<=4?u:d[r[u>>>24]]^h[r[u>>>16&255]]^p[r[u>>>8&255]]^v[r[255&u]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,l,c,u,r)},decryptBlock:function(t,e){var a=t[e+1];t[e+1]=t[e+3],t[e+3]=a,this._doCryptBlock(t,e,this._invKeySchedule,d,h,p,v,o);a=t[e+1];t[e+1]=t[e+3],t[e+3]=a},_doCryptBlock:function(t,e,a,i,n,r,o,s){for(var l=this._nRounds,c=t[e]^a[0],u=t[e+1]^a[1],d=t[e+2]^a[2],h=t[e+3]^a[3],p=4,v=1;v<l;v++){var f=i[c>>>24]^n[u>>>16&255]^r[d>>>8&255]^o[255&h]^a[p++],g=i[u>>>24]^n[d>>>16&255]^r[h>>>8&255]^o[255&c]^a[p++],m=i[d>>>24]^n[h>>>16&255]^r[c>>>8&255]^o[255&u]^a[p++],y=i[h>>>24]^n[c>>>16&255]^r[u>>>8&255]^o[255&d]^a[p++];c=f,u=g,d=m,h=y}f=(s[c>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&h])^a[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[h>>>8&255]<<8|s[255&c])^a[p++],m=(s[d>>>24]<<24|s[h>>>16&255]<<16|s[c>>>8&255]<<8|s[255&u])^a[p++],y=(s[h>>>24]<<24|s[c>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^a[p++];t[e]=f,t[e+1]=g,t[e+2]=m,t[e+3]=y},keySize:8});e.AES=i._createHelper(g)}(),t.AES})},43128:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(80754),a(84636),a(39506),a(57165))})(0,function(t){return function(){var e=t,a=e.lib,i=a.BlockCipher,n=e.algo;const r=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var l={pbox:[],sbox:[]};function c(t,e){let a=e>>24&255,i=e>>16&255,n=e>>8&255,r=255&e,o=t.sbox[0][a]+t.sbox[1][i];return o^=t.sbox[2][n],o+=t.sbox[3][r],o}function u(t,e,a){let i,n=e,o=a;for(let s=0;s<r;++s)n^=t.pbox[s],o=c(t,n)^o,i=n,n=o,o=i;return i=n,n=o,o=i,o^=t.pbox[r],n^=t.pbox[r+1],{left:n,right:o}}function d(t,e,a){let i,n=e,o=a;for(let s=r+1;s>1;--s)n^=t.pbox[s],o=c(t,n)^o,i=n,n=o,o=i;return i=n,n=o,o=i,o^=t.pbox[1],n^=t.pbox[0],{left:n,right:o}}function h(t,e,a){for(let r=0;r<4;r++){t.sbox[r]=[];for(let e=0;e<256;e++)t.sbox[r][e]=s[r][e]}let i=0;for(let s=0;s<r+2;s++)t.pbox[s]=o[s]^e[i],i++,i>=a&&(i=0);let n=0,l=0,c=0;for(let o=0;o<r+2;o+=2)c=u(t,n,l),n=c.left,l=c.right,t.pbox[o]=n,t.pbox[o+1]=l;for(let r=0;r<4;r++)for(let e=0;e<256;e+=2)c=u(t,n,l),n=c.left,l=c.right,t.sbox[r][e]=n,t.sbox[r][e+1]=l;return!0}var p=n.Blowfish=i.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var t=this._keyPriorReset=this._key,e=t.words,a=t.sigBytes/4;h(l,e,a)}},encryptBlock:function(t,e){var a=u(l,t[e],t[e+1]);t[e]=a.left,t[e+1]=a.right},decryptBlock:function(t,e){var a=d(l,t[e],t[e+1]);t[e]=a.left,t[e+1]=a.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=i._createHelper(p)}(),t.Blowfish})},57165:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(39506))})(0,function(t){t.lib.Cipher||function(e){var a=t,i=a.lib,n=i.Base,r=i.WordArray,o=i.BufferedBlockAlgorithm,s=a.enc,l=(s.Utf8,s.Base64),c=a.algo,u=c.EvpKDF,d=i.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,a){this.cfg=this.cfg.extend(a),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?S:_}return function(e){return{encrypt:function(a,i,n){return t(i).encrypt(e,a,i,n)},decrypt:function(a,i,n){return t(i).decrypt(e,a,i,n)}}}}()}),h=(i.StreamCipher=d.extend({_doFinalize:function(){var t=this._process(!0);return t},blockSize:1}),a.mode={}),p=i.BlockCipherMode=n.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),v=h.CBC=function(){var t=p.extend();function a(t,a,i){var n,r=this._iv;r?(n=r,this._iv=e):n=this._prevBlock;for(var o=0;o<i;o++)t[a+o]^=n[o]}return t.Encryptor=t.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize;a.call(this,t,e,n),i.encryptBlock(t,e),this._prevBlock=t.slice(e,e+n)}}),t.Decryptor=t.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize,r=t.slice(e,e+n);i.decryptBlock(t,e),a.call(this,t,e,n),this._prevBlock=r}}),t}(),f=a.pad={},g=f.Pkcs7={pad:function(t,e){for(var a=4*e,i=a-t.sigBytes%a,n=i<<24|i<<16|i<<8|i,o=[],s=0;s<i;s+=4)o.push(n);var l=r.create(o,i);t.concat(l)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},m=(i.BlockCipher=d.extend({cfg:d.cfg.extend({mode:v,padding:g}),reset:function(){var t;d.reset.call(this);var e=this.cfg,a=e.iv,i=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=i.createEncryptor:(t=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,a&&a.words):(this._mode=t.call(i,this,a&&a.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4}),i.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),y=a.format={},b=y.OpenSSL={stringify:function(t){var e,a=t.ciphertext,i=t.salt;return e=i?r.create([1398893684,1701076831]).concat(i).concat(a):a,e.toString(l)},parse:function(t){var e,a=l.parse(t),i=a.words;return 1398893684==i[0]&&1701076831==i[1]&&(e=r.create(i.slice(2,4)),i.splice(0,4),a.sigBytes-=16),m.create({ciphertext:a,salt:e})}},_=i.SerializableCipher=n.extend({cfg:n.extend({format:b}),encrypt:function(t,e,a,i){i=this.cfg.extend(i);var n=t.createEncryptor(a,i),r=n.finalize(e),o=n.cfg;return m.create({ciphertext:r,key:a,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:i.format})},decrypt:function(t,e,a,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var n=t.createDecryptor(a,i).finalize(e.ciphertext);return n},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),x=a.kdf={},w=x.OpenSSL={execute:function(t,e,a,i,n){if(i||(i=r.random(8)),n)o=u.create({keySize:e+a,hasher:n}).compute(t,i);else var o=u.create({keySize:e+a}).compute(t,i);var s=r.create(o.words.slice(e),4*a);return o.sigBytes=4*e,m.create({key:o,iv:s,salt:i})}},S=i.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:w}),encrypt:function(t,e,a,i){i=this.cfg.extend(i);var n=i.kdf.execute(a,t.keySize,t.ivSize,i.salt,i.hasher);i.iv=n.iv;var r=_.encrypt.call(this,t,e,n.key,i);return r.mixIn(n),r},decrypt:function(t,e,a,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var n=i.kdf.execute(a,t.keySize,t.ivSize,e.salt,i.hasher);i.iv=n.iv;var r=_.decrypt.call(this,t,e,n.key,i);return r}})}()})},19021:function(t,e,a){(function(e,a){t.exports=a()})(0,function(){var t=t||function(t,e){var i;if("undefined"!==typeof window&&window.crypto&&(i=window.crypto),"undefined"!==typeof self&&self.crypto&&(i=self.crypto),"undefined"!==typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!==typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&"undefined"!==typeof a.g&&a.g.crypto&&(i=a.g.crypto),!i)try{i=a(50477)}catch(g){}var n=function(){if(i){if("function"===typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(g){}if("function"===typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(g){}}throw new Error("Native crypto module could not be used to get secure random number.")},r=Object.create||function(){function t(){}return function(e){var a;return t.prototype=e,a=new t,t.prototype=null,a}}(),o={},s=o.lib={},l=s.Base=function(){return{extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),c=s.WordArray=l.extend({init:function(t,a){t=this.words=t||[],this.sigBytes=a!=e?a:4*t.length},toString:function(t){return(t||d).stringify(this)},concat:function(t){var e=this.words,a=t.words,i=this.sigBytes,n=t.sigBytes;if(this.clamp(),i%4)for(var r=0;r<n;r++){var o=a[r>>>2]>>>24-r%4*8&255;e[i+r>>>2]|=o<<24-(i+r)%4*8}else for(var s=0;s<n;s+=4)e[i+s>>>2]=a[s>>>2];return this.sigBytes+=n,this},clamp:function(){var e=this.words,a=this.sigBytes;e[a>>>2]&=4294967295<<32-a%4*8,e.length=t.ceil(a/4)},clone:function(){var t=l.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],a=0;a<t;a+=4)e.push(n());return new c.init(e,t)}}),u=o.enc={},d=u.Hex={stringify:function(t){for(var e=t.words,a=t.sigBytes,i=[],n=0;n<a;n++){var r=e[n>>>2]>>>24-n%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,a=[],i=0;i<e;i+=2)a[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new c.init(a,e/2)}},h=u.Latin1={stringify:function(t){for(var e=t.words,a=t.sigBytes,i=[],n=0;n<a;n++){var r=e[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(r))}return i.join("")},parse:function(t){for(var e=t.length,a=[],i=0;i<e;i++)a[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new c.init(a,e)}},p=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},v=s.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var a,i=this._data,n=i.words,r=i.sigBytes,o=this.blockSize,s=4*o,l=r/s;l=e?t.ceil(l):t.max((0|l)-this._minBufferSize,0);var u=l*o,d=t.min(4*u,r);if(u){for(var h=0;h<u;h+=o)this._doProcessBlock(n,h);a=n.splice(0,u),i.sigBytes-=d}return new c.init(a,d)},clone:function(){var t=l.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(s.Hasher=v.extend({cfg:l.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,a){return new t.init(a).finalize(e)}},_createHmacHelper:function(t){return function(e,a){return new f.HMAC.init(t,a).finalize(e)}}}),o.algo={});return o}(Math);return t})},80754:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){return function(){var e=t,a=e.lib,i=a.WordArray,n=e.enc;n.Base64={stringify:function(t){var e=t.words,a=t.sigBytes,i=this._map;t.clamp();for(var n=[],r=0;r<a;r+=3)for(var o=e[r>>>2]>>>24-r%4*8&255,s=e[r+1>>>2]>>>24-(r+1)%4*8&255,l=e[r+2>>>2]>>>24-(r+2)%4*8&255,c=o<<16|s<<8|l,u=0;u<4&&r+.75*u<a;u++)n.push(i.charAt(c>>>6*(3-u)&63));var d=i.charAt(64);if(d)while(n.length%4)n.push(d);return n.join("")},parse:function(t){var e=t.length,a=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var n=0;n<a.length;n++)i[a.charCodeAt(n)]=n}var o=a.charAt(64);if(o){var s=t.indexOf(o);-1!==s&&(e=s)}return r(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function r(t,e,a){for(var n=[],r=0,o=0;o<e;o++)if(o%4){var s=a[t.charCodeAt(o-1)]<<o%4*2,l=a[t.charCodeAt(o)]>>>6-o%4*2,c=s|l;n[r>>>2]|=c<<24-r%4*8,r++}return i.create(n,r)}}(),t.enc.Base64})},64725:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){return function(){var e=t,a=e.lib,i=a.WordArray,n=e.enc;n.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var a=t.words,i=t.sigBytes,n=e?this._safe_map:this._map;t.clamp();for(var r=[],o=0;o<i;o+=3)for(var s=a[o>>>2]>>>24-o%4*8&255,l=a[o+1>>>2]>>>24-(o+1)%4*8&255,c=a[o+2>>>2]>>>24-(o+2)%4*8&255,u=s<<16|l<<8|c,d=0;d<4&&o+.75*d<i;d++)r.push(n.charAt(u>>>6*(3-d)&63));var h=n.charAt(64);if(h)while(r.length%4)r.push(h);return r.join("")},parse:function(t,e){void 0===e&&(e=!0);var a=t.length,i=e?this._safe_map:this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o<i.length;o++)n[i.charCodeAt(o)]=o}var s=i.charAt(64);if(s){var l=t.indexOf(s);-1!==l&&(a=l)}return r(t,a,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function r(t,e,a){for(var n=[],r=0,o=0;o<e;o++)if(o%4){var s=a[t.charCodeAt(o-1)]<<o%4*2,l=a[t.charCodeAt(o)]>>>6-o%4*2,c=s|l;n[r>>>2]|=c<<24-r%4*8,r++}return i.create(n,r)}}(),t.enc.Base64url})},45503:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){return function(){var e=t,a=e.lib,i=a.WordArray,n=e.enc;n.Utf16=n.Utf16BE={stringify:function(t){for(var e=t.words,a=t.sigBytes,i=[],n=0;n<a;n+=2){var r=e[n>>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(r))}return i.join("")},parse:function(t){for(var e=t.length,a=[],n=0;n<e;n++)a[n>>>1]|=t.charCodeAt(n)<<16-n%2*16;return i.create(a,2*e)}};function r(t){return t<<8&4278255360|t>>>8&16711935}n.Utf16LE={stringify:function(t){for(var e=t.words,a=t.sigBytes,i=[],n=0;n<a;n+=2){var o=r(e[n>>>2]>>>16-n%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,a=[],n=0;n<e;n++)a[n>>>1]|=r(t.charCodeAt(n)<<16-n%2*16);return i.create(a,2*e)}}}(),t.enc.Utf16})},39506:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(45471),a(51025))})(0,function(t){return function(){var e=t,a=e.lib,i=a.Base,n=a.WordArray,r=e.algo,o=r.MD5,s=r.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:o,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var a,i=this.cfg,r=i.hasher.create(),o=n.create(),s=o.words,l=i.keySize,c=i.iterations;while(s.length<l){a&&r.update(a),a=r.update(t).finalize(e),r.reset();for(var u=1;u<c;u++)a=r.finalize(a),r.reset();o.concat(a)}return o.sigBytes=4*l,o}});e.EvpKDF=function(t,e,a){return s.create(a).compute(t,e)}}(),t.EvpKDF})},70025:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return function(){var e=t,a=e.lib,i=a.CipherParams,n=e.enc,r=n.Hex,o=e.format;o.Hex={stringify:function(t){return t.ciphertext.toString(r)},parse:function(t){var e=r.parse(t);return i.create({ciphertext:e})}}}(),t.format.Hex})},51025:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){(function(){var e=t,a=e.lib,i=a.Base,n=e.enc,r=n.Utf8,o=e.algo;o.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=r.parse(e));var a=t.blockSize,i=4*a;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var n=this._oKey=e.clone(),o=this._iKey=e.clone(),s=n.words,l=o.words,c=0;c<a;c++)s[c]^=1549556828,l[c]^=909522486;n.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,a=e.finalize(t);e.reset();var i=e.finalize(this._oKey.clone().concat(a));return i}})})()})},21396:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(43240),a(6440),a(45503),a(80754),a(64725),a(84636),a(45471),a(63009),a(36308),a(81380),a(89557),a(45953),a(78056),a(51025),a(70019),a(39506),a(57165),a(82169),a(96939),a(6372),a(73797),a(38454),a(42073),a(54905),a(10482),a(52155),a(58124),a(70025),a(40955),a(7628),a(77193),a(96298),a(22696),a(43128))})(0,function(t){return t})},6440:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){return function(){if("function"==typeof ArrayBuffer){var e=t,a=e.lib,i=a.WordArray,n=i.init,r=i.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!==typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var e=t.byteLength,a=[],i=0;i<e;i++)a[i>>>2]|=t[i]<<24-i%4*8;n.call(this,a,e)}else n.apply(this,arguments)};r.prototype=i}}(),t.lib.WordArray})},84636:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){return function(e){var a=t,i=a.lib,n=i.WordArray,r=i.Hasher,o=a.algo,s=[];(function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0})();var l=o.MD5=r.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var a=0;a<16;a++){var i=e+a,n=t[i];t[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var r=this._hash.words,o=t[e+0],l=t[e+1],p=t[e+2],v=t[e+3],f=t[e+4],g=t[e+5],m=t[e+6],y=t[e+7],b=t[e+8],_=t[e+9],x=t[e+10],w=t[e+11],S=t[e+12],k=t[e+13],C=t[e+14],I=t[e+15],E=r[0],A=r[1],P=r[2],D=r[3];E=c(E,A,P,D,o,7,s[0]),D=c(D,E,A,P,l,12,s[1]),P=c(P,D,E,A,p,17,s[2]),A=c(A,P,D,E,v,22,s[3]),E=c(E,A,P,D,f,7,s[4]),D=c(D,E,A,P,g,12,s[5]),P=c(P,D,E,A,m,17,s[6]),A=c(A,P,D,E,y,22,s[7]),E=c(E,A,P,D,b,7,s[8]),D=c(D,E,A,P,_,12,s[9]),P=c(P,D,E,A,x,17,s[10]),A=c(A,P,D,E,w,22,s[11]),E=c(E,A,P,D,S,7,s[12]),D=c(D,E,A,P,k,12,s[13]),P=c(P,D,E,A,C,17,s[14]),A=c(A,P,D,E,I,22,s[15]),E=u(E,A,P,D,l,5,s[16]),D=u(D,E,A,P,m,9,s[17]),P=u(P,D,E,A,w,14,s[18]),A=u(A,P,D,E,o,20,s[19]),E=u(E,A,P,D,g,5,s[20]),D=u(D,E,A,P,x,9,s[21]),P=u(P,D,E,A,I,14,s[22]),A=u(A,P,D,E,f,20,s[23]),E=u(E,A,P,D,_,5,s[24]),D=u(D,E,A,P,C,9,s[25]),P=u(P,D,E,A,v,14,s[26]),A=u(A,P,D,E,b,20,s[27]),E=u(E,A,P,D,k,5,s[28]),D=u(D,E,A,P,p,9,s[29]),P=u(P,D,E,A,y,14,s[30]),A=u(A,P,D,E,S,20,s[31]),E=d(E,A,P,D,g,4,s[32]),D=d(D,E,A,P,b,11,s[33]),P=d(P,D,E,A,w,16,s[34]),A=d(A,P,D,E,C,23,s[35]),E=d(E,A,P,D,l,4,s[36]),D=d(D,E,A,P,f,11,s[37]),P=d(P,D,E,A,y,16,s[38]),A=d(A,P,D,E,x,23,s[39]),E=d(E,A,P,D,k,4,s[40]),D=d(D,E,A,P,o,11,s[41]),P=d(P,D,E,A,v,16,s[42]),A=d(A,P,D,E,m,23,s[43]),E=d(E,A,P,D,_,4,s[44]),D=d(D,E,A,P,S,11,s[45]),P=d(P,D,E,A,I,16,s[46]),A=d(A,P,D,E,p,23,s[47]),E=h(E,A,P,D,o,6,s[48]),D=h(D,E,A,P,y,10,s[49]),P=h(P,D,E,A,C,15,s[50]),A=h(A,P,D,E,g,21,s[51]),E=h(E,A,P,D,S,6,s[52]),D=h(D,E,A,P,v,10,s[53]),P=h(P,D,E,A,x,15,s[54]),A=h(A,P,D,E,l,21,s[55]),E=h(E,A,P,D,b,6,s[56]),D=h(D,E,A,P,I,10,s[57]),P=h(P,D,E,A,m,15,s[58]),A=h(A,P,D,E,k,21,s[59]),E=h(E,A,P,D,f,6,s[60]),D=h(D,E,A,P,w,10,s[61]),P=h(P,D,E,A,p,15,s[62]),A=h(A,P,D,E,_,21,s[63]),r[0]=r[0]+E|0,r[1]=r[1]+A|0,r[2]=r[2]+P|0,r[3]=r[3]+D|0},_doFinalize:function(){var t=this._data,a=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;a[n>>>5]|=128<<24-n%32;var r=e.floor(i/4294967296),o=i;a[15+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),a[14+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(a.length+1),this._process();for(var s=this._hash,l=s.words,c=0;c<4;c++){var u=l[c];l[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,a,i,n,r,o){var s=t+(e&a|~e&i)+n+o;return(s<<r|s>>>32-r)+e}function u(t,e,a,i,n,r,o){var s=t+(e&i|a&~i)+n+o;return(s<<r|s>>>32-r)+e}function d(t,e,a,i,n,r,o){var s=t+(e^a^i)+n+o;return(s<<r|s>>>32-r)+e}function h(t,e,a,i,n,r,o){var s=t+(a^(e|~i))+n+o;return(s<<r|s>>>32-r)+e}a.MD5=r._createHelper(l),a.HmacMD5=r._createHmacHelper(l)}(Math),t.MD5})},82169:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function a(t,e,a,i){var n,r=this._iv;r?(n=r.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var o=0;o<a;o++)t[e+o]^=n[o]}return e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize;a.call(this,t,e,n,i),this._prevBlock=t.slice(e,e+n)}}),e.Decryptor=e.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize,r=t.slice(e,e+n);a.call(this,t,e,n,i),this._prevBlock=r}}),e}(),t.mode.CFB})},6372:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){
/** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/
return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function a(t){if(255===(t>>24&255)){var e=t>>16&255,a=t>>8&255,i=255&t;255===e?(e=0,255===a?(a=0,255===i?i=0:++i):++a):++e,t=0,t+=e<<16,t+=a<<8,t+=i}else t+=1<<24;return t}function i(t){return 0===(t[0]=a(t[0]))&&(t[1]=a(t[1])),t}var n=e.Encryptor=e.extend({processBlock:function(t,e){var a=this._cipher,n=a.blockSize,r=this._iv,o=this._counter;r&&(o=this._counter=r.slice(0),this._iv=void 0),i(o);var s=o.slice(0);a.encryptBlock(s,0);for(var l=0;l<n;l++)t[e+l]^=s[l]}});return e.Decryptor=n,e}(),t.mode.CTRGladman})},96939:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return t.mode.CTR=function(){var e=t.lib.BlockCipherMode.extend(),a=e.Encryptor=e.extend({processBlock:function(t,e){var a=this._cipher,i=a.blockSize,n=this._iv,r=this._counter;n&&(r=this._counter=n.slice(0),this._iv=void 0);var o=r.slice(0);a.encryptBlock(o,0),r[i-1]=r[i-1]+1|0;for(var s=0;s<i;s++)t[e+s]^=o[s]}});return e.Decryptor=a,e}(),t.mode.CTR})},38454:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return t.mode.ECB=function(){var e=t.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e}(),t.mode.ECB})},73797:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return t.mode.OFB=function(){var e=t.lib.BlockCipherMode.extend(),a=e.Encryptor=e.extend({processBlock:function(t,e){var a=this._cipher,i=a.blockSize,n=this._iv,r=this._keystream;n&&(r=this._keystream=n.slice(0),this._iv=void 0),a.encryptBlock(r,0);for(var o=0;o<i;o++)t[e+o]^=r[o]}});return e.Decryptor=a,e}(),t.mode.OFB})},42073:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return t.pad.AnsiX923={pad:function(t,e){var a=t.sigBytes,i=4*e,n=i-a%i,r=a+n-1;t.clamp(),t.words[r>>>2]|=n<<24-r%4*8,t.sigBytes+=n},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923})},54905:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return t.pad.Iso10126={pad:function(e,a){var i=4*a,n=i-e.sigBytes%i;e.concat(t.lib.WordArray.random(n-1)).concat(t.lib.WordArray.create([n<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126})},10482:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return t.pad.Iso97971={pad:function(e,a){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,a)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})},58124:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})},52155:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(57165))})(0,function(t){return t.pad.ZeroPadding={pad:function(t,e){var a=4*e;t.clamp(),t.sigBytes+=a-(t.sigBytes%a||a)},unpad:function(t){var e=t.words,a=t.sigBytes-1;for(a=t.sigBytes-1;a>=0;a--)if(e[a>>>2]>>>24-a%4*8&255){t.sigBytes=a+1;break}}},t.pad.ZeroPadding})},70019:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(63009),a(51025))})(0,function(t){return function(){var e=t,a=e.lib,i=a.Base,n=a.WordArray,r=e.algo,o=r.SHA256,s=r.HMAC,l=r.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var a=this.cfg,i=s.create(a.hasher,t),r=n.create(),o=n.create([1]),l=r.words,c=o.words,u=a.keySize,d=a.iterations;while(l.length<u){var h=i.update(e).finalize(o);i.reset();for(var p=h.words,v=p.length,f=h,g=1;g<d;g++){f=i.finalize(f),i.reset();for(var m=f.words,y=0;y<v;y++)p[y]^=m[y]}r.concat(h),c[0]++}return r.sigBytes=4*u,r}});e.PBKDF2=function(t,e,a){return l.create(a).compute(t,e)}}(),t.PBKDF2})},22696:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(80754),a(84636),a(39506),a(57165))})(0,function(t){return function(){var e=t,a=e.lib,i=a.StreamCipher,n=e.algo,r=[],o=[],s=[],l=n.RabbitLegacy=i.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,a=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)i[n]^=a[n+4&7];if(e){var r=e.words,o=r[0],s=r[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=l>>>16|4294901760&u,h=u<<16|65535&l;i[0]^=l,i[1]^=d,i[2]^=u,i[3]^=h,i[4]^=l,i[5]^=d,i[6]^=u,i[7]^=h;for(n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(t,e){var a=this._X;c.call(this),r[0]=a[0]^a[5]>>>16^a[3]<<16,r[1]=a[2]^a[7]>>>16^a[5]<<16,r[2]=a[4]^a[1]>>>16^a[7]<<16,r[3]=a[6]^a[3]>>>16^a[1]<<16;for(var i=0;i<4;i++)r[i]=16711935&(r[i]<<8|r[i]>>>24)|4278255360&(r[i]<<24|r[i]>>>8),t[e+i]^=r[i]},blockSize:4,ivSize:2});function c(){for(var t=this._X,e=this._C,a=0;a<8;a++)o[a]=e[a];e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<o[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<o[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<o[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<o[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<o[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<o[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<o[6]>>>0?1:0)|0,this._b=e[7]>>>0<o[7]>>>0?1:0;for(a=0;a<8;a++){var i=t[a]+e[a],n=65535&i,r=i>>>16,l=((n*n>>>17)+n*r>>>15)+r*r,c=((4294901760&i)*i|0)+((65535&i)*i|0);s[a]=l^c}t[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,t[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,t[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,t[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,t[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,t[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,t[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,t[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=i._createHelper(l)}(),t.RabbitLegacy})},96298:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(80754),a(84636),a(39506),a(57165))})(0,function(t){return function(){var e=t,a=e.lib,i=a.StreamCipher,n=e.algo,r=[],o=[],s=[],l=n.Rabbit=i.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,a=0;a<4;a++)t[a]=16711935&(t[a]<<8|t[a]>>>24)|4278255360&(t[a]<<24|t[a]>>>8);var i=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(a=0;a<4;a++)c.call(this);for(a=0;a<8;a++)n[a]^=i[a+4&7];if(e){var r=e.words,o=r[0],s=r[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=l>>>16|4294901760&u,h=u<<16|65535&l;n[0]^=l,n[1]^=d,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=d,n[6]^=u,n[7]^=h;for(a=0;a<4;a++)c.call(this)}},_doProcessBlock:function(t,e){var a=this._X;c.call(this),r[0]=a[0]^a[5]>>>16^a[3]<<16,r[1]=a[2]^a[7]>>>16^a[5]<<16,r[2]=a[4]^a[1]>>>16^a[7]<<16,r[3]=a[6]^a[3]>>>16^a[1]<<16;for(var i=0;i<4;i++)r[i]=16711935&(r[i]<<8|r[i]>>>24)|4278255360&(r[i]<<24|r[i]>>>8),t[e+i]^=r[i]},blockSize:4,ivSize:2});function c(){for(var t=this._X,e=this._C,a=0;a<8;a++)o[a]=e[a];e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<o[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<o[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<o[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<o[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<o[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<o[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<o[6]>>>0?1:0)|0,this._b=e[7]>>>0<o[7]>>>0?1:0;for(a=0;a<8;a++){var i=t[a]+e[a],n=65535&i,r=i>>>16,l=((n*n>>>17)+n*r>>>15)+r*r,c=((4294901760&i)*i|0)+((65535&i)*i|0);s[a]=l^c}t[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,t[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,t[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,t[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,t[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,t[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,t[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,t[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=i._createHelper(l)}(),t.Rabbit})},77193:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(80754),a(84636),a(39506),a(57165))})(0,function(t){return function(){var e=t,a=e.lib,i=a.StreamCipher,n=e.algo,r=n.RC4=i.extend({_doReset:function(){for(var t=this._key,e=t.words,a=t.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var r=0;n<256;n++){var o=n%a,s=e[o>>>2]>>>24-o%4*8&255;r=(r+i[n]+s)%256;var l=i[n];i[n]=i[r],i[r]=l}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var t=this._S,e=this._i,a=this._j,i=0,n=0;n<4;n++){e=(e+1)%256,a=(a+t[e])%256;var r=t[e];t[e]=t[a],t[a]=r,i|=t[(t[e]+t[a])%256]<<24-8*n}return this._i=e,this._j=a,i}e.RC4=i._createHelper(r);var s=n.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)o.call(this)}});e.RC4Drop=i._createHelper(s)}(),t.RC4})},78056:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){
/** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
return function(){var e=t,a=e.lib,i=a.WordArray,n=a.Hasher,r=e.algo,o=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=i.create([0,1518500249,1859775393,2400959708,2840853838]),d=i.create([1352829926,1548603684,1836072691,2053994217,0]),h=r.RIPEMD160=n.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var a=0;a<16;a++){var i=e+a,n=t[i];t[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var r,h,b,_,x,w,S,k,C,I,E,A=this._hash.words,P=u.words,D=d.words,T=o.words,M=s.words,R=l.words,F=c.words;w=r=A[0],S=h=A[1],k=b=A[2],C=_=A[3],I=x=A[4];for(a=0;a<80;a+=1)E=r+t[e+T[a]]|0,E+=a<16?p(h,b,_)+P[0]:a<32?v(h,b,_)+P[1]:a<48?f(h,b,_)+P[2]:a<64?g(h,b,_)+P[3]:m(h,b,_)+P[4],E|=0,E=y(E,R[a]),E=E+x|0,r=x,x=_,_=y(b,10),b=h,h=E,E=w+t[e+M[a]]|0,E+=a<16?m(S,k,C)+D[0]:a<32?g(S,k,C)+D[1]:a<48?f(S,k,C)+D[2]:a<64?v(S,k,C)+D[3]:p(S,k,C)+D[4],E|=0,E=y(E,F[a]),E=E+I|0,w=I,I=C,C=y(k,10),k=S,S=E;E=A[1]+b+C|0,A[1]=A[2]+_+I|0,A[2]=A[3]+x+w|0,A[3]=A[4]+r+S|0,A[4]=A[0]+h+k|0,A[0]=E},_doFinalize:function(){var t=this._data,e=t.words,a=8*this._nDataBytes,i=8*t.sigBytes;e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(e.length+1),this._process();for(var n=this._hash,r=n.words,o=0;o<5;o++){var s=r[o];r[o]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return n},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});function p(t,e,a){return t^e^a}function v(t,e,a){return t&e|~t&a}function f(t,e,a){return(t|~e)^a}function g(t,e,a){return t&a|e&~a}function m(t,e,a){return t^(e|~a)}function y(t,e){return t<<e|t>>>32-e}e.RIPEMD160=n._createHelper(h),e.HmacRIPEMD160=n._createHmacHelper(h)}(Math),t.RIPEMD160})},45471:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){return function(){var e=t,a=e.lib,i=a.WordArray,n=a.Hasher,r=e.algo,o=[],s=r.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var a=this._hash.words,i=a[0],n=a[1],r=a[2],s=a[3],l=a[4],c=0;c<80;c++){if(c<16)o[c]=0|t[e+c];else{var u=o[c-3]^o[c-8]^o[c-14]^o[c-16];o[c]=u<<1|u>>>31}var d=(i<<5|i>>>27)+l+o[c];d+=c<20?1518500249+(n&r|~n&s):c<40?1859775393+(n^r^s):c<60?(n&r|n&s|r&s)-1894007588:(n^r^s)-899497514,l=s,s=r,r=n<<30|n>>>2,n=i,i=d}a[0]=a[0]+i|0,a[1]=a[1]+n|0,a[2]=a[2]+r|0,a[3]=a[3]+s|0,a[4]=a[4]+l|0},_doFinalize:function(){var t=this._data,e=t.words,a=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=Math.floor(a/4294967296),e[15+(i+64>>>9<<4)]=a,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA1=n._createHelper(s),e.HmacSHA1=n._createHmacHelper(s)}(),t.SHA1})},36308:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(63009))})(0,function(t){return function(){var e=t,a=e.lib,i=a.WordArray,n=e.algo,r=n.SHA256,o=n.SHA224=r.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=r._doFinalize.call(this);return t.sigBytes-=4,t}});e.SHA224=r._createHelper(o),e.HmacSHA224=r._createHmacHelper(o)}(),t.SHA224})},63009:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){return function(e){var a=t,i=a.lib,n=i.WordArray,r=i.Hasher,o=a.algo,s=[],l=[];(function(){function t(t){for(var a=e.sqrt(t),i=2;i<=a;i++)if(!(t%i))return!1;return!0}function a(t){return 4294967296*(t-(0|t))|0}var i=2,n=0;while(n<64)t(i)&&(n<8&&(s[n]=a(e.pow(i,.5))),l[n]=a(e.pow(i,1/3)),n++),i++})();var c=[],u=o.SHA256=r.extend({_doReset:function(){this._hash=new n.init(s.slice(0))},_doProcessBlock:function(t,e){for(var a=this._hash.words,i=a[0],n=a[1],r=a[2],o=a[3],s=a[4],u=a[5],d=a[6],h=a[7],p=0;p<64;p++){if(p<16)c[p]=0|t[e+p];else{var v=c[p-15],f=(v<<25|v>>>7)^(v<<14|v>>>18)^v>>>3,g=c[p-2],m=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[p]=f+c[p-7]+m+c[p-16]}var y=s&u^~s&d,b=i&n^i&r^n&r,_=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),x=(s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25),w=h+x+y+l[p]+c[p],S=_+b;h=d,d=u,u=s,s=o+w|0,o=r,r=n,n=i,i=w+S|0}a[0]=a[0]+i|0,a[1]=a[1]+n|0,a[2]=a[2]+r|0,a[3]=a[3]+o|0,a[4]=a[4]+s|0,a[5]=a[5]+u|0,a[6]=a[6]+d|0,a[7]=a[7]+h|0},_doFinalize:function(){var t=this._data,a=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return a[n>>>5]|=128<<24-n%32,a[14+(n+64>>>9<<4)]=e.floor(i/4294967296),a[15+(n+64>>>9<<4)]=i,t.sigBytes=4*a.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});a.SHA256=r._createHelper(u),a.HmacSHA256=r._createHmacHelper(u)}(Math),t.SHA256})},45953:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(43240))})(0,function(t){return function(e){var a=t,i=a.lib,n=i.WordArray,r=i.Hasher,o=a.x64,s=o.Word,l=a.algo,c=[],u=[],d=[];(function(){for(var t=1,e=0,a=0;a<24;a++){c[t+5*e]=(a+1)*(a+2)/2%64;var i=e%5,n=(2*t+3*e)%5;t=i,e=n}for(t=0;t<5;t++)for(e=0;e<5;e++)u[t+5*e]=e+(2*t+3*e)%5*5;for(var r=1,o=0;o<24;o++){for(var l=0,h=0,p=0;p<7;p++){if(1&r){var v=(1<<p)-1;v<32?h^=1<<v:l^=1<<v-32}128&r?r=r<<1^113:r<<=1}d[o]=s.create(l,h)}})();var h=[];(function(){for(var t=0;t<25;t++)h[t]=s.create()})();var p=l.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var a=this._state,i=this.blockSize/2,n=0;n<i;n++){var r=t[e+2*n],o=t[e+2*n+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8);var s=a[n];s.high^=o,s.low^=r}for(var l=0;l<24;l++){for(var p=0;p<5;p++){for(var v=0,f=0,g=0;g<5;g++){s=a[p+5*g];v^=s.high,f^=s.low}var m=h[p];m.high=v,m.low=f}for(p=0;p<5;p++){var y=h[(p+4)%5],b=h[(p+1)%5],_=b.high,x=b.low;for(v=y.high^(_<<1|x>>>31),f=y.low^(x<<1|_>>>31),g=0;g<5;g++){s=a[p+5*g];s.high^=v,s.low^=f}}for(var w=1;w<25;w++){s=a[w];var S=s.high,k=s.low,C=c[w];C<32?(v=S<<C|k>>>32-C,f=k<<C|S>>>32-C):(v=k<<C-32|S>>>64-C,f=S<<C-32|k>>>64-C);var I=h[u[w]];I.high=v,I.low=f}var E=h[0],A=a[0];E.high=A.high,E.low=A.low;for(p=0;p<5;p++)for(g=0;g<5;g++){w=p+5*g,s=a[w];var P=h[w],D=h[(p+1)%5+5*g],T=h[(p+2)%5+5*g];s.high=P.high^~D.high&T.high,s.low=P.low^~D.low&T.low}s=a[0];var M=d[l];s.high^=M.high,s.low^=M.low}},_doFinalize:function(){var t=this._data,a=t.words,i=(this._nDataBytes,8*t.sigBytes),r=32*this.blockSize;a[i>>>5]|=1<<24-i%32,a[(e.ceil((i+1)/r)*r>>>5)-1]|=128,t.sigBytes=4*a.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,l=s/8,c=[],u=0;u<l;u++){var d=o[u],h=d.high,p=d.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),c.push(p),c.push(h)}return new n.init(c,s)},clone:function(){for(var t=r.clone.call(this),e=t._state=this._state.slice(0),a=0;a<25;a++)e[a]=e[a].clone();return t}});a.SHA3=r._createHelper(p),a.HmacSHA3=r._createHmacHelper(p)}(Math),t.SHA3})},89557:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(43240),a(81380))})(0,function(t){return function(){var e=t,a=e.x64,i=a.Word,n=a.WordArray,r=e.algo,o=r.SHA512,s=r.SHA384=o.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=16,t}});e.SHA384=o._createHelper(s),e.HmacSHA384=o._createHmacHelper(s)}(),t.SHA384})},81380:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(43240))})(0,function(t){return function(){var e=t,a=e.lib,i=a.Hasher,n=e.x64,r=n.Word,o=n.WordArray,s=e.algo;function l(){return r.create.apply(r,arguments)}var c=[l(1116352408,3609767458),l(1899447441,602891725),l(3049323471,3964484399),l(3921009573,2173295548),l(961987163,4081628472),l(1508970993,3053834265),l(2453635748,2937671579),l(2870763221,3664609560),l(3624381080,2734883394),l(310598401,1164996542),l(607225278,1323610764),l(1426881987,3590304994),l(1925078388,4068182383),l(2162078206,991336113),l(2614888103,633803317),l(3248222580,3479774868),l(3835390401,2666613458),l(4022224774,944711139),l(264347078,2341262773),l(604807628,2007800933),l(770255983,1495990901),l(1249150122,1856431235),l(1555081692,3175218132),l(1996064986,2198950837),l(2554220882,3999719339),l(2821834349,766784016),l(2952996808,2566594879),l(3210313671,3203337956),l(3336571891,1034457026),l(3584528711,2466948901),l(113926993,3758326383),l(338241895,168717936),l(666307205,1188179964),l(773529912,1546045734),l(1294757372,1522805485),l(1396182291,2643833823),l(1695183700,2343527390),l(1986661051,1014477480),l(2177026350,1206759142),l(2456956037,344077627),l(2730485921,1290863460),l(2820302411,3158454273),l(3259730800,3505952657),l(3345764771,106217008),l(3516065817,3606008344),l(3600352804,1432725776),l(4094571909,1467031594),l(275423344,851169720),l(430227734,3100823752),l(506948616,1363258195),l(659060556,3750685593),l(883997877,3785050280),l(958139571,3318307427),l(1322822218,3812723403),l(1537002063,2003034995),l(1747873779,3602036899),l(1955562222,1575990012),l(2024104815,1125592928),l(2227730452,2716904306),l(2361852424,442776044),l(2428436474,593698344),l(2756734187,3733110249),l(3204031479,2999351573),l(3329325298,3815920427),l(3391569614,3928383900),l(3515267271,566280711),l(3940187606,3454069534),l(4118630271,4000239992),l(116418474,1914138554),l(174292421,2731055270),l(289380356,3203993006),l(460393269,320620315),l(685471733,587496836),l(852142971,1086792851),l(1017036298,365543100),l(1126000580,2618297676),l(1288033470,3409855158),l(1501505948,4234509866),l(1607167915,987167468),l(1816402316,1246189591)],u=[];(function(){for(var t=0;t<80;t++)u[t]=l()})();var d=s.SHA512=i.extend({_doReset:function(){this._hash=new o.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var a=this._hash.words,i=a[0],n=a[1],r=a[2],o=a[3],s=a[4],l=a[5],d=a[6],h=a[7],p=i.high,v=i.low,f=n.high,g=n.low,m=r.high,y=r.low,b=o.high,_=o.low,x=s.high,w=s.low,S=l.high,k=l.low,C=d.high,I=d.low,E=h.high,A=h.low,P=p,D=v,T=f,M=g,R=m,F=y,B=b,L=_,N=x,$=w,z=S,V=k,O=C,W=I,H=E,Y=A,K=0;K<80;K++){var X,q,U=u[K];if(K<16)q=U.high=0|t[e+2*K],X=U.low=0|t[e+2*K+1];else{var j=u[K-15],G=j.high,Z=j.low,J=(G>>>1|Z<<31)^(G>>>8|Z<<24)^G>>>7,Q=(Z>>>1|G<<31)^(Z>>>8|G<<24)^(Z>>>7|G<<25),tt=u[K-2],et=tt.high,at=tt.low,it=(et>>>19|at<<13)^(et<<3|at>>>29)^et>>>6,nt=(at>>>19|et<<13)^(at<<3|et>>>29)^(at>>>6|et<<26),rt=u[K-7],ot=rt.high,st=rt.low,lt=u[K-16],ct=lt.high,ut=lt.low;X=Q+st,q=J+ot+(X>>>0<Q>>>0?1:0),X+=nt,q=q+it+(X>>>0<nt>>>0?1:0),X+=ut,q=q+ct+(X>>>0<ut>>>0?1:0),U.high=q,U.low=X}var dt=N&z^~N&O,ht=$&V^~$&W,pt=P&T^P&R^T&R,vt=D&M^D&F^M&F,ft=(P>>>28|D<<4)^(P<<30|D>>>2)^(P<<25|D>>>7),gt=(D>>>28|P<<4)^(D<<30|P>>>2)^(D<<25|P>>>7),mt=(N>>>14|$<<18)^(N>>>18|$<<14)^(N<<23|$>>>9),yt=($>>>14|N<<18)^($>>>18|N<<14)^($<<23|N>>>9),bt=c[K],_t=bt.high,xt=bt.low,wt=Y+yt,St=H+mt+(wt>>>0<Y>>>0?1:0),kt=(wt=wt+ht,St=St+dt+(wt>>>0<ht>>>0?1:0),wt=wt+xt,St=St+_t+(wt>>>0<xt>>>0?1:0),wt=wt+X,St=St+q+(wt>>>0<X>>>0?1:0),gt+vt),Ct=ft+pt+(kt>>>0<gt>>>0?1:0);H=O,Y=W,O=z,W=V,z=N,V=$,$=L+wt|0,N=B+St+($>>>0<L>>>0?1:0)|0,B=R,L=F,R=T,F=M,T=P,M=D,D=wt+kt|0,P=St+Ct+(D>>>0<wt>>>0?1:0)|0}v=i.low=v+D,i.high=p+P+(v>>>0<D>>>0?1:0),g=n.low=g+M,n.high=f+T+(g>>>0<M>>>0?1:0),y=r.low=y+F,r.high=m+R+(y>>>0<F>>>0?1:0),_=o.low=_+L,o.high=b+B+(_>>>0<L>>>0?1:0),w=s.low=w+$,s.high=x+N+(w>>>0<$>>>0?1:0),k=l.low=k+V,l.high=S+z+(k>>>0<V>>>0?1:0),I=d.low=I+W,d.high=C+O+(I>>>0<W>>>0?1:0),A=h.low=A+Y,h.high=E+H+(A>>>0<Y>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,a=8*this._nDataBytes,i=8*t.sigBytes;e[i>>>5]|=128<<24-i%32,e[30+(i+128>>>10<<5)]=Math.floor(a/4294967296),e[31+(i+128>>>10<<5)]=a,t.sigBytes=4*e.length,this._process();var n=this._hash.toX32();return n},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=i._createHelper(d),e.HmacSHA512=i._createHmacHelper(d)}(),t.SHA512})},7628:function(t,e,a){(function(e,i){t.exports=i(a(19021),a(80754),a(84636),a(39506),a(57165))})(0,function(t){return function(){var e=t,a=e.lib,i=a.WordArray,n=a.BlockCipher,r=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=r.DES=n.extend({_doReset:function(){for(var t=this._key,e=t.words,a=[],i=0;i<56;i++){var n=o[i]-1;a[i]=e[n>>>5]>>>31-n%32&1}for(var r=this._subKeys=[],c=0;c<16;c++){var u=r[c]=[],d=l[c];for(i=0;i<24;i++)u[i/6|0]|=a[(s[i]-1+d)%28]<<31-i%6,u[4+(i/6|0)]|=a[28+(s[i+24]-1+d)%28]<<31-i%6;u[0]=u[0]<<1|u[0]>>>31;for(i=1;i<7;i++)u[i]=u[i]>>>4*(i-1)+3;u[7]=u[7]<<5|u[7]>>>27}var h=this._invSubKeys=[];for(i=0;i<16;i++)h[i]=r[15-i]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,a){this._lBlock=t[e],this._rBlock=t[e+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=a[i],r=this._lBlock,o=this._rBlock,s=0,l=0;l<8;l++)s|=c[l][((o^n[l])&u[l])>>>0];this._lBlock=o,this._rBlock=r^s}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(t,e){var a=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=a,this._lBlock^=a<<t}function p(t,e){var a=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=a,this._rBlock^=a<<t}e.DES=n._createHelper(d);var v=r.TripleDES=n.extend({_doReset:function(){var t=this._key,e=t.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var a=e.slice(0,2),n=e.length<4?e.slice(0,2):e.slice(2,4),r=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(i.create(a)),this._des2=d.createEncryptor(i.create(n)),this._des3=d.createEncryptor(i.create(r))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(v)}(),t.TripleDES})},43240:function(t,e,a){(function(e,i){t.exports=i(a(19021))})(0,function(t){return function(e){var a=t,i=a.lib,n=i.Base,r=i.WordArray,o=a.x64={};o.Word=n.extend({init:function(t,e){this.high=t,this.low=e}}),o.WordArray=n.extend({init:function(t,a){t=this.words=t||[],this.sigBytes=a!=e?a:8*t.length},toX32:function(){for(var t=this.words,e=t.length,a=[],i=0;i<e;i++){var n=t[i];a.push(n.high),a.push(n.low)}return r.create(a,this.sigBytes)},clone:function(){for(var t=n.clone.call(this),e=t.words=this.words.slice(0),a=e.length,i=0;i<a;i++)e[i]=e[i].clone();return t}})}(),t})},50477:function(){},21560:function(t,e,a){"use strict";a.d(e,{A:function(){return n}});var i=a(44735);function n(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],a=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&a>=t.length&&(t=void 0),{value:t&&t[a++],done:!t}}}}throw new TypeError((0,i.A)(t)+" is not iterable")}}}]);