(self["webpackChunkvue_antd_pro"]=self["webpackChunkvue_antd_pro"]||[]).push([[471],{53004:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return ua}});var n=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(i){return e("a-select-option",{key:i.value,attrs:{value:i.value}},[e("div",{staticClass:"symbol-option"},[e("a-tag",{staticStyle:{"margin-right":"8px","margin-bottom":"0"},attrs:{color:t.getMarketColor(i.market)}},[t._v(" "+t._s(t.getMarketName(i.market))+" ")]),e("span",{staticClass:"symbol-name"},[t._v(t._s(i.symbol))]),i.name?e("span",{staticClass:"symbol-name-extra"},[t._v(t._s(i.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(i){return e("div",{key:i,staticClass:"timeframe-item",class:{active:t.timeframe===i},on:{click:function(e){return t.setTimeframe(i)}}},[t._v(" "+t._s(i)+" ")])}),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(i){return e("div",{key:"custom-"+i.id,class:["indicator-card",{"indicator-active":t.isIndicatorActive("custom-"+i.id)}],on:{click:function(e){return t.toggleIndicator(i,"custom")}}},[e("div",{staticClass:"card-content"},[e("div",{staticClass:"card-header"},[e("span",{staticClass:"card-name"},[t._v(t._s(i.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(i)}}})],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(i)}}})],1),e("a-tooltip",{attrs:{title:t.isIndicatorActive("custom-"+i.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-"+i.id)}],attrs:{type:t.isIndicatorActive("custom-"+i.id)?"pause-circle":"play-circle"},on:{click:function(e){return e.stopPropagation(),t.toggleIndicator(i,"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(i)}}})],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(i)}}})],1),e("a-tooltip",{attrs:{title:i.publish_to_community?t.$t("dashboard.indicator.action.unpublish"):t.$t("dashboard.indicator.action.publish")}},[e("a-icon",{class:["action-icon","publish-icon",{published:i.publish_to_community}],attrs:{type:i.publish_to_community?"cloud":"cloud-upload"},on:{click:function(e){return e.stopPropagation(),t.handlePublishIndicator(i)}}})],1)],1)]),e("span",{staticClass:"card-desc"},[t._v(t._s(i.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(i){return e("div",{key:"custom-"+i.id,class:["indicator-card",{"indicator-active":t.isIndicatorActive("custom-"+i.id)}],on:{click:function(e){return t.toggleIndicator(i,"custom")}}},[e("div",{staticClass:"card-content"},[e("div",{staticClass:"card-header"},[e("span",{staticClass:"card-name"},[t._v(t._s(i.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(i)}}})],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(i)}}})],1),e("a-tooltip",{attrs:{title:t.isIndicatorActive("custom-"+i.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-"+i.id)}],attrs:{type:t.isIndicatorActive("custom-"+i.id)?"pause-circle":"play-circle"},on:{click:function(e){return e.stopPropagation(),t.toggleIndicator(i,"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(i)}}})],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(i)}}})],1),e("a-tooltip",{attrs:{title:i.publish_to_community?t.$t("dashboard.indicator.action.unpublish"):t.$t("dashboard.indicator.action.publish")}},[e("a-icon",{class:["action-icon","publish-icon",{published:i.publish_to_community}],attrs:{type:i.publish_to_community?"cloud":"cloud-upload"},on:{click:function(e){return e.stopPropagation(),t.handlePublishIndicator(i)}}})],1)],1)]),e("span",{staticClass:"card-desc"},[t._v(t._s(i.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(i){return e("div",{key:"purchased-"+i.id,class:["indicator-card","purchased-indicator",{"indicator-active":t.isIndicatorActive("purchased-"+i.id)}],on:{click:function(e){return t.toggleIndicator(i,"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(i.name)+" ")],1),e("div",{staticClass:"card-actions"},[e("a-tooltip",{attrs:{title:t.isIndicatorActive("purchased-"+i.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-"+i.id)}],attrs:{type:t.isIndicatorActive("purchased-"+i.id)?"pause-circle":"play-circle"},on:{click:function(e){return e.stopPropagation(),t.toggleIndicator(i,"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(i)}}})],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(i)}}})],1)],1)]),e("span",{staticClass:"card-desc"},[t._v(t._s(i.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(i){return e("div",{key:i.name,staticClass:"param-item"},[e("div",{staticClass:"param-header"},[e("label",{staticClass:"param-label"},[t._v(t._s(i.name))]),i.description?e("a-tooltip",{attrs:{title:i.description}},[e("a-icon",{staticStyle:{color:"#999","margin-left":"4px"},attrs:{type:"question-circle"}})],1):t._e()],1),"int"===i.type?e("a-input-number",{staticStyle:{width:"100%"},attrs:{precision:0},model:{value:t.indicatorParamValues[i.name],callback:function(e){t.$set(t.indicatorParamValues,i.name,e)},expression:"indicatorParamValues[param.name]"}}):"float"===i.type?e("a-input-number",{staticStyle:{width:"100%"},attrs:{precision:4},model:{value:t.indicatorParamValues[i.name],callback:function(e){t.$set(t.indicatorParamValues,i.name,e)},expression:"indicatorParamValues[param.name]"}}):"bool"===i.type?e("a-switch",{model:{value:t.indicatorParamValues[i.name],callback:function(e){t.$set(t.indicatorParamValues,i.name,e)},expression:"indicatorParamValues[param.name]"}}):e("a-input",{model:{value:t.indicatorParamValues[i.name],callback:function(e){t.$set(t.indicatorParamValues,i.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(i){return e("a-tab-pane",{key:i.value,attrs:{tab:t.$t(i.i18nKey||"dashboard.analysis.market.".concat(i.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(i){return e("a-list-item",{staticClass:"symbol-list-item",on:{click:function(e){return t.selectSymbol(i)}}},[e("a-list-item-meta",[e("template",{slot:"title"},[e("div",{staticClass:"symbol-item-content"},[e("span",{staticClass:"symbol-code"},[t._v(t._s(i.symbol))]),e("span",{staticClass:"symbol-name"},[t._v(t._s(i.name))]),i.exchange?e("a-tag",{staticStyle:{"margin-left":"8px"},attrs:{size:"small",color:"blue"}},[t._v(" "+t._s(i.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(i){return e("a-list-item",{staticClass:"symbol-list-item",on:{click:function(e){return t.selectSymbol(i)}}},[e("a-list-item-meta",[e("template",{slot:"title"},[e("div",{staticClass:"symbol-item-content"},[e("span",{staticClass:"symbol-code"},[t._v(t._s(i.symbol))]),e("span",{staticClass:"symbol-name"},[t._v(t._s(i.name))]),i.exchange?e("a-tag",{staticStyle:{"margin-left":"8px"},attrs:{size:"small",color:"orange"}},[t._v(" "+t._s(i.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)},r=[],a=(i(62621),i(43898)),o=i(68285),s=i(21092),l=i(76959),c=i(17654),u=(i(6011),i(18787)),d=i(57888),h=(i(74423),i(85471)),p=i(95353),f=i(76471),v=i(64118),g=i(55585),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=i(52074),x=i(15237),_=i.n(x),w=(i(74806),i(55218),i(97923),i(50436),i(74053)),C=i.n(w),S=i(41802),k={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,f.Ay)({url:"/api/indicator/verifyCode",method:"post",data:{code:e}}).then(function(e){if(1===e.code){var i=e.data||{};t.$message.success("".concat(t.$t("dashboard.indicator.editor.verifyCodeSuccess")," (").concat(i.plots_count||0," plots, ").concat(i.signals_count||0," signals)"))}else{var n=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),n.details?t("pre",{style:{background:"#f5f5f5",padding:"8px",overflow:"auto",maxHeight:"300px",marginTop:"8px",fontSize:"12px",fontFamily:"monospace"}},n.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(),i=/```/.test(e);return i?(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(i){}this.codeEditor=null}try{this.$refs.codeEditorContainer.innerHTML="",this.codeEditor=_()(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(n){}}},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 i,n,r,a,o,s,c,u,d,h,p,f,v,g,m,y,x,_,w,k,A,T,M,I,E;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,i="",t.codeEditor&&(i=t.codeEditor.getValue()||""),t.codeEditor&&(t.codeEditor.setValue("# AI generating...\n"),t.codeEditor.refresh()),n="",e.p=2,r="/api/indicator/aiGenerate",a=C().get(S.Xh),o={prompt:t.aiPrompt.trim()},i.trim()&&(o.existingCode=i.trim()),e.n=3,fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:a?"Bearer ".concat(a):"","Access-Token":a||"",Token:a||""},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,f=p.done,v=p.value,!f){e.n=9;break}return e.a(3,21);case 9:h+=d.decode(v,{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(x=y.value,x.trim()&&x.startsWith("data: ")){e.n=12;break}return e.a(3,16);case 12:if(_=x.substring(6),"[DONE]"!==_){e.n=13;break}return e.a(3,17);case 13:if(e.p=13,w=JSON.parse(_),!w.error){e.n=14;break}throw new Error(w.error);case 14:w.content&&(n+=w.content,k=t.cleanMarkdownCodeBlocks(n),t.codeEditor&&(t.codeEditor.setValue(k),A=t.codeEditor.lineCount(),t.codeEditor.setCursor({line:A-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,I=e.v,m.e(I);case 19:return e.p=19,m.f(),e.f(19);case 20:e.n=7;break;case 21:t.codeEditor&&n?(T=t.cleanMarkdownCodeBlocks(n),t.codeEditor.setValue(T),t.codeEditor.refresh(),t.$message.success(t.$t("dashboard.indicator.editor.aiGenerateSuccess"))):n||t.$message.warning("未生成任何代码,请尝试更详细的提示词"),e.n=23;break;case 22:e.p=22,E=e.v,t.$message.error(E.message||t.$t("dashboard.indicator.editor.aiGenerateError")),n&&t.codeEditor&&(M=t.cleanMarkdownCodeBlocks(n),t.codeEditor.setValue(M));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]])}))()}}},A=k,T=i(845),M=(0,T.A)(A,m,y,!1,null,"4fea1865",null),I=M.exports,E=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(i){return e("a-tooltip",{key:i.name,attrs:{title:i.title,placement:"right"}},[e("div",{staticClass:"drawing-tool-btn",class:{active:t.activeDrawingTool===i.name},on:{click:function(e){return t.selectDrawingTool(i.name)}}},[e("a-icon",{attrs:{type:i.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(i){return e("div",{key:i.id,staticClass:"indicator-btn",class:{active:t.isIndicatorActive(i.id)},attrs:{title:i.name},on:{click:function(e){return t.toggleIndicator(i)}}},[t._v(" "+t._s(i.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)])])])},D=[];function P(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],i=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}throw new TypeError((0,o.A)(t)+" is not iterable")}var L=i(42822),R=i(9133),F=function(t,e){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},F(t,e)};function B(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}F(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var N,O,z,W,V,$,H,K,Y,X=function(){return X=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&r[r.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function q(t,e){var i="function"===typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,a=i.call(t),o=[];try{while((void 0===e||e-- >0)&&!(n=a.next()).done)o.push(n.value)}catch(s){r={error:s}}finally{try{n&&!n.done&&(i=a["return"])&&i.call(a)}finally{if(r)throw r.error}}return o}function Z(t,e,i){if(i||2===arguments.length)for(var n,r=0,a=e.length;r1e9)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 i="".concat(t);if(0===e.length)return i;if(i.includes(".")){var n=i.split(".");return"".concat(n[0].replace(/(\d)(?=(\d{3})+$)/g,function(t){return"".concat(t).concat(e)}),".").concat(n[1])}return i.replace(/(\d)(?=(\d{3})+$)/g,function(t){return"".concat(t).concat(e)})}function Wt(t,e){var i="".concat(t),n=new RegExp("\\.0{"+e+",}[1-9][0-9]*$");if(n.test(i)){var r=i.split("."),a=r[r.length-1],o=a.match(/0*/);if(Mt(o)){var s=o[0].length;return r[r.length-1]=a.replace(/0*/,"0{".concat(s,"}")),r.join(".")}}return i}function Vt(t){var e,i,n;return null!==(n=null===(i=null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView)||void 0===i?void 0:i.devicePixelRatio)&&void 0!==n?n:1}function $t(t,e,i){return"".concat(null!==e&&void 0!==e?e:"normal"," ").concat(null!==t&&void 0!==t?t:12,"px ").concat(null!==i&&void 0!==i?i:"Helvetica Neue")}function Ht(t,e,i,n){if(!Mt(Dt)){var r=document.createElement("canvas"),a=Vt(r);Dt=r.getContext("2d"),Dt.scale(a,a)}return Dt.font=$t(e,i,n),Math.round(Dt.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"})(Pt||(Pt={}));var Kt,Yt,Xt=function(){function t(){this._callbacks=[]}return t.prototype.subscribe=function(t){var e,i=null!==(e=this._callbacks.indexOf(t))&&void 0!==e?e:-1;i<0&&this._callbacks.push(t)},t.prototype.unsubscribe=function(t){var e;if(kt(t)){var i=null!==(e=this._callbacks.indexOf(t))&&void 0!==e?e:-1;i>-1&&this._callbacks.splice(i,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 Ut(t,e,i,n,r){var a,o=e.result,s=e.figures,l=e.styles,c=Ft(l,"circles",n.circles),u=c.length,d=Ft(l,"bars",n.bars),h=d.length,p=Ft(l,"lines",n.lines),f=p.length,v=0,g=0,m=0,y=0;s.forEach(function(s){var l;switch(s.type){case"circle":y=v;var b=c[v%u];a=X(X({},b),{color:b.noChangeColor}),v++;break;case"bar":y=g;var x=d[g%h];a=X(X({},x),{color:x.noChangeColor}),g++;break;case"line":y=m,a=p[m%f],m++;break}if(Mt(a)){var _={prev:{kLineData:t[i-1],indicatorData:o[i-1]},current:{kLineData:t[i],indicatorData:o[i]},next:{kLineData:t[i+1],indicatorData:o[i+1]}},w=null===(l=s.styles)||void 0===l?void 0:l.call(s,_,e,n);r(s,X(X({},a),w),y)}})}(function(t){t["Init"]="init",t["Forward"]="forward",t["Backward"]="backward"})(Kt||(Kt={})),function(t){t["Normal"]="normal",t["Price"]="price",t["Volume"]="volume"}(Yt||(Yt={}));var Gt,jt=function(){function t(t){this.result=[],this._precisionFlag=!1;var e=t.name,i=t.shortName,n=t.series,r=t.calcParams,a=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,f=t.extendData,v=t.regenerateFigures,g=t.createTooltipDataSource,m=t.draw;this.name=e,this.shortName=null!==i&&void 0!==i?i:e,this.series=null!==n&&void 0!==n?n:Yt.Normal,this.precision=null!==o&&void 0!==o?o:4,this.calcParams=null!==r&&void 0!==r?r:[],this.figures=null!==a&&void 0!==a?a:[],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=Ct(null!==p&&void 0!==p?p:{}),this.extendData=f,this.regenerateFigures=null!==v&&void 0!==v?v: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 i=null!==e&&void 0!==e&&e,n=Math.floor(t);return!(!(n!==this.precision&&t>=0)||i&&(!i||this._precisionFlag))&&(this.precision=n,i||(this._precisionFlag=!0),!0)},t.prototype.setCalcParams=function(t){var e,i;return this.calcParams=t,this.figures=null!==(i=null===(e=this.regenerateFigures)||void 0===e?void 0:e.call(this,t))&&void 0!==i?i: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 U(this,void 0,void 0,function(){var e;return G(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.calc(t,this)];case 1:return e=i.sent(),this.result=e,[2,!0];case 2:return i.sent(),[2,!1];case 3:return[2]}})})},t.extend=function(e){var i=function(t){function i(){return t.call(this,e)||this}return B(i,t),i.prototype.calc=function(t,i){return e.calc(t,i)},i}(t);return i},t}();function qt(){return["mouseClickEvent","mouseDoubleClickEvent","mouseRightClickEvent","tapEvent","doubleTapEvent","mouseDownEvent","touchStartEvent","mouseMoveEvent","touchMoveEvent"]}(function(t){t["Normal"]="normal",t["WeakMagnet"]="weak_magnet",t["StrongMagnet"]="strong_magnet"})(Gt||(Gt={}));var Zt,Jt=1,Qt=-1,te="overlay_",ee="overlay_figure_",ie=function(){function t(t){this.currentStep=Jt,this.points=[],this._prevPressedPoint=null,this._prevPressedPoints=[];var e=t.mode,i=t.modeSensitivity,n=t.extendData,r=t.styles,a=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,f=t.createXAxisFigures,v=t.createYAxisFigures,g=t.performEventPressedMove,m=t.performEventMoveForDrawing,y=t.onDrawStart,b=t.onDrawing,x=t.onDrawEnd,_=t.onClick,w=t.onDoubleClick,C=t.onRightClick,S=t.onPressedMoveStart,k=t.onPressedMoving,A=t.onPressedMoveEnd,T=t.onMouseEnter,M=t.onMouseLeave,I=t.onRemoved,E=t.onSelected,D=t.onDeselected;this.name=a,this.totalStep=!Tt(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:Gt.Normal,this.modeSensitivity=null!==i&&void 0!==i?i:8,this.extendData=n,this.styles=Ct(null!==r&&void 0!==r?r:{}),this.createPointFigures=null!==p&&void 0!==p?p:null,this.createXAxisFigures=null!==f&&void 0!==f?f:null,this.createYAxisFigures=null!==v&&void 0!==v?v: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!==x&&void 0!==x?x:null,this.onClick=null!==_&&void 0!==_?_:null,this.onDoubleClick=null!==w&&void 0!==w?w:null,this.onRightClick=null!==C&&void 0!==C?C:null,this.onPressedMoveStart=null!==S&&void 0!==S?S:null,this.onPressedMoving=null!==k&&void 0!==k?k:null,this.onPressedMoveEnd=null!==A&&void 0!==A?A:null,this.onMouseEnter=null!==T&&void 0!==T?T:null,this.onMouseLeave=null!==M&&void 0!==M?M:null,this.onRemoved=null!==I&&void 0!==I?I:null,this.onSelected=null!==E&&void 0!==E?E:null,this.onDeselected=null!==D&&void 0!==D?D:null}return t.prototype.setId=function(t){return!Et(this.id)&&(this.id=t,!0)},t.prototype.setGroupId=function(t){return!Et(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([],q(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 i=0;is?n=a:r=a,o<=2)break}return n}function fe(t){var e=Math.floor(ye(t)),i=be(e),n=t/i,r=0;return r=n<1.5?1:n<2.5?2:n<3.5?3:n<4.5?4:n<5.5?5:n<6.5?6:8,t=r*i,e>=-20?+t.toFixed(e<0?-e:0):t}function ve(t,e){null==e&&(e=10),e=Math.min(Math.max(0,e),20);var i=(+t).toFixed(e);return+i}function ge(t){var e=t.toString(),i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return n<0?-n:0}var r=e.indexOf(".");return r<0?0:e.length-1-r}function me(t,e,i){var n=[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER];return t.forEach(function(t){var r,a;n[0]=Math.max(null!==(r=t[e])&&void 0!==r?r:t,n[0]),n[1]=Math.min(null!==(a=t[i])&&void 0!==a?a:t,n[1])}),n}function ye(t){return Math.log(t)/Math.log(10)}function be(t){return Math.pow(10,t)}function xe(){return{from:0,to:0,realFrom:0,realTo:0}}var _e={MIN:1,MAX:50},we=8,Ce=80,Se=.88,ke=10,Ae=function(){function t(t){this._dateTimeFormat=this._buildDateTimeFormat(),this._zoomEnabled=!0,this._scrollEnabled=!0,this._totalBarSpace=0,this._barSpace=we,this._offsetRightDistance=Ce,this._startLastBarRightSideDiffBarCount=0,this._scrollLimitRole=0,this._minVisibleBarCount={left:2,right:2},this._maxOffsetDistance={left:50,right:50},this._visibleRange=xe(),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*Se):(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,i,n,r=this._chartStore.getDataList(),a=r.length,o=this._totalBarSpace/this._barSpace;1===this._scrollLimitRole?(i=(this._totalBarSpace-this._maxOffsetDistance.right)/this._barSpace,n=(this._totalBarSpace-this._maxOffsetDistance.left)/this._barSpace):(i=this._minVisibleBarCount.left,n=this._minVisibleBarCount.right),i=Math.max(0,i),n=Math.max(0,n);var s=o-Math.min(i,a);this._lastBarRightSideDiffBarCount>s&&(this._lastBarRightSideDiffBarCount=s);var l=-a+Math.min(n,a);this._lastBarRightSideDiffBarCounta&&(c=a);var d=Math.round(c-o)-1;d<0&&(d=0);var h=this._lastBarRightSideDiffBarCount>0?Math.round(a+this._lastBarRightSideDiffBarCount-o)-1:d;if(this._visibleRange={from:d,to:c,realFrom:h,realTo:u},this._chartStore.getActionStore().execute(Pt.OnVisibleRangeChange,this._visibleRange),this._chartStore.adjustVisibleDataList(),0===d){var p=r[0];this._chartStore.executeLoadMoreCallback(null!==(t=null===p||void 0===p?void 0:p.timestamp)&&void 0!==t?t:null),this._chartStore.executeLoadDataCallback({type:Kt.Forward,data:null!==p&&void 0!==p?p:null})}c===a&&this._chartStore.executeLoadDataCallback({type:Kt.Backward,data:null!==(e=r[a-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"};Et(t)&&(e.timeZone=t);var i=null;try{i=new Intl.DateTimeFormat("en",e)}catch(n){bt("","","Timezone is error!!!")}return i},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<_e.MIN||t>_e.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,i=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 n=Math.round(i-this._lastBarRightSideDiffBarCount*this._barSpace);0!==n&&this._chartStore.getActionStore().execute(Pt.OnScroll,{distance:n})}},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,i=(this._totalBarSpace-t)/this._barSpace,n=e+this._lastBarRightSideDiffBarCount-i;return Math.round(1e6*n)/1e6},t.prototype.dataIndexToTimestamp=function(t){var e,i=this.getDataByDataIndex(t);return null!==(e=null===i||void 0===i?void 0:i.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,i=e+this._lastBarRightSideDiffBarCount-t;return Math.floor(this._totalBarSpace-(i-.5)*this._barSpace)},t.prototype.coordinateToDataIndex=function(t){return Math.ceil(this.coordinateToFloatIndex(t))-1},t.prototype.zoom=function(t,e){var i,n=this;if(this._zoomEnabled){var r=null!==e&&void 0!==e?e:null;if(!Tt(null===r||void 0===r?void 0:r.x)){var a=this._chartStore.getTooltipStore().getCrosshair();r={x:null!==(i=null===a||void 0===a?void 0:a.x)&&void 0!==i?i:this._totalBarSpace/2}}var o=r.x,s=this.coordinateToFloatIndex(o),l=this._barSpace,c=this._barSpace+t*(this._barSpace/ke);this.setBarSpace(c,function(){n._lastBarRightSideDiffBarCount+=s-n.coordinateToFloatIndex(o)});var u=this._barSpace/l;1!==u&&this._chartStore.getActionStore().execute(Pt.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=xe()},t}(),Te={name:"AVP",shortName:"AVP",series:Yt.Price,precision:2,figures:[{key:"avp",title:"AVP: ",type:"line"}],calc:function(t){var e=0,i=0;return t.map(function(t){var n,r,a={},o=null!==(n=null===t||void 0===t?void 0:t.turnover)&&void 0!==n?n:0,s=null!==(r=null===t||void 0===t?void 0:t.volume)&&void 0!==r?r:0;return e+=o,i+=s,0!==i&&(a.avp=e/i),a})}},Me={name:"AO",shortName:"AO",calcParams:[5,34],figures:[{key:"ao",title:"AO: ",type:"bar",baseValue:0,styles:function(t,e,i){var n,r,a,o,s,l=t.prev,c=t.current,u=null!==(r=null===(n=l.indicatorData)||void 0===n?void 0:n.ao)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,d=null!==(o=null===(a=c.indicatorData)||void 0===a?void 0:a.ao)&&void 0!==o?o:Number.MIN_SAFE_INTEGER;s=d>u?Ft(e.styles,"bars[0].upColor",i.bars[0].upColor):Ft(e.styles,"bars[0].downColor",i.bars[0].downColor);var h=d>u?O.Stroke:O.Fill;return{color:s,style:h,borderColor:s}}}],calc:function(t,e){var i=e.calcParams,n=Math.max(i[0],i[1]),r=0,a=0,o=0,s=0;return t.map(function(e,l){var c={},u=(e.low+e.high)/2;if(r+=u,a+=u,l>=i[0]-1){o=r/i[0];var d=t[l-(i[0]-1)];r-=(d.low+d.high)/2}if(l>=i[1]-1){s=a/i[1];d=t[l-(i[1]-1)];a-=(d.low+d.high)/2}return l>=n-1&&(c.ao=o-s),c})}},Ie={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 i=e.calcParams,n=e.figures,r=[];return t.map(function(e,a){var o={},s=e.close;return i.forEach(function(e,l){var c;if(r[l]=(null!==(c=r[l])&&void 0!==c?c:0)+s,a>=e-1){var u=r[l]/i[l];o[n[l].key]=(s-u)/u*100,r[l]-=t[a-(e-1)].close}}),o})}};function Ee(t,e){var i=t.length,n=0;return t.forEach(function(t){var i=t.close-e;n+=i*i}),n=Math.abs(n),Math.sqrt(n/i)}var De={name:"BOLL",shortName:"BOLL",series:Yt.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 i=e.calcParams,n=i[0]-1,r=0;return t.map(function(e,a){var o=e.close,s={};if(r+=o,a>=n){s.mid=r/i[0];var l=Ee(t.slice(a-n,a+1),s.mid);s.up=s.mid+i[1]*l,s.dn=s.mid-i[1]*l,r-=t[a-n].close}return s})}},Pe={name:"BRAR",shortName:"BRAR",calcParams:[26],figures:[{key:"br",title:"BR: ",type:"line"},{key:"ar",title:"AR: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=0,r=0,a=0,o=0;return t.map(function(e,s){var l,c,u={},d=e.high,h=e.low,p=e.open,f=(null!==(l=t[s-1])&&void 0!==l?l:e).close;if(a+=d-p,o+=p-h,n+=d-f,r+=f-h,s>=i[0]-1){u.ar=0!==o?a/o*100:0,u.br=0!==r?n/r*100:0;var v=t[s-(i[0]-1)],g=v.high,m=v.low,y=v.open,b=(null!==(c=t[s-i[0]])&&void 0!==c?c:t[s-(i[0]-1)]).close;n-=g-b,r-=b-m,a-=g-y,o-=y-m}return u})}},Le={name:"BBI",shortName:"BBI",series:Yt.Price,precision:2,calcParams:[3,6,12,24],shouldOhlc:!0,figures:[{key:"bbi",title:"BBI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=Math.max.apply(Math,Z([],q(i),!1)),r=[],a=[];return t.map(function(e,o){var s={},l=e.close;if(i.forEach(function(e,i){var n;r[i]=(null!==(n=r[i])&&void 0!==n?n:0)+l,o>=e-1&&(a[i]=r[i]/e,r[i]-=t[o-(e-1)].close)}),o>=n-1){var c=0;a.forEach(function(t){c+=t}),s.bbi=c/4}return s})}},Re={name:"CCI",shortName:"CCI",calcParams:[20],figures:[{key:"cci",title:"CCI: ",type:"line"}],calc:function(t,e){var i=e.calcParams,n=i[0]-1,r=0,a=[];return t.map(function(e,o){var s={},l=(e.high+e.low+e.close)/3;if(r+=l,a.push(l),o>=n){var c=r/i[0],u=a.slice(o-n,o+1),d=0;u.forEach(function(t){d+=Math.abs(t-c)});var h=d/i[0];s.cci=0!==h?(l-c)/h/.015:0;var p=(t[o-n].high+t[o-n].low+t[o-n].close)/3;r-=p}return s})}},Fe={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 i=e.calcParams,n=Math.ceil(i[1]/2.5+1),r=Math.ceil(i[2]/2.5+1),a=Math.ceil(i[3]/2.5+1),o=Math.ceil(i[4]/2.5+1),s=0,l=[],c=0,u=[],d=0,h=[],p=0,f=[],v=[];return t.forEach(function(e,g){var m,y,b,x,_,w={},C=null!==(m=t[g-1])&&void 0!==m?m:e,S=(C.high+C.close+C.low+C.open)/4,k=Math.max(0,e.high-S),A=Math.max(0,S-e.low);g>=i[0]-1&&(w.cr=0!==A?k/A*100:0,s+=w.cr,c+=w.cr,d+=w.cr,p+=w.cr,g>=i[0]+i[1]-2&&(l.push(s/i[1]),g>=i[0]+i[1]+n-3&&(w.ma1=l[l.length-1-n]),s-=null!==(y=v[g-(i[1]-1)].cr)&&void 0!==y?y:0),g>=i[0]+i[2]-2&&(u.push(c/i[2]),g>=i[0]+i[2]+r-3&&(w.ma2=u[u.length-1-r]),c-=null!==(b=v[g-(i[2]-1)].cr)&&void 0!==b?b:0),g>=i[0]+i[3]-2&&(h.push(d/i[3]),g>=i[0]+i[3]+a-3&&(w.ma3=h[h.length-1-a]),d-=null!==(x=v[g-(i[3]-1)].cr)&&void 0!==x?x:0),g>=i[0]+i[4]-2&&(f.push(p/i[4]),g>=i[0]+i[4]+o-3&&(w.ma4=f[f.length-1-o]),p-=null!==(_=v[g-(i[4]-1)].cr)&&void 0!==_?_:0)),v.push(w)}),v}},Be={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 i=e.calcParams,n=Math.max(i[0],i[1]),r=0,a=0,o=0,s=[];return t.forEach(function(e,l){var c,u={},d=e.close;r+=d,a+=d;var h=0,p=0;if(l>=i[0]-1&&(h=r/i[0],r-=t[l-(i[0]-1)].close),l>=i[1]-1&&(p=a/i[1],a-=t[l-(i[1]-1)].close),l>=n-1){var f=h-p;u.dma=f,o+=f,l>=n+i[2]-2&&(u.ama=o/i[2],o-=null!==(c=s[l-(i[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 i=e.calcParams,n=0,r=0,a=0,o=0,s=0,l=0,c=0,u=0,d=[];return t.forEach(function(e,h){var p,f,v={},g=null!==(p=t[h-1])&&void 0!==p?p:e,m=g.close,y=e.high,b=e.low,x=y-b,_=Math.abs(y-m),w=Math.abs(m-b),C=y-g.high,S=g.low-b,k=Math.max(Math.max(x,_),w),A=C>0&&C>S?C:0,T=S>0&&S>C?S:0;if(n+=k,r+=A,a+=T,h>=i[0]-1){h>i[0]-1?(o=o-o/i[0]+k,s=s-s/i[0]+A,l=l-l/i[0]+T):(o=n,s=r,l=a);var M=0,I=0;0!==o&&(M=100*s/o,I=100*l/o),v.pdi=M,v.mdi=I;var E=0;I+M!==0&&(E=Math.abs(I-M)/(I+M)*100),c+=E,h>=2*i[0]-2&&(u=h>2*i[0]-2?(u*(i[0]-1)+E)/i[0]:c/i[0],v.adx=u,h>=2*i[0]+i[1]-3&&(v.adxr=((null!==(f=d[h-(i[1]-1)].adx)&&void 0!==f?f:0)+u)/2))}d.push(v)}),d}},Oe={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 i=e.calcParams,n=0,r=[];return t.map(function(e,a){var o,s={};if(a>0){var l=t[a-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}n+=s.emv,r.push(s.emv),a>=i[0]&&(s.maEmv=n/i[0],n-=r[a-i[0]])}return s})}},ze={name:"EMA",shortName:"EMA",series:Yt.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 i=e.calcParams,n=e.figures,r=0,a=[];return t.map(function(t,e){var o={},s=t.close;return r+=s,i.forEach(function(t,i){e>=t-1&&(a[i]=e>t-1?(2*s+(t-1)*a[i])/(t+1):r/t,o[n[i].key]=a[i])}),o})}},We={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 i=e.calcParams,n=0,r=[];return t.forEach(function(e,a){var o,s={};if(a>=i[0]){var l=e.close,c=t[a-i[0]].close;s.mtm=l-c,n+=s.mtm,a>=i[0]+i[1]-1&&(s.maMtm=n/i[1],n-=null!==(o=r[a-(i[1]-1)].mtm)&&void 0!==o?o:0)}r.push(s)}),r}},Ve={name:"MA",shortName:"MA",series:Yt.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 i=e.calcParams,n=e.figures,r=[];return t.map(function(e,a){var o={},s=e.close;return i.forEach(function(e,i){var l;r[i]=(null!==(l=r[i])&&void 0!==l?l:0)+s,a>=e-1&&(o[n[i].key]=r[i]/e,r[i]-=t[a-(e-1)].close)}),o})}},$e={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,i){var n,r,a,o,s,l=t.prev,c=t.current,u=null!==(r=null===(n=l.indicatorData)||void 0===n?void 0:n.macd)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,d=null!==(o=null===(a=c.indicatorData)||void 0===a?void 0:a.macd)&&void 0!==o?o:Number.MIN_SAFE_INTEGER;s=d>0?Ft(e.styles,"bars[0].upColor",i.bars[0].upColor):d<0?Ft(e.styles,"bars[0].downColor",i.bars[0].downColor):Ft(e.styles,"bars[0].noChangeColor",i.bars[0].noChangeColor);var h=u=r[0]-1&&(i=e>r[0]-1?(2*d+(r[0]-1)*i)/(r[0]+1):a/r[0]),e>=r[1]-1&&(n=e>r[1]-1?(2*d+(r[1]-1)*n)/(r[1]+1):a/r[1]),e>=c-1&&(o=i-n,u.dif=o,s+=o,e>=c+r[2]-2&&(l=e>c+r[2]-2?(2*o+l*(r[2]-1))/(r[2]+1):s/r[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 i=e.calcParams,n=0,r=0,a=[];return t.forEach(function(e,o){var s,l,c,u,d=null!==(s=t[o-1])&&void 0!==s?s:e;e.closed.close&&(r+=null!==(c=e.volume)&&void 0!==c?c:0);var h={obv:r};n+=r,o>=i[0]-1&&(h.maObv=n/i[0],n-=null!==(u=a[o-(i[0]-1)].obv)&&void 0!==u?u:0),a.push(h)}),a}},Ke={name:"PVT",shortName:"PVT",figures:[{key:"pvt",title:"PVT: ",type:"line"}],calc:function(t){var e=0;return t.map(function(i,n){var r,a,o={},s=i.close,l=null!==(r=i.volume)&&void 0!==r?r:1,c=(null!==(a=t[n-1])&&void 0!==a?a:i).close,u=0,d=c*l;return 0!==d&&(u=(s-c)/d),e+=u,o.pvt=e,o})}},Ye={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 i=e.calcParams,n=0,r=0,a=[],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;a.push(h),n+=h,s>=i[0]-1&&(u.psy=n/i[0]*100,r+=u.psy,s>=i[0]+i[1]-2&&(u.maPsy=r/i[1],r-=null!==(c=o[s-(i[1]-1)].psy)&&void 0!==c?c:0),n-=a[s-(i[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 i=e.calcParams,n=[],r=0;return t.forEach(function(e,a){var o,s,l={};if(a>=i[0]-1){var c=e.close,u=(null!==(o=t[a-i[0]])&&void 0!==o?o:t[a-(i[0]-1)]).close;l.roc=0!==u?(c-u)/u*100:0,r+=l.roc,a>=i[0]-1+i[1]-1&&(l.maRoc=r/i[1],r-=null!==(s=n[a-(i[1]-1)].roc)&&void 0!==s?s:0)}n.push(l)}),n}},Ue={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 i=e+1;return{key:"rsi".concat(i),title:"RSI".concat(i,": "),type:"line"}})},calc:function(t,e){var i=e.calcParams,n=e.figures,r=[],a=[];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 i.forEach(function(e,i){var s,c,d;if(u>0?r[i]=(null!==(s=r[i])&&void 0!==s?s:0)+u:a[i]=(null!==(c=a[i])&&void 0!==c?c:0)+Math.abs(u),o>=e-1){0!==a[i]?l[n[i].key]=100-100/(1+r[i]/a[i]):l[n[i].key]=0;var h=t[o-(e-1)],p=null!==(d=t[o-e])&&void 0!==d?d:h,f=h.close-p.close;f>0?r[i]-=f:a[i]-=Math.abs(f)}}),l})}},Ge={name:"SMA",shortName:"SMA",series:Yt.Price,calcParams:[12,2],precision:2,figures:[{key:"sma",title:"SMA: ",type:"line"}],shouldOhlc:!0,calc:function(t,e){var i=e.calcParams,n=0,r=0;return t.map(function(t,e){var a={},o=t.close;return n+=o,e>=i[0]-1&&(r=e>i[0]-1?(o*i[1]+r*(i[0]-i[1]+1))/(i[0]+1):n/i[0],a.sma=r),a})}},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 i=e.calcParams,n=[];return t.forEach(function(e,r){var a,o,s,l,c={},u=e.close;if(r>=i[0]-1){var d=me(t.slice(r-(i[0]-1),r+1),"high","low"),h=d[0],p=d[1],f=h-p,v=(u-p)/(0===f?1:f)*100;c.k=((i[1]-1)*(null!==(o=null===(a=n[r-1])||void 0===a?void 0:a.k)&&void 0!==o?o:50)+v)/i[1],c.d=((i[2]-1)*(null!==(l=null===(s=n[r-1])||void 0===s?void 0:s.d)&&void 0!==l?l:50)+c.k)/i[2],c.j=3*c.k-2*c.d}n.push(c)}),n}},qe={name:"SAR",shortName:"SAR",series:Yt.Price,calcParams:[2,2,20],precision:2,shouldOhlc:!0,figures:[{key:"sar",title:"SAR: ",type:"circle",styles:function(t,e,i){var n,r,a=t.current,o=null!==(r=null===(n=a.indicatorData)||void 0===n?void 0:n.sar)&&void 0!==r?r:Number.MIN_SAFE_INTEGER,s=a.kLineData,l=((null===s||void 0===s?void 0:s.high)+(null===s||void 0===s?void 0:s.low))/2,c=oe.low?(c=s,o=n,s=-100,l=!l):c>p&&(c=p)}else{(-100===s||s>h)&&(s=h,o=Math.min(o+r,a)),c=u+o*(s-u);var f=Math.max(t[Math.max(1,i)-1].high,d);c=a[0]-1&&(i=e>a[0]-1?(2*p+(a[0]-1)*i)/(a[0]+1):o/a[0],s+=i,e>=2*a[0]-2&&(n=e>2*a[0]-2?(2*i+(a[0]-1)*n)/(a[0]+1):s/a[0],l+=n,e>=3*a[0]-3))){var f=void 0,v=0;e>3*a[0]-3?(f=(2*n+(a[0]-1)*r)/(a[0]+1),v=(f-r)/r*100):f=l/a[0],r=f,h.trix=v,c+=v,e>=3*a[0]+a[1]-4&&(h.maTrix=c/a[1],c-=null!==(d=u[e-(a[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,i){var n=t.current.kLineData,r=Ft(e.styles,"bars[0].noChangeColor",i.bars[0].noChangeColor);return Mt(n)&&(n.close>n.open?r=Ft(e.styles,"bars[0].upColor",i.bars[0].upColor):n.close=e-1&&(l[n[i].key]=r[i]/e,r[i]-=null!==(c=t[a-(e-1)].volume)&&void 0!==c?c:0)}),l})}},ti={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 i=e.calcParams,n=0,r=0,a=0,o=0,s=[];return t.forEach(function(e,l){var c,u,d,h,p,f={},v=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(v>g?n+=m:v=i[0]-1){var y=a/2;f.vr=r+y===0?0:(n+y)/(r+y)*100,o+=f.vr,l>=i[0]+i[1]-2&&(f.maVr=o/i[1],o-=null!==(d=s[l-(i[1]-1)].vr)&&void 0!==d?d:0);var b=t[l-(i[0]-1)],x=null!==(h=t[l-i[0]])&&void 0!==h?h:b,_=b.close,w=null!==(p=b.volume)&&void 0!==p?p:0;_>x.close?n-=w:_=s){var l=me(t.slice(r-s,r+1),"high","low"),c=l[0],u=l[1],d=c-u;a[n[i].key]=0===d?0:(o-c)/d*100}}),a})}},ii={},ni=[Te,Me,Ie,De,Pe,Le,Re,Fe,Be,Ne,Oe,ze,We,Ve,$e,He,Ke,Ye,Xe,Ue,Ge,je,qe,Ze,Qe,ti,ei];function ri(t){ii[t.name]=jt.extend(t)}function ai(t){var e;return null!==(e=ii[t])&&void 0!==e?e:null}ni.forEach(function(t){ii[t.name]=jt.extend(t)});var oi=function(){function t(t){this._instances=new Map,this._chartStore=t}return t.prototype._overrideInstance=function(t,e){var i=e.shortName,n=e.series,r=e.calcParams,a=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,f=e.extendData,v=e.regenerateFigures,g=e.createTooltipDataSource,m=e.draw,y=e.calc,b=!1;Et(i)&&t.setShortName(i)&&(b=!0),Mt(n)&&t.setSeries(n)&&(b=!0);var x=!1;St(r)&&t.setCalcParams(r)&&(b=!0,x=!0),St(o)&&t.setFigures(o)&&(b=!0,x=!0),void 0!==s&&t.setMinValue(s)&&(b=!0),void 0!==l&&t.setMinValue(l)&&(b=!0),Tt(a)&&t.setPrecision(a)&&(b=!0),It(c)&&t.setShouldOhlc(c)&&(b=!0),It(u)&&t.setShouldFormatBigNumber(u)&&(b=!0),It(d)&&t.setVisible(d)&&(b=!0);var _=!1;return Tt(h)&&t.setZLevel(h)&&(b=!0,_=!0),Mt(p)&&t.setStyles(p)&&(b=!0),void 0!==f&&t.setExtendData(f)&&(b=!0,x=!0),void 0!==v&&t.setRegenerateFigures(v)&&(b=!0),void 0!==g&&t.setCreateTooltipDataSource(g)&&(b=!0),void 0!==m&&t.setDraw(m)&&(b=!0),kt(y)&&(t.calc=y,x=!0),[b,x,_]},t.prototype._sort=function(t){var e;Et(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,i){return U(this,void 0,void 0,function(){var n,r,a,o,s;return G(this,function(l){switch(l.label){case 0:return n=t.name,r=this._instances.get(e),Mt(r)?(a=r.find(function(t){return t.name===n}),Mt(a)?[4,Promise.reject(new Error("Duplicate indicators."))]:[3,2]):[3,2];case 1:return[2,l.sent()];case 2:return Mt(r)||(r=[]),o=ai(n),s=new o,this.synchronizeSeriesPrecision(s),this._overrideInstance(s,t),i||(r=[]),r.push(s),this._instances.set(e,r),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 i,n=!1,r=this._instances.get(t);if(Mt(r)){if(Et(e)){var a=r.findIndex(function(t){return t.name===e});a>-1&&(r.splice(a,1),n=!0)}else this._instances.set(t,[]),n=!0;0===(null===(i=this._instances.get(t))||void 0===i?void 0:i.length)&&this._instances.delete(t)}return n},t.prototype.hasInstances=function(t){return this._instances.has(t)},t.prototype.calcInstance=function(t,e){return U(this,void 0,void 0,function(){var i,n,r,a,o=this;return G(this,function(s){switch(s.label){case 0:return i=[],Et(t)?Et(e)?(n=this._instances.get(e),Mt(n)&&(r=n.find(function(e){return e.name===t}),Mt(r)&&i.push(r.calcIndicator(this._chartStore.getDataList())))):this._instances.forEach(function(e){var n=e.find(function(e){return e.name===t});Mt(n)&&i.push(n.calcIndicator(o._chartStore.getDataList()))}):this._instances.forEach(function(t){t.forEach(function(t){i.push(t.calcIndicator(o._chartStore.getDataList()))})}),[4,Promise.all(i)];case 1:return a=s.sent(),[2,a.includes(!0)]}})})},t.prototype.getInstanceByPaneId=function(t,e){var i,n,r=function(t){var e=new Map;return t.forEach(function(t){e.set(t.name,t)}),e};if(Et(t)){var a=null!==(i=this._instances.get(t))&&void 0!==i?i:[];return Et(e)?null!==(n=null===a||void 0===a?void 0:a.find(function(t){return t.name===e}))&&void 0!==n?n:null:r(a)}var o=new Map;return this._instances.forEach(function(t,e){o.set(e,r(t))}),o},t.prototype.synchronizeSeriesPrecision=function(t){var e=this._chartStore.getPrecision(),i=e.price,n=e.volume,r=function(t){switch(t.series){case Yt.Price:t.setPrecision(i,!0);break;case Yt.Volume:t.setPrecision(n,!0);break}};Mt(t)?r(t):this._instances.forEach(function(t){t.forEach(function(t){r(t)})})},t.prototype.override=function(t,e){return U(this,void 0,void 0,function(){var i,n,r,a,o,s,l,c=this;return G(this,function(u){switch(u.label){case 0:return i=t.name,n=new Map,null!==e?(r=this._instances.get(e),Mt(r)&&n.set(e,r)):n=this._instances,a=!1,o=[],s=!1,n.forEach(function(e){var n=e.find(function(t){return t.name===i});if(Mt(n)){var r=c._overrideInstance(n,t);r[2]&&(s=!0),r[1]?o.push(n.calcIndicator(c._chartStore.getDataList())):r[0]&&(a=!0)}}),s&&this._sort(),[4,Promise.all(o)];case 1:return l=u.sent(),[2,[a,l.includes(!0)]]}})})},t}(),si=function(){function t(t){this._crosshair={},this._activeIcon=null,this._chartStore=t}return t.prototype.setCrosshair=function(t,e){var i,n,r=null!==e&&void 0!==e?e:{},a=r.notInvalidate,o=r.notExecuteAction,s=this._chartStore.getDataList(),l=null!==t&&void 0!==t?t:{};Tt(l.x)?(i=this._chartStore.getTimeScaleStore().coordinateToDataIndex(l.x),n=i<0?0:i>s.length-1?s.length-1:i):(i=s.length-1,n=i);var c=s[n],u=this._chartStore.getTimeScaleStore().dataIndexToCoordinate(i),d={x:this._crosshair.x,y:this._crosshair.y,paneId:this._crosshair.paneId};this._crosshair=X(X({},l),{realX:u,kLineData:c,realDataIndex:i,dataIndex:n}),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!==a&&void 0!==a&&a||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}(),li={name:"fibonacciLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e,i=t.coordinates,n=t.bounding,r=t.overlay,a=t.precision,o=t.thousandsSeparator,s=t.decimalFoldThreshold,l=t.yAxis,c=r.points;if(i.length>0){var u=null===(e=null===l||void 0===l?void 0:l.isInCandle())||void 0===e||e?a.price:a.excludePriceVolumeMax,d=[],h=[],p=0,f=n.width;if(i.length>1&&Tt(c[0].value)&&Tt(c[1].value)){var v=[1,.786,.618,.5,.382,.236,0],g=i[0].y-i[1].y,m=c[0].value-c[1].value;v.forEach(function(t){var e,n=i[1].y+g*t,r=Wt(zt(((null!==(e=c[1].value)&&void 0!==e?e:0)+m*t).toFixed(u),o),s);d.push({coordinates:[{x:p,y:n},{x:f,y:n}]}),h.push({x:p,y:n,text:"".concat(r," (").concat((100*t).toFixed(1),"%)"),baseline:"bottom"})})}return[{type:"line",attrs:d},{type:"text",isCheckEvent:!1,attrs:h}]}return[]}},ci={name:"horizontalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding,n={x:0,y:e[0].y};return Mt(e[1])&&e[0].x-1)for(var r=n;r>-1;r--)if(this._children[r].dispatchEvent(t,e,i))return!0;return this.onEvent(t,e,i)},t.prototype.addChild=function(t){return this._children.push(t),this},t.prototype.clear=function(){this._children=[]},t}(),pi=2,fi=function(t){function e(e){var i=t.call(this)||this;return i.attrs=e.attrs,i.styles=e.styles,i}return B(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 i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return B(i,e),i.prototype.checkEventOnImp=function(e,i,n){return t.checkEventOn(e,i,n)},i.prototype.drawImp=function(e,i,n){t.draw(e,i,n)},i}(e);return i},e}(hi);function vi(t,e){var i=[];i=i.concat(e);for(var n=0;n1)for(var a=1;a0&&i<1?i:0:i?.5:0;if(r>0&&n>2){for(var a=e[0].x,o=e[0].y,s=1;s1&&(2!==i.length||i[0].x!==i[1].x&&i[0].y!==i[1].y?(t.save(),c%2===1&&t.translate(.5,.5),t.beginPath(),t.moveTo(i[0].x,i[0].y),bi(t,i,s),t.stroke(),t.closePath(),t.restore()):(t.beginPath(),i[0].x===i[1].x?(t.moveTo(i[0].x+f,i[0].y),t.lineTo(i[1].x+f,i[1].y)):(t.moveTo(i[0].x,i[0].y+f),t.lineTo(i[1].x,i[1].y+f)),t.stroke(),t.closePath()))})}var _i={name:"line",checkEventOn:vi,draw:function(t,e,i){xi(t,e,i)}};function wi(t,e,i){var n=null!==i&&void 0!==i?i:0,r=[];if(t.length>1)if(t[0].x===t[1].x){var a=0,o=e.height;if(r.push({coordinates:[{x:t[0].x,y:a},{x:t[0].x,y:o}]}),t.length>2){r.push({coordinates:[{x:t[2].x,y:a},{x:t[2].x,y:o}]});for(var s=t[0].x-t[2].x,l=0;l2){var v=t[2].y-p*t[2].x;r.push({coordinates:[{x:u,y:u*p+v},{x:d,y:d*p+v}]});for(s=f-v,l=0;l1){var i=void 0;return i=t[0].x===t[1].x&&t[0].y!==t[1].y?t[0].yt[1].x?{x:0,y:mi(t[0],t[1],{x:0,y:t[0].y})}:{x:e.width,y:mi(t[0],t[1],{x:e.width,y:t[0].y})},{coordinates:[t[0],i]}}return[]}var Ti={name:"rayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;return[{type:"line",attrs:Ai(e,i)}]}},Mi={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}}]:[]}},Ii={name:"straightLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=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:i.height}]}}]:[{type:"line",attrs:{coordinates:[{x:0,y:mi(e[0],e[1],{x:0,y:e[0].y})},{x:i.width,y:mi(e[0],e[1],{x:i.width,y:e[0].y})}]}}]:[]}},Ei={name:"verticalRayLine",totalStep:3,needDefaultPointFigure:!0,needDefaultXAxisFigure:!0,needDefaultYAxisFigure:!0,createPointFigures:function(t){var e=t.coordinates,i=t.bounding;if(2===e.length){var n={x:e[0].x,y:0};return e[0].y0&&l.set(e[0],n)};try{for(var u=j(this._instances),d=u.next();!d.done;d=u.next()){var h=d.value;c(h)}}catch(f){e={error:f}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}this._instances=l}else this._instances.forEach(function(t,e){a.push(e),t.forEach(function(t){var e;null===(e=t.onRemoved)||void 0===e||e.call(t,{overlay:t})})}),this._instances.clear();if(a.length>0){var p=this._chartStore.getChart();a.forEach(function(t){p.updatePane(1,t)}),p.updatePane(1,Vi.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 i=this._chartStore.getDataList();this._instances.forEach(function(n){n.forEach(function(n){var r=n.points;r.forEach(function(n){if(!Mt(n.timestamp)&&Mt(n.dataIndex)){e===Kt.Forward&&(n.dataIndex=n.dataIndex+t);var r=i[n.dataIndex];n.timestamp=null===r||void 0===r?void 0:r.timestamp}})})})}},t.prototype.setHoverInstanceInfo=function(t,e){var i,n,r=this._hoverInstanceInfo,a=r.instance,o=r.figureType,s=r.figureKey,l=r.figureIndex;if(((null===a||void 0===a?void 0:a.id)!==(null===(i=t.instance)||void 0===i?void 0:i.id)||o!==t.figureType||l!==t.figureIndex)&&(this._hoverInstanceInfo=t,(null===a||void 0===a?void 0:a.id)!==(null===(n=t.instance)||void 0===n?void 0:n.id))){var c=!1,u=!1;null!==a&&(u=!0,kt(a.onMouseLeave)&&(a.onMouseLeave(X({overlay:a,figureKey:s,figureIndex:l},e)),c=!0)),null!==t.instance&&(u=!0,kt(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 i,n,r,a,o,s,l,c,u,d=this._clickInstanceInfo,h=d.paneId,p=d.instance,f=d.figureType,v=d.figureKey,g=d.figureIndex;if(null!==(n=null===(i=t.instance)||void 0===i?void 0:i.isDrawing())&&void 0!==n&&n||null===(a=null===(r=t.instance)||void 0===r?void 0:r.onClick)||void 0===a||a.call(r,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)||f!==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:v,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,Vi.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}(),Hi=function(){function t(){this._actions=new Map}return t.prototype.execute=function(t,e){var i;null===(i=this._actions.get(t))||void 0===i||i.execute(e)},t.prototype.subscribe=function(t,e){var i;this._actions.has(t)||this._actions.set(t,new Xt),null===(i=this._actions.get(t))||void 0===i||i.subscribe(e)},t.prototype.unsubscribe=function(t,e){var i=this._actions.get(t);Mt(i)&&(i.unsubscribe(e),i.isEmpty()&&this._actions.delete(t))},t.prototype.has=function(t){var e=this._actions.get(t);return Mt(e)&&!e.isEmpty()},t}(),Ki={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"}}}},Yi={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"}}}},Xi={light:Ki,dark:Yi};function Ui(t){var e;return null!==(e=Xi[t])&&void 0!==e?e:null}var Gi=function(){function t(t,e){this._styles=gt(),this._customApi=ne(),this._locale=re,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 Ae(this),this._indicatorStore=new oi(this),this._overlayStore=new $i(this),this._tooltipStore=new si(this),this._actionStore=new Hi,this._visibleDataList=[],this._chart=t,this.setOptions(e)}return t.prototype.adjustVisibleDataList=function(){this._visibleDataList=[];for(var t=this._timeScaleStore.getVisibleRange(),e=t.realFrom,i=t.realTo,n=e;n0&&(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,i){return U(this,void 0,void 0,function(){var n,r,a,o,s,l,c;return G(this,function(u){switch(u.label){case 0:if(n=!1,r=!1,a=0,St(t)){switch(a=t.length,e){case Kt.Init:this.clear(),this._dataList=t,this._forwardMore=null===i||void 0===i||i,this._timeScaleStore.resetOffsetRightDistance(),r=!0;break;case Kt.Backward:this._dataList=this._dataList.concat(t),this._backwardMore=null!==i&&void 0!==i&&i,r=a>0;break;case Kt.Forward:this._dataList=t.concat(this._dataList),this._forwardMore=null!==i&&void 0!==i&&i,r=a>0}this._loading=!1,n=!0}else o=this._dataList.length,s=t.timestamp,l=Ft(this._dataList[o-1],"timestamp",0),s>l?(this._dataList.push(t),c=this._timeScaleStore.getLastBarRightSideDiffBarCount(),c<0&&this._timeScaleStore.setLastBarRightSideDiffBarCount(--c),a=1,n=!0,r=!0):s===l&&(this._dataList[o-1]=t,n=!0,r=!0);if(!n)return[3,5];u.label=1;case 1:return u.trys.push([1,4,,5]),this._overlayStore.updatePointPosition(a,e),r?(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(Pt.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&&Mt(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&&Mt(this._loadDataCallback)&&(this._forwardMore&&t.type===Kt.Forward||this._backwardMore&&t.type===Kt.Backward)){var i=function(i,n){e.addData(i,t.type,n).then(function(){}).catch(function(){})};this._loading=!0,this._loadDataCallback(X(X({},t),{callback:i}))}},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}(),ji={MAIN:"main",X_AXIS:"xAxis",Y_AXIS:"yAxis",SEPARATOR:"separator"},qi=7;function Zi(){return U(this,void 0,void 0,function(){return G(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){var e=new ResizeObserver(function(i){t(i.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 Ji=function(){function t(t,e){var i=this;this._supportedDevicePixelContentBox=!1,this._width=0,this._height=0,this._pixelWidth=0,this._pixelHeight=0,this._nextPixelWidth=0,this._nextPixelHeight=0,this._requestAnimationId=ae,this._mediaQueryListener=function(){var t=Vt(i._element);i._nextPixelWidth=Math.round(i._element.clientWidth*t),i._nextPixelHeight=Math.round(i._element.clientHeight*t),i._resetPixelRatio()},this._listener=e,this._element=he("canvas",t),this._ctx=this._element.getContext("2d",{willReadFrequently:!0}),Zi().then(function(t){i._supportedDevicePixelContentBox=t,t?(i._resizeObserver=new ResizeObserver(function(t){var e,n=t.find(function(t){return t.target===i._element}),r=null===(e=null===n||void 0===n?void 0:n.devicePixelContentBoxSize)||void 0===e?void 0:e[0];Mt(r)&&(i._nextPixelWidth=r.inlineSize,i._nextPixelHeight=r.blockSize,i._pixelWidth===i._nextPixelWidth&&i._pixelHeight===i._nextPixelHeight||i._resetPixelRatio())}),i._resizeObserver.observe(i._element,{box:"device-pixel-content-box"})):(i._mediaQueryList=window.matchMedia("(resolution: ".concat(Vt(i._element),"dppx)")),i._mediaQueryList.addListener(i._mediaQueryListener))}).catch(function(t){return!1})}return t.prototype._resetPixelRatio=function(){var t=this;this._executeListener(function(){var e=t._element.clientWidth,i=t._element.clientHeight,n=t._nextPixelWidth/e,r=t._nextPixelHeight/i;t._width=e,t._height=i,t._pixelWidth=t._nextPixelWidth,t._pixelHeight=t._nextPixelHeight,t._element.width=t._nextPixelWidth,t._element.height=t._nextPixelHeight,t._ctx.scale(n,r)})},t.prototype._executeListener=function(t){var e=this;this._requestAnimationId===ae&&(this._requestAnimationId=oe(function(){e._ctx.clearRect(0,0,e._width,e._height),null===t||void 0===t||t(),e._listener(),e._requestAnimationId=ae}))},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 i=Vt(this._element);this._nextPixelWidth=Math.round(t*i),this._nextPixelHeight=Math.round(e*i),this._resetPixelRatio()}}else this._executeListener()},t.prototype.getElement=function(){return this._element},t.prototype.getContext=function(){return this._ctx},t.prototype.destroy=function(){Mt(this._resizeObserver)&&this._resizeObserver.unobserve(this._element),Mt(this._mediaQueryList)&&this._mediaQueryList.removeListener(this._mediaQueryListener)},t}();function Qi(t){var e={width:0,height:0,left:0,right:0,top:0,bottom:0};return Mt(t)&&wt(e,t),e}var tn=function(t){function e(e,i){var n=t.call(this)||this;return n._bounding=Qi(),n._pane=i,n._rootContainer=e,n._container=n.createContainer(),e.appendChild(n._container),n}return B(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}(hi),en=function(t){function e(e,i){var n=t.call(this,e,i)||this;n._mainCanvas=new Ji({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},function(){n.updateMain(n._mainCanvas.getContext())}),n._overlayCanvas=new Ji({position:"absolute",top:"0",left:"0",zIndex:"2",boxSizing:"border-box"},function(){n.updateOverlay(n._overlayCanvas.getContext())});var r=n.getContainer();return r.appendChild(n._mainCanvas.getElement()),r.appendChild(n._overlayCanvas.getElement()),n}return B(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,i){var n=e.width,r=e.height,a=e.left;t.style.left="".concat(a,"px");var o=i,s=t.clientWidth,l=t.clientHeight;switch(n===s&&r===l||(t.style.width="".concat(n,"px"),t.style.height="".concat(r,"px"),o=3),o){case 0:this._mainCanvas.update(n,r);break;case 1:this._overlayCanvas.update(n,r);break;case 3:case 4:this._mainCanvas.update(n,r),this._overlayCanvas.update(n,r);break}},e.prototype.destroy=function(){this._mainCanvas.destroy(),this._overlayCanvas.destroy()},e.prototype.getImage=function(t){var e=this.getBounding(),i=e.width,n=e.height,r=he("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),a=r.getContext("2d"),o=Vt(r);return r.width=i*o,r.height=n*o,a.scale(o,o),a.drawImage(this._mainCanvas.getElement(),0,0,i,n),t&&a.drawImage(this._overlayCanvas.getElement(),0,0,i,n),r},e}(tn);function nn(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]*(360|3[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 rn(t,e){var i=[];i=i.concat(e);for(var n=0;ns*s))return!0}return!1}function an(t,e,i){var n=[];n=n.concat(e);var r=i.style,a=void 0===r?O.Fill:r,o=i.color,s=void 0===o?"currentColor":o,l=i.borderSize,c=void 0===l?1:l,u=i.borderColor,d=void 0===u?"currentColor":u,h=i.borderStyle,p=void 0===h?N.Solid:h,f=i.borderDashedValue,v=void 0===f?[2,2]:f,g=(a===O.Fill||i.style===O.StrokeFill)&&(!Et(s)||!nn(s));g&&(t.fillStyle=s,n.forEach(function(e){var i=e.x,n=e.y,r=e.r;t.beginPath(),t.arc(i,n,r,0,2*Math.PI),t.closePath(),t.fill()})),(a===O.Stroke||i.style===O.StrokeFill)&&c>0&&!nn(d)&&(t.strokeStyle=d,t.lineWidth=c,p===N.Dashed?t.setLineDash(v):t.setLineDash([]),n.forEach(function(e){var i=e.x,n=e.y,r=e.r;(!g||r>c)&&(t.beginPath(),t.arc(i,n,r,0,2*Math.PI),t.closePath(),t.stroke())}))}var on={name:"circle",checkEventOn:rn,draw:function(t,e,i){an(t,e,i)}};function sn(t,e){var i=[];i=i.concat(e);for(var n=0;nt.y!==a[s].y>t.y&&t.x<(a[s].x-a[o].x)*(t.y-a[o].y)/(a[s].y-a[o].y)+a[o].x&&(r=!r);if(r)return!0}return!1}function ln(t,e,i){var n=[];n=n.concat(e);var r=i.style,a=void 0===r?O.Fill:r,o=i.color,s=void 0===o?"currentColor":o,l=i.borderSize,c=void 0===l?1:l,u=i.borderColor,d=void 0===u?"currentColor":u,h=i.borderStyle,p=void 0===h?N.Solid:h,f=i.borderDashedValue,v=void 0===f?[2,2]:f;a!==O.Fill&&i.style!==O.StrokeFill||Et(s)&&nn(s)||(t.fillStyle=s,n.forEach(function(e){var i=e.coordinates;t.beginPath(),t.moveTo(i[0].x,i[0].y);for(var n=1;n0&&!nn(d)&&(t.strokeStyle=d,t.lineWidth=c,p===N.Dashed?t.setLineDash(v):t.setLineDash([]),n.forEach(function(e){var i=e.coordinates;t.beginPath(),t.moveTo(i[0].x,i[0].y);for(var n=1;n=a&&t.x<=a+o&&t.y>=s&&t.y<=s+l)return!0}return!1}function dn(t,e,i){var n,r=[];r=r.concat(e);var a=i.style,o=void 0===a?O.Fill:a,s=i.color,l=void 0===s?"transparent":s,c=i.borderSize,u=void 0===c?1:c,d=i.borderColor,h=void 0===d?"transparent":d,p=i.borderStyle,f=void 0===p?N.Solid:p,v=i.borderRadius,g=void 0===v?0:v,m=i.borderDashedValue,y=void 0===m?[2,2]:m,b=null!==(n=t.roundRect)&&void 0!==n?n:t.rect,x=(o===O.Fill||i.style===O.StrokeFill)&&(!Et(l)||!nn(l));if(x&&(t.fillStyle=l,r.forEach(function(e){var i=e.x,n=e.y,r=e.width,a=e.height;t.beginPath(),b.call(t,i,n,r,a,g),t.closePath(),t.fill()})),(o===O.Stroke||i.style===O.StrokeFill)&&u>0&&!nn(h)){t.strokeStyle=h,t.fillStyle=h,t.lineWidth=u,f===N.Dashed?t.setLineDash(y):t.setLineDash([]);var _=u%2===1?.5:0,w=Math.round(2*_);r.forEach(function(e){var i=e.x,n=e.y,r=e.width,a=e.height;r>2*u&&a>2*u?(t.beginPath(),b.call(t,i+_,n+_,r-w,a-w,g),t.closePath(),t.stroke()):x||t.fillRect(i,n,r,a)})}}var hn={name:"rect",checkEventOn:un,draw:function(t,e,i){dn(t,e,i)}};function pn(t,e){var i,n,r=e.size,a=void 0===r?12:r,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,f=e.weight,v=void 0===f?"normal":f,g=e.family,m=t.x,y=t.y,b=t.text,x=t.align,_=void 0===x?"left":x,w=t.baseline,C=void 0===w?"top":w,S=t.width,k=t.height,A=null!==S&&void 0!==S?S:s+Ht(b,a,v,g)+d,T=null!==k&&void 0!==k?k:c+a+p;switch(_){case"left":case"start":i=m;break;case"right":case"end":i=m-A;break;default:i=m-A/2;break}switch(C){case"top":case"hanging":n=y;break;case"bottom":case"ideographic":case"alphabetic":n=y-T;break;default:n=y-T/2;break}return{x:i,y:n,width:A,height:T}}function fn(t,e,i){var n=[];n=n.concat(e);for(var r=0;r=o&&t.x<=o+l&&t.y>=s&&t.y<=s+c)return!0}return!1}function vn(t,e,i){var n=[];n=n.concat(e);var r=i.color,a=void 0===r?"currentColor":r,o=i.size,s=void 0===o?12:o,l=i.family,c=i.weight,u=i.paddingLeft,d=void 0===u?0:u,h=i.paddingTop,p=void 0===h?0:h,f=i.paddingRight,v=void 0===f?0:f,g=n.map(function(t){return pn(t,i)});dn(t,g,X(X({},i),{color:i.backgroundColor})),t.textAlign="left",t.textBaseline="top",t.font=$t(s,c,l),t.fillStyle=a,n.forEach(function(e,i){var n=g[i];t.fillText(e.text,n.x+d,n.y+p,n.width-d-v)})}var gn={name:"text",checkEventOn:fn,draw:function(t,e,i){vn(t,e,i)}},mn=gn;function yn(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}function bn(t,e){var i=[];i=i.concat(e);for(var n=0;n=Math.min(l,u)-pi&&t.y<=Math.max(c,d)+pi&&t.y>=Math.min(c,d)-pi)return!0}}return!1}function xn(t,e,i){var n=[];n=n.concat(e);var r=i.style,a=void 0===r?N.Solid:r,o=i.size,s=void 0===o?1:o,l=i.color,c=void 0===l?"currentColor":l,u=i.dashedValue,d=void 0===u?[2,2]:u;t.lineWidth=s,t.strokeStyle=c,a===N.Dashed?t.setLineDash(d):t.setLineDash([]),n.forEach(function(e){var i=e.x,n=e.y,r=e.r,a=e.startAngle,o=e.endAngle;t.beginPath(),t.arc(i,n,r,a,o),t.stroke(),t.closePath()})}var _n={name:"arc",checkEventOn:bn,draw:function(t,e,i){xn(t,e,i)}},wn={},Cn=[on,_i,cn,hn,gn,mn,_n];function Sn(t){var e;return null!==(e=wn[t])&&void 0!==e?e:null}Cn.forEach(function(t){wn[t.name]=fi.extend(t)});var kn=function(t){function e(e){var i=t.call(this)||this;return i._widget=e,i}return B(e,t),e.prototype.getWidget=function(){return this._widget},e.prototype.createFigure=function(t,e){var i=Sn(t.name);if(null!==i){var n=new i(t);if(Mt(e)){for(var r in e)e.hasOwnProperty(r)&&n.registerEvent(r,e[r]);this.addChild(n)}return n}return null},e.prototype.draw=function(t){this.clear(),this.drawImp(t)},e}(hi),An=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i,n=this.getWidget(),r=this.getWidget().getPane(),a=r.getChart(),o=n.getBounding(),s=a.getStyles().grid,l=s.show;if(l){t.save(),t.globalCompositeOperation="destination-over";var c=s.horizontal,u=c.show;if(u){var d=r.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,f=p.show;if(f){var v=a.getXAxisPane().getAxisComponent();h=v.getTicks().map(function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:o.height}]}});null===(i=this.createFigure({name:"line",attrs:h,styles:p}))||void 0===i||i.draw(t)}t.restore()}},e}(kn),Tn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.eachChildren=function(t){var e=this.getWidget().getPane(),i=e.getChart().getChartStore(),n=i.getVisibleDataList(),r=i.getTimeScaleStore().getBarSpace();n.forEach(function(e,i){t(e,r,i)})},e}(kn),Mn=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(Pt.OnCandleBarClick,t),!1}},e}return B(e,t),e.prototype.drawImp=function(t){var e=this,i=this.getWidget().getPane(),n=i.getId()===Vi.CANDLE,r=i.getChart().getChartStore(),a=this.getCandleBarOptions(r);if(null!==a){var o=0,s=0;if(a.type===H.Ohlc){var l=r.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=i.getAxisComponent();this.eachChildren(function(i,r){var l=i.data,u=i.x;if(Mt(l)){var d=l.open,h=l.high,p=l.low,f=l.close,v=a.type,g=a.styles,m=[];f>d?(m[0]=g.upColor,m[1]=g.upBorderColor,m[2]=g.upWickColor):fd?e._createStrokeBar(u,x,r,m):e._createSolidBar(u,x,r,m);break;case H.CandleDownStroke:_=d>f?e._createStrokeBar(u,x,r,m):e._createSolidBar(u,x,r,m);break;case H.Ohlc:_=[{name:"rect",attrs:[{x:u-s,y:x[0],width:o,height:x[3]-x[0]},{x:u-r.halfGapBar,y:y+o>x[3]?x[3]-o:y,width:r.halfGapBar,height:o},{x:u+s,y:b+o>x[3]?x[3]-o:b,width:r.halfGapBar-s,height:o}],styles:{color:m[0]}}];break}_.forEach(function(r){var a,o;n&&(o={mouseClickEvent:e._boundCandleBarClickEvent(i)}),null===(a=e.createFigure(r,o))||void 0===a||a.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,i,n){return[{name:"rect",attrs:{x:t,y:e[0],width:1,height:e[3]-e[0]},styles:{color:n[2]}},{name:"rect",attrs:{x:t-i.halfGapBar,y:e[1],width:i.gapBar,height:Math.max(1,e[2]-e[1])},styles:{style:O.StrokeFill,color:n[0],borderColor:n[1]}}]},e.prototype._createStrokeBar=function(t,e,i,n){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:n[2]}},{name:"rect",attrs:{x:t-i.halfGapBar,y:e[1],width:i.gapBar,height:Math.max(1,e[2]-e[1])},styles:{style:O.Stroke,borderColor:n[1]}}]},e}(Tn),In=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.getCandleBarOptions=function(t){var e,i,n=this.getWidget().getPane(),r=n.getAxisComponent();if(!r.isInCandle()){var a=t.getIndicatorStore().getInstances(n.getId());try{for(var o=j(a),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=Ft(c,"ohlc.upColor",u.ohlc.upColor),h=Ft(c,"ohlc.downColor",u.ohlc.downColor),p=Ft(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(f){e={error:f}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}}return null},e.prototype.drawImp=function(e){var i=this;t.prototype.drawImp.call(this,e);var n=this.getWidget(),r=n.getPane(),a=r.getChart(),o=n.getBounding(),s=a.getXAxisPane().getAxisComponent(),l=r.getAxisComponent(),c=a.getChartStore(),u=c.getDataList(),d=c.getTimeScaleStore(),h=d.getVisibleRange(),p=c.getIndicatorStore().getInstances(r.getId()),f=c.getStyles().indicator;e.save(),p.forEach(function(t){var n;if(t.visible){t.zLevel<0?e.globalCompositeOperation="destination-over":e.globalCompositeOperation="source-over";var r=!1;if(null!==t.draw&&(e.save(),r=null!==(n=t.draw({ctx:e,kLineDataList:u,indicator:t,visibleRange:h,bounding:o,barSpace:d.getBarSpace(),defaultStyles:f,xAxis:s,yAxis:l}))&&void 0!==n&&n,e.restore()),!r){var a=t.result,c=[];i.eachChildren(function(n,r){var d,h,p,v=r.halfGapBar,g=n.dataIndex,m=n.x,y=s.convertToPixel(g-1),b=s.convertToPixel(g+1),x=null!==(d=a[g-1])&&void 0!==d?d:null,_=null!==(h=a[g])&&void 0!==h?h:null,w=null!==(p=a[g+1])&&void 0!==p?p:null,C={x:y},S={x:m},k={x:b};t.figures.forEach(function(t){var e=t.key,i=null===x||void 0===x?void 0:x[e];Tt(i)&&(C[e]=l.convertToPixel(i));var n=null===_||void 0===_?void 0:_[e];Tt(n)&&(S[e]=l.convertToPixel(n));var r=null===w||void 0===w?void 0:w[e];Tt(r)&&(k[e]=l.convertToPixel(r))}),Ut(u,t,g,f,function(t,n,a){var u,d,h;if(Mt(null===_||void 0===_?void 0:_[t.key])){var p=S[t.key],f=null===(u=t.attrs)||void 0===u?void 0:u.call(t,{data:{prev:x,current:_,next:w},coordinate:{prev:C,current:S,next:k},bounding:o,barSpace:r,xAxis:s,yAxis:l});if(!Mt(f))switch(t.type){case"circle":f={x:m,y:p,r:Math.max(1,v)};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===_||void 0===_?void 0:_[t.key])&&(b=Math.max(1,b));var A=void 0;A=p>y?y:p,f={x:m-v,y:A,width:Math.max(1,2*v),height:b};break;case"line":Mt(c[a])||(c[a]=[]),Tt(S[t.key])&&Tt(k[t.key])&&c[a].push({coordinates:[{x:S.x,y:S[t.key]},{x:k.x,y:k[t.key]}],styles:n});break}var T=t.type;Mt(f)&&"line"!==T&&(null===(h=i.createFigure({name:"bar"===T?"rect":T,attrs:f,styles:n}))||void 0===h||h.draw(e))}})}),c.forEach(function(t){if(t.length>1){for(var n=[{coordinates:[t[0].coordinates[0],t[0].coordinates[1]],styles:t[0].styles}],r=1;r0,S=_.length>0;if(C||S){var k=q(p.classifyTooltipIcons(w),3),A=k[0],T=k[1],M=k[2];if(g=p.drawStandardTooltipIcons(t,r,A,m,e,a.name,c,g,d),C){var I=b;x.length>0&&(I="".concat(I).concat(x)),g=p.drawStandardTooltipLegends(t,[{title:{text:"",color:v.color},value:{text:I,color:v.color}}],m,c,g,d,v)}g=p.drawStandardTooltipIcons(t,r,T,m,e,a.name,c,g,d),S&&(g=p.drawStandardTooltipLegends(t,_,m,c,g,d,f.text)),g=p.drawStandardTooltipIcons(t,r,M,m,e,a.name,c,g,d),u=m.y+g}})}return u},e.prototype.drawStandardTooltipIcons=function(t,e,i,n,r,a,o,s,l){var c=this;if(i.length>0){var u=0,d=0;i.forEach(function(e){var i=e.marginLeft,n=void 0===i?0:i,r=e.marginTop,a=void 0===r?0:r,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,f=e.paddingTop,v=void 0===f?0:f,g=e.paddingRight,m=void 0===g?0:g,y=e.paddingBottom,b=void 0===y?0:y,x=e.size,_=e.fontFamily,w=e.icon;t.font=$t(x,"normal",_),u+=n+p+t.measureText(w).width+m+s,d=Math.max(d,a+v+x+b+c)}),n.x+u>l?(n.x=o,n.y+=s,s=d):s=Math.max(s,d),i.forEach(function(i){var o,s=i.marginLeft,l=void 0===s?0:s,u=i.marginTop,d=void 0===u?0:u,h=i.marginRight,p=void 0===h?0:h,f=i.paddingLeft,v=void 0===f?0:f,g=i.paddingTop,m=void 0===g?0:g,y=i.paddingRight,b=void 0===y?0:y,x=i.paddingBottom,_=void 0===x?0:x,w=i.color,C=i.activeColor,S=i.size,k=i.fontFamily,A=i.icon,T=i.backgroundColor,M=i.activeBackgroundColor,I=(null===e||void 0===e?void 0:e.paneId)===r&&(null===e||void 0===e?void 0:e.indicatorName)===a&&(null===e||void 0===e?void 0:e.iconId)===i.id;null===(o=c.createFigure({name:"text",attrs:{text:A,x:n.x+l,y:n.y+d},styles:{paddingLeft:v,paddingTop:m,paddingRight:b,paddingBottom:_,color:I?C:w,size:S,family:k,backgroundColor:I?M:T}},{mouseClickEvent:c._boundIconClickEvent({paneId:r,indicatorName:a,iconId:i.id}),mouseMoveEvent:c._boundIconMouseMoveEvent({paneId:r,indicatorName:a,iconId:i.id})}))||void 0===o||o.draw(t),n.x+=l+v+t.measureText(A).width+b+p})}return s},e.prototype.drawStandardTooltipLegends=function(t,e,i,n,r,a,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,f=o.weight;t.font=$t(h,f,p),e.forEach(function(e){var o,v,g=e.title,m=e.value,y=t.measureText(g.text).width,b=t.measureText(m.text).width,x=y+b,_=c+h+d;i.x+l+x+u>a?(i.x=n,i.y+=r,r=_):r=Math.max(r,_),g.text.length>0&&(null===(o=s.createFigure({name:"text",attrs:{x:i.x+l,y:i.y+c,text:g.text},styles:{color:g.color,size:h,family:p,weight:f}}))||void 0===o||o.draw(t)),null===(v=s.createFigure({name:"text",attrs:{x:i.x+l+y,y:i.y+c,text:m.text},styles:{color:m.color,size:h,family:p,weight:f}}))||void 0===v||v.draw(t),i.x+=l+x+u})}return r},e.prototype.isDrawTooltip=function(t,e){var i=e.showRule;return i===z.Always||i===z.FollowCross&&Et(t.paneId)},e.prototype.getIndicatorTooltipData=function(t,e,i,n,r,a,o){var s,l,c=o.tooltip,u=c.showName?i.shortName:"",d="",h=i.calcParams;h.length>0&&c.showParams&&(d="(".concat(h.join(","),")"));var p={name:u,calcParamsText:d,values:[],icons:c.icons},f=e.dataIndex,v=null!==(s=i.result)&&void 0!==s?s:[],g=[];if(i.visible){var m=null!==(l=v[f])&&void 0!==l?l:{};Ut(t,i,f,o,function(t,e){var o;if(Et(t.title)){var s=e.color,l=null!==(o=m[t.key])&&void 0!==o?o:c.defaultValue;Tt(l)&&(l=Nt(l,i.precision),i.shouldFormatBigNumber&&(l=n.formatBigNumber(l)),l=Wt(zt(l,r),a)),g.push({title:{text:t.title,color:s},value:{text:l,color:s}})}}),p.values=g}if(null!==i.createTooltipDataSource){var y=this.getWidget(),b=y.getPane(),x=b.getChart().getChartStore(),_=i.createTooltipDataSource({kLineDataList:t,indicator:i,visibleRange:x.getTimeScaleStore().getVisibleRange(),bounding:y.getBounding(),crosshair:e,defaultStyles:o,xAxis:b.getChart().getXAxisPane().getAxisComponent(),yAxis:b.getAxisComponent()}),w=_.name,C=_.calcParamsText,S=_.values,k=_.icons;if(Et(w)&&c.showName&&(p.name=w),Et(C)&&c.showParams&&(p.calcParamsText=C),Mt(k)&&(p.icons=k),Mt(S)&&i.visible){var A=[],T=o.tooltip.text.color;S.forEach(function(t){var e,o={text:"",color:T};At(t.title)?o=t.title:o.text=t.title;var s={text:"",color:T};if(At(t.value)?s=t.value:s.text=null!==(e=t.value)&&void 0!==e?e:c.defaultValue,Tt(s.text)){var l=Nt(s.text,i.precision);i.shouldFormatBigNumber&&(l=n.formatBigNumber(l)),l=Wt(zt(l,r),a),s.text=l}A.push({title:o,value:s})}),p.values=A}}return p},e.prototype.classifyTooltipIcons=function(t){var e=[],i=[],n=[];return t.forEach(function(t){switch(t.position){case V.Left:e.push(t);break;case V.Middle:i.push(t);break;case V.Right:n.push(t);break}}),[e,i,n]},e}(kn),Pn=function(t){function e(e){var i=t.call(this,e)||this;return i._initEvent(),i}return B(e,t),e.prototype._initEvent=function(){var t=this,e=this.getWidget().getPane(),i=e.getId(),n=e.getChart().getChartStore().getOverlayStore();this.registerEvent("mouseMoveEvent",function(e){var r,a=n.getProgressInstanceInfo();if(null!==a){var o=a.instance,s=a.paneId;o.isStart()&&(n.updateProgressInstanceInfo(i),s=i);var l=o.points.length-1,c="".concat(ee,"point_").concat(l);return o.isDrawing()&&s===i&&(o.eventMoveForDrawing(t._coordinateToPoint(a.instance,e)),null===(r=o.onDrawing)||void 0===r||r.call(o,X({overlay:o,figureKey:c,figureIndex:l},e))),t._figureMouseMoveEvent(o,1,c,l,0)(e)}return n.setHoverInstanceInfo({paneId:i,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1}).registerEvent("mouseClickEvent",function(e){var r,a,o=n.getProgressInstanceInfo();if(null!==o){var s=o.instance,l=o.paneId;s.isStart()&&(n.updateProgressInstanceInfo(i,!0),l=i);var c=s.points.length-1,u="".concat(ee,"point_").concat(c);return s.isDrawing()&&l===i&&(s.eventMoveForDrawing(t._coordinateToPoint(s,e)),null===(r=s.onDrawing)||void 0===r||r.call(s,X({overlay:s,figureKey:u,figureIndex:c},e)),s.nextStep(),s.isDrawing()||(n.progressInstanceComplete(),null===(a=s.onDrawEnd)||void 0===a||a.call(s,X({overlay:s,figureKey:u,figureIndex:c},e)))),t._figureMouseClickEvent(s,1,u,c,0)(e)}return n.setClickInstanceInfo({paneId:i,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1},e),!1}).registerEvent("mouseDoubleClickEvent",function(e){var r,a=n.getProgressInstanceInfo();if(null!==a){var o=a.instance,s=a.paneId;if(o.isDrawing()&&s===i&&(o.forceComplete(),!o.isDrawing())){n.progressInstanceComplete();var l=o.points.length-1,c="".concat(ee,"point_").concat(l);null===(r=o.onDrawEnd)||void 0===r||r.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 i=n.getProgressInstanceInfo();if(null!==i){var r=i.instance;if(r.isDrawing()){var a=r.points.length-1;return t._figureMouseRightClickEvent(r,1,"".concat(ee,"point_").concat(a),a,0)(e)}}return!1}).registerEvent("mouseUpEvent",function(t){var e,r=n.getPressedInstanceInfo(),a=r.instance,o=r.figureIndex,s=r.figureKey;return null!==a&&(null===(e=a.onPressedMoveEnd)||void 0===e||e.call(a,X({overlay:a,figureKey:s,figureIndex:o},t))),n.setPressedInstanceInfo({paneId:i,instance:null,figureType:0,figureKey:"",figureIndex:-1,attrsIndex:-1}),!1}).registerEvent("pressedMouseMoveEvent",function(e){var i,r,a=n.getPressedInstanceInfo(),o=a.instance,s=a.figureType,l=a.figureIndex,c=a.figureKey;if(null!==o){if(!o.lock&&(null===(r=null===(i=o.onPressedMoving)||void 0===i?void 0:i.call(o,X({overlay:o,figureIndex:l,figureKey:c},e)))||void 0===r||!r)){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,i,n,r,a){var o;if(!t.isDrawing()){var s=[];if(Mt(a)&&(It(a)?a&&(s=qt()):s=a),0===s.length)return{mouseMoveEvent:this._figureMouseMoveEvent(t,e,i,n,r),mouseDownEvent:this._figureMouseDownEvent(t,e,i,n,r),mouseClickEvent:this._figureMouseClickEvent(t,e,i,n,r),mouseRightClickEvent:this._figureMouseRightClickEvent(t,e,i,n,r),mouseDoubleClickEvent:this._figureMouseDoubleClickEvent(t,e,i,n,r)};o={},s.includes("mouseMoveEvent")||s.includes("touchMoveEvent")||(o.mouseMoveEvent=this._figureMouseMoveEvent(t,e,i,n,r)),s.includes("mouseDownEvent")||s.includes("touchStartEvent")||(o.mouseDownEvent=this._figureMouseDownEvent(t,e,i,n,r)),s.includes("mouseClickEvent")||s.includes("tapEvent")||(o.mouseClickEvent=this._figureMouseClickEvent(t,e,i,n,r)),s.includes("mouseDoubleClickEvent")||s.includes("doubleTapEvent")||(o.mouseDoubleClickEvent=this._figureMouseDoubleClickEvent(t,e,i,n,r)),s.includes("mouseRightClickEvent")||(o.mouseRightClickEvent=this._figureMouseRightClickEvent(t,e,i,n,r))}return o},e.prototype._figureMouseMoveEvent=function(t,e,i,n,r){var a=this;return function(o){var s=a.getWidget().getPane(),l=s.getChart().getChartStore().getOverlayStore();return l.setHoverInstanceInfo({paneId:s.getId(),instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:r},o),!0}},e.prototype._figureMouseDownEvent=function(t,e,i,n,r){var a=this;return function(o){var s,l=a.getWidget().getPane(),c=l.getId(),u=l.getChart().getChartStore().getOverlayStore();return t.startPressedMove(a._coordinateToPoint(t,o)),null===(s=t.onPressedMoveStart)||void 0===s||s.call(t,X({overlay:t,figureIndex:n,figureKey:i},o)),u.setPressedInstanceInfo({paneId:c,instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:r}),!0}},e.prototype._figureMouseClickEvent=function(t,e,i,n,r){var a=this;return function(o){var s=a.getWidget().getPane(),l=s.getId(),c=s.getChart().getChartStore().getOverlayStore();return c.setClickInstanceInfo({paneId:l,instance:t,figureType:e,figureKey:i,figureIndex:n,attrsIndex:r},o),!0}},e.prototype._figureMouseDoubleClickEvent=function(t,e,i,n,r){return function(e){var r;return null===(r=t.onDoubleClick)||void 0===r||r.call(t,X(X({},e),{figureIndex:n,figureKey:i,overlay:t})),!0}},e.prototype._figureMouseRightClickEvent=function(t,e,i,n,r){var a=this;return function(e){var r,o;if(null===(o=null===(r=t.onRightClick)||void 0===r?void 0:r.call(t,X({overlay:t,figureIndex:n,figureKey:i},e)))||void 0===o||!o){var s=a.getWidget().getPane(),l=s.getChart().getChartStore().getOverlayStore();l.removeInstance(t)}return!0}},e.prototype._coordinateToPoint=function(t,e){var i,n={},r=this.getWidget().getPane(),a=r.getChart(),o=r.getId(),s=a.getChartStore().getTimeScaleStore();if(this.coordinateToPointTimestampDataIndexFlag()){var l=a.getXAxisPane().getAxisComponent(),c=l.convertFromPixel(e.x),u=null!==(i=s.dataIndexToTimestamp(c))&&void 0!==i?i:void 0;n.dataIndex=c,n.timestamp=u}if(this.coordinateToPointValueFlag()){var d=r.getAxisComponent(),h=d.convertFromPixel(e.y);if(t.mode!==Gt.Normal&&o===Vi.CANDLE&&Tt(n.dataIndex)){var p=s.getDataByDataIndex(n.dataIndex);if(null!==p){var f=t.modeSensitivity;if(h>p.high)if(t.mode===Gt.WeakMagnet){var v=d.convertToPixel(p.high),g=d.convertFromPixel(v-f);hg&&(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-y0){var m=(new Array).concat(this.getFigures(e,g,i,n,r,s,l,a,c,u,d));this.drawFigures(t,e,m,c)}this.drawDefaultFigures(t,e,g,i,r,a,o,s,l,c,u,d,h,p)},e.prototype.drawFigures=function(t,e,i,n){var r=this;i.forEach(function(i,a){var o=i.type,s=i.styles,l=i.attrs,c=i.ignoreEvent,u=[].concat(l);u.forEach(function(l,u){var d,h,p,f=r._createFigureEvents(e,2,null!==(d=i.key)&&void 0!==d?d:"",a,u,c),v=X(X(X({},n[o]),null===(h=e.styles)||void 0===h?void 0:h[o]),s);null===(p=r.createFigure({name:o,attrs:l,styles:v},f))||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,i,n,r,a,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:i,barSpace:n,precision:r,thousandsSeparator:a,decimalFoldThreshold:o,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==h?h:[]},e.prototype.drawDefaultFigures=function(t,e,i,n,r,a,o,s,l,c,u,d,h,p){var f,v,g=this;if(e.needDefaultPointFigure&&((null===(f=h.instance)||void 0===f?void 0:f.id)===e.id&&0!==h.figureType||(null===(v=p.instance)||void 0===v?void 0:v.id)===e.id&&0!==p.figureType)){var m=e.styles,y=X(X({},c.point),null===m||void 0===m?void 0:m.point);i.forEach(function(i,n){var r,a,o,s=i.x,l=i.y,c=y.radius,u=y.color,d=y.borderColor,p=y.borderSize;(null===(r=h.instance)||void 0===r?void 0:r.id)===e.id&&1===h.figureType&&h.figureIndex===n&&(c=y.activeRadius,u=y.activeColor,d=y.activeBorderColor,p=y.activeBorderSize),null===(a=g.createFigure({name:"circle",attrs:{x:s,y:l,r:c+p},styles:{color:d}},g._createFigureEvents(e,1,"".concat(ee,"point_").concat(n),n,0)))||void 0===a||a.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}(kn),Ln=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._gridView=new An(n),n._indicatorView=new In(n),n._crosshairLineView=new En(n),n._tooltipView=n.createTooltipView(),n._overlayView=new Pn(n),n.addChild(n._tooltipView),n.addChild(n._overlayView),n.getContainer().style.cursor="crosshair",n.registerEvent("mouseMoveEvent",function(){return i.getChart().getChartStore().getTooltipStore().setActiveIcon(),!1}),n}return B(e,t),e.prototype.getName=function(){return ji.MAIN},e.prototype.updateMain=function(t){this.updateMainContent(t),this._indicatorView.draw(t),this._gridView.draw(t)},e.prototype.createTooltipView=function(){return new Dn(this)},e.prototype.updateMainContent=function(t){},e.prototype.updateOverlay=function(t){this._overlayView.draw(t),this._crosshairLineView.draw(t),this._tooltipView.draw(t)},e}(en),Rn=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 i=e.getWidget().getPane();i.getChart().updatePane(0,i.getId())}),e}return B(e,t),e.prototype.drawImp=function(t){var e,i,n,r=this.getWidget(),a=r.getPane(),o=a.getChart(),s=o.getDataList(),l=s.length-1,c=r.getBounding(),u=a.getAxisComponent(),d=o.getStyles().candle.area,h=[],p=Number.MAX_SAFE_INTEGER,f=Number.MIN_SAFE_INTEGER,v=null;if(this.eachChildren(function(t){var e=t.data,i=t.x,n=null===e||void 0===e?void 0:e[d.value];if(Tt(n)){var r=u.convertToPixel(n);f===Number.MIN_SAFE_INTEGER&&(f=i),h.push({x:i,y:r}),p=Math.min(p,r),t.dataIndex===l&&(v={x:i,y:r})}}),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(St(g)){var y=t.createLinearGradient(0,c.height,0,p);try{g.forEach(function(t){var e=t.offset,i=t.color;y.addColorStop(e,i)})}catch(_){}m=y}else m=g;t.fillStyle=m,t.beginPath(),t.moveTo(f,c.height),t.lineTo(h[0].x,h[0].y),bi(t,h,d.smooth),t.lineTo(h[h.length-1].x,c.height),t.closePath(),t.fill()}var b=d.point;if(b.show&&Mt(v)){null===(i=this.createFigure({name:"circle",attrs:{x:v.x,y:v.y,r:b.radius},styles:{style:"fill",color:b.color}}))||void 0===i||i.draw(t);var x=b.rippleRadius;b.animation&&(x=b.radius+this._animationFrameTime/b.animationDuration*(b.rippleRadius-b.radius),this._animation.setDuration(b.animationDuration).start()),null===(n=this._ripplePoint)||void 0===n||n.setAttrs({x:v.x,y:v.y,r:x}).setStyles({style:"fill",color:b.rippleColor}).draw(t)}else this.stopAnimation()},e.prototype.stopAnimation=function(){this._animation.stop()},e}(Tn),Fn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e=this.getWidget(),i=e.getPane(),n=i.getChart().getChartStore(),r=n.getStyles().candle.priceMark,a=r.high,o=r.low;if(r.show&&(a.show||o.show)){var s=n.getThousandsSeparator(),l=n.getDecimalFoldThreshold(),c=n.getPrecision(),u=i.getAxisComponent(),d=Number.MIN_SAFE_INTEGER,h=0,p=Number.MAX_SAFE_INTEGER,f=0;this.eachChildren(function(t){var e=t.data,i=t.x;Mt(e)&&(de.low&&(p=e.low,f=i))});var v=u.convertToPixel(d),g=u.convertToPixel(p);a.show&&d!==Number.MIN_SAFE_INTEGER&&this._drawMark(t,Wt(zt(Nt(d,c.price),s),l),{x:h,y:v},vp/2?(l=d-5,c=l-r.textOffset,u="right"):(l=d+5,u="left",c=l+r.textOffset);var f=h+n[1];null===(o=this.createFigure({name:"line",attrs:{coordinates:[{x:d,y:h},{x:d,y:f},{x:l,y:f}]},styles:{color:r.color}}))||void 0===o||o.draw(t),null===(s=this.createFigure({name:"text",attrs:{x:c,y:f,text:e,align:u,baseline:"middle"},styles:{color:r.color,size:r.textSize,family:r.textFamily,weight:r.textWeight}}))||void 0===s||s.draw(t)},e}(Tn),Bn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),r=i.getBounding(),a=n.getChart().getChartStore(),o=a.getStyles().candle.priceMark,s=o.last,l=s.line;if(o.show&&s.show&&l.show){var c=n.getAxisComponent(),u=a.getDataList(),d=u[u.length-1];if(null!=d){var h=d.close,p=d.open,f=c.convertToNicePixel(h),v=void 0;v=h>p?s.upColor:h0&&(x=this.drawStandardTooltipLegends(t,C,_,d,x,p,b)),x=this.drawStandardTooltipIcons(t,r,T,_,i,"",d,x,p)}return _.y+x},e.prototype._drawRectTooltip=function(t,e,i,n,r,a,o,s,l,c,u,d,h,p,f,v){var g,m,y,b,x,_=this,w=v.candle,C=v.indicator,S=w.tooltip,k=C.tooltip;if(h||p){var A=null!==(g=a.dataIndex)&&void 0!==g?g:0,T=this._getCandleTooltipLegends({prev:null!==(m=e[A-1])&&void 0!==m?m:null,current:a.kLineData,next:null!==(y=e[A+1])&&void 0!==y?y:null},o,s,l,c,u,d,w),M=S.offsetLeft,I=S.offsetTop,E=S.offsetRight,D=S.offsetBottom,P=S.text,L=P.marginLeft,R=P.marginRight,F=P.marginTop,B=P.marginBottom,N=P.size,z=P.weight,W=P.family,V=S.rect,H=V.position,Y=V.paddingLeft,X=V.paddingRight,U=V.paddingTop,G=V.paddingBottom,j=V.offsetLeft,q=V.offsetRight,Z=V.offsetTop,J=V.offsetBottom,Q=V.borderSize,tt=V.borderRadius,et=V.borderColor,it=V.color,nt=0,rt=0,at=0;h&&(t.font=$t(N,z,W),T.forEach(function(e){var i=e.title,n=e.value,r="".concat(i.text).concat(n.text),a=t.measureText(r).width+L+R;nt=Math.max(nt,a)}),at+=(B+F+N)*T.length);var ot=k.text,st=ot.marginLeft,lt=ot.marginRight,ct=ot.marginTop,ut=ot.marginBottom,dt=ot.size,ht=ot.weight,pt=ot.family,ft=[];if(p&&(t.font=$t(dt,ht,pt),i.forEach(function(i){var n,r=null!==(n=_.getIndicatorTooltipData(e,a,i,c,u,d,C).values)&&void 0!==n?n:[];ft.push(r),r.forEach(function(e){var i=e.title,n=e.value,r="".concat(i.text).concat(n.text),a=t.measureText(r).width+st+lt;nt=Math.max(nt,a),at+=ct+ut+dt})})),rt+=nt,0!==rt&&0!==at){rt+=2*Q+Y+X,at+=2*Q+U+G;var vt=n.width/2,gt=H===$.Pointer&&a.paneId===Vi.CANDLE,mt=(null!==(b=a.realX)&&void 0!==b?b:0)>vt,yt=0;if(gt){var bt=a.realX;yt=mt?bt-q-rt:bt+j}else mt?(yt=j+M,v.yAxis.inside&&v.yAxis.position===K.Left&&(yt+=r.width)):(yt=n.width-q-rt-E,v.yAxis.inside&&v.yAxis.position===K.Right&&(yt-=r.width));var xt=f+Z;if(gt){var _t=a.y;xt=_t-at/2,xt+at>n.height-J-D&&(xt=n.height-J-at-D),xt1){var c="{".concat(l[1],"}");o.text=o.text.replace(c,null!==(e=x[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:a,value:o}})},e}(Dn),$n=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._candleBarView=new Mn(n),n._candleAreaView=new Rn(n),n._candleHighLowPriceView=new Fn(n),n._candleLastPriceLineView=new Bn(n),n.addChild(n._candleBarView),n}return B(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 Vn(this)},e}(Ln),Hn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i,n=this,r=this.getWidget(),a=r.getPane(),o=r.getBounding(),s=a.getAxisComponent(),l=this.getAxisStyles(a.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 i;null===(i=n.createFigure({name:"line",attrs:e,styles:l.tickLine}))||void 0===i||i.draw(t)})}if(l.tickText.show){var d=this.createTickTexts(c,o,l);null===(i=this.createFigure({name:"text",attrs:d,styles:l.tickText}))||void 0===i||i.draw(t)}}},e}(kn),Kn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.getAxisStyles=function(t){return t.yAxis},e.prototype.createAxisLine=function(t,e){var i,n=this.getWidget().getPane().getAxisComponent(),r=e.axisLine.size;return i=n.isFromZero()?0:t.width-r,{coordinates:[{x:i,y:0},{x:i,y:t.height}]}},e.prototype.createTickLines=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),r=i.axisLine,a=i.tickLine,o=0,s=0;return n.isFromZero()?(o=0,r.show&&(o+=r.size),s=o+a.length):(o=e.width,r.show&&(o-=r.size),s=o-a.length),t.map(function(t){return{coordinates:[{x:o,y:t.coord},{x:s,y:t.coord}]}})},e.prototype.createTickTexts=function(t,e,i){var n=this.getWidget().getPane().getAxisComponent(),r=i.axisLine,a=i.tickLine,o=i.tickText,s=0;n.isFromZero()?(s=o.marginStart,r.show&&(s+=r.size),a.show&&(s+=a.length)):(s=e.width-o.marginEnd,r.show&&(s-=r.size),a.show&&(s-=a.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}(Hn),Yn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),r=i.getBounding(),a=n.getChart().getChartStore(),o=a.getStyles().candle.priceMark,s=o.last,l=s.text;if(o.show&&s.show&&l.show){var c=a.getPrecision(),u=n.getAxisComponent(),d=a.getDataList(),h=d[d.length-1];if(Mt(h)){var p=h.close,f=h.open,v=u.convertToNicePixel(p),g=void 0;g=p>f?s.upColor:p1&&p.unshift({type:"rect",attrs:{x:0,y:g,width:i.width,height:m-g},ignoreEvent:!0})}return p},e.prototype.getFigures=function(t,e,i,n,r,a,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:i,barSpace:n,precision:r,thousandsSeparator:a,decimalFoldThreshold:o,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==h?h:[]},e}(Pn),Gn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.drawImp=function(t){var e,i=this.getWidget(),n=i.getPane(),r=i.getBounding(),a=i.getPane().getChart().getChartStore(),o=a.getTooltipStore().getCrosshair(),s=a.getStyles().crosshair;if(Et(o.paneId)&&this.compare(o,n.getId())&&s.show){var l=this.getDirectionStyles(s),c=l.text;if(l.show&&c.show){var u=n.getAxisComponent(),d=this.getText(o,a,u);t.font=$t(c.size,c.weight,c.family),null===(e=this.createFigure({name:"text",attrs:this.getTextAttrs(d,t.measureText(d).width,o,r,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,i){var n,r=i,a=i.convertFromPixel(t.y);if(r.getType()===Y.Percentage){var o=e.getVisibleFirstData();n="".concat(((a-o.close)/o.close*100).toFixed(2),"%")}else{var s=e.getIndicatorStore().getInstances(t.paneId),l=0,c=!1;r.isInCandle()?l=e.getPrecision().price:s.forEach(function(t){l=Math.max(t.precision,l),c||(c=t.shouldFormatBigNumber)}),n=Nt(a,l),c&&(n=e.getCustomApi().formatBigNumber(n))}return Wt(zt(n,e.getThousandsSeparator()),e.getDecimalFoldThreshold())},e.prototype.getTextAttrs=function(t,e,i,n,r,a){var o,s,l=r;return l.isFromZero()?(o=0,s="left"):(o=n.width,s="right"),{x:o,y:i.y,text:t,align:s,baseline:"middle"}},e}(kn),jn=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._yAxisView=new Kn(n),n._candleLastPriceLabelView=new Yn(n),n._indicatorLastValueView=new Xn(n),n._overlayYAxisView=new Un(n),n._crosshairHorizontalLabelView=new Gn(n),n.getContainer().style.cursor="ns-resize",n.addChild(n._overlayYAxisView),n}return B(e,t),e.prototype.getName=function(){return ji.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}(en),qn=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,i=t.realTo,n=t.realRange,r=[];if(n>=0){var a=q(this._calcTickInterval(n),2),o=a[0],s=a[1],l=ve(Math.ceil(e/o)*o,s),c=ve(Math.floor(i/o)*o,s),u=0,d=l;if(0!==o)while(d<=c){var h=d.toFixed(s);r[u]={text:h,coord:0,value:h},++u,d+=o}}return r},t.prototype._calcTickInterval=function(t){var e=fe(t/8),i=ge(e);return[e,i]},t}(),Zn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.calcRange=function(){var t,e,i,n,r=this.getParent(),a=r.getChart(),o=a.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,f=o.getIndicatorStore().getInstances(r.getId());f.forEach(function(t){var e,i,n;u||(u=null!==(e=t.shouldOhlc)&&void 0!==e&&e),p=Math.min(p,t.precision),Tt(t.minValue)&&(d=Math.min(d,t.minValue)),Tt(t.maxValue)&&(h=Math.max(h,t.maxValue)),c.push({figures:null!==(i=t.figures)&&void 0!==i?i:[],result:null!==(n=t.result)&&void 0!==n?n:[]})});var v=4,g=this.isInCandle();if(g){var m=o.getPrecision().price;v=p!==Number.MAX_SAFE_INTEGER?Math.min(p,m):m}else p!==Number.MAX_SAFE_INTEGER&&(v=p);var y=o.getVisibleDataList(),b=a.getStyles().candle,x=b.type===H.Area,_=b.area.value,w=g&&!x||!g&&u;y.forEach(function(t){var e=t.dataIndex,i=t.data;if(Mt(i)&&(w&&(s=Math.min(s,i.low),l=Math.max(l,i.high)),g&&x)){var n=i[_];Tt(n)&&(s=Math.min(s,n),l=Math.max(l,n))}c.forEach(function(t){var i,n=t.figures,r=t.result,a=null!==(i=r[e])&&void 0!==i?i:{};n.forEach(function(t){var e=a[t.key];Tt(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 C,S=this.getType();switch(S){case Y.Percentage:var k=o.getVisibleFirstData();Mt(k)&&Tt(k.close)&&(s=(s-k.close)/k.close*100,l=(l-k.close)/k.close*100),C=Math.pow(10,-2);break;case Y.Log:s=ye(s),l=ye(l),C=.05*be(-v);break;default:C=be(-v)}if(s===l||Math.abs(s-l)=1&&(E/=M);var D=null!==(n=null===I||void 0===I?void 0:I.bottom)&&void 0!==n?n:.1;D>=1&&(D/=M);var P,L,R,F=Math.abs(l-s);return s-=F*D,l+=F*E,F=Math.abs(l-s),S===Y.Log?(P=be(s),L=be(l),R=Math.abs(L-P)):(P=s,L=l,R=F),{from:s,to:l,range:F,realFrom:P,realTo:L,realRange:R}},e.prototype._innerConvertToPixel=function(t){var e,i,n=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,r=this.getRange(),a=r.from,o=r.range,s=(t-a)/o;return this.isReverse()?Math.round(s*n):Math.round((1-s)*n)},e.prototype.isInCandle=function(){return this.getParent().getId()===Vi.CANDLE},e.prototype.getType=function(){return this.isInCandle()?this.getParent().getChart().getStyles().yAxis.type:Y.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===K.Left&&e||t.position===K.Right&&!e},e.prototype.optimalTicks=function(t){var e,i,n=this,r=this.getParent(),a=null!==(i=null===(e=r.getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,o=r.getChart().getChartStore(),s=o.getCustomApi(),l=[],c=this.getType(),u=o.getIndicatorStore().getInstances(r.getId()),d=o.getThousandsSeparator(),h=o.getDecimalFoldThreshold(),p=0,f=!1;this.isInCandle()?p=o.getPrecision().price:u.forEach(function(t){p=Math.max(p,t.precision),f||(f=t.shouldFormatBigNumber)});var v,g=o.getStyles().xAxis.tickText.size;return t.forEach(function(t){var e,i=t.value,r=n._innerConvertToPixel(+i);switch(c){case Y.Percentage:e="".concat(Nt(i,2),"%");break;case Y.Log:r=n._innerConvertToPixel(ye(+i)),e=Nt(i,p);break;default:e=Nt(i,p),f&&(e=s.formatBigNumber(i));break}e=Wt(zt(e,d),h);var o=Tt(v);r>g&&r2*g||!o)&&(l.push({text:e,coord:r,value:i}),v=r)}),l},e.prototype.getAutoSize=function(){var t=this.getParent(),e=t.getChart(),i=e.getStyles(),n=i.yAxis,r=n.size;if("auto"!==r)return r;var a=e.getChartStore(),o=a.getCustomApi(),s=0;if(n.show&&(n.axisLine.show&&(s+=n.axisLine.size),n.tickLine.show&&(s+=n.tickLine.length),n.tickText.show)){var l=0;this.getTicks().forEach(function(t){l=Math.max(l,Ht(t.text,n.tickText.size,n.tickText.weight,n.tickText.family))}),s+=n.tickText.marginStart+n.tickText.marginEnd+l}var c=i.crosshair,u=0;if(c.show&&c.horizontal.show&&c.horizontal.text.show){var d=a.getIndicatorStore().getInstances(t.getId()),h=0,p=!1;d.forEach(function(t){h=Math.max(t.precision,h),p||(p=t.shouldFormatBigNumber)});var f=2;if(this.getType()!==Y.Percentage)if(this.isInCandle()){var v=a.getPrecision().price,g=i.indicator.lastValueMark;f=g.show&&g.text.show?Math.max(h,v):v}else f=h;var m=Nt(this.getRange().to,f);p&&(m=o.formatBigNumber(m)),m=Wt(m,a.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,i,n=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,r=this.getRange(),a=r.from,o=r.range,s=this.isReverse()?t/n:1-t/n,l=s*o+a;switch(this.getType()){case Y.Percentage:var c=this.getParent().getChart().getChartStore().getVisibleFirstData();return Mt(c)&&Tt(c.close)?c.close*l/100+c.close:0;case Y.Log:return be(l);default:return l}},e.prototype.convertToRealValue=function(t){var e=t;return this.getType()===Y.Log&&(e=be(t)),e},e.prototype.convertToPixel=function(t){var e=t;switch(this.getType()){case Y.Percentage:var i=this.getParent().getChart().getChartStore().getVisibleFirstData();Mt(i)&&Tt(i.close)&&(e=(t-i.close)/i.close*100);break;case Y.Log:e=ye(t);break;default:e=t}return this._innerConvertToPixel(e)},e.prototype.convertToNicePixel=function(t){var e,i,n=null!==(i=null===(e=this.getParent().getYAxisWidget())||void 0===e?void 0:e.getBounding().height)&&void 0!==i?i:0,r=this.convertToPixel(t);return Math.round(Math.max(.05*n,Math.min(r,.98*n)))},e.extend=function(t){var i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return B(i,e),i.prototype.createTicks=function(e){return t.createTicks(e)},i}(e);return i},e}(qn),Jn={name:"default",createTicks:function(t){var e=t.defaultTicks;return e}},Qn={default:Zn.extend(Jn)};function tr(t){var e;return null!==(e=Qn[t])&&void 0!==e?e:Qn.default}var er=function(){function t(t,e,i,n){this._bounding=Qi(),this._chart=i,this._id=n,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}(),ir=function(t){function e(e,i,n,r,a){var o=t.call(this,e,i,n,r)||this;o._yAxisWidget=null,o._options={minHeight:zi,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(a),o}return B(e,t),e.prototype.setOptions=function(t){var e,i,n,r,a,o=null===(e=t.axisOptions)||void 0===e?void 0:e.name;return(this._options.axisOptions.name!==o&&Et(o)||!Mt(this._axis))&&(this._axis=this.createAxisComponent(null!==o&&void 0!==o?o:"default")),wt(this._options,t),this.getId()===Vi.X_AXIS?(r=this.getMainWidget().getContainer(),a="ew-resize"):(r=this.getYAxisWidget().getContainer(),a="ns-resize"),null===(n=null===(i=t.axisOptions)||void 0===i?void 0:i.scrollZoomEnabled)||void 0===n||n?r.style.cursor=a:r.style.cursor="default",this},e.prototype.getOptions=function(){return this._options},e.prototype.getAxisComponent=function(){return this._axis},e.prototype.setBounding=function(t,e,i){var n,r;wt(this.getBounding(),t);var a={};return Mt(t.height)&&(a.height=t.height),Mt(t.top)&&(a.top=t.top),this._mainWidget.setBounding(a),null===(n=this._yAxisWidget)||void 0===n||n.setBounding(a),Mt(e)&&this._mainWidget.setBounding(e),Mt(i)&&(null===(r=this._yAxisWidget)||void 0===r||r.setBounding(i)),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(),i=e.width,n=e.height,r=he("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),a=r.getContext("2d"),o=Vt(r);r.width=i*o,r.height=n*o,a.scale(o,o);var s=this._mainWidget.getBounding();if(a.drawImage(this._mainWidget.getImage(t),s.left,0,s.width,s.height),null!==this._yAxisWidget){var l=this._yAxisWidget.getBounding();a.drawImage(this._yAxisWidget.getImage(t),l.left,0,l.width,l.height)}return r},e.prototype.createYAxisWidget=function(t){return null},e}(er),nr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.createAxisComponent=function(t){var e=tr(null!==t&&void 0!==t?t:"default");return new e(this)},e.prototype.createMainWidget=function(t){return new Ln(t,this)},e.prototype.createYAxisWidget=function(t){return new jn(t,this)},e}(ir),rr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.createMainWidget=function(t){return new $n(t,this)},e}(nr),ar=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(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,i){var n=i.tickLine,r=i.axisLine.size;return t.map(function(t){return{coordinates:[{x:t.coord,y:0},{x:t.coord,y:r+n.length}]}})},e.prototype.createTickTexts=function(t,e,i){var n=i.tickText,r=i.axisLine.size,a=i.tickLine.length;return t.map(function(t){return{x:t.coord,y:r+a+n.marginStart,text:t.text,align:"center",baseline:"top"}})},e}(Hn),or=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(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,i,n,r,a,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,f=Number.MIN_SAFE_INTEGER;e.forEach(function(e,i){p=Math.min(p,e.x),f=Math.max(f,e.x);var n=t.points[i];if(Tt(n.timestamp)){var o=a.formatDate(r,n.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:f-p,height:i.height},ignoreEvent:!0})}return h},e.prototype.getFigures=function(t,e,i,n,r,a,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:i,barSpace:n,precision:r,thousandsSeparator:a,decimalFoldThreshold:o,dateTimeFormat:s,defaultStyles:l,xAxis:c,yAxis:u}))&&void 0!==h?h:[]},e}(Un),sr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.compare=function(t){return Mt(t.kLineData)&&t.dataIndex===t.realDataIndex},e.prototype.getDirectionStyles=function(t){return t.vertical},e.prototype.getText=function(t,e){var i,n=null===(i=t.kLineData)||void 0===i?void 0:i.timestamp;return e.getCustomApi().formatDate(e.getTimeScaleStore().getDateTimeFormat(),n,"YYYY-MM-DD HH:mm",Zt.Crosshair)},e.prototype.getTextAttrs=function(t,e,i,n,r,a){var o,s=i.realX,l="center";return s-e/2-a.paddingLeft<0?(o=0,l="left"):s+e/2+a.paddingRight>n.width?(o=n.width,l="right"):o=s,{x:o,y:0,text:t,align:l,baseline:"top"}},e}(Gn),lr=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._xAxisView=new ar(n),n._overlayXAxisView=new or(n),n._crosshairVerticalLabelView=new sr(n),n.getContainer().style.cursor="ew-resize",n.addChild(n._overlayXAxisView),n}return B(e,t),e.prototype.getName=function(){return ji.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}(en),cr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.calcRange=function(){var t=this.getParent().getChart().getChartStore(),e=t.getTimeScaleStore().getVisibleRange(),i=e.from,n=e.to,r=i,a=n-1,o=n-i;return{from:r,to:a,range:o,realFrom:r,realTo:a,realRange:o}},e.prototype.optimalTicks=function(t){var e,i,n=this.getParent().getChart(),r=n.getChartStore(),a=r.getCustomApi().formatDate,o=[],s=t.length,l=r.getDataList();if(s>0){var c=r.getTimeScaleStore().getDateTimeFormat(),u=n.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),f=1;if(s>1){var v=parseInt(t[1].value,10),g=this.convertToPixel(v),m=Math.abs(g-p);me&&(t.apply(this,arguments),i=n)}}var vr=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._dragFlag=!1,n._dragStartY=0,n._topPaneHeight=0,n._bottomPaneHeight=0,n._pressedMouseMoveEvent=fr(n._pressedTouchMouseMoveEvent,20),n.registerEvent("touchStartEvent",n._mouseDownEvent.bind(n)).registerEvent("touchMoveEvent",n._pressedMouseMoveEvent.bind(n)).registerEvent("touchEndEvent",n._mouseUpEvent.bind(n)).registerEvent("mouseDownEvent",n._mouseDownEvent.bind(n)).registerEvent("mouseUpEvent",n._mouseUpEvent.bind(n)).registerEvent("pressedMouseMoveEvent",n._pressedMouseMoveEvent.bind(n)).registerEvent("mouseEnterEvent",n._mouseEnterEvent.bind(n)).registerEvent("mouseLeaveEvent",n._mouseLeaveEvent.bind(n)),n}return B(e,t),e.prototype.getName=function(){return ji.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,i=this.getPane(),n=i.getTopPane(),r=i.getBottomPane(),a=e<0;if(null!==n&&(null===r||void 0===r?void 0:r.getOptions().dragEnabled)){var o=void 0,s=void 0,l=void 0,c=void 0;a?(o=n,s=r,l=this._topPaneHeight,c=this._bottomPaneHeight):(o=r,s=n,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=i.getChart();p.getChartStore().getActionStore().execute(Pt.OnPaneDrag,{paneId:i.getId()}),p.adjustPaneViewport(!0,!0,!0,!0,!0)}}return!0},e.prototype._mouseEnterEvent=function(){var t,e=this.getPane(),i=e.getBottomPane();if(null!==(t=null===i||void 0===i?void 0:i.getOptions().dragEnabled)&&void 0!==t&&t){var n=e.getChart(),r=n.getStyles().separator;return this.getContainer().style.background=r.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(qi,"px"),margin:"0",padding:"0",position:"absolute",top:"-3px",zIndex:"20",boxSizing:"border-box",cursor:"ns-resize"})},e.prototype.updateImp=function(t,e,i){if(4===i||2===i){var n=this.getPane().getChart().getStyles().separator;t.style.top="".concat(-Math.floor((qi-n.size)/2),"px"),t.style.height="".concat(qi,"px")}},e}(tn),gr=function(t){function e(e,i,n,r,a,o){var s=t.call(this,e,i,n,r)||this;return s.getContainer().style.overflow="",s._topPane=a,s._bottomPane=o,s._separatorWidget=new vr(s.getContainer(),s),s}return B(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(),i=e.width,n=e.height,r=this.getChart().getStyles().separator,a=he("canvas",{width:"".concat(i,"px"),height:"".concat(n,"px"),boxSizing:"border-box"}),o=a.getContext("2d"),s=Vt(a);return a.width=i*s,a.height=n*s,o.scale(s,s),o.fillStyle=r.color,o.fillRect(0,0,i,n),a},e.prototype.updateImp=function(t,e,i){if(4===t||2===t){var n=this.getChart().getStyles().separator;e.style.backgroundColor=n.color,e.style.height="".concat(i.height,"px"),e.style.marginLeft="".concat(i.left,"px"),e.style.width="".concat(i.width,"px"),this._separatorWidget.update(t)}},e}(er);function mr(){var t;return"undefined"!==typeof window&&(null!==(t=window.navigator.userAgent.toLowerCase().indexOf("firefox"))&&void 0!==t?t:-1)>-1}function yr(){return"undefined"!==typeof window&&/iPhone|iPad|iPod/.test(window.navigator.platform)}var br,xr=10,_r=function(){function t(t,e,i){var n=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=!yr(),this._onFirefoxOutsideMouseUp=function(t){n._mouseUpHandler(t)},this._onMobileSafariDoubleClick=function(t){if(n._firesTouchEvents(t)){if(++n._tapCount,null!==n._tapTimeoutId&&n._tapCount>1){var e=n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._tapCoordinate).manhattanDistance;e<30&&!n._cancelTap&&n._processEvent(n._makeCompatEvent(t),n._handler.doubleTapEvent),n._resetTapTimeout()}}else if(++n._clickCount,null!==n._clickTimeoutId&&n._clickCount>1){e=n._mouseTouchMoveWithDownInfo(n._getCoordinate(t),n._clickCoordinate).manhattanDistance;e<5&&!n._cancelClick&&n._processEvent(n._makeCompatEvent(t),n._handler.mouseDoubleClickEvent),n._resetClickTimeout()}},this._target=t,this._handler=e,this._options=i,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,i,n,r=this;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this);var a=this._mouseMoveHandler.bind(this);this._unsubscribeMousemove=function(){r._target.removeEventListener("mousemove",a)},this._target.addEventListener("mousemove",a);var o=this._mouseWheelHandler.bind(this);this._unsubscribeMouseWheel=function(){r._target.removeEventListener("wheel",o)},this._target.addEventListener("wheel",o,{passive:!1});var s=this._contextMenuHandler.bind(this);this._unsubscribeContextMenu=function(){r._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(!Mt(this._handler.mouseWheelHortEvent))return;if(this._preventDefault(t),0===Math.abs(t.deltaX))return;this._handler.mouseWheelHortEvent(this._makeCompatEvent(t),-t.deltaX)}else{if(!Mt(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 i=Math.sign(e)*Math.min(1,Math.abs(e));this._handler.mouseWheelVertEvent(this._makeCompatEvent(t),i)}}},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 i=this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._touchMoveStartCoordinate),n=i.xOffset,r=i.yOffset,a=i.manhattanDistance;if(this._touchMoveExceededManhattanDistance||!(a<5)){if(!this._touchMoveExceededManhattanDistance){var o=.5*n,s=r>=o&&!this._options.treatVertDragAsPageScroll(),l=o>r&&!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),i=e.manhattanDistance;i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick&&this._processEvent(this._makeCompatEvent(t),this._handler.pressedMouseMoveEvent)}},t.prototype._mouseTouchMoveWithDownInfo=function(t,e){var i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y),r=i+n;return{xOffset:i,yOffset:n,manhattanDistance:r}},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 i=this._makeCompatEvent(t,e);if(this._processEvent(i,this._handler.touchEndEvent),++this._tapCount,null!==this._tapTimeoutId&&this._tapCount>1){var n=this._mouseTouchMoveWithDownInfo(this._getCoordinate(e),this._tapCoordinate).manhattanDistance;n<30&&!this._cancelTap&&this._processEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processEvent(i,this._handler.tapEvent),Mt(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),mr()){var i=this._target.ownerDocument.documentElement;i.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(t))if(this._processEvent(e,this._handler.mouseUpEvent),++this._clickCount,null!==this._clickTimeoutId&&this._clickCount>1){var n=this._mouseTouchMoveWithDownInfo(this._getCoordinate(t),this._clickCoordinate).manhattanDistance;n<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 i=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 n=this._touchMoveHandler.bind(this),r=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=function(){i.removeEventListener("touchmove",n),i.removeEventListener("touchend",r)},i.addEventListener("touchmove",n,{passive:!1}),i.addEventListener("touchend",r,{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;mr()&&e.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartCoordinate=this._getCoordinate(t),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);var i=this._mouseMoveWithDownHandler.bind(this),n=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=function(){e.removeEventListener("mousemove",i),e.removeEventListener("mouseup",n)},e.addEventListener("mousemove",i),e.addEventListener("mouseup",n),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,i=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",i)},this._unsubscribeOutsideMouseEvents=function(){e.removeEventListener("mousedown",i)},e.addEventListener("mousedown",i),e.addEventListener("touchstart",i,{passive:!0}),yr()&&(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;(Mt(this._handler.pinchStartEvent)||Mt(this._handler.pinchEvent)||Mt(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&&Mt(t._handler.pinchEvent)){var i=t._getTouchDistance(e.touches[0],e.touches[1]),n=i/t._startPinchDistance;t._handler.pinchEvent(X(X({},t._startPinchMiddleCoordinate),{pageX:0,pageY:0}),n),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,i=null!==(e=this._target.getBoundingClientRect())&&void 0!==e?e:{left:0,top:0};this._startPinchMiddleCoordinate={x:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,y:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this._startPinchDistance=this._getTouchDistance(t[0],t[1]),Mt(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,Mt(this._handler.pinchEndEvent)&&this._handler.pinchEndEvent({x:0,y:0,pageX:0,pageY:0}))},t.prototype._mouseLeaveHandler=function(t){var e,i,n;null===(e=this._unsubscribeMousemove)||void 0===e||e.call(this),null===(i=this._unsubscribeMouseWheel)||void 0===i||i.call(this),null===(n=this._unsubscribeContextMenu)||void 0===n||n.call(this),this._firesTouchEvents(t)||this._acceptMouseLeave&&(this._processEvent(this._makeCompatEvent(t),this._handler.mouseLeaveEvent),this._acceptMouseLeave=!yr())},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 Mt(null===(e=t.sourceCapabilities)||void 0===e?void 0:e.firesTouchEvents)?t.sourceCapabilities.firesTouchEvents:this._eventTimeStamp(t)this._startScrollCoordinate.y-s.y){var d=s.x-this._startScrollCoordinate.x;c.getTimeScaleStore().scroll(d)}return!0;case ji.X_AXIS:case ji.Y_AXIS:var h=o.dispatchEvent("pressedMouseMoveEvent",s);return h&&(null===(n=s.preventDefault)||void 0===n||n.call(s),this._chart.updatePane(1)),h}}return!1},t.prototype.touchEndEvent=function(t){var e=this,i=this._findWidgetByEvent(t).widget;if(null!==i){var n=this._makeWidgetEvent(t,i),r=i.getName();switch(r){case ji.MAIN:if(i.dispatchEvent("mouseUpEvent",n),null!==this._startScrollCoordinate){var a=(new Date).getTime()-this._flingStartTime,o=n.x-this._startScrollCoordinate.x,s=o/(a>0?a:1)*20;if(a<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 ji.X_AXIS:case ji.Y_AXIS:var u=i.dispatchEvent("mouseUpEvent",n);u&&this._chart.updatePane(1)}}return!1},t.prototype.tapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget,r=!1;if(null!==n){var a=this._makeWidgetEvent(t,n),o=n.dispatchEvent("mouseClickEvent",a);if(n.getName()===ji.MAIN){var s=this._makeWidgetEvent(t,n),l=this._chart.getChartStore(),c=l.getTooltipStore();o?(this._touchCancelCrosshair=!0,this._touchCoordinate=null,c.setCrosshair(void 0,{notInvalidate:!0}),r=!0):(this._touchCancelCrosshair||this._touchZoomed||(this._touchCoordinate={x:s.x,y:s.y},c.setCrosshair({x:s.x,y:s.y,paneId:null===i||void 0===i?void 0:i.getId()},{notInvalidate:!0}),r=!0),this._touchCancelCrosshair=!1)}(r||o)&&this._chart.updatePane(1)}return r},t.prototype.doubleTapEvent=function(t){return this.mouseDoubleClickEvent(t)},t.prototype.longTapEvent=function(t){var e=this._findWidgetByEvent(t),i=e.pane,n=e.widget;if(null!==n&&n.getName()===ji.MAIN){var r=this._makeWidgetEvent(t,n);return this._touchCoordinate={x:r.x,y:r.y},this._chart.getChartStore().getTooltipStore().setCrosshair({x:r.x,y:r.y,paneId:null===i||void 0===i?void 0:i.getId()}),!0}return!1},t.prototype._findWidgetByEvent=function(t){var e,i,n,r,a=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=q(u.value,2),h=d[1],p=h.getBounding(),f=p.top-Math.round((qi-l)/2);if(a>=p.left&&a<=p.left+p.width&&o>=f&&o<=f+qi)return{pane:h,widget:h.getWidget()}}}catch(k){e={error:k}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(e)throw e.error}}var v=this._chart.getAllDrawPanes(),g=null;try{for(var m=j(v),y=m.next();!y.done;y=m.next()){var b=y.value;p=b.getBounding();if(a>=p.left&&a<=p.left+p.width&&o>=p.top&&o<=p.top+p.height){g=b;break}}}catch(A){n={error:A}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}var x=null;if(null!==g){if(null===x){var _=g.getMainWidget(),w=_.getBounding();a>=w.left&&a<=w.left+w.width&&o>=w.top&&o<=w.top+w.height&&(x=_)}if(null===x){var C=g.getYAxisWidget();if(null!==C){var S=C.getBounding();a>=S.left&&a<=S.left+S.width&&o>=S.top&&o<=S.top+S.height&&(x=C)}}}return{pane:g,widget:x}},t.prototype._makeWidgetEvent=function(t,e){var i,n,r,a=null!==(i=null===e||void 0===e?void 0:e.getBounding())&&void 0!==i?i:null;return X(X({},t),{x:t.x-(null!==(n=null===a||void 0===a?void 0:a.left)&&void 0!==n?n:0),y:t.y-(null!==(r=null===a||void 0===a?void 0:a.top)&&void 0!==r?r: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"})(br||(br={}));var Cr=function(){function t(t,e){this._drawPanes=[],this._separatorPanes=new Map,this._initContainer(t),this._chartEvent=new wr(this._chartContainer,this),this._chartStore=new Gi(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,i=this,n=null!==(e=null===t||void 0===t?void 0:t.layout)&&void 0!==e?e:[{type:"candle"}],r=!1,a=!1,o=function(t){if(!a){var e=i._createPane(pr,Vi.X_AXIS,null!==t&&void 0!==t?t:{});i._xAxisPane=e,a=!0}};n.forEach(function(t){var e,n,a;switch(t.type){case"candle":if(!r){var s=null!==(e=t.options)&&void 0!==e?e:{};wt(s,{id:Vi.CANDLE}),i._candlePane=i._createPane(rr,Vi.CANDLE,s);var l=null!==(n=t.content)&&void 0!==n?n:[];l.forEach(function(t){i.createIndicator(t,!0,s)}),r=!0}break;case"indicator":var c;l=null!==(a=t.content)&&void 0!==a?a:[];if(l.length>0)l.forEach(function(e){Mt(c)?i.createIndicator(e,!0,{id:c}):c=i.createIndicator(e,!0,t.options)});break;case"xAxis":o(t.options);break}}),o({position:"bottom"})},t.prototype._createPane=function(t,e,i){var n,r=null,a=null,o=null===i||void 0===i?void 0:i.position;switch(o){case"top":var s=this._drawPanes[0];Mt(s)&&(a=new t(this._chartContainer,s.getContainer(),this,e,null!==i&&void 0!==i?i:{}),r=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)){a=new t(this._chartContainer,c.getContainer(),this,e,null!==i&&void 0!==i?i:{}),r=l;break}}}if(Mt(a)||(a=new t(this._chartContainer,null,this,e,null!==i&&void 0!==i?i:{})),Tt(r)?(this._drawPanes.splice(r,0,a),n=r):(this._drawPanes.push(a),n=this._drawPanes.length-1),a.getId()!==Vi.X_AXIS){var d=this._drawPanes[n+1];if(Mt(d)&&d.getId()===Vi.X_AXIS&&(d=this._drawPanes[n+2]),Mt(d)){var h=this._separatorPanes.get(d);Mt(h)?h.setTopPane(a):(h=new gr(this._chartContainer,d.getContainer(),this,"",a,d),this._separatorPanes.set(d,h))}var p=this._drawPanes[n-1];if(Mt(p)&&p.getId()===Vi.X_AXIS&&(p=this._drawPanes[n-2]),Mt(p)){h=new gr(this._chartContainer,a.getContainer(),this,"",p,a);this._separatorPanes.set(a,h)}}return a},t.prototype._measurePaneHeight=function(){var t,e=this,i=Math.floor(this._container.clientHeight),n=this._chartStore.getStyles().separator.size,r=this._xAxisPane.getAxisComponent().getAutoSize(),a=i-r-this._separatorPanes.size*n;a<0&&(a=0);var o=0;this._drawPanes.forEach(function(t){if(t.getId()!==Vi.CANDLE&&t.getId()!==Vi.X_AXIS){var e=t.getBounding().height,i=t.getOptions().minHeight;ea?(o=a,e=Math.max(a-o,0)):o+=e,t.setBounding({height:e})}});var s=a-o;null===(t=this._candlePane)||void 0===t||t.setBounding({height:s}),this._xAxisPane.setBounding({height:r});var l=0;this._drawPanes.forEach(function(t){var i=e._separatorPanes.get(t);Mt(i)&&(i.setBounding({height:n,top:l}),l+=n),t.setBounding({top:l}),l+=t.getBounding().height})},t.prototype._measurePaneWidth=function(){var t=this,e=Math.floor(this._container.clientWidth),i=this._chartStore.getStyles(),n=i.yAxis,r=n.position===K.Left,a=!n.inside,o=0,s=0,l=0,c=0;this._drawPanes.forEach(function(t){t.getId()!==Vi.X_AXIS&&(s=Math.max(s,t.getAxisComponent().getAutoSize()))}),s>e&&(s=e),a?(o=e-s,r?(l=0,c=s):(l=e-s,c=0)):(o=e,c=0,l=r?0:e-s),this._chartStore.getTimeScaleStore().setTotalBarSpace(o);var u,d={width:e},h={width:o,left:c},p={width:s,left:l},f=i.separator.fill;u=a&&!f?h:d,this._drawPanes.forEach(function(e){var i;null===(i=t._separatorPanes.get(e))||void 0===i||i.setBounding(u),e.setBounding(d,h,p)})},t.prototype._setPaneOptions=function(t,e){var i,n;if(Et(t.id)){var r=this.getDrawPaneById(t.id),a=!1;if(null!==r){var o=e;if(t.id!==Vi.CANDLE&&Tt(t.height)&&t.height>0){var s=Math.max(null!==(i=t.minHeight)&&void 0!==i?i:r.getOptions().minHeight,0),l=Math.max(s,t.height);r.setBounding({height:l}),o=!0,a=!0}(Et(null===(n=t.axisOptions)||void 0===n?void 0:n.name)||Mt(t.gap))&&(o=!0),r.setOptions(t),o&&this.adjustPaneViewport(a,!0,!0,!0,!0)}}},t.prototype.getDrawPaneById=function(t){if(t===Vi.CANDLE)return this._candlePane;if(t===Vi.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,i,n,r){t&&this._measurePaneHeight();var a=e,o=null!==n&&void 0!==n&&n,s=null!==r&&void 0!==r&&r;(o||s)&&this._drawPanes.forEach(function(t){var e=t.getAxisComponent().buildTicks(s);a||(a=e)}),a&&this._measurePaneWidth(),null!==i&&void 0!==i&&i&&(this._xAxisPane.getAxisComponent().buildTicks(!0),this.updatePane(4))},t.prototype.updatePane=function(t,e){if(Mt(e)){var i=this.getDrawPaneById(e);null===i||void 0===i||i.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,i=this._chartStore.getActionStore();if(i.has(Pt.OnCrosshairChange)){var n={};this._drawPanes.forEach(function(i){var r=i.getId(),a={},o=e._chartStore.getIndicatorStore().getInstances(r);o.forEach(function(e){var i,n=e.result;a[e.name]=n[null!==(i=t.dataIndex)&&void 0!==i?i:n.length-1]}),n[r]=a}),Et(t.paneId)&&i.execute(Pt.OnCrosshairChange,X(X({},t),{indicatorData:n}))}},t.prototype.getDom=function(t,e){var i,n;if(!Et(t))return this._chartContainer;var r=this.getDrawPaneById(t);if(null!==r){var a=null!==e&&void 0!==e?e:br.Root;switch(a){case br.Root:return r.getContainer();case br.Main:return r.getMainWidget().getContainer();case br.YAxis:return null!==(n=null===(i=r.getYAxisWidget())||void 0===i?void 0:i.getContainer())&&void 0!==n?n:null}}return null},t.prototype.getSize=function(t,e){var i,n;if(!Mt(t))return{width:Math.floor(this._chartContainer.clientWidth),height:Math.floor(this._chartContainer.clientHeight),left:0,top:0,right:0,bottom:0};var r=this.getDrawPaneById(t);if(null!==r){var a=null!==e&&void 0!==e?e:br.Root;switch(a){case br.Root:return r.getBounding();case br.Main:return r.getMainWidget().getBounding();case br.YAxis:return null!==(n=null===(i=r.getYAxisWidget())||void 0===i?void 0:i.getBounding())&&void 0!==n?n:null}}return null},t.prototype.setStyles=function(t){var e,i,n;this._chartStore.setOptions({styles:t}),n=Et(t)?Ui(t):t,Mt(null===(e=null===n||void 0===n?void 0:n.yAxis)||void 0===e?void 0:e.type)&&(null===(i=this._candlePane)||void 0===i||i.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,i){Mt(i)&&bt("applyNewData","","param `callback` has been deprecated since version 9.8.0, use `subscribeAction('onDataReady')` instead."),this._chartStore.addData(t,Kt.Init,e).then(function(){}).catch(function(){}).finally(function(){null===i||void 0===i||i()})},t.prototype.applyMoreData=function(t,e,i){bt("","","Api `applyMoreData` has been deprecated since version 9.8.0."),this._chartStore.addData(t,Kt.Forward,null===e||void 0===e||e).then(function(){}).catch(function(){}).finally(function(){null===i||void 0===i||i()})},t.prototype.updateData=function(t,e){Mt(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,i,n){var r,a=this,o=Et(t)?{name:t}:t;if(null===ai(o.name))return bt("createIndicator","value","indicator not supported, you may need to use registerIndicator to add one!!!"),null;var s=null===i||void 0===i?void 0:i.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;a._setPaneOptions(null!==i&&void 0!==i?i:{},null!==(e=l.getAxisComponent().buildTicks(!0))&&void 0!==e&&e)}).catch(function(t){});else{null!==s&&void 0!==s||(s=de(Vi.INDICATOR));var c=this._createPane(nr,s,null!==i&&void 0!==i?i:{}),u=null!==(r=null===i||void 0===i?void 0:i.height)&&void 0!==r?r:Wi;c.setBounding({height:u}),this._chartStore.getIndicatorStore().addInstance(o,s,null!==e&&void 0!==e&&e).finally(function(){a.adjustPaneViewport(!0,!0,!0,!0,!0),null===n||void 0===n||n()})}return null!==s&&void 0!==s?s:null},t.prototype.overrideIndicator=function(t,e,i){var n=this;this._chartStore.getIndicatorStore().override(t,null!==e&&void 0!==e?e:null).then(function(t){var e=q(t,2),r=e[0],a=e[1];(r||a)&&(n.adjustPaneViewport(!1,a,!0,a),null===i||void 0===i||i())}).catch(function(){})},t.prototype.getIndicatorByPaneId=function(t,e){return this._chartStore.getIndicatorStore().getInstanceByPaneId(t,e)},t.prototype.removeIndicator=function(t,e){var i,n,r,a=this._chartStore.getIndicatorStore(),o=a.removeInstance(t,e);if(o){var s=!1;if(t!==Vi.CANDLE&&!a.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(Mt(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 f=p.value;if(f[1].getTopPane().getId()===l.getId()){f[1].setTopPane(d);break}}}catch(g){i={error:g}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}u.destroy(),this._separatorPanes.delete(l)}this._drawPanes.splice(c,1),l.destroy();var v=this._drawPanes[0];Mt(v)&&v.getId()===Vi.X_AXIS&&(v=this._drawPanes[1]),null===(r=this._separatorPanes.get(v))||void 0===r||r.destroy(),this._separatorPanes.delete(v)}}this.adjustPaneViewport(s,!0,!0,!0,!0)}},t.prototype.createOverlay=function(t,e){var i=[];if(Et(t))i=[{name:t}];else if(St(t))i=t.map(function(t){return Et(t)?{name:t}:t});else{var n=t;i=[n]}var r=!0;Mt(e)&&null!==this.getDrawPaneById(e)||(e=Vi.CANDLE,r=!1);var a=this._chartStore.getOverlayStore().addInstances(i,e,r);return St(t)?a:a[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;Mt(t)&&(e=Et(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 i=Tt(e)&&e>0?e:0,n=this._chartStore.getTimeScaleStore();if(n.startScroll(),i>0){var r=new le({duration:i});r.doFrame(function(e){var r=t*(e/i);n.scroll(r)}),r.start()}else n.scroll(t)},t.prototype.scrollToRealTime=function(t){var e=this._chartStore.getTimeScaleStore(),i=e.getBarSpace().bar,n=e.getLastBarRightSideDiffBarCount()-e.getInitialOffsetRightDistance()/i,r=n*i;this.scrollByDistance(r,t)},t.prototype.scrollToDataIndex=function(t,e){var i=this._chartStore.getTimeScaleStore(),n=(i.getLastBarRightSideDiffBarCount()+(this.getDataList().length-1-t))*i.getBarSpace().bar;this.scrollByDistance(n,e)},t.prototype.scrollToTimestamp=function(t,e){var i=pe(this.getDataList(),"timestamp",t);this.scrollToDataIndex(i,e)},t.prototype.zoomAtCoordinate=function(t,e,i){var n=Tt(i)&&i>0?i:0,r=this._chartStore.getTimeScaleStore(),a=r.getBarSpace().bar,o=a*t,s=o-a;if(n>0){var l=0,c=new le({duration:n});c.doFrame(function(t){var i=s*(t/n),a=(i-l)/r.getBarSpace().bar*ke;r.zoom(a,e),l=i}),c.start()}else r.zoom(s/a*ke,e)},t.prototype.zoomAtDataIndex=function(t,e,i){var n=this._chartStore.getTimeScaleStore().dataIndexToCoordinate(e);this.zoomAtCoordinate(t,{x:n,y:0},i)},t.prototype.zoomAtTimestamp=function(t,e,i){var n=pe(this.getDataList(),"timestamp",e);this.zoomAtDataIndex(t,n,i)},t.prototype.convertToPixel=function(t,e){var i,n=e.paneId,r=void 0===n?Vi.CANDLE:n,a=e.absolute,o=void 0!==a&&a,s=[];if(r!==Vi.X_AXIS){var l=this.getDrawPaneById(r);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={},i=t.dataIndex;if(Tt(t.timestamp)&&(i=c.timestampToDataIndex(t.timestamp)),Tt(i)&&(e.x=null===h||void 0===h?void 0:h.convertToPixel(i)),Tt(t.value)){var n=null===p||void 0===p?void 0:p.convertToPixel(t.value);e.y=o?u.top+n:n}return e})}}return St(t)?s:null!==(i=s[0])&&void 0!==i?i:{}},t.prototype.convertFromPixel=function(t,e){var i,n=e.paneId,r=void 0===n?Vi.CANDLE:n,a=e.absolute,o=void 0!==a&&a,s=[];if(r!==Vi.X_AXIS){var l=this.getDrawPaneById(r);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,i,n={};if(Tt(t.x)){var r=null!==(e=null===h||void 0===h?void 0:h.convertFromPixel(t.x))&&void 0!==e?e:-1;n.dataIndex=r,n.timestamp=null!==(i=c.dataIndexToTimestamp(r))&&void 0!==i?i:void 0}if(Tt(t.y)){var a=o?t.y-u.top:t.y;n.value=p.convertFromPixel(a)}return n})}}return St(t)?s:null!==(i=s[0])&&void 0!==i?i:{}},t.prototype.executeAction=function(t,e){var i;switch(t){case Pt.OnCrosshairChange:var n=X({},e);n.paneId=null!==(i=n.paneId)&&void 0!==i?i:Vi.CANDLE,this._chartStore.getTooltipStore().setCrosshair(n,{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,i){var n=this,r=this._chartContainer.clientWidth,a=this._chartContainer.clientHeight,o=he("canvas",{width:"".concat(r,"px"),height:"".concat(a,"px"),boxSizing:"border-box"}),s=o.getContext("2d"),l=Vt(o);o.width=r*l,o.height=a*l,s.scale(l,l),s.fillStyle=null!==i&&void 0!==i?i:"#FFFFFF",s.fillRect(0,0,r,a);var c=null!==t&&void 0!==t&&t;return this._drawPanes.forEach(function(t){var e=n._separatorPanes.get(t);if(Mt(e)){var i=e.getBounding();s.drawImage(e.getImage(c),i.left,i.top,i.width,i.height)}var a=t.getBounding();s.drawImage(t.getImage(c),0,a.top,r,a.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}(),Sr=new Map,kr=1;function Ar(t,e){var i;if(_t(),i=Et(t)?document.getElementById(t):t,null===i)return xt("","","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 n=Sr.get(i.id);if(Mt(n))return bt("","","The chart has been initialized on the dom!!!"),n;var r="k_line_chart_".concat(kr++);return n=new Cr(i,e),n.id=r,i.setAttribute("k-line-chart-id",r),Sr.set(r,n),n}var Tr=i(21396),Mr=i.n(Tr);function Ir(t,e,i,n){if(!t||!e||!i||!n)return t;try{var r=Mr().enc.Base64.parse(t),a=Mr().lib.WordArray.create(r.words.slice(0,4)),o=Mr().lib.WordArray.create(r.words.slice(4)),s=Mr().enc.Base64.parse(n),l=Mr().AES.decrypt({ciphertext:o},s,{iv:a,mode:Mr().mode.CBC,padding:Mr().pad.Pkcs7}),c=l.toString(Mr().enc.Utf8);return c||t}catch(u){return t}}function Er(t,e){return Dr.apply(this,arguments)}function Dr(){return Dr=(0,c.A)((0,l.A)().m(function t(e,i){var n,r;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e&&i){t.n=1;break}throw new Error("用户ID和指标ID不能为空");case 1:return t.p=1,t.n=2,(0,f.Ay)({url:"/api/indicator/getDecryptKey",method:"post",data:{userid:e,indicatorId:i}});case 2:if(n=t.v,1!==n.code||!n.data||!n.data.key){t.n=3;break}return t.a(2,n.data.key);case 3:throw new Error(n.msg||"获取解密密钥失败");case 4:t.n=6;break;case 5:throw t.p=5,r=t.v,new Error("无法获取解密密钥,请检查网络连接或联系管理员: "+(r.message||"未知错误"));case 6:return t.a(2)}},t,null,[[1,5]])})),Dr.apply(this,arguments)}function Pr(t,e,i){return Lr.apply(this,arguments)}function Lr(){return Lr=(0,c.A)((0,l.A)().m(function t(e,i,n){var r;return(0,l.A)().w(function(t){while(1)switch(t.n){case 0:return t.n=1,Er(i,n);case 1:return r=t.v,t.a(2,Ir(e,i,n,r))}},t)})),Lr.apply(this,arguments)}function Rr(t,e){if(1===e||!0===e)return!0;if(t&&t.length>100)try{var i=atob(t);if(i.length>50)return!0}catch(n){}return!1}var Fr={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 i=e.emit,n=(0,h.IJ)([]),r=(0,h.KR)(!1),a=(0,h.KR)(null),s=(0,h.KR)(!1),u=(0,h.KR)(!0),p=null,v=(0,h.KR)(!1),g=(0,h.IJ)(null),m=(0,h.KR)(t.theme||"light"),y=(0,h.KR)(null),x=(0,h.KR)(5e3),_=(0,h.KR)(!1),w=(0,h.KR)(1e4),C=(0,h.KR)(0),S=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(g.value){var e=Date.now(),i=Number(w.value||1e4);(t||!C.value||e-C.value>=i)&&(C.value=e,_t())}},k=(0,h.KR)([]),A=(0,h.KR)([]),T=(0,h.KR)([]),M=(0,h.KR)(null),I=(0,h.nI)(),E=I.proxy,D=(0,h.EW)(function(){return[{name:"line",title:E.$t("dashboard.indicator.drawing.line"),icon:"line"},{name:"horizontalLine",title:E.$t("dashboard.indicator.drawing.horizontalLine"),icon:"minus"},{name:"verticalLine",title:E.$t("dashboard.indicator.drawing.verticalLine"),icon:"column-width"},{name:"ray",title:E.$t("dashboard.indicator.drawing.ray"),icon:"arrow-right"},{name:"straightLine",title:E.$t("dashboard.indicator.drawing.straightLine"),icon:"menu"},{name:"parallelStraightLine",title:E.$t("dashboard.indicator.drawing.parallelLine"),icon:"menu"},{name:"priceLine",title:E.$t("dashboard.indicator.drawing.priceLine"),icon:"dollar"},{name:"priceChannelLine",title:E.$t("dashboard.indicator.drawing.priceChannel"),icon:"border"},{name:"fibonacciLine",title:E.$t("dashboard.indicator.drawing.fibonacciLine"),icon:"rise"},{name:"measure",title:E.$t("dashboard.indicator.drawing.measure"),icon:"drag"}]}),F=(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}}]),B=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"},i=e[t]||t;if(M.value!==t){M.value=t;try{var n=["priceRangeMeasure"];if(n.includes(i)){if("function"!==typeof g.value.overrideOverlay)return void(M.value=null);g.value.overrideOverlay({name:i,lock:!1})}else{var r={name:i,lock:!1,extendData:{isDrawing:!0}},a=g.value.createOverlay(r);a?T.value.push(a):M.value=null}}catch(o){M.value=null}}else{M.value=null;try{"function"===typeof g.value.overrideOverlay&&g.value.overrideOverlay(null)}catch(s){}}}},O=function(){if(g.value)try{T.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){}}),T.value=[],M.value=null,"function"===typeof g.value.overrideOverlay&&g.value.overrideOverlay(null)}catch(t){}},z=function(t){var e=B(t.id);if(e)i("indicator-toggle",{action:"remove",indicator:{id:t.id}});else{var n=(0,d.A)((0,d.A)({},t),{},{params:(0,d.A)({},t.defaultParams),calculate:null});i("indicator-toggle",{action:"add",indicator:n})}},W=(0,h.KR)(null),V=(0,h.KR)(!1),$=(0,h.KR)(!1),H=(0,h.KR)(!1),K=(0,h.EW)(function(){return"dark"===m.value?{backgroundColor:"#131722",textColor:"#d1d4dc",textColorSecondary:"#787b86",borderColor:"#2a2e39",gridLineColor:"#1f2943",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:"#2a2e39",dataZoomFiller:"rgba(41, 98, 255, 0.15)",dataZoomHandle:"#13c2c2",dataZoomText:"transparent",dataZoomBg:"#1f2943"}:{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"}}),Y=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 W.value=window.pyodide,$.value=!0,void t(window.pyodide);V.value=!0;var i="0.25.0",n=function(t){return t&&t.endsWith("/")?t:t?t+"/":t},r="/assets/pyodide/v".concat(i,"/full/"),a="https://cdn.jsdelivr.net/pyodide/v".concat(i,"/full/"),o=n({NODE_ENV:"production",VUE_APP_PREVIEW:"false",VUE_APP_API_BASE_URL:"/api",BASE_URL:"/"}.VUE_APP_PYODIDE_LOCAL_BASE||r),s=n({NODE_ENV:"production",VUE_APP_PREVIEW:"false",VUE_APP_API_BASE_URL:"/api",BASE_URL:"/"}.VUE_APP_PYODIDE_CDN_BASE||a),u=({NODE_ENV:"production",VUE_APP_PREVIEW:"false",VUE_APP_API_BASE_URL:"/api",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,i){var n=document.querySelector('script[data-pyodide-src="'.concat(t,'"]'));if(n)return"function"===typeof window.loadPyodide?e():(n.addEventListener("load",function(){return e()},{once:!0}),void n.addEventListener("error",function(){return i(new Error("Pyodide 脚本加载失败"))},{once:!0}));var r=document.createElement("script");r.dataset.pyodideSrc=t,r.src=t,r.onload=function(){return e()},r.onerror=function(){return i(new Error("Pyodide 脚本加载失败"))},document.head.appendChild(r)})},p=function(){var e=(0,c.A)((0,l.A)().m(function e(i){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:i});case 2:return window.pyodide=e.v,e.n=3,window.pyodide.loadPackage(["pandas","numpy"]);case 3:W.value=window.pyodide,$.value=!0,V.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,i,n;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,i=t.v,t.p=6,t.n=7,e(d?o:s);case 7:t.n=9;break;case 8:throw t.p=8,n=t.v,n||i;case 9:return t.a(2)}},t,null,[[6,8],[1,5]])}))().catch(function(t){V.value=!1,H.value=!0,e(t)})})},U=function(t){if(!t||"string"!==typeof t)return null;try{var e={},i=t.match(/(\w+)\s*=\s*(\d+\.?\d*)/g);return i&&i.forEach(function(t){var i=t.split("=");if(2===i.length){var n=i[0].trim(),r=parseFloat(i[1].trim());isNaN(r)||(e[n]=r)}}),{params:e,plots:[],success:!0}}catch(n){return{params:{},plots:[],success:!1}}},G=function(){var e=(0,c.A)((0,l.A)().m(function e(i,n){var r,a,s,c,u,d,h,p,f,v,g,m,y,b,x,_,w,C,S=arguments;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(r=S.length>2&&void 0!==S[2]?S[2]:{},a=S.length>3&&void 0!==S[3]?S[3]:{},$.value&&W.value){e.n=5;break}if(!V.value){e.n=4;break}s=0;case 1:if(!(V.value&&s<30)){e.n=4;break}return e.n=2,new Promise(function(t){return setTimeout(t,500)});case 2:if(s++,!$.value||!W.value){e.n=3;break}return e.a(3,4);case 3:e.n=1;break;case 4:if($.value&&W.value){e.n=5;break}throw V.value?(V.value=!1,H.value=!0):H.value=!0,new Error("Python 引擎未就绪,请等待加载完成");case 5:if(e.p=5,c=i,u=a.is_encrypted||a.isEncrypted||0,!u&&!Rr(i,u)){e.n=11;break}if(d=a.user_id||a.userId||t.userId||r.userId,h=a.originalId||a.id||r.indicatorId,!d||!h){e.n=10;break}return e.p=6,e.n=7,Pr(c,d,h);case 7:c=e.v,e.n=9;break;case 8:throw e.p=8,_=e.v,new Error("代码解密失败,无法执行指标: "+(_.message||"未知错误"));case 9:e.n=11;break;case 10:throw new Error("缺少必要的解密参数(用户ID或指标ID),无法执行加密指标");case 11:return p=n.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}}),f=JSON.stringify(p),v=JSON.stringify(r||{}),g=f.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),m=v.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,W.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,x=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(x){e.n=16;break}return e.a(2,{plots:[],signals:[],calculatedVars:{}});case 16:return x.plots&&Array.isArray(x.plots)||(x.plots=[]),x.plots=x.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}),x.signals&&Array.isArray(x.signals)&&(x.signals=x.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})),x.calculatedVars||(x.calculatedVars={}),e.a(2,x);case 17:throw e.p=17,C=e.v,new Error("Python 执行失败: ".concat(C.message));case 18:return e.a(2)}},e,null,[[13,14],[6,8],[5,17]])}));return function(t,i){return e.apply(this,arguments)}}();function j(t,e){for(var i=[],n=0;nn-e+1){var c=(t[o-1].high+t[o-1].low+t[o-1].close)/3;s>c?r+=l:sp&&h>0?o.push(h):o.push(0),p>h&&p>0?s.push(p):s.push(0)}for(var f=[],v=[],g=[],m=0;m=e-1){var w=f[m],C=v[m],S=g[m];if(0===w?(i.push(0),n.push(0)):(i.push(C/w*100),n.push(S/w*100)),m>=e-1){var k=i[m]+n[m],A=0===k?0:Math.abs(i[m]-n[m])/k*100;if(m===e-1)r.push(A);else if(m===e){var T=Math.abs(i[m-1]-n[m-1])/(i[m-1]+n[m-1])*100;r.push((T+A)/2)}else r.push((r[m-1]*(e-1)+A)/e)}}}return{adx:r,plusDI:i,minusDI:n}}function nt(t){for(var e=[],i=0,n=0;nt[n-1].close?i+=t[n].volume:t[n].close255?12:7)},0),m=g+2*h,y=f+2*p,b=(null===(i=a.extendData)||void 0===i?void 0:i.side)||(null===(n=a.extendData)||void 0===n?void 0:n.type)||"buy",x="buy"===b,_=x?u:u-y,w=d,C=w,S=x?_:_+y;return[{type:"line",attrs:{coordinates:[{x:c,y:C},{x:c,y:S}]},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:_,width:m,height:y,r:4},styles:{style:"fill",color:l,borderSize:0},ignoreEvent:!0},{type:"text",attrs:{x:c,y:_+y/2,text:v,align:"center",baseline:"middle"},styles:{color:"#ffffff",size:f,weight:"bold",backgroundColor:l,borderRadius:5},ignoreEvent:!0}]}}),Ni({name:"priceRangeMeasure",totalStep:2,lock:!1,needDefaultPointFigure:!1,needDefaultXAxisFigure:!1,needDefaultYAxisFigure:!1,createPointFigures:function(t){var e=t.coordinates,i=t.overlay,n=t.ctx;if(!e[0]||!e[1])return[];var r=i.points[0],a=i.points[1];if(!r||!a)return[];var o=r.value,s=a.value,l=s-o,c=l/o*100,u=r.timestamp,d=a.timestamp,h=Math.abs(d-u),p="",f=Math.floor(h/864e5),v=Math.floor(h%864e5/36e5),g=Math.floor(h%36e5/6e4),m=Math.floor(h%6e4/1e3);p=f>0?"".concat(f,"天").concat(v>0?v+"小时":""):v>0?"".concat(v,"小时").concat(g>0?g+"分钟":""):g>0?"".concat(g,"分钟"):"".concat(m,"秒");var y=0;try{if(n&&n.chart){var b=n.chart.getData();if(b&&Array.isArray(b)&&b.length>0){var x=b.findIndex(function(t){return Math.abs(t.timestamp-u)<1e3}),_=b.findIndex(function(t){return Math.abs(t.timestamp-d)<1e3});x>=0&&_>=0&&(y=Math.abs(_-x))}}}catch(z){}var w=c>=0?"+".concat(c.toFixed(2),"%"):"".concat(c.toFixed(2),"%"),C=l>=0?"+".concat(l.toFixed(2)):"".concat(l.toFixed(2)),S="".concat(w," ").concat(C);y>0?(S+=" (".concat(y,"根"),p&&(S+=" / ".concat(p)),S+=")"):p&&(S+=" (".concat(p,")"));var k=l>=0,A=k?"#0ecb81":"#f6465d",T=k?"#0ecb81":"#f6465d",M=k?"rgba(14, 203, 129, 0.1)":"rgba(246, 70, 93, 0.1)",I=e[0].x,E=e[0].y,D=e[1].x,P=e[1].y,L=(I+D)/2,R=(E+P)/2,F=-20,B=12,N=7*S.length+16,O=B+8;return[{type:"line",attrs:{coordinates:[{x:I,y:E},{x:D,y:P}]},styles:{style:"stroke",color:A,size:2,dashedValue:[4,4]},ignoreEvent:!1},{type:"circle",attrs:{x:I,y:E,r:4},styles:{style:"fill",color:A},ignoreEvent:!1},{type:"circle",attrs:{x:D,y:P,r:4},styles:{style:"fill",color:A},ignoreEvent:!1},{type:"rect",attrs:{x:L-N/2,y:R+F-O/2,width:N,height:O,r:4},styles:{style:"fill",color:M,borderSize:1,borderColor:A},ignoreEvent:!1},{type:"text",attrs:{x:L,y:R+F,text:S,align:"center",baseline:"middle"},styles:{color:T,size:B,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 n=t[t.length-2],r=e.close.toFixed(2),a=(e.close-n.close)/n.close*100;i("price-change",{price:r,change:a})}else{var o=e.close.toFixed(2);i("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,i){var n=new Date(1e3*t),r=new Date(1e3*e);switch(i){case"1m":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes();case"5m":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours()&&Math.floor(n.getMinutes()/5)===Math.floor(r.getMinutes()/5);case"15m":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours()&&Math.floor(n.getMinutes()/15)===Math.floor(r.getMinutes()/15);case"30m":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours()&&Math.floor(n.getMinutes()/30)===Math.floor(r.getMinutes()/30);case"1H":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&n.getHours()===r.getHours();case"4H":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()&&Math.floor(n.getHours()/4)===Math.floor(r.getHours()/4);case"1D":return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate();case"1W":var a=Math.floor((n.getTime()-new Date(n.getFullYear(),0,1).getTime())/6048e5),o=Math.floor((r.getTime()-new Date(r.getFullYear(),0,1).getTime())/6048e5);return n.getFullYear()===r.getFullYear()&&a===o;default:return t===e}},dt=function(){var e=(0,c.A)((0,l.A)().m(function e(){var i,o,s,c,d,p,v,m=arguments;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(i=m.length>0&&void 0!==m[0]&&m[0],t.symbol){e.n=1;break}return e.a(2);case 1:if(!r.value||i){e.n=2;break}return e.a(2);case 2:return r.value=!0,a.value=null,e.p=3,o=[],e.p=4,e.n=5,(0,f.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=E.$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:n.value=o,u.value=!0,d=ct(o),lt(d),(0,h.dY)(function(){if(g.value){var e=n.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(i){g.value.applyNewData(e)}setTimeout(function(){g.value&&_t()},100)}}else mt();t.realtimeEnabled&&(gt(),vt())}),e.n=12;break;case 11:if(e.p=11,v=e.v,a.value=E.$t("dashboard.indicator.error.loadDataFailed")+": "+(v.message||E.$t("dashboard.indicator.error.loadDataFailedDesc")),n.value=[],g.value)try{g.value.applyNewData([])}catch(l){}case 12:return e.p=12,r.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(i){return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(t.symbol&&n.value&&0!==n.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 r,a,o,c,d,v;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,r=Math.floor(i/1e3),e.n=2,(0,f.Ay)({url:"/api/indicator/kline",method:"get",params:{market:t.market,symbol:t.symbol,timeframe:t.timeframe,limit:500,before_time:r}});case 2:if(a=e.v,1!==a.code||!a.data||!Array.isArray(a.data)){e.n=5;break}if(o=st(a.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.timestamp0&&(r=st(i.data),a=(0,R.A)(n.value),r.length>0&&(o=Math.floor(r[r.length-1].timestamp/1e3),s=Math.floor(a[a.length-1].timestamp/1e3),ut(o,s,t.timeframe)?(c=a[a.length-1],u=r[r.length-1],a[a.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},n.value=a,d=ct(n.value),lt(d),g.value&&"function"===typeof g.value.updateData?(h=n.value.length-1,g.value.updateData(a[h]),S(!1)):g.value&&(g.value.applyNewData(n.value),S(!1))):o>s&&(p=r.filter(function(e){var i=Math.floor(e.timestamp/1e3);return!a.some(function(e){var n=Math.floor(e.timestamp/1e3);return ut(i,n,t.timeframe)})}),p.length>0&&(n.value=[].concat((0,R.A)(a),(0,R.A)(p)),n.value.length>500&&(n.value=n.value.slice(-500)),v=ct(n.value),lt(v),g.value&&"function"===typeof g.value.applyMoreData?(g.value.applyMoreData(p),S(!0)):g.value&&(g.value.applyNewData(n.value),S(!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)}}(),vt=function(){y.value&&clearInterval(y.value);var e={"1m":5e3,"5m":1e4,"15m":15e3,"30m":3e4,"1H":6e4,"4H":3e5,"1D":6e5,"1W":18e5},i=e[t.timeframe]||1e4;x.value=Math.min(i,1e3),t.realtimeEnabled&&t.symbol&&n.value.length>0&&(y.value=setInterval(function(){!r.value&&t.symbol&&n.value&&n.value.length>0&&ft()},x.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=Ar(e,{drawingBarVisible:!0,overlay:{visible:!0}})}catch(y){g.value=Ar(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(M.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"},i=e[M.value];if(!t.name||t.name===i||"priceRangeMeasure"===i){T.value.push(t.id),M.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){M.value&&t&&t.id&&(T.value.push(t.id),M.value=null)})}catch(y){}g.value.subscribeAction("onOverlayRemoved",function(t){var e=T.value.indexOf(t);e>-1&&T.value.splice(e,1)})}if(g.value&&"function"===typeof g.value.subscribeAction){var i=null,r=!1;g.value.subscribeAction("onVisibleRangeChange",function(){var t=(0,c.A)((0,l.A)().m(function t(e){var a,o,c,d,h,f;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(r){t.n=1;break}return i=e.from,r=!0,setTimeout(function(){v.value=!0},1e3),t.a(2);case 1:if(v.value){t.n=2;break}return i=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&&(a=n.value.length,a>0&&(o=g.value.getVisibleRange(),o&&(c=Math.ceil((o.to-o.from)*a/100),d=.1,h=Math.min(100,d+c/a*100),g.value.setVisibleRange(d,h))))}catch(y){}return t.a(2);case 3:if(!(e.from<=5&&!s.value&&!p&&u.value&&v.value)){t.n=4;break}if(!(null!==i&&i>e.from)){t.n=4;break}if(!(n.value.length>0)){t.n=4;break}return f=n.value[0].timestamp,t.n=4,ht(f);case 4:i=e.from;case 5:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}())}if(n.value&&n.value.length>0){var o=n.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(){_t()})}}window.addEventListener("resize",yt)}catch(a){a.value=E.$t("dashboard.indicator.error.chartInitFailed")+": "+(a.message||"未知错误")}}else{var d=0,f=10,m=function(){var t=document.getElementById("kline-chart-container");t&&t.clientWidth>0&&t.clientHeight>0?mt():d0&&t.clientHeight>0&&mt()}},bt=function(){if(g.value){var t=K.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:[E.$t("dashboard.indicator.tooltip.time"),E.$t("dashboard.indicator.tooltip.open"),E.$t("dashboard.indicator.tooltip.high"),E.$t("dashboard.indicator.tooltip.low"),E.$t("dashboard.indicator.tooltip.close"),E.$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}})}},xt=function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];try{var o={name:t,shortName:t,calc:e,figures:i,calcParams:n,precision:r,series:a?"price":"normal"};return ri(o),!0}catch(s){return!(!s.message||!s.message.includes("already registered"))}},_t=function(){var e=(0,c.A)((0,l.A)().m(function e(){var i,r,a,o;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!_.value){e.n=1;break}return e.a(2);case 1:if(g.value&&0!==n.value.length){e.n=2;break}return e.a(2);case 2:_.value=!0,e.p=3;try{A.value.length>0&&g.value&&(A.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){}}),A.value=[])}catch(s){}try{k.value.length>0&&(k.value.forEach(function(t){var e="string"===typeof t?t:t.name,i="string"===typeof t?void 0:t.paneId;i?g.value.removeIndicator(i,e):(g.value.removeIndicator("candle_pane",e),g.value.removeIndicator(e))}),k.value=[])}catch(s){}i=ct(n.value),r=(0,l.A)().m(function e(){var n,r,a,s,c,u,d,h,p,f,v,m,y,x,_,w,C,S,T,M,I,E,D,P,F,B,N,O,z,W,$,K,X,U,st,lt,ct,ut,dt,ht,pt,ft,vt,gt,mt,yt,bt,_t,wt,Ct,St,kt,At,Tt,Mt,It,Et,Dt,Pt,Lt,Rt,Ft,Bt,Nt,Ot,zt,Wt,Vt,$t,Ht,Kt,Yt,Xt,Ut,Gt,jt,qt,Zt,Jt,Qt,te,ee,ie,ne,re,ae,oe,se,le,ce,ue,de,he,pe,fe,ve,ge,me,ye,be,xe,_e,we,Ce,Se,ke,Ae,Te,Me,Ie,Ee,De,Pe,Le,Re,Fe,Be,Ne,Oe,ze,We,Ve,$e,He,Ke,Ye,Xe,Ue,Ge,je,qe,Ze,Je,Qe,ti,ei,ii,ni,ri,ai,oi,si,li,ci,ui,di,hi,pi,fi,vi,gi,mi,yi,bi;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(n=t.activeIndicators[o],e.p=1,"python"!==n.type){e.n=31;break}if(n.code){e.n=2;break}return e.a(2,0);case 2:if(e.p=2,!n.calculate||"function"!==typeof n.calculate){e.n=15;break}return e.n=3,n.calculate(i,n.params||{});case 3:if(r=e.v,a=[],r&&r.plots&&Array.isArray(r.plots)&&(a=(0,R.A)(r.plots)),!(r&&r.signals&&Array.isArray(r.signals))){e.n=14;break}s=(0,b.A)(r.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;h0&&g.value){E=(0,b.A)(f);try{for(E.s();!(D=E.n()).done;){P=D.value;try{F=P.timestamp,F<1e10&&(F*=1e3),B=P.text,"function"===typeof g.value.createOverlay&&(N=g.value.createOverlay({name:"signalTag",points:[{timestamp:F,value:P.price},{timestamp:F,value:P.anchorPrice}],extendData:{text:B,color:P.color,side:P.side,action:P.action,price:P.price},lock:!0},"candle_pane"),N&&A.value.push(N))}catch(l){}}}catch(xi){E.e(xi)}finally{E.f()}}case 10:e.n=5;break;case 11:e.n=13;break;case 12:e.p=12,mi=e.v,s.e(mi);case 13:return e.p=13,s.f(),e.f(13);case 14:if(a.length>0&&(O=a.filter(function(t){return t.data&&Array.isArray(t.data)&&t.data.length>0}),O.length>0)){for(z=[],W={},$=0;$0)){e.n=23;break}for(_t=[],wt=0;wt0&&g.value){Bt=(0,b.A)(St);try{for(Bt.s();!(Nt=Bt.n()).done;){Ot=Nt.value;try{zt=Ot.timestamp,zt<1e10&&(zt*=1e3),Wt=Ot.text,"function"===typeof g.value.createOverlay&&(Vt=g.value.createOverlay({name:"signalTag",points:[{timestamp:zt,value:Ot.price},{timestamp:zt,value:Ot.anchorPrice}],extendData:{text:Wt,color:Ot.color,side:Ot.side,action:Ot.action,price:Ot.price},lock:!0},"candle_pane"),Vt&&A.value.push(Vt))}catch(l){}}}catch(xi){Bt.e(xi)}finally{Bt.f()}}case 23:e.n=18;break;case 24:e.n=26;break;case 25:e.p=25,yi=e.v,mt.e(yi);case 26:return e.p=26,mt.f(),e.f(26);case 27:if(gt.length>0&&($t=gt.filter(function(t){return t.data&&Array.isArray(t.data)&&t.data.length>0}),$t.length>0)){for(Ht=[],Kt={},Yt=0;Yt<$t.length;Yt++)Xt=$t[Yt],Ut=Xt.name||"PLOT_".concat(Yt),Gt=Ut.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"_"),jt=Xt.color||Y(Yt),qt=Xt.type||"line",Ht.push({key:Gt,title:Xt.name||Ut,type:qt,color:jt}),Kt[Gt]=Xt.data;Zt=$t.every(function(t){return!1!==t.overlay}),Jt="".concat(n.id,"_combined"),vt&&vt.name&&(Jt=vt.name);try{Qt=xt(Jt,function(t){for(var e=[],i=0;i0&&(0,h.dY)(function(){g.value&&_t()})},{deep:!0}),(0,h.wB)(function(){return t.realtimeEnabled},function(t){t?vt():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:n,loading:r,error:a,loadingHistory:s,chartRef:g,chartTheme:m,themeConfig:K,getIndicatorColor:Y,handleRetry:wt,loadingPython:V,pythonReady:$,pyodideLoadFailed:H,formatKlineData:st,updatePricePanel:lt,isSameTimeframe:ut,loadKlineData:dt,loadMoreHistoryData:pt,updateKlineRealtime:ft,startRealtime:vt,stopRealtime:gt,initChart:mt,handleResize:yt,updateChartTheme:bt,updateIndicators:_t,executePythonStrategy:G,parsePythonStrategy:U,indicatorButtons:F,isIndicatorActive:B,toggleIndicator:z,drawingTools:D,activeDrawingTool:M,selectDrawingTool:N,clearAllDrawings:O}}},Br=Fr,Nr=(0,T.A)(Br,E,D,!1,null,"5f0b12e1",null),Or=Nr.exports,zr=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(i){return e("a-button",{key:i.key,attrs:{type:t.selectedDatePreset===i.key?"primary":"default"},on:{click:function(e){return t.applyDatePreset(i)}}},[t._v(t._s(i.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(i){return[e("a-tag",{attrs:{color:t.getTradeTypeColor(i)}},[t._v(" "+t._s(t.getTradeTypeText(i))+" ")])]}},{key:"balance",fn:function(i){return[e("span",{staticStyle:{color:"#1890ff","font-weight":"500"}},[t._v(" $"+t._s(i?i.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"--")+" ")])]}},{key:"profit",fn:function(i){return[e("span",{style:{color:i>0?"#52c41a":i<0?"#f5222d":"#666"}},[t._v(" "+t._s(t.formatMoney(i))+" ")])]}}])})],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)},Wr=[],Vr=i(95093),$r=i.n(Vr),Hr=i(15014),Kr={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 $r()().subtract(this.recommendedRange.days,"days")},defaultEndDate:function(){return $r()()},earliestDate:function(){return $r()().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"),i=Number(this.form.getFieldValue("trendAddMaxTimes")||0),n=Number(this.form.getFieldValue("dcaAddMaxTimes")||0),r=Number(this.form.getFieldValue("trendAddSizePct")||0),a=Number(this.form.getFieldValue("dcaAddSizePct")||0),o=(t?i*r:0)+(e?n*a: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>$r()().endOf("day")||t$r()().endOf("day"))return!0;if(tn.endOf("day"))return!0}return!1},applyDatePreset:function(t){this.selectedDatePreset=t.key;var e=$r()(),i=$r()().subtract(t.days,"days");this.form.setFieldsValue({startDate:i,endDate:e}),this.fetchPrecisionInfo(i,e)},fetchPrecisionInfo:function(t,e){var i=this;return(0,c.A)((0,l.A)().m(function n(){var r;return(0,l.A)().w(function(n){while(1)switch(n.p=n.n){case 0:if(t&&e||(t=i.form?i.form.getFieldValue("startDate"):null,e=i.form?i.form.getFieldValue("endDate"):null),t||(t=i.defaultStartDate),e||(e=i.defaultEndDate),i.market&&"crypto"===i.market.toLowerCase()){n.n=1;break}return i.precisionInfo={enabled:!1,reason:"only_crypto",message:i.$t("dashboard.indicator.backtest.onlyCryptoSupported")},n.a(2);case 1:return n.p=1,n.n=2,(0,f.Ay)({url:"/api/indicator/backtest/precision-info",method:"get",params:{market:i.market,startDate:t.format("YYYY-MM-DD"),endDate:e.format("YYYY-MM-DD")},timeout:3e4});case 2:r=n.v,1===r.code&&r.data&&(i.precisionInfo=r.data),n.n=4;break;case 3:n.p=3,n.v,i.precisionInfo=null;case 4:return n.a(2)}},n,null,[[1,3]])}))()},onTimeframeChange:function(){this.selectedDatePreset="30d";var t=$r()(),e=$r()().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 i=e.diff(t,"days"),n=this.maxBacktestRange.days||365;return!(i>n)||(this.$message.error(this.$t("dashboard.indicator.backtest.dateRangeExceededDays",{timeframe:this.selectedTimeframe||this.timeframe,maxRange:this.maxBacktestRange.label,maxDays:n})),!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")||"即将完成,请稍候..."],i=0;this.loadingTip=e[0],this.loadingTimer=setInterval(function(){i=(i+1)%e.length,t.loadingTip=e[i]},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 i;return(0,l.A)().w(function(e){while(1)switch(e.n){case 0:i=["startDate","endDate","initialCapital","commission","leverage","tradeDirection","slippage"],t.form.validateFields(i,function(){var e=(0,c.A)((0,l.A)().m(function e(i,n){var r,a,o,s,c,u,h,p,v;return(0,l.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(!i){e.n=1;break}return e.a(2);case 1:if(r=(0,d.A)((0,d.A)({},t.form.getFieldsValue()||{}),n||{}),a=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(n.startDate,n.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(r.stopLossPct),takeProfitPct:o(r.takeProfitPct),trailing:{enabled:!!r.trailingEnabled,pct:o(r.trailingStopPct),activationPct:o(r.trailingActivationPct)}},position:{entryPct:o(r.entryPct||0)},scale:{trendAdd:{enabled:!!r.trendAddEnabled,stepPct:o(r.trendAddStepPct),sizePct:o(r.trendAddSizePct),maxTimes:r.trendAddMaxTimes||0},dcaAdd:{enabled:!!r.dcaAddEnabled,stepPct:o(r.dcaAddStepPct),sizePct:o(r.dcaAddSizePct),maxTimes:r.dcaAddMaxTimes||0},trendReduce:{enabled:!!r.trendReduceEnabled,stepPct:o(r.trendReduceStepPct),sizePct:o(r.trendReduceSizePct),maxTimes:r.trendReduceMaxTimes||0},adverseReduce:{enabled:!!r.adverseReduceEnabled,stepPct:o(r.adverseReduceStepPct),sizePct:o(r.adverseReduceSizePct),maxTimes:r.adverseReduceMaxTimes||0}}},c={userid:t.userId||1,indicatorId:t.indicator.id,symbol:t.symbol,market:t.market,timeframe:t.selectedTimeframe||t.timeframe,startDate:n.startDate.format("YYYY-MM-DD"),endDate:n.endDate.format("YYYY-MM-DD"),initialCapital:n.initialCapital,commission:o(n.commission||0),slippage:o(n.slippage||0),leverage:n.leverage||1,tradeDirection:n.tradeDirection||"long",strategyConfig:s,enableMtf:t.market&&"crypto"===t.market.toLowerCase()},e.n=6,(0,f.Ay)({url:"/api/indicator/backtest",method:"post",data:c,timeout:6e5});case 6:u=e.v,((Date.now()-a)/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,v=e.v,h=t.$t("dashboard.indicator.backtest.failed"),"ECONNABORTED"===v.code||v.message&&v.message.includes("timeout")?h="回测超时,请减少回测时间范围或使用更大的时间周期":v.response?h=(null===(p=v.response.data)||void 0===p?void 0:p.msg)||v.response.statusText||h:v.message&&(h=v.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,i){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=Hr.Ts(this.$refs.equityChartRef);var e=this.result.equityCurve||[],i=e.map(function(t){return t.time||t.date}),n=e.map(function(t){return void 0!==t.value?t.value:t.equity}),r=n[0]||1e5,a=n[n.length-1]||r,o=a>=r,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='
'.concat(t[0].axisValue,"
");return t.forEach(function(t){if(void 0!==t.value&&null!==t.value){var i=t.value.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});e+='
\n '.concat(t.marker," ").concat(t.seriesName,'\n $').concat(i,"\n
")}}),e}},legend:{show:!1},grid:{left:"3%",right:"4%",bottom:"12%",top:"8%",containLabel:!0},xAxis:{type:"category",data:i,boundaryGap:!1,axisLine:{lineStyle:{color:"#e8e8e8"}},axisTick:{show:!1},axisLabel:{color:"#8c8c8c",fontSize:11,rotate:0,interval:Math.floor(i.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:n,smooth:.4,symbol:"none",sampling:"lttb",lineStyle:{width:2.5,color:s,cap:"round",join:"round"},areaStyle:{color:new Hr.fA.W4(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)}},Yr=Kr,Xr=(0,T.A)(Yr,zr,Wr,!1,null,"473e449c",null),Ur=Xr.exports,Gr=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(i){return e("a-select-option",{key:i,attrs:{value:i}},[t._v(t._s(i))])}),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(i,n){return[e("span",[t._v(t._s(n.start_date||"")+" ~ "+t._s(n.end_date||""))])]}},{key:"status",fn:function(i){return[e("a-tag",{attrs:{color:"success"===i?"green":"failed"===i?"red":"blue"}},[t._v(" "+t._s("success"===i?t.$t("dashboard.indicator.backtest.historyStatusSuccess"):"failed"===i?t.$t("dashboard.indicator.backtest.historyStatusFailed"):i)+" ")])]}},{key:"actions",fn:function(i,n){return[e("a-button",{attrs:{type:"link",size:"small",loading:t.detailLoadingId===n.id},on:{click:function(e){return t.viewRun(n)}}},[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)},jr=[],qr={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||"",i=this.useCurrentFilters?this.symbol:this.filterSymbol||"",n=this.useCurrentFilters?this.timeframe:this.filterTimeframe||"";return e&&t.push("market=".concat(e)),i&&t.push("symbol=".concat(i)),n&&t.push("timeframe=".concat(n)),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 i,n,r,a;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,i=t.useCurrentFilters?t.symbol:t.filterSymbol||"",n=t.useCurrentFilters?t.timeframe:t.filterTimeframe||"",r=t.market||"",e.n=3,(0,f.Ay)({url:"/api/indicator/backtest/history",method:"get",params:{userid:t.userId,limit:100,offset:0,indicatorId:t.indicatorId,symbol:i,market:r,timeframe:n}});case 3:a=e.v,a&&1===a.code&&Array.isArray(a.data)?t.runs=a.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 i(){var n;return(0,l.A)().w(function(i){while(1)switch(i.p=i.n){case 0:if(t&&t.id){i.n=1;break}return i.a(2);case 1:return e.detailLoadingId=t.id,i.p=2,i.n=3,(0,f.Ay)({url:"/api/indicator/backtest/get",method:"get",params:{userid:e.userId,runId:t.id}});case 3:n=i.v,n&&1===n.code&&n.data&&e.$emit("view",n.data);case 4:return i.p=4,e.detailLoadingId=null,i.f(4);case 5:return i.a(2)}},i,null,[[2,,4,5]])}))()},handleAIAnalyze:function(){var t=this;return(0,c.A)((0,l.A)().m(function e(){var i,n;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,i=t.$i18n&&t.$i18n.locale?t.$i18n.locale:"zh-CN",e.n=3,(0,f.Ay)({url:"/api/indicator/backtest/aiAnalyze",method:"post",data:{userid:t.userId,runIds:t.selectedRowKeys,lang:i}});case 3:n=e.v,n&&1===n.code&&n.data&&n.data.analysis?t.aiResult=n.data.analysis:t.aiResult=n.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]])}))()}}},Zr=qr,Jr=(0,T.A)(Zr,Gr,jr,!1,null,null,null),Qr=Jr.exports,ta=function(){var t,e,i,n=this,r=n._self._c;return r("a-modal",{staticClass:"backtest-run-viewer",attrs:{title:n.modalTitle,visible:n.visible,width:1100,maskClosable:!1},on:{cancel:function(t){return n.$emit("cancel")}}},[n.run&&n.run.result?r("div",[n.run.id?r("a-alert",{staticStyle:{"margin-bottom":"12px"},attrs:{type:"info","show-icon":"",message:n.$t("dashboard.indicator.backtest.savedRunId",{id:n.run.id})}}):n._e(),r("div",{staticClass:"metrics-cards"},[r("div",{staticClass:"metric-card",class:{positive:n.result.totalReturn>0,negative:n.result.totalReturn<0}},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.totalReturn")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(n.formatPercent(n.result.totalReturn)))]),r("div",{staticClass:"metric-amount"},[n._v(n._s(n.formatMoney(n.result.totalProfit)))])]),r("div",{staticClass:"metric-card",class:{positive:n.result.annualReturn>0,negative:n.result.annualReturn<0}},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.annualReturn")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(n.formatPercent(n.result.annualReturn)))])]),r("div",{staticClass:"metric-card negative"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.maxDrawdown")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(n.formatPercent(n.result.maxDrawdown)))])]),r("div",{staticClass:"metric-card"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.sharpeRatio")))]),r("div",{staticClass:"metric-value"},[n._v(n._s((null!==(t=n.result.sharpeRatio)&&void 0!==t?t:0).toFixed(2)))])]),r("div",{staticClass:"metric-card"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.winRate")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(n.formatPercent(n.result.winRate)))])]),r("div",{staticClass:"metric-card",class:{positive:n.result.profitFactor>=1.5,negative:n.result.profitFactor<1}},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.profitFactor")))]),r("div",{staticClass:"metric-value"},[n._v(n._s((null!==(e=n.result.profitFactor)&&void 0!==e?e:0).toFixed(2)))])]),r("div",{staticClass:"metric-card"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.totalTrades")))]),r("div",{staticClass:"metric-value"},[n._v(n._s(null!==(i=n.result.totalTrades)&&void 0!==i?i:0))])]),r("div",{staticClass:"metric-card negative"},[r("div",{staticClass:"metric-label"},[n._v(n._s(n.$t("dashboard.indicator.backtest.totalCommission")))]),r("div",{staticClass:"metric-value"},[n._v("-$"+n._s(n.result.totalCommission?n.result.totalCommission.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"))])])]),r("div",{staticClass:"chart-section"},[r("div",{staticClass:"chart-title"},[n._v(n._s(n.$t("dashboard.indicator.backtest.equityCurve")))]),r("div",{ref:"equityChartRef",staticClass:"equity-chart"})]),r("div",{staticClass:"trades-section"},[r("div",{staticClass:"chart-title"},[n._v(n._s(n.$t("dashboard.indicator.backtest.tradeHistory")))]),r("a-table",{attrs:{columns:n.tradeColumns,"data-source":n.result.trades||[],pagination:{pageSize:10,size:"small"},size:"small",scroll:{x:800},rowKey:n.rowKey},scopedSlots:n._u([{key:"type",fn:function(t){return[r("a-tag",{attrs:{color:n.getTradeTypeColor(t)}},[n._v(" "+n._s(n.getTradeTypeText(t))+" ")])]}},{key:"balance",fn:function(t){return[r("span",{staticStyle:{color:"#1890ff","font-weight":"500"}},[n._v(" $"+n._s(t?t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"--")+" ")])]}},{key:"profit",fn:function(t){return[r("span",{style:{color:t>0?"#52c41a":t<0?"#f5222d":"#666"}},[n._v(" "+n._s(n.formatMoney(t))+" ")])]}}])})],1)],1):r("div",{staticStyle:{padding:"12px 0"}},[r("a-empty",{attrs:{description:n.$t("dashboard.indicator.backtest.historyNoData")}})],1),r("template",{slot:"footer"},[r("a-button",{on:{click:function(t){return n.$emit("cancel")}}},[n._v(n._s(n.$t("dashboard.indicator.backtest.close")))])],1)],2)},ea=[],ia={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=Hr.Ts(this.$refs.equityChartRef);var e=this.result.equityCurve||[],i=e.map(function(t){return t.time||t.date}),n=e.map(function(t){return void 0!==t.value?t.value:t.equity}),r=n[0]||1e5,a=n[n.length-1]||r,o=a>=r,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:i,boundaryGap:!1},yAxis:{type:"value"},series:[{name:this.$t("dashboard.indicator.backtest.strategy"),type:"line",data:n,smooth:.4,symbol:"none",sampling:"lttb",lineStyle:{width:2.5,color:s},areaStyle:{color:new Hr.fA.W4(0,0,0,1,l)}}]};this.equityChart.setOption(c),window.addEventListener("resize",function(){return t.equityChart&&t.equityChart.resize()})}}}},na=ia,ra=(0,T.A)(na,ta,ea,!1,null,"a484239a",null),aa=ra.exports,oa=i(38250),sa={name:"DashboardIndicator",components:{IndicatorEditor:I,KlineChart:Or,BacktestModal:Ur,BacktestHistoryDrawer:Qr,BacktestRunViewer:aa,QuickTradePanel:oa.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||{},i=e.proxy,n=(0,h.KR)(1),r=(0,h.KR)(!1),p=(0,h.KR)(void 0),m=(0,h.KR)([]),y=(0,h.KR)([]),b=(0,h.KR)(!1),x=(0,h.KR)(""),_=(0,h.KR)(!1),w=(0,h.KR)(!1),C=(0,h.KR)(!1),S=(0,h.KR)(""),k=(0,h.KR)(""),A=(0,h.KR)([]),T=(0,h.KR)(!1),M=(0,h.KR)([]),I=(0,h.KR)(!1),E=(0,h.KR)(null),D=(0,h.KR)(null),P=(0,h.KR)([]),L=(0,h.KR)(!1),R=(0,h.KR)(!1),F=(0,h.KR)(""),B=(0,h.KR)(""),N=(0,h.KR)(0),O=(0,h.EW)(function(){return"crypto"===(K.value||"").toLowerCase()}),z=function(){O.value?(F.value=H.value||"",N.value=parseFloat(Y.value)||0,B.value="",R.value=!0):u.A.warning(i.$t("quickTrade.cryptoOnly"))},W=function(){u.A.success(i.$t("quickTrade.orderSuccess"))},V=function(t){t&&O.value&&(F.value=t)},$=function(){i&&i.$router&&i.$router.push("/indicator-community")},H=(0,h.KR)(""),K=(0,h.KR)(""),Y=(0,h.KR)("--"),X=(0,h.KR)(0),U=(0,h.EW)(function(){return X.value>0?"color-up":X.value<0?"color-down":""}),G=(0,h.KR)("1D"),j=(0,h.KR)([]),q=(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),it=(0,h.KR)(!1),nt=(0,h.KR)(null),rt=(0,h.KR)(""),at=(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),ft=(0,h.KR)(null),vt=(0,h.KR)(!1),gt=(0,h.KR)(null),mt=(0,h.KR)(!1),yt=(0,h.KR)(null),bt=(0,h.KR)(!1),xt=(0,h.KR)(null),_t=(0,h.KR)(!1),wt=(0,h.KR)(!1),Ct=(0,h.KR)("free"),St=(0,h.KR)(10),kt=(0,h.KR)(""),At=(0,h.KR)(!1),Tt={price:[{required:!0,message:"请输入价格",trigger:"blur",type:"number"}]},Mt=(0,h.KR)(!1),It=function(t){var e=t.price,i=t.change;Y.value=e,X.value=i},Et=function(){},Dt=(0,h.KR)([]),Pt=(0,h.KR)([]),Lt=function(t){G.value=t},Rt=function(t){return t?Object.values(t).join(", "):""},Ft=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,i,a,o,s,c;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(r.value=!0,t.p=1,a=(0,h.nI)(),o=null===a||void 0===a||null===(e=a.proxy)||void 0===e?void 0:e.$store,s=(null===o||void 0===o||null===(i=o.getters)||void 0===i?void 0:i.userInfo)||{},!s||!s.email){t.n=2;break}return n.value=s.id,r.value=!1,Bt(),re(),t.a(2);case 2:return t.n=3,(0,g.ug)();case 3:c=t.v,c&&1===c.code&&c.data&&(n.value=c.data.id,o&&o.commit("SET_INFO",c.data),Bt(),re()),t.n=5;break;case 4:t.p=4,t.v;case 5:return t.p=5,r.value=!1,t.f(5);case 6:return t.a(2)}},t,null,[[1,4,5,6]])}));return function(){return t.apply(this,arguments)}}(),Bt=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,r;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value){t.n=1;break}return t.a(2);case 1:return b.value=!0,t.p=2,t.n=3,(0,v.Qo)({userid:n.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&&(r=y.value[0],K.value=r.market,H.value=r.symbol,p.value=r.value)),t.n=5;break;case 4:t.p=4,t.v,u.A.error(i.$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(){x.value?m.value=y.value.filter(function(t){return t.symbol.toLowerCase().includes(x.value.toLowerCase())||t.name&&t.name.toLowerCase().includes(x.value.toLowerCase())}):m.value=y.value},Ot=function(t){x.value=t,0===y.value.length&&t&&(_.value=!0),Nt()},zt=function(t){_.value=t,t||(x.value="")},Wt=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 i=t.split(":"),n=(0,s.A)(i,2),r=n[0],a=n[1];e={market:r,symbol:a,value:t}}e&&(K.value=e.market,H.value=e.symbol,p.value=e.value)}},Vt=function(t,e){var i,n=(null===(i=e.componentOptions)||void 0===i||null===(i=i.propsData)||void 0===i?void 0:i.value)||"";return"__empty_watchlist_hint__"===n||"__add_stock_option__"===n||n.toLowerCase().includes(t.toLowerCase())},$t=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,v.iO)();case 1:e=t.v,e&&1===e.code&&e.data&&Array.isArray(e.data)?P.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)?P.value=Object.keys(e.data).map(function(t){return{value:t,i18nKey:"dashboard.analysis.market.".concat(t)}}):P.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"}],P.value.length>0&&!S.value&&(S.value=P.value[0].value),t.n=3;break;case 2:t.p=2,t.v,P.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,E.value=null,k.value="",A.value=[],L.value=!1,S.value=P.value.length>0?P.value[0].value:""},Kt=function(t){S.value=t,k.value="",A.value=[],E.value=null,L.value=!1,qt(t)},Yt=function(t){var e=t.target.value;if(k.value=e,D.value&&clearTimeout(D.value),!e||""===e.trim())return A.value=[],L.value=!1,void(E.value=null);D.value=setTimeout(function(){Ut(e)},500)},Xt=function(t){t&&t.trim()&&(S.value?A.value.length>0||(L.value&&0===A.value.length?Gt():Ut(t)):u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")))},Ut=function(){var t=(0,c.A)((0,l.A)().m(function t(e){var n;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 A.value=[],L.value=!1,t.a(2);case 1:if(S.value){t.n=2;break}return u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")),t.a(2);case 2:return T.value=!0,L.value=!0,t.p=3,t.n=4,(0,v._3)({market:S.value,keyword:e.trim(),limit:20});case 4:n=t.v,n&&1===n.code&&n.data&&n.data.length>0?A.value=n.data:(A.value=[],E.value={market:S.value,symbol:e.trim().toUpperCase(),name:""}),t.n=6;break;case 5:t.p=5,t.v,A.value=[],E.value={market:S.value,symbol:e.trim().toUpperCase(),name:""};case 6:return t.p=6,T.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)}}(),Gt=function(){k.value&&k.value.trim()?S.value?E.value={market:S.value,symbol:k.value.trim().toUpperCase(),name:""}:u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")):u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseEnterSymbol"))},jt=function(t){E.value={market:t.market,symbol:t.symbol,name:t.name||t.symbol}},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=S.value||(P.value.length>0?P.value[0].value:"")),e){t.n=1;break}return t.a(2);case 1:return I.value=!0,t.p=2,t.n=3,(0,v.z6)({market:e,limit:10});case 3:i=t.v,i&&1===i.code&&i.data?M.value=i.data:M.value=[],t.n=5;break;case 4:t.p=4,t.v,M.value=[];case 5:return t.p=5,I.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,r,a,o,s,c;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(e="",r="",!E.value){t.n=1;break}e=E.value.market,r=E.value.symbol.toUpperCase(),t.n=4;break;case 1:if(!k.value||!k.value.trim()){t.n=3;break}if(S.value){t.n=2;break}return u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectMarket")),t.a(2);case 2:e=S.value,r=k.value.trim().toUpperCase(),t.n=4;break;case 3:return u.A.warning(i.$t("dashboard.analysis.modal.addStock.pleaseSelectOrEnterSymbol")),t.a(2);case 4:return C.value=!0,t.p=5,t.n=6,(0,v.dp)({userid:n.value,market:e,symbol:r});case 6:if(a=t.v,!a||1!==a.code){t.n=8;break}return u.A.success(i.$t("dashboard.analysis.message.addStockSuccess")),Ht(),t.n=7,Bt();case 7:t.n=9;break;case 8:u.A.error((null===a||void 0===a?void 0:a.msg)||i.$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)||i.$t("dashboard.analysis.message.addStockFailed"),u.A.error(s);case 11:return t.p=11,C.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(!ie(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,i=t.indicator;if("add"===e){var n=(0,d.A)((0,d.A)({},i),{},{calculate:ee(i.id)});Jt(n)}else"remove"===e&&Qt(i.id)},ee=function(t){return null},ie=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})},ne=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)})},re=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,i,r;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value){t.n=1;break}return t.a(2);case 1:return et.value=!0,t.p=2,t.n=3,(0,f.Ay)({url:"/api/indicator/getIndicators",method:"get",params:{userid:n.value}});case 3:e=t.v,1===e.code&&e.data&&(i=e.data.filter(function(t){return!t.is_buy||0===t.is_buy||"0"===t.is_buy}),r=e.data.filter(function(t){return 1===t.is_buy||"1"===t.is_buy}),Q.value=i.map(function(t){return(0,d.A)((0,d.A)({},t),{},{type:"python",source:"custom"})}),tt.value=r.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)}}(),ae=(0,h.KR)(null),oe=function(){var t=(0,c.A)((0,l.A)().m(function t(e,n){var r,a,o,s,c,h,p,f,v;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(r="".concat(n,"-").concat(e.id),!ie(r)){t.n=1;break}return Qt(r),t.a(2);case 1:if(t.p=1,a=e.code||"",ae.value){t.n=2;break}return u.A.error(i.$t("dashboard.indicator.error.chartNotReady")),t.a(2);case 2:if("function"===typeof ae.value.parsePythonStrategy){t.n=3;break}return u.A.error(i.$t("dashboard.indicator.error.chartMethodNotReady")),t.a(2);case 3:if("function"===typeof ae.value.executePythonStrategy){t.n=4;break}return u.A.error(i.$t("dashboard.indicator.error.chartExecuteNotReady")),t.a(2);case 4:if(o=ae.value.parsePythonStrategy(a),o){t.n=5;break}return u.A.error(i.$t("dashboard.indicator.error.parseFailed")),t.a(2);case 5:s=e.userParams||{},c=a,h=(0,d.A)({},s),p={id:r,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,i){return ae.value.executePythonStrategy(c,t,(0,d.A)((0,d.A)({},i),h),{id:e.id,user_id:e.user_id||e.userId,is_encrypted:e.is_encrypted||e.isEncrypted||0})}},f=(0,d.A)((0,d.A)({},o.params),s),j.value.push((0,d.A)((0,d.A)({},p),{},{params:f})),t.n=7;break;case 6:t.p=6,v=t.v,u.A.error(i.$t("dashboard.indicator.error.addIndicatorFailed")+": "+(v.message||"未知错误"));case 7:return t.a(2)}},t,null,[[1,6]])}));return function(e,i){return t.apply(this,arguments)}}(),se=function(){var t=(0,c.A)((0,l.A)().m(function t(e,n){var r,a,o,s,c;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(r="".concat(n,"-").concat(e.id),!ie(r)){t.n=1;break}Qt(r),t.n=5;break;case 1:return t.p=1,st.value=!0,t.n=2,i.$http.get("/api/indicator/getIndicatorParams",{params:{indicator_id:e.id}});case 2:a=t.v,a&&1===a.code&&Array.isArray(a.data)&&a.data.length>0?(at.value=a.data,o="".concat(n,"-").concat(e.id),s=lt.value[o],c={},a.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,nt.value=e,rt.value=n,it.value=!0):oe(e,n),t.n=4;break;case 3:t.p=3,t.v,oe(e,n);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,i){return t.apply(this,arguments)}}(),le=function(){if(nt.value){var t="".concat(rt.value,"-").concat(nt.value.id);lt.value[t]=(0,d.A)({},ot.value);var e=(0,d.A)((0,d.A)({},nt.value),{},{userParams:(0,d.A)({},ot.value)});oe(e,rt.value)}it.value=!1,nt.value=null,rt.value=""},ce=function(){ue(),it.value=!1,setTimeout(function(){nt.value=null,rt.value=""},100)},ue=function(){if(nt.value&&rt.value){var t="".concat(rt.value,"-").concat(nt.value.id);lt.value[t]=JSON.parse(JSON.stringify(ot.value))}},de=function(){ue()},he=function(t){var e=t.code,n=t.name;if(e&&e.trim())try{if(!ae.value)return void u.A.error(i.$t("dashboard.indicator.error.chartNotReady"));if("function"!==typeof ae.value.parsePythonStrategy)return void u.A.error(i.$t("dashboard.indicator.error.chartMethodNotReady"));if("function"!==typeof ae.value.executePythonStrategy)return void u.A.error(i.$t("dashboard.indicator.error.chartExecuteNotReady"));var r=ae.value.parsePythonStrategy(e);if(!r)return void u.A.error(i.$t("dashboard.indicator.error.parseFailedCheck"));var a={id:"temp-editor-indicator",name:n||"临时指标",type:"python",code:e,description:"",parsed:r,calculate:function(t,i){var n=e;return ae.value.executePythonStrategy(n,t,i)}},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)({},a),{},{params:(0,d.A)({},r.params)})),u.A.success(i.$t("dashboard.indicator.success.runIndicator"))}catch(s){u.A.error(i.$t("dashboard.indicator.error.runIndicatorFailed")+": "+(s.message||"未知错误"))}else u.A.warning(i.$t("dashboard.indicator.warning.enterCode"))},pe=function(){ht.value=null,dt.value=!0},fe=function(t){ht.value=t,dt.value=!0},ve=function(){ct.value=!ct.value},ge=function(t){a.A.confirm({title:i.$t("dashboard.indicator.delete.confirmTitle"),content:i.$t("dashboard.indicator.delete.confirmContent",{name:t.name}),okText:i.$t("dashboard.indicator.delete.confirmOk"),okType:"danger",cancelText:i.$t("dashboard.indicator.delete.confirmCancel"),onOk:function(){var e=(0,c.A)((0,l.A)().m(function e(){var r,a,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,f.Ay)({url:"/api/indicator/deleteIndicator",method:"post",data:{id:t.id,userid:n.value}});case 1:if(r=e.v,1!==r.code){e.n=3;break}return u.A.success(i.$t("dashboard.indicator.delete.success")),a="custom-"+t.id,ie(a)&&Qt(a),e.n=2,re();case 2:e.n=4;break;case 3:u.A.error(r.msg||i.$t("dashboard.indicator.delete.failed"));case 4:e.n=6;break;case 5:e.p=5,o=e.v,u.A.error(i.$t("dashboard.indicator.delete.failed")+": "+(o.message||"未知错误"));case 6:return e.a(2)}},e,null,[[0,5]])}));function r(){return e.apply(this,arguments)}return r}()})},me=function(t){ft.value=(0,d.A)({},t),pt.value=!0},ye=function(t){gt.value=(0,d.A)({},t),vt.value=!0},be=function(t){yt.value=t,mt.value=!0},xe=function(t){xt.value=(0,d.A)({},t),Ct.value=t.pricing_type||"free",St.value=t.price||10,kt.value=t.description||"",At.value=!!t.vip_free,bt.value=!0},_e=function(){var t=(0,c.A)((0,l.A)().m(function t(){var e,r;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value){t.n=1;break}return u.A.error(i.$t("dashboard.indicator.error.pleaseLogin")),t.a(2);case 1:return _t.value=!0,t.p=2,t.n=3,(0,f.Ay)({url:"/api/indicator/saveIndicator",method:"post",data:{userid:n.value,id:xt.value.id,code:xt.value.code,name:xt.value.name,description:kt.value,publishToCommunity:!0,pricingType:Ct.value,price:"paid"===Ct.value?St.value:0,vipFree:"paid"===Ct.value&&At.value}});case 3:if(e=t.v,1!==e.code){t.n=5;break}return u.A.success(i.$t("dashboard.indicator.publish.success")),bt.value=!1,xt.value=null,t.n=4,re();case 4:t.n=6;break;case 5:u.A.error(e.msg||i.$t("dashboard.indicator.publish.failed"));case 6:t.n=8;break;case 7:t.p=7,r=t.v,u.A.error(i.$t("dashboard.indicator.publish.failed")+": "+(r.message||""));case 8:return t.p=8,_t.value=!1,t.f(8);case 9:return t.a(2)}},t,null,[[2,7,8,9]])}));return function(){return t.apply(this,arguments)}}(),we=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(n.value&&xt.value){t.n=1;break}return t.a(2);case 1:return wt.value=!0,t.p=2,t.n=3,(0,f.Ay)({url:"/api/indicator/saveIndicator",method:"post",data:{userid:n.value,id:xt.value.id,code:xt.value.code,name:xt.value.name,description:xt.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(i.$t("dashboard.indicator.publish.unpublishSuccess")),bt.value=!1,xt.value=null,t.n=4,re();case 4:t.n=6;break;case 5:u.A.error(e.msg||i.$t("dashboard.indicator.publish.unpublishFailed"));case 6:t.n=8;break;case 7:t.p=7,t.v,u.A.error(i.$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)}}(),Ce=function(){var t=(0,c.A)((0,l.A)().m(function t(e){var r,a,o;return(0,l.A)().w(function(t){while(1)switch(t.p=t.n){case 0:if(n.value){t.n=1;break}return u.A.error(i.$t("dashboard.indicator.error.pleaseLogin")),t.a(2);case 1:return r=i.$refs.indicatorEditor,r&&(r.saving=!0),t.p=2,t.n=3,(0,f.Ay)({url:"/api/indicator/saveIndicator",method:"post",data:{userid:n.value,id:e.id||0,code:e.code}});case 3:if(a=t.v,1!==a.code){t.n=5;break}return u.A.success(i.$t("dashboard.indicator.save.success")),dt.value=!1,ht.value=null,t.n=4,re();case 4:t.n=6;break;case 5:u.A.error(a.msg||i.$t("dashboard.indicator.save.failed"));case 6:t.n=8;break;case 7:t.p=7,o=t.v,u.A.error(i.$t("dashboard.indicator.save.failed")+": "+(o.message||"未知错误"));case 8:return t.p=8,r&&(r.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)}}(),Se=function(t){var e=t.end_time;if(1===e||"1"===e)return i.$t("dashboard.indicator.status.normalPermanent");if(!e||0===e)return i.$t("dashboard.indicator.status.normal");var n=Math.floor(Date.now()/1e3);return e0&&!S.value&&(S.value=P.value[0].value),S.value&&qt(S.value)):(E.value=null,k.value="",A.value=[],L.value=!1,D.value&&(clearTimeout(D.value),D.value=null))}),(0,h.wB)(function(){return ot.value},function(t){if(it.value&&nt.value&&rt.value){var e="".concat(rt.value,"-").concat(nt.value.id);lt.value[e]=JSON.parse(JSON.stringify(t))}},{deep:!0,immediate:!1}),(0,h.wB)(it,function(t){t||ue()}),{userId:n,klineChart:ae,searchSymbol:p,symbolSuggestions:m,watchlist:y,symbolSearchValue:x,symbolSearchOpen:_,currentSymbol:H,currentMarket:K,currentPrice:Y,priceChange:X,priceChangeClass:U,timeframe:G,loadingWatchlist:b,activeIndicators:j,trendIndicators:Dt,oscillatorIndicators:Pt,customIndicators:Q,purchasedIndicators:tt,loadingIndicators:et,realtimeEnabled:Mt,toggleRealtime:Ee,handleSymbolSearch:Ot,handleSymbolSelect:Wt,handleDropdownVisibleChange:zt,filterSymbolOption:Vt,getMarketName:Me,getMarketColor:Ie,setTimeframe:Lt,addIndicator:Jt,removeIndicator:Qt,isIndicatorActive:ie,loadIndicators:re,addPythonIndicator:oe,toggleIndicator:se,getIndicatorStatus:Se,getIndicatorStatusIcon:ke,getIndicatorStatusClass:Ae,getExpiryTimeText:Te,formatParams:Rt,loadWatchlist:Bt,getCustomActiveIndicators:ne,showIndicatorEditor:dt,editingIndicator:ht,handleCreateIndicator:pe,handleRunIndicator:he,handleSaveIndicator:Ce,handleEditIndicator:fe,handleDeleteIndicator:ge,toggleCustomSection:ve,customSectionCollapsed:ct,purchasedSectionCollapsed:ut,handlePriceChange:It,handleChartRetry:Et,handleIndicatorToggle:te,showParamsModal:it,pendingIndicator:nt,indicatorParams:at,indicatorParamValues:ot,loadingParams:st,confirmIndicatorParams:le,cancelIndicatorParams:ce,handleParamsModalAfterClose:de,showBacktestModal:pt,backtestIndicator:ft,handleOpenBacktest:me,showBacktestHistoryDrawer:vt,backtestHistoryIndicator:gt,handleOpenBacktestHistory:ye,showBacktestRunViewer:mt,selectedBacktestRun:yt,handleViewBacktestRun:be,showPublishModal:bt,publishIndicator:xt,publishing:_t,unpublishing:wt,publishPricingType:Ct,publishPrice:St,publishDescription:kt,publishVipFree:At,publishRules:Tt,handlePublishIndicator:xe,handleConfirmPublish:_e,handleUnpublish:we,selectedSymbol:H,selectedMarket:K,selectedTimeframe:G,isMobile:q,showAddStockModal:w,addingStock:C,selectedMarketTab:S,symbolSearchKeyword:k,symbolSearchResults:A,searchingSymbols:T,hotSymbols:M,loadingHotSymbols:I,selectedSymbolForAdd:E,marketTypes:P,hasSearched:L,handleCloseAddStockModal:Ht,handleMarketTabChange:Kt,handleSymbolSearchInput:Yt,handleSearchOrInput:Xt,searchSymbolsInModal:Ut,selectSymbol:jt,loadHotSymbols:qt,handleAddStock:Zt,handleDirectAdd:Gt,loadMarketTypes:$t,showQuickTrade:R,qtSymbol:F,qtSide:B,qtPrice:N,isCryptoMarket:O,openQuickTrade:z,onQuickTradeSuccess:W,handleQuickTradeSymbolChange:V,goToIndicatorMarket:$}}},la=sa,ca=(0,T.A)(la,n,r,!1,null,"b17e86c2",null),ua=ca.exports},64118:function(t,e,i){"use strict";i.d(e,{Qo:function(){return a},_3:function(){return u},dp:function(){return o},iO:function(){return c},mk:function(){return s},ms:function(){return l},z6:function(){return d}});var n=i(76471),r={GetWatchlist:"/api/market/watchlist/get",AddWatchlist:"/api/market/watchlist/add",RemoveWatchlist:"/api/market/watchlist/remove",GetWatchlistPrices:"/api/market/watchlist/prices",MultiAnalysis:"/api/analysis/multiAnalysis",CreateAnalysisTask:"/api/analysis/createTask",GetAnalysisTaskStatus:"/api/analysis/getTaskStatus",GetAnalysisHistoryList:"/api/analysis/getHistoryList",DeleteAnalysisTask:"/api/analysis/deleteTask",ReflectAnalysis:"/api/analysis/reflect",ChatMessage:"/api/ai/chat/message",GetChatHistory:"/api/ai/chat/history",SaveChatHistory:"/api/ai/chat/history/save",GetConfig:"/api/market/config",GetMenuFooterConfig:"/api/market/menuFooterConfig",GetMarketTypes:"/api/market/types",SearchSymbols:"/api/market/symbols/search",GetHotSymbols:"/api/market/symbols/hot"};function a(t){return(0,n.Ay)({url:r.GetWatchlist,method:"get",params:t})}function o(t){return(0,n.Ay)({url:r.AddWatchlist,method:"post",data:t})}function s(t){return(0,n.Ay)({url:r.RemoveWatchlist,method:"post",data:t})}function l(t){return(0,n.Ay)({url:r.GetWatchlistPrices,method:"get",params:{watchlist:JSON.stringify(t.watchlist||[])}})}function c(){return(0,n.Ay)({url:r.GetMarketTypes,method:"get"})}function u(t){return(0,n.Ay)({url:r.SearchSymbols,method:"get",params:t})}function d(t){return(0,n.Ay)({url:r.GetHotSymbols,method:"get",params:t})}},55218:function(t,e,i){(function(t){t(i(15237))})(function(t){var e={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},i=t.Pos;function n(t,i){return"pairs"==i&&"string"==typeof t?t:"object"==typeof t&&null!=t[i]?t[i]:e[i]}t.defineOption("autoCloseBrackets",!1,function(e,i,o){o&&o!=t.Init&&(e.removeKeyMap(r),e.state.closeBrackets=null),i&&(a(n(i,"pairs")),e.state.closeBrackets=i,e.addKeyMap(r))});var r={Backspace:l,Enter:c};function a(t){for(var e=0;e=0;l--){var u=o[l].head;e.replaceRange("",i(u.line,u.ch-1),i(u.line,u.ch+1),"+delete")}}function c(e){var i=s(e),r=i&&n(i,"explode");if(!r||e.getOption("disableInput"))return t.Pass;for(var a=e.listSelections(),o=0;o0?{line:o.head.line,ch:o.head.ch+e}:{line:o.head.line-1};i.push({anchor:s,head:s})}t.setSelections(i,r)}function d(e){var n=t.cmpPos(e.anchor,e.head)>0;return{anchor:new i(e.anchor.line,e.anchor.ch+(n?-1:1)),head:new i(e.head.line,e.head.ch+(n?1:-1))}}function h(e,r){var a=s(e);if(!a||e.getOption("disableInput"))return t.Pass;var o=n(a,"pairs"),l=o.indexOf(r);if(-1==l)return t.Pass;for(var c,h=n(a,"closeBefore"),p=n(a,"triples"),v=o.charAt(l+1)==r,g=e.listSelections(),m=l%2==0,y=0;y1&&p.indexOf(r)>=0&&e.getRange(i(_.line,_.ch-2),_)==r+r){if(_.ch>2&&/\bstring/.test(e.getTokenTypeAt(i(_.line,_.ch-2))))return t.Pass;b="addFour"}else if(v){var C=0==_.ch?" ":e.getRange(i(_.line,_.ch-1),_);if(t.isWordChar(w)||C==r||t.isWordChar(C))return t.Pass;b="both"}else{if(!m||!(0===w.length||/\s/.test(w)||h.indexOf(w)>-1))return t.Pass;b="both"}else b=v&&f(e,_)?"both":p.indexOf(r)>=0&&e.getRange(_,i(_.line,_.ch+3))==r+r+r?"skipThree":"skip";if(c){if(c!=b)return t.Pass}else c=b}var S=l%2?o.charAt(l-1):r,k=l%2?r:o.charAt(l+1);e.operation(function(){if("skip"==c)u(e,1);else if("skipThree"==c)u(e,3);else if("surround"==c){for(var t=e.getSelections(),i=0;i",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function r(t){return t&&t.bracketRegex||/[(){}[\]]/}function a(t,e,a){var s=t.getLineHandle(e.line),l=e.ch-1,c=a&&a.afterCursor;null==c&&(c=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var u=r(a),d=!c&&l>=0&&u.test(s.text.charAt(l))&&n[s.text.charAt(l)]||u.test(s.text.charAt(l+1))&&n[s.text.charAt(++l)];if(!d)return null;var h=">"==d.charAt(1)?1:-1;if(a&&a.strict&&h>0!=(l==e.ch))return null;var p=t.getTokenTypeAt(i(e.line,l+1)),f=o(t,i(e.line,l+(h>0?1:0)),h,p,a);return null==f?null:{from:i(e.line,l),to:f&&f.pos,match:f&&f.ch==d.charAt(0),forward:h>0}}function o(t,e,a,o,s){for(var l=s&&s.maxScanLineLength||1e4,c=s&&s.maxScanLines||1e3,u=[],d=r(s),h=a>0?Math.min(e.line+c,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-c),p=e.line;p!=h;p+=a){var f=t.getLine(p);if(f){var v=a>0?0:f.length-1,g=a>0?f.length:-1;if(!(f.length>l))for(p==e.line&&(v=e.ch-(a<0?1:0));v!=g;v+=a){var m=f.charAt(v);if(d.test(m)&&(void 0===o||(t.getTokenTypeAt(i(p,v+1))||"")==(o||""))){var y=n[m];if(y&&">"==y.charAt(1)==a>0)u.push(m);else{if(!u.length)return{pos:i(p,v),ch:m};u.pop()}}}}}return p-a!=(a>0?t.lastLine():t.firstLine())&&null}function s(t,n,r){for(var o=t.state.matchBrackets.maxHighlightLineLength||1e3,s=r&&r.highlightNonMatching,l=[],c=t.listSelections(),u=0;u2),m=/Android/.test(t),y=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),b=g||/Mac/.test(e),x=/\bCrOS\b/.test(t),_=/win/i.test(e),w=h&&t.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(h=!1,l=!0);var C=b&&(c||h&&(null==w||w<12.11)),S=i||o&&s>=9;function k(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var A,T=function(t,e){var i=t.className,n=k(e).exec(i);if(n){var r=i.slice(n.index+n[0].length);t.className=i.slice(0,n.index)+(r?n[1]+r:"")}};function M(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function I(t,e){return M(t).appendChild(e)}function E(t,e,i,n){var r=document.createElement(t);if(i&&(r.className=i),n&&(r.style.cssText=n),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var a=0;a=e)return o+(e-a);o+=s-a,o+=i-o%i,a=s+1}}g?B=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:o&&(B=function(t){try{t.select()}catch(e){}});var K=function(){this.id=null,this.f=null,this.time=0,this.handler=V(this.onTimeout,this)};function Y(t,e){for(var i=0;i=e)return n+Math.min(o,e-r);if(r+=a-n,r+=i-r%i,n=a+1,r>=e)return n}}var J=[""];function Q(t){while(J.length<=t)J.push(tt(J)+" ");return J[t]}function tt(t){return t[t.length-1]}function et(t,e){for(var i=[],n=0;n"€"&&(t.toUpperCase()!=t.toLowerCase()||at.test(t))}function st(t,e){return e?!!(e.source.indexOf("\\w")>-1&&ot(t))||e.test(t):ot(t)}function lt(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var ct=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ut(t){return t.charCodeAt(0)>=768&&ct.test(t)}function dt(t,e,i){while((i<0?e>0:ei?-1:1;;){if(e==i)return e;var r=(e+i)/2,a=n<0?Math.ceil(r):Math.floor(r);if(a==e)return t(a)?e:i;t(a)?i=a:e=a+n}}function pt(t,e,i,n){if(!t)return n(e,i,"ltr",0);for(var r=!1,a=0;ae||e==i&&o.to==e)&&(n(Math.max(o.from,e),Math.min(o.to,i),1==o.level?"rtl":"ltr",a),r=!0)}r||n(e,i,"ltr")}var ft=null;function vt(t,e,i){var n;ft=null;for(var r=0;re)return r;a.to==e&&(a.from!=a.to&&"before"==i?n=r:ft=r),a.from==e&&(a.from!=a.to&&"before"!=i?n=r:ft=r)}return null!=n?n:ft}var gt=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",e="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(i){return i<=247?t.charAt(i):1424<=i&&i<=1524?"R":1536<=i&&i<=1785?e.charAt(i-1536):1774<=i&&i<=2220?"r":8192<=i&&i<=8203?"w":8204==i?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,a=/[LRr]/,o=/[Lb1n]/,s=/[1n]/;function l(t,e,i){this.level=t,this.from=e,this.to=i}return function(t,e){var c="ltr"==e?"L":"R";if(0==t.length||"ltr"==e&&!n.test(t))return!1;for(var u=t.length,d=[],h=0;h-1&&(n[e]=r.slice(0,a).concat(r.slice(a+1)))}}}function wt(t,e){var i=xt(t,e);if(i.length)for(var n=Array.prototype.slice.call(arguments,2),r=0;r0}function At(t){t.prototype.on=function(t,e){bt(this,t,e)},t.prototype.off=function(t,e){_t(this,t,e)}}function Tt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Mt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function It(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Et(t){Tt(t),Mt(t)}function Dt(t){return t.target||t.srcElement}function Pt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),b&&t.ctrlKey&&1==e&&(e=3),e}var Lt,Rt,Ft=function(){if(o&&s<9)return!1;var t=E("div");return"draggable"in t||"dragDrop"in t}();function Bt(t){if(null==Lt){var e=E("span","​");I(t,E("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Lt=e.offsetWidth<=1&&e.offsetHeight>2&&!(o&&s<8))}var i=Lt?E("span","​"):E("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Nt(t){if(null!=Rt)return Rt;var e=I(t,document.createTextNode("AخA")),i=A(e,0,1).getBoundingClientRect(),n=A(e,1,2).getBoundingClientRect();return M(t),!(!i||i.left==i.right)&&(Rt=n.right-i.right<3)}var Ot=3!="\n\nb".split(/\n/).length?function(t){var e=0,i=[],n=t.length;while(e<=n){var r=t.indexOf("\n",e);-1==r&&(r=t.length);var a=t.slice(e,"\r"==t.charAt(r-1)?r-1:r),o=a.indexOf("\r");-1!=o?(i.push(a.slice(0,o)),e+=o+1):(i.push(a),e=r+1)}return i}:function(t){return t.split(/\r\n?|\n/)},zt=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(i){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},Wt=function(){var t=E("div");return"oncopy"in t||(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),Vt=null;function $t(t){if(null!=Vt)return Vt;var e=I(t,E("span","x")),i=e.getBoundingClientRect(),n=A(e,0,1).getBoundingClientRect();return Vt=Math.abs(i.left-n.left)>1}var Ht={},Kt={};function Yt(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),Ht[t]=e}function Xt(t,e){Kt[t]=e}function Ut(t){if("string"==typeof t&&Kt.hasOwnProperty(t))t=Kt[t];else if(t&&"string"==typeof t.name&&Kt.hasOwnProperty(t.name)){var e=Kt[t.name];"string"==typeof e&&(e={name:e}),t=rt(e,t),t.name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Ut("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Ut("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Gt(t,e){e=Ut(e);var i=Ht[e.name];if(!i)return Gt(t,"text/plain");var n=i(t,e);if(jt.hasOwnProperty(e.name)){var r=jt[e.name];for(var a in r)r.hasOwnProperty(a)&&(n.hasOwnProperty(a)&&(n["_"+a]=n[a]),n[a]=r[a])}if(n.name=e.name,e.helperType&&(n.helperType=e.helperType),e.modeProps)for(var o in e.modeProps)n[o]=e.modeProps[o];return n}var jt={};function qt(t,e){var i=jt.hasOwnProperty(t)?jt[t]:jt[t]={};$(e,i)}function Zt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var i={};for(var n in e){var r=e[n];r instanceof Array&&(r=r.concat([])),i[n]=r}return i}function Jt(t,e){var i;while(t.innerMode){if(i=t.innerMode(e),!i||i.mode==t)break;e=i.state,t=i.mode}return i||{mode:t,state:e}}function Qt(t,e,i){return!t.startState||t.startState(e,i)}var te=function(t,e,i){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};function ee(t,e){if(e-=t.first,e<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");var i=t;while(!i.lines)for(var n=0;;++n){var r=i.children[n],a=r.chunkSize();if(e=t.first&&ei?ce(i,ee(t,i).text.length):me(e,ee(t,e.line).text.length)}function me(t,e){var i=t.ch;return null==i||i>e?ce(t.line,e):i<0?ce(t.line,0):t}function ye(t,e){for(var i=[],n=0;n=this.string.length},te.prototype.sol=function(){return this.pos==this.lineStart},te.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},te.prototype.next=function(){if(this.pose},te.prototype.eatSpace=function(){var t=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>t},te.prototype.skipToEnd=function(){this.pos=this.string.length},te.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},te.prototype.backUp=function(t){this.pos-=t},te.prototype.column=function(){return this.lastColumnPos0?null:(n&&!1!==e&&(this.pos+=n[0].length),n)}var r=function(t){return i?t.toLowerCase():t},a=this.string.substr(this.pos,t.length);if(r(a)==r(t))return!1!==e&&(this.pos+=t.length),!0},te.prototype.current=function(){return this.string.slice(this.start,this.pos)},te.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},te.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},te.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var be=function(t,e){this.state=t,this.lookAhead=e},xe=function(t,e,i,n){this.state=e,this.doc=t,this.line=i,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function _e(t,e,i,n){var r=[t.state.modeGen],a={};Ee(t,e.text,t.doc.mode,i,function(t,e){return r.push(t,e)},a,n);for(var o=i.state,s=function(n){i.baseTokens=r;var s=t.state.overlays[n],l=1,c=0;i.state=!0,Ee(t,e.text,s.mode,i,function(t,e){var i=l;while(ct&&r.splice(l,1,t,r[l+1],n),l+=2,c=Math.min(t,n)}if(e)if(s.opaque)r.splice(i,l-i,t,"overlay "+e),l=i+2;else for(;it.options.maxHighlightLength&&Zt(t.doc.mode,n.state),a=_e(t,e,n);r&&(n.state=r),e.stateAfter=n.save(!r),e.styles=a.styles,a.classes?e.styleClasses=a.classes:e.styleClasses&&(e.styleClasses=null),i===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function Ce(t,e,i){var n=t.doc,r=t.display;if(!n.mode.startState)return new xe(n,!0,e);var a=De(t,e,i),o=a>n.first&&ee(n,a-1).stateAfter,s=o?xe.fromSaved(n,o,a):new xe(n,Qt(n.mode),a);return n.iter(a,e,function(i){Se(t,i.text,s);var n=s.line;i.stateAfter=n==e-1||n%5==0||n>=r.viewFrom&&ne.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}xe.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},xe.prototype.baseToken=function(t){if(!this.baseTokens)return null;while(this.baseTokens[this.baseTokenPos]<=t)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},xe.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},xe.fromSaved=function(t,e,i){return e instanceof be?new xe(t,Zt(t.mode,e.state),i,e.lookAhead):new xe(t,Zt(t.mode,e),i)},xe.prototype.save=function(t){var e=!1!==t?Zt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new be(e,this.maxLookAhead):e};var Te=function(t,e,i){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=i};function Me(t,e,i,n){var r,a=t.doc,o=a.mode;e=ge(a,e);var s,l=ee(a,e.line),c=Ce(t,e.line,i),u=new te(l.text,t.options.tabSize,c);n&&(s=[]);while((n||u.post.options.maxHighlightLength?(s=!1,o&&Se(t,e,n,d.pos),d.pos=e.length,l=null):l=Ie(Ae(i,d,n.state,h),a),h){var p=h[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!s||u!=l){while(co;--s){if(s<=a.first)return a.first;var l=ee(a,s-1),c=l.stateAfter;if(c&&(!i||s+(c instanceof be?c.lookAhead:0)<=a.modeFrontier))return s;var u=H(l.text,null,t.options.tabSize);(null==r||n>u)&&(r=s-1,n=u)}return r}function Pe(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontieri;n--){var r=ee(t,n).stateAfter;if(r&&(!(r instanceof be)||n+r.lookAhead=e:a.to>e);(n||(n=[])).push(new Ne(o,a.from,l?null:a.to))}}return n}function $e(t,e,i){var n;if(t)for(var r=0;r=e:a.to>e);if(s||a.from==e&&"bookmark"==o.type&&(!i||a.marker.insertLeft)){var l=null==a.from||(o.inclusiveLeft?a.from<=e:a.from0&&s)for(var x=0;x0)){var u=[l,1],d=ue(c.from,s.from),h=ue(c.to,s.to);(d<0||!o.inclusiveLeft&&!d)&&u.push({from:c.from,to:s.from}),(h>0||!o.inclusiveRight&&!h)&&u.push({from:s.to,to:c.to}),r.splice.apply(r,u),l+=u.length-3}}return r}function Xe(t){var e=t.markedSpans;if(e){for(var i=0;ie)&&(!i||qe(i,a.marker)<0)&&(i=a.marker)}return i}function ei(t,e,i,n,r){var a=ee(t,e),o=Re&&a.markedSpans;if(o)for(var s=0;s=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ue(c.to,i)>=0:ue(c.to,i)>0)||u>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ue(c.from,n)<=0:ue(c.from,n)<0)))return!0}}}function ii(t){var e;while(e=Je(t))t=e.find(-1,!0).line;return t}function ni(t){var e;while(e=Qe(t))t=e.find(1,!0).line;return t}function ri(t){var e,i;while(e=Qe(t))t=e.find(1,!0).line,(i||(i=[])).push(t);return i}function ai(t,e){var i=ee(t,e),n=ii(i);return i==n?e:ae(n)}function oi(t,e){if(e>t.lastLine())return e;var i,n=ee(t,e);if(!si(t,n))return e;while(i=Qe(n))n=i.find(1,!0).line;return ae(n)+1}function si(t,e){var i=Re&&e.markedSpans;if(i)for(var n=void 0,r=0;re.maxLineLength&&(e.maxLineLength=i,e.maxLine=t)})}var hi=function(t,e,i){this.text=t,Ue(this,e),this.height=i?i(this):1};function pi(t,e,i,n){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),Xe(t),Ue(t,i);var r=n?n(t):1;r!=t.height&&re(t,r)}function fi(t){t.parent=null,Xe(t)}hi.prototype.lineNo=function(){return ae(this)},At(hi);var vi={},gi={};function mi(t,e){if(!t||/^\s*$/.test(t))return null;var i=e.addModeClass?gi:vi;return i[t]||(i[t]=t.replace(/\S+/g,"cm-$&"))}function yi(t,e){var i=D("span",null,null,l?"padding-right: .1px":null),n={pre:D("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var r=0;r<=(e.rest?e.rest.length:0);r++){var a=r?e.rest[r-1]:e.line,o=void 0;n.pos=0,n.addToken=xi,Nt(t.display.measure)&&(o=mt(a,t.doc.direction))&&(n.addToken=wi(n.addToken,o)),n.map=[];var s=e!=t.display.externalMeasured&&ae(a);Si(a,n,we(t,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=F(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=F(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Bt(t.display.measure))),0==r?(e.measure.map=n.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(n.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(l){var c=n.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return wt(t,"renderLine",t,e.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function bi(t){var e=E("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function xi(t,e,i,n,r,a,l){if(e){var c,u=t.splitSpaces?_i(e,t.trailingSpace):e,d=t.cm.state.specialChars,h=!1;if(d.test(e)){c=document.createDocumentFragment();var p=0;while(1){d.lastIndex=p;var f=d.exec(e),v=f?f.index-p:e.length-p;if(v){var g=document.createTextNode(u.slice(p,p+v));o&&s<9?c.appendChild(E("span",[g])):c.appendChild(g),t.map.push(t.pos,t.pos+v,g),t.col+=v,t.pos+=v}if(!f)break;p+=v+1;var m=void 0;if("\t"==f[0]){var y=t.cm.options.tabSize,b=y-t.col%y;m=c.appendChild(E("span",Q(b),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),t.col+=b}else"\r"==f[0]||"\n"==f[0]?(m=c.appendChild(E("span","\r"==f[0]?"␍":"␤","cm-invalidchar")),m.setAttribute("cm-text",f[0]),t.col+=1):(m=t.cm.options.specialCharPlaceholder(f[0]),m.setAttribute("cm-text",f[0]),o&&s<9?c.appendChild(E("span",[m])):c.appendChild(m),t.col+=1);t.map.push(t.pos,t.pos+1,m),t.pos++}}else t.col+=e.length,c=document.createTextNode(u),t.map.push(t.pos,t.pos+e.length,c),o&&s<9&&(h=!0),t.pos+=e.length;if(t.trailingSpace=32==u.charCodeAt(e.length-1),i||n||r||h||a||l){var x=i||"";n&&(x+=n),r&&(x+=r);var _=E("span",[c],x,a);if(l)for(var w in l)l.hasOwnProperty(w)&&"style"!=w&&"class"!=w&&_.setAttribute(w,l[w]);return t.content.appendChild(_)}t.content.appendChild(c)}}function _i(t,e){if(t.length>1&&!/ /.test(t))return t;for(var i=e,n="",r=0;rc&&d.from<=c)break;if(d.to>=u)return t(i,n,r,a,o,s,l);t(i,n.slice(0,d.to-c),r,a,null,s,l),a=null,n=n.slice(d.to-c),c=d.to}}}function Ci(t,e,i,n){var r=!n&&i.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!n&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",i.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function Si(t,e,i){var n=t.markedSpans,r=t.text,a=0;if(n)for(var o,s,l,c,u,d,h,p=r.length,f=0,v=1,g="",m=0;;){if(m==f){l=c=u=s="",h=null,d=null,m=1/0;for(var y=[],b=void 0,x=0;xf||w.collapsed&&_.to==f&&_.from==f)){if(null!=_.to&&_.to!=f&&m>_.to&&(m=_.to,c=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&_.from==f&&(u+=" "+w.startStyle),w.endStyle&&_.to==m&&(b||(b=[])).push(w.endStyle,_.to),w.title&&((h||(h={})).title=w.title),w.attributes)for(var C in w.attributes)(h||(h={}))[C]=w.attributes[C];w.collapsed&&(!d||qe(d.marker,w)<0)&&(d=_)}else _.from>f&&m>_.from&&(m=_.from)}if(b)for(var S=0;S=p)break;var A=Math.min(p,m);while(1){if(g){var T=f+g.length;if(!d){var M=T>A?g.slice(0,A-f):g;e.addToken(e,M,o?o+l:l,u,f+M.length==m?c:"",s,h)}if(T>=A){g=g.slice(A-f),f=A;break}f=T,u=""}g=r.slice(a,a=i[v++]),o=mi(i[v++],e.cm.options)}}else for(var I=1;I2&&a.push((l.bottom+c.top)/2-i.top)}}a.push(i.bottom-i.top)}}function en(t,e,i){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};if(t.rest){for(var n=0;ni)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}}function nn(t,e){e=ii(e);var i=ae(e),n=t.display.externalMeasured=new ki(t.doc,e,i);n.lineN=i;var r=n.built=yi(t,n);return n.text=r.pre,I(t.display.lineMeasure,r.pre),n}function rn(t,e,i,n){return sn(t,on(t,e),i,n)}function an(t,e){if(e>=t.display.viewFrom&&e=i.lineN&&ee)&&(a=l-s,r=a-1,e>=l&&(o="right")),null!=r){if(n=t[c+2],s==l&&i==(n.insertLeft?"left":"right")&&(o=i),"left"==i&&0==r)while(c&&t[c-2]==t[c-3]&&t[c-1].insertLeft)n=t[2+(c-=3)],o="left";if("right"==i&&r==l-s)while(c=0;r--)if((i=t[r]).left!=i.right)break;return i}function hn(t,e,i,n){var r,a=un(e.map,i,n),l=a.node,c=a.start,u=a.end,d=a.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){while(c&&ut(e.line.text.charAt(a.coverStart+c)))--c;while(a.coverStart+u0&&(d=n="right"),r=t.options.lineWrapping&&(p=l.getClientRects()).length>1?p["right"==n?p.length-1:0]:l.getBoundingClientRect()}if(o&&s<9&&!c&&(!r||!r.left&&!r.right)){var f=l.parentNode.getClientRects()[0];r=f?{left:f.left,right:f.left+Rn(t.display),top:f.top,bottom:f.bottom}:cn}for(var v=r.top-e.rect.top,g=r.bottom-e.rect.top,m=(v+g)/2,y=e.view.measure.heights,b=0;b=n.text.length?(l=n.text.length,c="before"):l<=0&&(l=0,c="after"),!s)return o("before"==c?l-1:l,"before"==c);function u(t,e,i){var n=s[e],r=1==n.level;return o(i?t-1:t,r!=i)}var d=vt(s,l,c),h=ft,p=u(l,d,"before"==c);return null!=h&&(p.other=u(l,h,"before"!=c)),p}function Sn(t,e){var i=0;e=ge(t.doc,e),t.options.lineWrapping||(i=Rn(t.display)*e.ch);var n=ee(t.doc,e.line),r=ci(n)+Gi(t.display);return{left:i,right:i,top:r,bottom:r+n.height}}function kn(t,e,i,n,r){var a=ce(t,e,i);return a.xRel=r,n&&(a.outside=n),a}function An(t,e,i){var n=t.doc;if(i+=t.display.viewOffset,i<0)return kn(n.first,0,null,-1,-1);var r=oe(n,i),a=n.first+n.size-1;if(r>a)return kn(n.first+n.size-1,ee(n,a).text.length,null,1,1);e<0&&(e=0);for(var o=ee(n,r);;){var s=En(t,o,r,e,i),l=ti(o,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var c=l.find(1);if(c.line==r)return c;o=ee(n,r=c.line)}}function Tn(t,e,i,n){n-=bn(e);var r=e.text.length,a=ht(function(e){return sn(t,i,e-1).bottom<=n},r,0);return r=ht(function(e){return sn(t,i,e).top>n},a,r),{begin:a,end:r}}function Mn(t,e,i,n){i||(i=on(t,e));var r=xn(t,e,sn(t,i,n),"line").top;return Tn(t,e,i,r)}function In(t,e,i,n){return!(t.bottom<=i)&&(t.top>i||(n?t.left:t.right)>e)}function En(t,e,i,n,r){r-=ci(e);var a=on(t,e),o=bn(e),s=0,l=e.text.length,c=!0,u=mt(e,t.doc.direction);if(u){var d=(t.options.lineWrapping?Pn:Dn)(t,e,i,a,u,n,r);c=1!=d.level,s=c?d.from:d.to-1,l=c?d.to:d.from-1}var h,p,f=null,v=null,g=ht(function(e){var i=sn(t,a,e);return i.top+=o,i.bottom+=o,!!In(i,n,r,!1)&&(i.top<=r&&i.left<=n&&(f=e,v=i),!0)},s,l),m=!1;if(v){var y=n-v.left=x.bottom?1:0}return g=dt(e.text,g,1),kn(i,g,p,m,n-h)}function Dn(t,e,i,n,r,a,o){var s=ht(function(s){var l=r[s],c=1!=l.level;return In(Cn(t,ce(i,c?l.to:l.from,c?"before":"after"),"line",e,n),a,o,!0)},0,r.length-1),l=r[s];if(s>0){var c=1!=l.level,u=Cn(t,ce(i,c?l.from:l.to,c?"after":"before"),"line",e,n);In(u,a,o,!0)&&u.top>o&&(l=r[s-1])}return l}function Pn(t,e,i,n,r,a,o){var s=Tn(t,e,n,o),l=s.begin,c=s.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,d=null,h=0;h=c||p.to<=l)){var f=1!=p.level,v=sn(t,n,f?Math.min(c,p.to)-1:Math.max(l,p.from)).right,g=vg)&&(u=p,d=g)}}return u||(u=r[r.length-1]),u.fromc&&(u={from:u.from,to:c,level:u.level}),u}function Ln(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ln){ln=E("pre",null,"CodeMirror-line-like");for(var e=0;e<49;++e)ln.appendChild(document.createTextNode("x")),ln.appendChild(E("br"));ln.appendChild(document.createTextNode("x"))}I(t.measure,ln);var i=ln.offsetHeight/50;return i>3&&(t.cachedTextHeight=i),M(t.measure),i||1}function Rn(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=E("span","xxxxxxxxxx"),i=E("pre",[e],"CodeMirror-line-like");I(t.measure,i);var n=e.getBoundingClientRect(),r=(n.right-n.left)/10;return r>2&&(t.cachedCharWidth=r),r||10}function Fn(t){for(var e=t.display,i={},n={},r=e.gutters.clientLeft,a=e.gutters.firstChild,o=0;a;a=a.nextSibling,++o){var s=t.display.gutterSpecs[o].className;i[s]=a.offsetLeft+a.clientLeft+r,n[s]=a.clientWidth}return{fixedPos:Bn(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:e.wrapper.clientWidth}}function Bn(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function Nn(t){var e=Ln(t.display),i=t.options.lineWrapping,n=i&&Math.max(5,t.display.scroller.clientWidth/Rn(t.display)-3);return function(r){if(si(t.doc,r))return 0;var a=0;if(r.widgets)for(var o=0;o0&&(l=ee(t.doc,c.line).text).length==c.ch){var u=H(l,l.length,t.options.tabSize)-l.length;c=ce(c.line,Math.max(0,Math.round((a-qi(t.display).left)/Rn(t.display))-u))}return c}function Wn(t,e){if(e>=t.display.viewTo)return null;if(e-=t.display.viewFrom,e<0)return null;for(var i=t.display.view,n=0;ne)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)Re&&ai(t.doc,e)r.viewFrom?Hn(t):(r.viewFrom+=n,r.viewTo+=n);else if(e<=r.viewFrom&&i>=r.viewTo)Hn(t);else if(e<=r.viewFrom){var a=Kn(t,i,i+n,1);a?(r.view=r.view.slice(a.index),r.viewFrom=a.lineN,r.viewTo+=n):Hn(t)}else if(i>=r.viewTo){var o=Kn(t,e,e,-1);o?(r.view=r.view.slice(0,o.index),r.viewTo=o.lineN):Hn(t)}else{var s=Kn(t,e,e,-1),l=Kn(t,i,i+n,1);s&&l?(r.view=r.view.slice(0,s.index).concat(Ai(t,s.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=n):Hn(t)}var c=r.externalMeasured;c&&(i=r.lineN&&e=n.viewTo)){var a=n.view[Wn(t,e)];if(null!=a.node){var o=a.changes||(a.changes=[]);-1==Y(o,i)&&o.push(i)}}}function Hn(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function Kn(t,e,i,n){var r,a=Wn(t,e),o=t.display.view;if(!Re||i==t.doc.first+t.doc.size)return{index:a,lineN:i};for(var s=t.display.viewFrom,l=0;l0){if(a==o.length-1)return null;r=s+o[a].size-e,a++}else r=s-e;e+=r,i+=r}while(ai(t.doc,i)!=i){if(a==(n<0?0:o.length-1))return null;i+=n*o[a-(n<0?1:0)].size,a+=n}return{index:a,lineN:i}}function Yn(t,e,i){var n=t.display,r=n.view;0==r.length||e>=n.viewTo||i<=n.viewFrom?(n.view=Ai(t,e,i),n.viewFrom=e):(n.viewFrom>e?n.view=Ai(t,e,n.viewFrom).concat(n.view):n.viewFromi&&(n.view=n.view.slice(0,Wn(t,i)))),n.viewTo=i}function Xn(t){for(var e=t.display.view,i=0,n=0;n=t.display.viewTo||l.to().line0?o:t.defaultCharWidth())+"px"}if(n.other){var s=i.appendChild(E("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=n.other.left+"px",s.style.top=n.other.top+"px",s.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function qn(t,e){return t.top-e.top||t.left-e.left}function Zn(t,e,i){var n=t.display,r=t.doc,a=document.createDocumentFragment(),o=qi(t.display),s=o.left,l=Math.max(n.sizerWidth,Ji(t)-n.sizer.offsetLeft)-o.right,c="ltr"==r.direction;function u(t,e,i,n){e<0&&(e=0),e=Math.round(e),n=Math.round(n),a.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+e+"px; width: "+(null==i?l-t:i)+"px;\n height: "+(n-e)+"px"))}function d(e,i,n){var a,o,d=ee(r,e),h=d.text.length;function p(i,n){return wn(t,ce(e,i),"div",d,n)}function f(e,i,n){var r=Mn(t,d,null,e),a="ltr"==i==("after"==n)?"left":"right",o="after"==n?r.begin:r.end-(/\s/.test(d.text.charAt(r.end-1))?2:1);return p(o,a)[a]}var v=mt(d,r.direction);return pt(v,i||0,null==n?h:n,function(t,e,r,d){var g="ltr"==r,m=p(t,g?"left":"right"),y=p(e-1,g?"right":"left"),b=null==i&&0==t,x=null==n&&e==h,_=0==d,w=!v||d==v.length-1;if(y.top-m.top<=3){var C=(c?b:x)&&_,S=(c?x:b)&&w,k=C?s:(g?m:y).left,A=S?l:(g?y:m).right;u(k,m.top,A-k,m.bottom)}else{var T,M,I,E;g?(T=c&&b&&_?s:m.left,M=c?l:f(t,r,"before"),I=c?s:f(e,r,"after"),E=c&&x&&w?l:y.right):(T=c?f(t,r,"before"):s,M=!c&&b&&_?l:m.right,I=!c&&x&&w?s:y.left,E=c?f(e,r,"after"):l),u(T,m.top,M-T,m.bottom),m.bottom0?e.blinker=setInterval(function(){t.hasFocus()||ir(t),e.cursorDiv.style.visibility=(i=!i)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Qn(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||er(t))}function tr(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&ir(t))},100)}function er(t,e){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(wt(t,"focus",t,e),t.state.focused=!0,R(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),l&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Jn(t))}function ir(t,e){t.state.delayingBlurEvent||(t.state.focused&&(wt(t,"blur",t,e),t.state.focused=!1,T(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function nr(t){for(var e=t.display,i=e.lineDiv.offsetTop,n=Math.max(0,e.scroller.getBoundingClientRect().top),r=e.lineDiv.getBoundingClientRect().top,a=0,l=0;l.005||v<-.005)&&(rt.display.sizerWidth){var m=Math.ceil(h/Rn(t.display));m>t.display.maxLineLength&&(t.display.maxLineLength=m,t.display.maxLine=c.line,t.display.maxLineChanged=!0)}}}Math.abs(a)>2&&(e.scroller.scrollTop+=a)}function rr(t){if(t.widgets)for(var e=0;e=o&&(a=oe(e,ci(ee(e,l))-t.wrapper.clientHeight),o=l)}return{from:a,to:Math.max(o,a+1)}}function or(t,e){if(!Ct(t,"scrollCursorIntoView")){var i=t.display,n=i.sizer.getBoundingClientRect(),r=null,a=i.wrapper.ownerDocument;if(e.top+n.top<0?r=!0:e.bottom+n.top>(a.defaultView.innerHeight||a.documentElement.clientHeight)&&(r=!1),null!=r&&!v){var o=E("div","​",null,"position: absolute;\n top: "+(e.top-i.viewOffset-Gi(t.display))+"px;\n height: "+(e.bottom-e.top+Zi(t)+i.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(r),t.display.lineSpace.removeChild(o)}}}function sr(t,e,i,n){var r;null==n&&(n=0),t.options.lineWrapping||e!=i||(i="before"==e.sticky?ce(e.line,e.ch+1,"before"):e,e=e.ch?ce(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e);for(var a=0;a<5;a++){var o=!1,s=Cn(t,e),l=i&&i!=e?Cn(t,i):s;r={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-n,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+n};var c=cr(t,r),u=t.doc.scrollTop,d=t.doc.scrollLeft;if(null!=c.scrollTop&&(gr(t,c.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(o=!0)),null!=c.scrollLeft&&(yr(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-d)>1&&(o=!0)),!o)break}return r}function lr(t,e){var i=cr(t,e);null!=i.scrollTop&&gr(t,i.scrollTop),null!=i.scrollLeft&&yr(t,i.scrollLeft)}function cr(t,e){var i=t.display,n=Ln(t.display);e.top<0&&(e.top=0);var r=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:i.scroller.scrollTop,a=Qi(t),o={};e.bottom-e.top>a&&(e.bottom=e.top+a);var s=t.doc.height+ji(i),l=e.tops-n;if(e.topr+a){var u=Math.min(e.top,(c?s:e.bottom)-a);u!=r&&(o.scrollTop=u)}var d=t.options.fixedGutter?0:i.gutters.offsetWidth,h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:i.scroller.scrollLeft-d,p=Ji(t)-i.gutters.offsetWidth,f=e.right-e.left>p;return f&&(e.right=e.left+p),e.left<10?o.scrollLeft=0:e.leftp+h-3&&(o.scrollLeft=e.right+(f?0:10)-p),o}function ur(t,e){null!=e&&(fr(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function dr(t){fr(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function hr(t,e,i){null==e&&null==i||fr(t),null!=e&&(t.curOp.scrollLeft=e),null!=i&&(t.curOp.scrollTop=i)}function pr(t,e){fr(t),t.curOp.scrollToPos=e}function fr(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var i=Sn(t,e.from),n=Sn(t,e.to);vr(t,i,n,e.margin)}}function vr(t,e,i,n){var r=cr(t,{left:Math.min(e.left,i.left),top:Math.min(e.top,i.top)-n,right:Math.max(e.right,i.right),bottom:Math.max(e.bottom,i.bottom)+n});hr(t,r.scrollLeft,r.scrollTop)}function gr(t,e){Math.abs(t.doc.scrollTop-e)<2||(i||Ur(t,{top:e}),mr(t,e,!0),i&&Ur(t),zr(t,100))}function mr(t,e,i){e=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e)),(t.display.scroller.scrollTop!=e||i)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function yr(t,e,i,n){e=Math.max(0,Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(i?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!n||(t.doc.scrollLeft=e,Zr(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function br(t){var e=t.display,i=e.gutters.offsetWidth,n=Math.round(t.doc.height+ji(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?i:0,docHeight:n,scrollHeight:n+Zi(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:i}}var xr=function(t,e,i){this.cm=i;var n=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=r.tabIndex=-1,t(n),t(r),bt(n,"scroll",function(){n.clientHeight&&e(n.scrollTop,"vertical")}),bt(r,"scroll",function(){r.clientWidth&&e(r.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,o&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xr.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,i=t.scrollHeight>t.clientHeight+1,n=t.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=e?n+"px":"0";var r=t.viewHeight-(e?n:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+r)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=t.barLeft+"px";var a=t.viewWidth-t.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+a)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?n:0,bottom:e?n:0}},xr.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xr.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xr.prototype.zeroWidthHack=function(){var t=b&&!f?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new K,this.disableVert=new K},xr.prototype.enableZeroWidthBar=function(t,e,i){function n(){var r=t.getBoundingClientRect(),a="vert"==i?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);a!=t?t.style.visibility="hidden":e.set(1e3,n)}t.style.visibility="",e.set(1e3,n)},xr.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var _r=function(){};function wr(t,e){e||(e=br(t));var i=t.display.barWidth,n=t.display.barHeight;Cr(t,e);for(var r=0;r<4&&i!=t.display.barWidth||n!=t.display.barHeight;r++)i!=t.display.barWidth&&t.options.lineWrapping&&nr(t),Cr(t,br(t)),i=t.display.barWidth,n=t.display.barHeight}function Cr(t,e){var i=t.display,n=i.scrollbars.update(e);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px",i.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=n.bottom+"px",i.scrollbarFiller.style.width=n.right+"px"):i.scrollbarFiller.style.display="",n.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=n.bottom+"px",i.gutterFiller.style.width=e.gutterWidth+"px"):i.gutterFiller.style.display=""}_r.prototype.update=function(){return{bottom:0,right:0}},_r.prototype.setScrollLeft=function(){},_r.prototype.setScrollTop=function(){},_r.prototype.clear=function(){};var Sr={native:xr,null:_r};function kr(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&T(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Sr[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),bt(e,"mousedown",function(){t.state.focused&&setTimeout(function(){return t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,i){"horizontal"==i?yr(t,e):gr(t,e)},t),t.display.scrollbars.addClass&&R(t.display.wrapper,t.display.scrollbars.addClass)}var Ar=0;function Tr(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ar,markArrays:null},Mi(t.curOp)}function Mr(t){var e=t.curOp;e&&Ei(e,function(t){for(var e=0;e=i.viewTo)||i.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new Vr(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function Dr(t){t.updatedDisplay=t.mustUpdate&&Yr(t.cm,t.update)}function Pr(t){var e=t.cm,i=e.display;t.updatedDisplay&&nr(e),t.barMeasure=br(e),i.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=rn(e,i.maxLine,i.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+t.adjustWidthTo+Zi(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+t.adjustWidthTo-Ji(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=i.input.prepareSelection())}function Lr(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft=t.display.viewTo)){var i=+new Date+t.options.workTime,n=Ce(t,e.highlightFrontier),r=[];e.iter(n.line,Math.min(e.first+e.size,t.display.viewTo+500),function(a){if(n.line>=t.display.viewFrom){var o=a.styles,s=a.text.length>t.options.maxHighlightLength?Zt(e.mode,n.state):null,l=_e(t,a,n,!0);s&&(n.state=s),a.styles=l.styles;var c=a.styleClasses,u=l.classes;u?a.styleClasses=u:c&&(a.styleClasses=null);for(var d=!o||o.length!=a.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!d&&hi)return zr(t,t.options.workDelay),!0}),e.highlightFrontier=n.line,e.modeFrontier=Math.max(e.modeFrontier,n.line),r.length&&Fr(t,function(){for(var e=0;e=i.viewFrom&&e.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==Xn(t))return!1;Jr(t)&&(Hn(t),e.dims=Fn(t));var r=n.first+n.size,a=Math.max(e.visible.from-t.options.viewportMargin,n.first),o=Math.min(r,e.visible.to+t.options.viewportMargin);i.viewFromo&&i.viewTo-o<20&&(o=Math.min(r,i.viewTo)),Re&&(a=ai(t.doc,a),o=oi(t.doc,o));var s=a!=i.viewFrom||o!=i.viewTo||i.lastWrapHeight!=e.wrapperHeight||i.lastWrapWidth!=e.wrapperWidth;Yn(t,a,o),i.viewOffset=ci(ee(t.doc,i.viewFrom)),t.display.mover.style.top=i.viewOffset+"px";var l=Xn(t);if(!s&&0==l&&!e.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var c=Hr(t);return l>4&&(i.lineDiv.style.display="none"),Gr(t,i.updateLineNumbers,e.dims),l>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Kr(c),M(i.cursorDiv),M(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,s&&(i.lastWrapHeight=e.wrapperHeight,i.lastWrapWidth=e.wrapperWidth,zr(t,400)),i.updateLineNumbers=null,!0}function Xr(t,e){for(var i=e.viewport,n=!0;;n=!1){if(n&&t.options.lineWrapping&&e.oldDisplayWidth!=Ji(t))n&&(e.visible=ar(t.display,t.doc,i));else if(i&&null!=i.top&&(i={top:Math.min(t.doc.height+ji(t.display)-Qi(t),i.top)}),e.visible=ar(t.display,t.doc,i),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!Yr(t,e))break;nr(t);var r=br(t);Un(t),wr(t,r),qr(t,r),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Ur(t,e){var i=new Vr(t,e);if(Yr(t,i)){nr(t),Xr(t,i);var n=br(t);Un(t),wr(t,n),qr(t,n),i.finish()}}function Gr(t,e,i){var n=t.display,r=t.options.lineNumbers,a=n.lineDiv,o=a.firstChild;function s(e){var i=e.nextSibling;return l&&b&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),i}for(var c=n.view,u=n.viewFrom,d=0;d-1&&(p=!1),Ri(t,h,u,i)),p&&(M(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(le(t.options,u)))),o=h.node.nextSibling}else{var f=$i(t,h,u,i);a.insertBefore(f,o)}u+=h.size}while(o)o=s(o)}function jr(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px",Pi(t,"gutterChanged",t)}function qr(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+Zi(t)+"px"}function Zr(t){var e=t.display,i=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var n=Bn(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,a=n+"px",o=0;oc.clientWidth,f=c.scrollHeight>c.clientHeight;if(r&&p||a&&f){if(a&&b&&l)t:for(var v=e.target,g=s.view;v!=c;v=v.parentNode)for(var m=0;m=0&&ue(t,n.to())<=0)return i}return-1};var ca=function(t,e){this.anchor=t,this.head=e};function ua(t,e,i){var n=t&&t.options.selectionsMayTouch,r=e[i];e.sort(function(t,e){return ue(t.from(),e.from())}),i=Y(e,r);for(var a=1;a0:l>=0){var c=fe(s.from(),o.from()),u=pe(s.to(),o.to()),d=s.empty()?o.from()==o.head:s.from()==s.head;a<=i&&--i,e.splice(--a,2,new ca(d?u:c,d?c:u))}}return new la(e,i)}function da(t,e){return new la([new ca(t,e||t)],0)}function ha(t){return t.text?ce(t.from.line+t.text.length-1,tt(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function pa(t,e){if(ue(t,e.from)<0)return t;if(ue(t,e.to)<=0)return ha(e);var i=t.line+e.text.length-(e.to.line-e.from.line)-1,n=t.ch;return t.line==e.to.line&&(n+=ha(e).ch-e.to.ch),ce(i,n)}function fa(t,e){for(var i=[],n=0;n1&&t.remove(s.line+1,f-1),t.insert(s.line+1,m)}Pi(t,"change",t,e)}function _a(t,e,i){function n(t,r,a){if(t.linked)for(var o=0;o1&&!t.done[t.done.length-2].ranges?(t.done.pop(),tt(t.done)):void 0}function Ia(t,e,i,n){var r=t.history;r.undone.length=0;var a,o,s=+new Date;if((r.lastOp==n||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&r.lastModTime>s-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(a=Ma(r,r.lastOp==n)))o=tt(a.changes),0==ue(e.from,e.to)&&0==ue(e.from,o.to)?o.to=ha(e):a.changes.push(Aa(t,e));else{var l=tt(r.done);l&&l.ranges||Pa(t.sel,r.done),a={changes:[Aa(t,e)],generation:r.generation},r.done.push(a);while(r.done.length>r.undoDepth)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(i),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=s,r.lastOp=r.lastSelOp=n,r.lastOrigin=r.lastSelOrigin=e.origin,o||wt(t,"historyAdded")}function Ea(t,e,i,n){var r=e.charAt(0);return"*"==r||"+"==r&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Da(t,e,i,n){var r=t.history,a=n&&n.origin;i==r.lastSelOp||a&&r.lastSelOrigin==a&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==a||Ea(t,a,tt(r.done),e))?r.done[r.done.length-1]=e:Pa(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=a,r.lastSelOp=i,n&&!1!==n.clearRedo&&Ta(r.undone)}function Pa(t,e){var i=tt(e);i&&i.ranges&&i.equals(t)||e.push(t)}function La(t,e,i,n){var r=e["spans_"+t.id],a=0;t.iter(Math.max(t.first,i),Math.min(t.first+t.size,n),function(i){i.markedSpans&&((r||(r=e["spans_"+t.id]={}))[a]=i.markedSpans),++a})}function Ra(t){if(!t)return null;for(var e,i=0;i-1&&(tt(s)[d]=c[d],delete c[d])}}}return n}function Oa(t,e,i,n){if(n){var r=t.anchor;if(i){var a=ue(e,r)<0;a!=ue(i,r)<0?(r=e,e=i):a!=ue(e,i)<0&&(e=i)}return new ca(r,e)}return new ca(i||e,e)}function za(t,e,i,n,r){null==r&&(r=t.cm&&(t.cm.display.shift||t.extend)),Ya(t,new la([Oa(t.sel.primary(),e,i,r)],0),n)}function Wa(t,e,i){for(var n=[],r=t.cm&&(t.cm.display.shift||t.extend),a=0;a=e.ch:s.to>e.ch))){if(r&&(wt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(a.markedSpans){--o;continue}break}if(!l.atomic)continue;if(i){var d=l.find(n<0?1:-1),h=void 0;if((n<0?u:c)&&(d=Ja(t,d,-n,d&&d.line==e.line?a:null)),d&&d.line==e.line&&(h=ue(d,i))&&(n<0?h<0:h>0))return qa(t,d,e,n,r)}var p=l.find(n<0?-1:1);return(n<0?c:u)&&(p=Ja(t,p,n,p.line==e.line?a:null)),p?qa(t,p,e,n,r):null}}return e}function Za(t,e,i,n,r){var a=n||1,o=qa(t,e,i,a,r)||!r&&qa(t,e,i,a,!0)||qa(t,e,i,-a,r)||!r&&qa(t,e,i,-a,!0);return o||(t.cantEdit=!0,ce(t.first,0))}function Ja(t,e,i,n){return i<0&&0==e.ch?e.line>t.first?ge(t,ce(e.line-1)):null:i>0&&e.ch==(n||ee(t,e.line)).text.length?e.line=0;--r)io(t,{from:n[r].from,to:n[r].to,text:r?[""]:e.text,origin:e.origin});else io(t,e)}}function io(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ue(e.from,e.to)){var i=fa(t,e);Ia(t,e,i,t.cm?t.cm.curOp.id:NaN),ao(t,e,i,He(t,e));var n=[];_a(t,function(t,i){i||-1!=Y(n,t.history)||(uo(t.history,e),n.push(t.history)),ao(t,e,null,He(t,e))})}}function no(t,e,i){var n=t.cm&&t.cm.state.suppressEdits;if(!n||i){for(var r,a=t.history,o=t.sel,s="undo"==e?a.done:a.undone,l="undo"==e?a.undone:a.done,c=0;c=0;--p){var f=h(p);if(f)return f.v}}}}function ro(t,e){if(0!=e&&(t.first+=e,t.sel=new la(et(t.sel.ranges,function(t){return new ca(ce(t.anchor.line+e,t.anchor.ch),ce(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){Vn(t.cm,t.first,t.first-e,e);for(var i=t.cm.display,n=i.viewFrom;nt.lastLine())){if(e.from.linea&&(e={from:e.from,to:ce(a,ee(t,a).text.length),text:[e.text[0]],origin:e.origin}),e.removed=ie(t,e.from,e.to),i||(i=fa(t,e)),t.cm?oo(t.cm,e,n):xa(t,e,n),Xa(t,i,G),t.cantEdit&&Za(t,ce(t.firstLine(),0))&&(t.cantEdit=!1)}}function oo(t,e,i){var n=t.doc,r=t.display,a=e.from,o=e.to,s=!1,l=a.line;t.options.lineWrapping||(l=ae(ii(ee(n,a.line))),n.iter(l,o.line+1,function(t){if(t==r.maxLine)return s=!0,!0})),n.sel.contains(e.from,e.to)>-1&&St(t),xa(n,e,i,Nn(t)),t.options.lineWrapping||(n.iter(l,a.line+e.text.length,function(t){var e=ui(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,s=!1)}),s&&(t.curOp.updateMaxLine=!0)),Pe(n,a.line),zr(t,400);var c=e.text.length-(o.line-a.line)-1;e.full?Vn(t):a.line!=o.line||1!=e.text.length||ba(t.doc,e)?Vn(t,a.line,o.line+1,c):$n(t,a.line,"text");var u=kt(t,"changes"),d=kt(t,"change");if(d||u){var h={from:a,to:o,text:e.text,removed:e.removed,origin:e.origin};d&&Pi(t,"change",t,h),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(h)}t.display.selForContextMenu=null}function so(t,e,i,n,r){var a;n||(n=i),ue(n,i)<0&&(a=[n,i],i=a[0],n=a[1]),"string"==typeof e&&(e=t.splitLines(e)),eo(t,{from:i,to:n,text:e,origin:r})}function lo(t,e,i,n){i1||!(this.children[0]instanceof po))){var s=[];this.collapse(s),this.children=[new po(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e50){for(var o=r.lines.length%25+25,s=o;s10);t.parent.maybeSpill()}},iterN:function(t,e,i){for(var n=0;n0||0==o&&!1!==a.clearWhenEmpty)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=D("span",[a.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(ei(t,e.line,e,i,a)||e.line!=i.line&&ei(t,i.line,e,i,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");Be()}a.addToHistory&&Ia(t,{from:e,to:i,origin:"markText"},t.sel,NaN);var s,l=e.line,c=t.cm;if(t.iter(l,i.line+1,function(n){c&&a.collapsed&&!c.options.lineWrapping&&ii(n)==c.display.maxLine&&(s=!0),a.collapsed&&l!=e.line&&re(n,0),We(n,new Ne(a,l==e.line?e.ch:null,l==i.line?i.ch:null),t.cm&&t.cm.curOp),++l}),a.collapsed&&t.iter(e.line,i.line+1,function(e){si(t,e)&&re(e,0)}),a.clearOnEnter&&bt(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(Fe(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),a.collapsed&&(a.id=++yo,a.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),a.collapsed)Vn(c,e.line,i.line+1);else if(a.className||a.startStyle||a.endStyle||a.css||a.attributes||a.title)for(var u=e.line;u<=i.line;u++)$n(c,u,"text");a.atomic&&Ga(c.doc),Pi(c,"markerAdded",c,a)}return a}bo.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&Tr(t),kt(this,"clear")){var i=this.find();i&&Pi(this,"clear",i.from,i.to)}for(var n=null,r=null,a=0;at.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=n&&t&&this.collapsed&&Vn(t,n,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Ga(t.doc)),t&&Pi(t,"markerCleared",t,this,n,r),e&&Mr(t),this.parent&&this.parent.clear()}},bo.prototype.find=function(t,e){var i,n;null==t&&"bookmark"==this.type&&(t=1);for(var r=0;r=0;l--)eo(this,n[l]);s?Ka(this,s):this.cm&&dr(this.cm)}),undo:Or(function(){no(this,"undo")}),redo:Or(function(){no(this,"redo")}),undoSelection:Or(function(){no(this,"undo",!0)}),redoSelection:Or(function(){no(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,i=0,n=0;n=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,i){t=ge(this,t),e=ge(this,e);var n=[],r=t.line;return this.iter(t.line,e.line+1,function(a){var o=a.markedSpans;if(o)for(var s=0;s=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||i&&!i(l.marker)||n.push(l.marker.parent||l.marker)}++r}),n},getAllMarks:function(){var t=[];return this.iter(function(e){var i=e.markedSpans;if(i)for(var n=0;nt)return e=t,!0;t-=a,++i}),ge(this,ce(i,e))},indexFromPos:function(t){t=ge(this,t);var e=t.ch;if(t.linee&&(e=t.from),null!=t.to&&t.to-1)return e.state.draggingText(t),void setTimeout(function(){return e.display.input.focus()},20);try{var d=t.dataTransfer.getData("Text");if(d){var h;if(e.state.draggingText&&!e.state.draggingText.copy&&(h=e.listSelections()),Xa(e.doc,da(i,i)),h)for(var p=0;p=0;e--)so(t.doc,"",n[e].from,n[e].to,"+delete");dr(t)})}function Zo(t,e,i){var n=dt(t.text,e+i,i);return n<0||n>t.text.length?null:n}function Jo(t,e,i){var n=Zo(t,e.ch,i);return null==n?null:new ce(e.line,n,i<0?"after":"before")}function Qo(t,e,i,n,r){if(t){"rtl"==e.doc.direction&&(r=-r);var a=mt(i,e.doc.direction);if(a){var o,s=r<0?tt(a):a[0],l=r<0==(1==s.level),c=l?"after":"before";if(s.level>0||"rtl"==e.doc.direction){var u=on(e,i);o=r<0?i.text.length-1:0;var d=sn(e,u,o).top;o=ht(function(t){return sn(e,u,t).top==d},r<0==(1==s.level)?s.from:s.to-1,o),"before"==c&&(o=Zo(i,o,1))}else o=r<0?s.to:s.from;return new ce(n,o,c)}}return new ce(n,r<0?i.text.length:0,r<0?"before":"after")}function ts(t,e,i,n){var r=mt(e,t.doc.direction);if(!r)return Jo(e,i,n);i.ch>=e.text.length?(i.ch=e.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var a=vt(r,i.ch,i.sticky),o=r[a];if("ltr"==t.doc.direction&&o.level%2==0&&(n>0?o.to>i.ch:o.from=o.from&&h>=u.begin)){var p=d?"before":"after";return new ce(i.line,h,p)}}var f=function(t,e,n){for(var a=function(t,e){return e?new ce(i.line,l(t,1),"before"):new ce(i.line,t,"after")};t>=0&&t0==(1!=o.level),c=s?n.begin:l(n.end,-1);if(o.from<=c&&c0?u.end:l(u.begin,-1);return null==g||n>0&&g==e.text.length||(v=f(n>0?0:r.length-1,n,c(g)),!v)?null:v}$o.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},$o.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},$o.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},$o.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},$o["default"]=b?$o.macDefault:$o.pcDefault;var es={selectAll:Qa,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),G)},killLine:function(t){return qo(t,function(e){if(e.empty()){var i=ee(t.doc,e.head.line).text.length;return e.head.ch==i&&e.head.line0)r=new ce(r.line,r.ch+1),t.replaceRange(a.charAt(r.ch-1)+a.charAt(r.ch-2),ce(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var o=ee(t.doc,r.line-1).text;o&&(r=new ce(r.line,1),t.replaceRange(a.charAt(0)+t.doc.lineSeparator()+o.charAt(o.length-1),ce(r.line-1,o.length-1),r,"+transpose"))}i.push(new ca(r,r))}t.setSelections(i)})},newlineAndIndent:function(t){return Fr(t,function(){for(var e=t.listSelections(),i=e.length-1;i>=0;i--)t.replaceRange(t.doc.lineSeparator(),e[i].anchor,e[i].head,"+input");e=t.listSelections();for(var n=0;n-1&&(ue((r=s.ranges[r]).from(),e)<0||e.xRel>0)&&(ue(r.to(),e)>0||e.xRel<0)?As(t,n,e,a):Ms(t,n,e,a)}function As(t,e,i,n){var r=t.display,a=!1,c=Br(t,function(e){l&&(r.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:tr(t)),_t(r.wrapper.ownerDocument,"mouseup",c),_t(r.wrapper.ownerDocument,"mousemove",u),_t(r.scroller,"dragstart",d),_t(r.scroller,"drop",c),a||(Tt(e),n.addNew||za(t.doc,i,null,null,n.extend),l&&!p||o&&9==s?setTimeout(function(){r.wrapper.ownerDocument.body.focus({preventScroll:!0}),r.input.focus()},20):r.input.focus())}),u=function(t){a=a||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},d=function(){return a=!0};l&&(r.scroller.draggable=!0),t.state.draggingText=c,c.copy=!n.moveOnDrag,bt(r.wrapper.ownerDocument,"mouseup",c),bt(r.wrapper.ownerDocument,"mousemove",u),bt(r.scroller,"dragstart",d),bt(r.scroller,"drop",c),t.state.delayingBlurEvent=!0,setTimeout(function(){return r.input.focus()},20),r.scroller.dragDrop&&r.scroller.dragDrop()}function Ts(t,e,i){if("char"==i)return new ca(e,e);if("word"==i)return t.findWordAt(e);if("line"==i)return new ca(ce(e.line,0),ge(t.doc,ce(e.line+1,0)));var n=i(t,e);return new ca(n.from,n.to)}function Ms(t,e,i,n){o&&tr(t);var r=t.display,a=t.doc;Tt(e);var s,l,c=a.sel,u=c.ranges;if(n.addNew&&!n.extend?(l=a.sel.contains(i),s=l>-1?u[l]:new ca(i,i)):(s=a.sel.primary(),l=a.sel.primIndex),"rectangle"==n.unit)n.addNew||(s=new ca(i,i)),i=zn(t,e,!0,!0),l=-1;else{var d=Ts(t,i,n.unit);s=n.extend?Oa(s,d.anchor,d.head,n.extend):d}n.addNew?-1==l?(l=u.length,Ya(a,ua(t,u.concat([s]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&"char"==n.unit&&!n.extend?(Ya(a,ua(t,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),c=a.sel):Va(a,l,s,j):(l=0,Ya(a,new la([s],0),j),c=a.sel);var h=i;function p(e){if(0!=ue(h,e))if(h=e,"rectangle"==n.unit){for(var r=[],o=t.options.tabSize,u=H(ee(a,i.line).text,i.ch,o),d=H(ee(a,e.line).text,e.ch,o),p=Math.min(u,d),f=Math.max(u,d),v=Math.min(i.line,e.line),g=Math.min(t.lastLine(),Math.max(i.line,e.line));v<=g;v++){var m=ee(a,v).text,y=Z(m,p,o);p==f?r.push(new ca(ce(v,y),ce(v,y))):m.length>y&&r.push(new ca(ce(v,y),ce(v,Z(m,f,o))))}r.length||r.push(new ca(i,i)),Ya(a,ua(t,c.ranges.slice(0,l).concat(r),l),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var b,x=s,_=Ts(t,e,n.unit),w=x.anchor;ue(_.anchor,w)>0?(b=_.head,w=fe(x.from(),_.anchor)):(b=_.anchor,w=pe(x.to(),_.head));var C=c.ranges.slice(0);C[l]=Is(t,new ca(ge(a,w),b)),Ya(a,ua(t,C,l),j)}}var f=r.wrapper.getBoundingClientRect(),v=0;function g(e){var i=++v,o=zn(t,e,!0,"rectangle"==n.unit);if(o)if(0!=ue(o,h)){t.curOp.focus=L(O(t)),p(o);var s=ar(r,a);(o.line>=s.to||o.linef.bottom?20:0;l&&setTimeout(Br(t,function(){v==i&&(r.scroller.scrollTop+=l,g(e))}),50)}}function m(e){t.state.selectingText=!1,v=1/0,e&&(Tt(e),r.input.focus()),_t(r.wrapper.ownerDocument,"mousemove",y),_t(r.wrapper.ownerDocument,"mouseup",b),a.history.lastSelOrigin=null}var y=Br(t,function(t){0!==t.buttons&&Pt(t)?g(t):m(t)}),b=Br(t,m);t.state.selectingText=b,bt(r.wrapper.ownerDocument,"mousemove",y),bt(r.wrapper.ownerDocument,"mouseup",b)}function Is(t,e){var i=e.anchor,n=e.head,r=ee(t.doc,i.line);if(0==ue(i,n)&&i.sticky==n.sticky)return e;var a=mt(r);if(!a)return e;var o=vt(a,i.ch,i.sticky),s=a[o];if(s.from!=i.ch&&s.to!=i.ch)return e;var l,c=o+(s.from==i.ch==(1!=s.level)?0:1);if(0==c||c==a.length)return e;if(n.line!=i.line)l=(n.line-i.line)*("ltr"==t.doc.direction?1:-1)>0;else{var u=vt(a,n.ch,n.sticky),d=u-o||(n.ch-i.ch)*(1==s.level?-1:1);l=u==c-1||u==c?d<0:d>0}var h=a[c+(l?-1:0)],p=l==(1==h.level),f=p?h.from:h.to,v=p?"after":"before";return i.ch==f&&i.sticky==v?e:new ca(new ce(i.line,f,v),n)}function Es(t,e,i,n){var r,a;if(e.touches)r=e.touches[0].clientX,a=e.touches[0].clientY;else try{r=e.clientX,a=e.clientY}catch(h){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;n&&Tt(e);var o=t.display,s=o.lineDiv.getBoundingClientRect();if(a>s.bottom||!kt(t,i))return It(e);a-=s.top-o.viewOffset;for(var l=0;l=r){var u=oe(t.doc,a),d=t.display.gutterSpecs[l];return wt(t,i,t,u,d.className,e),It(e)}}}function Ds(t,e){return Es(t,e,"gutterClick",!0)}function Ps(t,e){Ui(t.display,e)||Ls(t,e)||Ct(t,e,"contextmenu")||S||t.display.input.onContextMenu(e)}function Ls(t,e){return!!kt(t,"gutterContextMenu")&&Es(t,e,"gutterContextMenu",!1)}function Rs(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),gn(t)}xs.prototype.compare=function(t,e,i){return this.time+bs>t&&0==ue(e,this.pos)&&i==this.button};var Fs={toString:function(){return"CodeMirror.Init"}},Bs={},Ns={};function Os(t){var e=t.optionHandlers;function i(i,n,r,a){t.defaults[i]=n,r&&(e[i]=a?function(t,e,i){i!=Fs&&r(t,e,i)}:r)}t.defineOption=i,t.Init=Fs,i("value","",function(t,e){return t.setValue(e)},!0),i("mode",null,function(t,e){t.doc.modeOption=e,ma(t)},!0),i("indentUnit",2,ma,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(t){ya(t),gn(t),Vn(t)},!0),i("lineSeparator",null,function(t,e){if(t.doc.lineSep=e,e){var i=[],n=t.doc.first;t.doc.iter(function(t){for(var r=0;;){var a=t.text.indexOf(e,r);if(-1==a)break;r=a+e.length,i.push(ce(n,a))}n++});for(var r=i.length-1;r>=0;r--)so(t.doc,e,i[r],ce(i[r].line,i[r].ch+e.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(t,e,i){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),i!=Fs&&t.refresh()}),i("specialCharPlaceholder",bi,function(t){return t.refresh()},!0),i("electricChars",!0),i("inputStyle",y?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(t,e){return t.getInputField().spellcheck=e},!0),i("autocorrect",!1,function(t,e){return t.getInputField().autocorrect=e},!0),i("autocapitalize",!1,function(t,e){return t.getInputField().autocapitalize=e},!0),i("rtlMoveVisually",!_),i("wholeLineUpdateBefore",!0),i("theme","default",function(t){Rs(t),ea(t)},!0),i("keyMap","default",function(t,e,i){var n=jo(e),r=i!=Fs&&jo(i);r&&r.detach&&r.detach(t,n),n.attach&&n.attach(t,r||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Ws,!0),i("gutters",[],function(t,e){t.display.gutterSpecs=Qr(e,t.options.lineNumbers),ea(t)},!0),i("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?Bn(t.display)+"px":"0",t.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(t){return wr(t)},!0),i("scrollbarStyle","native",function(t){kr(t),wr(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0),i("lineNumbers",!1,function(t,e){t.display.gutterSpecs=Qr(t.options.gutters,e),ea(t)},!0),i("firstLineNumber",1,ea,!0),i("lineNumberFormatter",function(t){return t},ea,!0),i("showCursorWhenSelecting",!1,Un,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(t,e){"nocursor"==e&&(ir(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)}),i("screenReaderLabel",null,function(t,e){e=""===e?null:e,t.display.input.screenReaderLabelChanged(e)}),i("disableInput",!1,function(t,e){e||t.display.input.reset()},!0),i("dragDrop",!0,zs),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Un,!0),i("singleCursorHeightPerLine",!0,Un,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,ya,!0),i("addModeClass",!1,ya,!0),i("pollInterval",100),i("undoDepth",200,function(t,e){return t.doc.history.undoDepth=e}),i("historyEventDelay",1250),i("viewportMargin",10,function(t){return t.refresh()},!0),i("maxHighlightLength",1e4,ya,!0),i("moveInputWithCursor",!0,function(t,e){e||t.display.input.resetPosition()}),i("tabindex",null,function(t,e){return t.display.input.getField().tabIndex=e||""}),i("autofocus",null),i("direction","ltr",function(t,e){return t.doc.setDirection(e)},!0),i("phrases",null)}function zs(t,e,i){var n=i&&i!=Fs;if(!e!=!n){var r=t.display.dragFunctions,a=e?bt:_t;a(t.display.scroller,"dragstart",r.start),a(t.display.scroller,"dragenter",r.enter),a(t.display.scroller,"dragover",r.over),a(t.display.scroller,"dragleave",r.leave),a(t.display.scroller,"drop",r.drop)}}function Ws(t){t.options.lineWrapping?(R(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(T(t.display.wrapper,"CodeMirror-wrap"),di(t)),On(t),Vn(t),gn(t),setTimeout(function(){return wr(t)},100)}function Vs(t,e){var i=this;if(!(this instanceof Vs))return new Vs(t,e);this.options=e=e?$(e):{},$(Bs,e,!1);var n=e.value;"string"==typeof n?n=new To(n,e.mode,null,e.lineSeparator,e.direction):e.mode&&(n.modeOption=e.mode),this.doc=n;var r=new Vs.inputStyles[e.inputStyle](this),a=this.display=new ia(t,n,r,e);for(var c in a.wrapper.CodeMirror=this,Rs(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),kr(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new K,keySeq:null,specialChars:null},e.autofocus&&!y&&a.input.focus(),o&&s<11&&setTimeout(function(){return i.display.input.reset(!0)},20),$s(this),Fo(),Tr(this),this.curOp.forceUpdate=!0,wa(this,n),e.autofocus&&!y||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&er(i)},20):ir(this),Ns)Ns.hasOwnProperty(c)&&Ns[c](this,e[c],Fs);Jr(this),e.finishInit&&e.finishInit(this);for(var u=0;u400}bt(e.scroller,"touchstart",function(r){if(!Ct(t,r)&&!a(r)&&!Ds(t,r)){e.input.ensurePolled(),clearTimeout(i);var o=+new Date;e.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==r.touches.length&&(e.activeTouch.left=r.touches[0].pageX,e.activeTouch.top=r.touches[0].pageY)}}),bt(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),bt(e.scroller,"touchend",function(i){var n=e.activeTouch;if(n&&!Ui(e,i)&&null!=n.left&&!n.moved&&new Date-n.start<300){var a,o=t.coordsChar(e.activeTouch,"page");a=!n.prev||l(n,n.prev)?new ca(o,o):!n.prev.prev||l(n,n.prev.prev)?t.findWordAt(o):new ca(ce(o.line,0),ge(t.doc,ce(o.line+1,0))),t.setSelection(a.anchor,a.head),t.focus(),Tt(i)}r()}),bt(e.scroller,"touchcancel",r),bt(e.scroller,"scroll",function(){e.scroller.clientHeight&&(gr(t,e.scroller.scrollTop),yr(t,e.scroller.scrollLeft,!0),wt(t,"scroll",t))}),bt(e.scroller,"mousewheel",function(e){return sa(t,e)}),bt(e.scroller,"DOMMouseScroll",function(e){return sa(t,e)}),bt(e.wrapper,"scroll",function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={enter:function(e){Ct(t,e)||Et(e)},over:function(e){Ct(t,e)||(Do(t,e),Et(e))},start:function(e){return Eo(t,e)},drop:Br(t,Io),leave:function(e){Ct(t,e)||Po(t)}};var c=e.input.getField();bt(c,"keyup",function(e){return vs.call(t,e)}),bt(c,"keydown",Br(t,ps)),bt(c,"keypress",Br(t,gs)),bt(c,"focus",function(e){return er(t,e)}),bt(c,"blur",function(e){return ir(t,e)})}Vs.defaults=Bs,Vs.optionHandlers=Ns;var Hs=[];function Ks(t,e,i,n){var r,a=t.doc;null==i&&(i="add"),"smart"==i&&(a.mode.indent?r=Ce(t,e).state:i="prev");var o=t.options.tabSize,s=ee(a,e),l=H(s.text,null,o);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==i&&(c=a.mode.indent(r,s.text.slice(u.length),s.text),c==U||c>150)){if(!n)return;i="prev"}}else c=0,i="not";"prev"==i?c=e>a.first?H(ee(a,e-1).text,null,o):0:"add"==i?c=l+t.options.indentUnit:"subtract"==i?c=l-t.options.indentUnit:"number"==typeof i&&(c=l+i),c=Math.max(0,c);var d="",h=0;if(t.options.indentWithTabs)for(var p=Math.floor(c/o);p;--p)h+=o,d+="\t";if(ho,l=Ot(e),c=null;if(s&&n.ranges.length>1)if(Ys&&Ys.text.join("\n")==e){if(n.ranges.length%Ys.text.length==0){c=[];for(var u=0;u=0;h--){var p=n.ranges[h],f=p.from(),v=p.to();p.empty()&&(i&&i>0?f=ce(f.line,f.ch-i):t.state.overwrite&&!s?v=ce(v.line,Math.min(ee(a,v.line).text.length,v.ch+tt(l).length)):s&&Ys&&Ys.lineWise&&Ys.text.join("\n")==l.join("\n")&&(f=v=ce(f.line,0)));var g={from:f,to:v,text:c?c[h%c.length]:l,origin:r||(s?"paste":t.state.cutIncoming>o?"cut":"+input")};eo(t.doc,g),Pi(t,"inputRead",t,g)}e&&!s&&js(t,e),dr(t),t.curOp.updateInput<2&&(t.curOp.updateInput=d),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function Gs(t,e){var i=t.clipboardData&&t.clipboardData.getData("Text");if(i)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||!e.hasFocus()||Fr(e,function(){return Us(e,i,0,null,"paste")}),!0}function js(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var i=t.doc.sel,n=i.ranges.length-1;n>=0;n--){var r=i.ranges[n];if(!(r.head.ch>100||n&&i.ranges[n-1].head.line==r.head.line)){var a=t.getModeAt(r.head),o=!1;if(a.electricChars){for(var s=0;s-1){o=Ks(t,r.head.line,"smart");break}}else a.electricInput&&a.electricInput.test(ee(t.doc,r.head.line).text.slice(0,r.head.ch))&&(o=Ks(t,r.head.line,"smart"));o&&Pi(t,"electricInput",t,r.head.line)}}}function qs(t){for(var e=[],i=[],n=0;ni&&(Ks(this,r.head.line,t,!0),i=r.head.line,n==this.doc.sel.primIndex&&dr(this));else{var a=r.from(),o=r.to(),s=Math.max(i,a.line);i=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var l=s;l0&&Va(this.doc,n,new ca(a,c[n].to()),G)}}}),getTokenAt:function(t,e){return Me(this,t,e)},getLineTokens:function(t,e){return Me(this,ce(t),e,!0)},getTokenTypeAt:function(t){t=ge(this.doc,t);var e,i=we(this,ee(this.doc,t.line)),n=0,r=(i.length-1)/2,a=t.ch;if(0==a)e=i[2];else for(;;){var o=n+r>>1;if((o?i[2*o-1]:0)>=a)r=o;else{if(!(i[2*o+1]a&&(t=a,r=!0),n=ee(this.doc,t)}else n=t;return xn(this,n,{top:0,left:0},e||"page",i||r).top+(r?this.doc.height-ci(n):0)},defaultTextHeight:function(){return Ln(this.display)},defaultCharWidth:function(){return Rn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,i,n,r){var a=this.display;t=Cn(this,ge(this.doc,t));var o=t.bottom,s=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),a.sizer.appendChild(e),"over"==n)o=t.top;else if("above"==n||"near"==n){var l=Math.max(a.wrapper.clientHeight,this.doc.height),c=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?o=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(o=t.bottom),s+e.offsetWidth>c&&(s=c-e.offsetWidth)}e.style.top=o+"px",e.style.left=e.style.right="","right"==r?(s=a.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?s=0:"middle"==r&&(s=(a.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),i&&lr(this,{left:s,top:o,right:s+e.offsetWidth,bottom:o+e.offsetHeight})},triggerOnKeyDown:Nr(ps),triggerOnKeyPress:Nr(gs),triggerOnKeyUp:vs,triggerOnMouseDown:Nr(ws),execCommand:function(t){if(es.hasOwnProperty(t))return es[t].call(null,this)},triggerElectric:Nr(function(t){js(this,t)}),findPosH:function(t,e,i,n){var r=1;e<0&&(r=-1,e=-e);for(var a=ge(this.doc,t),o=0;o0&&s(i.charAt(n-1)))--n;while(r.5||this.options.lineWrapping)&&On(this),wt(this,"refresh",this)}),swapDoc:Nr(function(t){var e=this.doc;return e.cm=null,this.state.selectingText&&this.state.selectingText(),wa(this,t),gn(this),this.display.input.reset(),hr(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,Pi(this,"swapDoc",this,e),e}),phrase:function(t){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:t},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},At(t),t.registerHelper=function(e,n,r){i.hasOwnProperty(e)||(i[e]=t[e]={_global:[]}),i[e][n]=r},t.registerGlobalHelper=function(e,n,r,a){t.registerHelper(e,n,a),i[e]._global.push({pred:r,val:a})}}function tl(t,e,i,n,r){var a=e,o=i,s=ee(t,e.line),l=r&&"rtl"==t.direction?-i:i;function c(){var i=e.line+l;return!(i=t.first+t.size)&&(e=new ce(i,e.ch,e.sticky),s=ee(t,i))}function u(a){var o;if("codepoint"==n){var u=s.text.charCodeAt(e.ch+(i>0?0:-1));if(isNaN(u))o=null;else{var d=i>0?u>=55296&&u<56320:u>=56320&&u<57343;o=new ce(e.line,Math.max(0,Math.min(s.text.length,e.ch+i*(d?2:1))),-i)}}else o=r?ts(t.cm,s,e,i):Jo(s,e,i);if(null==o){if(a||!c())return!1;e=Qo(r,t.cm,s,e.line,l)}else e=o;return!0}if("char"==n||"codepoint"==n)u();else if("column"==n)u(!0);else if("word"==n||"group"==n)for(var d=null,h="group"==n,p=t.cm&&t.cm.getHelper(e,"wordChars"),f=!0;;f=!1){if(i<0&&!u(!f))break;var v=s.text.charAt(e.ch)||"\n",g=st(v,p)?"w":h&&"\n"==v?"n":!h||/\s/.test(v)?null:"p";if(!h||f||g||(g="s"),d&&d!=g){i<0&&(i=1,u(),e.sticky="after");break}if(g&&(d=g),i>0&&!u(!f))break}var m=Za(t,e,a,o,!0);return de(a,m)&&(m.hitSide=!0),m}function el(t,e,i,n){var r,a,o=t.doc,s=e.left;if("page"==n){var l=Math.min(t.display.wrapper.clientHeight,W(t).innerHeight||o(t).documentElement.clientHeight),c=Math.max(l-.5*Ln(t.display),3);r=(i>0?e.bottom:e.top)+i*c}else"line"==n&&(r=i>0?e.bottom+3:e.top-3);for(;;){if(a=An(t,s,r),!a.outside)break;if(i<0?r<=0:r>=o.height){a.hitSide=!0;break}r+=5*i}return a}var il=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new K,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function nl(t,e){var i=an(t,e.line);if(!i||i.hidden)return null;var n=ee(t.doc,e.line),r=en(i,n,e.line),a=mt(n,t.doc.direction),o="left";if(a){var s=vt(a,e.ch);o=s%2?"right":"left"}var l=un(r.map,e.ch,o);return l.offset="right"==l.collapse?l.end:l.start,l}function rl(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function al(t,e){return e&&(t.bad=!0),t}function ol(t,e,i,n,r){var a="",o=!1,s=t.doc.lineSeparator(),l=!1;function c(t){return function(e){return e.id==t}}function u(){o&&(a+=s,l&&(a+=s),o=l=!1)}function d(t){t&&(u(),a+=t)}function h(e){if(1==e.nodeType){var i=e.getAttribute("cm-text");if(i)return void d(i);var a,p=e.getAttribute("cm-marker");if(p){var f=t.findMarks(ce(n,0),ce(r+1,0),c(+p));return void(f.length&&(a=f[0].find(0))&&d(ie(t.doc,a.from,a.to).join(s)))}if("false"==e.getAttribute("contenteditable"))return;var v=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;v&&u();for(var g=0;g=e.display.viewTo||a.line=e.display.viewFrom&&nl(e,r)||{node:l[0].measure.map[2],offset:0},u=a.linen.firstLine()&&(o=ce(o.line-1,ee(n.doc,o.line-1).length)),s.ch==ee(n.doc,s.line).text.length&&s.liner.viewTo-1)return!1;o.line==r.viewFrom||0==(t=Wn(n,o.line))?(e=ae(r.view[0].line),i=r.view[0].node):(e=ae(r.view[t].line),i=r.view[t-1].node.nextSibling);var l,c,u=Wn(n,s.line);if(u==r.view.length-1?(l=r.viewTo-1,c=r.lineDiv.lastChild):(l=ae(r.view[u+1].line)-1,c=r.view[u+1].node.previousSibling),!i)return!1;var d=n.doc.splitLines(ol(n,i,c,e,l)),h=ie(n.doc,ce(e,0),ce(l,ee(n.doc,l).text.length));while(d.length>1&&h.length>1)if(tt(d)==tt(h))d.pop(),h.pop(),l--;else{if(d[0]!=h[0])break;d.shift(),h.shift(),e++}var p=0,f=0,v=d[0],g=h[0],m=Math.min(v.length,g.length);while(po.ch&&y.charCodeAt(y.length-f-1)==b.charCodeAt(b.length-f-1))p--,f++;d[d.length-1]=y.slice(0,y.length-f).replace(/^\u200b+/,""),d[0]=d[0].slice(p).replace(/\u200b+$/,"");var _=ce(e,p),w=ce(l,h.length?tt(h).length-f:0);return d.length>1||d[0]||ue(_,w)?(so(n.doc,d,_,w,"+input"),!0):void 0},il.prototype.ensurePolled=function(){this.forceCompositionEnd()},il.prototype.reset=function(){this.forceCompositionEnd()},il.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},il.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()},80))},il.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||Fr(this.cm,function(){return Vn(t.cm)})},il.prototype.setUneditable=function(t){t.contentEditable="false"},il.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||Br(this.cm,Us)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},il.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},il.prototype.onContextMenu=function(){},il.prototype.resetPosition=function(){},il.prototype.needsContentAttribute=!0;var cl=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new K,this.hasSelection=!1,this.composing=null,this.resetting=!1};function ul(t,e){if(e=e?$(e):{},e.value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var i=L(z(t));e.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}function n(){t.value=s.getValue()}var r;if(t.form&&(bt(t.form,"submit",n),!e.leaveSubmitMethodAlone)){var a=t.form;r=a.submit;try{var o=a.submit=function(){n(),a.submit=r,a.submit(),a.submit=o}}catch(l){}}e.finishInit=function(i){i.save=n,i.getTextArea=function(){return t},i.toTextArea=function(){i.toTextArea=isNaN,n(),t.parentNode.removeChild(i.getWrapperElement()),t.style.display="",t.form&&(_t(t.form,"submit",n),e.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=r))}},t.style.display="none";var s=Vs(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},e);return s}function dl(t){t.off=_t,t.on=bt,t.wheelEventPixels=oa,t.Doc=To,t.splitLines=Ot,t.countColumn=H,t.findColumn=Z,t.isWordChar=ot,t.Pass=U,t.signal=wt,t.Line=hi,t.changeEnd=ha,t.scrollbarModel=Sr,t.Pos=ce,t.cmpPos=ue,t.modes=Ht,t.mimeModes=Kt,t.resolveMode=Ut,t.getMode=Gt,t.modeExtensions=jt,t.extendMode=qt,t.copyState=Zt,t.startState=Qt,t.innerMode=Jt,t.commands=es,t.keyMap=$o,t.keyName=Go,t.isModifierKey=Xo,t.lookupKey=Yo,t.normalizeKeyMap=Ko,t.StringStream=te,t.SharedTextMarker=_o,t.TextMarker=bo,t.LineWidget=vo,t.e_preventDefault=Tt,t.e_stopPropagation=Mt,t.e_stop=Et,t.addClass=R,t.contains=P,t.rmClass=T,t.keyNames=Oo}cl.prototype.init=function(t){var e=this,i=this,n=this.cm;this.createField(t);var r=this.textarea;function a(t){if(!Ct(n,t)){if(n.somethingSelected())Xs({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var e=qs(n);Xs({lineWise:!0,text:e.text}),"cut"==t.type?n.setSelections(e.ranges,null,G):(i.prevInput="",r.value=e.text.join("\n"),B(r))}"cut"==t.type&&(n.state.cutIncoming=+new Date)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),g&&(r.style.width="0px"),bt(r,"input",function(){o&&s>=9&&e.hasSelection&&(e.hasSelection=null),i.poll()}),bt(r,"paste",function(t){Ct(n,t)||Gs(t,n)||(n.state.pasteIncoming=+new Date,i.fastPoll())}),bt(r,"cut",a),bt(r,"copy",a),bt(t.scroller,"paste",function(e){if(!Ui(t,e)&&!Ct(n,e)){if(!r.dispatchEvent)return n.state.pasteIncoming=+new Date,void i.focus();var a=new Event("paste");a.clipboardData=e.clipboardData,r.dispatchEvent(a)}}),bt(t.lineSpace,"selectstart",function(e){Ui(t,e)||Tt(e)}),bt(r,"compositionstart",function(){var t=n.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:t,range:n.markText(t,n.getCursor("to"),{className:"CodeMirror-composing"})}}),bt(r,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},cl.prototype.createField=function(t){this.wrapper=Js(),this.textarea=this.wrapper.firstChild;var e=this.cm.options;Zs(this.textarea,e.spellcheck,e.autocorrect,e.autocapitalize)},cl.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},cl.prototype.prepareSelection=function(){var t=this.cm,e=t.display,i=t.doc,n=Gn(t);if(t.options.moveInputWithCursor){var r=Cn(t,i.sel.primary().head,"div"),a=e.wrapper.getBoundingClientRect(),o=e.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,r.top+o.top-a.top)),n.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,r.left+o.left-a.left))}return n},cl.prototype.showSelection=function(t){var e=this.cm,i=e.display;I(i.cursorDiv,t.cursors),I(i.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},cl.prototype.reset=function(t){if(!(this.contextMenuPending||this.composing&&t)){var e=this.cm;if(this.resetting=!0,e.somethingSelected()){this.prevInput="";var i=e.getSelection();this.textarea.value=i,e.state.focused&&B(this.textarea),o&&s>=9&&(this.hasSelection=i)}else t||(this.prevInput=this.textarea.value="",o&&s>=9&&(this.hasSelection=null));this.resetting=!1}},cl.prototype.getField=function(){return this.textarea},cl.prototype.supportsTouch=function(){return!1},cl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!y||L(z(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(t){}},cl.prototype.blur=function(){this.textarea.blur()},cl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},cl.prototype.receivedFocus=function(){this.slowPoll()},cl.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){t.poll(),t.cm.state.focused&&t.slowPoll()})},cl.prototype.fastPoll=function(){var t=!1,e=this;function i(){var n=e.poll();n||t?(e.pollingFast=!1,e.slowPoll()):(t=!0,e.polling.set(60,i))}e.pollingFast=!0,e.polling.set(20,i)},cl.prototype.poll=function(){var t=this,e=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||this.resetting||!e.state.focused||zt(i)&&!n&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=i.value;if(r==n&&!e.somethingSelected())return!1;if(o&&s>=9&&this.hasSelection===r||b&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var a=r.charCodeAt(0);if(8203!=a||n||(n="​"),8666==a)return this.reset(),this.cm.execCommand("undo")}var l=0,c=Math.min(n.length,r.length);while(l1e3||r.indexOf("\n")>-1?i.value=t.prevInput="":t.prevInput=r,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},cl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},cl.prototype.onKeyPress=function(){o&&s>=9&&(this.hasSelection=null),this.fastPoll()},cl.prototype.onContextMenu=function(t){var e=this,i=e.cm,n=i.display,r=e.textarea;e.contextMenuPending&&e.contextMenuPending();var a=zn(i,t),c=n.scroller.scrollTop;if(a&&!h){var u=i.options.resetSelectionOnContextMenu;u&&-1==i.doc.sel.contains(a)&&Br(i,Ya)(i.doc,da(a),G);var d,p=r.style.cssText,f=e.wrapper.style.cssText,v=e.wrapper.offsetParent.getBoundingClientRect();if(e.wrapper.style.cssText="position: static",r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-v.top-5)+"px; left: "+(t.clientX-v.left-5)+"px;\n z-index: 1000; background: "+(o?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(d=r.ownerDocument.defaultView.scrollY),n.input.focus(),l&&r.ownerDocument.defaultView.scrollTo(null,d),n.input.reset(),i.somethingSelected()||(r.value=e.prevInput=" "),e.contextMenuPending=y,n.selForContextMenu=i.doc.sel,clearTimeout(n.detectingSelectAll),o&&s>=9&&m(),S){Et(t);var g=function(){_t(window,"mouseup",g),setTimeout(y,20)};bt(window,"mouseup",g)}else setTimeout(y,50)}function m(){if(null!=r.selectionStart){var t=i.somethingSelected(),a="​"+(t?r.value:"");r.value="⇚",r.value=a,e.prevInput=t?"":"​",r.selectionStart=1,r.selectionEnd=a.length,n.selForContextMenu=i.doc.sel}}function y(){if(e.contextMenuPending==y&&(e.contextMenuPending=!1,e.wrapper.style.cssText=f,r.style.cssText=p,o&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=c),null!=r.selectionStart)){(!o||o&&s<9)&&m();var t=0,a=function(){n.selForContextMenu==i.doc.sel&&0==r.selectionStart&&r.selectionEnd>0&&"​"==e.prevInput?Br(i,Qa)(i):t++<10?n.detectingSelectAll=setTimeout(a,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(a,200)}}},cl.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},cl.prototype.setUneditable=function(){},cl.prototype.needsContentAttribute=!1,Os(Vs),Qs(Vs);var hl="iter insert remove copy getEditor constructor".split(" ");for(var pl in To.prototype)To.prototype.hasOwnProperty(pl)&&Y(hl,pl)<0&&(Vs.prototype[pl]=function(t){return function(){return t.apply(this.doc,arguments)}}(To.prototype[pl]));return At(To),Vs.inputStyles={textarea:cl,contenteditable:il},Vs.defineMode=function(t){Vs.defaults.mode||"null"==t||(Vs.defaults.mode=t),Yt.apply(this,arguments)},Vs.defineMIME=Xt,Vs.defineMode("null",function(){return{token:function(t){return t.skipToEnd()}}}),Vs.defineMIME("text/plain","null"),Vs.defineExtension=function(t,e){Vs.prototype[t]=e},Vs.defineDocExtension=function(t,e){To.prototype[t]=e},Vs.fromTextArea=ul,dl(Vs),Vs.version="5.65.21",Vs})},74806:function(t,e,i){(function(t){t(i(15237))})(function(t){"use strict";function e(t){return new RegExp("^(("+t.join(")|(")+"))\\b")}var i=e(["and","or","not","is"]),n=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in","False","True"],r=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function a(t){return t.scopes[t.scopes.length-1]}t.registerHelper("hintWords","python",n.concat(r).concat(["exec","print"])),t.defineMode("python",function(o,s){for(var l="error",c=s.delimiters||s.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,u=[s.singleOperators,s.doubleOperators,s.doubleDelimiters,s.tripleDelimiters,s.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],d=0;dn?S(e):r0&&A(t,e)&&(o+=" "+l),o}return _(t,e)}function _(t,e,n){if(t.eatSpace())return null;if(!n&&t.match(/^#.*/))return"comment";if(t.match(/^[0-9\.]/,!1)){var r=!1;if(t.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),t.match(/^[\d_]+\.\d*/)&&(r=!0),t.match(/^\.\d+/)&&(r=!0),r)return t.eat(/J/i),"number";var a=!1;if(t.match(/^0x[0-9a-f_]+/i)&&(a=!0),t.match(/^0b[01_]+/i)&&(a=!0),t.match(/^0o[0-7_]+/i)&&(a=!0),t.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(t.eat(/J/i),a=!0),t.match(/^0(?![\dx])/i)&&(a=!0),a)return t.eat(/L/i),"number"}if(t.match(m)){var o=-1!==t.current().toLowerCase().indexOf("f");return o?(e.tokenize=w(t.current(),e.tokenize),e.tokenize(t,e)):(e.tokenize=C(t.current(),e.tokenize),e.tokenize(t,e))}for(var s=0;s=0)t=t.substr(1);var i=1==t.length,n="string";function r(t){return function(e,i){var n=_(e,i,!0);return"punctuation"==n&&("{"==e.current()?i.tokenize=r(t+1):"}"==e.current()&&(i.tokenize=t>1?r(t-1):a)),n}}function a(a,o){while(!a.eol())if(a.eatWhile(/[^'"\{\}\\]/),a.eat("\\")){if(a.next(),i&&a.eol())return n}else{if(a.match(t))return o.tokenize=e,n;if(a.match("{{"))return n;if(a.match("{",!1))return o.tokenize=r(0),a.current()?n:o.tokenize(a,o);if(a.match("}}"))return n;if(a.match("}"))return l;a.eat(/['"]/)}if(i){if(s.singleLineStringErrors)return l;o.tokenize=e}return n}return a.isString=!0,a}function C(t,e){while("rubf".indexOf(t.charAt(0).toLowerCase())>=0)t=t.substr(1);var i=1==t.length,n="string";function r(r,a){while(!r.eol())if(r.eatWhile(/[^'"\\]/),r.eat("\\")){if(r.next(),i&&r.eol())return n}else{if(r.match(t))return a.tokenize=e,n;r.eat(/['"]/)}if(i){if(s.singleLineStringErrors)return l;a.tokenize=e}return n}return r.isString=!0,r}function S(t){while("py"!=a(t).type)t.scopes.pop();t.scopes.push({offset:a(t).offset+o.indentUnit,type:"py",align:null})}function k(t,e,i){var n=t.match(/^[\s\[\{\(]*(?:#|$)/,!1)?null:t.column()+1;e.scopes.push({offset:e.indent+h,type:i,align:n})}function A(t,e){var i=t.indentation();while(e.scopes.length>1&&a(e).offset>i){if("py"!=a(e).type)return!0;e.scopes.pop()}return a(e).offset!=i}function T(t,e){t.sol()&&(e.beginningOfLine=!0,e.dedent=!1);var i=e.tokenize(t,e),n=t.current();if(e.beginningOfLine&&"@"==n)return t.match(g,!1)?"meta":v?"operator":l;if(/\S/.test(n)&&(e.beginningOfLine=!1),"variable"!=i&&"builtin"!=i||"meta"!=e.lastToken||(i="meta"),"pass"!=n&&"return"!=n||(e.dedent=!0),"lambda"==n&&(e.lambda=!0),":"==n&&!e.lambda&&"py"==a(e).type&&t.match(/^\s*(?:#|$)/,!1)&&S(e),1==n.length&&!/string|comment/.test(i)){var r="[({".indexOf(n);if(-1!=r&&k(t,e,"])}".slice(r,r+1)),r="])}".indexOf(n),-1!=r){if(a(e).type!=n)return l;e.indent=e.scopes.pop().offset-h}}return e.dedent&&t.eol()&&"py"==a(e).type&&e.scopes.length>1&&e.scopes.pop(),i}var M={startState:function(t){return{tokenize:x,scopes:[{offset:t||0,type:"py",align:null}],indent:t||0,lastToken:null,lambda:!1,dedent:0}},token:function(t,e){var i=e.errorToken;i&&(e.errorToken=!1);var n=T(t,e);return n&&"comment"!=n&&(e.lastToken="keyword"==n||"punctuation"==n?t.current():n),"punctuation"==n&&(n=null),t.eol()&&e.lambda&&(e.lambda=!1),i?n+" "+l:n},indent:function(e,i){if(e.tokenize!=x)return e.tokenize.isString?t.Pass:0;var n=a(e),r=n.type==i.charAt(0)||"py"==n.type&&!e.dedent&&/^(else:|elif |except |finally:)/.test(i);return null!=n.align?n.align-(r?1:0):n.offset-(r?h:0)},electricInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return M}),t.defineMIME("text/x-python","python");var o=function(t){return t.split(" ")};t.defineMIME("text/x-cython",{name:"python",extra_keywords:o("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")})})},40955:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.BlockCipher,r=e.algo,a=[],o=[],s=[],l=[],c=[],u=[],d=[],h=[],p=[],f=[];(function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var i=0,n=0;for(e=0;e<256;e++){var r=n^n<<1^n<<2^n<<3^n<<4;r=r>>>8^255&r^99,a[i]=r,o[r]=i;var v=t[i],g=t[v],m=t[g],y=257*t[r]^16843008*r;s[i]=y<<24|y>>>8,l[i]=y<<16|y>>>16,c[i]=y<<8|y>>>24,u[i]=y;y=16843009*m^65537*g^257*v^16843008*i;d[r]=y<<24|y>>>8,h[r]=y<<16|y>>>16,p[r]=y<<8|y>>>24,f[r]=y,i?(i=v^t[t[t[m^v]]],n^=t[t[n]]):i=n=1}})();var v=[0,1,2,4,8,16,32,64,128,27,54],g=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,i=t.sigBytes/4,n=this._nRounds=i+6,r=4*(n+1),o=this._keySchedule=[],s=0;s6&&s%i==4&&(u=a[u>>>24]<<24|a[u>>>16&255]<<16|a[u>>>8&255]<<8|a[255&u]):(u=u<<8|u>>>24,u=a[u>>>24]<<24|a[u>>>16&255]<<16|a[u>>>8&255]<<8|a[255&u],u^=v[s/i|0]<<24),o[s]=o[s-i]^u);for(var l=this._invKeySchedule=[],c=0;c>>24]]^h[a[u>>>16&255]]^p[a[u>>>8&255]]^f[a[255&u]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,l,c,u,a)},decryptBlock:function(t,e){var i=t[e+1];t[e+1]=t[e+3],t[e+3]=i,this._doCryptBlock(t,e,this._invKeySchedule,d,h,p,f,o);i=t[e+1];t[e+1]=t[e+3],t[e+3]=i},_doCryptBlock:function(t,e,i,n,r,a,o,s){for(var l=this._nRounds,c=t[e]^i[0],u=t[e+1]^i[1],d=t[e+2]^i[2],h=t[e+3]^i[3],p=4,f=1;f>>24]^r[u>>>16&255]^a[d>>>8&255]^o[255&h]^i[p++],g=n[u>>>24]^r[d>>>16&255]^a[h>>>8&255]^o[255&c]^i[p++],m=n[d>>>24]^r[h>>>16&255]^a[c>>>8&255]^o[255&u]^i[p++],y=n[h>>>24]^r[c>>>16&255]^a[u>>>8&255]^o[255&d]^i[p++];c=v,u=g,d=m,h=y}v=(s[c>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&h])^i[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[h>>>8&255]<<8|s[255&c])^i[p++],m=(s[d>>>24]<<24|s[h>>>16&255]<<16|s[c>>>8&255]<<8|s[255&u])^i[p++],y=(s[h>>>24]<<24|s[c>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^i[p++];t[e]=v,t[e+1]=g,t[e+2]=m,t[e+3]=y},keySize:8});e.AES=n._createHelper(g)}(),t.AES})},43128:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.BlockCipher,r=e.algo;const a=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 i=e>>24&255,n=e>>16&255,r=e>>8&255,a=255&e,o=t.sbox[0][i]+t.sbox[1][n];return o^=t.sbox[2][r],o+=t.sbox[3][a],o}function u(t,e,i){let n,r=e,o=i;for(let s=0;s1;--s)r^=t.pbox[s],o=c(t,r)^o,n=r,r=o,o=n;return n=r,r=o,o=n,o^=t.pbox[1],r^=t.pbox[0],{left:r,right:o}}function h(t,e,i){for(let a=0;a<4;a++){t.sbox[a]=[];for(let e=0;e<256;e++)t.sbox[a][e]=s[a][e]}let n=0;for(let s=0;s=i&&(n=0);let r=0,l=0,c=0;for(let o=0;o>>2];t.sigBytes-=e}},m=(n.BlockCipher=d.extend({cfg:d.cfg.extend({mode:f,padding:g}),reset:function(){var t;d.reset.call(this);var e=this.cfg,i=e.iv,n=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=n.createEncryptor:(t=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,i&&i.words):(this._mode=t.call(n,this,i&&i.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}),n.CipherParams=r.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),y=i.format={},b=y.OpenSSL={stringify:function(t){var e,i=t.ciphertext,n=t.salt;return e=n?a.create([1398893684,1701076831]).concat(n).concat(i):i,e.toString(l)},parse:function(t){var e,i=l.parse(t),n=i.words;return 1398893684==n[0]&&1701076831==n[1]&&(e=a.create(n.slice(2,4)),n.splice(0,4),i.sigBytes-=16),m.create({ciphertext:i,salt:e})}},x=n.SerializableCipher=r.extend({cfg:r.extend({format:b}),encrypt:function(t,e,i,n){n=this.cfg.extend(n);var r=t.createEncryptor(i,n),a=r.finalize(e),o=r.cfg;return m.create({ciphertext:a,key:i,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,i,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var r=t.createDecryptor(i,n).finalize(e.ciphertext);return r},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),_=i.kdf={},w=_.OpenSSL={execute:function(t,e,i,n,r){if(n||(n=a.random(8)),r)o=u.create({keySize:e+i,hasher:r}).compute(t,n);else var o=u.create({keySize:e+i}).compute(t,n);var s=a.create(o.words.slice(e),4*i);return o.sigBytes=4*e,m.create({key:o,iv:s,salt:n})}},C=n.PasswordBasedCipher=x.extend({cfg:x.cfg.extend({kdf:w}),encrypt:function(t,e,i,n){n=this.cfg.extend(n);var r=n.kdf.execute(i,t.keySize,t.ivSize,n.salt,n.hasher);n.iv=r.iv;var a=x.encrypt.call(this,t,e,r.key,n);return a.mixIn(r),a},decrypt:function(t,e,i,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var r=n.kdf.execute(i,t.keySize,t.ivSize,e.salt,n.hasher);n.iv=r.iv;var a=x.decrypt.call(this,t,e,r.key,n);return a}})}()})},19021:function(t,e,i){(function(e,i){t.exports=i()})(0,function(){var t=t||function(t,e){var n;if("undefined"!==typeof window&&window.crypto&&(n=window.crypto),"undefined"!==typeof self&&self.crypto&&(n=self.crypto),"undefined"!==typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!==typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&"undefined"!==typeof i.g&&i.g.crypto&&(n=i.g.crypto),!n)try{n=i(50477)}catch(g){}var r=function(){if(n){if("function"===typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(g){}if("function"===typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(g){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(e){var i;return t.prototype=e,i=new t,t.prototype=null,i}}(),o={},s=o.lib={},l=s.Base=function(){return{extend:function(t){var e=a(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,i){t=this.words=t||[],this.sigBytes=i!=e?i:4*t.length},toString:function(t){return(t||d).stringify(this)},concat:function(t){var e=this.words,i=t.words,n=this.sigBytes,r=t.sigBytes;if(this.clamp(),n%4)for(var a=0;a>>2]>>>24-a%4*8&255;e[n+a>>>2]|=o<<24-(n+a)%4*8}else for(var s=0;s>>2]=i[s>>>2];return this.sigBytes+=r,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=t.ceil(i/4)},clone:function(){var t=l.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],i=0;i>>2]>>>24-r%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new c.init(i,e/2)}},h=u.Latin1={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new c.init(i,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)))}},f=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 i,n=this._data,r=n.words,a=n.sigBytes,o=this.blockSize,s=4*o,l=a/s;l=e?t.ceil(l):t.max((0|l)-this._minBufferSize,0);var u=l*o,d=t.min(4*u,a);if(u){for(var h=0;h>>2]>>>24-a%4*8&255,s=e[a+1>>>2]>>>24-(a+1)%4*8&255,l=e[a+2>>>2]>>>24-(a+2)%4*8&255,c=o<<16|s<<8|l,u=0;u<4&&a+.75*u>>6*(3-u)&63));var d=n.charAt(64);if(d)while(r.length%4)r.push(d);return r.join("")},parse:function(t){var e=t.length,i=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var r=0;r>>6-o%4*2,c=s|l;r[a>>>2]|=c<<24-a%4*8,a++}return n.create(r,a)}}(),t.enc.Base64})},64725:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=e.enc;r.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var i=t.words,n=t.sigBytes,r=e?this._safe_map:this._map;t.clamp();for(var a=[],o=0;o>>2]>>>24-o%4*8&255,l=i[o+1>>>2]>>>24-(o+1)%4*8&255,c=i[o+2>>>2]>>>24-(o+2)%4*8&255,u=s<<16|l<<8|c,d=0;d<4&&o+.75*d>>6*(3-d)&63));var h=r.charAt(64);if(h)while(a.length%4)a.push(h);return a.join("")},parse:function(t,e){void 0===e&&(e=!0);var i=t.length,n=e?this._safe_map:this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o>>6-o%4*2,c=s|l;r[a>>>2]|=c<<24-a%4*8,a++}return n.create(r,a)}}(),t.enc.Base64url})},45503:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=e.enc;r.Utf16=r.Utf16BE={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r>>2]>>>16-r%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var e=t.length,i=[],r=0;r>>1]|=t.charCodeAt(r)<<16-r%2*16;return n.create(i,2*e)}};function a(t){return t<<8&4278255360|t>>>8&16711935}r.Utf16LE={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r>>2]>>>16-r%4*8&65535);n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var e=t.length,i=[],r=0;r>>1]|=a(t.charCodeAt(r)<<16-r%2*16);return n.create(i,2*e)}}}(),t.enc.Utf16})},39506:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(45471),i(51025))})(0,function(t){return function(){var e=t,i=e.lib,n=i.Base,r=i.WordArray,a=e.algo,o=a.MD5,s=a.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var i,n=this.cfg,a=n.hasher.create(),o=r.create(),s=o.words,l=n.keySize,c=n.iterations;while(s.lengthn&&(e=t.finalize(e)),e.clamp();for(var r=this._oKey=e.clone(),o=this._iKey=e.clone(),s=r.words,l=o.words,c=0;c>>2]|=t[n]<<24-n%4*8;r.call(this,i,e)}else r.apply(this,arguments)};a.prototype=n}}(),t.lib.WordArray})},84636:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(e){var i=t,n=i.lib,r=n.WordArray,a=n.Hasher,o=i.algo,s=[];(function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0})();var l=o.MD5=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var i=0;i<16;i++){var n=e+i,r=t[n];t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var a=this._hash.words,o=t[e+0],l=t[e+1],p=t[e+2],f=t[e+3],v=t[e+4],g=t[e+5],m=t[e+6],y=t[e+7],b=t[e+8],x=t[e+9],_=t[e+10],w=t[e+11],C=t[e+12],S=t[e+13],k=t[e+14],A=t[e+15],T=a[0],M=a[1],I=a[2],E=a[3];T=c(T,M,I,E,o,7,s[0]),E=c(E,T,M,I,l,12,s[1]),I=c(I,E,T,M,p,17,s[2]),M=c(M,I,E,T,f,22,s[3]),T=c(T,M,I,E,v,7,s[4]),E=c(E,T,M,I,g,12,s[5]),I=c(I,E,T,M,m,17,s[6]),M=c(M,I,E,T,y,22,s[7]),T=c(T,M,I,E,b,7,s[8]),E=c(E,T,M,I,x,12,s[9]),I=c(I,E,T,M,_,17,s[10]),M=c(M,I,E,T,w,22,s[11]),T=c(T,M,I,E,C,7,s[12]),E=c(E,T,M,I,S,12,s[13]),I=c(I,E,T,M,k,17,s[14]),M=c(M,I,E,T,A,22,s[15]),T=u(T,M,I,E,l,5,s[16]),E=u(E,T,M,I,m,9,s[17]),I=u(I,E,T,M,w,14,s[18]),M=u(M,I,E,T,o,20,s[19]),T=u(T,M,I,E,g,5,s[20]),E=u(E,T,M,I,_,9,s[21]),I=u(I,E,T,M,A,14,s[22]),M=u(M,I,E,T,v,20,s[23]),T=u(T,M,I,E,x,5,s[24]),E=u(E,T,M,I,k,9,s[25]),I=u(I,E,T,M,f,14,s[26]),M=u(M,I,E,T,b,20,s[27]),T=u(T,M,I,E,S,5,s[28]),E=u(E,T,M,I,p,9,s[29]),I=u(I,E,T,M,y,14,s[30]),M=u(M,I,E,T,C,20,s[31]),T=d(T,M,I,E,g,4,s[32]),E=d(E,T,M,I,b,11,s[33]),I=d(I,E,T,M,w,16,s[34]),M=d(M,I,E,T,k,23,s[35]),T=d(T,M,I,E,l,4,s[36]),E=d(E,T,M,I,v,11,s[37]),I=d(I,E,T,M,y,16,s[38]),M=d(M,I,E,T,_,23,s[39]),T=d(T,M,I,E,S,4,s[40]),E=d(E,T,M,I,o,11,s[41]),I=d(I,E,T,M,f,16,s[42]),M=d(M,I,E,T,m,23,s[43]),T=d(T,M,I,E,x,4,s[44]),E=d(E,T,M,I,C,11,s[45]),I=d(I,E,T,M,A,16,s[46]),M=d(M,I,E,T,p,23,s[47]),T=h(T,M,I,E,o,6,s[48]),E=h(E,T,M,I,y,10,s[49]),I=h(I,E,T,M,k,15,s[50]),M=h(M,I,E,T,g,21,s[51]),T=h(T,M,I,E,C,6,s[52]),E=h(E,T,M,I,f,10,s[53]),I=h(I,E,T,M,_,15,s[54]),M=h(M,I,E,T,l,21,s[55]),T=h(T,M,I,E,b,6,s[56]),E=h(E,T,M,I,A,10,s[57]),I=h(I,E,T,M,m,15,s[58]),M=h(M,I,E,T,S,21,s[59]),T=h(T,M,I,E,v,6,s[60]),E=h(E,T,M,I,w,10,s[61]),I=h(I,E,T,M,p,15,s[62]),M=h(M,I,E,T,x,21,s[63]),a[0]=a[0]+T|0,a[1]=a[1]+M|0,a[2]=a[2]+I|0,a[3]=a[3]+E|0},_doFinalize:function(){var t=this._data,i=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;i[r>>>5]|=128<<24-r%32;var a=e.floor(n/4294967296),o=n;i[15+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(i.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=a.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,i,n,r,a,o){var s=t+(e&i|~e&n)+r+o;return(s<>>32-a)+e}function u(t,e,i,n,r,a,o){var s=t+(e&n|i&~n)+r+o;return(s<>>32-a)+e}function d(t,e,i,n,r,a,o){var s=t+(e^i^n)+r+o;return(s<>>32-a)+e}function h(t,e,i,n,r,a,o){var s=t+(i^(e|~n))+r+o;return(s<>>32-a)+e}i.MD5=a._createHelper(l),i.HmacMD5=a._createHmacHelper(l)}(Math),t.MD5})},82169:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function i(t,e,i,n){var r,a=this._iv;a?(r=a.slice(0),this._iv=void 0):r=this._prevBlock,n.encryptBlock(r,0);for(var o=0;o>24&255)){var e=t>>16&255,i=t>>8&255,n=255&t;255===e?(e=0,255===i?(i=0,255===n?n=0:++n):++i):++e,t=0,t+=e<<16,t+=i<<8,t+=n}else t+=1<<24;return t}function n(t){return 0===(t[0]=i(t[0]))&&(t[1]=i(t[1])),t}var r=e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,r=i.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),n(o);var s=o.slice(0);i.encryptBlock(s,0);for(var l=0;l>>2]|=r<<24-a%4*8,t.sigBytes+=r},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923})},54905:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.pad.Iso10126={pad:function(e,i){var n=4*i,r=n-e.sigBytes%n;e.concat(t.lib.WordArray.random(r-1)).concat(t.lib.WordArray.create([r<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126})},10482:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.pad.Iso97971={pad:function(e,i){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,i)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})},58124:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})},52155:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(57165))})(0,function(t){return t.pad.ZeroPadding={pad:function(t,e){var i=4*e;t.clamp(),t.sigBytes+=i-(t.sigBytes%i||i)},unpad:function(t){var e=t.words,i=t.sigBytes-1;for(i=t.sigBytes-1;i>=0;i--)if(e[i>>>2]>>>24-i%4*8&255){t.sigBytes=i+1;break}}},t.pad.ZeroPadding})},70019:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(63009),i(51025))})(0,function(t){return function(){var e=t,i=e.lib,n=i.Base,r=i.WordArray,a=e.algo,o=a.SHA256,s=a.HMAC,l=a.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var i=this.cfg,n=s.create(i.hasher,t),a=r.create(),o=r.create([1]),l=a.words,c=o.words,u=i.keySize,d=i.iterations;while(l.length>>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(var r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(e){var a=e.words,o=a[0],s=a[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(r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(t,e){var i=this._X;c.call(this),a[0]=i[0]^i[5]>>>16^i[3]<<16,a[1]=i[2]^i[7]>>>16^i[5]<<16,a[2]=i[4]^i[1]>>>16^i[7]<<16,a[3]=i[6]^i[3]>>>16^i[1]<<16;for(var n=0;n<4;n++)a[n]=16711935&(a[n]<<8|a[n]>>>24)|4278255360&(a[n]<<24|a[n]>>>8),t[e+n]^=a[n]},blockSize:4,ivSize:2});function c(){for(var t=this._X,e=this._C,i=0;i<8;i++)o[i]=e[i];e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0;for(i=0;i<8;i++){var n=t[i]+e[i],r=65535&n,a=n>>>16,l=((r*r>>>17)+r*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);s[i]=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=n._createHelper(l)}(),t.RabbitLegacy})},96298:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.StreamCipher,r=e.algo,a=[],o=[],s=[],l=r.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,i=0;i<4;i++)t[i]=16711935&(t[i]<<8|t[i]>>>24)|4278255360&(t[i]<<24|t[i]>>>8);var n=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],r=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(i=0;i<4;i++)c.call(this);for(i=0;i<8;i++)r[i]^=n[i+4&7];if(e){var a=e.words,o=a[0],s=a[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;r[0]^=l,r[1]^=d,r[2]^=u,r[3]^=h,r[4]^=l,r[5]^=d,r[6]^=u,r[7]^=h;for(i=0;i<4;i++)c.call(this)}},_doProcessBlock:function(t,e){var i=this._X;c.call(this),a[0]=i[0]^i[5]>>>16^i[3]<<16,a[1]=i[2]^i[7]>>>16^i[5]<<16,a[2]=i[4]^i[1]>>>16^i[7]<<16,a[3]=i[6]^i[3]>>>16^i[1]<<16;for(var n=0;n<4;n++)a[n]=16711935&(a[n]<<8|a[n]>>>24)|4278255360&(a[n]<<24|a[n]>>>8),t[e+n]^=a[n]},blockSize:4,ivSize:2});function c(){for(var t=this._X,e=this._C,i=0;i<8;i++)o[i]=e[i];e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0;for(i=0;i<8;i++){var n=t[i]+e[i],r=65535&n,a=n>>>16,l=((r*r>>>17)+r*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);s[i]=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=n._createHelper(l)}(),t.Rabbit})},77193:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.StreamCipher,r=e.algo,a=r.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,i=t.sigBytes,n=this._S=[],r=0;r<256;r++)n[r]=r;r=0;for(var a=0;r<256;r++){var o=r%i,s=e[o>>>2]>>>24-o%4*8&255;a=(a+n[r]+s)%256;var l=n[r];n[r]=n[a],n[a]=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,i=this._j,n=0,r=0;r<4;r++){e=(e+1)%256,i=(i+t[e])%256;var a=t[e];t[e]=t[i],t[i]=a,n|=t[(t[e]+t[i])%256]<<24-8*r}return this._i=e,this._j=i,n}e.RC4=n._createHelper(a);var s=r.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)o.call(this)}});e.RC4Drop=n._createHelper(s)}(),t.RC4})},78056:function(t,e,i){(function(e,n){t.exports=n(i(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,i=e.lib,n=i.WordArray,r=i.Hasher,a=e.algo,o=n.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=n.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=n.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=n.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=n.create([0,1518500249,1859775393,2400959708,2840853838]),d=n.create([1352829926,1548603684,1836072691,2053994217,0]),h=a.RIPEMD160=r.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var i=0;i<16;i++){var n=e+i,r=t[n];t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var a,h,b,x,_,w,C,S,k,A,T,M=this._hash.words,I=u.words,E=d.words,D=o.words,P=s.words,L=l.words,R=c.words;w=a=M[0],C=h=M[1],S=b=M[2],k=x=M[3],A=_=M[4];for(i=0;i<80;i+=1)T=a+t[e+D[i]]|0,T+=i<16?p(h,b,x)+I[0]:i<32?f(h,b,x)+I[1]:i<48?v(h,b,x)+I[2]:i<64?g(h,b,x)+I[3]:m(h,b,x)+I[4],T|=0,T=y(T,L[i]),T=T+_|0,a=_,_=x,x=y(b,10),b=h,h=T,T=w+t[e+P[i]]|0,T+=i<16?m(C,S,k)+E[0]:i<32?g(C,S,k)+E[1]:i<48?v(C,S,k)+E[2]:i<64?f(C,S,k)+E[3]:p(C,S,k)+E[4],T|=0,T=y(T,R[i]),T=T+A|0,w=A,A=k,k=y(S,10),S=C,C=T;T=M[1]+b+k|0,M[1]=M[2]+x+A|0,M[2]=M[3]+_+w|0,M[3]=M[4]+a+C|0,M[4]=M[0]+h+S|0,M[0]=T},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(e.length+1),this._process();for(var r=this._hash,a=r.words,o=0;o<5;o++){var s=a[o];a[o]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return r},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function p(t,e,i){return t^e^i}function f(t,e,i){return t&e|~t&i}function v(t,e,i){return(t|~e)^i}function g(t,e,i){return t&i|e&~i}function m(t,e,i){return t^(e|~i)}function y(t,e){return t<>>32-e}e.RIPEMD160=r._createHelper(h),e.HmacRIPEMD160=r._createHmacHelper(h)}(Math),t.RIPEMD160})},45471:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=i.Hasher,a=e.algo,o=[],s=a.SHA1=r.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var i=this._hash.words,n=i[0],r=i[1],a=i[2],s=i[3],l=i[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=(n<<5|n>>>27)+l+o[c];d+=c<20?1518500249+(r&a|~r&s):c<40?1859775393+(r^a^s):c<60?(r&a|r&s|a&s)-1894007588:(r^a^s)-899497514,l=s,s=a,a=r<<30|r>>>2,r=n,n=d}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+a|0,i[3]=i[3]+s|0,i[4]=i[4]+l|0},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(i/4294967296),e[15+(n+64>>>9<<4)]=i,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA1=r._createHelper(s),e.HmacSHA1=r._createHmacHelper(s)}(),t.SHA1})},36308:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(63009))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=e.algo,a=r.SHA256,o=r.SHA224=a.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=4,t}});e.SHA224=a._createHelper(o),e.HmacSHA224=a._createHmacHelper(o)}(),t.SHA224})},63009:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(e){var i=t,n=i.lib,r=n.WordArray,a=n.Hasher,o=i.algo,s=[],l=[];(function(){function t(t){for(var i=e.sqrt(t),n=2;n<=i;n++)if(!(t%n))return!1;return!0}function i(t){return 4294967296*(t-(0|t))|0}var n=2,r=0;while(r<64)t(n)&&(r<8&&(s[r]=i(e.pow(n,.5))),l[r]=i(e.pow(n,1/3)),r++),n++})();var c=[],u=o.SHA256=a.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(t,e){for(var i=this._hash.words,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],u=i[5],d=i[6],h=i[7],p=0;p<64;p++){if(p<16)c[p]=0|t[e+p];else{var f=c[p-15],v=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=c[p-2],m=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[p]=v+c[p-7]+m+c[p-16]}var y=s&u^~s&d,b=n&r^n&a^r&a,x=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=(s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25),w=h+_+y+l[p]+c[p],C=x+b;h=d,d=u,u=s,s=o+w|0,o=a,a=r,r=n,n=w+C|0}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+a|0,i[3]=i[3]+o|0,i[4]=i[4]+s|0,i[5]=i[5]+u|0,i[6]=i[6]+d|0,i[7]=i[7]+h|0},_doFinalize:function(){var t=this._data,i=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(n/4294967296),i[15+(r+64>>>9<<4)]=n,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var t=a.clone.call(this);return t._hash=this._hash.clone(),t}});i.SHA256=a._createHelper(u),i.HmacSHA256=a._createHmacHelper(u)}(Math),t.SHA256})},45953:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(43240))})(0,function(t){return function(e){var i=t,n=i.lib,r=n.WordArray,a=n.Hasher,o=i.x64,s=o.Word,l=i.algo,c=[],u=[],d=[];(function(){for(var t=1,e=0,i=0;i<24;i++){c[t+5*e]=(i+1)*(i+2)/2%64;var n=e%5,r=(2*t+3*e)%5;t=n,e=r}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 a=1,o=0;o<24;o++){for(var l=0,h=0,p=0;p<7;p++){if(1&a){var f=(1<>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8);var s=i[r];s.high^=o,s.low^=a}for(var l=0;l<24;l++){for(var p=0;p<5;p++){for(var f=0,v=0,g=0;g<5;g++){s=i[p+5*g];f^=s.high,v^=s.low}var m=h[p];m.high=f,m.low=v}for(p=0;p<5;p++){var y=h[(p+4)%5],b=h[(p+1)%5],x=b.high,_=b.low;for(f=y.high^(x<<1|_>>>31),v=y.low^(_<<1|x>>>31),g=0;g<5;g++){s=i[p+5*g];s.high^=f,s.low^=v}}for(var w=1;w<25;w++){s=i[w];var C=s.high,S=s.low,k=c[w];k<32?(f=C<>>32-k,v=S<>>32-k):(f=S<>>64-k,v=C<>>64-k);var A=h[u[w]];A.high=f,A.low=v}var T=h[0],M=i[0];T.high=M.high,T.low=M.low;for(p=0;p<5;p++)for(g=0;g<5;g++){w=p+5*g,s=i[w];var I=h[w],E=h[(p+1)%5+5*g],D=h[(p+2)%5+5*g];s.high=I.high^~E.high&D.high,s.low=I.low^~E.low&D.low}s=i[0];var P=d[l];s.high^=P.high,s.low^=P.low}},_doFinalize:function(){var t=this._data,i=t.words,n=(this._nDataBytes,8*t.sigBytes),a=32*this.blockSize;i[n>>>5]|=1<<24-n%32,i[(e.ceil((n+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,l=s/8,c=[],u=0;u>>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 r.init(c,s)},clone:function(){for(var t=a.clone.call(this),e=t._state=this._state.slice(0),i=0;i<25;i++)e[i]=e[i].clone();return t}});i.SHA3=a._createHelper(p),i.HmacSHA3=a._createHmacHelper(p)}(Math),t.SHA3})},89557:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(43240),i(81380))})(0,function(t){return function(){var e=t,i=e.x64,n=i.Word,r=i.WordArray,a=e.algo,o=a.SHA512,s=a.SHA384=o.extend({_doReset:function(){this._hash=new r.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.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,i){(function(e,n){t.exports=n(i(19021),i(43240))})(0,function(t){return function(){var e=t,i=e.lib,n=i.Hasher,r=e.x64,a=r.Word,o=r.WordArray,s=e.algo;function l(){return a.create.apply(a,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=n.extend({_doReset:function(){this._hash=new o.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var i=this._hash.words,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],l=i[5],d=i[6],h=i[7],p=n.high,f=n.low,v=r.high,g=r.low,m=a.high,y=a.low,b=o.high,x=o.low,_=s.high,w=s.low,C=l.high,S=l.low,k=d.high,A=d.low,T=h.high,M=h.low,I=p,E=f,D=v,P=g,L=m,R=y,F=b,B=x,N=_,O=w,z=C,W=S,V=k,$=A,H=T,K=M,Y=0;Y<80;Y++){var X,U,G=u[Y];if(Y<16)U=G.high=0|t[e+2*Y],X=G.low=0|t[e+2*Y+1];else{var j=u[Y-15],q=j.high,Z=j.low,J=(q>>>1|Z<<31)^(q>>>8|Z<<24)^q>>>7,Q=(Z>>>1|q<<31)^(Z>>>8|q<<24)^(Z>>>7|q<<25),tt=u[Y-2],et=tt.high,it=tt.low,nt=(et>>>19|it<<13)^(et<<3|it>>>29)^et>>>6,rt=(it>>>19|et<<13)^(it<<3|et>>>29)^(it>>>6|et<<26),at=u[Y-7],ot=at.high,st=at.low,lt=u[Y-16],ct=lt.high,ut=lt.low;X=Q+st,U=J+ot+(X>>>0>>0?1:0),X+=rt,U=U+nt+(X>>>0>>0?1:0),X+=ut,U=U+ct+(X>>>0>>0?1:0),G.high=U,G.low=X}var dt=N&z^~N&V,ht=O&W^~O&$,pt=I&D^I&L^D&L,ft=E&P^E&R^P&R,vt=(I>>>28|E<<4)^(I<<30|E>>>2)^(I<<25|E>>>7),gt=(E>>>28|I<<4)^(E<<30|I>>>2)^(E<<25|I>>>7),mt=(N>>>14|O<<18)^(N>>>18|O<<14)^(N<<23|O>>>9),yt=(O>>>14|N<<18)^(O>>>18|N<<14)^(O<<23|N>>>9),bt=c[Y],xt=bt.high,_t=bt.low,wt=K+yt,Ct=H+mt+(wt>>>0>>0?1:0),St=(wt=wt+ht,Ct=Ct+dt+(wt>>>0>>0?1:0),wt=wt+_t,Ct=Ct+xt+(wt>>>0<_t>>>0?1:0),wt=wt+X,Ct=Ct+U+(wt>>>0>>0?1:0),gt+ft),kt=vt+pt+(St>>>0>>0?1:0);H=V,K=$,V=z,$=W,z=N,W=O,O=B+wt|0,N=F+Ct+(O>>>0>>0?1:0)|0,F=L,B=R,L=D,R=P,D=I,P=E,E=wt+St|0,I=Ct+kt+(E>>>0>>0?1:0)|0}f=n.low=f+E,n.high=p+I+(f>>>0>>0?1:0),g=r.low=g+P,r.high=v+D+(g>>>0

>>0?1:0),y=a.low=y+R,a.high=m+L+(y>>>0>>0?1:0),x=o.low=x+B,o.high=b+F+(x>>>0>>0?1:0),w=s.low=w+O,s.high=_+N+(w>>>0>>0?1:0),S=l.low=S+W,l.high=C+z+(S>>>0>>0?1:0),A=d.low=A+$,d.high=k+V+(A>>>0<$>>>0?1:0),M=h.low=M+K,h.high=T+H+(M>>>0>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;e[n>>>5]|=128<<24-n%32,e[30+(n+128>>>10<<5)]=Math.floor(i/4294967296),e[31+(n+128>>>10<<5)]=i,t.sigBytes=4*e.length,this._process();var r=this._hash.toX32();return r},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=n._createHelper(d),e.HmacSHA512=n._createHmacHelper(d)}(),t.SHA512})},7628:function(t,e,i){(function(e,n){t.exports=n(i(19021),i(80754),i(84636),i(39506),i(57165))})(0,function(t){return function(){var e=t,i=e.lib,n=i.WordArray,r=i.BlockCipher,a=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=a.DES=r.extend({_doReset:function(){for(var t=this._key,e=t.words,i=[],n=0;n<56;n++){var r=o[n]-1;i[n]=e[r>>>5]>>>31-r%32&1}for(var a=this._subKeys=[],c=0;c<16;c++){var u=a[c]=[],d=l[c];for(n=0;n<24;n++)u[n/6|0]|=i[(s[n]-1+d)%28]<<31-n%6,u[4+(n/6|0)]|=i[28+(s[n+24]-1+d)%28]<<31-n%6;u[0]=u[0]<<1|u[0]>>>31;for(n=1;n<7;n++)u[n]=u[n]>>>4*(n-1)+3;u[7]=u[7]<<5|u[7]>>>27}var h=this._invSubKeys=[];for(n=0;n<16;n++)h[n]=a[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,i){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 n=0;n<16;n++){for(var r=i[n],a=this._lBlock,o=this._rBlock,s=0,l=0;l<8;l++)s|=c[l][((o^r[l])&u[l])>>>0];this._lBlock=o,this._rBlock=a^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 i=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=i,this._lBlock^=i<>>t^this._lBlock)&e;this._lBlock^=i,this._rBlock^=i<192.");var i=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),a=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(i)),this._des2=d.createEncryptor(n.create(r)),this._des3=d.createEncryptor(n.create(a))},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=r._createHelper(f)}(),t.TripleDES})},43240:function(t,e,i){(function(e,n){t.exports=n(i(19021))})(0,function(t){return function(e){var i=t,n=i.lib,r=n.Base,a=n.WordArray,o=i.x64={};o.Word=r.extend({init:function(t,e){this.high=t,this.low=e}}),o.WordArray=r.extend({init:function(t,i){t=this.words=t||[],this.sigBytes=i!=e?i:8*t.length},toX32:function(){for(var t=this.words,e=t.length,i=[],n=0;n