"use strict";(self["webpackChunksanyue_imghub"]=self["webpackChunksanyue_imghub"]||[]).push([[535],{2893:function(t,e,s){s(85331)},3261:function(t,e,s){s(85331)},4885:function(t,e,s){s(85331)},5802:function(t,e,s){s(85331),s(38736),s(213),s(85970)},13535:function(t,e,s){s.r(e),s.d(e,{default:function(){return Yg}});var i=s(56768),n=s(24232);const a={class:"menu-list"},o=["onClick"],l={class:"menu-text"};function r(t,e,s,r,d,c){const h=(0,i.g2)("font-awesome-icon");return(0,i.uX)(),(0,i.CE)("div",{class:(0,n.C4)(["sidebar-container",{"is-collapsed":s.isCollapse}]),ref:"sidebar",style:(0,n.Tr)(c.sidebarStyle)},[(0,i.Lk)("div",a,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(d.menuItems,e=>((0,i.uX)(),(0,i.CE)("div",{key:e.index,class:(0,n.C4)(["menu-item",{"is-active":s.activeIndex===e.index}]),onClick:t=>c.handleSelect(e.index)},[(0,i.bF)(h,{icon:e.icon,class:"menu-icon"},null,8,["icon"]),(0,i.Lk)("span",l,(0,n.v_)(t.$t(e.titleKey)),1)],10,o))),128))]),(0,i.Lk)("div",{class:"toggle-button",onClick:e[0]||(e[0]=(...t)=>c.toggleCollapse&&c.toggleCollapse(...t))},[(0,i.bF)(h,{icon:s.isCollapse?"angle-double-right":"angle-double-left"},null,8,["icon"])])],6)}var d={name:"SysConfigTabs",props:{activeIndex:{type:String,default:"status"},isCollapse:{type:Boolean,default:!1}},data(){return{expandedWidth:null,menuItems:[{index:"status",icon:"chart-bar",titleKey:"sysConfigTabs.systemStatus"},{index:"upload",icon:"cloud-upload",titleKey:"sysConfigTabs.uploadSettings"},{index:"security",icon:"shield",titleKey:"sysConfigTabs.securitySettings"},{index:"page",icon:"pager",titleKey:"sysConfigTabs.pageSettings"},{index:"others",icon:"cog",titleKey:"sysConfigTabs.otherSettings"}]}},computed:{collapsedWidth(){return window.innerWidth<=768?50:56},sidebarStyle(){return this.isCollapse?{width:this.collapsedWidth+"px"}:this.expandedWidth?{width:this.expandedWidth+"px"}:{}}},watch:{"$i18n.locale"(){this.$nextTick(()=>this.measureWidth())}},methods:{toggleCollapse(){this.$emit("update:isCollapse",!this.isCollapse)},checkMobile(){const t=window.innerWidth<=768;this.$emit("update:isCollapse",t)},handleSelect(t){this.$emit("update:activeIndex",t)},measureWidth(){const t=this.$refs.sidebar;if(!t)return;const e=t.style.width,s=t.style.transition,i=t.classList.contains("is-collapsed");t.style.transition="none",i&&t.classList.remove("is-collapsed"),t.style.width="auto",t.offsetWidth;const n=t.scrollWidth;t.style.width=e,i&&t.classList.add("is-collapsed"),t.offsetWidth,t.style.transition=s,this.expandedWidth=n}},mounted(){this.checkMobile(),this.$nextTick(()=>this.measureWidth()),window.addEventListener("resize",this.checkMobile)},beforeDestroy(){window.removeEventListener("resize",this.checkMobile)}},c=s(71241);const h=(0,c.A)(d,[["render",r],["__scopeId","data-v-2718059d"]]);var u=h,p=s(54880),g=(s(85331),s(77128),s(78507)),f=(s(213),s(38273));const m={class:"container"},b={class:"header-content"},y={class:"header-action"};function x(t,e,s,a,o,l){const r=f.A,d=(0,i.g2)("font-awesome-icon"),c=g.R7,h=p.bZ,x=u;return(0,i.uX)(),(0,i.CE)("div",m,[(0,i.bF)(h,null,{default:(0,i.k6)(()=>[(0,i.Lk)("div",b,[(0,i.bF)(r,{activeTab:"systemConfig"}),(0,i.Lk)("div",y,[(0,i.bF)(c,{disabled:l.disableTooltip,content:t.$t("sysConfig.logout"),placement:"bottom"},{default:(0,i.k6)(()=>[(0,i.bF)(d,{icon:"sign-out-alt",class:"header-icon",onClick:l.handleLogout},null,8,["onClick"])]),_:1},8,["disabled","content"])])])]),_:1}),(0,i.bF)(x,{activeIndex:o.activeIndex,"onUpdate:activeIndex":e[0]||(e[0]=t=>o.activeIndex=t),isCollapse:o.isSidebarCollapse,"onUpdate:isCollapse":e[1]||(e[1]=t=>o.isSidebarCollapse=t)},null,8,["activeIndex","isCollapse"]),((0,i.uX)(),(0,i.Wv)((0,i.$y)(l.currentComponent),{class:(0,n.C4)(["main-container",{collapsed:o.isSidebarCollapse}])},null,8,["class"]))])}s(44114);var v=s(99114),_=(s(30694),s(57009)),k=(s(78450),s(69655)),w=(s(2893),s(9267)),C=(s(15616),s(45130));const S={class:"date-range-calendar"},F={class:"selected-range"},T={class:"selected-range-inputs"},P=["aria-label"],M={class:"date-range-separator"},D=["aria-label"],A={class:"calendar-header"},$=["aria-label"],V={class:"calendar-title"},L=["aria-label"],E={class:"calendar-weekdays"},I={class:"calendar-grid"},U=["onClick"];function O(t,e,s,a,o,l){const r=(0,i.g2)("font-awesome-icon");return(0,i.uX)(),(0,i.CE)("div",S,[(0,i.Lk)("div",F,[(0,i.Lk)("div",T,[(0,i.bo)((0,i.Lk)("input",{"onUpdate:modelValue":e[0]||(e[0]=t=>o.inputStart=t),class:"date-input",type:"text",inputmode:"numeric","aria-label":l.startDateLabel,onChange:e[1]||(e[1]=(...t)=>l.handleManualInput&&l.handleManualInput(...t))},null,40,P),[[C.Jo,o.inputStart,void 0,{trim:!0}]]),(0,i.Lk)("span",M,(0,n.v_)(l.rangeSeparator),1),(0,i.bo)((0,i.Lk)("input",{"onUpdate:modelValue":e[2]||(e[2]=t=>o.inputEnd=t),class:"date-input",type:"text",inputmode:"numeric","aria-label":l.endDateLabel,onChange:e[3]||(e[3]=(...t)=>l.handleManualInput&&l.handleManualInput(...t))},null,40,D),[[C.Jo,o.inputEnd,void 0,{trim:!0}]])])]),(0,i.Lk)("div",A,[(0,i.Lk)("button",{type:"button",class:"calendar-nav","aria-label":l.previousMonthLabel,onClick:e[4]||(e[4]=(...t)=>l.goToPreviousMonth&&l.goToPreviousMonth(...t))},[(0,i.bF)(r,{icon:"chevron-left"})],8,$),(0,i.Lk)("div",V,(0,n.v_)(l.monthTitle),1),(0,i.Lk)("button",{type:"button",class:"calendar-nav","aria-label":l.nextMonthLabel,onClick:e[5]||(e[5]=(...t)=>l.goToNextMonth&&l.goToNextMonth(...t))},[(0,i.bF)(r,{icon:"chevron-right"})],8,L)]),(0,i.Lk)("div",E,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(l.weekdayLabels,t=>((0,i.uX)(),(0,i.CE)("span",{key:t},(0,n.v_)(t),1))),128))]),(0,i.Lk)("div",I,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(l.calendarDays,t=>((0,i.uX)(),(0,i.CE)("button",{key:t.key,type:"button",class:(0,n.C4)(["calendar-day",{"is-muted":!t.isCurrentMonth,"is-today":t.isToday,"is-range-start":t.key===o.draftStart,"is-range-end":t.key===o.draftEnd,"is-in-range":l.isInRange(t.key)}]),onClick:e=>l.selectDay(t.key)},(0,n.v_)(t.dayOfMonth),11,U))),128))])])}const R=864e5;function W(t){return String(t).padStart(2,"0")}function B(t){return`${t.getFullYear()}-${W(t.getMonth()+1)}-${W(t.getDate())}`}function N(t){if("string"!==typeof t)return null;const e=t.trim().match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/);if(!e)return null;const s=Number(e[1]),i=Number(e[2])-1,n=Number(e[3]),a=new Date(s,i,n);return a.getFullYear()!==s||a.getMonth()!==i||a.getDate()!==n?null:(a.setHours(0,0,0,0),a)}function z(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}var j={name:"DateRangeCalendar",props:{modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue","change"],data(){const t=new Date;return t.setHours(0,0,0,0),{displayYear:t.getFullYear(),displayMonth:t.getMonth(),draftStart:"",draftEnd:"",inputStart:"",inputEnd:"",awaitingEnd:!1}},computed:{previousMonthLabel(){return this.$t("dateRangeCalendar.previousMonth")},nextMonthLabel(){return this.$t("dateRangeCalendar.nextMonth")},startDateLabel(){return this.$t("dateRangeCalendar.startDate")},endDateLabel(){return this.$t("dateRangeCalendar.endDate")},rangeSeparator(){return this.$t("dateRangeCalendar.rangeSeparator")},monthTitle(){return this.$t("dateRangeCalendar.monthTitle",{year:this.displayYear,month:W(this.displayMonth+1)})},weekdayLabels(){return[this.$t("dateRangeCalendar.weekdaySun"),this.$t("dateRangeCalendar.weekdayMon"),this.$t("dateRangeCalendar.weekdayTue"),this.$t("dateRangeCalendar.weekdayWed"),this.$t("dateRangeCalendar.weekdayThu"),this.$t("dateRangeCalendar.weekdayFri"),this.$t("dateRangeCalendar.weekdaySat")]},calendarDays(){const t=new Date(this.displayYear,this.displayMonth,1),e=new Date(this.displayYear,this.displayMonth,1-t.getDay()),s=B(new Date);return Array.from({length:42},(t,i)=>{const n=new Date(e.getTime()+i*R),a=B(n);return{key:a,dayOfMonth:n.getDate(),isCurrentMonth:n.getMonth()===this.displayMonth,isToday:a===s}})}},watch:{modelValue:{immediate:!0,handler(t){this.syncFromModel(t)}}},methods:{syncFromModel(t){const e=N(t?.[0]),s=N(t?.[1]);this.draftStart=e?B(e):"",this.draftEnd=s?B(s):"",this.inputStart=this.draftStart,this.inputEnd=this.draftEnd,this.awaitingEnd=!1;const i=e||s;i&&(this.displayYear=i.getFullYear(),this.displayMonth=i.getMonth())},goToPreviousMonth(){const t=z(new Date(this.displayYear,this.displayMonth,1),-1);this.displayYear=t.getFullYear(),this.displayMonth=t.getMonth()},goToNextMonth(){const t=z(new Date(this.displayYear,this.displayMonth,1),1);this.displayYear=t.getFullYear(),this.displayMonth=t.getMonth()},selectDay(t){if(!this.draftStart||this.draftEnd||!this.awaitingEnd)return this.draftStart=t,this.draftEnd="",this.inputStart=t,this.inputEnd="",void(this.awaitingEnd=!0);const e=tthis.draftStart&&tl.fetchIndexInfo&&l.fetchIndexInfo(...t))},[(0,i.Lk)("div",G,[(0,i.bF)(r,{icon:"database"})]),(0,i.Lk)("div",J,[(0,i.Lk)("div",Z,(0,n.v_)(t.$t("sysStatus.totalFiles")),1),(0,i.Lk)("div",tt,(0,n.v_)(o.indexInfo.totalFiles?.toLocaleString()||"0"),1),(0,i.Lk)("div",et,(0,n.v_)(t.$t("sysStatus.clickToRefresh")),1)])]),(0,i.Lk)("div",st,[(0,i.Lk)("div",it,[(0,i.bF)(r,{icon:"clock"})]),(0,i.Lk)("div",nt,[(0,i.Lk)("div",at,(0,n.v_)(t.$t("sysStatus.indexUpdateTime")),1),(0,i.Lk)("div",ot,(0,n.v_)(l.formatTime(o.indexInfo.lastUpdated)),1),(0,i.Lk)("div",lt,(0,n.v_)(l.getTimeAgo(o.indexInfo.lastUpdated)),1)])]),(0,i.Lk)("div",{class:"overview-card system-version",onClick:e[1]||(e[1]=(...t)=>l.openReleases&&l.openReleases(...t))},[(0,i.Lk)("div",rt,[(0,i.bF)(r,{icon:"code-branch"})]),(0,i.Lk)("div",dt,[(0,i.Lk)("div",ct,(0,n.v_)(t.$t("sysStatus.systemVersion")),1),(0,i.Lk)("div",ht,"v"+(0,n.v_)(o.version),1),(0,i.Lk)("div",ut,(0,n.v_)(t.$t("sysStatus.clickToViewChangelog")),1)])])]),(0,i.Lk)("div",pt,[(0,i.Lk)("div",gt,[(0,i.Lk)("div",ft,[(0,i.Lk)("div",mt,[(0,i.bF)(r,{icon:"chart-line"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysStatus.uploadTrend")),1),(0,i.bF)(d,{class:"trend-calendar-btn",circle:"","aria-label":t.$t("sysStatus.selectDateRange"),onClick:l.openTrendDateDialog},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"calendar"})]),_:1},8,["aria-label","onClick"])]),(0,i.Lk)("div",bt,[(0,i.bF)(h,{modelValue:o.trendGroupBy,"onUpdate:modelValue":e[2]||(e[2]=t=>o.trendGroupBy=t),size:"small",class:"trend-group-switch","aria-label":t.$t("sysStatus.uploadTrendGroupBy")},{default:(0,i.k6)(()=>[(0,i.bF)(c,{label:"channel"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysStatus.byChannelType")),1)]),_:1}),(0,i.bF)(c,{label:"channelName"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysStatus.byChannelName")),1)]),_:1})]),_:1},8,["modelValue","aria-label"])])]),(0,i.bF)(p,{modelValue:o.trendDatePickerVisible,"onUpdate:modelValue":e[4]||(e[4]=t=>o.trendDatePickerVisible=t),title:t.$t("sysStatus.selectDateRange"),width:l.trendDateDialogWidth,class:"trend-date-dialog","align-center":"","append-to-body":""},{default:(0,i.k6)(()=>[(0,i.Lk)("div",yt,[(0,i.bF)(u,{modelValue:o.trendDateRange,"onUpdate:modelValue":e[3]||(e[3]=t=>o.trendDateRange=t),onChange:l.handleTrendDateRangeChange},null,8,["modelValue","onChange"])])]),_:1},8,["modelValue","title","width"]),(0,i.Lk)("div",xt,[l.hasTrendData?((0,i.uX)(),(0,i.CE)("div",_t,[(0,i.bF)(f,{data:l.uploadTrendChartData,options:l.lineChartOptions},null,8,["data","options"])])):((0,i.uX)(),(0,i.CE)("div",vt,[(0,i.bF)(r,{icon:"inbox"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysStatus.noData")),1)]))])]),(0,i.Lk)("div",kt,[(0,i.Lk)("div",wt,[(0,i.bF)(r,{icon:"share-alt"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysStatus.channelDistribution")),1)]),(0,i.Lk)("div",Ct,[0===Object.keys(o.indexInfo.channelStats||{}).length?((0,i.uX)(),(0,i.CE)("div",St,[(0,i.bF)(r,{icon:"inbox"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysStatus.noData")),1)])):((0,i.uX)(),(0,i.CE)("div",Ft,[(0,i.Lk)("div",Tt,[(0,i.bF)(m,{data:l.channelChartData,options:l.chartOptions},null,8,["data","options"]),(0,i.Lk)("div",Pt,[(0,i.Lk)("div",Mt,(0,n.v_)(o.indexInfo.totalFiles?.toLocaleString()||"0"),1),(0,i.Lk)("div",Dt,(0,n.v_)(t.$t("sysStatus.totalFilesLabel")),1)])]),(0,i.Lk)("div",At,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(o.indexInfo.channelStats,(t,e,s)=>((0,i.uX)(),(0,i.CE)("div",{key:e,class:"legend-item"},[(0,i.Lk)("span",{class:"legend-color",style:(0,n.Tr)({background:l.getChartColor(s)})},null,4),(0,i.Lk)("span",$t,(0,n.v_)(e),1),(0,i.Lk)("span",Vt,(0,n.v_)(t.toLocaleString()),1),(0,i.Lk)("span",Lt,(0,n.v_)(l.getPercentage(t,o.indexInfo.totalFiles))+"%",1)]))),128))])]))])]),(0,i.Lk)("div",Et,[(0,i.Lk)("div",It,[(0,i.bF)(r,{icon:"file-alt"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysStatus.fileStatusDistribution")),1)]),(0,i.Lk)("div",Ut,[0===Object.keys(o.indexInfo.typeStats||{}).length?((0,i.uX)(),(0,i.CE)("div",Ot,[(0,i.bF)(r,{icon:"inbox"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysStatus.noData")),1)])):((0,i.uX)(),(0,i.CE)("div",Rt,[(0,i.Lk)("div",Wt,[(0,i.bF)(m,{data:l.typeChartData,options:l.chartOptions},null,8,["data","options"]),(0,i.Lk)("div",Bt,[(0,i.Lk)("div",Nt,(0,n.v_)(Object.keys(o.indexInfo.typeStats).length),1),(0,i.Lk)("div",zt,(0,n.v_)(t.$t("sysStatus.statusTypes")),1)])]),(0,i.Lk)("div",jt,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(l.aggregatedTypeStats,(t,e,s)=>((0,i.uX)(),(0,i.CE)("div",{key:e,class:"legend-item"},[(0,i.Lk)("span",{class:"legend-color",style:(0,n.Tr)({background:l.getTypeChartColor(s)})},null,4),(0,i.Lk)("span",qt,(0,n.v_)(e),1),(0,i.Lk)("span",Ht,(0,n.v_)(t.toLocaleString()),1),(0,i.Lk)("span",Xt,(0,n.v_)(l.getPercentage(t,o.indexInfo.totalFiles))+"%",1)]))),128))])]))])])]),(0,i.Lk)("div",Kt,[(0,i.Lk)("div",Qt,[(0,i.Lk)("div",Yt,[(0,i.bF)(r,{icon:"tools"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysStatus.systemMaintenance")),1)]),(0,i.Lk)("div",Gt,[o.isProcessing?((0,i.uX)(),(0,i.CE)("div",Jt,[(0,i.Lk)("div",Zt,[(0,i.Lk)("span",te,(0,n.v_)(l.phaseDescription),1),(0,i.Lk)("span",ee,(0,n.v_)(Math.round(o.processingProgress.percentage))+"%",1)]),(0,i.bF)(b,{percentage:o.processingProgress.percentage,"stroke-width":12,"show-text":!1,class:"progress-bar"},null,8,["percentage"]),(0,i.Lk)("div",se,[o.processingProgress.current>0?((0,i.uX)(),(0,i.CE)("span",ie,[(0,i.bF)(r,{icon:"file-alt"}),(0,i.eW)(" "+(0,n.v_)(o.processingProgress.current.toLocaleString())+" ",1),o.processingProgress.total>0?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.eW)(" / "+(0,n.v_)(o.processingProgress.total.toLocaleString()),1)],64)):(0,i.Q3)("",!0),(0,i.eW)(" "+(0,n.v_)(t.$t("sysStatus.records")),1)])):(0,i.Q3)("",!0),l.estimatedTimeRemaining?((0,i.uX)(),(0,i.CE)("span",ne,[(0,i.bF)(r,{icon:"clock"}),(0,i.eW)(" "+(0,n.v_)(l.estimatedTimeRemaining),1)])):(0,i.Q3)("",!0)]),o.processingProgress.message?((0,i.uX)(),(0,i.CE)("div",ae,(0,n.v_)(o.processingProgress.message),1)):(0,i.Q3)("",!0),(0,i.bF)(d,{type:"danger",plain:"",size:"small",onClick:l.cancelOperation,class:"cancel-btn"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"times"}),(0,i.eW)(" "+(0,n.v_)(t.$t("sysStatus.cancelOperation")),1)]),_:1},8,["onClick"])])):o.processingError?((0,i.uX)(),(0,i.CE)("div",oe,[(0,i.Lk)("div",le,[(0,i.bF)(r,{icon:"exclamation-triangle"})]),(0,i.Lk)("div",re,[(0,i.Lk)("div",de,(0,n.v_)(o.processingError.message),1),o.processingError.suggestion?((0,i.uX)(),(0,i.CE)("div",ce,(0,n.v_)(o.processingError.suggestion),1)):(0,i.Q3)("",!0)]),(0,i.Lk)("div",he,[o.processingError.recoverable?((0,i.uX)(),(0,i.Wv)(d,{key:0,type:"primary",size:"small",onClick:l.retryOperation},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"redo"}),(0,i.eW)(" "+(0,n.v_)(t.$t("sysStatus.retry")),1)]),_:1},8,["onClick"])):(0,i.Q3)("",!0),(0,i.bF)(d,{type:"default",size:"small",onClick:l.dismissError},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysStatus.close")),1)]),_:1},8,["onClick"])])])):((0,i.uX)(),(0,i.CE)("div",ue,[(0,i.bF)(y,{content:t.$t("sysStatus.rebuildTooltip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(d,{type:"primary",loading:o.rebuilding,disabled:o.isProcessing,onClick:l.rebuildIndex,class:"action-btn rebuild-btn"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"sync-alt"}),(0,i.eW)(" "+(0,n.v_)(o.rebuilding?t.$t("sysStatus.rebuilding"):t.$t("sysStatus.rebuildIndex")),1)]),_:1},8,["loading","disabled","onClick"])]),_:1},8,["content"]),(0,i.bF)(y,{content:t.$t("sysStatus.backupTooltip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(d,{type:"success",loading:o.backing,disabled:o.isProcessing,onClick:l.backupData,class:"action-btn backup-btn"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"download"}),(0,i.eW)(" "+(0,n.v_)(o.backing?t.$t("sysStatus.backingUp"):t.$t("sysStatus.backupData")),1)]),_:1},8,["loading","disabled","onClick"])]),_:1},8,["content"]),(0,i.bF)(y,{content:t.$t("sysStatus.restoreTooltip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.Lk)("div",pe,[(0,i.Lk)("input",{type:"file",ref:"fileInput",accept:".json",onChange:e[5]||(e[5]=(...t)=>l.handleFileSelect&&l.handleFileSelect(...t)),style:{display:"none"}},null,544),(0,i.bF)(d,{type:"warning",loading:o.restoring,disabled:o.isProcessing,onClick:l.selectRestoreFile,class:"action-btn restore-btn"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"upload"}),(0,i.eW)(" "+(0,n.v_)(o.restoring?t.$t("sysStatus.restoring"):t.$t("sysStatus.restoreData")),1)]),_:1},8,["loading","disabled","onClick"])])]),_:1},8,["content"])]))])])]),o.indexInfo.newestFile||o.indexInfo.oldestFile?((0,i.uX)(),(0,i.CE)("div",ge,[o.indexInfo.newestFile?((0,i.uX)(),(0,i.CE)("div",{key:0,class:"file-info-card info-card-newest",onClick:e[8]||(e[8]=t=>l.openFileInNewTab(o.indexInfo.newestFile))},[l.isImageFile(o.indexInfo.newestFile)&&!o.loadErrors["newest"]?((0,i.uX)(),(0,i.Wv)(x,{key:0,src:"/file/"+o.indexInfo.newestFile.id+"?from=admin",fit:"cover",class:"card-bg-media",onError:e[6]||(e[6]=t=>l.handleImageError("newest"))},null,8,["src"])):l.isVideoFile(o.indexInfo.newestFile)&&!o.loadErrors["newest"]?((0,i.uX)(),(0,i.CE)("video",{key:1,src:"/file/"+o.indexInfo.newestFile.id+"?from=admin",class:"card-bg-media",muted:"",loop:"",autoplay:"",onError:e[7]||(e[7]=t=>l.handleImageError("newest"))},null,40,fe)):((0,i.uX)(),(0,i.CE)("div",me,[(0,i.bF)(r,{icon:"file-alt",class:"fallback-icon"})])),(0,i.Lk)("div",be,[(0,i.bF)(r,{icon:"arrow-up"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysStatus.latestUpload")),1)]),(0,i.Lk)("div",ye,[(0,i.Lk)("div",xe,(0,n.v_)(o.indexInfo.newestFile.metadata?.FileName||o.indexInfo.newestFile.id),1),(0,i.Lk)("div",ve,(0,n.v_)(l.formatTime(o.indexInfo.newestFile.metadata?.TimeStamp)),1)])])):(0,i.Q3)("",!0),o.indexInfo.oldestFile?((0,i.uX)(),(0,i.CE)("div",{key:1,class:"file-info-card info-card-oldest",onClick:e[11]||(e[11]=t=>l.openFileInNewTab(o.indexInfo.oldestFile))},[l.isImageFile(o.indexInfo.oldestFile)&&!o.loadErrors["oldest"]?((0,i.uX)(),(0,i.Wv)(x,{key:0,src:"/file/"+o.indexInfo.oldestFile.id+"?from=admin",fit:"cover",class:"card-bg-media",onError:e[9]||(e[9]=t=>l.handleImageError("oldest"))},null,8,["src"])):l.isVideoFile(o.indexInfo.oldestFile)&&!o.loadErrors["oldest"]?((0,i.uX)(),(0,i.CE)("video",{key:1,src:"/file/"+o.indexInfo.oldestFile.id+"?from=admin",class:"card-bg-media",muted:"",loop:"",autoplay:"",onError:e[10]||(e[10]=t=>l.handleImageError("oldest"))},null,40,_e)):((0,i.uX)(),(0,i.CE)("div",ke,[(0,i.bF)(r,{icon:"file-alt",class:"fallback-icon"})])),(0,i.Lk)("div",we,[(0,i.bF)(r,{icon:"arrow-down"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysStatus.earliestUpload")),1)]),(0,i.Lk)("div",Ce,[(0,i.Lk)("div",Se,(0,n.v_)(o.indexInfo.oldestFile.metadata?.FileName||o.indexInfo.oldestFile.id),1),(0,i.Lk)("div",Fe,(0,n.v_)(l.formatTime(o.indexInfo.oldestFile.metadata?.TimeStamp)),1)])])):(0,i.Q3)("",!0)])):(0,i.Q3)("",!0)])),[[C,o.loading]])}s(18111),s(7588),s(61701),s(18237),s(17642),s(58004),s(33853),s(45876),s(32475),s(15024),s(31698);var Pe=s(70797),Me={rE:"2.7.5"},De=(s(20116),s(91114));s(22489),s(13579); /*! * @kurkle/color v0.3.4 * https://github.com/kurkle/color#readme * (c) 2024 Jukka Kurkela * Released under the MIT License */ function Ae(t){return t+.5|0}const $e=(t,e,s)=>Math.max(Math.min(t,s),e);function Ve(t){return $e(Ae(2.55*t),0,255)}function Le(t){return $e(Ae(255*t),0,255)}function Ee(t){return $e(Ae(t/2.55)/100,0,1)}function Ie(t){return $e(Ae(100*t),0,100)}const Ue={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Oe=[..."0123456789ABCDEF"],Re=t=>Oe[15&t],We=t=>Oe[(240&t)>>4]+Oe[15&t],Be=t=>(240&t)>>4===(15&t),Ne=t=>Be(t.r)&&Be(t.g)&&Be(t.b)&&Be(t.a);function ze(t){var e,s=t.length;return"#"===t[0]&&(4===s||5===s?e={r:255&17*Ue[t[1]],g:255&17*Ue[t[2]],b:255&17*Ue[t[3]],a:5===s?17*Ue[t[4]]:255}:7!==s&&9!==s||(e={r:Ue[t[1]]<<4|Ue[t[2]],g:Ue[t[3]]<<4|Ue[t[4]],b:Ue[t[5]]<<4|Ue[t[6]],a:9===s?Ue[t[7]]<<4|Ue[t[8]]:255})),e}const je=(t,e)=>t<255?e(t):"";function qe(t){var e=Ne(t)?Re:We;return t?"#"+e(t.r)+e(t.g)+e(t.b)+je(t.a,e):void 0}const He=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Xe(t,e,s){const i=e*Math.min(s,1-s),n=(e,n=(e+t/30)%12)=>s-i*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Ke(t,e,s){const i=(i,n=(i+t/60)%6)=>s-s*e*Math.max(Math.min(n,4-n,1),0);return[i(5),i(3),i(1)]}function Qe(t,e,s){const i=Xe(t,1,.5);let n;for(e+s>1&&(n=1/(e+s),e*=n,s*=n),n=0;n<3;n++)i[n]*=1-e-s,i[n]+=e;return i}function Ye(t,e,s,i,n){return t===n?(e-s)/i+(e.5?c/(2-a-o):c/(a+o),r=Ye(s,i,n,c,a),r=60*r+.5),[0|r,d||0,l]}function Je(t,e,s,i){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,s,i)).map(Le)}function Ze(t,e,s){return Je(Xe,t,e,s)}function ts(t,e,s){return Je(Qe,t,e,s)}function es(t,e,s){return Je(Ke,t,e,s)}function ss(t){return(t%360+360)%360}function is(t){const e=He.exec(t);let s,i=255;if(!e)return;e[5]!==s&&(i=e[6]?Ve(+e[5]):Le(+e[5]));const n=ss(+e[2]),a=+e[3]/100,o=+e[4]/100;return s="hwb"===e[1]?ts(n,a,o):"hsv"===e[1]?es(n,a,o):Ze(n,a,o),{r:s[0],g:s[1],b:s[2],a:i}}function ns(t,e){var s=Ge(t);s[0]=ss(s[0]+e),s=Ze(s),t.r=s[0],t.g=s[1],t.b=s[2]}function as(t){if(!t)return;const e=Ge(t),s=e[0],i=Ie(e[1]),n=Ie(e[2]);return t.a<255?`hsla(${s}, ${i}%, ${n}%, ${Ee(t.a)})`:`hsl(${s}, ${i}%, ${n}%)`}const os={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},ls={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function rs(){const t={},e=Object.keys(ls),s=Object.keys(os);let i,n,a,o,l;for(i=0;i>16&255,a>>8&255,255&a]}return t}let ds;function cs(t){ds||(ds=rs(),ds.transparent=[0,0,0,0]);const e=ds[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const hs=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function us(t){const e=hs.exec(t);let s,i,n,a=255;if(e){if(e[7]!==s){const t=+e[7];a=e[8]?Ve(t):$e(255*t,0,255)}return s=+e[1],i=+e[3],n=+e[5],s=255&(e[2]?Ve(s):$e(s,0,255)),i=255&(e[4]?Ve(i):$e(i,0,255)),n=255&(e[6]?Ve(n):$e(n,0,255)),{r:s,g:i,b:n,a:a}}}function ps(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${Ee(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const gs=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,fs=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function ms(t,e,s){const i=fs(Ee(t.r)),n=fs(Ee(t.g)),a=fs(Ee(t.b));return{r:Le(gs(i+s*(fs(Ee(e.r))-i))),g:Le(gs(n+s*(fs(Ee(e.g))-n))),b:Le(gs(a+s*(fs(Ee(e.b))-a))),a:t.a+s*(e.a-t.a)}}function bs(t,e,s){if(t){let i=Ge(t);i[e]=Math.max(0,Math.min(i[e]+i[e]*s,0===e?360:1)),i=Ze(i),t.r=i[0],t.g=i[1],t.b=i[2]}}function ys(t,e){return t?Object.assign(e||{},t):t}function xs(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=Le(t[3]))):(e=ys(t,{r:0,g:0,b:0,a:1}),e.a=Le(e.a)),e}function vs(t){return"r"===t.charAt(0)?us(t):is(t)}class _s{constructor(t){if(t instanceof _s)return t;const e=typeof t;let s;"object"===e?s=xs(t):"string"===e&&(s=ze(t)||cs(t)||vs(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=ys(this._rgb);return t&&(t.a=Ee(t.a)),t}set rgb(t){this._rgb=xs(t)}rgbString(){return this._valid?ps(this._rgb):void 0}hexString(){return this._valid?qe(this._rgb):void 0}hslString(){return this._valid?as(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,i=t.rgb;let n;const a=e===n?.5:e,o=2*a-1,l=s.a-i.a,r=((o*l===-1?o:(o+l)/(1+o*l))+1)/2;n=1-r,s.r=255&r*s.r+n*i.r+.5,s.g=255&r*s.g+n*i.g+.5,s.b=255&r*s.b+n*i.b+.5,s.a=a*s.a+(1-a)*i.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=ms(this._rgb,t._rgb,e)),this}clone(){return new _s(this.rgb)}alpha(t){return this._rgb.a=Le(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Ae(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return bs(this._rgb,2,t),this}darken(t){return bs(this._rgb,2,-t),this}saturate(t){return bs(this._rgb,1,t),this}desaturate(t){return bs(this._rgb,1,-t),this}rotate(t){return ns(this._rgb,t),this}} /*! * Chart.js v4.5.1 * https://www.chartjs.org * (c) 2025 Chart.js Contributors * Released under the MIT License */ function ks(){}const ws=(()=>{let t=0;return()=>t++})();function Cs(t){return null===t||void 0===t}function Ss(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function Fs(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function Ts(t){return("number"===typeof t||t instanceof Number)&&isFinite(+t)}function Ps(t,e){return Ts(t)?t:e}function Ms(t,e){return"undefined"===typeof t?e:t}const Ds=(t,e)=>"string"===typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,As=(t,e)=>"string"===typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function $s(t,e,s){if(t&&"function"===typeof t.call)return t.apply(s,e)}function Vs(t,e,s,i){let n,a,o;if(Ss(t))if(a=t.length,i)for(n=a-1;n>=0;n--)e.call(s,t[n],n);else for(n=0;nt,x:t=>t.x,y:t=>t.y};function Ns(t){const e=t.split("."),s=[];let i="";for(const n of e)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(s.push(i),i="");return s}function zs(t){const e=Ns(t);return t=>{for(const s of e){if(""===s)break;t=t&&t[s]}return t}}function js(t,e){const s=Bs[e]||(Bs[e]=zs(e));return s(t)}function qs(t){return t.charAt(0).toUpperCase()+t.slice(1)}const Hs=t=>"undefined"!==typeof t,Xs=t=>"function"===typeof t,Ks=(t,e)=>{if(t.size!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;return!0};function Qs(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const Ys=Math.PI,Gs=2*Ys,Js=Gs+Ys,Zs=Number.POSITIVE_INFINITY,ti=Ys/180,ei=Ys/2,si=Ys/4,ii=2*Ys/3,ni=Math.log10,ai=Math.sign;function oi(t,e,s){return Math.abs(t-e)t-e).pop(),e}function di(t){return"symbol"===typeof t||"object"===typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function ci(t){return!di(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function hi(t,e){const s=Math.round(t);return s-e<=t&&s+e>=t}function ui(t,e,s){let i,n,a;for(i=0,n=t.length;ir&&d=Math.min(e,s)-i&&t<=Math.max(e,s)+i}function Ci(t,e,s){s=s||(s=>t[s]1)i=a+n>>1,s(i)?a=i:n=i;return{lo:a,hi:n}}const Si=(t,e,s,i)=>Ci(t,s,i?i=>{const n=t[i][e];return nt[i][e]Ci(t,s,i=>t[i][e]>=s);function Ti(t,e,s){let i=0,n=t.length;while(ii&&t[n-1]>s)n--;return i>0||n{const s="_onData"+qs(e),i=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=i.apply(this,e);return t._chartjs.listeners.forEach(t=>{"function"===typeof t[s]&&t[s](...e)}),n}})}))}function Di(t,e){const s=t._chartjs;if(!s)return;const i=s.listeners,n=i.indexOf(e);-1!==n&&i.splice(n,1),i.length>0||(Pi.forEach(e=>{delete t[e]}),delete t._chartjs)}function Ai(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const $i=function(){return"undefined"===typeof window?function(t){return t()}:window.requestAnimationFrame}();function Vi(t,e){let s=[],i=!1;return function(...n){s=n,i||(i=!0,$i.call(window,()=>{i=!1,t.apply(e,s)}))}}function Li(t,e){let s;return function(...i){return e?(clearTimeout(s),s=setTimeout(t,e,i)):t.apply(this,i),e}}const Ei=t=>"start"===t?"left":"end"===t?"right":"center",Ii=(t,e,s)=>"start"===t?e:"end"===t?s:(e+s)/2,Ui=(t,e,s,i)=>{const n=i?"left":"right";return t===n?s:"center"===t?(e+s)/2:e};function Oi(t,e,s){const i=e.length;let n=0,a=i;if(t._sorted){const{iScale:o,vScale:l,_parsed:r}=t,d=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,c=o.axis,{min:h,max:u,minDefined:p,maxDefined:g}=o.getUserBounds();if(p){if(n=Math.min(Si(r,c,h).lo,s?i:Si(e,c,o.getPixelForValue(h)).lo),d){const t=r.slice(0,n+1).reverse().findIndex(t=>!Cs(t[l.axis]));n-=Math.max(0,t)}n=_i(n,0,i-1)}if(g){let t=Math.max(Si(r,o.axis,u,!0).hi+1,s?0:Si(e,c,o.getPixelForValue(u),!0).hi+1);if(d){const e=r.slice(t-1).findIndex(t=>!Cs(t[l.axis]));t+=Math.max(0,e)}a=_i(t,n,i)-n}else a=i-n}return{start:n,count:a}}function Ri(t){const{xScale:e,yScale:s,_scaleRanges:i}=t,n={xmin:e.min,xmax:e.max,ymin:s.min,ymax:s.max};if(!i)return t._scaleRanges=n,!0;const a=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==s.min||i.ymax!==s.max;return Object.assign(i,n),a}const Wi=t=>0===t||1===t,Bi=(t,e,s)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*Gs/s),Ni=(t,e,s)=>Math.pow(2,-10*t)*Math.sin((t-e)*Gs/s)+1,zi={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*ei),easeOutSine:t=>Math.sin(t*ei),easeInOutSine:t=>-.5*(Math.cos(Ys*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>Wi(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Wi(t)?t:Bi(t,.075,.3),easeOutElastic:t=>Wi(t)?t:Ni(t,.075,.3),easeInOutElastic(t){const e=.1125,s=.45;return Wi(t)?t:t<.5?.5*Bi(2*t,e,s):.5+.5*Ni(2*t-1,e,s)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-zi.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-=1.5/s)*t+.75:t<2.5/s?e*(t-=2.25/s)*t+.9375:e*(t-=2.625/s)*t+.984375},easeInOutBounce:t=>t<.5?.5*zi.easeInBounce(2*t):.5*zi.easeOutBounce(2*t-1)+.5};function ji(t){if(t&&"object"===typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function qi(t){return ji(t)?t:new _s(t)}function Hi(t){return ji(t)?t:new _s(t).saturate(.5).darken(.1).hexString()}const Xi=["x","y","borderWidth","radius","tension"],Ki=["color","borderColor","backgroundColor"];function Qi(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:Ki},numbers:{type:"number",properties:Xi}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})}function Yi(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Gi=new Map;function Ji(t,e){e=e||{};const s=t+JSON.stringify(e);let i=Gi.get(s);return i||(i=new Intl.NumberFormat(t,e),Gi.set(s,i)),i}function Zi(t,e,s){return Ji(e,s).format(t)}const tn={values(t){return Ss(t)?t:""+t},numeric(t,e,s){if(0===t)return"0";const i=this.chart.options.locale;let n,a=t;if(s.length>1){const e=Math.max(Math.abs(s[0].value),Math.abs(s[s.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),a=en(t,s)}const o=ni(Math.abs(a)),l=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),r={notation:n,minimumFractionDigits:l,maximumFractionDigits:l};return Object.assign(r,this.options.ticks.format),Zi(t,i,r)},logarithmic(t,e,s){if(0===t)return"0";const i=s[e].significand||t/Math.pow(10,Math.floor(ni(t)));return[1,2,3,5,10,15].includes(i)||e>.8*s.length?tn.numeric.call(this,t,e,s):""}};function en(t,e){let s=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(s)>=1&&t!==Math.floor(t)&&(s=t-Math.floor(t)),s}var sn={formatters:tn};function nn(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:sn.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}const an=Object.create(null),on=Object.create(null);function ln(t,e){if(!e)return t;const s=e.split(".");for(let i=0,n=s.length;it.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>Hi(e.backgroundColor),this.hoverBorderColor=(t,e)=>Hi(e.borderColor),this.hoverColor=(t,e)=>Hi(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return rn(this,t,e)}get(t){return ln(this,t)}describe(t,e){return rn(on,t,e)}override(t,e){return rn(an,t,e)}route(t,e,s,i){const n=ln(this,t),a=ln(this,s),o="_"+e;Object.defineProperties(n,{[o]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[o],e=a[i];return Fs(t)?Object.assign({},e,t):Ms(t,e)},set(t){this[o]=t}}})}apply(t){t.forEach(t=>t(this))}}var cn=new dn({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Qi,Yi,nn]);function hn(t){return!t||Cs(t.size)||Cs(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function un(t,e,s,i,n){let a=e[n];return a||(a=e[n]=t.measureText(n).width,s.push(n)),a>i&&(i=a),i}function pn(t,e,s,i){i=i||{};let n=i.data=i.data||{},a=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(n=i.data={},a=i.garbageCollect=[],i.font=e),t.save(),t.font=e;let o=0;const l=s.length;let r,d,c,h,u;for(r=0;rs.length){for(r=0;r0&&t.stroke()}}function yn(t,e,s){return s=s||.5,!e||t&&t.x>e.left-s&&t.xe.top-s&&t.y0&&""!==a.strokeColor;let r,d;for(t.save(),t.font=n.string,wn(t,a),r=0;r+t||0;function $n(t,e){const s={},i=Fs(e),n=i?Object.keys(e):e,a=Fs(t)?i?s=>Ms(t[s],t[e[s]]):e=>t[e]:()=>t;for(const o of n)s[o]=An(a(o));return s}function Vn(t){return $n(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Ln(t){return $n(t,["topLeft","topRight","bottomLeft","bottomRight"])}function En(t){const e=Vn(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function In(t,e){t=t||{},e=e||cn.font;let s=Ms(t.size,e.size);"string"===typeof s&&(s=parseInt(s,10));let i=Ms(t.style,e.style);i&&!(""+i).match(Mn)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const n={family:Ms(t.family,e.family),lineHeight:Dn(Ms(t.lineHeight,e.lineHeight),s),size:s,style:i,weight:Ms(t.weight,e.weight),string:""};return n.string=hn(n),n}function Un(t,e,s,i){let n,a,o,l=!0;for(n=0,a=t.length;ns&&0===t?0:t+e;return{min:o(i,-Math.abs(a)),max:o(n,a)}}function Rn(t,e){return Object.assign(Object.create(t),e)}function Wn(t,e=[""],s,i,n=()=>t[0]){const a=s||t;"undefined"===typeof i&&(i=sa("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:a,_fallback:i,_getTarget:n,override:s=>Wn([s,...t],e,a,i)};return new Proxy(o,{deleteProperty(e,s){return delete e[s],delete e._keys,delete t[0][s],!0},get(s,i){return qn(s,i,()=>ea(i,e,t,s))},getOwnPropertyDescriptor(t,e){return Reflect.getOwnPropertyDescriptor(t._scopes[0],e)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(t,e){return ia(t).includes(e)},ownKeys(t){return ia(t)},set(t,e,s){const i=t._storage||(t._storage=n());return t[e]=i[e]=s,delete t._keys,!0}})}function Bn(t,e,s,i){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:s,_stack:new Set,_descriptors:Nn(t,i),setContext:e=>Bn(t,e,s,i),override:n=>Bn(t.override(n),e,s,i)};return new Proxy(n,{deleteProperty(e,s){return delete e[s],delete t[s],!0},get(t,e,s){return qn(t,e,()=>Hn(t,e,s))},getOwnPropertyDescriptor(e,s){return e._descriptors.allKeys?Reflect.has(t,s)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,s)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(e,s){return Reflect.has(t,s)},ownKeys(){return Reflect.ownKeys(t)},set(e,s,i){return t[s]=i,delete e[s],!0}})}function Nn(t,e={scriptable:!0,indexable:!0}){const{_scriptable:s=e.scriptable,_indexable:i=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:s,indexable:i,isScriptable:Xs(s)?s:()=>s,isIndexable:Xs(i)?i:()=>i}}const zn=(t,e)=>t?t+qs(e):e,jn=(t,e)=>Fs(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function qn(t,e,s){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const i=s();return t[e]=i,i}function Hn(t,e,s){const{_proxy:i,_context:n,_subProxy:a,_descriptors:o}=t;let l=i[e];return Xs(l)&&o.isScriptable(e)&&(l=Xn(e,l,t,s)),Ss(l)&&l.length&&(l=Kn(e,l,t,o.isIndexable)),jn(e,l)&&(l=Bn(l,n,a&&a[e],o)),l}function Xn(t,e,s,i){const{_proxy:n,_context:a,_subProxy:o,_stack:l}=s;if(l.has(t))throw new Error("Recursion detected: "+Array.from(l).join("->")+"->"+t);l.add(t);let r=e(a,o||i);return l.delete(t),jn(t,r)&&(r=Jn(n._scopes,n,t,r)),r}function Kn(t,e,s,i){const{_proxy:n,_context:a,_subProxy:o,_descriptors:l}=s;if("undefined"!==typeof a.index&&i(t))return e[a.index%e.length];if(Fs(e[0])){const s=e,i=n._scopes.filter(t=>t!==s);e=[];for(const r of s){const s=Jn(i,n,t,r);e.push(Bn(s,a,o&&o[t],l))}}return e}function Qn(t,e,s){return Xs(t)?t(e,s):t}const Yn=(t,e)=>!0===t?e:"string"===typeof t?js(e,t):void 0;function Gn(t,e,s,i,n){for(const a of e){const e=Yn(s,a);if(e){t.add(e);const a=Qn(e._fallback,s,n);if("undefined"!==typeof a&&a!==s&&a!==i)return a}else if(!1===e&&"undefined"!==typeof i&&s!==i)return null}return!1}function Jn(t,e,s,i){const n=e._rootScopes,a=Qn(e._fallback,s,i),o=[...t,...n],l=new Set;l.add(i);let r=Zn(l,o,s,a||s,i);return null!==r&&(("undefined"===typeof a||a===s||(r=Zn(l,o,a,r,i),null!==r))&&Wn(Array.from(l),[""],n,a,()=>ta(e,s,i)))}function Zn(t,e,s,i,n){while(s)s=Gn(t,e,s,i,n);return s}function ta(t,e,s){const i=t._getTarget();e in i||(i[e]={});const n=i[e];return Ss(n)&&Fs(s)?s:n||{}}function ea(t,e,s,i){let n;for(const a of e)if(n=sa(zn(a,t),s),"undefined"!==typeof n)return jn(t,n)?Jn(s,i,t,n):n}function sa(t,e){for(const s of e){if(!s)continue;const e=s[t];if("undefined"!==typeof e)return e}}function ia(t){let e=t._keys;return e||(e=t._keys=na(t._scopes)),e}function na(t){const e=new Set;for(const s of t)for(const t of Object.keys(s).filter(t=>!t.startsWith("_")))e.add(t);return Array.from(e)}function aa(t,e,s,i){const{iScale:n}=t,{key:a="r"}=this._parsing,o=new Array(i);let l,r,d,c;for(l=0,r=i;le"x"===t?"y":"x";function da(t,e,s,i){const n=t.skip?e:t,a=e,o=s.skip?e:s,l=bi(a,n),r=bi(o,a);let d=l/(l+r),c=r/(l+r);d=isNaN(d)?0:d,c=isNaN(c)?0:c;const h=i*d,u=i*c;return{previous:{x:a.x-h*(o.x-n.x),y:a.y-h*(o.y-n.y)},next:{x:a.x+u*(o.x-n.x),y:a.y+u*(o.y-n.y)}}}function ca(t,e,s){const i=t.length;let n,a,o,l,r,d=la(t,0);for(let c=0;c!t.skip)),"monotone"===e.cubicInterpolationMode)ua(t,n);else{let s=i?t[t.length-1]:t[0];for(a=0,o=t.length;at.ownerDocument.defaultView.getComputedStyle(t,null);function va(t,e){return xa(t).getPropertyValue(e)}const _a=["top","right","bottom","left"];function ka(t,e,s){const i={};s=s?"-"+s:"";for(let n=0;n<4;n++){const a=_a[n];i[a]=parseFloat(t[e+"-"+a+s])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const wa=(t,e,s)=>(t>0||e>0)&&(!s||!s.shadowRoot);function Ca(t,e){const s=t.touches,i=s&&s.length?s[0]:t,{offsetX:n,offsetY:a}=i;let o,l,r=!1;if(wa(n,a,t.target))o=n,l=a;else{const t=e.getBoundingClientRect();o=i.clientX-t.left,l=i.clientY-t.top,r=!0}return{x:o,y:l,box:r}}function Sa(t,e){if("native"in t)return t;const{canvas:s,currentDevicePixelRatio:i}=e,n=xa(s),a="border-box"===n.boxSizing,o=ka(n,"padding"),l=ka(n,"border","width"),{x:r,y:d,box:c}=Ca(t,s),h=o.left+(c&&l.left),u=o.top+(c&&l.top);let{width:p,height:g}=e;return a&&(p-=o.width+l.width,g-=o.height+l.height),{x:Math.round((r-h)/p*s.width/i),y:Math.round((d-u)/g*s.height/i)}}function Fa(t,e,s){let i,n;if(void 0===e||void 0===s){const a=t&&ba(t);if(a){const t=a.getBoundingClientRect(),o=xa(a),l=ka(o,"border","width"),r=ka(o,"padding");e=t.width-r.width-l.width,s=t.height-r.height-l.height,i=ya(o.maxWidth,a,"clientWidth"),n=ya(o.maxHeight,a,"clientHeight")}else e=t.clientWidth,s=t.clientHeight}return{width:e,height:s,maxWidth:i||Zs,maxHeight:n||Zs}}const Ta=t=>Math.round(10*t)/10;function Pa(t,e,s,i){const n=xa(t),a=ka(n,"margin"),o=ya(n.maxWidth,t,"clientWidth")||Zs,l=ya(n.maxHeight,t,"clientHeight")||Zs,r=Fa(t,e,s);let{width:d,height:c}=r;if("content-box"===n.boxSizing){const t=ka(n,"border","width"),e=ka(n,"padding");d-=e.width+t.width,c-=e.height+t.height}d=Math.max(0,d-a.width),c=Math.max(0,i?d/i:c-a.height),d=Ta(Math.min(d,o,r.maxWidth)),c=Ta(Math.min(c,l,r.maxHeight)),d&&!c&&(c=Ta(d/2));const h=void 0!==e||void 0!==s;return h&&i&&r.height&&c>r.height&&(c=r.height,d=Ta(Math.floor(c*i))),{width:d,height:c}}function Ma(t,e,s){const i=e||1,n=Ta(t.height*i),a=Ta(t.width*i);t.height=Ta(t.height),t.width=Ta(t.width);const o=t.canvas;return o.style&&(s||!o.style.height&&!o.style.width)&&(o.style.height=`${t.height}px`,o.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==i||o.height!==n||o.width!==a)&&(t.currentDevicePixelRatio=i,o.height=n,o.width=a,t.ctx.setTransform(i,0,0,i,0,0),!0)}const Da=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};ma()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(e){}return t}();function Aa(t,e){const s=va(t,e),i=s&&s.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function $a(t,e,s,i){return{x:t.x+s*(e.x-t.x),y:t.y+s*(e.y-t.y)}}function Va(t,e,s,i){return{x:t.x+s*(e.x-t.x),y:"middle"===i?s<.5?t.y:e.y:"after"===i?s<1?t.y:e.y:s>0?e.y:t.y}}function La(t,e,s,i){const n={x:t.cp2x,y:t.cp2y},a={x:e.cp1x,y:e.cp1y},o=$a(t,n,s),l=$a(n,a,s),r=$a(a,e,s),d=$a(o,l,s),c=$a(l,r,s);return $a(d,c,s)}const Ea=function(t,e){return{x(s){return t+t+e-s},setWidth(t){e=t},textAlign(t){return"center"===t?t:"right"===t?"left":"right"},xPlus(t,e){return t-e},leftForLtr(t,e){return t-e}}},Ia=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function Ua(t,e,s){return t?Ea(e,s):Ia()}function Oa(t,e){let s,i;"ltr"!==e&&"rtl"!==e||(s=t.canvas.style,i=[s.getPropertyValue("direction"),s.getPropertyPriority("direction")],s.setProperty("direction",e,"important"),t.prevTextDirection=i)}function Ra(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Wa(t){return"angle"===t?{between:vi,compare:yi,normalize:xi}:{between:wi,compare:(t,e)=>t-e,normalize:t=>t}}function Ba({start:t,end:e,count:s,loop:i,style:n}){return{start:t%s,end:e%s,loop:i&&(e-t+1)%s===0,style:n}}function Na(t,e,s){const{property:i,start:n,end:a}=s,{between:o,normalize:l}=Wa(i),r=e.length;let d,c,{start:h,end:u,loop:p}=t;if(p){for(h+=r,u+=r,d=0,c=r;dr(n,b,f)&&0!==l(n,b),_=()=>0===l(a,f)||r(a,b,f),k=()=>y||v(),w=()=>!y||_();for(let C=c,S=c;C<=h;++C)m=e[C%o],m.skip||(f=d(m[i]),f!==b&&(y=r(f,n,a),null===x&&k()&&(x=0===l(f,n)?C:S),null!==x&&w()&&(g.push(Ba({start:x,end:C,loop:u,count:o,style:p})),x=null),S=C,b=f));return null!==x&&g.push(Ba({start:x,end:h,loop:u,count:o,style:p})),g}function ja(t,e){const s=[],i=t.segments;for(let n=0;nn&&t[a%e].skip)a--;return a%=e,{start:n,end:a}}function Ha(t,e,s,i){const n=t.length,a=[];let o,l=e,r=t[e];for(o=e+1;o<=s;++o){const s=t[o%n];s.skip||s.stop?r.skip||(i=!1,a.push({start:e%n,end:(o-1)%n,loop:i}),e=l=s.stop?o:null):(l=o,r.skip&&(e=o)),r=s}return null!==l&&a.push({start:e%n,end:l%n,loop:i}),a}function Xa(t,e){const s=t.points,i=t.options.spanGaps,n=s.length;if(!n)return[];const a=!!t._loop,{start:o,end:l}=qa(s,n,a,i);if(!0===i)return Ka(t,[{start:o,end:l,loop:a}],s,e);const r=li({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(s-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=$i.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,i)=>{if(!s.running||!s.items.length)return;const n=s.items;let a,o=n.length-1,l=!1;for(;o>=0;--o)a=n[o],a._active?(a._total>s.duration&&(s.duration=a._total),a.tick(t),l=!0):(n[o]=n[n.length-1],n.pop());l&&(i.draw(),this._notify(i,s,t,"progress")),n.length||(s.running=!1,this._notify(i,s,t,"complete"),s.initial=!1),e+=n.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((t,e)=>Math.max(t,e._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let i=s.length-1;for(;i>=0;--i)s[i].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var so=new eo;const io="transparent",no={boolean(t,e,s){return s>.5?e:t},color(t,e,s){const i=qi(t||io),n=i.valid&&qi(e||io);return n&&n.valid?n.mix(i,s).hexString():e},number(t,e,s){return t+(e-t)*s}};class ao{constructor(t,e,s,i){const n=e[s];i=Un([t.to,i,n,t.from]);const a=Un([t.from,n,i]);this._active=!0,this._fn=t.fn||no[t.type||typeof a],this._easing=zi[t.easing]||zi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=a,this._to=i,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const i=this._target[this._prop],n=s-this._start,a=this._duration-n;this._start=s,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Un([t.to,e,i,t.from]),this._from=Un([t.from,i,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,i=this._prop,n=this._from,a=this._loop,o=this._to;let l;if(this._active=n!==o&&(a||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(n,o,l))}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let i=0;i{const n=t[i];if(!Fs(n))return;const a={};for(const t of e)a[t]=n[t];(Ss(n.properties)&&n.properties||[i]).forEach(t=>{t!==i&&s.has(t)||s.set(t,a)})})}_animateOptions(t,e){const s=e.options,i=ro(t,s);if(!i)return[];const n=this._createAnimations(i,s);return s.$shared&&lo(t.options.$animations,s).then(()=>{t.options=s},()=>{}),n}_createAnimations(t,e){const s=this._properties,i=[],n=t.$animations||(t.$animations={}),a=Object.keys(e),o=Date.now();let l;for(l=a.length-1;l>=0;--l){const r=a[l];if("$"===r.charAt(0))continue;if("options"===r){i.push(...this._animateOptions(t,e));continue}const d=e[r];let c=n[r];const h=s.get(r);if(c){if(h&&c.active()){c.update(h,d,o);continue}c.cancel()}h&&h.duration?(n[r]=c=new ao(h,t,r,d),i.push(c)):t[r]=d}return i}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const s=this._createAnimations(t,e);return s.length?(so.add(this._chart,s),!0):void 0}}function lo(t,e){const s=[],i=Object.keys(e);for(let n=0;n0||!s&&e<0)return n.index}return null}function _o(t,e){const{chart:s,_cachedMeta:i}=t,n=s._stacks||(s._stacks={}),{iScale:a,vScale:o,index:l}=i,r=a.axis,d=o.axis,c=bo(a,o,i),h=e.length;let u;for(let p=0;ps[t].axis===e).shift()}function wo(t,e){return Rn(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Co(t,e,s){return Rn(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:s,index:e,mode:"default",type:"data"})}function So(t,e){const s=t.controller.index,i=t.vScale&&t.vScale.axis;if(i){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[i]||void 0===e[i][s])return;delete e[i][s],void 0!==e[i]._visualValues&&void 0!==e[i]._visualValues[s]&&delete e[i]._visualValues[s]}}}const Fo=t=>"reset"===t||"none"===t,To=(t,e)=>e?t:Object.assign({},t),Po=(t,e,s)=>t&&!e.hidden&&e._stacked&&{keys:po(s,!0),values:null};class Mo{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=mo(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&So(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),i=(t,e,s,i)=>"x"===t?e:"r"===t?i:s,n=e.xAxisID=Ms(s.xAxisID,ko(t,"x")),a=e.yAxisID=Ms(s.yAxisID,ko(t,"y")),o=e.rAxisID=Ms(s.rAxisID,ko(t,"r")),l=e.indexAxis,r=e.iAxisID=i(l,n,a,o),d=e.vAxisID=i(l,a,n,o);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(o),e.iScale=this.getScaleForId(r),e.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Di(this._data,this),t._stacked&&So(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(Fs(e)){const t=this._cachedMeta;this._data=fo(e,t)}else if(s!==e){if(s){Di(s,this);const t=this._cachedMeta;So(t),t._parsed=[]}e&&Object.isExtensible(e)&&Mi(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,s=this.getDataset();let i=!1;this._dataCheck();const n=e._stacked;e._stacked=mo(e.vScale,e),e.stack!==s.stack&&(i=!0,So(e),e.stack=s.stack),this._resyncElements(t),(i||n!==e._stacked)&&(_o(this,e._parsed),e._stacked=mo(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:i}=this,{iScale:n,_stacked:a}=s,o=n.axis;let l,r,d,c=0===t&&e===i.length||s._sorted,h=t>0&&s._parsed[t-1];if(!1===this._parsing)s._parsed=i,s._sorted=!0,d=i;else{d=Ss(i[t])?this.parseArrayData(s,i,t,e):Fs(i[t])?this.parseObjectData(s,i,t,e):this.parsePrimitiveData(s,i,t,e);const n=()=>null===r[o]||h&&r[o]e||c=0;--h)if(!p()){this.updateRangeFromParsed(r,t,u,l);break}return r}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let i,n,a;for(i=0,n=e.length;i=0&&tthis.getContext(s,i,e),g=r.resolveNamedOptions(h,u,p,c);return g.$shared&&(g.$shared=l,n[a]=Object.freeze(To(g,l))),g}_resolveAnimations(t,e,s){const i=this.chart,n=this._cachedDataOpts,a=`animation-${e}`,o=n[a];if(o)return o;let l;if(!1!==i.options.animation){const i=this.chart.config,n=i.datasetAnimationScopeKeys(this._type,e),a=i.getOptionScopes(this.getDataset(),n);l=i.createResolver(a,this.getContext(t,s,e))}const r=new oo(i,l&&l.animations);return l&&l._cacheable&&(n[a]=Object.freeze(r)),r}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Fo(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),i=this._sharedOptions,n=this.getSharedOptions(s),a=this.includeOptions(e,n)||n!==i;return this.updateSharedOptions(n,e,s),{sharedOptions:n,includeOptions:a}}updateElement(t,e,s,i){Fo(i)?Object.assign(t,s):this._resolveAnimations(e,i).update(t,s)}updateSharedOptions(t,e,s){t&&!Fo(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,i){t.active=i;const n=this.getStyle(e,i);this._resolveAnimations(e,s,i).update(t,{options:!i&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[o,l,r]of this._syncList)this[o](l,r);this._syncList=[];const i=s.length,n=e.length,a=Math.min(n,i);a&&this.parse(0,a),n>i?this._insertElements(i,n-i,t):n{for(t.length+=e,o=t.length-1;o>=a;o--)t[o]=t[o-e]};for(l(n),o=t;ot-e))}return t._cache.$bar}function Ao(t){const e=t.iScale,s=Do(e,t.type);let i,n,a,o,l=e._length;const r=()=>{32767!==a&&-32768!==a&&(Hs(o)&&(l=Math.min(l,Math.abs(a-o)||l)),o=a)};for(i=0,n=s.length;i0?n[t-1]:null,l=tMath.abs(l)&&(r=l,d=o),e[s.axis]=d,e._custom={barStart:r,barEnd:d,start:n,end:a,min:o,max:l}}function Eo(t,e,s,i){return Ss(t)?Lo(t,e,s,i):e[s.axis]=s.parse(t,i),e}function Io(t,e,s,i){const n=t.iScale,a=t.vScale,o=n.getLabels(),l=n===a,r=[];let d,c,h,u;for(d=s,c=s+i;d=s?1:-1)}function Ro(t){let e,s,i,n,a;return t.horizontal?(e=t.base>t.x,s="left",i="right"):(e=t.baset.controller.options.grouped),n=s.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(e),l=o&&o[s.axis],r=t=>{const e=t._parsed.find(t=>t[s.axis]===l),i=e&&e[t.vScale.axis];if(Cs(i)||isNaN(i))return!0};for(const d of i)if((void 0===e||!r(d))&&((!1===n||-1===a.indexOf(d.stack)||void 0===n&&void 0===d.stack)&&a.push(d.stack),d.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(s=>t[s].axis===e).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const s of this.chart.data.datasets)t[Ms("x"===this.chart.options.indexAxis?s.xAxisID:s.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,s){const i=this._getStacks(t,s),n=void 0!==e?i.indexOf(e):-1;return-1===n?i.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,i=[];let n,a;for(n=0,a=e.data.length;n=0;--s)e=Math.max(e,t[s].size(this.resolveDataElementOptions(s))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart.data.labels||[],{xScale:i,yScale:n}=e,a=this.getParsed(t),o=i.getLabelForValue(a.x),l=n.getLabelForValue(a.y),r=a._custom;return{label:s[t]||"",value:"("+o+", "+l+(r?", "+r:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,s,i){const n="reset"===i,{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:l,includeOptions:r}=this._getSharedOptions(e,i),d=a.axis,c=o.axis;for(let h=e;hvi(t,l,r,!0)?1:Math.max(e,e*s,i,i*s),g=(t,e,i)=>vi(t,l,r,!0)?-1:Math.min(e,e*s,i,i*s),f=p(0,d,h),m=p(ei,c,u),b=g(Ys,d,h),y=g(Ys+ei,c,u);i=(f-b)/2,n=(m-y)/2,a=-(f+b)/2,o=-(m+y)/2}return{ratioX:i,ratioY:n,offsetX:a,offsetY:o}}(0,De.A)(Ho,"id","bubble"),(0,De.A)(Ho,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),(0,De.A)(Ho,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});class Ko extends Mo{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const s=this.getDataset().data,i=this._cachedMeta;if(!1===this._parsing)i._parsed=s;else{let n,a,o=t=>+s[t];if(Fs(s[t])){const{key:t="value"}=this._parsing;o=e=>+js(s[e],t)}for(n=t,a=t+e;n0&&!isNaN(t)?Gs*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,i=s.data.labels||[],n=Zi(e._parsed[t],s.options.locale);return{label:i[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const s=this.chart;let i,n,a,o,l;if(!t)for(i=0,n=s.data.datasets.length;i"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),(0,De.A)(Ko,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data,{labels:{pointStyle:s,textAlign:i,color:n,useBorderRadius:a,borderRadius:o}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((e,l)=>{const r=t.getDatasetMeta(0),d=r.controller.getStyle(l);return{text:e,fillStyle:d.backgroundColor,fontColor:n,hidden:!t.getDataVisibility(l),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:i,pointStyle:s,borderRadius:a&&(o||d.borderRadius),index:l}}):[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}}});class Qo extends Mo{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:s,data:i=[],_dataset:n}=e,a=this.chart._animationsDisabled;let{start:o,count:l}=Oi(e,i,a);this._drawStart=o,this._drawCount=l,Ri(e)&&(o=0,l=i.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!n._decimated,s.points=i;const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0),r.segment=this.options.segment,this.updateElement(s,void 0,{animated:!a,options:r},t),this.updateElements(i,o,l,t)}updateElements(t,e,s,i){const n="reset"===i,{iScale:a,vScale:o,_stacked:l,_dataset:r}=this._cachedMeta,{sharedOptions:d,includeOptions:c}=this._getSharedOptions(e,i),h=a.axis,u=o.axis,{spanGaps:p,segment:g}=this.options,f=ci(p)?p:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||n||"none"===i,b=e+s,y=t.length;let x=e>0&&this.getParsed(e-1);for(let v=0;v=b){p.skip=!0;continue}const y=this.getParsed(v),_=Cs(y[u]),k=p[h]=a.getPixelForValue(y[h],v),w=p[u]=n||_?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,y,l):y[u],v);p.skip=isNaN(k)||isNaN(w)||_,p.stop=v>0&&Math.abs(y[h]-x[h])>f,g&&(p.parsed=y,p.raw=r.data[v]),c&&(p.options=d||this.resolveDataElementOptions(v,s.active?"active":i)),m||this.updateElement(s,v,p,i),x=y}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,i=t.data||[];if(!i.length)return s;const n=i[0].size(this.resolveDataElementOptions(0)),a=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(s,n,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}(0,De.A)(Qo,"id","line"),(0,De.A)(Qo,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),(0,De.A)(Qo,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Yo extends Mo{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,i=s.data.labels||[],n=Zi(e._parsed[t].r,s.options.locale);return{label:i[t]||"",value:n}}parseObjectData(t,e,s,i){return aa.bind(this)(t,e,s,i)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,s)=>{const i=this.getParsed(s).r;!isNaN(i)&&this.chart.getDataVisibility(s)&&(ie.max&&(e.max=i))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,s=t.options,i=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(i/2,0),a=Math.max(s.cutoutPercentage?n/100*s.cutoutPercentage:1,0),o=(n-a)/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,s,i){const n="reset"===i,a=this.chart,o=a.options,l=o.animation,r=this._cachedMeta.rScale,d=r.xCenter,c=r.yCenter,h=r.getIndexAngle(0)-.5*Ys;let u,p=h;const g=360/this.countVisibleElements();for(u=0;u{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,s){return this.chart.getDataVisibility(t)?pi(this.resolveDataElementOptions(t,e).angle||s):0}}(0,De.A)(Yo,"id","polarArea"),(0,De.A)(Yo,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),(0,De.A)(Yo,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:i}}=t.legend.options;return e.labels.map((e,n)=>{const a=t.getDatasetMeta(0),o=a.controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:i,lineWidth:o.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(n),index:n}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class Go extends Ko{}(0,De.A)(Go,"id","pie"),(0,De.A)(Go,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class Jo extends Mo{getLabelAndValue(t){const e=this._cachedMeta.vScale,s=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(s[e.axis])}}parseObjectData(t,e,s,i){return aa.bind(this)(t,e,s,i)}update(t){const e=this._cachedMeta,s=e.dataset,i=e.data||[],n=e.iScale.getLabels();if(s.points=i,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const a={_loop:!0,_fullLoop:n.length===i.length,options:e};this.updateElement(s,void 0,a,t)}this.updateElements(i,0,i.length,t)}updateElements(t,e,s,i){const n=this._cachedMeta.rScale,a="reset"===i;for(let o=e;o0&&this.getParsed(e-1);for(let x=e;x0&&Math.abs(s[u]-y[u])>m,f&&(d.parsed=s,d.raw=r.data[x]),h&&(d.options=c||this.resolveDataElementOptions(x,e.active?"active":i)),b||this.updateElement(e,x,d,i),y=s}this.updateSharedOptions(c,i,d)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let s=e.length-1;s>=0;--s)t=Math.max(t,e[s].size(this.resolveDataElementOptions(s))/2);return t>0&&t}const s=t.dataset,i=s.options&&s.options.borderWidth||0;if(!e.length)return i;const n=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(i,n,a)/2}}(0,De.A)(Zo,"id","scatter"),(0,De.A)(Zo,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),(0,De.A)(Zo,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});function tl(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class el{static override(t){Object.assign(el.prototype,t)}constructor(t){(0,De.A)(this,"options",void 0),this.options=t||{}}init(){}formats(){return tl()}parse(){return tl()}format(){return tl()}add(){return tl()}diff(){return tl()}startOf(){return tl()}endOf(){return tl()}}var sl={_date:el};function il(t,e,s,i){const{controller:n,data:a,_sorted:o}=t,l=n._cachedMeta.iScale,r=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(l&&e===l.axis&&"r"!==e&&o&&a.length){const o=l._reversePixels?Fi:Si;if(!i){const i=o(a,e,s);if(r){const{vScale:e}=n._cachedMeta,{_parsed:s}=t,a=s.slice(0,i.lo+1).reverse().findIndex(t=>!Cs(t[e.axis]));i.lo-=Math.max(0,a);const o=s.slice(i.hi).findIndex(t=>!Cs(t[e.axis]));i.hi+=Math.max(0,o)}return i}if(n._sharedOptions){const t=a[0],i="function"===typeof t.getRange&&t.getRange(e);if(i){const t=o(a,e,s-i),n=o(a,e,s+i);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:a.length-1}}function nl(t,e,s,i,n){const a=t.getSortedVisibleDatasetMetas(),o=s[e];for(let l=0,r=a.length;l{t[o]&&t[o](e[s],n)&&(a.push({element:t,datasetIndex:i,index:r}),l=l||t.inRange(e.x,e.y,n))}),i&&!l?[]:a}var hl={evaluateInteractionItems:nl,modes:{index(t,e,s,i){const n=Sa(e,t),a=s.axis||"x",o=s.includeInvisible||!1,l=s.intersect?ol(t,n,a,i,o):dl(t,n,a,!1,i,o),r=[];return l.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{const e=l[0].index,s=t.data[e];s&&!s.skip&&r.push({element:s,datasetIndex:t.index,index:e})}),r):[]},dataset(t,e,s,i){const n=Sa(e,t),a=s.axis||"xy",o=s.includeInvisible||!1;let l=s.intersect?ol(t,n,a,i,o):dl(t,n,a,!1,i,o);if(l.length>0){const e=l[0].datasetIndex,s=t.getDatasetMeta(e).data;l=[];for(let t=0;tt.pos===e)}function gl(t,e){return t.filter(t=>-1===ul.indexOf(t.pos)&&t.box.axis===e)}function fl(t,e){return t.sort((t,s)=>{const i=e?s:t,n=e?t:s;return i.weight===n.weight?i.index-n.index:i.weight-n.weight})}function ml(t){const e=[];let s,i,n,a,o,l;for(s=0,i=(t||[]).length;st.box.fullSize),!0),i=fl(pl(e,"left"),!0),n=fl(pl(e,"right")),a=fl(pl(e,"top"),!0),o=fl(pl(e,"bottom")),l=gl(e,"x"),r=gl(e,"y");return{fullSize:s,leftAndTop:i.concat(a),rightAndBottom:n.concat(r).concat(o).concat(l),chartArea:pl(e,"chartArea"),vertical:i.concat(n).concat(r),horizontal:a.concat(o).concat(l)}}function vl(t,e,s,i){return Math.max(t[s],e[s])+Math.max(t[i],e[i])}function _l(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function kl(t,e,s,i){const{pos:n,box:a}=s,o=t.maxPadding;if(!Fs(n)){s.size&&(t[n]-=s.size);const e=i[s.stack]||{size:0,count:1};e.size=Math.max(e.size,s.horizontal?a.height:a.width),s.size=e.size/e.count,t[n]+=s.size}a.getPadding&&_l(o,a.getPadding());const l=Math.max(0,e.outerWidth-vl(o,t,"left","right")),r=Math.max(0,e.outerHeight-vl(o,t,"top","bottom")),d=l!==t.w,c=r!==t.h;return t.w=l,t.h=r,s.horizontal?{same:d,other:c}:{same:c,other:d}}function wl(t){const e=t.maxPadding;function s(s){const i=Math.max(e[s]-t[s],0);return t[s]+=i,i}t.y+=s("top"),t.x+=s("left"),s("right"),s("bottom")}function Cl(t,e){const s=e.maxPadding;function i(t){const i={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{i[t]=Math.max(e[t],s[t])}),i}return i(t?["left","right"]:["top","bottom"])}function Sl(t,e,s,i){const n=[];let a,o,l,r,d,c;for(a=0,o=t.length,d=0;a{"function"===typeof t.beforeLayout&&t.beforeLayout()});const c=r.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,h=Object.freeze({outerWidth:e,outerHeight:s,padding:n,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/c,hBoxMaxHeight:o/2}),u=Object.assign({},n);_l(u,En(i));const p=Object.assign({maxPadding:u,w:a,h:o,x:n.left,y:n.top},n),g=yl(r.concat(d),h);Sl(l.fullSize,p,h,g),Sl(r,p,h,g),Sl(d,p,h,g)&&Sl(r,p,h,g),wl(p),Tl(l.leftAndTop,p,h,g),p.x+=p.w,p.y+=p.h,Tl(l.rightAndBottom,p,h,g),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},Vs(l.chartArea,e=>{const s=e.box;Object.assign(s,t.chartArea),s.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class Ml{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,i){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,i?Math.floor(e/i):s)}}isAttached(t){return!0}updateConfig(t){}}class Dl extends Ml{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Al="$chartjs",$l={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Vl=t=>null===t||""===t;function Ll(t,e){const s=t.style,i=t.getAttribute("height"),n=t.getAttribute("width");if(t[Al]={initial:{height:i,width:n,style:{display:s.display,height:s.height,width:s.width}}},s.display=s.display||"block",s.boxSizing=s.boxSizing||"border-box",Vl(n)){const e=Aa(t,"width");void 0!==e&&(t.width=e)}if(Vl(i))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Aa(t,"height");void 0!==e&&(t.height=e)}return t}const El=!!Da&&{passive:!0};function Il(t,e,s){t&&t.addEventListener(e,s,El)}function Ul(t,e,s){t&&t.canvas&&t.canvas.removeEventListener(e,s,El)}function Ol(t,e){const s=$l[t.type]||t.type,{x:i,y:n}=Sa(t,e);return{type:s,chart:e,native:t,x:void 0!==i?i:null,y:void 0!==n?n:null}}function Rl(t,e){for(const s of t)if(s===e||s.contains(e))return!0}function Wl(t,e,s){const i=t.canvas,n=new MutationObserver(t=>{let e=!1;for(const s of t)e=e||Rl(s.addedNodes,i),e=e&&!Rl(s.removedNodes,i);e&&s()});return n.observe(document,{childList:!0,subtree:!0}),n}function Bl(t,e,s){const i=t.canvas,n=new MutationObserver(t=>{let e=!1;for(const s of t)e=e||Rl(s.removedNodes,i),e=e&&!Rl(s.addedNodes,i);e&&s()});return n.observe(document,{childList:!0,subtree:!0}),n}const Nl=new Map;let zl=0;function jl(){const t=window.devicePixelRatio;t!==zl&&(zl=t,Nl.forEach((e,s)=>{s.currentDevicePixelRatio!==t&&e()}))}function ql(t,e){Nl.size||window.addEventListener("resize",jl),Nl.set(t,e)}function Hl(t){Nl.delete(t),Nl.size||window.removeEventListener("resize",jl)}function Xl(t,e,s){const i=t.canvas,n=i&&ba(i);if(!n)return;const a=Vi((t,e)=>{const i=n.clientWidth;s(t,e),i{const e=t[0],s=e.contentRect.width,i=e.contentRect.height;0===s&&0===i||a(s,i)});return o.observe(n),ql(t,a),o}function Kl(t,e,s){s&&s.disconnect(),"resize"===e&&Hl(t)}function Ql(t,e,s){const i=t.canvas,n=Vi(e=>{null!==t.ctx&&s(Ol(e,t))},t);return Il(i,e,n),n}class Yl extends Ml{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(Ll(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Al])return!1;const s=e[Al].initial;["height","width"].forEach(t=>{const i=s[t];Cs(i)?e.removeAttribute(t):e.setAttribute(t,i)});const i=s.style||{};return Object.keys(i).forEach(t=>{e.style[t]=i[t]}),e.width=e.width,delete e[Al],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const i=t.$proxies||(t.$proxies={}),n={attach:Wl,detach:Bl,resize:Xl},a=n[e]||Ql;i[e]=a(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),i=s[e];if(!i)return;const n={attach:Kl,detach:Kl,resize:Kl},a=n[e]||Ul;a(t,e,i),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,i){return Pa(t,e,s,i)}isAttached(t){const e=t&&ba(t);return!(!e||!e.isConnected)}}function Gl(t){return!ma()||"undefined"!==typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Dl:Yl}class Jl{constructor(){(0,De.A)(this,"x",void 0),(0,De.A)(this,"y",void 0),(0,De.A)(this,"active",!1),(0,De.A)(this,"options",void 0),(0,De.A)(this,"$animations",void 0)}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return ci(this.x)&&ci(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const i={};return t.forEach(t=>{i[t]=s[t]&&s[t].active()?s[t]._to:this[t]}),i}}function Zl(t,e){const s=t.options.ticks,i=tr(t),n=Math.min(s.maxTicksLimit||i,i),a=s.major.enabled?sr(e):[],o=a.length,l=a[0],r=a[o-1],d=[];if(o>n)return ir(e,d,a,o/n),d;const c=er(a,e,n);if(o>0){let t,s;const i=o>1?Math.round((r-l)/(o-1)):null;for(nr(e,d,c,Cs(i)?0:l-i,l),t=0,s=o-1;tn)return t}return Math.max(n,1)}function sr(t){const e=[];let s,i;for(s=0,i=t.length;s"left"===t?"right":"right"===t?"left":t,lr=(t,e,s)=>"top"===e||"left"===e?t[e]+s:t[e]-s,rr=(t,e)=>Math.min(e||t,t);function dr(t,e){const s=[],i=t.length/e,n=t.length;let a=0;for(;ao+l)))return d}function hr(t,e){Vs(t,t=>{const s=t.gc,i=s.length/2;let n;if(i>e){for(n=0;ni?i:s,i=n&&s>i?s:i,{min:Ps(s,Ps(i,s)),max:Ps(i,Ps(s,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){const e=this._labelItems||(this._labelItems=this._computeLabelItems(t));return e}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){$s(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:i,grace:n,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=On(this,n,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=o=n||s<=1||!this.isHorizontal())return void(this.labelRotation=i);const d=this._getLabelSizes(),c=d.widest.width,h=d.highest.height,u=_i(this.chart.width-c,0,this.maxWidth);a=t.offset?this.maxWidth/s:u/(s-1),c+6>a&&(a=u/(s-(t.offset?.5:1)),o=this.maxHeight-ur(t.grid)-e.padding-pr(t.title,this.chart.options.font),l=Math.sqrt(c*c+h*h),r=gi(Math.min(Math.asin(_i((d.highest.height+6)/a,-1,1)),Math.asin(_i(o/l,-1,1))-Math.asin(_i(h/l,-1,1)))),r=Math.max(i,Math.min(n,r))),this.labelRotation=r}afterCalculateLabelRotation(){$s(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){$s(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:i,grid:n}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){const a=pr(i,e.options.font);if(o?(t.width=this.maxWidth,t.height=ur(n)+a):(t.height=this.maxHeight,t.width=ur(n)+a),s.display&&this.ticks.length){const{first:e,last:i,widest:n,highest:a}=this._getLabelSizes(),l=2*s.padding,r=pi(this.labelRotation),d=Math.cos(r),c=Math.sin(r);if(o){const e=s.mirror?0:c*n.width+d*a.height;t.height=Math.min(this.maxHeight,t.height+e+l)}else{const e=s.mirror?0:d*n.width+c*a.height;t.width=Math.min(this.maxWidth,t.width+e+l)}this._calculatePadding(e,i,c,d)}}this._handleMargins(),o?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,i){const{ticks:{align:n,padding:a},position:o}=this.options,l=0!==this.labelRotation,r="top"!==o&&"x"===this.axis;if(this.isHorizontal()){const o=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,h=0;l?r?(c=i*t.width,h=s*e.height):(c=s*t.height,h=i*e.width):"start"===n?h=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,h=e.width/2),this.paddingLeft=Math.max((c-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((h-d+a)*this.width/(this.width-d),0)}else{let s=e.height/2,i=t.height/2;"start"===n?(s=0,i=t.height):"end"===n&&(s=e.height,i=0),this.paddingTop=s+a,this.paddingBottom=i+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){$s(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,s;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,s=t.length;e({width:a[t]||0,height:o[t]||0});return{first:w(0),last:w(e-1),widest:w(_),highest:w(k),widths:a,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return ki(this._alignToPixels?gn(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&to*i?o/s:l/i:l*i0}_computeGridLineItems(t){const e=this.axis,s=this.chart,i=this.options,{grid:n,position:a,border:o}=i,l=n.offset,r=this.isHorizontal(),d=this.ticks,c=d.length+(l?1:0),h=ur(n),u=[],p=o.setContext(this.getContext()),g=p.display?p.width:0,f=g/2,m=function(t){return gn(s,t,g)};let b,y,x,v,_,k,w,C,S,F,T,P;if("top"===a)b=m(this.bottom),k=this.bottom-h,C=b-f,F=m(t.top)+f,P=t.bottom;else if("bottom"===a)b=m(this.top),F=t.top,P=m(t.bottom)-f,k=b+f,C=this.top+h;else if("left"===a)b=m(this.right),_=this.right-h,w=b-f,S=m(t.left)+f,T=t.right;else if("right"===a)b=m(this.left),S=t.left,T=m(t.right)-f,_=b+f,w=this.left+h;else if("x"===e){if("center"===a)b=m((t.top+t.bottom)/2+.5);else if(Fs(a)){const t=Object.keys(a)[0],e=a[t];b=m(this.chart.scales[t].getPixelForValue(e))}F=t.top,P=t.bottom,k=b+f,C=k+h}else if("y"===e){if("center"===a)b=m((t.left+t.right)/2);else if(Fs(a)){const t=Object.keys(a)[0],e=a[t];b=m(this.chart.scales[t].getPixelForValue(e))}_=b-f,w=_-h,S=t.left,T=t.right}const M=Ms(i.ticks.maxTicksLimit,c),D=Math.max(1,Math.ceil(c/M));for(y=0;y0&&(a-=i/2);break}h={left:a,top:n,width:i+e.width,height:s+e.height,color:t.backdropColor}}f.push({label:x,font:C,textOffset:T,options:{rotation:g,color:s,strokeColor:l,strokeWidth:d,textAlign:u,textBaseline:P,translation:[v,_],backdrop:h}})}return f}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options,s=-pi(this.labelRotation);if(s)return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:i,padding:n}}=this.options,a=this._getLabelSizes(),o=t+n,l=a.widest.width;let r,d;return"left"===e?i?(d=this.right+n,"near"===s?r="left":"center"===s?(r="center",d+=l/2):(r="right",d+=l)):(d=this.right-o,"near"===s?r="right":"center"===s?(r="center",d-=l/2):(r="left",d=this.left)):"right"===e?i?(d=this.left+n,"near"===s?r="right":"center"===s?(r="center",d-=l/2):(r="left",d-=l)):(d=this.left+o,"near"===s?r="left":"center"===s?(r="center",d+=l/2):(r="right",d=this.right)):r="right",{textAlign:r,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:i,width:n,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,i,n,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks,i=s.findIndex(e=>e.value===t);if(i>=0){const t=e.setContext(this.getContext(i));return t.lineWidth}return 0}drawGrid(t){const e=this.options.grid,s=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,a;const o=(t,e,i)=>{i.width&&i.color&&(s.save(),s.lineWidth=i.width,s.strokeStyle=i.color,s.setLineDash(i.borderDash||[]),s.lineDashOffset=i.borderDashOffset,s.beginPath(),s.moveTo(t.x,t.y),s.lineTo(e.x,e.y),s.stroke(),s.restore())};if(e.display)for(n=0,a=i.length;n{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",i=[];let n,a;for(n=0,a=e.length;n{const i=s.split("."),n=i.pop(),a=[t].concat(i).join("."),o=e[s].split("."),l=o.pop(),r=o.join(".");cn.route(a,n,r,l)})}function kr(t){return"id"in t&&"defaults"in t}class wr{constructor(){this.controllers=new xr(Mo,"datasets",!0),this.elements=new xr(Jl,"elements"),this.plugins=new xr(Object,"plugins"),this.scales=new xr(yr,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(e=>{const i=s||this._getRegistryForType(e);s||i.isForType(e)||i===this.plugins&&e.id?this._exec(t,i,e):Vs(e,e=>{const i=s||this._getRegistryForType(e);this._exec(t,i,e)})})}_exec(t,e,s){const i=qs(t);$s(s["before"+i],[],s),e[t](s),$s(s["after"+i],[],s)}_getRegistryForType(t){for(let e=0;et.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(i(e,s),t,"stop"),this._notify(i(s,e),t,"start")}}function Fr(t){const e={},s=[],i=Object.keys(Cr.plugins.items);for(let a=0;a1&&Vr(t[0].toLowerCase());if(e)return e}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Ir(t,e,s){if(s[e+"AxisID"]===t)return{axis:e}}function Ur(t,e){if(e.data&&e.data.datasets){const s=e.data.datasets.filter(e=>e.xAxisID===t||e.yAxisID===t);if(s.length)return Ir(t,"x",s[0])||Ir(t,"y",s[0])}return{}}function Or(t,e){const s=an[t.type]||{scales:{}},i=e.scales||{},n=Dr(t.type,e),a=Object.create(null);return Object.keys(i).forEach(e=>{const o=i[e];if(!Fs(o))return console.error(`Invalid scale configuration for scale: ${e}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const l=Er(e,o,Ur(e,t),cn.scales[o.type]),r=$r(l,n),d=s.scales||{};a[e]=Rs(Object.create(null),[{axis:l},o,d[l],d[r]])}),t.data.datasets.forEach(s=>{const n=s.type||t.type,o=s.indexAxis||Dr(n,e),l=an[n]||{},r=l.scales||{};Object.keys(r).forEach(t=>{const e=Ar(t,o),n=s[e+"AxisID"]||e;a[n]=a[n]||Object.create(null),Rs(a[n],[{axis:e},i[n],r[t]])})}),Object.keys(a).forEach(t=>{const e=a[t];Rs(e,[cn.scales[e.type],cn.scale])}),a}function Rr(t){const e=t.options||(t.options={});e.plugins=Ms(e.plugins,{}),e.scales=Or(t,e)}function Wr(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function Br(t){return t=t||{},t.data=Wr(t.data),Rr(t),t}const Nr=new Map,zr=new Set;function jr(t,e){let s=Nr.get(t);return s||(s=e(),Nr.set(t,s),zr.add(s)),s}const qr=(t,e,s)=>{const i=js(e,s);void 0!==i&&t.add(i)};class Hr{constructor(t){this._config=Br(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Wr(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Rr(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return jr(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return jr(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return jr(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return jr(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let i=s.get(t);return i&&!e||(i=new Map,s.set(t,i)),i}getOptionScopes(t,e,s){const{options:i,type:n}=this,a=this._cachedScopes(t,s),o=a.get(e);if(o)return o;const l=new Set;e.forEach(e=>{t&&(l.add(t),e.forEach(e=>qr(l,t,e))),e.forEach(t=>qr(l,i,t)),e.forEach(t=>qr(l,an[n]||{},t)),e.forEach(t=>qr(l,cn,t)),e.forEach(t=>qr(l,on,t))});const r=Array.from(l);return 0===r.length&&r.push(Object.create(null)),zr.has(e)&&a.set(e,r),r}chartOptionScopes(){const{options:t,type:e}=this;return[t,an[e]||{},cn.datasets[e]||{},{type:e},cn,on]}resolveNamedOptions(t,e,s,i=[""]){const n={$shared:!0},{resolver:a,subPrefixes:o}=Xr(this._resolverCache,t,i);let l=a;if(Qr(a,e)){n.$shared=!1,s=Xs(s)?s():s;const e=this.createResolver(t,s,o);l=Bn(a,s,e)}for(const r of e)n[r]=l[r];return n}createResolver(t,e,s=[""],i){const{resolver:n}=Xr(this._resolverCache,t,s);return Fs(e)?Bn(n,e,void 0,i):n}}function Xr(t,e,s){let i=t.get(e);i||(i=new Map,t.set(e,i));const n=s.join();let a=i.get(n);if(!a){const t=Wn(e,s);a={resolver:t,subPrefixes:s.filter(t=>!t.toLowerCase().includes("hover"))},i.set(n,a)}return a}const Kr=t=>Fs(t)&&Object.getOwnPropertyNames(t).some(e=>Xs(t[e]));function Qr(t,e){const{isScriptable:s,isIndexable:i}=Nn(t);for(const n of e){const e=s(n),a=i(n),o=(a||e)&&t[n];if(e&&(Xs(o)||Kr(o))||a&&Ss(o))return!0}return!1}var Yr="4.5.1";const Gr=["top","bottom","left","right","chartArea"];function Jr(t,e){return"top"===t||"bottom"===t||-1===Gr.indexOf(t)&&"x"===e}function Zr(t,e){return function(s,i){return s[t]===i[t]?s[e]-i[e]:s[t]-i[t]}}function td(t){const e=t.chart,s=e.options.animation;e.notifyPlugins("afterRender"),$s(s&&s.onComplete,[t],e)}function ed(t){const e=t.chart,s=e.options.animation;$s(s&&s.onProgress,[t],e)}function sd(t){return ma()&&"string"===typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const id={},nd=t=>{const e=sd(t);return Object.values(id).filter(t=>t.canvas===e).pop()};function ad(t,e,s){const i=Object.keys(t);for(const n of i){const i=+n;if(i>=e){const a=t[n];delete t[n],(s>0||i>e)&&(t[i+s]=a)}}}function od(t,e,s,i){return s&&"mouseout"!==t.type?i?e:t:null}class ld{static register(...t){Cr.add(...t),rd()}static unregister(...t){Cr.remove(...t),rd()}constructor(t,e){const s=this.config=new Hr(e),i=sd(t),n=nd(i);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Gl(i)),this.platform.updateConfig(s);const o=this.platform.acquireContext(i,a.aspectRatio),l=o&&o.canvas,r=l&&l.height,d=l&&l.width;this.id=ws(),this.ctx=o,this.canvas=l,this.width=d,this.height=r,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Sr,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Li(t=>this.update(t),a.resizeDelay||0),this._dataChanges=[],id[this.id]=this,o&&l?(so.listen(this,"complete",td),so.listen(this,"progress",ed),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:i,_aspectRatio:n}=this;return Cs(t)?e&&n?n:i?s/i:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Cr}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ma(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return fn(this.canvas,this.ctx),this}stop(){return so.stop(this),this}resize(t,e){so.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,i=this.canvas,n=s.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(i,t,e,n),o=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Ma(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),$s(s.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const t=this.options,e=t.scales||{};Vs(e,(t,e)=>{t.id=e})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,i=Object.keys(s).reduce((t,e)=>(t[e]=!1,t),{});let n=[];e&&(n=n.concat(Object.keys(e).map(t=>{const s=e[t],i=Er(t,s),n="r"===i,a="x"===i;return{options:s,dposition:n?"chartArea":a?"bottom":"left",dtype:n?"radialLinear":a?"category":"linear"}}))),Vs(n,e=>{const n=e.options,a=n.id,o=Er(a,n),l=Ms(n.type,e.dtype);void 0!==n.position&&Jr(n.position,o)===Jr(e.dposition)||(n.position=e.dposition),i[a]=!0;let r=null;if(a in s&&s[a].type===l)r=s[a];else{const t=Cr.getScale(l);r=new t({id:a,type:l,ctx:this.ctx,chart:this}),s[r.id]=r}r.init(n,t)}),Vs(i,(t,e)=>{t||delete s[e]}),Vs(s,t=>{Pl.configure(this,t,t.options),Pl.addBox(this,t)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((t,e)=>t.index-e.index),s>e){for(let t=e;te.length&&delete this._stacks,t.forEach((t,s)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,i;for(this._removeUnreferencedMetasets(),s=0,i=e.length;s{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let r=0,d=this.data.datasets.length;r{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Zr("z","_idx"));const{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){Vs(this.scales,t=>{Pl.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);Ks(e,s)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:i,count:n}of e){const e="_removeElements"===s?-n:n;ad(t,i,e)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),i=s(0);for(let n=1;nt.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Pl.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],Vs(this.boxes,t=>{s&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s={meta:t,index:t.index,cancelable:!0},i=to(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(i&&xn(e,i),t.controller.draw(),i&&vn(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return yn(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,i){const n=hl.modes[e];return"function"===typeof n?n(this,t,s,i):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let i=s.filter(t=>t&&t._dataset===e).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(i)),i}getContext(){return this.$context||(this.$context=Rn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return"boolean"===typeof s.hidden?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const i=s?"show":"hide",n=this.getDatasetMeta(t),a=n.controller._resolveAnimations(void 0,i);Hs(e)?(n.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),a.update(n,{visible:s}),this.update(e=>e.datasetIndex===t?i:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),so.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,s,i),t[s]=i},i=(t,e,s)=>{t.offsetX=e,t.offsetY=s,this._eventHandler(t)};Vs(this.options.events,t=>s(t,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(s,i)=>{e.addEventListener(this,s,i),t[s]=i},i=(s,i)=>{t[s]&&(e.removeEventListener(this,s,i),delete t[s])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let a;const o=()=>{i("attach",o),this.attached=!0,this.resize(),s("resize",n),s("detach",a)};a=()=>{this.attached=!1,i("resize",n),this._stop(),this._resize(0,0),s("attach",o)},e.isAttached(this.canvas)?o():a()}unbindEvents(){Vs(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},Vs(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const i=s?"set":"remove";let n,a,o,l;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+i+"DatasetHoverStyle"]()),o=0,l=t.length;o{const s=this.getDatasetMeta(t);if(!s)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:s.data[e],index:e}}),i=!Ls(s,e);i&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return 1===this._plugins._cache.filter(e=>e.plugin.id===t).length}_updateHoverStyles(t,e,s){const i=this.options.hover,n=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),a=n(e,t),o=s?t:n(t,e);a.length&&this.updateHoverStyle(a,i.mode,!1),o.length&&i.mode&&this.updateHoverStyle(o,i.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},i=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",s,i))return;const n=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,i),(n||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:i=[],options:n}=this,a=e,o=this._getActiveElements(t,i,s,a),l=Qs(t),r=od(t,this._lastEvent,s,l);s&&(this._lastEvent=null,$s(n.onHover,[t,o,this],this),l&&$s(n.onClick,[t,o,this],this));const d=!Ls(o,i);return(d||e)&&(this._active=o,this._updateHoverStyles(o,i,e)),this._lastEvent=r,d}_getActiveElements(t,e,s,i){if("mouseout"===t.type)return[];if(!s)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,i)}}function rd(){return Vs(ld.instances,t=>t._plugins.invalidate())}function dd(t,e,s){const{startAngle:i,x:n,y:a,outerRadius:o,innerRadius:l,options:r}=e,{borderWidth:d,borderJoinStyle:c}=r,h=Math.min(d/o,xi(i-s));if(t.beginPath(),t.arc(n,a,o-d/2,i+h/2,s-h/2),l>0){const e=Math.min(d/l,xi(i-s));t.arc(n,a,l+d/2,s-e/2,i+e/2,!0)}else{const e=Math.min(d/2,o*xi(i-s));if("round"===c)t.arc(n,a,e,s-Ys/2,i+Ys/2,!0);else if("bevel"===c){const o=2*e*e,l=-o*Math.cos(s+Ys/2)+n,r=-o*Math.sin(s+Ys/2)+a,d=o*Math.cos(i+Ys/2)+n,c=o*Math.sin(i+Ys/2)+a;t.lineTo(l,r),t.lineTo(d,c)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}function cd(t,e,s){const{startAngle:i,pixelMargin:n,x:a,y:o,outerRadius:l,innerRadius:r}=e;let d=n/l;t.beginPath(),t.arc(a,o,l,i-d,s+d),r>n?(d=n/r,t.arc(a,o,r,s+d,i-d,!0)):t.arc(a,o,n,s+ei,i-ei),t.closePath(),t.clip()}function hd(t){return $n(t,["outerStart","outerEnd","innerStart","innerEnd"])}function ud(t,e,s,i){const n=hd(t.options.borderRadius),a=(s-e)/2,o=Math.min(a,i*e/2),l=t=>{const e=(s-Math.min(a,t))*i/2;return _i(t,0,Math.min(a,e))};return{outerStart:l(n.outerStart),outerEnd:l(n.outerEnd),innerStart:_i(n.innerStart,0,o),innerEnd:_i(n.innerEnd,0,o)}}function pd(t,e,s,i){return{x:s+t*Math.cos(e),y:i+t*Math.sin(e)}}function gd(t,e,s,i,n,a){const{x:o,y:l,startAngle:r,pixelMargin:d,innerRadius:c}=e,h=Math.max(e.outerRadius+i+s-d,0),u=c>0?c+i+s+d:0;let p=0;const g=n-r;if(i){const t=c>0?c-i:0,e=h>0?h-i:0,s=(t+e)/2,n=0!==s?g*s/(s+i):g;p=(g-n)/2}const f=Math.max(.001,g*h-s/Ys)/h,m=(g-f)/2,b=r+m+p,y=n-m-p,{outerStart:x,outerEnd:v,innerStart:_,innerEnd:k}=ud(e,u,h,y-b),w=h-x,C=h-v,S=b+x/w,F=y-v/C,T=u+_,P=u+k,M=b+_/T,D=y-k/P;if(t.beginPath(),a){const e=(S+F)/2;if(t.arc(o,l,h,S,e),t.arc(o,l,h,e,F),v>0){const e=pd(C,F,o,l);t.arc(e.x,e.y,v,F,y+ei)}const s=pd(P,y,o,l);if(t.lineTo(s.x,s.y),k>0){const e=pd(P,D,o,l);t.arc(e.x,e.y,k,y+ei,D+Math.PI)}const i=(y-k/u+(b+_/u))/2;if(t.arc(o,l,u,y-k/u,i,!0),t.arc(o,l,u,i,b+_/u,!0),_>0){const e=pd(T,M,o,l);t.arc(e.x,e.y,_,M+Math.PI,b-ei)}const n=pd(w,b,o,l);if(t.lineTo(n.x,n.y),x>0){const e=pd(w,S,o,l);t.arc(e.x,e.y,x,b-ei,S)}}else{t.moveTo(o,l);const e=Math.cos(S)*h+o,s=Math.sin(S)*h+l;t.lineTo(e,s);const i=Math.cos(F)*h+o,n=Math.sin(F)*h+l;t.lineTo(i,n)}t.closePath()}function fd(t,e,s,i,n){const{fullCircles:a,startAngle:o,circumference:l}=e;let r=e.endAngle;if(a){gd(t,e,s,i,r,n);for(let e=0;e=Ys&&0===p&&"miter"!==c&&dd(t,e,f),a||(gd(t,e,s,i,f,n),t.stroke())}(0,De.A)(ld,"defaults",cn),(0,De.A)(ld,"instances",id),(0,De.A)(ld,"overrides",an),(0,De.A)(ld,"registry",Cr),(0,De.A)(ld,"version",Yr),(0,De.A)(ld,"getChart",nd);class bd extends Jl{constructor(t){super(),(0,De.A)(this,"circumference",void 0),(0,De.A)(this,"endAngle",void 0),(0,De.A)(this,"fullCircles",void 0),(0,De.A)(this,"innerRadius",void 0),(0,De.A)(this,"outerRadius",void 0),(0,De.A)(this,"pixelMargin",void 0),(0,De.A)(this,"startAngle",void 0),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,s){const i=this.getProps(["x","y"],s),{angle:n,distance:a}=mi(i,{x:t,y:e}),{startAngle:o,endAngle:l,innerRadius:r,outerRadius:d,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),h=(this.options.spacing+this.options.borderWidth)/2,u=Ms(c,l-o),p=vi(n,o,l)&&o!==l,g=u>=Gs||p,f=wi(a,r+h,d+h);return g&&f}getCenterPoint(t){const{x:e,y:s,startAngle:i,endAngle:n,innerRadius:a,outerRadius:o}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:r}=this.options,d=(i+n)/2,c=(a+o+r+l)/2;return{x:e+Math.cos(d)*c,y:s+Math.sin(d)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:s}=this,i=(e.offset||0)/4,n=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=s>Gs?Math.floor(s/Gs):0,0===s||this.innerRadius<0||this.outerRadius<0)return;t.save();const o=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(o)*i,Math.sin(o)*i);const l=1-Math.sin(Math.min(Ys,s||0)),r=i*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,fd(t,this,r,n,a),md(t,this,r,n,a),t.restore()}}function yd(t,e,s=e){t.lineCap=Ms(s.borderCapStyle,e.borderCapStyle),t.setLineDash(Ms(s.borderDash,e.borderDash)),t.lineDashOffset=Ms(s.borderDashOffset,e.borderDashOffset),t.lineJoin=Ms(s.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Ms(s.borderWidth,e.borderWidth),t.strokeStyle=Ms(s.borderColor,e.borderColor)}function xd(t,e,s){t.lineTo(s.x,s.y)}function vd(t){return t.stepped?_n:t.tension||"monotone"===t.cubicInterpolationMode?kn:xd}function _d(t,e,s={}){const i=t.length,{start:n=0,end:a=i-1}=s,{start:o,end:l}=e,r=Math.max(n,o),d=Math.min(a,l),c=nl&&a>l;return{count:i,start:r,loop:e.loop,ilen:d(o+(d?l-t:t))%a,x=()=>{p!==g&&(t.lineTo(m,g),t.lineTo(m,p),t.lineTo(m,f))};for(r&&(h=n[y(0)],t.moveTo(h.x,h.y)),c=0;c<=l;++c){if(h=n[y(c)],h.skip)continue;const e=h.x,s=h.y,i=0|e;i===u?(sg&&(g=s),m=(b*m+e)/++b):(x(),t.lineTo(e,s),u=i,b=0,p=g=s),f=s}x()}function Cd(t){const e=t.options,s=e.borderDash&&e.borderDash.length,i=!t._decimated&&!t._loop&&!e.tension&&"monotone"!==e.cubicInterpolationMode&&!e.stepped&&!s;return i?wd:kd}function Sd(t){return t.stepped?Va:t.tension||"monotone"===t.cubicInterpolationMode?La:$a}function Fd(t,e,s,i){let n=e._path;n||(n=e._path=new Path2D,e.path(n,s,i)&&n.closePath()),yd(t,e.options),t.stroke(n)}function Td(t,e,s,i){const{segments:n,options:a}=e,o=Cd(e);for(const l of n)yd(t,a,l.style),t.beginPath(),o(t,e,l,{start:s,end:s+i-1})&&t.closePath(),t.stroke()}(0,De.A)(bd,"id","arc"),(0,De.A)(bd,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),(0,De.A)(bd,"defaultRoutes",{backgroundColor:"backgroundColor"}),(0,De.A)(bd,"descriptors",{_scriptable:!0,_indexable:t=>"borderDash"!==t});const Pd="function"===typeof Path2D;function Md(t,e,s,i){Pd&&!e.options.segment?Fd(t,e,s,i):Td(t,e,s,i)}class Dd extends Jl{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||"monotone"===s.cubicInterpolationMode)&&!s.stepped&&!this._pointsUpdated){const i=s.spanGaps?this._loop:this._fullLoop;fa(this._points,s,t,i,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Xa(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,i=t[e],n=this.points,a=ja(this,{property:e,start:i,end:i});if(!a.length)return;const o=[],l=Sd(s);let r,d;for(r=0,d=a.length;r"borderDash"!==t&&"fill"!==t});class $d extends Jl{constructor(t){super(),(0,De.A)(this,"parsed",void 0),(0,De.A)(this,"skip",void 0),(0,De.A)(this,"stop",void 0),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,s){const i=this.options,{x:n,y:a}=this.getProps(["x","y"],s);return Math.pow(t-n,2)+Math.pow(e-a,2){e=Hd(t,e,n);const o=n[t],l=n[e];null!==i?(a.push({x:o.x,y:i}),a.push({x:l.x,y:i})):null!==s&&(a.push({x:s,y:o.y}),a.push({x:s,y:l.y}))}),a}function Hd(t,e,s){for(;e>t;e--){const t=s[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function Xd(t,e,s,i){return t&&e?i(t[s],e[s]):t?t[s]:e?e[s]:0}function Kd(t,e){let s=[],i=!1;return Ss(t)?(i=!0,s=t):s=qd(t,e),s.length?new Dd({points:s,options:{tension:0},_loop:i,_fullLoop:i}):null}function Qd(t){return t&&!1!==t.fill}function Yd(t,e,s){const i=t[e];let n=i.fill;const a=[e];let o;if(!s)return n;while(!1!==n&&-1===a.indexOf(n)){if(!Ts(n))return n;if(o=t[n],!o)return!1;if(o.visible)return n;a.push(n),n=o.fill}return!1}function Gd(t,e,s){const i=ec(t);if(Fs(i))return!isNaN(i.value)&&i;let n=parseFloat(i);return Ts(n)&&Math.floor(n)===n?Jd(i[0],e,n,s):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Jd(t,e,s,i){return"-"!==t&&"+"!==t||(s=e+s),!(s===e||s<0||s>=i)&&s}function Zd(t,e){let s=null;return"start"===t?s=e.bottom:"end"===t?s=e.top:Fs(t)?s=e.getPixelForValue(t.value):e.getBasePixel&&(s=e.getBasePixel()),s}function tc(t,e,s){let i;return i="start"===t?s:"end"===t?e.options.reverse?e.min:e.max:Fs(t)?t.value:e.getBaseValue(),i}function ec(t){const e=t.options,s=e.fill;let i=Ms(s&&s.target,s);return void 0===i&&(i=!!e.backgroundColor),!1!==i&&null!==i&&(!0===i?"origin":i)}function sc(t){const{scale:e,index:s,line:i}=t,n=[],a=i.segments,o=i.points,l=ic(e,s);l.push(Kd({x:null,y:e.bottom},i));for(let r=0;r=0;--o){const e=n[o].$filler;e&&(e.line.updateControlPoints(a,e.axis),i&&e.fill&&uc(t.ctx,e,a))}},beforeDatasetsDraw(t,e,s){if("beforeDatasetsDraw"!==s.drawTime)return;const i=t.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){const e=i[n].$filler;Qd(e)&&uc(t.ctx,e,t.chartArea)}},beforeDatasetDraw(t,e,s){const i=e.meta.$filler;Qd(i)&&"beforeDatasetDraw"===s.drawTime&&uc(t.ctx,i,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const vc=(t,e)=>{let{boxHeight:s=e,boxWidth:i=e}=t;return t.usePointStyle&&(s=Math.min(s,e),i=t.pointStyleWidth||Math.min(i,e)),{boxWidth:i,boxHeight:s,itemHeight:Math.max(e,s)}},_c=(t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class kc extends Jl{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=$s(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(e=>t.filter(e,this.chart.data))),t.sort&&(e=e.sort((e,s)=>t.sort(e,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const s=t.labels,i=In(s.font),n=i.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:l}=vc(s,n);let r,d;e.font=i.string,this.isHorizontal()?(r=this.maxWidth,d=this._fitRows(a,n,o,l)+10):(d=this.maxHeight,r=this._fitCols(a,i,o,l)+10),this.width=Math.min(r,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,i){const{ctx:n,maxWidth:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],r=this.lineWidths=[0],d=i+o;let c=t;n.textAlign="left",n.textBaseline="middle";let h=-1,u=-d;return this.legendItems.forEach((t,p)=>{const g=s+e/2+n.measureText(t.text).width;(0===p||r[r.length-1]+g+2*o>a)&&(c+=d,r[r.length-(p>0?0:1)]=0,u+=d,h++),l[p]={left:0,top:u,row:h,width:g,height:i},r[r.length-1]+=g+o}),c}_fitCols(t,e,s,i){const{ctx:n,maxHeight:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],r=this.columnSizes=[],d=a-t;let c=o,h=0,u=0,p=0,g=0;return this.legendItems.forEach((t,a)=>{const{itemWidth:f,itemHeight:m}=wc(s,e,n,t,i);a>0&&u+m+2*o>d&&(c+=h+o,r.push({width:h,height:u}),p+=h+o,g++,h=u=0),l[a]={left:p,top:u,col:g,width:f,height:m},h=Math.max(h,f),u+=m+o}),c+=h,r.push({width:h,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:i},rtl:n}}=this,a=Ua(n,this.left,this.width);if(this.isHorizontal()){let n=0,o=Ii(s,this.left+i,this.right-this.lineWidths[n]);for(const l of e)n!==l.row&&(n=l.row,o=Ii(s,this.left+i,this.right-this.lineWidths[n])),l.top+=this.top+t+i,l.left=a.leftForLtr(a.x(o),l.width),o+=l.width+i}else{let n=0,o=Ii(s,this.top+t+i,this.bottom-this.columnSizes[n].height);for(const l of e)l.col!==n&&(n=l.col,o=Ii(s,this.top+t+i,this.bottom-this.columnSizes[n].height)),l.top=o,l.left+=this.left+i,l.left=a.leftForLtr(a.x(l.left),l.width),o+=l.height+i}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;xn(t,this),this._draw(),vn(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:i}=this,{align:n,labels:a}=t,o=cn.color,l=Ua(t.rtl,this.left,this.width),r=In(a.font),{padding:d}=a,c=r.size,h=c/2;let u;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=r.string;const{boxWidth:p,boxHeight:g,itemHeight:f}=vc(a,c),m=function(t,e,s){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;i.save();const n=Ms(s.lineWidth,1);if(i.fillStyle=Ms(s.fillStyle,o),i.lineCap=Ms(s.lineCap,"butt"),i.lineDashOffset=Ms(s.lineDashOffset,0),i.lineJoin=Ms(s.lineJoin,"miter"),i.lineWidth=n,i.strokeStyle=Ms(s.strokeStyle,o),i.setLineDash(Ms(s.lineDash,[])),a.usePointStyle){const o={radius:g*Math.SQRT2/2,pointStyle:s.pointStyle,rotation:s.rotation,borderWidth:n},r=l.xPlus(t,p/2),d=e+h;bn(i,o,r,d,a.pointStyleWidth&&p)}else{const a=e+Math.max((c-g)/2,0),o=l.leftForLtr(t,p),r=Ln(s.borderRadius);i.beginPath(),Object.values(r).some(t=>0!==t)?Tn(i,{x:o,y:a,w:p,h:g,radius:r}):i.rect(o,a,p,g),i.fill(),0!==n&&i.stroke()}i.restore()},b=function(t,e,s){Fn(i,s.text,t,e+f/2,r,{strikethrough:s.hidden,textAlign:l.textAlign(s.textAlign)})},y=this.isHorizontal(),x=this._computeTitleHeight();u=y?{x:Ii(n,this.left+d,this.right-s[0]),y:this.top+d+x,line:0}:{x:this.left+d,y:Ii(n,this.top+x+d,this.bottom-e[0].height),line:0},Oa(this.ctx,t.textDirection);const v=f+d;this.legendItems.forEach((o,c)=>{i.strokeStyle=o.fontColor,i.fillStyle=o.fontColor;const g=i.measureText(o.text).width,f=l.textAlign(o.textAlign||(o.textAlign=a.textAlign)),_=p+h+g;let k=u.x,w=u.y;l.setWidth(this.width),y?c>0&&k+_+d>this.right&&(w=u.y+=v,u.line++,k=u.x=Ii(n,this.left+d,this.right-s[u.line])):c>0&&w+v>this.bottom&&(k=u.x=k+e[u.line].width+d,u.line++,w=u.y=Ii(n,this.top+x+d,this.bottom-e[u.line].height));const C=l.x(k);if(m(C,w,o),k=Ui(f,k+p+h,y?k+_:this.right,t.rtl),b(l.x(k),w,o),y)u.x+=_+d;else if("string"!==typeof o.text){const t=r.lineHeight;u.y+=Fc(o,t)+d}else u.y+=v}),Ra(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=In(e.font),i=En(e.padding);if(!e.display)return;const n=Ua(t.rtl,this.left,this.width),a=this.ctx,o=e.position,l=s.size/2,r=i.top+l;let d,c=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),d=this.top+r,c=Ii(t.align,c,this.right-h);else{const e=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);d=r+Ii(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=Ii(o,c,c+h);a.textAlign=n.textAlign(Ei(o)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=s.string,Fn(a,e.text,u,d,s)}_computeTitleHeight(){const t=this.options.title,e=In(t.font),s=En(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,i,n;if(wi(t,this.left,this.right)&&wi(e,this.top,this.bottom))for(n=this.legendHitBoxes,s=0;st.length>e.length?t:e)),e+s.size/2+i.measureText(n).width}function Sc(t,e,s){let i=t;return"string"!==typeof e.text&&(i=Fc(e,s)),i}function Fc(t,e){const s=t.text?t.text.length:0;return e*s}function Tc(t,e){return!("mousemove"!==t&&"mouseout"!==t||!e.onHover&&!e.onLeave)||!(!e.onClick||"click"!==t&&"mouseup"!==t)}var Pc={id:"legend",_element:kc,start(t,e,s){const i=t.legend=new kc({ctx:t.ctx,options:s,chart:t});Pl.configure(t,i,s),Pl.addBox(t,i)},stop(t){Pl.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,s){const i=t.legend;Pl.configure(t,i,s),i.options=s},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,s){const i=e.datasetIndex,n=s.chart;n.isDatasetVisible(i)?(n.hide(i),e.hidden=!0):(n.show(i),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:s,pointStyle:i,textAlign:n,color:a,useBorderRadius:o,borderRadius:l}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{const r=t.controller.getStyle(s?0:void 0),d=En(r.borderWidth);return{text:e[t.index].label,fillStyle:r.backgroundColor,fontColor:a,hidden:!t.visible,lineCap:r.borderCapStyle,lineDash:r.borderDash,lineDashOffset:r.borderDashOffset,lineJoin:r.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:r.borderColor,pointStyle:i||r.pointStyle,rotation:r.rotation,textAlign:n||r.textAlign,borderRadius:o&&(l||r.borderRadius),datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};new WeakMap;const Mc={average(t){if(!t.length)return!1;let e,s,i=new Set,n=0,a=0;for(e=0,s=t.length;et+e)/i.size;return{x:o,y:n/a}},nearest(t,e){if(!t.length)return!1;let s,i,n,a=e.x,o=e.y,l=Number.POSITIVE_INFINITY;for(s=0,i=t.length;s-1?t.split("\n"):t}function $c(t,e){const{element:s,datasetIndex:i,index:n}=e,a=t.getDatasetMeta(i).controller,{label:o,value:l}=a.getLabelAndValue(n);return{chart:t,label:o,parsed:a.getParsed(n),raw:t.data.datasets[i].data[n],formattedValue:l,dataset:a.getDataset(),dataIndex:n,datasetIndex:i,element:s}}function Vc(t,e){const s=t.chart.ctx,{body:i,footer:n,title:a}=t,{boxWidth:o,boxHeight:l}=e,r=In(e.bodyFont),d=In(e.titleFont),c=In(e.footerFont),h=a.length,u=n.length,p=i.length,g=En(e.padding);let f=g.height,m=0,b=i.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,h&&(f+=h*d.lineHeight+(h-1)*e.titleSpacing+e.titleMarginBottom),b){const t=e.displayColors?Math.max(l,r.lineHeight):r.lineHeight;f+=p*t+(b-p)*r.lineHeight+(b-1)*e.bodySpacing}u&&(f+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let y=0;const x=function(t){m=Math.max(m,s.measureText(t).width+y)};return s.save(),s.font=d.string,Vs(t.title,x),s.font=r.string,Vs(t.beforeBody.concat(t.afterBody),x),y=e.displayColors?o+2+e.boxPadding:0,Vs(i,t=>{Vs(t.before,x),Vs(t.lines,x),Vs(t.after,x)}),y=0,s.font=c.string,Vs(t.footer,x),s.restore(),m+=g.width,{width:m,height:f}}function Lc(t,e){const{y:s,height:i}=e;return st.height-i/2?"bottom":"center"}function Ec(t,e,s,i){const{x:n,width:a}=i,o=s.caretSize+s.caretPadding;return"left"===t&&n+a+o>e.width||("right"===t&&n-a-o<0||void 0)}function Ic(t,e,s,i){const{x:n,width:a}=s,{width:o,chartArea:{left:l,right:r}}=t;let d="center";return"center"===i?d=n<=(l+r)/2?"left":"right":n<=a/2?d="left":n>=o-a/2&&(d="right"),Ec(d,t,e,s)&&(d="center"),d}function Uc(t,e,s){const i=s.yAlign||e.yAlign||Lc(t,s);return{xAlign:s.xAlign||e.xAlign||Ic(t,e,s,i),yAlign:i}}function Oc(t,e){let{x:s,width:i}=t;return"right"===e?s-=i:"center"===e&&(s-=i/2),s}function Rc(t,e,s){let{y:i,height:n}=t;return"top"===e?i+=s:i-="bottom"===e?n+s:n/2,i}function Wc(t,e,s,i){const{caretSize:n,caretPadding:a,cornerRadius:o}=t,{xAlign:l,yAlign:r}=s,d=n+a,{topLeft:c,topRight:h,bottomLeft:u,bottomRight:p}=Ln(o);let g=Oc(e,l);const f=Rc(e,r,d);return"center"===r?"left"===l?g+=d:"right"===l&&(g-=d):"left"===l?g-=Math.max(c,u)+n:"right"===l&&(g+=Math.max(h,p)+n),{x:_i(g,0,i.width-e.width),y:_i(f,0,i.height-e.height)}}function Bc(t,e,s){const i=En(s.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.right:t.x+i.left}function Nc(t){return Dc([],Ac(t))}function zc(t,e,s){return Rn(t,{tooltip:e,tooltipItems:s,type:"tooltip"})}function jc(t,e){const s=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return s?t.override(s):t}const qc={beforeTitle:ks,title(t){if(t.length>0){const e=t[0],s=e.chart.data.labels,i=s?s.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex{const e={before:[],lines:[],after:[]},n=jc(s,t);Dc(e.before,Ac(Hc(n,"beforeLabel",this,t))),Dc(e.lines,Hc(n,"label",this,t)),Dc(e.after,Ac(Hc(n,"afterLabel",this,t))),i.push(e)}),i}getAfterBody(t,e){return Nc(Hc(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,i=Hc(s,"beforeFooter",this,t),n=Hc(s,"footer",this,t),a=Hc(s,"afterFooter",this,t);let o=[];return o=Dc(o,Ac(i)),o=Dc(o,Ac(n)),o=Dc(o,Ac(a)),o}_createItems(t){const e=this._active,s=this.chart.data,i=[],n=[],a=[];let o,l,r=[];for(o=0,l=e.length;ot.filter(e,i,n,s))),t.itemSort&&(r=r.sort((e,i)=>t.itemSort(e,i,s))),Vs(r,e=>{const s=jc(t.callbacks,e);i.push(Hc(s,"labelColor",this,e)),n.push(Hc(s,"labelPointStyle",this,e)),a.push(Hc(s,"labelTextColor",this,e))}),this.labelColors=i,this.labelPointStyles=n,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){const s=this.options.setContext(this.getContext()),i=this._active;let n,a=[];if(i.length){const t=Mc[s.position].call(this,i,this._eventPosition);a=this._createItems(s),this.title=this.getTitle(a,s),this.beforeBody=this.getBeforeBody(a,s),this.body=this.getBody(a,s),this.afterBody=this.getAfterBody(a,s),this.footer=this.getFooter(a,s);const e=this._size=Vc(this,s),o=Object.assign({},t,e),l=Uc(this.chart,s,o),r=Wc(s,o,l,this.chart);this.xAlign=l.xAlign,this.yAlign=l.yAlign,n={opacity:1,x:r.x,y:r.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=a,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,i){const n=this.getCaretPosition(t,s,i);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,s){const{xAlign:i,yAlign:n}=this,{caretSize:a,cornerRadius:o}=s,{topLeft:l,topRight:r,bottomLeft:d,bottomRight:c}=Ln(o),{x:h,y:u}=t,{width:p,height:g}=e;let f,m,b,y,x,v;return"center"===n?(x=u+g/2,"left"===i?(f=h,m=f-a,y=x+a,v=x-a):(f=h+p,m=f+a,y=x-a,v=x+a),b=f):(m="left"===i?h+Math.max(l,d)+a:"right"===i?h+p-Math.max(r,c)-a:this.caretX,"top"===n?(y=u,x=y-a,f=m-a,b=m+a):(y=u+g,x=y+a,f=m+a,b=m-a),v=y),{x1:f,x2:m,x3:b,y1:y,y2:x,y3:v}}drawTitle(t,e,s){const i=this.title,n=i.length;let a,o,l;if(n){const r=Ua(s.rtl,this.x,this.width);for(t.x=Bc(this,s.titleAlign,s),e.textAlign=r.textAlign(s.titleAlign),e.textBaseline="middle",a=In(s.titleFont),o=s.titleSpacing,e.fillStyle=s.titleColor,e.font=a.string,l=0;l0!==t)?(t.beginPath(),t.fillStyle=n.multiKeyBackground,Tn(t,{x:e,y:p,w:r,h:l,radius:o}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Tn(t,{x:s,y:p+1,w:r-2,h:l-2,radius:o}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,p,r,l),t.strokeRect(e,p,r,l),t.fillStyle=a.backgroundColor,t.fillRect(s,p+1,r-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:i}=this,{bodySpacing:n,bodyAlign:a,displayColors:o,boxHeight:l,boxWidth:r,boxPadding:d}=s,c=In(s.bodyFont);let h=c.lineHeight,u=0;const p=Ua(s.rtl,this.x,this.width),g=function(s){e.fillText(s,p.x(t.x+u),t.y+h/2),t.y+=h+n},f=p.textAlign(a);let m,b,y,x,v,_,k;for(e.textAlign=a,e.textBaseline="middle",e.font=c.string,t.x=Bc(this,f,s),e.fillStyle=s.bodyColor,Vs(this.beforeBody,g),u=o&&"right"!==f?"center"===a?r/2+d:r+2+d:0,x=0,_=i.length;x<_;++x){for(m=i[x],b=this.labelTextColors[x],e.fillStyle=b,Vs(m.before,g),y=m.lines,o&&y.length&&(this._drawColorBox(e,t,x,p,s),h=Math.max(c.lineHeight,l)),v=0,k=y.length;v0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,i=s&&s.x,n=s&&s.y;if(i||n){const s=Mc[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=Vc(this,t),o=Object.assign({},s,this._size),l=Uc(e,t,o),r=Wc(t,o,l,e);i._to===r.x&&n._to===r.y||(this.xAlign=l.xAlign,this.yAlign=l.yAlign,this.width=a.width,this.height=a.height,this.caretX=s.x,this.caretY=s.y,this._resolveAnimations().update(this,r))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const i={width:this.width,height:this.height},n={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const a=En(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=s,this.drawBackground(n,t,i,e),Oa(t,e.textDirection),n.y+=a.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Ra(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,i=t.map(({datasetIndex:t,index:e})=>{const s=this.chart.getDatasetMeta(t);if(!s)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:s.data[e],index:e}}),n=!Ls(s,i),a=this._positionChanged(i,e);(n||a)&&(this._active=i,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,n=this._active||[],a=this._getActiveElements(t,n,e,s),o=this._positionChanged(a,t),l=e||!Ls(a,n)||o;return l&&(this._active=a,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,i){const n=this.options;if("mouseout"===t.type)return[];if(!i)return e.filter(t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index));const a=this.chart.getElementsAtEventForMode(t,n.mode,n,s);return n.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:s,caretY:i,options:n}=this,a=Mc[n.position].call(this,t,e);return!1!==a&&(s!==a.x||i!==a.y)}}(0,De.A)(Xc,"positioners",Mc);var Kc={id:"tooltip",_element:Xc,positioners:Mc,afterInit(t,e,s){s&&(t.tooltip=new Xc({chart:t,options:s}))},beforeUpdate(t,e,s){t.tooltip&&t.tooltip.initialize(s)},reset(t,e,s){t.tooltip&&t.tooltip.initialize(s)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const s={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...s,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",s)}},afterEvent(t,e){if(t.tooltip){const s=e.replay;t.tooltip.handleEvent(e.event,s,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:qc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Qc=(t,e,s,i)=>("string"===typeof e?(s=t.push(e)-1,i.unshift({index:s,label:e})):isNaN(e)&&(s=null),s);function Yc(t,e,s,i){const n=t.indexOf(e);if(-1===n)return Qc(t,e,s,i);const a=t.lastIndexOf(e);return n!==a?s:n}const Gc=(t,e)=>null===t?null:_i(Math.round(t),0,e);function Jc(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function th(t,e){const s=[],i=1e-14,{bounds:n,step:a,min:o,max:l,precision:r,count:d,maxTicks:c,maxDigits:h,includeBounds:u}=t,p=a||1,g=c-1,{min:f,max:m}=e,b=!Cs(o),y=!Cs(l),x=!Cs(d),v=(m-f)/(h+1);let _,k,w,C,S=li((m-f)/g/p)*p;if(Sg&&(S=li(C*S/g/p)*p),Cs(r)||(_=Math.pow(10,r),S=Math.ceil(S*_)/_),"ticks"===n?(k=Math.floor(f/S)*S,w=Math.ceil(m/S)*S):(k=f,w=m),b&&y&&a&&hi((l-o)/a,S/1e3)?(C=Math.round(Math.min((l-o)/S,c)),S=(l-o)/C,k=o,w=l):x?(k=b?o:k,w=y?l:w,C=d-1,S=(w-k)/C):(C=(w-k)/S,C=oi(C,Math.round(C),S/1e3)?Math.round(C):Math.ceil(C));const F=Math.max(fi(S),fi(k));_=Math.pow(10,Cs(r)?F:r),k=Math.round(k*_)/_,w=Math.round(w*_)/_;let T=0;for(b&&(u&&k!==o?(s.push({value:o}),kl)break;s.push({value:t})}return y&&u&&w!==l?s.length&&oi(s[s.length-1].value,l,eh(l,v,t))?s[s.length-1].value=l:s.push({value:l}):y&&w!==l||s.push({value:w}),s}function eh(t,e,{horizontal:s,minRotation:i}){const n=pi(i),a=(s?Math.sin(n):Math.cos(n))||.001,o=.75*e*(""+t).length;return Math.min(e/a,o)}(0,De.A)(Zc,"id","category"),(0,De.A)(Zc,"defaults",{ticks:{callback:Jc}});class sh extends yr{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return Cs(t)||("number"===typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:i,max:n}=this;const a=t=>i=e?i:t,o=t=>n=s?n:t;if(t){const t=ai(i),e=ai(n);t<0&&e<0?o(0):t>0&&e>0&&a(0)}if(i===n){let e=0===n?1:Math.abs(.05*n);o(n+e),t||a(i-e)}this.min=i,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:s,stepSize:i}=t;return i?(e=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),s=s||11),s&&(e=Math.min(s,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const i={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},n=this._range||this,a=th(i,n);return"ticks"===t.bounds&&ui(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const i=(s-e)/Math.max(t.length-1,1)/2;e-=i,s+=i}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return Zi(t,this.chart.options.locale,this.options.ticks.format)}}class ih extends sh{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Ts(t)?t:0,this.max=Ts(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=pi(this.options.ticks.minRotation),i=(t?Math.sin(s):Math.cos(s))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/i))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}(0,De.A)(ih,"id","linear"),(0,De.A)(ih,"defaults",{ticks:{callback:sn.formatters.numeric}});const nh=t=>Math.floor(ni(t)),ah=(t,e)=>Math.pow(10,nh(t)+e);function oh(t){const e=t/Math.pow(10,nh(t));return 1===e}function lh(t,e,s){const i=Math.pow(10,s),n=Math.floor(t/i),a=Math.ceil(e/i);return a-n}function rh(t,e){const s=e-t;let i=nh(s);while(lh(t,e,i)>10)i++;while(lh(t,e,i)<10)i--;return Math.min(i,nh(t))}function dh(t,{min:e,max:s}){e=Ps(t.min,e);const i=[],n=nh(e);let a=rh(e,s),o=a<0?Math.pow(10,Math.abs(a)):1;const l=Math.pow(10,a),r=n>a?Math.pow(10,n):0,d=Math.round((e-r)*o)/o,c=Math.floor((e-r)/l/10)*l*10;let h=Math.floor((d-c)/Math.pow(10,a)),u=Ps(t.min,Math.round((r+c+h*Math.pow(10,a))*o)/o);while(u=10?h=h<15?15:20:h++,h>=20&&(a++,h=2,o=a>=0?1:o),u=Math.round((r+c+h*Math.pow(10,a))*o)/o;const p=Ps(t.max,u);return i.push({value:p,major:oh(p),significand:h}),i}class ch extends yr{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const s=sh.prototype.parse.apply(this,[t,e]);if(0!==s)return Ts(s)&&s>0?s:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Ts(t)?Math.max(0,t):null,this.max=Ts(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Ts(this._userMin)&&(this.min=t===ah(this.min,0)?ah(this.min,-1):ah(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let s=this.min,i=this.max;const n=e=>s=t?s:e,a=t=>i=e?i:t;s===i&&(s<=0?(n(1),a(10)):(n(ah(s,-1)),a(ah(i,1)))),s<=0&&n(ah(i,-1)),i<=0&&a(ah(s,1)),this.min=s,this.max=i}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},s=dh(e,this);return"ticks"===t.bounds&&ui(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return void 0===t?"0":Zi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ni(t),this._valueRange=ni(this.max)-ni(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ni(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function hh(t){const e=t.ticks;if(e.display&&t.display){const t=En(e.backdropPadding);return Ms(e.font&&e.font.size,cn.font.size)+t.height}return 0}function uh(t,e,s){return s=Ss(s)?s:[s],{w:pn(t,e.string,s),h:s.length*e.lineHeight}}function ph(t,e,s,i,n){return t===i||t===n?{start:e-s/2,end:e+s/2}:tn?{start:e-s,end:e}:{start:e,end:e+s}}function gh(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},s=Object.assign({},e),i=[],n=[],a=t._pointLabels.length,o=t.options.pointLabels,l=o.centerPointLabels?Ys/a:0;for(let r=0;re.r&&(l=(i.end-e.r)/a,t.r=Math.max(t.r,e.r+l)),n.starte.b&&(r=(n.end-e.b)/o,t.b=Math.max(t.b,e.b+r))}function mh(t,e,s){const i=t.drawingArea,{extra:n,additionalAngle:a,padding:o,size:l}=s,r=t.getPointPosition(e,i+n+o,a),d=Math.round(gi(xi(r.angle+ei))),c=_h(r.y,l.h,d),h=xh(d),u=vh(r.x,l.w,h);return{visible:!0,x:r.x,y:c,textAlign:h,left:u,top:c,right:u+l.w,bottom:c+l.h}}function bh(t,e){if(!e)return!0;const{left:s,top:i,right:n,bottom:a}=t,o=yn({x:s,y:i},e)||yn({x:s,y:a},e)||yn({x:n,y:i},e)||yn({x:n,y:a},e);return!o}function yh(t,e,s){const i=[],n=t._pointLabels.length,a=t.options,{centerPointLabels:o,display:l}=a.pointLabels,r={extra:hh(a)/2,additionalAngle:o?Ys/n:0};let d;for(let c=0;c270||s<90)&&(t-=e),t}function kh(t,e,s){const{left:i,top:n,right:a,bottom:o}=s,{backdropColor:l}=e;if(!Cs(l)){const s=Ln(e.borderRadius),r=En(e.backdropPadding);t.fillStyle=l;const d=i-r.left,c=n-r.top,h=a-i+r.width,u=o-n+r.height;Object.values(s).some(t=>0!==t)?(t.beginPath(),Tn(t,{x:d,y:c,w:h,h:u,radius:s}),t.fill()):t.fillRect(d,c,h,u)}}function wh(t,e){const{ctx:s,options:{pointLabels:i}}=t;for(let n=e-1;n>=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const a=i.setContext(t.getPointLabelContext(n));kh(s,a,e);const o=In(a.font),{x:l,y:r,textAlign:d}=e;Fn(s,t._pointLabels[n],l,r+o.lineHeight/2,o,{color:a.color,textAlign:d,textBaseline:"middle"})}}function Ch(t,e,s,i){const{ctx:n}=t;if(s)n.arc(t.xCenter,t.yCenter,e,0,Gs);else{let s=t.getPointPosition(0,e);n.moveTo(s.x,s.y);for(let a=1;a{const s=$s(this.options.pointLabels.callback,[t,e],this);return s||0===s?s:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){const t=this.options;t.display&&t.pointLabels.display?gh(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,i){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,i))}getIndexAngle(t){const e=Gs/(this._pointLabels.length||1),s=this.options.startAngle||0;return xi(t*e+pi(s))}getDistanceFromCenterForValue(t){if(Cs(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(Cs(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(0!==e||0===e&&this.min<0){l=this.getDistanceFromCenterForValue(t.value);const s=this.getContext(e),o=i.setContext(s),r=n.setContext(s);Sh(this,o,l,a,r)}}),s.display){for(t.save(),o=a-1;o>=0;o--){const i=s.setContext(this.getPointLabelContext(o)),{color:n,lineWidth:a}=i;a&&n&&(t.lineWidth=a,t.strokeStyle=n,t.setLineDash(i.borderDash),t.lineDashOffset=i.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),r=this.getPointPosition(o,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(r.x,r.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,s=e.ticks;if(!s.display)return;const i=this.getIndexAngle(0);let n,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(i),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((i,o)=>{if(0===o&&this.min>=0&&!e.reverse)return;const l=s.setContext(this.getContext(o)),r=In(l.font);if(n=this.getDistanceFromCenterForValue(this.ticks[o].value),l.showLabelBackdrop){t.font=r.string,a=t.measureText(i.label).width,t.fillStyle=l.backdropColor;const e=En(l.backdropPadding);t.fillRect(-a/2-e.left,-n-r.size/2-e.top,a+e.width,r.size+e.height)}Fn(t,i.label,0,-n,r,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),t.restore()}drawTitle(){}}(0,De.A)(Th,"id","radialLinear"),(0,De.A)(Th,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:sn.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),(0,De.A)(Th,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),(0,De.A)(Th,"descriptors",{angleLines:{_fallback:"grid"}});const Ph={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Mh=Object.keys(Ph);function Dh(t,e){return t-e}function Ah(t,e){if(Cs(e))return null;const s=t._adapter,{parser:i,round:n,isoWeekday:a}=t._parseOpts;let o=e;return"function"===typeof i&&(o=i(o)),Ts(o)||(o="string"===typeof i?s.parse(o,i):s.parse(o)),null===o?null:(n&&(o="week"!==n||!ci(a)&&!0!==a?s.startOf(o,n):s.startOf(o,"isoWeek",a)),+o)}function $h(t,e,s,i){const n=Mh.length;for(let a=Mh.indexOf(t);a=Mh.indexOf(s);a--){const s=Mh[a];if(Ph[s].common&&t._adapter.diff(n,i,s)>=e-1)return s}return Mh[s?Mh.indexOf(s):0]}function Lh(t){for(let e=Mh.indexOf(t)+1,s=Mh.length;e=e?s[i]:s[n];t[a]=!0}}else t[e]=!0}function Ih(t,e,s,i){const n=t._adapter,a=+n.startOf(e[0].value,i),o=e[e.length-1].value;let l,r;for(l=a;l<=o;l=+n.add(l,1,i))r=s[l],r>=0&&(e[r].major=!0);return e}function Uh(t,e,s){const i=[],n={},a=e.length;let o,l;for(o=0;o+t.value))}initOffsets(t=[]){let e,s,i=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),i=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,s=this.getDecimalForValue(t[t.length-1]),n=1===t.length?s:(s-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;i=_i(i,0,a),n=_i(n,0,a),this._offsets={start:i,end:n,factor:1/(i+1+n)}}_generate(){const t=this._adapter,e=this.min,s=this.max,i=this.options,n=i.time,a=n.unit||$h(n.minUnit,e,s,this._getLabelCapacity(e)),o=Ms(i.ticks.stepSize,1),l="week"===a&&n.isoWeekday,r=ci(l)||!0===l,d={};let c,h,u=e;if(r&&(u=+t.startOf(u,"isoWeek",l)),u=+t.startOf(u,r?"day":a),t.diff(s,e,a)>1e5*o)throw new Error(e+" and "+s+" are too far apart with stepSize of "+o+" "+a);const p="data"===i.ticks.source&&this.getDataTimestamps();for(c=u,h=0;c+t)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const s=this.options,i=s.time.displayFormats,n=this._unit,a=e||i[n];return this._adapter.format(t,a)}_tickFormatFunction(t,e,s,i){const n=this.options,a=n.ticks.callback;if(a)return $s(a,[t,e,s],this);const o=n.time.displayFormats,l=this._unit,r=this._majorUnit,d=l&&o[l],c=r&&o[r],h=s[e],u=r&&c&&h&&h.major;return this._adapter.format(t,i||(u?c:d))}generateTickLabels(t){let e,s,i;for(e=0,s=t.length;e0?o:1}getDataTimestamps(){let t,e,s=this._cache.data||[];if(s.length)return s;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(t=0,e=i.length;t=t[l].pos&&e<=t[r].pos&&({lo:l,hi:r}=Si(t,"pos",e)),({pos:i,time:a}=t[l]),({pos:n,time:o}=t[r])):(e>=t[l].time&&e<=t[r].time&&({lo:l,hi:r}=Si(t,"time",e)),({time:i,pos:a}=t[l]),({time:n,pos:o}=t[r]));const d=n-i;return d?a+(o-a)*(e-i)/d:a}(0,De.A)(Oh,"id","time"),(0,De.A)(Oh,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});class Wh extends Oh{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Rh(e,this.min),this._tableRange=Rh(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,i=[],n=[];let a,o,l,r,d;for(a=0,o=t.length;a=e&&r<=s&&i.push(r);if(i.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(a=0,o=i.length;at-e)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return t=e.length&&s.length?this.normalize(e.concat(s)):e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(Rh(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Rh(this._table,s*this._tableRange+this._minPos,!0)}}(0,De.A)(Wh,"id","timeseries"),(0,De.A)(Wh,"defaults",Oh.defaults);var Bh=s(90144);const Nh={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},zh={ariaLabel:{type:String},ariaDescribedby:{type:String}},jh={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Nh,...zh},qh="2"===i.rE[0]?(t,e)=>Object.assign(t,{attrs:e}):(t,e)=>Object.assign(t,e);function Hh(t){return(0,Bh.ju)(t)?(0,Bh.ux)(t):t}function Xh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return(0,Bh.ju)(e)?new Proxy(t,{}):t}function Kh(t,e){const s=t.options;s&&e&&Object.assign(s,e)}function Qh(t,e){t.labels=e}function Yh(t,e,s){const i=[];t.datasets=e.map(e=>{const n=t.datasets.find(t=>t[s]===e[s]);return n&&e.data&&!i.includes(n)?(i.push(n),Object.assign(n,e),n):{...e}})}function Gh(t,e){const s={labels:[],datasets:[]};return Qh(s,t.labels),Yh(s,t.datasets,e),s}const Jh=(0,i.pM)({props:jh,setup(t,e){let{expose:s,slots:n}=e;const a=(0,Bh.KR)(null),o=(0,Bh.IJ)(null);s({chart:o});const l=()=>{if(!a.value)return;const{type:e,data:s,options:i,plugins:n,datasetIdKey:l}=t,r=Gh(s,l),d=Xh(r,s);o.value=new ld(a.value,{type:e,data:d,options:{...i},plugins:n})},r=()=>{const e=(0,Bh.ux)(o.value);e&&(t.destroyDelay>0?setTimeout(()=>{e.destroy(),o.value=null},t.destroyDelay):(e.destroy(),o.value=null))},d=e=>{e.update(t.updateMode)};return(0,i.sV)(l),(0,i.hi)(r),(0,i.wB)([()=>t.options,()=>t.data],(e,s)=>{let[n,a]=e,[l,r]=s;const c=(0,Bh.ux)(o.value);if(!c)return;let h=!1;if(n){const t=Hh(n),e=Hh(l);t&&t!==e&&(Kh(c,t),h=!0)}if(a){const e=Hh(a.labels),s=Hh(r.labels),i=Hh(a.datasets),n=Hh(r.datasets);e!==s&&(Qh(c.config.data,e),h=!0),i&&i!==n&&(Yh(c.config.data,i,t.datasetIdKey),h=!0)}h&&(0,i.dY)(()=>{d(c)})},{deep:!0}),()=>(0,i.h)("canvas",{role:"img","aria-label":t.ariaLabel,"aria-describedby":t.ariaDescribedby,ref:a},[(0,i.h)("p",{},[n.default?n.default():""])])}});function Zh(t,e){return ld.register(e),(0,i.pM)({props:Nh,setup(e,s){let{expose:n}=s;const a=(0,Bh.IJ)(null),o=t=>{a.value=t?.chart};return n({chart:a}),()=>(0,i.h)(Jh,qh({ref:o},{type:t,...e}))}})}const tu=Zh("doughnut",Ko),eu=Zh("line",Qo);s(79577),s(41549),s(49797),s(49631),s(35623);class su extends Error{constructor(t,e,s=!1,i=""){super(t),this.name="BatchOperationError",this.code=e,this.recoverable=s,this.suggestion=i}}const iu={401:()=>new su("认证失败,请重新登录","AUTH_FAILED",!1,"请刷新页面并重新登录"),403:()=>new su("权限不足或请求被拒绝","FORBIDDEN",!1,"请确认您有管理员权限"),400:t=>new su(`请求数据无效: ${t}`,"INVALID_DATA",!0,"请检查数据格式后重试"),500:()=>new su("服务器内部错误","SERVER_ERROR",!0,"请稍后重试,如果问题持续请联系管理员"),NETWORK:()=>new su("网络连接失败","NETWORK_ERROR",!0,"请检查网络连接后重试"),ABORT:()=>new su("操作已取消","ABORTED",!1,"")};function nu(t,e=""){if("AbortError"===t.name)return iu.ABORT();if(t instanceof Response||t&&"number"===typeof t.status){const s=iu[t.status];return s?s(e):new su(`请求失败: ${t.status}`,"HTTP_ERROR",!0,"请稍后重试")}return t instanceof TypeError&&t.message.includes("fetch")?iu.NETWORK():new su(t.message||"未知错误","UNKNOWN_ERROR",!0,"请稍后重试")}class au{constructor(t={}){this.batchSize=t.batchSize||1e3,this.onProgress=t.onProgress||(()=>{}),this.onError=t.onError||(()=>{}),this.abortController=null}async fetchAllRecords(t=!1){this.abortController=new AbortController;const e=[];let s=null,i=0,n=0;try{do{if(this.abortController.signal.aborted)break;const a=await this.fetchBatch(s,t);e.push(...a.records),s=a.nextCursor,i+=a.records.length,n++,this.onProgress({phase:"fetching",current:i,batchCount:n,message:`已获取 ${i} 条记录...`})}while(s&&!this.abortController.signal.aborted);if(this.abortController.signal.aborted)throw iu.ABORT();return e}catch(a){const t=a instanceof su?a:nu(a);throw this.onError(t),t}}async fetchBatch(t,e){const s=new URLSearchParams;t&&s.set("cursor",t),e&&s.set("includeValue","true"),s.set("limit",String(this.batchSize));try{const t=await(0,Pe.A)(`/api/manage/batch/list?${s}`,{signal:this.abortController.signal});if(!t.ok){let e="";try{const s=await t.json();e=s.error||""}catch{}throw nu(t,e)}const e=await t.json();if(!e.success)throw new su(e.error||"请求失败","API_ERROR",!0,"请稍后重试");return{records:e.records||[],nextCursor:e.nextCursor||null,totalProcessed:e.totalProcessed||0}}catch(i){if(i instanceof su)throw i;throw nu(i)}}abort(){this.abortController&&this.abortController.abort()}isAborted(){return!!this.abortController&&this.abortController.signal.aborted}reset(){this.abortController=null}}var ou=au;class lu{constructor(t={}){this.chunkSize=t.chunkSize||null,this.maxRetries=t.maxRetries||3,this.retryDelay=t.retryDelay||1e3,this.onProgress=t.onProgress||(()=>{}),this.onError=t.onError||(()=>{}),this.sessionId=this.generateSessionId(),this.aborted=!1}async fetchConfig(){try{const t=await(0,Pe.A)("/api/manage/batch/index/config");if(!t.ok)throw new Error("获取配置失败");const e=await t.json();if(e.success)return{chunkSize:e.chunkSize||500,databaseType:e.databaseType||"unknown"};throw new Error(e.error||"获取配置失败")}catch(t){return console.warn("Failed to fetch index config, using default:",t),{chunkSize:500,databaseType:"unknown"}}}async rebuild(){this.aborted=!1;try{if(!this.chunkSize){const t=await this.fetchConfig();this.chunkSize=t.chunkSize}this.onProgress({phase:"fetching",message:"正在获取数据...",current:0});const t=new ou({onProgress:t=>this.onProgress({...t,phase:"fetching"}),onError:t=>this.onError(t)}),e=await t.fetchAllRecords(!1);if(this.aborted)throw new su("操作已取消","ABORTED",!1,"");if(this.onProgress({phase:"sorting",message:"正在排序...",current:0,total:e.length}),this.sortByTimestampDescending(e),this.aborted)throw new su("操作已取消","ABORTED",!1,"");const s=this.splitIntoChunks(e);for(let i=0;i{const s=t.metadata&&t.metadata.TimeStamp||0,i=e.metadata&&e.metadata.TimeStamp||0;return i-s})}splitIntoChunks(t){const e=[];for(let s=0;st.toString(16).padStart(2,"0")).join("")}let n=2166136261,a=2166136261;for(let o=0;o>>0,a=Math.imul(a^i[o],16777635)>>>0;return n.toString(16).padStart(8,"0")+a.toString(16).padStart(8,"0")}createHttpError(t,e=""){switch(t){case 401:return new su("认证失败,请重新登录","AUTH_FAILED",!1,"请刷新页面并重新登录");case 403:return new su("权限不足或请求被拒绝","FORBIDDEN",!1,"请确认您有管理员权限");case 400:return new su(`请求数据无效: ${e}`,"INVALID_DATA",!0,"请检查数据格式后重试");case 404:return new su("会话不存在","SESSION_NOT_FOUND",!1,"请重新开始索引重建");case 410:return new su("会话已过期","SESSION_EXPIRED",!1,"请重新开始索引重建");case 500:default:return new su(`服务器错误: ${e||t}`,"SERVER_ERROR",!0,"请稍后重试")}}sleep(t){return new Promise(e=>setTimeout(e,t))}abort(){this.aborted=!0}reset(){this.aborted=!1,this.sessionId=this.generateSessionId()}}var ru=lu;class du{constructor(t={}){this.onProgress=t.onProgress||(()=>{}),this.processor=null}async generateBackup(){this.processor=new ou({onProgress:t=>this.onProgress({...t,phase:"fetching"})});const t=await this.processor.fetchAllRecords(!0);this.onProgress({phase:"building",message:"正在构建备份数据..."});const e={timestamp:Date.now(),version:Me.rE,data:{fileCount:t.length,files:{},settings:{}}};for(const n of t)e.data.files[n.id]={metadata:n.metadata,value:n.value||null};const s=await this.fetchSettings();e.data.settings=s,this.onProgress({phase:"downloading",message:"正在生成下载..."}),this.downloadBackup(e);const i=Object.keys(s).length;return{success:!0,fileCount:t.length,settingsCount:i}}async fetchSettings(){try{const t=await(0,Pe.A)("/api/manage/batch/settings");if(!t.ok)return console.warn("Failed to fetch settings:",t.status),{};const e=await t.json();return e.settings||{}}catch(t){return console.warn("Failed to fetch settings:",t),{}}}downloadBackup(t){const e=JSON.stringify(t,null,2),s=new Blob([e],{type:"application/json"}),i=URL.createObjectURL(s),n=document.createElement("a");n.href=i,n.download=`imgbed_backup_${(new Date).toISOString().split("T")[0]}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(i)}abort(){this.processor&&this.processor.abort()}isAborted(){return!!this.processor&&this.processor.isAborted()}}var cu=du;class hu{constructor(t={}){this.chunkSize=t.chunkSize||50,this.maxRetries=t.maxRetries||3,this.retryDelay=t.retryDelay||1e3,this.onProgress=t.onProgress||(()=>{}),this.onError=t.onError||(()=>{}),this.aborted=!1}async restore(t){if(this.aborted=!1,!t||!t.data)throw new su("备份文件格式无效","INVALID_BACKUP",!1,"请选择有效的备份文件");const{files:e={},settings:s={}}=t.data,i=Object.entries(e),n=Object.entries(s),a=i.length,o=n.length,l=a+o;let r=0,d=0,c=0,h=0;try{this.onProgress({phase:"restoring_files",message:"正在恢复文件数据...",current:0,total:l});const e=this.splitIntoChunks(i,this.chunkSize);for(let t=0;tsetTimeout(e,t))}abort(){this.aborted=!0}}var uu=hu;ld.register(bd,Kc,Pc,Zc,ih,$d,Dd,xc);const pu=864e5;function gu(t){return String(t).padStart(2,"0")}function fu(t){return`${t.getFullYear()}-${gu(t.getMonth()+1)}-${gu(t.getDate())}`}function mu(){const t=new Date;t.setHours(0,0,0,0);const e=new Date(t.getTime()-6*pu);return[fu(e),fu(t)]}var bu={name:"SysCogStatus",components:{Doughnut:tu,Line:eu,DateRangeCalendar:H},data(){return{loading:!1,rebuilding:!1,backing:!1,restoring:!1,indexInfo:{},version:Me.rE,loadErrors:{newest:!1,oldest:!1},trendGroupBy:"channel",trendDatePickerVisible:!1,trendDateRange:mu(),channelColors:["#8B5CF6","#EC4899","#06B6D4","#10B981","#F59E0B","#EF4444","#6366F1","#84CC16"],typeColors:["#10B981","#3B82F6","#F59E0B","#EF4444","#8B5CF6","#EC4899","#06B6D4","#84CC16"],trendColors:["#2563EB","#10B981","#F59E0B","#EF4444","#8B5CF6","#06B6D4","#EC4899","#84CC16","#64748B"],isProcessing:!1,processingPhase:"",processingProgress:{current:0,total:0,message:"",percentage:0},processingError:null,processingStartTime:null,currentRebuilder:null,currentBackupGenerator:null,currentRestoreProcessor:null}},computed:{channelChartData(){const t=this.indexInfo.channelStats||{};return{labels:Object.keys(t),datasets:[{data:Object.values(t),backgroundColor:this.channelColors.slice(0,Object.keys(t).length),borderWidth:0}]}},typeChartData(){const t=this.aggregatedTypeStats;return{labels:Object.keys(t),datasets:[{data:Object.values(t),backgroundColor:this.typeColors.slice(0,Object.keys(t).length),borderWidth:0}]}},aggregatedTypeStats(){const t=this.indexInfo.typeStats||{},e={};for(const[s,i]of Object.entries(t)){const t="Block"===s?this.$t("sysStatus.blocked"):this.$t("sysStatus.normalStatus");e[t]=(e[t]||0)+i}return e},currentTrendGroup(){const t=this.indexInfo.uploadTrend||{},e=t.groupBy||{};return e[this.trendGroupBy]||{series:[]}},trendRawLabels(){const t=this.indexInfo.uploadTrend||{};return t.labels||[]},trendRangeCrossesYear(){const t=new Set;return this.trendRawLabels.forEach(e=>{this.extractTrendLabelDates(e).forEach(e=>t.add(e.year))}),t.size>1},trendDisplayLabels(){return this.trendRawLabels.map(t=>this.formatTrendAxisLabel(t))},hasTrendData(){const t=this.indexInfo.uploadTrend||{};return(t.labels||[]).length>0},trendDateDialogWidth(){return window.innerWidth>768?"420px":"90%"},uploadTrendChartData(){const t=this.indexInfo.uploadTrend||{},e=this.currentTrendGroup.series||[],s="#F97316";return{labels:this.trendDisplayLabels,datasets:[{label:this.$t("sysStatus.totalUploads"),data:t.total||[],borderColor:s,backgroundColor:this.hexToRgba(s,.1),pointBackgroundColor:s,pointBorderColor:s,borderWidth:3,pointRadius:2,pointHoverRadius:5,tension:.28,fill:!1},...e.map((t,e)=>{const s=this.getTrendColor(e);return{label:this.formatTrendSeriesName(t),data:t.data||[],borderColor:s,backgroundColor:this.hexToRgba(s,.12),pointBackgroundColor:s,pointBorderColor:s,borderWidth:2,pointRadius:2,pointHoverRadius:5,tension:.32,fill:!1}})]}},lineChartOptions(){const t="#64748B";return{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!0,position:"bottom",labels:{usePointStyle:!0,boxWidth:8,boxHeight:8,padding:16,color:t}},tooltip:{backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,displayColors:!0,callbacks:{title:t=>{const e=t?.[0]?.dataIndex;return this.trendRawLabels[e]||""},label:t=>{const e=t.parsed||{},s=void 0!==e.y?e.y:t.raw;return` ${t.dataset.label}: ${Number(s||0).toLocaleString()} ${this.$t("sysStatus.uploadsUnit")}`}}}},scales:{x:{grid:{display:!1},ticks:{color:t,maxTicksLimit:8,autoSkip:!0}},y:{beginAtZero:!0,grid:{color:"rgba(148, 163, 184, 0.18)"},ticks:{color:t,precision:0,callback:t=>Number(t).toLocaleString()}}}}},chartOptions(){return{responsive:!0,maintainAspectRatio:!0,cutout:"65%",hoverOffset:8,layout:{padding:10},plugins:{legend:{display:!1},tooltip:{backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,displayColors:!0,z:100,callbacks:{label:t=>{const e=t.raw,s=t.dataset.data.reduce((t,e)=>t+e,0),i=(e/s*100).toFixed(1);return` ${e.toLocaleString()} (${i}%)`}}}},animation:{animateRotate:!0,animateScale:!0}}},estimatedTimeRemaining(){if(!this.isProcessing||!this.processingStartTime)return"";if(0===this.processingProgress.current||0===this.processingProgress.percentage)return"";const t=Date.now()-this.processingStartTime,e=this.processingProgress.percentage/100;if(e<=0)return"";const s=t/e,i=s-t;if(i<=0)return this.$t("sysStatus.aboutToComplete");const n=Math.ceil(i/1e3);if(n<60)return this.$t("sysStatus.seconds",{count:n});const a=Math.ceil(n/60);if(a<60)return this.$t("sysStatus.minutes",{count:a});const o=Math.floor(a/60),l=a%60;return this.$t("sysStatus.hoursMinutes",{hours:o,minutes:l})},phaseDescription(){const t={fetching:this.$t("sysStatus.phaseFetching"),sorting:this.$t("sysStatus.phaseSorting"),uploading:this.$t("sysStatus.phaseUploading"),finalizing:this.$t("sysStatus.phaseFinalizing"),building:this.$t("sysStatus.phaseBuilding"),downloading:this.$t("sysStatus.phaseDownloading"),restoring_files:this.$t("sysStatus.phaseRestoringFiles"),restoring_settings:this.$t("sysStatus.phaseRestoringSettings"),completed:this.$t("sysStatus.phaseCompleted"),retrying:this.$t("sysStatus.phaseRetrying")};return t[this.processingPhase]||this.processingPhase}},mounted(){this.fetchIndexInfo()},methods:{getChartColor(t){return this.channelColors[t%this.channelColors.length]},getTypeChartColor(t){return this.typeColors[t%this.typeColors.length]},getTrendColor(t){return this.trendColors[t%this.trendColors.length]},formatTrendSeriesName(t){return t?.isOther||"__other__"===t?.name?this.$t("sysStatus.otherChannels"):t?.name||this.$t("sysStatus.unknown")},hexToRgba(t,e){const s=(t||"").replace("#","");if(6!==s.length)return`rgba(37, 99, 235, ${e})`;const i=parseInt(s.slice(0,2),16),n=parseInt(s.slice(2,4),16),a=parseInt(s.slice(4,6),16);return`rgba(${i}, ${n}, ${a}, ${e})`},extractTrendLabelDates(t){const e=String(t||"").match(/\d{4}-\d{2}-\d{2}/g)||[];return e.map(t=>{const[e,s,i]=t.split("-").map(Number);return{year:e,month:s,day:i}})},formatTrendAxisLabel(t){const e=this.extractTrendLabelDates(t);if(0===e.length)return t;const s=(t,e)=>{const s=`${t.month}/${t.day}`;return e?`${t.year}/${s}`:s};if(1===e.length)return s(e[0],this.trendRangeCrossesYear);const[i,n]=e;if(!this.trendRangeCrossesYear)return`${s(i,!1)}-${s(n,!1)}`;const a=i.year===n.year?s(n,!1):s(n,!0);return`${s(i,!0)}-${a}`},openTrendDateDialog(){this.trendDatePickerVisible=!0},handleTrendDateRangeChange(t){Array.isArray(t)&&2===t.length&&t[0]&&t[1]&&(this.trendDatePickerVisible=!1,this.fetchIndexInfo())},getTrendDateRangeParams(){return Array.isArray(this.trendDateRange)&&2===this.trendDateRange.length||(this.trendDateRange=mu()),{startDate:this.trendDateRange[0],endDate:this.trendDateRange[1]}},async fetchIndexInfo(){this.loading=!0;try{const{startDate:t,endDate:e}=this.getTrendDateRangeParams(),s=new URLSearchParams({action:"info",timezoneOffset:String((new Date).getTimezoneOffset()),trendMaxPoints:"90",trendSeriesLimit:"8",trendStartDate:t,trendEndDate:e}),i=await(0,Pe.A)(`/api/manage/list?${s.toString()}`,{method:"GET"});if(!i.ok)throw new Error("API请求失败");{const t=await i.json();this.indexInfo=t}}catch(t){console.error("获取索引信息失败:",t),this.$message.error(this.$t("sysStatus.fetchIndexFailed"))}finally{this.loading=!1}},async rebuildIndex(){if(this.isProcessing)this.$message.warning(this.$t("sysStatus.operationInProgress"));else{this.rebuilding=!0,this.isProcessing=!0,this.processingError=null,this.processingStartTime=Date.now(),this.processingProgress={current:0,total:0,message:"",percentage:0},this.currentRebuilder=new ru({onProgress:t=>this.handleProgress(t),onError:t=>this.handleError(t)});try{const t=await this.currentRebuilder.rebuild();this.$message.success(this.$t("sysStatus.rebuildSuccess",{count:t.totalFiles.toLocaleString()})),setTimeout(()=>{this.fetchIndexInfo()},1e3)}catch(t){if("ABORTED"!==t.code){const e=t.suggestion?`${t.message}。${t.suggestion}`:t.message;this.$message.error(e),this.processingError={message:t.message,suggestion:t.suggestion,recoverable:t.recoverable}}}finally{this.rebuilding=!1,this.isProcessing=!1,this.currentRebuilder=null,this.processingStartTime=null}}},async backupData(){if(this.isProcessing)this.$message.warning(this.$t("sysStatus.operationInProgress"));else{this.backing=!0,this.isProcessing=!0,this.processingError=null,this.processingStartTime=Date.now(),this.processingProgress={current:0,total:0,message:"",percentage:0},this.currentBackupGenerator=new cu({onProgress:t=>this.handleProgress(t)});try{const t=await this.currentBackupGenerator.generateBackup(),e=t.settingsCount>0?this.$t("sysStatus.backupSuccessWithSettings",{fileCount:t.fileCount.toLocaleString(),settingsCount:t.settingsCount}):this.$t("sysStatus.backupSuccess",{count:t.fileCount.toLocaleString()});this.$message.success(e)}catch(t){if("ABORTED"!==t.code){const e=t.suggestion?`${t.message}。${t.suggestion}`:t.message;this.$message.error(e),this.processingError={message:t.message,suggestion:t.suggestion,recoverable:t.recoverable}}}finally{this.backing=!1,this.isProcessing=!1,this.currentBackupGenerator=null,this.processingStartTime=null}}},selectRestoreFile(){this.restoring||this.$refs.fileInput.click()},async handleFileSelect(t){const e=t.target.files[0];if(e)if(e.name.endsWith(".json")){try{await this.$confirm(this.$t("sysStatus.restoreConfirmMessage"),this.$t("sysStatus.restoreConfirmTitle"),{confirmButtonText:this.$t("sysStatus.restoreConfirmOk"),cancelButtonText:this.$t("sysStatus.restoreConfirmCancel"),type:"warning"}),await this.restoreData(e)}catch(s){"cancel"!==s&&console.error("确认恢复失败:",s)}t.target.value=""}else this.$message.error(this.$t("sysStatus.selectJsonFile"))},async restoreData(t){if(this.isProcessing)this.$message.warning(this.$t("sysStatus.operationInProgress"));else{this.restoring=!0,this.isProcessing=!0,this.processingError=null,this.processingStartTime=Date.now(),this.processingProgress={current:0,total:0,message:"",percentage:0};try{const s=await t.text();let i;try{i=JSON.parse(s)}catch(e){throw new Error(this.$t("sysStatus.invalidBackupFile"))}this.currentRestoreProcessor=new uu({chunkSize:100,onProgress:t=>this.handleProgress(t),onError:t=>this.handleError(t)});const n=await this.currentRestoreProcessor.restore(i);this.restoring=!1,this.isProcessing=!1,this.currentRestoreProcessor=null,this.processingStartTime=null,this.$message.success(this.$t("sysStatus.restoreSuccess",{files:n.restoredFiles,settings:n.restoredSettings})),await new Promise(t=>setTimeout(t,500)),await this.rebuildIndex()}catch(s){if(console.error("恢复数据失败:",s),this.restoring=!1,this.isProcessing=!1,this.currentRestoreProcessor=null,this.processingStartTime=null,"ABORTED"!==s.code){const t=s.suggestion?`${s.message}。${s.suggestion}`:s.message;this.$message.error(this.$t("sysStatus.restoreFailed")+": "+t),this.processingError={message:s.message,suggestion:s.suggestion,recoverable:s.recoverable}}}}},formatTime(t){if(!t)return this.$t("sysStatus.unknown");const e=new Date(t);return e.toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})},getPercentage(t,e){return e&&0!==e?Math.round(t/e*100):0},getTimeAgo(t){if(!t)return"";const e=Date.now(),s=e-t,i=Math.floor(s/6e4),n=Math.floor(s/36e5),a=Math.floor(s/864e5);return a>0?this.$t("sysStatus.daysAgo",{count:a}):n>0?this.$t("sysStatus.hoursAgo",{count:n}):i>0?this.$t("sysStatus.minutesAgo",{count:i}):this.$t("sysStatus.justNow")},handleImageError(t){this.loadErrors[t]=!0},isValidPreview(t,e){return!this.loadErrors[t]&&(!!e?.metadata?.FileType&&(e.metadata.FileType.includes("image")||e.metadata.FileType.includes("video")))},openReleases(){window.open("https://github.com/MarSeventh/CloudFlare-ImgBed/releases","_blank")},isImageFile(t){if(!t)return!1;if(t.metadata?.FileType?.includes("image"))return!0;const e=t.metadata?.FileName||t.id||"",s=e.substring(e.lastIndexOf(".")+1).toLowerCase(),i=["jpg","jpeg","png","gif","bmp","webp","svg","ico","tiff","tif","avif","heic","heif"];return i.includes(s)},isVideoFile(t){if(!t)return!1;if(t.metadata?.FileType?.includes("video"))return!0;const e=t.metadata?.FileName||t.id||"",s=e.substring(e.lastIndexOf(".")+1).toLowerCase(),i=["mp4","webm","ogg","avi","mov","flv","wmv","mkv","m4v","3gp","mpeg","mpg"];return i.includes(s)},openFileInNewTab(t){t?.id&&window.open("/file/"+t.id+"?from=admin","_blank")},handleProgress(t){this.processingPhase=t.phase,this.processingProgress.message=t.message||"",this.processingProgress.current=t.current||0,"fetching"===t.phase?(this.processingProgress.total=t.total||0,t.total&&t.total>0?this.processingProgress.percentage=Math.min(60,t.current/t.total*60):this.processingProgress.percentage=Math.min(50,15*Math.log10(t.current+1))):"sorting"===t.phase?(this.processingProgress.percentage=65,this.processingProgress.total=t.total||this.processingProgress.total):"uploading"===t.phase?(this.processingProgress.total=t.total||0,t.total&&t.total>0&&(this.processingProgress.percentage=70+t.current/t.total*25)):"finalizing"===t.phase?this.processingProgress.percentage=97:"building"===t.phase?this.processingProgress.percentage=80:"downloading"===t.phase?this.processingProgress.percentage=95:"restoring_files"===t.phase?(this.processingProgress.total=t.total||0,this.processingProgress.percentage=t.percentage||0):"restoring_settings"===t.phase?(this.processingProgress.total=t.total||0,this.processingProgress.percentage=t.percentage||80):"completed"===t.phase?this.processingProgress.percentage=100:"retrying"===t.phase&&(this.processingProgress.message=t.message)},handleError(t){console.error("批量操作错误:",t),this.processingError={message:t.message,suggestion:t.suggestion,recoverable:t.recoverable}},cancelOperation(){this.currentRebuilder&&(this.currentRebuilder.abort(),this.$message.info(this.$t("sysStatus.cancellingRebuild"))),this.currentBackupGenerator&&(this.currentBackupGenerator.abort(),this.$message.info(this.$t("sysStatus.cancellingRebuild"))),this.currentRestoreProcessor&&(this.currentRestoreProcessor.abort(),this.$message.info(this.$t("sysStatus.cancellingRebuild")))},retryOperation(){this.processingError=null,this.rebuilding?(this.rebuilding=!1,this.isProcessing=!1,this.$nextTick(()=>{this.rebuildIndex()})):this.backing&&(this.backing=!1,this.isProcessing=!1,this.$nextTick(()=>{this.backupData()}))},dismissError(){this.processingError=null}}};const yu=(0,c.A)(bu,[["render",Te],["__scopeId","data-v-90d03e30"]]);var xu=yu,vu=s(59869),_u=(s(70415),s(73565),s(82006)),ku=(s(98642),s(81418)),wu=(s(50333),s(39623)),Cu=(s(29092),s(63003),s(76018)),Su=(s(96808),s(67819),s(55558)),Fu=(s(10456),s(12687)),Tu=(s(18785),s(53676));const Pu=["onClick"];function Mu(t,e,s,a,o,l){const r=(0,i.g2)("font-awesome-icon"),d=Tu.A;return(0,i.uX)(),(0,i.CE)("div",{class:(0,n.C4)(["custom-select",{"is-open":o.isOpen}]),style:(0,n.Tr)({width:s.width})},[(0,i.Lk)("div",{class:"custom-select-trigger",onClick:e[0]||(e[0]=(...t)=>l.toggleDropdown&&l.toggleDropdown(...t))},[(0,i.Lk)("span",{class:(0,n.C4)(["custom-select-value",{"is-placeholder":!s.modelValue}])},(0,n.v_)(l.displayLabel),3),(0,i.bF)(r,{icon:"chevron-down",class:"custom-select-arrow"})]),(0,i.bF)(C.eB,{name:"dropdown-fade"},{default:(0,i.k6)(()=>[(0,i.bo)((0,i.Lk)("div",{class:"custom-select-dropdown",onClick:e[1]||(e[1]=(0,C.D$)(()=>{},["stop"]))},[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(s.options,e=>((0,i.uX)(),(0,i.CE)("div",{key:e.value,class:(0,n.C4)(["custom-select-option",{"is-selected":s.modelValue===e.value}]),onClick:t=>l.selectOption(e.value)},[(0,i.RG)(t.$slots,"option",{option:e},()=>[e.channelType?((0,i.uX)(),(0,i.Wv)(d,{key:0,type:e.channelType,class:(0,n.C4)(["option-icon",e.iconClass])},null,8,["type","class"])):e.icon?((0,i.uX)(),(0,i.Wv)(r,{key:1,icon:e.icon,class:(0,n.C4)(["option-icon",e.iconClass])},null,8,["icon","class"])):(0,i.Q3)("",!0),(0,i.Lk)("span",null,(0,n.v_)(e.label),1)],!0)],10,Pu))),128))],512),[[C.aG,o.isOpen]])]),_:3})],6)}var Du={name:"CustomSelect",components:{ChannelIcon:Tu.A},props:{modelValue:{type:[String,Number],default:""},options:{type:Array,required:!0},placeholder:{type:String,default:""},width:{type:String,default:"160px"}},emits:["update:modelValue","change"],data(){return{isOpen:!1}},computed:{resolvedPlaceholder(){return this.placeholder||this.$t("common.select")},displayLabel(){const t=this.options.find(t=>t.value===this.modelValue);return t?t.label:this.resolvedPlaceholder}},mounted(){document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)},methods:{toggleDropdown(){this.isOpen=!this.isOpen},selectOption(t){this.$emit("update:modelValue",t),this.$emit("change",t),this.isOpen=!1},handleClickOutside(t){this.$el.contains(t.target)||(this.isOpen=!1)}}};const Au=(0,c.A)(Du,[["render",Mu],["__scopeId","data-v-3c680cc7"]]);var $u=Au;const Vu={class:"upload-settings"},Lu={class:"page-header"},Eu={class:"first-title"},Iu={class:"header-actions"},Uu={class:"group-header"},Ou={class:"group-title"},Ru={key:0,class:"load-balance-switch"},Wu={class:"switch-label"},Bu={key:0,class:"channel-cards"},Nu=["onMousemove","onMouseleave"],zu={class:"card-header"},ju={class:"card-title"},qu={class:"channel-name"},Hu={class:"card-body"},Xu={class:"card-info"},Ku={class:"info-item"},Qu={class:"info-text"},Yu={key:0,class:"info-item"},Gu={class:"info-text"},Ju={key:1,class:"info-item"},Zu=["title"],tp={class:"info-item"},ep={class:"info-text"},sp={key:0,class:"info-item"},ip=["title"],np={class:"info-item"},ap={class:"info-text"},op={class:"info-item"},lp={class:"info-text"},rp={class:"info-item"},dp={class:"info-text"},cp={class:"info-item"},hp=["title"],up={key:0,class:"info-item"},pp=["title"],gp={key:0,class:"quota-mini"},fp={class:"quota-text"},mp={class:"card-actions"},bp={key:1,class:"empty-tip"},yp={class:"channel-type-option"},xp={key:0,class:"form-warning",style:{"margin-top":"0"}},vp=["innerHTML"],_p={class:"form-warning"},kp={class:"quota-label"},wp={class:"quota-status"};function Cp(t,e,s,a,o,l){const r=(0,i.g2)("font-awesome-icon"),d=g.R7,c=$u,h=K.S2,u=Tu.A,p=Fu.u,f=Su.qi,m=k.ve,b=Cu.P9,y=Cu.AV,x=_u.xE,_=wu.WK,S=ku.lq,F=_u.US,T=w.kZ,P=vu.MF,M=vu.TS,D=v.A;return(0,i.bo)(((0,i.uX)(),(0,i.CE)("div",Vu,[(0,i.Lk)("div",Lu,[(0,i.Lk)("h3",Eu,[(0,i.eW)((0,n.v_)(t.$t("sysUpload.title"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.titleTooltip"),placement:"right"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"help-icon"})]),_:1},8,["content"])]),(0,i.Lk)("div",Iu,[(0,i.bF)(c,{modelValue:o.channelFilter,"onUpdate:modelValue":e[0]||(e[0]=t=>o.channelFilter=t),options:l.filterOptions,placeholder:t.$t("sysUpload.filterPlaceholder"),width:"160px"},null,8,["modelValue","options","placeholder"]),(0,i.bF)(h,{type:"primary",onClick:e[1]||(e[1]=t=>o.showAddDialog=!0),class:"add-btn"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"plus",style:{"margin-right":"6px"}}),(0,i.eW)(" "+(0,n.v_)(t.$t("sysUpload.addChannel")),1)]),_:1})])]),((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(l.filteredChannels,s=>((0,i.uX)(),(0,i.CE)("div",{key:s.value,class:"channel-group"},[(0,i.Lk)("div",Uu,[(0,i.Lk)("div",Ou,[(0,i.bF)(u,{type:s.value,class:(0,n.C4)(["group-icon",l.getChannelIconClass(s.value)])},null,8,["type","class"]),(0,i.Lk)("span",null,(0,n.v_)(s.label),1),(0,i.bF)(p,{size:"small",type:"info",class:"channel-count"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(l.getChannelList(s.value).length),1)]),_:2},1024)]),l.hasLoadBalance(s.value)?((0,i.uX)(),(0,i.CE)("div",Ru,[(0,i.Lk)("span",Wu,(0,n.v_)(t.$t("sysUpload.loadBalance")),1),(0,i.bF)(f,{modelValue:l.getSettings(s.value).loadBalance.enabled,"onUpdate:modelValue":t=>l.getSettings(s.value).loadBalance.enabled=t,size:"small",onChange:l.saveSettings},null,8,["modelValue","onUpdate:modelValue","onChange"])])):(0,i.Q3)("",!0)]),l.getChannelList(s.value).length>0?((0,i.uX)(),(0,i.CE)("div",Bu,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(l.getChannelList(s.value),(a,o)=>((0,i.uX)(),(0,i.CE)("div",{key:a.name||o,class:(0,n.C4)(["channel-card",[s.value,{disabled:!a.enabled,fixed:a.fixed}]]),onMousemove:t=>l.handleCardMouseMove(t,s.value,o),onMouseleave:t=>l.handleCardMouseLeave(s.value,o)},[(0,i.Lk)("div",{class:"card-glow",ref_for:!0,ref:`glow-${s.value}-${o}`},null,512),(0,i.Lk)("div",zu,[(0,i.Lk)("div",ju,[(0,i.Lk)("span",qu,(0,n.v_)(a.name||t.$t("sysUpload.unnamedChannel")),1),a.fixed?((0,i.uX)(),(0,i.Wv)(p,{key:0,size:"small",type:"warning"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.envVariable")),1)]),_:1})):(0,i.Q3)("",!0)]),(0,i.bF)(f,{modelValue:a.enabled,"onUpdate:modelValue":t=>a.enabled=t,size:"small",onClick:e[2]||(e[2]=(0,C.D$)(()=>{},["stop"])),onChange:l.saveSettings},null,8,["modelValue","onUpdate:modelValue","onChange"])]),(0,i.Lk)("div",Hu,[(0,i.Lk)("div",Xu,["telegram"===s.value?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.Lk)("div",Ku,[(0,i.bF)(r,{icon:"robot",class:"info-icon"}),(0,i.Lk)("span",Qu,"Bot: "+(0,n.v_)(l.maskText(a.botToken)),1)]),a.chatId?((0,i.uX)(),(0,i.CE)("div",Yu,[(0,i.bF)(r,{icon:"comments",class:"info-icon"}),(0,i.Lk)("span",Gu,"Channel: "+(0,n.v_)(l.maskText(a.chatId)),1)])):(0,i.Q3)("",!0)],64)):"cfr2"===s.value?((0,i.uX)(),(0,i.CE)("div",Ju,[(0,i.bF)(r,{icon:"link",class:"info-icon"}),(0,i.Lk)("span",{class:"info-text",title:a.publicUrl},(0,n.v_)(a.publicUrl||t.$t("sysUpload.notSet")),9,Zu)])):"s3"===s.value?((0,i.uX)(),(0,i.CE)(i.FK,{key:2},[(0,i.Lk)("div",tp,[(0,i.bF)(r,{icon:"server",class:"info-icon"}),(0,i.Lk)("span",ep,(0,n.v_)(a.bucketName||t.$t("sysUpload.notSet")),1)]),a.endpoint?((0,i.uX)(),(0,i.CE)("div",sp,[(0,i.bF)(r,{icon:"link",class:"info-icon"}),(0,i.Lk)("span",{class:"info-text",title:a.endpoint},(0,n.v_)(a.endpoint),9,ip)])):(0,i.Q3)("",!0)],64)):"discord"===s.value?((0,i.uX)(),(0,i.CE)(i.FK,{key:3},[(0,i.Lk)("div",np,[(0,i.bF)(r,{icon:"robot",class:"info-icon"}),(0,i.Lk)("span",ap,"Bot: "+(0,n.v_)(l.maskText(a.botToken)),1)]),(0,i.Lk)("div",op,[(0,i.bF)(r,{icon:"hashtag",class:"info-icon"}),(0,i.Lk)("span",lp,"Channel: "+(0,n.v_)(l.maskText(a.channelId)),1)]),a.isNitro?((0,i.uX)(),(0,i.Wv)(p,{key:0,size:"small",type:"success"},{default:(0,i.k6)(()=>[...e[78]||(e[78]=[(0,i.eW)("Nitro",-1)])]),_:1})):(0,i.Q3)("",!0)],64)):"huggingface"===s.value?((0,i.uX)(),(0,i.CE)(i.FK,{key:4},[(0,i.Lk)("div",rp,[(0,i.bF)(r,{icon:"database",class:"info-icon"}),(0,i.Lk)("span",dp,(0,n.v_)(a.repo||t.$t("sysUpload.notSet")),1)]),a.isPrivate?((0,i.uX)(),(0,i.Wv)(p,{key:0,size:"small",type:"warning"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.privateRepo")),1)]),_:1})):(0,i.Q3)("",!0)],64)):"webdav"===s.value?((0,i.uX)(),(0,i.CE)(i.FK,{key:5},[(0,i.Lk)("div",cp,[(0,i.bF)(r,{icon:"folder",class:"info-icon"}),(0,i.Lk)("span",{class:"info-text",title:a.baseUrl},(0,n.v_)(a.baseUrl||t.$t("sysUpload.notSet")),9,hp)]),a.publicUrl?((0,i.uX)(),(0,i.CE)("div",up,[(0,i.bF)(r,{icon:"link",class:"info-icon"}),(0,i.Lk)("span",{class:"info-text",title:a.publicUrl},(0,n.v_)(a.publicUrl),9,pp)])):(0,i.Q3)("",!0)],64)):(0,i.Q3)("",!0)]),a.quota?.enabled?((0,i.uX)(),(0,i.CE)("div",gp,[(0,i.bF)(m,{percentage:l.getQuotaPercentage(a),status:l.getQuotaStatus(a),"stroke-width":6},null,8,["percentage","status"]),(0,i.Lk)("span",fp,(0,n.v_)(l.getQuotaText(a)),1)])):(0,i.Q3)("",!0)]),(0,i.Lk)("div",mp,[(0,i.bF)(h,{text:"",type:"primary",size:"small",onClick:t=>l.openDetailDialog(s.value,o)},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"eye",style:{"margin-right":"4px"}}),(0,i.eW)((0,n.v_)(t.$t("sysUpload.detail")),1)]),_:1},8,["onClick"]),(0,i.bF)(h,{text:"",type:"primary",size:"small",onClick:t=>l.openEditDialog(s.value,o)},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"edit",style:{"margin-right":"4px"}}),(0,i.eW)((0,n.v_)(t.$t("sysUpload.editBtn")),1)]),_:1},8,["onClick"]),(0,i.bF)(h,{text:"",type:"danger",size:"small",onClick:t=>l.deleteChannel(s.value,o),disabled:a.fixed},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"trash-alt",style:{"margin-right":"4px"}}),(0,i.eW)((0,n.v_)(t.$t("sysUpload.deleteBtn")),1)]),_:1},8,["onClick","disabled"])])],42,Nu))),128))])):((0,i.uX)(),(0,i.CE)("div",bp,[(0,i.bF)(r,{icon:"inbox",class:"empty-icon"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysUpload.noChannels",{type:s.label})),1)]))]))),128)),(0,i.bF)(T,{modelValue:o.showAddDialog,"onUpdate:modelValue":e[35]||(e[35]=t=>o.showAddDialog=t),title:t.$t("sysUpload.addDialogTitle"),class:"channel-dialog","destroy-on-close":"",onClosed:l.resetAddForm},{footer:(0,i.k6)(()=>[(0,i.bF)(h,{onClick:e[34]||(e[34]=t=>o.showAddDialog=!1)},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.cancel")),1)]),_:1}),"cfr2"!==o.newChannel.type?((0,i.uX)(),(0,i.Wv)(h,{key:0,type:"primary",onClick:l.confirmAddChannel},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.confirmAdd")),1)]),_:1},8,["onClick"])):(0,i.Q3)("",!0)]),default:(0,i.k6)(()=>[(0,i.bF)(F,{model:o.newChannel,"label-position":"top",ref:"addForm",rules:l.addRules},{default:(0,i.k6)(()=>[(0,i.bF)(x,{label:t.$t("sysUpload.channelTypeLabel"),prop:"type"},{default:(0,i.k6)(()=>[(0,i.bF)(y,{modelValue:o.newChannel.type,"onUpdate:modelValue":e[3]||(e[3]=t=>o.newChannel.type=t),placeholder:t.$t("sysUpload.channelTypePlaceholder"),style:{width:"100%"},onChange:l.onChannelTypeChange},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(o.addableChannels,t=>((0,i.uX)(),(0,i.Wv)(b,{key:t.value,label:t.label,value:t.value},{default:(0,i.k6)(()=>[(0,i.Lk)("span",yp,[(0,i.bF)(u,{type:t.value,class:(0,n.C4)(["select-option-icon",l.getChannelIconClass(t.value)])},null,8,["type","class"]),(0,i.Lk)("span",null,(0,n.v_)(t.label),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),"cfr2"===o.newChannel.type?((0,i.uX)(),(0,i.CE)("div",xp,[(0,i.bF)(r,{icon:"info-circle",style:{"margin-right":"6px"}}),(0,i.Lk)("span",{innerHTML:t.$t("sysUpload.r2ConfigNote")},null,8,vp)])):((0,i.uX)(),(0,i.CE)(i.FK,{key:1},[(0,i.bF)(x,{prop:"name"},{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.channelNameLabel"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.channelNameImmutableTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"exclamation-triangle",class:"inline-warning-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.name,"onUpdate:modelValue":e[4]||(e[4]=t=>o.newChannel.name=t),placeholder:t.$t("sysUpload.channelNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),"telegram"===o.newChannel.type?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.bF)(x,{label:t.$t("sysUpload.botTokenLabel"),prop:"botToken"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.botToken,"onUpdate:modelValue":e[5]||(e[5]=t=>o.newChannel.botToken=t),type:"password","show-password":"",placeholder:t.$t("sysUpload.botTokenPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.chatIdLabel"),prop:"chatId"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.chatId,"onUpdate:modelValue":e[6]||(e[6]=t=>o.newChannel.chatId=t),type:"password","show-password":"",placeholder:t.$t("sysUpload.chatIdPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.proxyDomain")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.proxyUrl,"onUpdate:modelValue":e[7]||(e[7]=t=>o.newChannel.proxyUrl=t),placeholder:t.$t("sysUpload.proxyDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):"s3"===o.newChannel.type?((0,i.uX)(),(0,i.CE)(i.FK,{key:1},[(0,i.bF)(x,{label:t.$t("sysUpload.endpointLabel"),prop:"endpoint"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.endpoint,"onUpdate:modelValue":e[8]||(e[8]=t=>o.newChannel.endpoint=t),placeholder:t.$t("sysUpload.endpointPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.cdnDomain"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.cdnDomainTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.cdnDomain,"onUpdate:modelValue":e[9]||(e[9]=t=>o.newChannel.cdnDomain=t),placeholder:t.$t("sysUpload.cdnDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),(0,i.bF)(x,{label:t.$t("sysUpload.bucketName"),prop:"bucketName"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.bucketName,"onUpdate:modelValue":e[10]||(e[10]=t=>o.newChannel.bucketName=t),placeholder:t.$t("sysUpload.bucketNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.bucketRegion"),prop:"region"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.region,"onUpdate:modelValue":e[11]||(e[11]=t=>o.newChannel.region=t),placeholder:t.$t("sysUpload.bucketRegionPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.accessKeyId"),prop:"accessKeyId"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.accessKeyId,"onUpdate:modelValue":e[12]||(e[12]=t=>o.newChannel.accessKeyId=t),type:"password","show-password":"",placeholder:t.$t("sysUpload.accessKeyIdPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.secretAccessKey"),prop:"secretAccessKey"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.secretAccessKey,"onUpdate:modelValue":e[13]||(e[13]=t=>o.newChannel.secretAccessKey=t),type:"password","show-password":"",placeholder:t.$t("sysUpload.secretAccessKeyPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.pathStyle"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.pathStyleTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.newChannel.pathStyle,"onUpdate:modelValue":e[14]||(e[14]=t=>o.newChannel.pathStyle=t)},null,8,["modelValue"])]),_:1}),(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimit")},{default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.newChannel.quota.enabled,"onUpdate:modelValue":e[15]||(e[15]=t=>o.newChannel.quota.enabled=t)},null,8,["modelValue"])]),_:1},8,["label"]),o.newChannel.quota?.enabled?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimitGB")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.newChannel.quota.limitGB,"onUpdate:modelValue":e[16]||(e[16]=t=>o.newChannel.quota.limitGB=t),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.quotaThreshold")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.newChannel.quota.threshold,"onUpdate:modelValue":e[17]||(e[17]=t=>o.newChannel.quota.threshold=t),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,i.Q3)("",!0)],64)):"discord"===o.newChannel.type?((0,i.uX)(),(0,i.CE)(i.FK,{key:2},[(0,i.bF)(x,{label:t.$t("sysUpload.botTokenLabel"),prop:"botToken"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.botToken,"onUpdate:modelValue":e[18]||(e[18]=t=>o.newChannel.botToken=t),type:"password","show-password":"",placeholder:t.$t("sysUpload.botTokenPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.channelIdLabel"),prop:"channelId"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.channelId,"onUpdate:modelValue":e[19]||(e[19]=t=>o.newChannel.channelId=t),type:"password","show-password":"",placeholder:t.$t("sysUpload.channelIdPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.proxyDomain")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.proxyUrl,"onUpdate:modelValue":e[20]||(e[20]=t=>o.newChannel.proxyUrl=t),placeholder:t.$t("sysUpload.proxyDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.nitroMember"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.nitroTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.newChannel.isNitro,"onUpdate:modelValue":e[21]||(e[21]=t=>o.newChannel.isNitro=t)},null,8,["modelValue"])]),_:1}),(0,i.Lk)("div",_p,[(0,i.bF)(r,{icon:"exclamation-triangle",style:{"margin-right":"6px"}}),(0,i.eW)(" "+(0,n.v_)(t.$t("sysUpload.discordWarning")),1)])],64)):"huggingface"===o.newChannel.type?((0,i.uX)(),(0,i.CE)(i.FK,{key:3},[(0,i.bF)(x,{label:t.$t("sysUpload.repoName"),prop:"repo"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.repo,"onUpdate:modelValue":e[22]||(e[22]=t=>o.newChannel.repo=t),placeholder:t.$t("sysUpload.repoNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.accessToken"),prop:"token"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.token,"onUpdate:modelValue":e[23]||(e[23]=t=>o.newChannel.token=t),type:"password","show-password":"",placeholder:t.$t("sysUpload.accessTokenPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.privateRepo"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.privateRepoTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.newChannel.isPrivate,"onUpdate:modelValue":e[24]||(e[24]=t=>o.newChannel.isPrivate=t)},null,8,["modelValue"])]),_:1})],64)):"webdav"===o.newChannel.type?((0,i.uX)(),(0,i.CE)(i.FK,{key:4},[(0,i.bF)(x,{label:t.$t("sysUpload.webdavBaseUrl"),prop:"baseUrl"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.baseUrl,"onUpdate:modelValue":e[25]||(e[25]=t=>o.newChannel.baseUrl=t),placeholder:t.$t("sysUpload.webdavBaseUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.webdavUsername")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.username,"onUpdate:modelValue":e[26]||(e[26]=t=>o.newChannel.username=t),placeholder:t.$t("sysUpload.webdavUsernamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.webdavPassword")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.password,"onUpdate:modelValue":e[27]||(e[27]=t=>o.newChannel.password=t),type:"password","show-password":"",placeholder:t.$t("sysUpload.webdavPasswordPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.publicUrl"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.webdavPublicUrlTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.publicUrl,"onUpdate:modelValue":e[28]||(e[28]=t=>o.newChannel.publicUrl=t),placeholder:t.$t("sysUpload.webdavPublicUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),(0,i.bF)(x,{label:t.$t("sysUpload.webdavHeaders")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.newChannel.headersText,"onUpdate:modelValue":e[29]||(e[29]=t=>o.newChannel.headersText=t),type:"textarea",autosize:{minRows:2},placeholder:t.$t("sysUpload.webdavHeadersPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.webdavCreateDirectory"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.webdavCreateDirectoryTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.newChannel.createDirectory,"onUpdate:modelValue":e[30]||(e[30]=t=>o.newChannel.createDirectory=t)},null,8,["modelValue"])]),_:1}),(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimit")},{default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.newChannel.quota.enabled,"onUpdate:modelValue":e[31]||(e[31]=t=>o.newChannel.quota.enabled=t)},null,8,["modelValue"])]),_:1},8,["label"]),o.newChannel.quota?.enabled?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimitGB")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.newChannel.quota.limitGB,"onUpdate:modelValue":e[32]||(e[32]=t=>o.newChannel.quota.limitGB=t),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.quotaThreshold")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.newChannel.quota.threshold,"onUpdate:modelValue":e[33]||(e[33]=t=>o.newChannel.quota.threshold=t),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,i.Q3)("",!0)],64)):(0,i.Q3)("",!0)],64))]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title","onClosed"]),(0,i.bF)(T,{modelValue:o.showDetailDialog,"onUpdate:modelValue":e[37]||(e[37]=t=>o.showDetailDialog=t),title:t.$t("sysUpload.detailDialogTitle",{name:o.currentChannel?.name||""}),class:"channel-dialog",onClosed:l.resetDetailData},{footer:(0,i.k6)(()=>[(0,i.bF)(h,{onClick:e[36]||(e[36]=t=>o.showDetailDialog=!1)},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.closeBtn")),1)]),_:1}),(0,i.bF)(h,{type:"primary",onClick:l.openEditFromDetail},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.editBtn")),1)]),_:1},8,["onClick"])]),default:(0,i.k6)(()=>[(0,i.bF)(M,{column:1,border:""},{default:(0,i.k6)(()=>[(0,i.bF)(P,{label:t.$t("sysUpload.channelNameDetail")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.name),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.channelTypeDetail")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(l.getChannelTypeLabel(o.currentChannelType)),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.statusLabel")},{default:(0,i.k6)(()=>[(0,i.bF)(p,{type:o.currentChannel?.enabled?"success":"info"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.enabled?t.$t("sysUpload.enabled"):t.$t("sysUpload.disabled")),1)]),_:1},8,["type"])]),_:1},8,["label"]),o.currentChannel?.fixed?((0,i.uX)(),(0,i.Wv)(P,{key:0,label:t.$t("sysUpload.configSource")},{default:(0,i.k6)(()=>[(0,i.bF)(p,{type:"warning"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.envVariable")),1)]),_:1})]),_:1},8,["label"])):(0,i.Q3)("",!0),"telegram"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:1},[(0,i.bF)(P,{label:t.$t("sysUpload.botTokenLabel")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(l.maskText(o.currentChannel?.botToken,10)),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.chatIdLabel")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(l.maskText(o.currentChannel?.chatId,6)),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.proxyDomain")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.proxyUrl||t.$t("sysUpload.notSet")),1)]),_:1},8,["label"])],64)):"cfr2"===o.currentChannelType?((0,i.uX)(),(0,i.Wv)(P,{key:2,label:t.$t("sysUpload.publicUrl")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{"model-value":o.currentChannel?.publicUrl||t.$t("sysUpload.notSet"),readonly:""},null,8,["model-value"])]),_:1},8,["label"])):"s3"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:3},[(0,i.bF)(P,{label:t.$t("sysUpload.endpointLabel")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{"model-value":o.currentChannel?.endpoint,readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.cdnDomain")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{"model-value":o.currentChannel?.cdnDomain||t.$t("sysUpload.notSet"),readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.bucketName")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.bucketName),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.bucketRegion")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.region),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.pathStyle")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.pathStyle?t.$t("sysUpload.isPathStyle"):t.$t("sysUpload.isNotPathStyle")),1)]),_:1},8,["label"])],64)):"discord"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:4},[(0,i.bF)(P,{label:t.$t("sysUpload.botTokenLabel")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(l.maskText(o.currentChannel?.botToken,10)),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.channelIdLabel")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(l.maskText(o.currentChannel?.channelId,6)),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.proxyDomain")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.proxyUrl||t.$t("sysUpload.notSet")),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.nitroMember")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.isNitro?t.$t("sysUpload.isPathStyle"):t.$t("sysUpload.isNotPathStyle")),1)]),_:1},8,["label"])],64)):"huggingface"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:5},[(0,i.bF)(P,{label:t.$t("sysUpload.repoName")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.repo),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.privateRepo")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.isPrivate?t.$t("sysUpload.isPathStyle"):t.$t("sysUpload.isNotPathStyle")),1)]),_:1},8,["label"])],64)):"webdav"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:6},[(0,i.bF)(P,{label:t.$t("sysUpload.webdavBaseUrl")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{"model-value":o.currentChannel?.baseUrl,readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.publicUrl")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{"model-value":o.currentChannel?.publicUrl||t.$t("sysUpload.notSet"),readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.webdavUsername")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.username||t.$t("sysUpload.notSet")),1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.webdavHeaders")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{"model-value":l.formatHeaders(o.currentChannel?.headers),type:"textarea",autosize:{minRows:2},readonly:""},null,8,["model-value"])]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.webdavCreateDirectory")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(!1!==o.currentChannel?.createDirectory?t.$t("sysUpload.isPathStyle"):t.$t("sysUpload.isNotPathStyle")),1)]),_:1},8,["label"])],64)):(0,i.Q3)("",!0),o.currentChannel?.quota?.enabled?((0,i.uX)(),(0,i.CE)(i.FK,{key:7},[(0,i.bF)(P,{label:t.$t("sysUpload.quotaLimit")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.quota?.limitGB)+" GB",1)]),_:1},8,["label"]),(0,i.bF)(P,{label:t.$t("sysUpload.quotaThreshold")},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(o.currentChannel?.quota?.threshold)+"%",1)]),_:1},8,["label"]),(0,i.bF)(P,null,{label:(0,i.k6)(()=>[(0,i.Lk)("span",kp,[(0,i.eW)((0,n.v_)(t.$t("sysUpload.currentUsage"))+" ",1),(0,i.bF)(h,{link:"",type:"primary",onClick:l.refreshQuota,class:"refresh-btn"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"sync-alt",class:(0,n.C4)({"fa-spin":o.quotaLoading})},null,8,["class"])]),_:1},8,["onClick"])])]),default:(0,i.k6)(()=>[(0,i.Lk)("div",wp,[(0,i.bF)(m,{percentage:l.getQuotaPercentage(o.currentChannel),status:l.getQuotaStatus(o.currentChannel),"stroke-width":16,"text-inside":!0,format:()=>l.getQuotaText(o.currentChannel)},null,8,["percentage","status","format"]),(0,i.Lk)("div",{class:(0,n.C4)(["quota-info",{"quota-warning":l.isQuotaExceeded(o.currentChannel)}])},(0,n.v_)(l.getQuotaStatusText(o.currentChannel)),3)])]),_:1})],64)):(0,i.Q3)("",!0)]),_:1})]),_:1},8,["modelValue","title","onClosed"]),(0,i.bF)(T,{modelValue:o.showEditDialog,"onUpdate:modelValue":e[77]||(e[77]=t=>o.showEditDialog=t),title:t.$t("sysUpload.editDialogTitle",{name:o.editChannel?.name||""}),class:"channel-dialog","destroy-on-close":"",onClosed:l.resetEditData},{footer:(0,i.k6)(()=>[(0,i.bF)(h,{onClick:e[76]||(e[76]=t=>o.showEditDialog=!1)},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.cancel")),1)]),_:1}),(0,i.bF)(h,{type:"primary",onClick:l.confirmEditChannel},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.saveChanges")),1)]),_:1},8,["onClick"])]),default:(0,i.k6)(()=>[(0,i.bF)(F,{model:o.editChannel,"label-position":"top",ref:"editForm",rules:l.editRules},{default:(0,i.k6)(()=>[(0,i.bF)(x,{prop:"name"},{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.channelNameLabel"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.channelNameEditDisabledTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"exclamation-triangle",class:"inline-warning-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.name,"onUpdate:modelValue":e[38]||(e[38]=t=>o.editChannel.name=t),disabled:""},null,8,["modelValue"])]),_:1}),(0,i.bF)(x,{label:t.$t("sysUpload.enableChannel")},{default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.editChannel.enabled,"onUpdate:modelValue":e[39]||(e[39]=t=>o.editChannel.enabled=t)},null,8,["modelValue"])]),_:1},8,["label"]),"telegram"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.bF)(x,{label:t.$t("sysUpload.botTokenLabel"),prop:"botToken"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.botToken,"onUpdate:modelValue":e[40]||(e[40]=t=>o.editChannel.botToken=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.chatIdLabel"),prop:"chatId"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.chatId,"onUpdate:modelValue":e[41]||(e[41]=t=>o.editChannel.chatId=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.proxyDomain")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.proxyUrl,"onUpdate:modelValue":e[42]||(e[42]=t=>o.editChannel.proxyUrl=t),placeholder:t.$t("sysUpload.proxyDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):"cfr2"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:1},[(0,i.bF)(x,{label:t.$t("sysUpload.publicUrl")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.publicUrl,"onUpdate:modelValue":e[43]||(e[43]=t=>o.editChannel.publicUrl=t)},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimit")},{default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.editChannel.quota.enabled,"onUpdate:modelValue":e[44]||(e[44]=t=>o.editChannel.quota.enabled=t),onChange:e[45]||(e[45]=t=>l.onQuotaEnabledChange(t,o.editChannel))},null,8,["modelValue"])]),_:1},8,["label"]),o.editChannel.quota?.enabled?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimitGB")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.editChannel.quota.limitGB,"onUpdate:modelValue":e[46]||(e[46]=t=>o.editChannel.quota.limitGB=t),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.quotaThreshold")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.editChannel.quota.threshold,"onUpdate:modelValue":e[47]||(e[47]=t=>o.editChannel.quota.threshold=t),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,i.Q3)("",!0)],64)):"s3"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:2},[(0,i.bF)(x,{label:t.$t("sysUpload.endpointLabel"),prop:"endpoint"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.endpoint,"onUpdate:modelValue":e[48]||(e[48]=t=>o.editChannel.endpoint=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.cdnDomain"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.cdnDomainTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.cdnDomain,"onUpdate:modelValue":e[49]||(e[49]=t=>o.editChannel.cdnDomain=t),placeholder:t.$t("sysUpload.cdnDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),(0,i.bF)(x,{label:t.$t("sysUpload.bucketName"),prop:"bucketName"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.bucketName,"onUpdate:modelValue":e[50]||(e[50]=t=>o.editChannel.bucketName=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.bucketRegion"),prop:"region"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.region,"onUpdate:modelValue":e[51]||(e[51]=t=>o.editChannel.region=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.accessKeyId"),prop:"accessKeyId"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.accessKeyId,"onUpdate:modelValue":e[52]||(e[52]=t=>o.editChannel.accessKeyId=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.secretAccessKey"),prop:"secretAccessKey"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.secretAccessKey,"onUpdate:modelValue":e[53]||(e[53]=t=>o.editChannel.secretAccessKey=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.pathStyle"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.pathStyleTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.editChannel.pathStyle,"onUpdate:modelValue":e[54]||(e[54]=t=>o.editChannel.pathStyle=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1}),(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimit")},{default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.editChannel.quota.enabled,"onUpdate:modelValue":e[55]||(e[55]=t=>o.editChannel.quota.enabled=t),onChange:e[56]||(e[56]=t=>l.onQuotaEnabledChange(t,o.editChannel))},null,8,["modelValue"])]),_:1},8,["label"]),o.editChannel.quota?.enabled?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimitGB")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.editChannel.quota.limitGB,"onUpdate:modelValue":e[57]||(e[57]=t=>o.editChannel.quota.limitGB=t),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.quotaThreshold")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.editChannel.quota.threshold,"onUpdate:modelValue":e[58]||(e[58]=t=>o.editChannel.quota.threshold=t),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,i.Q3)("",!0)],64)):"discord"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:3},[(0,i.bF)(x,{label:t.$t("sysUpload.botTokenLabel"),prop:"botToken"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.botToken,"onUpdate:modelValue":e[59]||(e[59]=t=>o.editChannel.botToken=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.channelIdLabel"),prop:"channelId"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.channelId,"onUpdate:modelValue":e[60]||(e[60]=t=>o.editChannel.channelId=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.proxyDomain")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.proxyUrl,"onUpdate:modelValue":e[61]||(e[61]=t=>o.editChannel.proxyUrl=t),placeholder:t.$t("sysUpload.proxyDomainPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.nitroMember"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.nitroTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.editChannel.isNitro,"onUpdate:modelValue":e[62]||(e[62]=t=>o.editChannel.isNitro=t)},null,8,["modelValue"])]),_:1})],64)):"huggingface"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:4},[(0,i.bF)(x,{label:t.$t("sysUpload.repoName"),prop:"repo"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.repo,"onUpdate:modelValue":e[63]||(e[63]=t=>o.editChannel.repo=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.accessToken"),prop:"token"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.token,"onUpdate:modelValue":e[64]||(e[64]=t=>o.editChannel.token=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.privateRepo"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.privateRepoTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.editChannel.isPrivate,"onUpdate:modelValue":e[65]||(e[65]=t=>o.editChannel.isPrivate=t)},null,8,["modelValue"])]),_:1})],64)):"webdav"===o.currentChannelType?((0,i.uX)(),(0,i.CE)(i.FK,{key:5},[(0,i.bF)(x,{label:t.$t("sysUpload.webdavBaseUrl"),prop:"baseUrl"},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.baseUrl,"onUpdate:modelValue":e[66]||(e[66]=t=>o.editChannel.baseUrl=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.webdavUsername")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.username,"onUpdate:modelValue":e[67]||(e[67]=t=>o.editChannel.username=t),disabled:o.editChannel.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.webdavPassword")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.password,"onUpdate:modelValue":e[68]||(e[68]=t=>o.editChannel.password=t),disabled:o.editChannel.fixed,type:"password","show-password":""},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.publicUrl"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.webdavPublicUrlTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.publicUrl,"onUpdate:modelValue":e[69]||(e[69]=t=>o.editChannel.publicUrl=t),placeholder:t.$t("sysUpload.webdavPublicUrlPlaceholder")},null,8,["modelValue","placeholder"])]),_:1}),(0,i.bF)(x,{label:t.$t("sysUpload.webdavHeaders")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{modelValue:o.editChannel.headersText,"onUpdate:modelValue":e[70]||(e[70]=t=>o.editChannel.headersText=t),type:"textarea",autosize:{minRows:2},placeholder:t.$t("sysUpload.webdavHeadersPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(x,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysUpload.webdavCreateDirectory"))+" ",1),(0,i.bF)(d,{content:t.$t("sysUpload.webdavCreateDirectoryTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",class:"inline-help-icon"})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.editChannel.createDirectory,"onUpdate:modelValue":e[71]||(e[71]=t=>o.editChannel.createDirectory=t)},null,8,["modelValue"])]),_:1}),(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimit")},{default:(0,i.k6)(()=>[(0,i.bF)(f,{modelValue:o.editChannel.quota.enabled,"onUpdate:modelValue":e[72]||(e[72]=t=>o.editChannel.quota.enabled=t),onChange:e[73]||(e[73]=t=>l.onQuotaEnabledChange(t,o.editChannel))},null,8,["modelValue"])]),_:1},8,["label"]),o.editChannel.quota?.enabled?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.bF)(x,{label:t.$t("sysUpload.quotaLimitGB")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.editChannel.quota.limitGB,"onUpdate:modelValue":e[74]||(e[74]=t=>o.editChannel.quota.limitGB=t),min:.1,step:1,precision:1},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(x,{label:t.$t("sysUpload.quotaThreshold")},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.editChannel.quota.threshold,"onUpdate:modelValue":e[75]||(e[75]=t=>o.editChannel.quota.threshold=t),min:50,max:100,step:5},null,8,["modelValue"])]),_:1},8,["label"])],64)):(0,i.Q3)("",!0)],64)):(0,i.Q3)("",!0)]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title","onClosed"])])),[[D,o.loading]])}var Sp={components:{ChannelIcon:Tu.A,CustomSelect:$u},data(){return{channelFilter:"",channels:[{value:"telegram",label:"Telegram"},{value:"cfr2",label:"CloudFlare R2"},{value:"s3",label:"S3"},{value:"discord",label:"Discord"},{value:"huggingface",label:"HuggingFace"},{value:"webdav",label:"WebDAV"}],addableChannels:[{value:"telegram",label:"Telegram"},{value:"cfr2",label:"CloudFlare R2"},{value:"s3",label:"S3"},{value:"discord",label:"Discord"},{value:"huggingface",label:"HuggingFace"},{value:"webdav",label:"WebDAV"}],telegramSettings:{loadBalance:{enabled:!1},channels:[]},cfr2Settings:{channels:[]},s3Settings:{loadBalance:{enabled:!1},channels:[]},discordSettings:{loadBalance:{enabled:!1},channels:[]},huggingfaceSettings:{loadBalance:{enabled:!1},channels:[]},webdavSettings:{loadBalance:{enabled:!1},channels:[]},showAddDialog:!1,showDetailDialog:!1,showEditDialog:!1,currentChannelType:"",currentChannelIndex:-1,currentChannel:null,editChannel:{},newChannel:{type:"",name:"",enabled:!0,botToken:"",chatId:"",proxyUrl:"",endpoint:"",cdnDomain:"",bucketName:"",region:"auto",accessKeyId:"",secretAccessKey:"",pathStyle:!1,quota:{enabled:!1,limitGB:10,threshold:95},channelId:"",isNitro:!1,repo:"",token:"",isPrivate:!1,baseUrl:"",username:"",password:"",publicUrl:"",headersText:"",createDirectory:!0},quotaStats:{},quotaLoading:!1,loading:!1}},computed:{filterOptions(){return[{value:"",label:this.$t("common.all")},...this.channels.map(t=>({value:t.value,label:t.label,channelType:t.value,iconClass:this.getChannelIconClass(t.value)}))]},filteredChannels(){return this.channelFilter?this.channels.filter(t=>t.value===this.channelFilter):this.channels},addRules(){return{type:[{required:!0,message:this.$t("sysUpload.channelTypePlaceholder"),trigger:"change"}],name:[{required:!0,message:this.$t("sysUpload.channelNamePlaceholder"),trigger:"blur"},{pattern:/^[\u4e00-\u9fa5a-zA-Z0-9_-]+$/,message:this.$t("sysUpload.channelNamePlaceholder"),trigger:"blur"}],botToken:[{required:!0,message:this.$t("sysUpload.botTokenPlaceholder"),trigger:"blur"}],chatId:[{required:!0,message:this.$t("sysUpload.chatIdPlaceholder"),trigger:"blur"}],channelId:[{required:!0,message:this.$t("sysUpload.channelIdPlaceholder"),trigger:"blur"}],endpoint:[{required:!0,message:this.$t("sysUpload.endpointPlaceholder"),trigger:"blur"}],bucketName:[{required:!0,message:this.$t("sysUpload.bucketNamePlaceholder"),trigger:"blur"}],region:[{required:!0,message:this.$t("sysUpload.bucketRegionPlaceholder"),trigger:"blur"}],accessKeyId:[{required:!0,message:this.$t("sysUpload.accessKeyIdPlaceholder"),trigger:"blur"}],secretAccessKey:[{required:!0,message:this.$t("sysUpload.secretAccessKeyPlaceholder"),trigger:"blur"}],repo:[{required:!0,message:this.$t("sysUpload.repoNamePlaceholder"),trigger:"blur"}],token:[{required:!0,message:this.$t("sysUpload.accessTokenPlaceholder"),trigger:"blur"}],baseUrl:[{required:!0,message:this.$t("sysUpload.webdavBaseUrlPlaceholder"),trigger:"blur"}]}},editRules(){return{name:[{required:!0,message:this.$t("sysUpload.channelNamePlaceholder"),trigger:"blur"},{pattern:/^[\u4e00-\u9fa5a-zA-Z0-9_-]+$/,message:this.$t("sysUpload.channelNamePlaceholder"),trigger:"blur"}],botToken:[{required:!0,message:this.$t("sysUpload.botTokenPlaceholder"),trigger:"blur"}],chatId:[{required:!0,message:this.$t("sysUpload.chatIdPlaceholder"),trigger:"blur"}],channelId:[{required:!0,message:this.$t("sysUpload.channelIdPlaceholder"),trigger:"blur"}],endpoint:[{required:!0,message:this.$t("sysUpload.endpointPlaceholder"),trigger:"blur"}],bucketName:[{required:!0,message:this.$t("sysUpload.bucketNamePlaceholder"),trigger:"blur"}],region:[{required:!0,message:this.$t("sysUpload.bucketRegionPlaceholder"),trigger:"blur"}],accessKeyId:[{required:!0,message:this.$t("sysUpload.accessKeyIdPlaceholder"),trigger:"blur"}],secretAccessKey:[{required:!0,message:this.$t("sysUpload.secretAccessKeyPlaceholder"),trigger:"blur"}],repo:[{required:!0,message:this.$t("sysUpload.repoNamePlaceholder"),trigger:"blur"}],token:[{required:!0,message:this.$t("sysUpload.accessTokenPlaceholder"),trigger:"blur"}],baseUrl:[{required:!0,message:this.$t("sysUpload.webdavBaseUrlPlaceholder"),trigger:"blur"}]}}},methods:{handleCardMouseMove(t,e,s){const i=t.currentTarget,n=i.getBoundingClientRect(),a=t.clientX-n.left,o=t.clientY-n.top,l=`glow-${e}-${s}`,r=this.$refs[l];r&&r[0]&&(r[0].style.opacity="1",r[0].style.left=`${a}px`,r[0].style.top=`${o}px`)},handleCardMouseLeave(t,e){const s=`glow-${t}-${e}`,i=this.$refs[s];i&&i[0]&&(i[0].style.opacity="0")},getChannelIconClass(t){return`channel-brand-${t}`},getChannelTypeLabel(t){const e=this.channels.find(e=>e.value===t);return e?e.label:t},getChannelList(t){return this.getSettings(t)?.channels||[]},getSettings(t){const e={telegram:this.telegramSettings,cfr2:this.cfr2Settings,s3:this.s3Settings,discord:this.discordSettings,huggingface:this.huggingfaceSettings,webdav:this.webdavSettings};return e[t]},hasLoadBalance(t){return["telegram","s3","discord","huggingface","webdav"].includes(t)},maskText(t,e=4){return t?t.length<=2*e?"****":t.slice(0,e)+"****"+t.slice(-e):this.$t("sysUpload.notSet")},formatHeaders(t){return!t||"object"===typeof t&&0===Object.keys(t).length?this.$t("sysUpload.notSet"):"string"===typeof t?t:JSON.stringify(t,null,2)},headersToText(t){return t?"string"===typeof t?t:JSON.stringify(t,null,2):""},parseHeadersText(t){if(!t||!t.trim())return{};try{const e=JSON.parse(t);return!e||"object"!==typeof e||Array.isArray(e)?null:e}catch(e){return null}},openDetailDialog(t,e){this.currentChannelType=t,this.currentChannelIndex=e,this.currentChannel=this.getChannelList(t)[e],this.showDetailDialog=!0},openEditDialog(t,e){this.currentChannelType=t,this.currentChannelIndex=e;const s=this.getChannelList(t)[e];this.editChannel=JSON.parse(JSON.stringify(s)),"webdav"===t&&(this.editChannel.headersText=this.headersToText(this.editChannel.headers),this.editChannel.createDirectory=!1!==this.editChannel.createDirectory),this.editChannel.quota||(this.editChannel.quota={enabled:!1,limitGB:10,threshold:95}),this.showEditDialog=!0},openEditFromDetail(){this.showDetailDialog=!1,this.openEditDialog(this.currentChannelType,this.currentChannelIndex)},resetAddForm(){this.newChannel={type:"",name:"",enabled:!0,botToken:"",chatId:"",proxyUrl:"",endpoint:"",bucketName:"",region:"auto",accessKeyId:"",secretAccessKey:"",pathStyle:!1,quota:{enabled:!1,limitGB:10,threshold:95},channelId:"",isNitro:!1,repo:"",token:"",isPrivate:!1,baseUrl:"",username:"",password:"",publicUrl:"",headersText:"",createDirectory:!0}},resetDetailData(){this.currentChannel=null},resetEditData(){this.editChannel={}},onChannelTypeChange(){const{type:t,name:e}=this.newChannel;this.newChannel={type:t,name:e,enabled:!0,botToken:"",chatId:"",proxyUrl:"",endpoint:"",cdnDomain:"",bucketName:"",region:"auto",accessKeyId:"",secretAccessKey:"",pathStyle:!1,quota:{enabled:!1,limitGB:10,threshold:95},channelId:"",isNitro:!1,repo:"",token:"",isPrivate:!1,baseUrl:"",username:"",password:"",publicUrl:"",headersText:"",createDirectory:!0}},confirmAddChannel(){this.$refs.addForm.validate(t=>{if(!t)return;const{type:e,name:s}=this.newChannel,i=this.getSettings(e),n=["Telegram_env","R2_env","S3_env","Discord_env","HuggingFace_env","WebDAV_env"];if(n.includes(s))return void this.$message.warning(this.$t("sysUpload.reservedName"));const a=i.channels.some(t=>t.name===s);if(a)return void this.$message.warning(this.$t("sysUpload.duplicateName"));let o={id:i.channels.length+1,name:this.newChannel.name,type:e,savePath:"database",enabled:!0,fixed:!1};if("telegram"===e)Object.assign(o,{botToken:this.newChannel.botToken,chatId:this.newChannel.chatId,proxyUrl:this.newChannel.proxyUrl});else if("s3"===e)Object.assign(o,{endpoint:this.newChannel.endpoint,cdnDomain:this.newChannel.cdnDomain,bucketName:this.newChannel.bucketName,region:this.newChannel.region,accessKeyId:this.newChannel.accessKeyId,secretAccessKey:this.newChannel.secretAccessKey,pathStyle:this.newChannel.pathStyle,quota:{...this.newChannel.quota}});else if("discord"===e)Object.assign(o,{botToken:this.newChannel.botToken,channelId:this.newChannel.channelId,proxyUrl:this.newChannel.proxyUrl,isNitro:this.newChannel.isNitro});else if("huggingface"===e)Object.assign(o,{repo:this.newChannel.repo,token:this.newChannel.token,isPrivate:this.newChannel.isPrivate});else if("webdav"===e){const t=this.parseHeadersText(this.newChannel.headersText);if(null===t)return void this.$message.warning(this.$t("sysUpload.webdavHeadersInvalid"));Object.assign(o,{baseUrl:this.newChannel.baseUrl,username:this.newChannel.username,password:this.newChannel.password,publicUrl:this.newChannel.publicUrl,headers:t,createDirectory:!1!==this.newChannel.createDirectory,quota:{...this.newChannel.quota}})}i.channels.push(o),this.showAddDialog=!1,this.saveSettings()})},confirmEditChannel(){this.$refs.editForm.validate(t=>{if(!t)return;const e=this.getSettings(this.currentChannelType),s=this.currentChannelIndex,i=e.channels[s]?.name||this.editChannel.name,n={...this.editChannel,name:i};if("webdav"===this.currentChannelType){const t=this.parseHeadersText(n.headersText);if(null===t)return void this.$message.warning(this.$t("sysUpload.webdavHeadersInvalid"));n.headers=t,n.createDirectory=!1!==n.createDirectory,delete n.headersText}e.channels[this.currentChannelIndex]=n,this.showEditDialog=!1,this.saveSettings()})},deleteChannel(t,e){const s=this.getChannelList(t)[e];s.fixed?this.$message.warning(this.$t("sysUpload.fixedChannelCannotDelete")):this.$confirm(this.$t("sysUpload.deleteChannelConfirm"),this.$t("common.warning"),{confirmButtonText:this.$t("common.confirm"),cancelButtonText:this.$t("common.cancel"),type:"warning"}).then(()=>{const s=this.getSettings(t);s.channels.splice(e,1),s.channels.forEach((t,e)=>{t.id=e+1}),this.saveSettings()}).catch(()=>{})},saveSettings(){const t={telegram:this.telegramSettings,cfr2:this.cfr2Settings,s3:this.s3Settings,discord:this.discordSettings,huggingface:this.huggingfaceSettings,webdav:this.webdavSettings};(0,Pe.A)("/api/manage/sysConfig/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(()=>{this.$message.success(this.$t("sysOthers.settingsSaved"))})},async refreshQuota(){this.quotaLoading=!0;try{const t=await(0,Pe.A)("/api/manage/quota",{method:"POST"}),e=await t.json();if(e.success)this.quotaStats=e.channelStats||{};else{const t=await(0,Pe.A)("/api/manage/quota"),e=await t.json();e.success&&(this.quotaStats=e.quotaStats||{})}}catch(t){console.error("Failed to refresh quota stats:",t)}finally{this.quotaLoading=!1}},async loadQuotaStats(){try{const t=await(0,Pe.A)("/api/manage/quota"),e=await t.json();e.success&&(this.quotaStats=e.quotaStats||{})}catch(t){console.error("Failed to load quota stats:",t)}},getChannelUsedGB(t){const e=this.quotaStats[t.name];return e?(e.usedMB||0)/1024:0},getQuotaPercentage(t){const e=this.getChannelUsedGB(t),s=t.quota?.limitGB||10,i=e/s*100;return Math.min(100,Math.round(10*i)/10)},getQuotaStatus(t){const e=this.getQuotaPercentage(t),s=t.quota?.threshold||95;return e>=s?"exception":e>=80?"warning":"success"},getQuotaText(t){const e=this.getChannelUsedGB(t),s=t.quota?.limitGB||10;return`${e.toFixed(2)} / ${s} GB`},isQuotaExceeded(t){const e=this.getQuotaPercentage(t),s=t.quota?.threshold||95;return e>=s},getQuotaStatusText(t){const e=this.getQuotaPercentage(t),s=t.quota?.threshold||95;return e>=s?`⚠️ 已达到容量阈值 (${s}%),渠道写入已暂停`:e>=80?"⚡ 容量使用较高,接近阈值":"✓ 容量正常"},async onQuotaEnabledChange(t,e){if(t&&e.name){const t=this.quotaStats[e.name];t||this.$confirm(this.$t("sysUpload.quotaInitConfirm"),this.$t("sysUpload.quotaInitTitle"),{confirmButtonText:this.$t("sysUpload.quotaInitConfirmBtn"),cancelButtonText:this.$t("sysUpload.quotaInitCancelBtn"),type:"info"}).then(async()=>{await this.recalculateQuota()}).catch(()=>{this.$message.info(this.$t("sysUpload.quotaInitLater"))})}},async recalculateQuota(){this.quotaLoading=!0;try{this.$message.info(this.$t("sysUpload.quotaCalculating"));const t=await(0,Pe.A)("/api/manage/quota",{method:"POST"}),e=await t.json();e.success?(this.quotaStats=e.channelStats||{},this.$message.success(this.$t("sysUpload.quotaCalculateSuccess"))):this.$message.error(this.$t("sysUpload.quotaCalculateError")+(e.error||""))}catch(t){console.error("Failed to recalculate quota:",t),this.$message.error(this.$t("sysUpload.quotaCalculateFailed"))}finally{this.quotaLoading=!1}}},mounted(){this.loading=!0,(0,Pe.A)("/api/manage/sysConfig/upload").then(t=>t.json()).then(t=>{this.telegramSettings=t.telegram,t.cfr2&&t.cfr2.channels&&(t.cfr2.channels=t.cfr2.channels.map(t=>({...t,quota:t.quota||{enabled:!1,limitGB:10,threshold:95}}))),this.cfr2Settings=t.cfr2,t.s3&&t.s3.channels&&(t.s3.channels=t.s3.channels.map(t=>({...t,quota:t.quota||{enabled:!1,limitGB:10,threshold:95}}))),this.s3Settings=t.s3,t.discord&&t.discord.channels&&(t.discord.channels=t.discord.channels.map(t=>({...t,proxyUrl:t.proxyUrl||""}))),this.discordSettings=t.discord||{loadBalance:{},channels:[]},t.huggingface&&t.huggingface.channels&&(t.huggingface.channels=t.huggingface.channels.map(t=>({...t,isPrivate:t.isPrivate||!1}))),this.huggingfaceSettings=t.huggingface||{loadBalance:{},channels:[]},t.webdav&&t.webdav.channels&&(t.webdav.channels=t.webdav.channels.map(t=>({...t,username:t.username||"",password:t.password||"",publicUrl:t.publicUrl||"",headers:t.headers||{},createDirectory:!1!==t.createDirectory,quota:t.quota||{enabled:!1,limitGB:10,threshold:95}}))),this.webdavSettings=t.webdav||{loadBalance:{},channels:[]},this.loadQuotaStats()}).finally(()=>{this.loading=!1})}};const Fp=(0,c.A)(Sp,[["render",Cp],["__scopeId","data-v-9a9d7c2a"]]);var Tp=Fp,Pp=s(98469);s(49187);const Mp={class:"save-text"};function Dp(t,e,s,a,o,l){const r=(0,i.g2)("font-awesome-icon");return(0,i.uX)(),(0,i.Wv)(C.eB,{name:"fade-up"},{default:(0,i.k6)(()=>[(0,i.bo)((0,i.Lk)("div",{class:(0,n.C4)(["floating-save-btn",{"is-loading":s.loading}]),onClick:e[0]||(e[0]=(...t)=>l.handleClick&&l.handleClick(...t))},[s.loading?((0,i.uX)(),(0,i.Wv)(r,{key:0,icon:"spinner",spin:""})):((0,i.uX)(),(0,i.Wv)(r,{key:1,icon:"save"})),(0,i.Lk)("span",Mp,(0,n.v_)(s.loading?t.$t("floatingSave.saving"):t.$t("floatingSave.save")),1)],2),[[C.aG,o.visible]])]),_:1})}var Ap={name:"FloatingSaveButton",emits:["click"],props:{loading:{type:Boolean,default:!1},show:{type:Boolean,default:!0}},data(){return{visible:!1}},watch:{show:{immediate:!0,handler(t){t?setTimeout(()=>{this.visible=!0},600):this.visible=!1}}},methods:{handleClick(){this.loading||this.$emit("click")}}};const $p=(0,c.A)(Ap,[["render",Dp],["__scopeId","data-v-53091626"]]);var Vp=$p,Lp=s(84757);s(5802),s(64752),s(38736);const Ep={class:"security-settings"},Ip={class:"first-settings"},Up={class:"first-title"},Op={class:"second-title"},Rp={style:{display:"flex",gap:"8px",width:"100%"}},Wp={class:"second-title"},Bp={style:{display:"flex",gap:"8px",width:"100%"}},Np={class:"second-title token-title"},zp={class:"token-actions"},jp={class:"token-table-container"},qp={class:"table-cell-content"},Hp={class:"table-cell-content"},Xp={class:"token-display"},Kp={class:"table-cell-content"},Qp={class:"table-cell-content"},Yp={class:"table-cell-content"},Gp={class:"table-cell-content"},Jp={class:"table-cell-content action-buttons"},Zp={class:"first-settings"},tg={class:"first-title"},eg={class:"second-title"},sg={class:"second-title"},ig={class:"query-param-list"},ng={class:"query-param-list"},ag={class:"first-settings"},og={class:"first-title"},lg={class:"second-title"},rg={class:"second-title"},dg={class:"second-title"},cg={class:"form-item-hint"},hg={class:"form-item-hint"},ug={style:{display:"flex",gap:"10px",width:"100%"}},pg={class:"dialog-footer"},gg={style:{display:"flex",gap:"10px",width:"100%"}},fg={class:"dialog-footer"},mg={class:"token-result"},bg={style:{"margin-bottom":"15px",color:"#e6a23c"}},yg={class:"dialog-footer"};function xg(t,e,s,a,o,l){const r=wu.WK,d=Pp.dI,c=_u.xE,h=_u.US,u=(0,i.g2)("font-awesome-icon"),p=K.S2,f=Lp.o8,m=Fu.u,b=Lp.Up,y=g.R7,x=Su.qi,_=Cu.P9,k=Cu.AV,S=ku.lq,F=Vp,T=Pp.o5,P=w.kZ,M=v.A;return(0,i.bo)(((0,i.uX)(),(0,i.CE)("div",Ep,[(0,i.Lk)("div",Ip,[(0,i.Lk)("h3",Up,(0,n.v_)(t.$t("sysSecurity.authManagement")),1),(0,i.Lk)("h4",Op,(0,n.v_)(t.$t("sysSecurity.userAuth")),1),(0,i.bF)(h,{model:o.authSettings.user,rules:l.userPassRules,ref:"userPassForm","label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,{label:t.$t("sysSecurity.uploadPassword"),prop:"authCode"},{default:(0,i.k6)(()=>[(0,i.Lk)("div",Rp,[(0,i.bF)(r,{modelValue:o.authSettings.user.authCode,"onUpdate:modelValue":e[0]||(e[0]=t=>o.authSettings.user.authCode=t),type:"password","show-password":"",onInput:l.handleUserPassInput,autocomplete:"new-password",placeholder:o.authSettings.user._hasPassword?t.$t("sysSecurity.passwordUnchanged"):"",disabled:o.clearUserPassword},null,8,["modelValue","onInput","placeholder","disabled"]),o.authSettings.user._hasPassword?((0,i.uX)(),(0,i.Wv)(d,{key:0,modelValue:o.clearUserPassword,"onUpdate:modelValue":e[1]||(e[1]=t=>o.clearUserPassword=t),onChange:l.handleClearUserPassword},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.clearPassword")),1)]),_:1},8,["modelValue","onChange"])):(0,i.Q3)("",!0)])]),_:1},8,["label"]),(0,i.bF)(C.eB,{name:"fade-slide",mode:"out-in"},{default:(0,i.k6)(()=>[o.showUserPassConfirm?((0,i.uX)(),(0,i.Wv)(c,{label:t.$t("sysSecurity.confirmPassword"),prop:"confirmNewUserPassword",key:"user-confirm"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.authSettings.user.confirmNewUserPassword,"onUpdate:modelValue":e[2]||(e[2]=t=>o.authSettings.user.confirmNewUserPassword=t),type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue"])]),_:1},8,["label"])):(0,i.Q3)("",!0)]),_:1})]),_:1},8,["model","rules"]),(0,i.Lk)("h4",Wp,(0,n.v_)(t.$t("sysSecurity.adminAuth")),1),(0,i.bF)(h,{model:o.authSettings.admin,rules:l.adminPassRules,ref:"adminPassForm","label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,{label:t.$t("sysSecurity.adminUsername"),prop:"adminUsername"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.authSettings.admin.adminUsername,"onUpdate:modelValue":e[3]||(e[3]=t=>o.authSettings.admin.adminUsername=t),autocomplete:"new-password",disabled:o.clearAdminPassword},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.adminPassword"),prop:"adminPassword"},{default:(0,i.k6)(()=>[(0,i.Lk)("div",Bp,[(0,i.bF)(r,{modelValue:o.authSettings.admin.adminPassword,"onUpdate:modelValue":e[4]||(e[4]=t=>o.authSettings.admin.adminPassword=t),type:"password","show-password":"",onInput:l.handleAdminPassInput,autocomplete:"new-password",placeholder:o.authSettings.admin._hasPassword?t.$t("sysSecurity.passwordUnchanged"):"",disabled:o.clearAdminPassword},null,8,["modelValue","onInput","placeholder","disabled"]),o.authSettings.admin._hasPassword?((0,i.uX)(),(0,i.Wv)(d,{key:0,modelValue:o.clearAdminPassword,"onUpdate:modelValue":e[5]||(e[5]=t=>o.clearAdminPassword=t),onChange:l.handleClearAdminPassword},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.clearPassword")),1)]),_:1},8,["modelValue","onChange"])):(0,i.Q3)("",!0)])]),_:1},8,["label"]),(0,i.bF)(C.eB,{name:"fade-slide",mode:"out-in"},{default:(0,i.k6)(()=>[o.showAdminPassConfirm?((0,i.uX)(),(0,i.Wv)(c,{label:t.$t("sysSecurity.confirmPassword"),prop:"confirmNewAdminPassword",key:"admin-confirm"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.authSettings.admin.confirmNewAdminPassword,"onUpdate:modelValue":e[6]||(e[6]=t=>o.authSettings.admin.confirmNewAdminPassword=t),type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue"])]),_:1},8,["label"])):(0,i.Q3)("",!0)]),_:1})]),_:1},8,["model","rules"]),(0,i.Lk)("h4",Np,[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.apiTokenManagement"))+" ",1),(0,i.Lk)("a",zp,[(0,i.bF)(p,{type:"primary",size:"small",onClick:e[7]||(e[7]=t=>o.showCreateTokenDialog=!0),circle:""},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"plus"})]),_:1})])]),(0,i.Lk)("div",jp,[(0,i.bo)(((0,i.uX)(),(0,i.Wv)(b,{data:o.apiTokens,class:"token-table"},{default:(0,i.k6)(()=>[(0,i.bF)(f,{prop:"name",label:t.$t("sysSecurity.tokenName"),"header-align":"center"},{default:(0,i.k6)(t=>[(0,i.Lk)("div",qp,(0,n.v_)(t.row.name),1)]),_:1},8,["label"]),(0,i.bF)(f,{prop:"token",label:t.$t("sysSecurity.tokenValue"),"header-align":"center"},{default:(0,i.k6)(t=>[(0,i.Lk)("div",Hp,[(0,i.Lk)("span",Xp,(0,n.v_)(t.row.token),1)])]),_:1},8,["label"]),(0,i.bF)(f,{prop:"permissions",label:t.$t("sysSecurity.permissions"),"header-align":"center"},{default:(0,i.k6)(t=>[(0,i.Lk)("div",Kp,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(t.row.permissions,t=>((0,i.uX)(),(0,i.Wv)(m,{key:t,size:"small",class:"permission-tag"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(l.getPermissionText(t)),1)]),_:2},1024))),128))])]),_:1},8,["label"]),(0,i.bF)(f,{prop:"createdAt",label:t.$t("sysSecurity.createdAt"),"header-align":"center"},{default:(0,i.k6)(t=>[(0,i.Lk)("div",Qp,(0,n.v_)(l.formatDate(t.row.createdAt)),1)]),_:1},8,["label"]),(0,i.bF)(f,{label:t.$t("sysSecurity.status"),"header-align":"center",width:"90"},{default:(0,i.k6)(t=>[(0,i.Lk)("div",Yp,[(0,i.bF)(m,{type:"active"===l.getTokenStatus(t.row.expiresAt).status?"success":"danger",size:"small"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(l.getTokenStatus(t.row.expiresAt).label),1)]),_:2},1032,["type"])])]),_:1},8,["label"]),(0,i.bF)(f,{label:t.$t("sysSecurity.expiresAt"),"header-align":"center"},{default:(0,i.k6)(t=>[(0,i.Lk)("div",Gp,(0,n.v_)(l.getTokenStatus(t.row.expiresAt).expiresText),1)]),_:1},8,["label"]),(0,i.bF)(f,{label:t.$t("sysSecurity.operation"),fixed:"right","header-align":"center"},{default:(0,i.k6)(e=>[(0,i.Lk)("div",Jp,[(0,i.bF)(p,{class:"action-button",size:"small",onClick:t=>l.editToken(e.row)},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.editBtn")),1)]),_:1},8,["onClick"]),(0,i.bF)(p,{class:"action-button",size:"small",type:"danger",onClick:t=>l.deleteToken(e.row.id)},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.deleteBtn")),1)]),_:1},8,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data"])),[[M,o.tokenLoading]])])]),(0,i.Lk)("div",Zp,[(0,i.Lk)("h3",tg,(0,n.v_)(t.$t("sysSecurity.uploadManagement")),1),(0,i.Lk)("h4",eg,[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.imageReview"))+" ",1),(0,i.bF)(y,{content:t.$t("sysSecurity.imageReviewTooltip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,i.bF)(h,{model:o.uploadSettings.moderate,"label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,{label:t.$t("sysSecurity.enableReview")},{default:(0,i.k6)(()=>[(0,i.bF)(x,{modelValue:o.uploadSettings.moderate.enabled,"onUpdate:modelValue":e[8]||(e[8]=t=>o.uploadSettings.moderate.enabled=t)},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.reviewChannel")},{default:(0,i.k6)(()=>[(0,i.bF)(k,{modelValue:o.uploadSettings.moderate.channel,"onUpdate:modelValue":e[9]||(e[9]=t=>o.uploadSettings.moderate.channel=t),placeholder:t.$t("sysSecurity.reviewChannelPlaceholder")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{label:"moderatecontent.com",value:"moderatecontent.com"}),(0,i.bF)(_,{label:"nsfwjs",value:"nsfwjs"})]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),"moderatecontent.com"===o.uploadSettings.moderate.channel?((0,i.uX)(),(0,i.Wv)(c,{key:0,label:t.$t("sysSecurity.apiKey")},{default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.uploadSettings.moderate.moderateContentApiKey,"onUpdate:modelValue":e[10]||(e[10]=t=>o.uploadSettings.moderate.moderateContentApiKey=t)},null,8,["modelValue"])]),_:1},8,["label"])):(0,i.Q3)("",!0),"nsfwjs"===o.uploadSettings.moderate.channel?((0,i.uX)(),(0,i.Wv)(c,{key:1,label:t.$t("sysSecurity.apiPath")},{default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.uploadSettings.moderate.nsfwApiPath,"onUpdate:modelValue":e[11]||(e[11]=t=>o.uploadSettings.moderate.nsfwApiPath=t),placeholder:"https://nsfwjs.your.domain"},null,8,["modelValue"])]),_:1},8,["label"])):(0,i.Q3)("",!0)]),_:1},8,["model"]),(0,i.Lk)("h4",sg,[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.ipQuery"))+" ",1),(0,i.bF)(y,{content:t.$t("sysSecurity.ipQueryTooltip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,i.bF)(h,{model:o.uploadSettings.ipQuery,"label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,{label:t.$t("sysSecurity.enableIpQuery")},{default:(0,i.k6)(()=>[(0,i.bF)(x,{modelValue:o.uploadSettings.ipQuery.enabled,"onUpdate:modelValue":e[12]||(e[12]=t=>o.uploadSettings.ipQuery.enabled=t)},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.ipQueryChannel")},{default:(0,i.k6)(()=>[(0,i.bF)(k,{modelValue:o.uploadSettings.ipQuery.channel,"onUpdate:modelValue":e[13]||(e[13]=t=>o.uploadSettings.ipQuery.channel=t),placeholder:t.$t("sysSecurity.ipQueryChannelPlaceholder")},{default:(0,i.k6)(()=>[(0,i.bF)(_,{label:t.$t("sysSecurity.customApi"),value:"customApi"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),"customApi"===o.uploadSettings.ipQuery.channel?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[(0,i.bF)(c,{label:t.$t("sysSecurity.apiPath")},{default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.uploadSettings.ipQuery.customApi.url,"onUpdate:modelValue":e[14]||(e[14]=t=>o.uploadSettings.ipQuery.customApi.url=t),placeholder:"https://api.example.com/ip"},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.queryParams")},{default:(0,i.k6)(()=>[(0,i.Lk)("div",ig,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(o.uploadSettings.ipQuery.customApi.params,(e,s)=>((0,i.uX)(),(0,i.CE)("div",{key:s,class:"query-param-row"},[(0,i.bF)(r,{modelValue:e.key,"onUpdate:modelValue":t=>e.key=t,placeholder:t.$t("sysSecurity.paramNamePlaceholder")},null,8,["modelValue","onUpdate:modelValue","placeholder"]),(0,i.bF)(r,{modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,placeholder:t.$t("sysSecurity.paramValuePlaceholder")},null,8,["modelValue","onUpdate:modelValue","placeholder"]),(0,i.bF)(p,{type:"danger",plain:"",circle:"",onClick:t=>l.removeIpQueryParam(s),disabled:o.uploadSettings.ipQuery.customApi.params.length<=1},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"trash-alt"})]),_:1},8,["onClick","disabled"])]))),128)),(0,i.bF)(p,{type:"primary",plain:"",onClick:l.addIpQueryParam},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"plus"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysSecurity.addQueryParam")),1)]),_:1},8,["onClick"])])]),_:1},8,["label"]),(0,i.bF)(c,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.responseFields"))+" ",1),(0,i.bF)(y,{content:t.$t("sysSecurity.responseFieldsTip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.Lk)("div",ng,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(o.uploadSettings.ipQuery.customApi.responseFields,(e,s)=>((0,i.uX)(),(0,i.CE)("div",{key:s,class:"response-field-row"},[(0,i.bF)(r,{modelValue:o.uploadSettings.ipQuery.customApi.responseFields[s],"onUpdate:modelValue":t=>o.uploadSettings.ipQuery.customApi.responseFields[s]=t,placeholder:t.$t("sysSecurity.responseFieldPathPlaceholder")},null,8,["modelValue","onUpdate:modelValue","placeholder"]),(0,i.bF)(p,{plain:"",circle:"",onClick:t=>l.moveIpQueryResponseField(s,-1),disabled:0===s},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"arrow-up"})]),_:1},8,["onClick","disabled"]),(0,i.bF)(p,{plain:"",circle:"",onClick:t=>l.moveIpQueryResponseField(s,1),disabled:s===o.uploadSettings.ipQuery.customApi.responseFields.length-1},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"arrow-down"})]),_:1},8,["onClick","disabled"]),(0,i.bF)(p,{type:"danger",plain:"",circle:"",onClick:t=>l.removeIpQueryResponseField(s)},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"trash-alt"})]),_:1},8,["onClick"])]))),128)),(0,i.bF)(p,{type:"primary",plain:"",onClick:l.addIpQueryResponseField},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"plus"}),(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysSecurity.addResponseField")),1)]),_:1},8,["onClick"])])]),_:1})],64)):(0,i.Q3)("",!0)]),_:1},8,["model"])]),(0,i.Lk)("div",ag,[(0,i.Lk)("h3",og,(0,n.v_)(t.$t("sysSecurity.accessManagement")),1),(0,i.Lk)("h4",lg,(0,n.v_)(t.$t("sysSecurity.domainFilter")),1),(0,i.bF)(h,{model:o.accessSettings,"label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.allowedDomains"))+" ",1),(0,i.bF)(y,{content:t.$t("sysSecurity.allowedDomainsTooltip"),placement:"top","raw-content":""},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.accessSettings.allowedDomains,"onUpdate:modelValue":e[15]||(e[15]=t=>o.accessSettings.allowedDomains=t)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"]),(0,i.Lk)("h4",rg,(0,n.v_)(t.$t("sysSecurity.whiteListMode")),1),(0,i.bF)(h,{model:o.accessSettings,rules:l.accessRules,ref:"accessForm","label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.enableWhiteList"))+" ",1),(0,i.bF)(y,{content:t.$t("sysSecurity.enableWhiteListTooltip"),placement:"top","raw-content":""},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(x,{modelValue:o.accessSettings.whiteListMode,"onUpdate:modelValue":e[16]||(e[16]=t=>o.accessSettings.whiteListMode=t)},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"]),(0,i.Lk)("h4",dg,(0,n.v_)(t.$t("sysSecurity.sessionSecurityPolicy")),1),(0,i.bF)(h,{model:o.accessSettings,"label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,null,{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.secureMode"))+" ",1),(0,i.bF)(y,{content:t.$t("sysSecurity.secureModeTooltip"),placement:"top"},{default:(0,i.k6)(()=>[(0,i.bF)(u,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(x,{modelValue:o.accessSettings.sessionSecure,"onUpdate:modelValue":e[17]||(e[17]=t=>o.accessSettings.sessionSecure=t)},null,8,["modelValue"])]),_:1}),(0,i.bF)(c,{label:t.$t("sysSecurity.userSessionMaxAge"),prop:"userSessionMaxAge"},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.accessSettings.userSessionMaxAge,"onUpdate:modelValue":e[18]||(e[18]=t=>o.accessSettings.userSessionMaxAge=t),min:1,max:3650,step:1,precision:0,"controls-position":"right"},null,8,["modelValue"]),(0,i.Lk)("span",cg,(0,n.v_)(t.$t("sysSecurity.sessionMaxAgeUnit")),1)]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.adminSessionMaxAge"),prop:"adminSessionMaxAge"},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:o.accessSettings.adminSessionMaxAge,"onUpdate:modelValue":e[19]||(e[19]=t=>o.accessSettings.adminSessionMaxAge=t),min:1,max:3650,step:1,precision:0,"controls-position":"right"},null,8,["modelValue"]),(0,i.Lk)("span",hg,(0,n.v_)(t.$t("sysSecurity.sessionMaxAgeUnit")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),(0,i.bF)(F,{show:!o.loading,onClick:l.saveSettings},null,8,["show","onClick"]),(0,i.bF)(P,{modelValue:o.showCreateTokenDialog,"onUpdate:modelValue":e[27]||(e[27]=t=>o.showCreateTokenDialog=t),title:t.$t("sysSecurity.createTokenTitle"),width:l.dialogWidth},{footer:(0,i.k6)(()=>[(0,i.Lk)("span",pg,[(0,i.bF)(p,{onClick:e[26]||(e[26]=t=>o.showCreateTokenDialog=!1)},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("common.cancel")),1)]),_:1}),(0,i.bF)(p,{type:"primary",onClick:l.createToken},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.createBtn")),1)]),_:1},8,["onClick"])])]),default:(0,i.k6)(()=>[(0,i.bF)(h,{model:o.newToken,rules:l.tokenRules,ref:"tokenForm","label-width":"100px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,{label:t.$t("sysSecurity.tokenNameLabel"),prop:"name"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.newToken.name,"onUpdate:modelValue":e[20]||(e[20]=t=>o.newToken.name=t),placeholder:t.$t("sysSecurity.tokenNamePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.permissionsLabel"),prop:"permissions"},{default:(0,i.k6)(()=>[(0,i.bF)(T,{modelValue:o.newToken.permissions,"onUpdate:modelValue":e[21]||(e[21]=t=>o.newToken.permissions=t)},{default:(0,i.k6)(()=>[(0,i.bF)(d,{label:"upload"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.permUpload")),1)]),_:1}),(0,i.bF)(d,{label:"delete"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.permDelete")),1)]),_:1}),(0,i.bF)(d,{label:"list"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.permList")),1)]),_:1}),(0,i.bF)(d,{label:"manage"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.permManage")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.neverExpire")},{default:(0,i.k6)(()=>[(0,i.bF)(x,{modelValue:o.newToken.neverExpire,"onUpdate:modelValue":e[22]||(e[22]=t=>o.newToken.neverExpire=t),onChange:l.onCreateNeverExpireChange},null,8,["modelValue","onChange"])]),_:1},8,["label"]),o.newToken.neverExpire?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.Wv)(c,{key:0,label:t.$t("sysSecurity.validPeriod"),prop:"expirationValue"},{default:(0,i.k6)(()=>[(0,i.Lk)("div",ug,[(0,i.bF)(S,{modelValue:o.newToken.expirationValue,"onUpdate:modelValue":e[23]||(e[23]=t=>o.newToken.expirationValue=t),min:1,step:1,"controls-position":"right",style:{flex:"1"}},null,8,["modelValue"]),(0,i.bF)(k,{modelValue:o.newToken.expirationUnit,"onUpdate:modelValue":e[24]||(e[24]=t=>o.newToken.expirationUnit=t),style:{width:"100px"}},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(o.timeUnitOptions,e=>((0,i.uX)(),(0,i.Wv)(_,{key:e.value,label:t.$t(e.labelKey),value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])]),_:1},8,["label"])),o.newToken.neverExpire?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.Wv)(c,{key:1,label:t.$t("sysSecurity.autoDeleteOnExpire")},{default:(0,i.k6)(()=>[(0,i.bF)(x,{modelValue:o.newToken.autoDelete,"onUpdate:modelValue":e[25]||(e[25]=t=>o.newToken.autoDelete=t)},null,8,["modelValue"])]),_:1},8,["label"]))]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title","width"]),(0,i.bF)(P,{modelValue:o.showEditTokenDialog,"onUpdate:modelValue":e[35]||(e[35]=t=>o.showEditTokenDialog=t),title:t.$t("sysSecurity.editTokenTitle"),width:l.dialogWidth},{footer:(0,i.k6)(()=>[(0,i.Lk)("span",fg,[(0,i.bF)(p,{onClick:e[34]||(e[34]=t=>o.showEditTokenDialog=!1)},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("common.cancel")),1)]),_:1}),(0,i.bF)(p,{type:"primary",onClick:l.updateToken},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.updateBtn")),1)]),_:1},8,["onClick"])])]),default:(0,i.k6)(()=>[(0,i.bF)(h,{model:o.editingToken,rules:l.editTokenRules,ref:"editTokenForm","label-width":"100px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,{label:t.$t("sysSecurity.tokenNameLabel")},{default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.editingToken.name,"onUpdate:modelValue":e[28]||(e[28]=t=>o.editingToken.name=t),disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.permissionsLabel"),prop:"permissions"},{default:(0,i.k6)(()=>[(0,i.bF)(T,{modelValue:o.editingToken.permissions,"onUpdate:modelValue":e[29]||(e[29]=t=>o.editingToken.permissions=t)},{default:(0,i.k6)(()=>[(0,i.bF)(d,{label:"upload"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.permUpload")),1)]),_:1}),(0,i.bF)(d,{label:"delete"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.permDelete")),1)]),_:1}),(0,i.bF)(d,{label:"list"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.permList")),1)]),_:1}),(0,i.bF)(d,{label:"manage"},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.permManage")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.neverExpire")},{default:(0,i.k6)(()=>[(0,i.bF)(x,{modelValue:o.editingToken.neverExpire,"onUpdate:modelValue":e[30]||(e[30]=t=>o.editingToken.neverExpire=t),onChange:l.onEditNeverExpireChange},null,8,["modelValue","onChange"])]),_:1},8,["label"]),o.editingToken.neverExpire?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.Wv)(c,{key:0,label:t.$t("sysSecurity.validPeriod"),prop:"expirationValue"},{default:(0,i.k6)(()=>[(0,i.Lk)("div",gg,[(0,i.bF)(S,{modelValue:o.editingToken.expirationValue,"onUpdate:modelValue":e[31]||(e[31]=t=>o.editingToken.expirationValue=t),min:1,step:1,"controls-position":"right",style:{flex:"1"}},null,8,["modelValue"]),(0,i.bF)(k,{modelValue:o.editingToken.expirationUnit,"onUpdate:modelValue":e[32]||(e[32]=t=>o.editingToken.expirationUnit=t),style:{width:"100px"}},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(o.timeUnitOptions,e=>((0,i.uX)(),(0,i.Wv)(_,{key:e.value,label:t.$t(e.labelKey),value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])]),_:1},8,["label"])),o.editingToken.neverExpire?(0,i.Q3)("",!0):((0,i.uX)(),(0,i.Wv)(c,{key:1,label:t.$t("sysSecurity.autoDeleteOnExpire")},{default:(0,i.k6)(()=>[(0,i.bF)(x,{modelValue:o.editingToken.autoDelete,"onUpdate:modelValue":e[33]||(e[33]=t=>o.editingToken.autoDelete=t)},null,8,["modelValue"])]),_:1},8,["label"]))]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title","width"]),(0,i.bF)(P,{modelValue:o.showTokenResultDialog,"onUpdate:modelValue":e[38]||(e[38]=t=>o.showTokenResultDialog=t),title:t.$t("sysSecurity.tokenCreatedTitle"),width:l.dialogWidth},{footer:(0,i.k6)(()=>[(0,i.Lk)("span",yg,[(0,i.bF)(p,{type:"primary",onClick:e[37]||(e[37]=t=>o.showTokenResultDialog=!1)},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.savedBtn")),1)]),_:1})])]),default:(0,i.k6)(()=>[(0,i.Lk)("div",mg,[(0,i.Lk)("p",bg,[(0,i.bF)(u,{icon:"exclamation-triangle",style:{"margin-right":"5px"}}),(0,i.eW)(" "+(0,n.v_)(t.$t("sysSecurity.tokenCreatedWarning")),1)]),(0,i.bF)(h,{"label-width":"100px"},{default:(0,i.k6)(()=>[(0,i.bF)(c,{label:t.$t("sysSecurity.tokenNameLabel")},{default:(0,i.k6)(()=>[(0,i.Lk)("span",null,(0,n.v_)(o.createdToken.name),1)]),_:1},8,["label"]),(0,i.bF)(c,{label:t.$t("sysSecurity.fullToken")},{default:(0,i.k6)(()=>[(0,i.bF)(r,{modelValue:o.createdToken.token,"onUpdate:modelValue":e[36]||(e[36]=t=>o.createdToken.token=t),readonly:""},{append:(0,i.k6)(()=>[(0,i.bF)(p,{onClick:l.copyToken},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysSecurity.copyBtn")),1)]),_:1},8,["onClick"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["modelValue","title","width"])])),[[M,o.loading]])}s(81148);const vg={s:1e3,m:6e4,h:36e5,d:864e5};function _g(t,e,s){if(!Number.isFinite(e)||e<=0)throw new Error("有效期数值必须大于 0");const i="string"===typeof t?new Date(t):new Date(t.getTime());if(vg[s])return new Date(i.getTime()+e*vg[s]).toISOString();if("M"===s)return i.setUTCMonth(i.getUTCMonth()+e),i.toISOString();if("Y"===s)return i.setUTCFullYear(i.getUTCFullYear()+e),i.toISOString();throw new Error(`无效的时间单位: ${s}`)}function kg(t){const e=new Date(t),s=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0"),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return`${s}-${i}-${n} ${a}:${o}:${l}`}function wg(t,e=new Date){if(null===t||void 0===t)return{status:"active",label:"有效",expiresText:"永不过期"};const s=new Date(t),i=e instanceof Date?e:new Date(e),n=kg(t);return i.getTime()>s.getTime()?{status:"expired",label:"已过期",expiresText:n}:{status:"active",label:"有效",expiresText:n}}var Cg={components:{FloatingSaveButton:Vp},data(){return{authSettings:{user:{},admin:{}},uploadSettings:{moderate:{},ipQuery:{enabled:!1,channel:"customApi",customApi:{url:"",params:[{key:"ip",value:"{ip}"}],responseFields:[]}}},accessSettings:{},apiTokens:[],loading:!0,tokenLoading:!1,oriUserPassword:"",oriAdminPassword:"",showUserPassConfirm:!1,showAdminPassConfirm:!1,clearUserPassword:!1,clearAdminPassword:!1,showCreateTokenDialog:!1,showEditTokenDialog:!1,showTokenResultDialog:!1,timeUnitOptions:[{labelKey:"sysSecurity.timeUnitSeconds",value:"s"},{labelKey:"sysSecurity.timeUnitMinutes",value:"m"},{labelKey:"sysSecurity.timeUnitHours",value:"h"},{labelKey:"sysSecurity.timeUnitDays",value:"d"},{labelKey:"sysSecurity.timeUnitMonths",value:"M"},{labelKey:"sysSecurity.timeUnitYears",value:"Y"}],newToken:{name:"",owner:"",permissions:[],neverExpire:!0,expirationValue:1,expirationUnit:"d",autoDelete:!1},editingToken:{id:"",name:"",owner:"",permissions:[],neverExpire:!0,expirationValue:1,expirationUnit:"d",autoDelete:!1},createdToken:{name:"",token:""}}},computed:{dialogWidth(){return window.innerWidth>768?"50%":"90%"},userPassRules(){return{authCode:[{validator:(t,e,s)=>{const i=["%","&","?","#","/"],n=i.some(t=>e&&e.includes(t));n?s(new Error(this.$t("sysSecurity.passwordUrlReserved"))):s()},trigger:"blur"}],confirmNewUserPassword:[{validator:(t,e,s)=>{e?e!==this.authSettings.user.authCode?s(new Error(this.$t("sysSecurity.passwordMismatch"))):s():s(new Error(this.$t("sysSecurity.confirmUploadPassword")))},trigger:"blur"}]}},adminPassRules(){return{confirmNewAdminPassword:[{validator:(t,e,s)=>{e?e!==this.authSettings.admin.adminPassword?s(new Error(this.$t("sysSecurity.passwordMismatch"))):s():s(new Error(this.$t("sysSecurity.confirmAdminPassword")))},trigger:"blur"}]}},accessRules(){const t=(t,e,s)=>{!Number.isInteger(e)||e<1||e>3650?s(new Error(this.$t("sysSecurity.sessionMaxAgeInvalid"))):s()};return{userSessionMaxAge:[{validator:t,trigger:"change"}],adminSessionMaxAge:[{validator:t,trigger:"change"}]}},tokenRules(){return{name:[{required:!0,message:this.$t("sysSecurity.tokenNameRequired"),trigger:"blur"}],permissions:[{required:!0,message:this.$t("sysSecurity.permissionsRequired"),trigger:"change"}],expirationValue:[{validator:(t,e,s)=>{this.newToken.neverExpire||e&&!(e<=0)?s():s(new Error(this.$t("sysSecurity.validPeriodRequired")))},trigger:"blur"}]}},editTokenRules(){return{permissions:[{required:!0,message:this.$t("sysSecurity.permissionsRequired"),trigger:"change"}],expirationValue:[{validator:(t,e,s)=>{this.editingToken.neverExpire||e&&!(e<=0)?s():s(new Error(this.$t("sysSecurity.validPeriodRequired")))},trigger:"blur"}]}}},methods:{normalizeIpQuerySettings(t={}){const e=t.ipQuery||{},s=e.customApi||{},i=Array.isArray(s.params)&&s.params.length>0?s.params.map(t=>({key:t?.key||"",value:t?.value||""})):[{key:"ip",value:"{ip}"}],n=Array.isArray(s.responseFields)?s.responseFields.map(t=>"string"===typeof t?t:t?.path||""):[];return{...t,moderate:t.moderate||{},ipQuery:{enabled:e.enabled??!1,channel:e.channel||"customApi",customApi:{url:s.url||"",params:i,responseFields:n}}}},addIpQueryParam(){this.uploadSettings.ipQuery.customApi.params.push({key:"",value:""})},removeIpQueryParam(t){this.uploadSettings.ipQuery.customApi.params.length<=1||this.uploadSettings.ipQuery.customApi.params.splice(t,1)},addIpQueryResponseField(){this.uploadSettings.ipQuery.customApi.responseFields.push("")},removeIpQueryResponseField(t){this.uploadSettings.ipQuery.customApi.responseFields.splice(t,1)},moveIpQueryResponseField(t,e){const s=this.uploadSettings.ipQuery.customApi.responseFields,i=t+e;if(i<0||i>=s.length)return;const[n]=s.splice(t,1);s.splice(i,0,n)},handleUserPassInput(){this.authSettings.user.authCode!==this.oriUserPassword?this.showUserPassConfirm=!0:this.showUserPassConfirm=!1},handleAdminPassInput(){this.authSettings.admin.adminPassword!==this.oriAdminPassword?this.showAdminPassConfirm=!0:this.showAdminPassConfirm=!1},handleClearUserPassword(t){t&&(this.authSettings.user.authCode="",this.showUserPassConfirm=!1)},handleClearAdminPassword(t){t&&(this.authSettings.admin.adminPassword="",this.authSettings.admin.adminUsername="",this.showAdminPassConfirm=!1)},getPermissionText(t){const e={upload:this.$t("sysSecurity.permUpload"),delete:this.$t("sysSecurity.permDelete"),list:this.$t("sysSecurity.permList"),manage:this.$t("sysSecurity.permManage")};return e[t]||t},formatDate(t){return new Date(t).toLocaleString("zh-CN")},async loadApiTokens(){this.tokenLoading=!0;try{const t=await(0,Pe.A)("/api/manage/apiTokens"),e=await t.json();this.apiTokens=e.tokens||[]}catch(t){this.$message.error(this.$t("sysSecurity.tokenListFailed"))}finally{this.tokenLoading=!1}},createToken(){this.$refs.tokenForm.validate(async t=>{if(t)try{this.newToken.owner="admin";let t=null,e=!1;this.newToken.neverExpire||(t=_g(new Date,this.newToken.expirationValue,this.newToken.expirationUnit),e=this.newToken.autoDelete);const s=await(0,Pe.A)("/api/manage/apiTokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:this.newToken.name,owner:this.newToken.owner,permissions:this.newToken.permissions,expiresAt:t,autoDelete:e})}),i=await s.json();s.ok?(this.createdToken={name:i.name,token:i.token},this.showCreateTokenDialog=!1,this.showTokenResultDialog=!0,this.newToken={name:"",owner:"",permissions:[],neverExpire:!0,expirationValue:1,expirationUnit:"d",autoDelete:!1},await this.loadApiTokens(),this.$message.success(this.$t("sysSecurity.tokenCreateSuccess"))):this.$message.error(i.error||this.$t("sysSecurity.tokenCreateFailed"))}catch(e){this.$message.error(this.$t("sysSecurity.tokenCreateFailed"))}})},editToken(t){const e=null!==t.expiresAt&&void 0!==t.expiresAt;this.editingToken={id:t.id,name:t.name,owner:t.owner,permissions:[...t.permissions],neverExpire:!e,expirationValue:1,expirationUnit:"d",autoDelete:t.autoDelete||!1},this.showEditTokenDialog=!0},updateToken(){this.$refs.editTokenForm.validate(async t=>{if(t)try{let t=null,e=!1;this.editingToken.neverExpire||(t=_g(new Date,this.editingToken.expirationValue,this.editingToken.expirationUnit),e=this.editingToken.autoDelete);const s=await(0,Pe.A)("/api/manage/apiTokens",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tokenId:this.editingToken.id,permissions:this.editingToken.permissions,expiresAt:t,autoDelete:e})}),i=await s.json();s.ok?(this.showEditTokenDialog=!1,await this.loadApiTokens(),this.$message.success(this.$t("sysSecurity.tokenUpdateSuccess"))):this.$message.error(i.error||this.$t("sysSecurity.tokenUpdateFailed"))}catch(e){this.$message.error(this.$t("sysSecurity.tokenUpdateFailed"))}})},async deleteToken(t){try{await this.$confirm(this.$t("sysSecurity.tokenDeleteConfirm"),this.$t("sysSecurity.tokenDeleteConfirmTitle"),{confirmButtonText:this.$t("sysSecurity.tokenDeleteConfirmOk"),cancelButtonText:this.$t("sysSecurity.tokenDeleteConfirmCancel"),type:"warning"});const e=await(0,Pe.A)(`/api/manage/apiTokens?id=${t}`,{method:"DELETE"}),s=await e.json();e.ok?(await this.loadApiTokens(),this.$message.success(this.$t("sysSecurity.tokenDeleteSuccess"))):this.$message.error(s.error||this.$t("sysSecurity.tokenDeleteFailed"))}catch(e){"cancel"!==e&&this.$message.error(this.$t("sysSecurity.tokenDeleteFailed"))}},async copyToken(){try{await navigator.clipboard.writeText(this.createdToken.token),this.$message.success(this.$t("sysSecurity.tokenCopied"))}catch(t){this.$message.error(this.$t("sysSecurity.copyFailed"))}},onCreateNeverExpireChange(t){t&&(this.newToken.autoDelete=!1)},onEditNeverExpireChange(t){t&&(this.editingToken.autoDelete=!1)},getTokenStatus(t){return wg(t)},saveSettings(){let t=[];t.push(new Promise(t=>{this.$refs.userPassForm.validate(e=>{t(e)})})),t.push(new Promise(t=>{this.$refs.adminPassForm.validate(e=>{t(e)})})),t.push(new Promise(t=>{this.$refs.accessForm.validate(e=>{t(e)})})),Promise.all(t).then(t=>{const e=t.every(t=>t);if(!e)return;if(this.accessSettings.userSessionMaxAge<1||!Number.isInteger(this.accessSettings.userSessionMaxAge)||this.accessSettings.userSessionMaxAge>3650||this.accessSettings.adminSessionMaxAge<1||!Number.isInteger(this.accessSettings.adminSessionMaxAge)||this.accessSettings.adminSessionMaxAge>3650)return void this.$message.error(this.$t("sysSecurity.sessionMaxAgeInvalid"));const s={auth:this.authSettings,upload:this.uploadSettings,access:this.accessSettings};delete s.auth.user.confirmNewUserPassword,delete s.auth.admin.confirmNewAdminPassword,this.clearUserPassword&&(s.auth.user._clear=!0,s.auth.user.authCode=""),this.clearAdminPassword&&(s.auth.admin._clear=!0,s.auth.admin.adminPassword=""),(0,Pe.A)("/api/manage/sysConfig/security",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(t=>t.json()).then(t=>{if(t.adminPasswordChanged){const t=this.$t("sysSecurity.adminPasswordChangedRelogin");return this.$message.warning(t),void setTimeout(()=>{this.$store.commit("setAdminLoggedIn",!1),this.$router.push("/adminLogin")},1500)}this.$message.success(this.$t("sysSecurity.settingsSaved")),this.authSettings.user.authCode="",this.authSettings.admin.adminPassword="",this.oriUserPassword="",this.oriAdminPassword="",s.auth.user.authCode&&!s.auth.user._clear?this.authSettings.user._hasPassword=!0:s.auth.user._clear&&(this.authSettings.user._hasPassword=!1),s.auth.admin.adminPassword&&!s.auth.admin._clear?this.authSettings.admin._hasPassword=!0:s.auth.admin._clear&&(this.authSettings.admin._hasPassword=!1),this.showUserPassConfirm=!1,this.showAdminPassConfirm=!1,this.clearUserPassword=!1,this.clearAdminPassword=!1}).catch(()=>{})})}},mounted(){this.loading=!0,(0,Pe.A)("/api/manage/sysConfig/security").then(t=>t.json()).then(t=>{this.authSettings=t.auth,this.uploadSettings=this.normalizeIpQuerySettings(t.upload),this.accessSettings=t.access,this.oriUserPassword="",this.oriAdminPassword="",this.authSettings.user.confirmNewUserPassword="",this.authSettings.admin.confirmNewAdminPassword="",this.loadApiTokens()}).finally(()=>{this.loading=!1})}};const Sg=(0,c.A)(Cg,[["render",xg],["__scopeId","data-v-906380e0"]]);var Fg=Sg;const Tg={class:"page-settings"},Pg={class:"first-title"},Mg={key:5,class:"announcement-refresh-option"};function Dg(t,e,s,a,o,l){const r=(0,i.g2)("font-awesome-icon"),d=g.R7,c=Cu.P9,h=Cu.AV,u=Su.qi,p=wu.WK,f=Pp.dI,m=_u.xE,b=_u.US,y=Vp,x=v.A;return(0,i.bo)(((0,i.uX)(),(0,i.CE)("div",Tg,[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(l.groupedSettings,(s,a)=>((0,i.uX)(),(0,i.CE)("div",{key:a,class:"first-settings"},[(0,i.Lk)("h3",Pg,(0,n.v_)(a),1),(0,i.bF)(b,{model:o.settings,"label-width":"150px"},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(s,(s,a)=>((0,i.uX)(),(0,i.Wv)(m,{key:s.id},{label:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(l.localized(s,"label"))+" ",1),s.tooltip?((0,i.uX)(),(0,i.Wv)(d,{key:0,content:l.localized(s,"tooltip"),placement:"top","raw-content":""},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])):(0,i.Q3)("",!0)]),default:(0,i.k6)(()=>["select"===s.type?((0,i.uX)(),(0,i.Wv)(h,{key:0,modelValue:s.value,"onUpdate:modelValue":t=>s.value=t,disabled:s.fixed,placeholder:l.localized(s,"placeholder"),style:{width:"100%"}},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(s.options,t=>((0,i.uX)(),(0,i.Wv)(c,{key:t.value,label:l.localizedOption(t),value:t.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","placeholder"])):"channelName"===s.type?((0,i.uX)(),(0,i.Wv)(h,{key:1,modelValue:s.value,"onUpdate:modelValue":t=>s.value=t,disabled:!l.currentUploadChannel||0===l.currentChannelList.length,placeholder:t.$t("sysPage.channelSelectPlaceholder"),clearable:"",style:{width:"100%"}},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(l.currentChannelList,t=>((0,i.uX)(),(0,i.Wv)(c,{key:t.name,label:t.name,value:t.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):"boolean"===s.type?((0,i.uX)(),(0,i.Wv)(u,{key:2,modelValue:s.value,"onUpdate:modelValue":t=>s.value=t,disabled:s.fixed},null,8,["modelValue","onUpdate:modelValue","disabled"])):"textarea"===s.type?((0,i.uX)(),(0,i.Wv)(p,{key:3,modelValue:s.value,"onUpdate:modelValue":t=>s.value=t,type:"textarea",autosize:{minRows:2},resize:"vertical",disabled:s.fixed,placeholder:l.localized(s,"placeholder")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):((0,i.uX)(),(0,i.Wv)(p,{key:4,modelValue:s.value,"onUpdate:modelValue":t=>s.value=t,disabled:s.fixed,placeholder:l.localized(s,"placeholder")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])),"announcement"===s.id?((0,i.uX)(),(0,i.CE)("div",Mg,[(0,i.bF)(f,{modelValue:o.refreshAnnouncement,"onUpdate:modelValue":e[0]||(e[0]=t=>o.refreshAnnouncement=t)},{default:(0,i.k6)(()=>[(0,i.eW)((0,n.v_)(t.$t("sysPage.refreshAnnouncement")),1)]),_:1},8,["modelValue"])])):(0,i.Q3)("",!0)]),_:2},1024))),128))]),_:2},1032,["model"])]))),128)),(0,i.bF)(y,{show:!o.loading,onClick:l.saveSettings},null,8,["show","onClick"])])),[[x,o.loading]])}var Ag=s(457),$g={components:{FloatingSaveButton:Vp},data(){return{settings:{config:[]},loading:!0,refreshAnnouncement:!1,availableChannels:{}}},computed:{isEn(){return"en"===this.$i18n.locale},groupedSettings(){const t={};return this.settings.config&&this.settings.config.forEach(e=>{const s=this.isEn?e.category_en||e.category||this.$t("sysPage.otherSettings"):e.category||this.$t("sysPage.otherSettings");t[s]||(t[s]=[]),t[s].push(e)}),t},currentUploadChannel(){const t=this.settings.config?.find(t=>"defaultUploadChannel"===t.id);return t?.value||""},currentChannelList(){return this.availableChannels[this.currentUploadChannel]||[]}},watch:{currentUploadChannel(t,e){if(t!==e){const e=this.settings.config?.find(t=>"defaultChannelName"===t.id);if(e){const s=this.availableChannels[t]||[];s.some(t=>t.name===e.value)||(e.value="")}}}},methods:{localized(t,e){return this.isEn&&t[e+"_en"]?t[e+"_en"]:t[e]||""},localizedOption(t){return this.isEn&&t.label_en?t.label_en:t.label},saveSettings(){(0,Pe.A)("/api/manage/sysConfig/page",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.settings,refreshAnnouncement:this.refreshAnnouncement})}).then(()=>{this.refreshAnnouncement=!1,this.$message.success(this.$t("sysPage.settingsSaved"))})},async fetchAvailableChannels(){try{const t=await Ag.A.get("/api/channels");t.data&&(this.availableChannels=t.data)}catch(t){console.error("Failed to fetch available channels:",t)}}},mounted(){this.loading=!0,this.fetchAvailableChannels(),(0,Pe.A)("/api/manage/sysConfig/page").then(t=>t.json()).then(t=>{this.settings=t,this.settings.config&&this.settings.config.forEach(t=>{"boolean"===t.type&&("string"===typeof t.value?t.value="true"===t.value:void 0!==t.value&&null!==t.value||(t.value=t.default||!1))})}).finally(()=>{this.loading=!1})}};const Vg=(0,c.A)($g,[["render",Dg],["__scopeId","data-v-01b71420"]]);var Lg=Vg;const Eg={class:"others-settings"},Ig={class:"first-settings"},Ug={class:"first-title"},Og={class:"first-title"},Rg={class:"first-title"},Wg={class:"first-title"},Bg=["innerHTML"],Ng={class:"first-title"};function zg(t,e,s,a,o,l){const r=(0,i.g2)("font-awesome-icon"),d=g.R7,c=Su.qi,h=_u.xE,u=_u.US,p=wu.WK,f=Cu.P9,m=Cu.AV,b=Vp,y=v.A;return(0,i.bo)(((0,i.uX)(),(0,i.CE)("div",Eg,[(0,i.Lk)("div",Ig,[(0,i.Lk)("h3",Ug,[(0,i.eW)((0,n.v_)(t.$t("sysOthers.remoteTelemetry"))+" ",1),(0,i.bF)(d,{content:t.$t("sysOthers.remoteTelemetryTooltip"),placement:"right"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,i.bF)(u,{model:o.settings.telemetry,"label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(h,{label:t.$t("sysOthers.enable")},{default:(0,i.k6)(()=>[(0,i.bF)(c,{modelValue:o.settings.telemetry.enabled,"onUpdate:modelValue":e[0]||(e[0]=t=>o.settings.telemetry.enabled=t),disabled:o.settings.telemetry.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"])]),_:1},8,["model"]),(0,i.Lk)("h3",Og,[(0,i.eW)((0,n.v_)(t.$t("sysOthers.cloudflareApiToken"))+" ",1),(0,i.bF)(d,{content:t.$t("sysOthers.cloudflareApiTokenTooltip"),placement:"right","raw-content":""},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,i.bF)(u,{model:o.settings.cloudflareApiToken,"label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(h,{label:t.$t("sysOthers.zoneId")},{default:(0,i.k6)(()=>[(0,i.bF)(p,{modelValue:o.settings.cloudflareApiToken.CF_ZONE_ID,"onUpdate:modelValue":e[1]||(e[1]=t=>o.settings.cloudflareApiToken.CF_ZONE_ID=t),disabled:o.settings.cloudflareApiToken.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(h,{label:t.$t("sysOthers.accountEmail")},{default:(0,i.k6)(()=>[(0,i.bF)(p,{modelValue:o.settings.cloudflareApiToken.CF_EMAIL,"onUpdate:modelValue":e[2]||(e[2]=t=>o.settings.cloudflareApiToken.CF_EMAIL=t),disabled:o.settings.cloudflareApiToken.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(h,{label:"API Key"},{default:(0,i.k6)(()=>[(0,i.bF)(p,{modelValue:o.settings.cloudflareApiToken.CF_API_KEY,"onUpdate:modelValue":e[3]||(e[3]=t=>o.settings.cloudflareApiToken.CF_API_KEY=t),disabled:o.settings.cloudflareApiToken.fixed,type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,i.Lk)("h3",Rg,[(0,i.eW)((0,n.v_)(t.$t("sysOthers.randomImageApi"))+" ",1),(0,i.bF)(d,{content:t.$t("sysOthers.randomImageApiTooltip"),placement:"right"},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,i.bF)(u,{model:o.settings.randomImageAPI,"label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(h,{label:t.$t("sysOthers.enable")},{default:(0,i.k6)(()=>[(0,i.bF)(c,{modelValue:o.settings.randomImageAPI.enabled,"onUpdate:modelValue":e[4]||(e[4]=t=>o.settings.randomImageAPI.enabled=t),disabled:o.settings.randomImageAPI.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(h,{prop:"randomImageAPI.allowedDir"},{label:(0,i.k6)(()=>[(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysOthers.directory")),1),(0,i.bF)(d,{content:t.$t("sysOthers.directoryTooltip"),placement:"right","raw-content":""},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),default:(0,i.k6)(()=>[(0,i.bF)(p,{modelValue:o.settings.randomImageAPI.allowedDir,"onUpdate:modelValue":e[5]||(e[5]=t=>o.settings.randomImageAPI.allowedDir=t),disabled:o.settings.randomImageAPI.fixed},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,i.Lk)("h3",Wg,[(0,i.eW)((0,n.v_)(t.$t("sysOthers.publicBrowse"))+" ",1),(0,i.bF)(d,{content:t.$t("sysOthers.publicBrowseTooltip"),placement:"right","raw-content":""},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,i.bF)(u,{model:o.settings.publicBrowse,"label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(h,{label:t.$t("sysOthers.enable")},{default:(0,i.k6)(()=>[(0,i.bF)(c,{modelValue:o.settings.publicBrowse.enabled,"onUpdate:modelValue":e[6]||(e[6]=t=>o.settings.publicBrowse.enabled=t),disabled:o.settings.publicBrowse.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(h,{prop:"publicBrowse.allowedDir"},{label:(0,i.k6)(()=>[(0,i.Lk)("span",null,(0,n.v_)(t.$t("sysOthers.openDirectory")),1),(0,i.bF)(d,{placement:"right","raw-content":""},{content:(0,i.k6)(()=>[(0,i.Lk)("div",{style:{"max-width":"320px","line-height":"1.6"},innerHTML:t.$t("sysOthers.openDirectoryTooltip")},null,8,Bg)]),default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1})]),default:(0,i.k6)(()=>[(0,i.bF)(p,{modelValue:o.settings.publicBrowse.allowedDir,"onUpdate:modelValue":e[7]||(e[7]=t=>o.settings.publicBrowse.allowedDir=t),disabled:o.settings.publicBrowse.fixed,placeholder:"wallpaper,photos,album"},null,8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"]),(0,i.Lk)("h3",Ng,[(0,i.eW)((0,n.v_)(t.$t("sysOthers.webdav"))+" ",1),(0,i.bF)(d,{content:t.$t("sysOthers.webdavTooltip"),placement:"right","raw-content":""},{default:(0,i.k6)(()=>[(0,i.bF)(r,{icon:"question-circle",style:{"margin-left":"5px",cursor:"pointer"}})]),_:1},8,["content"])]),(0,i.bF)(u,{model:o.settings.webDAV,"label-width":"120px"},{default:(0,i.k6)(()=>[(0,i.bF)(h,{label:t.$t("sysOthers.enable")},{default:(0,i.k6)(()=>[(0,i.bF)(c,{modelValue:o.settings.webDAV.enabled,"onUpdate:modelValue":e[8]||(e[8]=t=>o.settings.webDAV.enabled=t),disabled:o.settings.webDAV.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(h,{label:t.$t("sysOthers.webdavUsername")},{default:(0,i.k6)(()=>[(0,i.bF)(p,{modelValue:o.settings.webDAV.username,"onUpdate:modelValue":e[9]||(e[9]=t=>o.settings.webDAV.username=t),disabled:o.settings.webDAV.fixed},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(h,{label:t.$t("sysOthers.webdavPassword")},{default:(0,i.k6)(()=>[(0,i.bF)(p,{modelValue:o.settings.webDAV.password,"onUpdate:modelValue":e[10]||(e[10]=t=>o.settings.webDAV.password=t),disabled:o.settings.webDAV.fixed,type:"password","show-password":"",autocomplete:"new-password"},null,8,["modelValue","disabled"])]),_:1},8,["label"]),(0,i.bF)(h,{label:t.$t("sysOthers.webdavUploadChannel")},{default:(0,i.k6)(()=>[(0,i.bF)(m,{modelValue:o.settings.webDAV.uploadChannel,"onUpdate:modelValue":e[11]||(e[11]=t=>o.settings.webDAV.uploadChannel=t),disabled:o.settings.webDAV.fixed,placeholder:t.$t("sysOthers.webdavDefaultChannel"),clearable:""},{default:(0,i.k6)(()=>[(0,i.bF)(f,{label:"Telegram",value:"telegram"}),(0,i.bF)(f,{label:"Cloudflare R2",value:"cfr2"}),(0,i.bF)(f,{label:"S3",value:"s3"}),(0,i.bF)(f,{label:"Discord",value:"discord"}),(0,i.bF)(f,{label:"HuggingFace",value:"huggingface"}),(0,i.bF)(f,{label:"WebDAV",value:"webdav"})]),_:1},8,["modelValue","disabled","placeholder"])]),_:1},8,["label"]),o.settings.webDAV.uploadChannel&&l.webdavChannelList.length>1?((0,i.uX)(),(0,i.Wv)(h,{key:0,label:t.$t("sysOthers.webdavChannelName")},{default:(0,i.k6)(()=>[(0,i.bF)(m,{modelValue:o.settings.webDAV.channelName,"onUpdate:modelValue":e[12]||(e[12]=t=>o.settings.webDAV.channelName=t),disabled:o.settings.webDAV.fixed,placeholder:t.$t("uploadSettings.autoSelect"),clearable:""},{default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(l.webdavChannelList,t=>((0,i.uX)(),(0,i.Wv)(f,{key:t.name,label:t.name,value:t.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled","placeholder"])]),_:1},8,["label"])):(0,i.Q3)("",!0)]),_:1},8,["model"])]),(0,i.bF)(b,{show:!o.loading,onClick:l.saveSettings},null,8,["show","onClick"])])),[[y,o.loading]])}var jg={components:{FloatingSaveButton:Vp},data(){return{settings:{telemetry:{},randomImageAPI:{},cloudflareApiToken:{},webDAV:{},publicBrowse:{}},availableChannels:{},loading:!0}},computed:{webdavChannelList(){const t=this.settings.webDAV?.uploadChannel;return t&&this.availableChannels[t]||[]}},watch:{"settings.webDAV.uploadChannel"(){this.settings.webDAV&&(this.settings.webDAV.channelName="")}},methods:{saveSettings(){(0,Pe.A)("/api/manage/sysConfig/others",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.settings)}).then(()=>this.$message.success(this.$t("sysOthers.settingsSaved")))},async fetchAvailableChannels(){try{const t=await(0,Pe.A)("/api/channels");t.ok&&(this.availableChannels=await t.json())}catch(t){console.error("Failed to fetch available channels:",t)}}},mounted(){this.loading=!0,(0,Pe.A)("/api/manage/sysConfig/others").then(t=>t.json()).then(t=>{this.settings=t}).finally(()=>{this.loading=!1}),this.fetchAvailableChannels()}};const qg=(0,c.A)(jg,[["render",zg],["__scopeId","data-v-67b1b002"]]);var Hg=qg,Xg=s(48903),Kg={name:"SystemConfig",mixins:[Xg.A],data(){return{activeIndex:"status",isSidebarCollapse:!1}},watch:{"$route.hash":{immediate:!0,handler(t){this.activeIndex=t.replace("#",""),window.scrollTo(0,0)}},activeIndex(t){const e=`#${t}`;this.$router.push({hash:e})}},components:{DashboardTabs:f.A,SysConfigTabs:u,SysCogStatus:xu,SysCogUpload:Tp,SysCogSecurity:Fg,SysCogPage:Lg,SysCogOthers:Hg},computed:{disableTooltip(){return window.innerWidth<768},currentComponent(){const t=this.$route.hash.replace("#","");switch(t){case"status":return xu;case"upload":return Tp;case"security":return Fg;case"page":return Lg;case"others":return Hg;default:return xu}}},methods:{handleLogout(){const t="/api/auth/logout";fetch(t,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({authType:"admin"})}).finally(()=>{this.$store.commit("setAdminLoggedIn",!1),this.$router.push("/adminLogin")})},setDefaultHash(){const t="#status";window.location.hash=t,this.activeIndex=t.replace("#","")}},mounted(){this.initializeBackground("adminBkImg",".container",!1,!0),window.location.hash||this.setDefaultHash()}};const Qg=(0,c.A)(Kg,[["render",x],["__scopeId","data-v-ad570976"]]);var Yg=Qg},15616:function(t,e,s){s(85331),s(97197)},34396:function(t,e,s){s(85331),s(4885)},49187:function(t,e,s){s(85331),s(38736)},50333:function(t,e,s){s(85331),s(29092)},53676:function(t,e,s){s.d(e,{A:function(){return h}});var i=s(56768);const n={key:0,class:"channel-svg-icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},a={key:1,class:"channel-svg-icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},o={key:2,class:"channel-svg-icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function l(t,e,s,l,r,d){const c=(0,i.g2)("font-awesome-icon");return(0,i.uX)(),(0,i.CE)("span",(0,i.v6)(t.$attrs,{class:"channel-icon-wrapper"}),["telegram"===s.type?((0,i.uX)(),(0,i.CE)("svg",n,[...e[0]||(e[0]=[(0,i.Lk)("path",{d:"M417.28 795.733333 429.226667 615.253333 756.906667 320C771.413333 306.773333 753.92 300.373333 734.72 311.893333L330.24 567.466667 155.306667 512C117.76 501.333333 117.333333 475.306667 163.84 456.533333L845.226667 193.706667C876.373333 179.626667 906.24 201.386667 894.293333 249.173333L778.24 795.733333C770.133333 834.56 746.666667 843.946667 714.24 826.026667L537.6 695.466667 452.693333 777.813333C442.88 787.626667 434.773333 795.733333 417.28 795.733333Z"},null,-1)])])):"huggingface"===s.type?((0,i.uX)(),(0,i.CE)("svg",a,[...e[1]||(e[1]=[(0,i.Fv)('',9)])])):"webdav"===s.type?((0,i.uX)(),(0,i.CE)("svg",o,[...e[2]||(e[2]=[(0,i.Lk)("path",{d:"M446.293333 810.666667C384 898.986667 262.4 921.173333 174.506667 859.733333c-87.466667-61.44-107.946667-183.893333-46.506667-273.066666a195.626667 195.626667 0 0 1 152.746667-84.48l2.133333 61.013333c-38.826667 2.986667-76.373333 23.04-100.693333 58.026667-42.666667 61.44-29.44 144.213333 29.013333 185.6 58.88 40.96 141.226667 25.173333 183.893333-35.84 13.226667-19.2 20.906667-40.106667 23.893334-61.44v-43.093334l238.08-1.706666 2.986666-4.693334c22.613333-39.253333 71.68-52.906667 110.08-30.72a81.066667 81.066667 0 0 1 29.013334 110.933334c-22.613333 38.826667-72.106667 52.48-110.506667 30.293333-17.493333-9.813333-29.866667-25.6-35.413333-43.52l-173.653334 0.853333a211.626667 211.626667 0 0 1-33.28 82.773334m310.613334-304.64c107.946667 13.226667 184.746667 110.08 171.52 216.32-13.226667 106.666667-111.36 182.186667-219.306667 168.96a197.504 197.504 0 0 1-146.346667-94.293334l52.906667-30.72a137.386667 137.386667 0 0 0 98.986667 61.866667c74.666667 8.96 140.8-41.813333 149.76-113.066667 8.96-71.253333-43.946667-136.533333-117.76-145.493333-23.04-2.56-45.226667 0.426667-65.28 7.68l-36.266667 18.773333-110.08-203.52h-9.386667a81.322667 81.322667 0 0 1-78.933333-83.2c1.28-44.373333 39.68-78.933333 84.48-77.226666 44.8 2.56 80.213333 38.826667 78.933333 83.2-0.853333 18.773333-8.106667 35.84-19.626666 49.066666l81.066666 149.76c26.453333-8.533333 55.466667-11.52 85.333334-8.106666M352 389.973333c-42.666667-100.266667 2.56-215.04 101.12-256.853333 98.986667-41.813333 213.333333 5.546667 256 105.813333 25.173333 58.453333 20.053333 122.453333-8.533333 173.653334l-52.906667-30.72c17.92-34.56 20.906667-76.8 3.84-116.48-29.013333-68.266667-106.24-101.12-172.373333-73.386667-66.56 28.16-96.426667 106.666667-67.413334 174.933333 11.946667 28.16 32 49.92 56.32 64.426667l16.64 8.96-130.986666 212.906667c1.28 2.133333 2.986667 4.693333 4.266666 8.106666 20.906667 38.826667 6.4 87.893333-32.853333 108.8-38.826667 20.906667-87.893333 5.546667-109.226667-34.56-20.906667-39.68-6.4-88.746667 32.853334-109.653333 16.64-8.96 34.986667-11.093333 52.48-7.253333l98.56-160.853334c-20.053333-18.346667-37.12-41.386667-47.786667-67.84z"},null,-1)])])):((0,i.uX)(),(0,i.Wv)(c,{key:3,icon:d.fontAwesomeIcon},null,8,["icon"]))],16)}var r={name:"ChannelIcon",inheritAttrs:!1,props:{type:{type:String,required:!0}},computed:{fontAwesomeIcon(){const t={cfr2:["fab","cloudflare"],s3:["fab","aws"],discord:["fab","discord"]};return t[this.type]||"server"}}},d=s(71241);const c=(0,d.A)(r,[["render",l],["__scopeId","data-v-33933ada"]]);var h=c},63003:function(t,e,s){s(85331)},64752:function(t,e,s){s(85331),s(38736),s(18785)},70415:function(t,e,s){s(85331),s(73565)},73565:function(t,e,s){s(85331)},91114:function(t,e,s){function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function n(t,e){if("object"!=i(t)||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var n=s.call(t,e||"default");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function a(t){var e=n(t,"string");return"symbol"==i(e)?e:e+""}function o(t,e,s){return(e=a(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}s.d(e,{A:function(){return o}})},98642:function(t,e,s){s(85331)}}]); //# sourceMappingURL=535.1609e789.js.map