@acedatacloud/nexior 3.278.2 → 3.278.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ApiCodeButton-XRUnXYPg.js → ApiCodeButton-C1XeBPd6.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-BXl8-YSc.js → AskUserQuestionCard-oOnoGoYC.js} +1 -1
- package/dist/assets/{Auth-GGt1tbdq.js → Auth-C3GZzsqu.js} +1 -1
- package/dist/assets/{Bare-Dldg4ftu.js → Bare-ilkcpOfn.js} +1 -1
- package/dist/assets/{BotPlaceholder-CnFAaOE1.js → BotPlaceholder-C1UVVId0.js} +1 -1
- package/dist/assets/{BottomFooter-CznSE4Ty.js → BottomFooter-OYMNLKXj.js} +1 -1
- package/dist/assets/{Callback-DZRIOXTQ.js → Callback-DZWDH2Jd.js} +1 -1
- package/dist/assets/{Console-BHZeL6eH.js → Console-eAvlamaN.js} +1 -1
- package/dist/assets/{Consumption-D6r8XXTj.js → Consumption-DTpXXWzm.js} +1 -1
- package/dist/assets/{Conversation-CAnpAlxz.js → Conversation-CrkfOD7B.js} +1 -1
- package/dist/assets/{CopyToClipboard-C6tjXA6K.js → CopyToClipboard-CRnka5tK.js} +1 -1
- package/dist/assets/{Detail-Cw7eYYZt.js → Detail-FaCDRqcy.js} +2 -2
- package/dist/assets/{Extra-C7tg885x.js → Extra-Ca4VzqGk.js} +1 -1
- package/dist/assets/{FilePreview-DzUhQYAe.js → FilePreview-B-30mO9d.js} +1 -1
- package/dist/assets/{Hailuo-DfkZ-KvV.js → Hailuo-BgqAqO-q.js} +1 -1
- package/dist/assets/{History-C8m617CJ.js → History-BTV8BkyG.js} +1 -1
- package/dist/assets/{ImagePreview-Bh9k6FZ2.js → ImagePreview-DhCeZxCj.js} +1 -1
- package/dist/assets/{ImageWrapper-BoFMq92u.js → ImageWrapper-D2btRRAT.js} +1 -1
- package/dist/assets/{Index-WKC8mQYd.js → Index-83IdsREA.js} +1 -1
- package/dist/assets/{Index-BrUx1io1.js → Index-B-7PZA3P.js} +1 -1
- package/dist/assets/{Index-Eq0JKvWS.js → Index-B0rY6XyR.js} +1 -1
- package/dist/assets/{Index-BlXcIs17.js → Index-BA46FpHB.js} +1 -1
- package/dist/assets/{Index-h9wqDCyJ.js → Index-BCDRu724.js} +1 -1
- package/dist/assets/{Index-BNZ6iK8s.js → Index-BnVtmvSF.js} +1 -1
- package/dist/assets/{Index-Cc2-5WmB.js → Index-Bsro-2ns.js} +1 -1
- package/dist/assets/{Index-B8mjfJNx.js → Index-C-OYMJTV.js} +1 -1
- package/dist/assets/{Index-DXaHr9NY.js → Index-C0dMgZnO.js} +1 -1
- package/dist/assets/{Index-BeIuKnZs.js → Index-CEMGKfmo.js} +1 -1
- package/dist/assets/{Index-CM5FTb-D.js → Index-CVDt8ZY-.js} +1 -1
- package/dist/assets/{Index-B8Z5Id1W.js → Index-CaFkCgHI.js} +1 -1
- package/dist/assets/{Index-DUhxk_vy.js → Index-CfdAudvE.js} +1 -1
- package/dist/assets/{Index-BAKBk8mx.js → Index-D9wgOGcc.js} +1 -1
- package/dist/assets/{Index-JGFTH5E8.js → Index-DBM5oVyB.js} +1 -1
- package/dist/assets/{Index-CS70dgIx.js → Index-DDbrH674.js} +1 -1
- package/dist/assets/{Index-CjXm9jUL.js → Index-DQ65PFeh.js} +1 -1
- package/dist/assets/{Index-Cgly2-SK.js → Index-DSk0Kd_P.js} +1 -1
- package/dist/assets/{Index-AXUWCvHz.js → Index-DjDTSJh9.js} +1 -1
- package/dist/assets/{Index-KSssbVEB.js → Index-DncgncPd.js} +1 -1
- package/dist/assets/{Index-C2Opz8kF.js → Index-DzXFliY0.js} +1 -1
- package/dist/assets/{Index-BiIky916.js → Index-MeX7MVcf.js} +1 -1
- package/dist/assets/{Index-BNyjQqI5.js → Index-N2wA_CDH.js} +1 -1
- package/dist/assets/{Index-Zw3jy9a-.js → Index-W-S932Hw.js} +1 -1
- package/dist/assets/{Index-C7sPFES1.js → Index-ZUvgUU8o.js} +1 -1
- package/dist/assets/{Index-DeAYbbeT.js → Index-nGxC_UL9.js} +1 -1
- package/dist/assets/{Invitees-DsV_7MCA.js → Invitees-B2dp_P8M.js} +1 -1
- package/dist/assets/{List-CFLKV4J9.js → List-Bpj9MQXe.js} +1 -1
- package/dist/assets/{List-CE7R9OKB.js → List-C7cCl6VZ.js} +1 -1
- package/dist/assets/{List-DU7U4tme.js → List-DthXcxsV.js} +1 -1
- package/dist/assets/{Main-BAhX8GYq.js → Main-Dzcz3CQQ.js} +1 -1
- package/dist/assets/{Model-CQABuodX.js → Model-DTA7WYUi.js} +1 -1
- package/dist/assets/{Navigator-B688E2-B.js → Navigator-DKSj2Vas.js} +1 -1
- package/dist/assets/{NoTasks-e1BlGq0f.js → NoTasks-C1jixEiN.js} +1 -1
- package/dist/assets/{NotFound-CxH4Fu0s.js → NotFound-D5YnmbEB.js} +1 -1
- package/dist/assets/{Pagination-B2FW-sku.js → Pagination-BB0rDmAw.js} +1 -1
- package/dist/assets/{Pay-RIYyAaqF.js → Pay-DKBMI1b6.js} +1 -1
- package/dist/assets/{Player-Bjd8nCgN.js → Player-BImId-TA.js} +1 -1
- package/dist/assets/{Seedance-Deds0YV6.js → Seedance-LsGJ233H.js} +1 -1
- package/dist/assets/{Status-DiD0mkQo.js → Status-BgvktlpB.js} +1 -1
- package/dist/assets/{Subscribe-BqTWK6RR.js → Subscribe-DYGeuJIU.js} +1 -1
- package/dist/assets/{TabSwitcher-2S5QWcoY.js → TabSwitcher-DuAqLxUz.js} +1 -1
- package/dist/assets/{Tts-tMfixHQS.js → Tts-2qcW53B7.js} +1 -1
- package/dist/assets/{VideoPlayer-BTdx5mLj.js → VideoPlayer-gT-2rF-j.js} +1 -1
- package/dist/assets/{avatar-CQSomwZT.js → avatar-DLL1117G.js} +1 -1
- package/dist/assets/{basic-zlHwcq-X.js → basic-DBGdmFzO.js} +1 -1
- package/dist/assets/{chat-Cdy7mNX9.js → chat-Famr5Dh3.js} +1 -1
- package/dist/assets/{codingBridge-AMM5Yfms.js → codingBridge-C6-bnlhU.js} +1 -1
- package/dist/assets/{codingBridgeNotify-B5hMVYJw.js → codingBridgeNotify-CzOJWd-L.js} +2 -2
- package/dist/assets/{collapse-CTXiAD7g.js → collapse-Cdnq-zf7.js} +1 -1
- package/dist/assets/{createTaskActions-DSPMTgwo.js → createTaskActions-BUWJErGu.js} +1 -1
- package/dist/assets/{date-picker-DC_BNmdb.js → date-picker-DNzuis04.js} +1 -1
- package/dist/assets/{dropdown-BbYFfCs7.js → dropdown-5vgk-RLq.js} +1 -1
- package/dist/assets/{esm-DFkZ7F8J.js → esm-BDz3-BhM.js} +1 -1
- package/dist/assets/{esm-Bi2Uph8T.js → esm-BmxknlM2.js} +2 -2
- package/dist/assets/{esm-BZjRNmjy.js → esm-CRsYuFpi.js} +1 -1
- package/dist/assets/{esm-BN6hjMVy.js → esm-DFhLU1h5.js} +2 -2
- package/dist/assets/{esm-fXplvSmH.js → esm-DNm0jlst.js} +3 -3
- package/dist/assets/esm-DimqjTJx.js +1 -0
- package/dist/assets/{esm-EaF3dEQf.js → esm-yabqu3BG.js} +1 -1
- package/dist/assets/{fish-BAGR88C_.js → fish-dbdLrzWy.js} +1 -1
- package/dist/assets/{flux-BtYjsfYl.js → flux-DyviWvjE.js} +1 -1
- package/dist/assets/{grokvideo-CKv2BO_7.js → grokvideo-qrd6p2o2.js} +1 -1
- package/dist/assets/{hailuo-DG5mZklk.js → hailuo-DpxIOlpn.js} +1 -1
- package/dist/assets/{headshots-CAyCBYat.js → headshots-DJRZcUpJ.js} +1 -1
- package/dist/assets/{image-cvBtti-L.js → image-OB0St7Yu.js} +1 -1
- package/dist/assets/{index-CsXA6dkM.js → index-CTMytxLX.js} +15 -15
- package/dist/assets/{index.browser.esm-Dr_h5BxO.js → index.browser.esm-C3bG2KzK.js} +1 -1
- package/dist/assets/{index.es-D93UqOcB.js → index.es-DsMKNIuW.js} +1 -1
- package/dist/assets/{input-number-DDxc66zf.js → input-number-kZVB4fzD.js} +1 -1
- package/dist/assets/{kling-naYQud0S.js → kling-Bf1AxoJM.js} +1 -1
- package/dist/assets/{luma-CB_cImsU.js → luma-CsV4LQYT.js} +1 -1
- package/dist/assets/{midjourney-Ca7ErK8M.js → midjourney-CMW7Ux6b.js} +1 -1
- package/dist/assets/{nanobanana-C7D8RvvP.js → nanobanana-DnTNTtkq.js} +1 -1
- package/dist/assets/{openaiimage-UtglNb2q.js → openaiimage-CQN4Wul-.js} +1 -1
- package/dist/assets/{pagination-BpjwaQQS.css → pagination-C7kzirU-.css} +1 -1
- package/dist/assets/pagination-CMIlkvfz.js +282 -0
- package/dist/assets/{pika-yEgO6wXQ.js → pika-Bd75sd5k.js} +1 -1
- package/dist/assets/{pixverse-BWEADGsJ.js → pixverse-BpSWuW92.js} +1 -1
- package/dist/assets/{popover-2BS--0bq.js → popover-CeSAG69n.js} +1 -1
- package/dist/assets/{producer-D3D7ilyZ.js → producer-ITL9iATN.js} +1 -1
- package/dist/assets/{qrart-FZS22xqx.js → qrart-CfFMTejm.js} +1 -1
- package/dist/assets/{row-U3CmiTzy.js → row-Cq8mMRkw.js} +1 -1
- package/dist/assets/{seedance-Czqgd4WU.js → seedance-CcheKNrL.js} +1 -1
- package/dist/assets/{seedream-CE7FHFfX.js → seedream-B55ZlbhM.js} +1 -1
- package/dist/assets/{select-D_7T85Mp.js → select-CTfF5Pq0.js} +1 -1
- package/dist/assets/{serp-CwmIceQI.js → serp-DySJaJQH.js} +1 -1
- package/dist/assets/{slider-CFD5cZcS.js → slider-B5LGYuTq.js} +1 -1
- package/dist/assets/{solana-wallets-C91bEGYV.js → solana-wallets-CtntUGPc.js} +2 -2
- package/dist/assets/{solana-wallets-vue-oVdaAppb.js → solana-wallets-vue-Cy-TvgK3.js} +1 -1
- package/dist/assets/{sora-DUTFdxrW.js → sora--H2jRucL.js} +1 -1
- package/dist/assets/{suno-Ca91dgYy.js → suno-CgkMICe_.js} +1 -1
- package/dist/assets/{switch-Cexn2Stk.js → switch-B2HtIflI.js} +1 -1
- package/dist/assets/{tabs-BWSaSKf3.js → tabs-D-lB-wXk.js} +1 -1
- package/dist/assets/{upload--zrGs1_t.js → upload-PztQKfjm.js} +1 -1
- package/dist/assets/{veo-BWaUVwgY.js → veo-rkeTUbPb.js} +1 -1
- package/dist/assets/{wan-CyCmG8VS.js → wan-xIj-uREq.js} +1 -1
- package/dist/assets/{web-CZjmcTh9.js → web-0yhFotq-.js} +1 -1
- package/dist/assets/{web-Jginljwu.js → web-BbKwlQEJ.js} +1 -1
- package/dist/assets/{web-BU-O2Ttu.js → web-BwhUYrDl.js} +1 -1
- package/dist/assets/{web-C4MShhV0.js → web-Cn1Ev3Rd.js} +1 -1
- package/dist/assets/{web-BWX-AogE.js → web-DE99siCh.js} +1 -1
- package/dist/assets/{webextrator-CgRsPmSN.js → webextrator-BCG-VK2I.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/esm-9yhkXqn2.js +0 -1
- package/dist/assets/pagination-BqDYLukW.js +0 -292
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Wt as c,Z as l,a as u,c as d,dt as f,i as ee,k as p,n as m,nt as h,o as g,r as _,s as v,t as y,tt as b,ut as x,v as S}from"./vendor-chart-BJCvKk8-.js";import{t as C}from"./button-DfsQodL-.js";import{r as w,t as T}from"./select-D_7T85Mp.js";import{n as E,t as D}from"./table-lRQt4LGt.js";import{n as O,t as k}from"./tabs-BWSaSKf3.js";import{t as A}from"./date-picker-DC_BNmdb.js";import{t as j}from"./card-DjyfNde2.js";import{n as M,r as N}from"./radio-BmBXySlN.js";import{n as P,t as F}from"./row-U3CmiTzy.js";import{t as I}from"./Pagination-B2FW-sku.js";import{n as L,t as R}from"./skeleton-C4sltx62.js";import{An as z,E as B,En as V,Mr as H,Pr as U,Tn as W,_r as G,lr as K,ur as q,wn as J}from"./index-CsXA6dkM.js";import{t as Y}from"./index.es-D93UqOcB.js";import{t as X}from"./CopyToClipboard-C6tjXA6K.js";ee.register(_,u,m,v,d,g);var Z=r({name:`ConsoleUsageList`,components:{Pagination:I,ElTag:U,ElDatePicker:A,ElTable:D,ElSelect:w,ElOption:T,CopyToClipboard:X,ElRow:F,ElCol:P,ElTableColumn:E,ElCard:j,ElRadioButton:M,ElRadioGroup:N,ElSkeleton:R,ElSkeletonItem:L,ElDialog:H,ElTabs:O,ElTabPane:k,ElButton:C,FontAwesomeIcon:Y,BarChart:y},data(){return{applicationIds:this.$route.query.application_id?.toString()?this.$route.query.application_id?.toString().split(`,`):[],apiIds:this.$route.query.api_id?.toString()?this.$route.query.api_id?.toString().split(`,`):[],applications:[],apis:[],apisLoading:!1,credentialType:K,serviceType:q,apiUsages:[],proxyUsages:[],createdAtRange:(()=>{let e=this.$route.query.created_at_to?.toString(),t=this.$route.query.created_at_from?.toString();if(t&&e)return[new Date(t),new Date(e)];let n=new Date,r=new Date;return r.setDate(1),r.setHours(0,0,0,0),[r,n]})(),shortcuts:[{text:this.$t(`usage.shortcuts.thisMonth`),value:()=>{let e=new Date,t=new Date;return t.setDate(1),t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last1Day`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-1),[t,e]}},{text:this.$t(`usage.shortcuts.last3Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-3),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}],type:this.$route.query.type?.toString()||q.API,loading:!1,total:void 0,limit:15,totalUsed:0,barChartLabels:[],barChartSeries:[],aggLoading:!1,detailDialogVisible:!1,detailRow:null,detailActiveTab:`request`,detailLoading:!1,exporting:!1,statusCodeFilter:this.$route.query.status_code?.toString()||``,statusCodeOptions:[],statusCodeOptionsLoading:!1}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},totalUsedString(){return`${(this.totalUsed||0).toFixed(2)}`},barChartData(){return{labels:this.barChartLabels,datasets:this.barChartSeries.map(e=>({label:e.label,data:e.data,backgroundColor:e.color}))}},barChartOptions(){return{responsive:!0,plugins:{legend:{position:`top`,onClick:(e,t,n)=>{let r=n?.chart;if(!r||t?.datasetIndex===void 0)return;let i=t.datasetIndex,a=r.data?.datasets||[];a.some((e,t)=>t!==i&&r.isDatasetVisible(t))?a.forEach((e,t)=>r.setDatasetVisibility(t,t===i)):a.forEach((e,t)=>r.setDatasetVisibility(t,!0)),r.update()}},title:{display:!0,text:this.$t(`usage.title.usageTrend`)}},scales:{x:{stacked:!0},y:{stacked:!0,beginAtZero:!0}}}}},watch:{page:{handler(){this.onFetchUsages()}},type:{handler(){this.applicationIds=[],this.apiIds=[],this.onApplicationsChange(this.applicationIds),this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()}}},mounted(){this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},methods:{async onFetchUsages(){this.type===q.API?this.onFetchApiUsages():this.type===q.Proxy&&this.onFetchProxyUsages()},async onApiChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onApisChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e&&e.length?e.join(`,`):``}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onTimeRangeChanged(){console.log(`onTimeRangeChanged`,this.createdAtRange),await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,created_at_from:this.createdAtRange?this.$dayjs.format(this.createdAtRange[0].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``,created_at_to:this.createdAtRange?this.$dayjs.format(this.createdAtRange[1].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``}}),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},async onApplicationChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e}}),this.onFetchUsages(),this.onFetchAggregate()},async onApplicationsChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e&&e.length?e.join(`,`):``}}),this.onFetchUsages(),this.onFetchAggregate()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},getRemainingAmount(e){if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`},getDeductedAmount(e){if(e?.deducted_amount===void 0||e?.deducted_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.deducted_amount?.toFixed(6)} ${t}`},getOriginalAmount(e){if(e?.original_amount===void 0||e?.original_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.original_amount?.toFixed(6)} ${t}`},onStatusCodeChange(e){let t={...this.$route.query},n=(e||``).trim();n?t.status_code=n:delete t.status_code,delete t.status_code_filter,this.$router.push({name:this.$route.name?.toString(),query:t}),this.onFetchUsages(),this.onFetchAggregate()},async onFetchStatusCodeOptions(){this.statusCodeOptionsLoading=!0;try{let{data:e}=await W.getStatusCodes({user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{}});this.statusCodeOptions=(e?.items||[]).slice().sort((e,t)=>e-t)}catch{this.statusCodeOptions=[]}finally{this.statusCodeOptionsLoading=!1}},formatElapsed(e){return e==null||Number.isNaN(e)?`-`:e<1?`${Math.round(e*1e3)} ms`:`${e.toFixed(2)} s`},getSimpleMetadata(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))n===`request`||n===`response`||typeof r==`object`&&r||(t[n]=r);return t},onShowDetail(e){this.detailRow={...e,metadata:void 0},this.detailActiveTab=`request`,this.detailDialogVisible=!0,this.detailLoading=!0,e.id&&W.get(e.id).then(e=>{this.detailRow=e.data}).finally(()=>{this.detailLoading=!1})},formatJson(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}},onFetchApplications(){z.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:G.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,J.getAll({limit:100,offset:0,ordering:`-created_at`}).then(({data:e})=>{this.apis=e.items}).catch(()=>{}).finally(()=>{this.apisLoading=!1})},onFetchApiUsages(){console.log(`onFetchApiUsages`,this.createdAtRange),this.loading=!0,W.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{}}).then(({data:e})=>{this.apiUsages=e.items,this.loading=!1,this.total=e.count}).catch(()=>{this.loading=!1})},onFetchProxyUsages(){this.loading=!0,V.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{}}).then(({data:e})=>{this.proxyUsages=e.items,this.loading=!1,this.total=e.count}).catch(()=>{this.loading=!1})},onExport(){this.exporting=!0,W.exportCsv({user_id:this.$store.getters.user.id,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{}}).then(({data:e})=>{let t=window.URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`usages.csv`,n.click(),window.URL.revokeObjectURL(t)}).catch(()=>{}).finally(()=>{this.exporting=!1})},async onFetchAggregate(){if(this.aggLoading=!0,this.type!==this.serviceType.API)return;let e={user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{}};try{let{data:t}=await W.getAggregate(e);this.totalUsed=t.total||0;let n=Array.from(new Set((t.items||[]).map(e=>e.date))).sort(),r=Array.from(new Set((t.items||[]).map(e=>e.api_id))),i=e=>`hsl(${e*57%360}, 70%, 60%)`,a=r.map((e,r)=>{let a=t.apis?.[e]?.title||e,o={};return(t.items||[]).filter(t=>t.api_id===e).forEach(e=>{o[e.date]=e.amount||0}),{key:e,label:a,data:n.map(e=>o[e]||0),color:i(r)}});this.barChartLabels=n,this.barChartSeries=a}finally{this.aggLoading=!1}}}}),Q={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},$={class:`inline-block w-9`},te={class:`inline-block`},ne={key:1,class:`summary-card`},re={class:`icon-wrapper`},ie={class:`text-left`},ae={class:`description`},oe={class:`value`},se={class:`chart-wrapper`},ce={key:0},le={key:1},ue={class:`flex flex-wrap gap-2`},de={class:`key`},fe={key:0,class:`cursor-pointer`},pe={class:`created-at`},me={class:`created-at`},he={key:1,class:`detail-json`},ge={key:2,class:`text-gray-400`},_e={key:1,class:`detail-json`},ve={key:2,class:`text-gray-400`},ye={class:`float-right`};function be(r,u,d,ee,m,g){let _=b(`el-col`),v=b(`el-row`),y=b(`el-radio-button`),C=b(`el-radio-group`),w=b(`el-option`),T=b(`el-select`),E=b(`el-skeleton-item`),D=b(`el-skeleton`),O=b(`el-date-picker`),k=b(`font-awesome-icon`),A=b(`el-button`),j=b(`el-card`),M=b(`bar-chart`),N=b(`el-table-column`),P=b(`el-tag`),F=b(`copy-to-clipboard`),I=b(`el-table`),L=b(`el-tab-pane`),R=b(`el-tabs`),z=b(`el-dialog`),B=b(`pagination`),V=h(`loading`);return l(),a(v,null,{default:x(()=>[o(_,{span:24},{default:x(()=>[o(v,null,{default:x(()=>[o(_,{span:24},{default:x(()=>[n(`h2`,Q,c(r.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),o(v,null,{default:x(()=>[o(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[n(`span`,null,c(r.$t(`application.field.type`)),1),o(C,{modelValue:r.type,"onUpdate:modelValue":u[0]||=e=>r.type=e},{default:x(()=>[o(y,{value:r.serviceType.API,label:r.$t(`application.field.api`)},null,8,[`value`,`label`]),o(y,{value:r.serviceType.Proxy,label:r.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),f(o(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[n(`span`,$,c(r.$t(`usage.field.application`)),1),o(T,{modelValue:r.applicationIds,"onUpdate:modelValue":u[1]||=e=>r.applicationIds=e,placeholder:r.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:r.onApplicationsChange},{default:x(()=>[(l(!0),t(s,null,e(r.applications,e=>(l(),a(w,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[S,!1]]),r.type===r.serviceType.API?(l(),a(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[n(`span`,te,c(r.$t(`usage.field.api`)),1),r.apisLoading?(l(),a(D,{key:0,animated:``,class:`w-full`},{template:x(()=>[o(E,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(l(),a(T,{key:1,modelValue:r.apiIds,"onUpdate:modelValue":u[2]||=e=>r.apiIds=e,placeholder:r.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:r.onApisChange},{default:x(()=>[(l(!0),t(s,null,e(r.apis,e=>(l(),a(w,{key:e?.id,label:e?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):p(``,!0),r.type===r.serviceType.API?(l(),a(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[o(O,{modelValue:r.createdAtRange,"onUpdate:modelValue":u[3]||=e=>r.createdAtRange=e,type:`datetimerange`,class:`w-full`,shortcuts:r.shortcuts,"range-separator":r.$t(`usage.placeholder.to`),"start-placeholder":r.$t(`usage.placeholder.startDate`),"end-placeholder":r.$t(`usage.placeholder.endDate`),onChange:r.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):p(``,!0),r.type===r.serviceType.API?(l(),a(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[o(T,{modelValue:r.statusCodeFilter,"onUpdate:modelValue":u[4]||=e=>r.statusCodeFilter=e,placeholder:r.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:r.statusCodeOptionsLoading,onChange:r.onStatusCodeChange},{default:x(()=>[(l(!0),t(s,null,e(r.statusCodeOptions,e=>(l(),a(w,{key:e,label:String(e),value:String(e)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):p(``,!0),r.type===r.serviceType.API?(l(),a(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:x(()=>[o(A,{type:`primary`,plain:``,loading:r.exporting,class:`w-full whitespace-nowrap`,onClick:r.onExport},{default:x(()=>[o(k,{icon:`fa-solid fa-file-export`,class:`mr-1`}),i(` `+c(r.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):p(``,!0)]),_:1}),o(v,null,{default:x(()=>[o(_,{span:24},{default:x(()=>[r.type===r.serviceType.API?(l(),a(v,{key:0,gutter:24,class:`mb-5`},{default:x(()=>[o(_,{md:6,xs:24},{default:x(()=>[o(j,{shadow:`hover`,class:`h-full`},{default:x(()=>[r.aggLoading?(l(),a(D,{key:0})):(l(),t(`div`,ne,[n(`div`,re,[o(k,{icon:`fa-solid fa-cubes`,class:`icon`})]),n(`div`,ie,[n(`p`,ae,c(r.$t(`usage.title.totalUsed`)),1),n(`p`,oe,c(r.totalUsedString),1)])]))]),_:1})]),_:1}),o(_,{md:18,xs:24},{default:x(()=>[o(j,{shadow:`hover`,class:`h-full`},{default:x(()=>[n(`div`,se,[r.aggLoading?(l(),a(D,{key:0,class:`w-full`})):(l(),a(M,{key:1,data:r.barChartData,options:r.barChartOptions,class:`chart`},null,8,[`data`,`options`]))])]),_:1})]),_:1})]),_:1})):p(``,!0),o(j,{shadow:`hover`},{default:x(()=>[r.type===r.serviceType.API?f((l(),a(I,{key:0,data:r.apiUsages,stripe:``,"table-layout":`fixed`,"empty-text":r.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:x(()=>[o(N,{label:r.$t(`application.field.name`),width:`160px`},{default:x(e=>[n(`span`,null,c(e.row?.api?.title),1)]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.statusCode`),width:`120px`},{default:x(e=>[n(`span`,null,c(e.row.status_code),1)]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.elapsed`),width:`120px`},{default:x(e=>[n(`span`,null,c(r.formatElapsed(e.row.elapsed)),1)]),_:1},8,[`label`]),o(N,{prop:`deducted_amount`,label:r.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:x(e=>[r.getDeductedAmount(e.row)===r.getOriginalAmount(e.row)?(l(),t(`div`,ce,[n(`span`,null,c(r.getDeductedAmount(e.row)),1)])):(l(),t(`div`,le,[u[7]||=n(`p`,null,null,-1),n(`p`,null,[n(`span`,null,c(r.getDeductedAmount(e.row)),1)]),n(`p`,null,[n(`del`,null,c(r.getOriginalAmount(e.row)),1)])]))]),_:1},8,[`label`]),o(N,{prop:`remaining_amount`,label:r.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:x(e=>[n(`span`,null,c(r.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),o(N,{prop:`metadata`,label:r.$t(`usage.field.metadata`),width:`260px`,"class-name":`text-center`},{default:x(o=>[n(`div`,ue,[o.row.original_amount>o.row.deducted_amount&&o.row.original_amount>0?(l(),a(P,{key:0,type:`success`,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:x(()=>[i(c(((o.row.original_amount-o.row.deducted_amount)*100/o.row.original_amount).toFixed(0)+`% OFF`),1)]),_:2},1024)):p(``,!0),(l(!0),t(s,null,e(r.getSimpleMetadata(o.row.metadata),(e,t)=>(l(),a(P,{key:t,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:x(()=>[i(c(t)+`: `+c(e),1)]),_:2},1024))),128))])]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:x(e=>[e.row.id?(l(),a(A,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:t=>r.onShowDetail(e.row)},{default:x(()=>[i(c(r.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):p(``,!0)]),_:1},8,[`label`]),o(N,{prop:`trace_id`,label:r.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:x(e=>[n(`span`,de,c(e.row.trace_id),1),e.row.trace_id?(l(),t(`span`,fe,[o(F,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):p(``,!0)]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.createdAt`),width:`200px`},{default:x(e=>[n(`span`,pe,c(r.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[V,r.loading]]):p(``,!0),r.type===r.serviceType.Proxy?f((l(),a(I,{key:1,data:r.proxyUsages,stripe:``,"table-layout":`fixed`,"empty-text":r.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:x(()=>[o(N,{label:r.$t(`application.field.name`),width:`160px`},{default:x(e=>[n(`span`,null,c(e.row?.service?.title),1)]),_:1},8,[`label`]),o(N,{prop:`remaining_amount`,label:r.$t(`usage.field.remainingAmount`),width:`160px`,"class-name":`text-center`},{default:x(e=>[n(`span`,null,c(r.getRemainingAmount(e.row)),1),n(`span`,null,c(r.getOriginalAmount(e.row)),1)]),_:1},8,[`label`]),o(N,{prop:`deducted_amount`,label:r.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:x(e=>[n(`span`,null,c(r.getDeductedAmount(e.row)),1)]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:x(e=>[n(`span`,null,c(r.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),o(N,{prop:`metadata`,label:r.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:x(n=>[(l(!0),t(s,null,e(n.row.metadata,(e,t)=>(l(),a(P,{key:t,class:`mb-2`},{default:x(()=>[i(c(t)+`: `+c(e),1)]),_:2},1024))),128))]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.createdAt`),width:`200px`},{default:x(e=>[n(`span`,me,c(r.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[V,r.loading]]):p(``,!0)]),_:1})]),_:1})]),_:1}),o(z,{modelValue:r.detailDialogVisible,"onUpdate:modelValue":u[6]||=e=>r.detailDialogVisible=e,title:r.$t(`usage.dialog.detailTitle`),width:`70%`,top:`5vh`,"destroy-on-close":``},{default:x(()=>[o(R,{modelValue:r.detailActiveTab,"onUpdate:modelValue":u[5]||=e=>r.detailActiveTab=e},{default:x(()=>[o(L,{label:r.$t(`usage.dialog.request`),name:`request`},{default:x(()=>[r.detailLoading?(l(),a(D,{key:0,rows:6,animated:``})):r.detailRow?.metadata?.request?(l(),t(`pre`,he,c(r.formatJson(r.detailRow.metadata.request)),1)):(l(),t(`p`,ge,c(r.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),o(L,{label:r.$t(`usage.dialog.response`),name:`response`},{default:x(()=>[r.detailLoading?(l(),a(D,{key:0,rows:6,animated:``})):r.detailRow?.metadata?.response?(l(),t(`pre`,_e,c(r.formatJson(r.detailRow.metadata.response)),1)):(l(),t(`p`,ve,c(r.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`]),o(v,null,{default:x(()=>[o(_,{span:10,offset:14},{default:x(()=>[n(`div`,ye,[o(B,{"current-page":r.page,"page-size":r.limit,total:r.total,onChange:r.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var xe=B(Z,[[`render`,be],[`__scopeId`,`data-v-38f1845c`]]);export{xe as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Wt as c,Z as l,a as u,c as d,dt as f,i as ee,k as p,n as m,nt as h,o as g,r as _,s as v,t as y,tt as b,ut as x,v as S}from"./vendor-chart-BJCvKk8-.js";import{t as C}from"./button-DfsQodL-.js";import{r as w,t as T}from"./select-CTfF5Pq0.js";import{n as E,t as D}from"./table-lRQt4LGt.js";import{n as O,t as k}from"./tabs-D-lB-wXk.js";import{t as A}from"./date-picker-DNzuis04.js";import{t as j}from"./card-DjyfNde2.js";import{n as M,r as N}from"./radio-BmBXySlN.js";import{n as P,t as F}from"./row-Cq8mMRkw.js";import{t as I}from"./Pagination-BB0rDmAw.js";import{n as L,t as R}from"./skeleton-C4sltx62.js";import{An as z,E as B,En as V,Mr as H,Pr as U,Tn as W,_r as G,lr as K,ur as q,wn as J}from"./index-CTMytxLX.js";import{t as Y}from"./index.es-DsMKNIuW.js";import{t as X}from"./CopyToClipboard-CRnka5tK.js";ee.register(_,u,m,v,d,g);var Z=r({name:`ConsoleUsageList`,components:{Pagination:I,ElTag:U,ElDatePicker:A,ElTable:D,ElSelect:w,ElOption:T,CopyToClipboard:X,ElRow:F,ElCol:P,ElTableColumn:E,ElCard:j,ElRadioButton:M,ElRadioGroup:N,ElSkeleton:R,ElSkeletonItem:L,ElDialog:H,ElTabs:O,ElTabPane:k,ElButton:C,FontAwesomeIcon:Y,BarChart:y},data(){return{applicationIds:this.$route.query.application_id?.toString()?this.$route.query.application_id?.toString().split(`,`):[],apiIds:this.$route.query.api_id?.toString()?this.$route.query.api_id?.toString().split(`,`):[],applications:[],apis:[],apisLoading:!1,credentialType:K,serviceType:q,apiUsages:[],proxyUsages:[],createdAtRange:(()=>{let e=this.$route.query.created_at_to?.toString(),t=this.$route.query.created_at_from?.toString();if(t&&e)return[new Date(t),new Date(e)];let n=new Date,r=new Date;return r.setDate(1),r.setHours(0,0,0,0),[r,n]})(),shortcuts:[{text:this.$t(`usage.shortcuts.thisMonth`),value:()=>{let e=new Date,t=new Date;return t.setDate(1),t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last1Day`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-1),[t,e]}},{text:this.$t(`usage.shortcuts.last3Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-3),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}],type:this.$route.query.type?.toString()||q.API,loading:!1,total:void 0,limit:15,totalUsed:0,barChartLabels:[],barChartSeries:[],aggLoading:!1,detailDialogVisible:!1,detailRow:null,detailActiveTab:`request`,detailLoading:!1,exporting:!1,statusCodeFilter:this.$route.query.status_code?.toString()||``,statusCodeOptions:[],statusCodeOptionsLoading:!1}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},totalUsedString(){return`${(this.totalUsed||0).toFixed(2)}`},barChartData(){return{labels:this.barChartLabels,datasets:this.barChartSeries.map(e=>({label:e.label,data:e.data,backgroundColor:e.color}))}},barChartOptions(){return{responsive:!0,plugins:{legend:{position:`top`,onClick:(e,t,n)=>{let r=n?.chart;if(!r||t?.datasetIndex===void 0)return;let i=t.datasetIndex,a=r.data?.datasets||[];a.some((e,t)=>t!==i&&r.isDatasetVisible(t))?a.forEach((e,t)=>r.setDatasetVisibility(t,t===i)):a.forEach((e,t)=>r.setDatasetVisibility(t,!0)),r.update()}},title:{display:!0,text:this.$t(`usage.title.usageTrend`)}},scales:{x:{stacked:!0},y:{stacked:!0,beginAtZero:!0}}}}},watch:{page:{handler(){this.onFetchUsages()}},type:{handler(){this.applicationIds=[],this.apiIds=[],this.onApplicationsChange(this.applicationIds),this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()}}},mounted(){this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},methods:{async onFetchUsages(){this.type===q.API?this.onFetchApiUsages():this.type===q.Proxy&&this.onFetchProxyUsages()},async onApiChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onApisChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e&&e.length?e.join(`,`):``}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onTimeRangeChanged(){console.log(`onTimeRangeChanged`,this.createdAtRange),await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,created_at_from:this.createdAtRange?this.$dayjs.format(this.createdAtRange[0].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``,created_at_to:this.createdAtRange?this.$dayjs.format(this.createdAtRange[1].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``}}),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},async onApplicationChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e}}),this.onFetchUsages(),this.onFetchAggregate()},async onApplicationsChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e&&e.length?e.join(`,`):``}}),this.onFetchUsages(),this.onFetchAggregate()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},getRemainingAmount(e){if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`},getDeductedAmount(e){if(e?.deducted_amount===void 0||e?.deducted_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.deducted_amount?.toFixed(6)} ${t}`},getOriginalAmount(e){if(e?.original_amount===void 0||e?.original_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.original_amount?.toFixed(6)} ${t}`},onStatusCodeChange(e){let t={...this.$route.query},n=(e||``).trim();n?t.status_code=n:delete t.status_code,delete t.status_code_filter,this.$router.push({name:this.$route.name?.toString(),query:t}),this.onFetchUsages(),this.onFetchAggregate()},async onFetchStatusCodeOptions(){this.statusCodeOptionsLoading=!0;try{let{data:e}=await W.getStatusCodes({user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{}});this.statusCodeOptions=(e?.items||[]).slice().sort((e,t)=>e-t)}catch{this.statusCodeOptions=[]}finally{this.statusCodeOptionsLoading=!1}},formatElapsed(e){return e==null||Number.isNaN(e)?`-`:e<1?`${Math.round(e*1e3)} ms`:`${e.toFixed(2)} s`},getSimpleMetadata(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))n===`request`||n===`response`||typeof r==`object`&&r||(t[n]=r);return t},onShowDetail(e){this.detailRow={...e,metadata:void 0},this.detailActiveTab=`request`,this.detailDialogVisible=!0,this.detailLoading=!0,e.id&&W.get(e.id).then(e=>{this.detailRow=e.data}).finally(()=>{this.detailLoading=!1})},formatJson(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}},onFetchApplications(){z.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:G.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,J.getAll({limit:100,offset:0,ordering:`-created_at`}).then(({data:e})=>{this.apis=e.items}).catch(()=>{}).finally(()=>{this.apisLoading=!1})},onFetchApiUsages(){console.log(`onFetchApiUsages`,this.createdAtRange),this.loading=!0,W.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{}}).then(({data:e})=>{this.apiUsages=e.items,this.loading=!1,this.total=e.count}).catch(()=>{this.loading=!1})},onFetchProxyUsages(){this.loading=!0,V.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{}}).then(({data:e})=>{this.proxyUsages=e.items,this.loading=!1,this.total=e.count}).catch(()=>{this.loading=!1})},onExport(){this.exporting=!0,W.exportCsv({user_id:this.$store.getters.user.id,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{}}).then(({data:e})=>{let t=window.URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`usages.csv`,n.click(),window.URL.revokeObjectURL(t)}).catch(()=>{}).finally(()=>{this.exporting=!1})},async onFetchAggregate(){if(this.aggLoading=!0,this.type!==this.serviceType.API)return;let e={user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{}};try{let{data:t}=await W.getAggregate(e);this.totalUsed=t.total||0;let n=Array.from(new Set((t.items||[]).map(e=>e.date))).sort(),r=Array.from(new Set((t.items||[]).map(e=>e.api_id))),i=e=>`hsl(${e*57%360}, 70%, 60%)`,a=r.map((e,r)=>{let a=t.apis?.[e]?.title||e,o={};return(t.items||[]).filter(t=>t.api_id===e).forEach(e=>{o[e.date]=e.amount||0}),{key:e,label:a,data:n.map(e=>o[e]||0),color:i(r)}});this.barChartLabels=n,this.barChartSeries=a}finally{this.aggLoading=!1}}}}),Q={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},$={class:`inline-block w-9`},te={class:`inline-block`},ne={key:1,class:`summary-card`},re={class:`icon-wrapper`},ie={class:`text-left`},ae={class:`description`},oe={class:`value`},se={class:`chart-wrapper`},ce={key:0},le={key:1},ue={class:`flex flex-wrap gap-2`},de={class:`key`},fe={key:0,class:`cursor-pointer`},pe={class:`created-at`},me={class:`created-at`},he={key:1,class:`detail-json`},ge={key:2,class:`text-gray-400`},_e={key:1,class:`detail-json`},ve={key:2,class:`text-gray-400`},ye={class:`float-right`};function be(r,u,d,ee,m,g){let _=b(`el-col`),v=b(`el-row`),y=b(`el-radio-button`),C=b(`el-radio-group`),w=b(`el-option`),T=b(`el-select`),E=b(`el-skeleton-item`),D=b(`el-skeleton`),O=b(`el-date-picker`),k=b(`font-awesome-icon`),A=b(`el-button`),j=b(`el-card`),M=b(`bar-chart`),N=b(`el-table-column`),P=b(`el-tag`),F=b(`copy-to-clipboard`),I=b(`el-table`),L=b(`el-tab-pane`),R=b(`el-tabs`),z=b(`el-dialog`),B=b(`pagination`),V=h(`loading`);return l(),a(v,null,{default:x(()=>[o(_,{span:24},{default:x(()=>[o(v,null,{default:x(()=>[o(_,{span:24},{default:x(()=>[n(`h2`,Q,c(r.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),o(v,null,{default:x(()=>[o(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[n(`span`,null,c(r.$t(`application.field.type`)),1),o(C,{modelValue:r.type,"onUpdate:modelValue":u[0]||=e=>r.type=e},{default:x(()=>[o(y,{value:r.serviceType.API,label:r.$t(`application.field.api`)},null,8,[`value`,`label`]),o(y,{value:r.serviceType.Proxy,label:r.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),f(o(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[n(`span`,$,c(r.$t(`usage.field.application`)),1),o(T,{modelValue:r.applicationIds,"onUpdate:modelValue":u[1]||=e=>r.applicationIds=e,placeholder:r.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:r.onApplicationsChange},{default:x(()=>[(l(!0),t(s,null,e(r.applications,e=>(l(),a(w,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[S,!1]]),r.type===r.serviceType.API?(l(),a(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[n(`span`,te,c(r.$t(`usage.field.api`)),1),r.apisLoading?(l(),a(D,{key:0,animated:``,class:`w-full`},{template:x(()=>[o(E,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(l(),a(T,{key:1,modelValue:r.apiIds,"onUpdate:modelValue":u[2]||=e=>r.apiIds=e,placeholder:r.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:r.onApisChange},{default:x(()=>[(l(!0),t(s,null,e(r.apis,e=>(l(),a(w,{key:e?.id,label:e?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):p(``,!0),r.type===r.serviceType.API?(l(),a(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[o(O,{modelValue:r.createdAtRange,"onUpdate:modelValue":u[3]||=e=>r.createdAtRange=e,type:`datetimerange`,class:`w-full`,shortcuts:r.shortcuts,"range-separator":r.$t(`usage.placeholder.to`),"start-placeholder":r.$t(`usage.placeholder.startDate`),"end-placeholder":r.$t(`usage.placeholder.endDate`),onChange:r.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):p(``,!0),r.type===r.serviceType.API?(l(),a(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:x(()=>[o(T,{modelValue:r.statusCodeFilter,"onUpdate:modelValue":u[4]||=e=>r.statusCodeFilter=e,placeholder:r.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:r.statusCodeOptionsLoading,onChange:r.onStatusCodeChange},{default:x(()=>[(l(!0),t(s,null,e(r.statusCodeOptions,e=>(l(),a(w,{key:e,label:String(e),value:String(e)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):p(``,!0),r.type===r.serviceType.API?(l(),a(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:x(()=>[o(A,{type:`primary`,plain:``,loading:r.exporting,class:`w-full whitespace-nowrap`,onClick:r.onExport},{default:x(()=>[o(k,{icon:`fa-solid fa-file-export`,class:`mr-1`}),i(` `+c(r.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):p(``,!0)]),_:1}),o(v,null,{default:x(()=>[o(_,{span:24},{default:x(()=>[r.type===r.serviceType.API?(l(),a(v,{key:0,gutter:24,class:`mb-5`},{default:x(()=>[o(_,{md:6,xs:24},{default:x(()=>[o(j,{shadow:`hover`,class:`h-full`},{default:x(()=>[r.aggLoading?(l(),a(D,{key:0})):(l(),t(`div`,ne,[n(`div`,re,[o(k,{icon:`fa-solid fa-cubes`,class:`icon`})]),n(`div`,ie,[n(`p`,ae,c(r.$t(`usage.title.totalUsed`)),1),n(`p`,oe,c(r.totalUsedString),1)])]))]),_:1})]),_:1}),o(_,{md:18,xs:24},{default:x(()=>[o(j,{shadow:`hover`,class:`h-full`},{default:x(()=>[n(`div`,se,[r.aggLoading?(l(),a(D,{key:0,class:`w-full`})):(l(),a(M,{key:1,data:r.barChartData,options:r.barChartOptions,class:`chart`},null,8,[`data`,`options`]))])]),_:1})]),_:1})]),_:1})):p(``,!0),o(j,{shadow:`hover`},{default:x(()=>[r.type===r.serviceType.API?f((l(),a(I,{key:0,data:r.apiUsages,stripe:``,"table-layout":`fixed`,"empty-text":r.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:x(()=>[o(N,{label:r.$t(`application.field.name`),width:`160px`},{default:x(e=>[n(`span`,null,c(e.row?.api?.title),1)]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.statusCode`),width:`120px`},{default:x(e=>[n(`span`,null,c(e.row.status_code),1)]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.elapsed`),width:`120px`},{default:x(e=>[n(`span`,null,c(r.formatElapsed(e.row.elapsed)),1)]),_:1},8,[`label`]),o(N,{prop:`deducted_amount`,label:r.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:x(e=>[r.getDeductedAmount(e.row)===r.getOriginalAmount(e.row)?(l(),t(`div`,ce,[n(`span`,null,c(r.getDeductedAmount(e.row)),1)])):(l(),t(`div`,le,[u[7]||=n(`p`,null,null,-1),n(`p`,null,[n(`span`,null,c(r.getDeductedAmount(e.row)),1)]),n(`p`,null,[n(`del`,null,c(r.getOriginalAmount(e.row)),1)])]))]),_:1},8,[`label`]),o(N,{prop:`remaining_amount`,label:r.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:x(e=>[n(`span`,null,c(r.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),o(N,{prop:`metadata`,label:r.$t(`usage.field.metadata`),width:`260px`,"class-name":`text-center`},{default:x(o=>[n(`div`,ue,[o.row.original_amount>o.row.deducted_amount&&o.row.original_amount>0?(l(),a(P,{key:0,type:`success`,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:x(()=>[i(c(((o.row.original_amount-o.row.deducted_amount)*100/o.row.original_amount).toFixed(0)+`% OFF`),1)]),_:2},1024)):p(``,!0),(l(!0),t(s,null,e(r.getSimpleMetadata(o.row.metadata),(e,t)=>(l(),a(P,{key:t,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:x(()=>[i(c(t)+`: `+c(e),1)]),_:2},1024))),128))])]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:x(e=>[e.row.id?(l(),a(A,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:t=>r.onShowDetail(e.row)},{default:x(()=>[i(c(r.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):p(``,!0)]),_:1},8,[`label`]),o(N,{prop:`trace_id`,label:r.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:x(e=>[n(`span`,de,c(e.row.trace_id),1),e.row.trace_id?(l(),t(`span`,fe,[o(F,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):p(``,!0)]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.createdAt`),width:`200px`},{default:x(e=>[n(`span`,pe,c(r.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[V,r.loading]]):p(``,!0),r.type===r.serviceType.Proxy?f((l(),a(I,{key:1,data:r.proxyUsages,stripe:``,"table-layout":`fixed`,"empty-text":r.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:x(()=>[o(N,{label:r.$t(`application.field.name`),width:`160px`},{default:x(e=>[n(`span`,null,c(e.row?.service?.title),1)]),_:1},8,[`label`]),o(N,{prop:`remaining_amount`,label:r.$t(`usage.field.remainingAmount`),width:`160px`,"class-name":`text-center`},{default:x(e=>[n(`span`,null,c(r.getRemainingAmount(e.row)),1),n(`span`,null,c(r.getOriginalAmount(e.row)),1)]),_:1},8,[`label`]),o(N,{prop:`deducted_amount`,label:r.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:x(e=>[n(`span`,null,c(r.getDeductedAmount(e.row)),1)]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:x(e=>[n(`span`,null,c(r.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),o(N,{prop:`metadata`,label:r.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:x(n=>[(l(!0),t(s,null,e(n.row.metadata,(e,t)=>(l(),a(P,{key:t,class:`mb-2`},{default:x(()=>[i(c(t)+`: `+c(e),1)]),_:2},1024))),128))]),_:1},8,[`label`]),o(N,{label:r.$t(`usage.field.createdAt`),width:`200px`},{default:x(e=>[n(`span`,me,c(r.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[V,r.loading]]):p(``,!0)]),_:1})]),_:1})]),_:1}),o(z,{modelValue:r.detailDialogVisible,"onUpdate:modelValue":u[6]||=e=>r.detailDialogVisible=e,title:r.$t(`usage.dialog.detailTitle`),width:`70%`,top:`5vh`,"destroy-on-close":``},{default:x(()=>[o(R,{modelValue:r.detailActiveTab,"onUpdate:modelValue":u[5]||=e=>r.detailActiveTab=e},{default:x(()=>[o(L,{label:r.$t(`usage.dialog.request`),name:`request`},{default:x(()=>[r.detailLoading?(l(),a(D,{key:0,rows:6,animated:``})):r.detailRow?.metadata?.request?(l(),t(`pre`,he,c(r.formatJson(r.detailRow.metadata.request)),1)):(l(),t(`p`,ge,c(r.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),o(L,{label:r.$t(`usage.dialog.response`),name:`response`},{default:x(()=>[r.detailLoading?(l(),a(D,{key:0,rows:6,animated:``})):r.detailRow?.metadata?.response?(l(),t(`pre`,_e,c(r.formatJson(r.detailRow.metadata.response)),1)):(l(),t(`p`,ve,c(r.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`]),o(v,null,{default:x(()=>[o(_,{span:10,offset:14},{default:x(()=>[n(`div`,ye,[o(B,{"current-page":r.page,"page-size":r.limit,total:r.total,onChange:r.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var xe=B(Z,[[`render`,be],[`__scopeId`,`data-v-38f1845c`]]);export{xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Wt as c,Z as l,dt as u,nt as d,tt as f,ut as p}from"./vendor-chart-BJCvKk8-.js";import{t as m}from"./button-DfsQodL-.js";import{r as h,t as g}from"./select-D_7T85Mp.js";import{n as _,t as v}from"./table-lRQt4LGt.js";import{t as y}from"./date-picker-DC_BNmdb.js";import{t as b}from"./card-DjyfNde2.js";import{n as x,t as S}from"./row-U3CmiTzy.js";import{t as C}from"./Pagination-B2FW-sku.js";import{t as w}from"./skeleton-C4sltx62.js";import{Cn as T,E,Pr as D,Pt as O,dr as k}from"./index-CsXA6dkM.js";import{t as A}from"./index.es-D93UqOcB.js";import{t as j}from"./CopyToClipboard-C6tjXA6K.js";var M={total_count:0,total_spent:0,state_counts:{}},N=r({name:`ConsoleOrderList`,components:{Pagination:C,CopyToClipboard:j,ElRow:S,ElCol:x,ElTable:v,ElTableColumn:_,ElButton:m,ElTag:D,ElCard:b,ElSelect:h,ElOption:g,ElDatePicker:y,ElSkeleton:w,FontAwesomeIcon:A},data(){return{OrderState:k,orders:[],loading:!1,total:void 0,limit:10,filterState:this.$route.query.state?.toString()||``,filterPayWay:this.$route.query.pay_way?.toString()||``,createdAtRange:(()=>{let e=this.$route.query.created_at_from?.toString(),t=this.$route.query.created_at_to?.toString();if(e&&t)return[new Date(e),new Date(t)]})(),summary:{...M},summaryLoading:!1,exporting:!1,shortcuts:[{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}]}},computed:{page(){return parseInt(this.$route.query.page?.toString()||`1`)},stateOptions(){return[{value:k.PENDING,label:this.$t(`order.state.pending`)},{value:k.FINISHED,label:this.$t(`order.state.finished`)},{value:k.PAID,label:this.$t(`order.state.paid`)},{value:k.EXPIRED,label:this.$t(`order.state.expired`)},{value:k.FAILED,label:this.$t(`order.state.failed`)},{value:k.REFUNDED,label:this.$t(`order.state.refunded`)}]},payWayOptions(){return[{value:`WechatPay`,label:this.$t(`order.title.wechatPay`)},{value:`Stripe`,label:this.$t(`order.title.stripe`)},{value:`AliPay`,label:this.$t(`order.title.aliPay`)},{value:`X402`,label:this.$t(`order.title.x402`)},{value:`PayPal`,label:this.$t(`order.title.paypal`)}]},filterQuery(){let e={user_id:this.$store.getters.user?.id};return this.filterState&&(e.state=this.filterState),this.filterPayWay&&(e.pay_way=this.filterPayWay),this.createdAtRange?.[0]&&(e.created_at_from=this.createdAtRange[0]),this.createdAtRange?.[1]&&(e.created_at_to=this.createdAtRange[1]),e}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData(),this.onFetchSummary()},methods:{getPriceString:O,stateTagType(e){return e===k.FINISHED||e===k.PAID?`success`:e===k.EXPIRED||e===k.FAILED?`danger`:e===k.REFUNDED?`warning`:`info`},stateLabel(e){return{[k.PENDING]:this.$t(`order.state.pending`),[k.PAID]:this.$t(`order.state.paid`),[k.FINISHED]:this.$t(`order.state.finished`),[k.EXPIRED]:this.$t(`order.state.expired`),[k.FAILED]:this.$t(`order.state.failed`),[k.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==k.PAID&&e!==k.FINISHED&&e!==k.EXPIRED&&e!==k.FAILED&&e!==k.REFUNDED},goToDetail(e){this.$router.push({name:`console-order-detail`,params:{id:e}})},async onFilterChange(){await this.$router.push({name:this.$route.name?.toString(),query:{page:1,...this.filterState?{state:this.filterState}:{},...this.filterPayWay?{pay_way:this.filterPayWay}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0].toISOString()}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1].toISOString()}:{}}}),this.onFetchData(),this.onFetchSummary()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchData(){this.loading=!0,T.getAll({ordering:`-created_at`,limit:this.limit,offset:(this.page-1)*this.limit,...this.filterQuery}).then(({data:e})=>{this.orders=e.items,this.total=e.count}).catch(()=>{}).finally(()=>{this.loading=!1})},onFetchSummary(){this.summaryLoading=!0,T.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...M}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,T.exportCsv(this.filterQuery).then(({data:e})=>{let t=window.URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`orders.csv`,n.click(),window.URL.revokeObjectURL(t)}).catch(()=>{}).finally(()=>{this.exporting=!1})}}}),P={class:`title`},F={key:1,class:`card-content`},I={class:`icon-wrapper`},L={class:`description`},R={class:`value`},z={key:1,class:`card-content`},B={class:`icon-wrapper`},V={class:`description`},H={class:`value`},U={key:1,class:`card-content`},W={class:`icon-wrapper`},ee={class:`description`},G={class:`value`},K={key:1,class:`card-content`},q={class:`icon-wrapper`},J={class:`description`},Y={class:`value`},X={class:`filter-row mb-3`},Z={class:`key`},Q={class:`cursor-pointer`},$={class:`price`},te={class:`description`},ne={class:`text-gray-500`},re={class:`created-at`},ie={class:`flex items-center justify-center flex-wrap`},ae={class:`float-right`};function oe(r,m,h,g,_,v){let y=f(`el-col`),b=f(`el-row`),x=f(`el-skeleton`),S=f(`font-awesome-icon`),C=f(`el-card`),w=f(`el-option`),T=f(`el-select`),E=f(`el-date-picker`),D=f(`el-button`),O=f(`copy-to-clipboard`),k=f(`el-table-column`),A=f(`el-tag`),j=f(`el-table`),M=f(`pagination`),N=d(`loading`);return l(),a(b,{class:`panel`},{default:p(()=>[o(y,{span:24},{default:p(()=>[o(b,null,{default:p(()=>[o(y,{span:24},{default:p(()=>[n(`h2`,P,c(r.$t(`common.title.allOrders`)),1)]),_:1})]),_:1}),o(b,{gutter:16},{default:p(()=>[o(y,{md:6,sm:12,xs:24},{default:p(()=>[o(C,{shadow:`hover`,class:`item-mini mb-3`},{default:p(()=>[r.summaryLoading?(l(),a(x,{key:0})):(l(),t(`div`,F,[n(`div`,I,[o(S,{icon:`fa-solid fa-receipt`,class:`icon`})]),n(`p`,L,c(r.$t(`order.title.totalOrders`)),1),n(`p`,R,c(r.summary.total_count),1)]))]),_:1})]),_:1}),o(y,{md:6,sm:12,xs:24},{default:p(()=>[o(C,{shadow:`hover`,class:`item-mini mb-3`},{default:p(()=>[r.summaryLoading?(l(),a(x,{key:0})):(l(),t(`div`,z,[n(`div`,B,[o(S,{icon:`fa-solid fa-dollar-sign`,class:`icon`})]),n(`p`,V,c(r.$t(`order.title.totalSpent`)),1),n(`p`,H,c(r.getPriceString({value:r.summary.total_spent})),1)]))]),_:1})]),_:1}),o(y,{md:6,sm:12,xs:24},{default:p(()=>[o(C,{shadow:`hover`,class:`item-mini mb-3`},{default:p(()=>[r.summaryLoading?(l(),a(x,{key:0})):(l(),t(`div`,U,[n(`div`,W,[o(S,{icon:`fa-solid fa-check-circle`,class:`icon`})]),n(`p`,ee,c(r.$t(`order.title.finishedOrders`)),1),n(`p`,G,c(r.summary.state_counts?.Finished||0),1)]))]),_:1})]),_:1}),o(y,{md:6,sm:12,xs:24},{default:p(()=>[o(C,{shadow:`hover`,class:`item-mini mb-3`},{default:p(()=>[r.summaryLoading?(l(),a(x,{key:0})):(l(),t(`div`,K,[n(`div`,q,[o(S,{icon:`fa-solid fa-clock`,class:`icon`})]),n(`p`,J,c(r.$t(`order.title.pendingOrders`)),1),n(`p`,Y,c(r.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),n(`div`,X,[o(T,{modelValue:r.filterState,"onUpdate:modelValue":m[0]||=e=>r.filterState=e,clearable:``,placeholder:r.$t(`order.field.allStates`),class:`filter-select`,onChange:r.onFilterChange},{default:p(()=>[(l(!0),t(s,null,e(r.stateOptions,e=>(l(),a(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),o(T,{modelValue:r.filterPayWay,"onUpdate:modelValue":m[1]||=e=>r.filterPayWay=e,clearable:``,placeholder:r.$t(`order.field.allPayWays`),class:`filter-select`,onChange:r.onFilterChange},{default:p(()=>[(l(!0),t(s,null,e(r.payWayOptions,e=>(l(),a(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),o(E,{modelValue:r.createdAtRange,"onUpdate:modelValue":m[2]||=e=>r.createdAtRange=e,type:`datetimerange`,shortcuts:r.shortcuts,"range-separator":r.$t(`usage.placeholder.to`),"start-placeholder":r.$t(`usage.placeholder.startDate`),"end-placeholder":r.$t(`usage.placeholder.endDate`),onChange:r.onFilterChange},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`]),o(D,{type:`primary`,plain:``,loading:r.exporting,onClick:r.onExport},{default:p(()=>[o(S,{icon:`fa-solid fa-file-export`,class:`mr-1`}),i(` `+c(r.$t(`order.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),o(b,null,{default:p(()=>[o(y,{span:24},{default:p(()=>[o(C,{shadow:`hover`},{default:p(()=>[u((l(),a(j,{data:r.orders,stripe:``,"empty-text":r.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:p(()=>[o(k,{prop:`id`,label:r.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:p(e=>[n(`span`,Z,c(e.row.id),1),n(`span`,Q,[o(O,{content:e.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),o(k,{label:r.$t(`order.field.price`),width:`110px`,align:`center`},{default:p(e=>[n(`span`,$,c(r.getPriceString({value:e.row?.price})),1)]),_:1},8,[`label`]),o(k,{label:r.$t(`order.field.description`),"min-width":`220px`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:p(e=>[n(`span`,te,c(e.row.description),1)]),_:1},8,[`label`]),o(k,{prop:`state`,label:r.$t(`order.field.state`),width:`130px`,align:`center`},{default:p(e=>[o(A,{type:r.stateTagType(e.row.state),class:`mx-1`,effect:`dark`,round:``,size:`small`},{default:p(()=>[i(c(r.stateLabel(e.row.state)),1)]),_:2},1032,[`type`])]),_:1},8,[`label`]),o(k,{label:r.$t(`order.field.payWay`),width:`120px`,align:`center`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:p(e=>[n(`span`,ne,c(e.row.pay_way||`-`),1)]),_:1},8,[`label`]),o(k,{label:r.$t(`order.field.createdAt`),width:`200px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:p(e=>[n(`span`,re,c(r.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`]),o(k,{"min-width":`130px`,fixed:`right`},{default:p(e=>[n(`div`,ie,[r.isPendingAction(e.row.state)?(l(),a(D,{key:0,type:`primary`,size:`small`,onClick:t=>r.goToDetail(e.row.id)},{default:p(()=>[i(c(r.$t(`order.button.continuePay`)),1)]),_:1},8,[`onClick`])):(l(),a(D,{key:1,size:`small`,onClick:t=>r.goToDetail(e.row.id)},{default:p(()=>[i(c(r.$t(`order.button.checkDetail`)),1)]),_:1},8,[`onClick`]))])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[N,r.loading]])]),_:1})]),_:1})]),_:1}),o(b,null,{default:p(()=>[o(y,{span:10,offset:14},{default:p(()=>[n(`div`,ae,[o(M,{"current-page":r.page,"page-size":r.limit,total:r.total,onChange:r.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var se=E(N,[[`render`,oe],[`__scopeId`,`data-v-350ab467`]]);export{se as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as s,Wt as c,Z as l,dt as u,nt as d,tt as f,ut as p}from"./vendor-chart-BJCvKk8-.js";import{t as m}from"./button-DfsQodL-.js";import{r as h,t as g}from"./select-CTfF5Pq0.js";import{n as _,t as v}from"./table-lRQt4LGt.js";import{t as y}from"./date-picker-DNzuis04.js";import{t as b}from"./card-DjyfNde2.js";import{n as x,t as S}from"./row-Cq8mMRkw.js";import{t as C}from"./Pagination-BB0rDmAw.js";import{t as w}from"./skeleton-C4sltx62.js";import{Cn as T,E,Pr as D,Pt as O,dr as k}from"./index-CTMytxLX.js";import{t as A}from"./index.es-DsMKNIuW.js";import{t as j}from"./CopyToClipboard-CRnka5tK.js";var M={total_count:0,total_spent:0,state_counts:{}},N=r({name:`ConsoleOrderList`,components:{Pagination:C,CopyToClipboard:j,ElRow:S,ElCol:x,ElTable:v,ElTableColumn:_,ElButton:m,ElTag:D,ElCard:b,ElSelect:h,ElOption:g,ElDatePicker:y,ElSkeleton:w,FontAwesomeIcon:A},data(){return{OrderState:k,orders:[],loading:!1,total:void 0,limit:10,filterState:this.$route.query.state?.toString()||``,filterPayWay:this.$route.query.pay_way?.toString()||``,createdAtRange:(()=>{let e=this.$route.query.created_at_from?.toString(),t=this.$route.query.created_at_to?.toString();if(e&&t)return[new Date(e),new Date(t)]})(),summary:{...M},summaryLoading:!1,exporting:!1,shortcuts:[{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}]}},computed:{page(){return parseInt(this.$route.query.page?.toString()||`1`)},stateOptions(){return[{value:k.PENDING,label:this.$t(`order.state.pending`)},{value:k.FINISHED,label:this.$t(`order.state.finished`)},{value:k.PAID,label:this.$t(`order.state.paid`)},{value:k.EXPIRED,label:this.$t(`order.state.expired`)},{value:k.FAILED,label:this.$t(`order.state.failed`)},{value:k.REFUNDED,label:this.$t(`order.state.refunded`)}]},payWayOptions(){return[{value:`WechatPay`,label:this.$t(`order.title.wechatPay`)},{value:`Stripe`,label:this.$t(`order.title.stripe`)},{value:`AliPay`,label:this.$t(`order.title.aliPay`)},{value:`X402`,label:this.$t(`order.title.x402`)},{value:`PayPal`,label:this.$t(`order.title.paypal`)}]},filterQuery(){let e={user_id:this.$store.getters.user?.id};return this.filterState&&(e.state=this.filterState),this.filterPayWay&&(e.pay_way=this.filterPayWay),this.createdAtRange?.[0]&&(e.created_at_from=this.createdAtRange[0]),this.createdAtRange?.[1]&&(e.created_at_to=this.createdAtRange[1]),e}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData(),this.onFetchSummary()},methods:{getPriceString:O,stateTagType(e){return e===k.FINISHED||e===k.PAID?`success`:e===k.EXPIRED||e===k.FAILED?`danger`:e===k.REFUNDED?`warning`:`info`},stateLabel(e){return{[k.PENDING]:this.$t(`order.state.pending`),[k.PAID]:this.$t(`order.state.paid`),[k.FINISHED]:this.$t(`order.state.finished`),[k.EXPIRED]:this.$t(`order.state.expired`),[k.FAILED]:this.$t(`order.state.failed`),[k.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==k.PAID&&e!==k.FINISHED&&e!==k.EXPIRED&&e!==k.FAILED&&e!==k.REFUNDED},goToDetail(e){this.$router.push({name:`console-order-detail`,params:{id:e}})},async onFilterChange(){await this.$router.push({name:this.$route.name?.toString(),query:{page:1,...this.filterState?{state:this.filterState}:{},...this.filterPayWay?{pay_way:this.filterPayWay}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0].toISOString()}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1].toISOString()}:{}}}),this.onFetchData(),this.onFetchSummary()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchData(){this.loading=!0,T.getAll({ordering:`-created_at`,limit:this.limit,offset:(this.page-1)*this.limit,...this.filterQuery}).then(({data:e})=>{this.orders=e.items,this.total=e.count}).catch(()=>{}).finally(()=>{this.loading=!1})},onFetchSummary(){this.summaryLoading=!0,T.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...M}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,T.exportCsv(this.filterQuery).then(({data:e})=>{let t=window.URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`orders.csv`,n.click(),window.URL.revokeObjectURL(t)}).catch(()=>{}).finally(()=>{this.exporting=!1})}}}),P={class:`title`},F={key:1,class:`card-content`},I={class:`icon-wrapper`},L={class:`description`},R={class:`value`},z={key:1,class:`card-content`},B={class:`icon-wrapper`},V={class:`description`},H={class:`value`},U={key:1,class:`card-content`},W={class:`icon-wrapper`},ee={class:`description`},G={class:`value`},K={key:1,class:`card-content`},q={class:`icon-wrapper`},J={class:`description`},Y={class:`value`},X={class:`filter-row mb-3`},Z={class:`key`},Q={class:`cursor-pointer`},$={class:`price`},te={class:`description`},ne={class:`text-gray-500`},re={class:`created-at`},ie={class:`flex items-center justify-center flex-wrap`},ae={class:`float-right`};function oe(r,m,h,g,_,v){let y=f(`el-col`),b=f(`el-row`),x=f(`el-skeleton`),S=f(`font-awesome-icon`),C=f(`el-card`),w=f(`el-option`),T=f(`el-select`),E=f(`el-date-picker`),D=f(`el-button`),O=f(`copy-to-clipboard`),k=f(`el-table-column`),A=f(`el-tag`),j=f(`el-table`),M=f(`pagination`),N=d(`loading`);return l(),a(b,{class:`panel`},{default:p(()=>[o(y,{span:24},{default:p(()=>[o(b,null,{default:p(()=>[o(y,{span:24},{default:p(()=>[n(`h2`,P,c(r.$t(`common.title.allOrders`)),1)]),_:1})]),_:1}),o(b,{gutter:16},{default:p(()=>[o(y,{md:6,sm:12,xs:24},{default:p(()=>[o(C,{shadow:`hover`,class:`item-mini mb-3`},{default:p(()=>[r.summaryLoading?(l(),a(x,{key:0})):(l(),t(`div`,F,[n(`div`,I,[o(S,{icon:`fa-solid fa-receipt`,class:`icon`})]),n(`p`,L,c(r.$t(`order.title.totalOrders`)),1),n(`p`,R,c(r.summary.total_count),1)]))]),_:1})]),_:1}),o(y,{md:6,sm:12,xs:24},{default:p(()=>[o(C,{shadow:`hover`,class:`item-mini mb-3`},{default:p(()=>[r.summaryLoading?(l(),a(x,{key:0})):(l(),t(`div`,z,[n(`div`,B,[o(S,{icon:`fa-solid fa-dollar-sign`,class:`icon`})]),n(`p`,V,c(r.$t(`order.title.totalSpent`)),1),n(`p`,H,c(r.getPriceString({value:r.summary.total_spent})),1)]))]),_:1})]),_:1}),o(y,{md:6,sm:12,xs:24},{default:p(()=>[o(C,{shadow:`hover`,class:`item-mini mb-3`},{default:p(()=>[r.summaryLoading?(l(),a(x,{key:0})):(l(),t(`div`,U,[n(`div`,W,[o(S,{icon:`fa-solid fa-check-circle`,class:`icon`})]),n(`p`,ee,c(r.$t(`order.title.finishedOrders`)),1),n(`p`,G,c(r.summary.state_counts?.Finished||0),1)]))]),_:1})]),_:1}),o(y,{md:6,sm:12,xs:24},{default:p(()=>[o(C,{shadow:`hover`,class:`item-mini mb-3`},{default:p(()=>[r.summaryLoading?(l(),a(x,{key:0})):(l(),t(`div`,K,[n(`div`,q,[o(S,{icon:`fa-solid fa-clock`,class:`icon`})]),n(`p`,J,c(r.$t(`order.title.pendingOrders`)),1),n(`p`,Y,c(r.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),n(`div`,X,[o(T,{modelValue:r.filterState,"onUpdate:modelValue":m[0]||=e=>r.filterState=e,clearable:``,placeholder:r.$t(`order.field.allStates`),class:`filter-select`,onChange:r.onFilterChange},{default:p(()=>[(l(!0),t(s,null,e(r.stateOptions,e=>(l(),a(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),o(T,{modelValue:r.filterPayWay,"onUpdate:modelValue":m[1]||=e=>r.filterPayWay=e,clearable:``,placeholder:r.$t(`order.field.allPayWays`),class:`filter-select`,onChange:r.onFilterChange},{default:p(()=>[(l(!0),t(s,null,e(r.payWayOptions,e=>(l(),a(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),o(E,{modelValue:r.createdAtRange,"onUpdate:modelValue":m[2]||=e=>r.createdAtRange=e,type:`datetimerange`,shortcuts:r.shortcuts,"range-separator":r.$t(`usage.placeholder.to`),"start-placeholder":r.$t(`usage.placeholder.startDate`),"end-placeholder":r.$t(`usage.placeholder.endDate`),onChange:r.onFilterChange},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`]),o(D,{type:`primary`,plain:``,loading:r.exporting,onClick:r.onExport},{default:p(()=>[o(S,{icon:`fa-solid fa-file-export`,class:`mr-1`}),i(` `+c(r.$t(`order.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),o(b,null,{default:p(()=>[o(y,{span:24},{default:p(()=>[o(C,{shadow:`hover`},{default:p(()=>[u((l(),a(j,{data:r.orders,stripe:``,"empty-text":r.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:p(()=>[o(k,{prop:`id`,label:r.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:p(e=>[n(`span`,Z,c(e.row.id),1),n(`span`,Q,[o(O,{content:e.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),o(k,{label:r.$t(`order.field.price`),width:`110px`,align:`center`},{default:p(e=>[n(`span`,$,c(r.getPriceString({value:e.row?.price})),1)]),_:1},8,[`label`]),o(k,{label:r.$t(`order.field.description`),"min-width":`220px`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:p(e=>[n(`span`,te,c(e.row.description),1)]),_:1},8,[`label`]),o(k,{prop:`state`,label:r.$t(`order.field.state`),width:`130px`,align:`center`},{default:p(e=>[o(A,{type:r.stateTagType(e.row.state),class:`mx-1`,effect:`dark`,round:``,size:`small`},{default:p(()=>[i(c(r.stateLabel(e.row.state)),1)]),_:2},1032,[`type`])]),_:1},8,[`label`]),o(k,{label:r.$t(`order.field.payWay`),width:`120px`,align:`center`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:p(e=>[n(`span`,ne,c(e.row.pay_way||`-`),1)]),_:1},8,[`label`]),o(k,{label:r.$t(`order.field.createdAt`),width:`200px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:p(e=>[n(`span`,re,c(r.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`]),o(k,{"min-width":`130px`,fixed:`right`},{default:p(e=>[n(`div`,ie,[r.isPendingAction(e.row.state)?(l(),a(D,{key:0,type:`primary`,size:`small`,onClick:t=>r.goToDetail(e.row.id)},{default:p(()=>[i(c(r.$t(`order.button.continuePay`)),1)]),_:1},8,[`onClick`])):(l(),a(D,{key:1,size:`small`,onClick:t=>r.goToDetail(e.row.id)},{default:p(()=>[i(c(r.$t(`order.button.checkDetail`)),1)]),_:1},8,[`onClick`]))])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[N,r.loading]])]),_:1})]),_:1})]),_:1}),o(b,null,{default:p(()=>[o(y,{span:10,offset:14},{default:p(()=>[n(`div`,ae,[o(M,{"current-page":r.page,"page-size":r.limit,total:r.total,onChange:r.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var se=E(N,[[`render`,oe],[`__scopeId`,`data-v-350ab467`]]);export{se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,D as t,F as n,N as r,O as i,P as a,Wt as o,Z as s,dt as c,k as l,nt as u,tt as d,ut as f}from"./vendor-chart-BJCvKk8-.js";import{t as p}from"./button-DfsQodL-.js";import{n as m,t as h}from"./table-lRQt4LGt.js";import{t as g}from"./card-DjyfNde2.js";import{n as _,t as v}from"./row-
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,D as t,F as n,N as r,O as i,P as a,Wt as o,Z as s,dt as c,k as l,nt as u,tt as d,ut as f}from"./vendor-chart-BJCvKk8-.js";import{t as p}from"./button-DfsQodL-.js";import{n as m,t as h}from"./table-lRQt4LGt.js";import{t as g}from"./card-DjyfNde2.js";import{n as _,t as v}from"./row-Cq8mMRkw.js";import{t as y}from"./Pagination-BB0rDmAw.js";import{t as b}from"./skeleton-C4sltx62.js";import{t as x}from"./switch-B2HtIflI.js";import{An as S,B as C,E as w,P as T,Pr as E,Tr as D,_r as O,gr as k,kr as A,lr as j,ur as M}from"./index-CTMytxLX.js";import{t as N}from"./index.es-DsMKNIuW.js";import{t as P}from"./CopyToClipboard-CRnka5tK.js";var F=n({name:`ConsoleApplicationList`,components:{Pagination:y,CopyToClipboard:P,ElTable:h,ElRow:v,ElButton:p,ElCol:_,ElTag:E,ElSkeleton:b,ElSwitch:x,ElTableColumn:m,ElCard:g,FontAwesomeIcon:N},data(){return{credentialType:j,serviceType:M,individualApplications:[],globalApplications:[],individualApplicationsTotal:void 0,globalApplicationsTotal:void 0,loading:!1,buying:!1,limit:10,form:{amount:1},active:{service:void 0,application:void 0}}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},showPayment(){return!D()}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{updateAllowConsumeGlobal(e,t){!e||!e.id||S.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{A.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{A.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:C,query:{application_id:e.id,type:e?.service?.type}})},onBuyMore(e){e?.id&&this.$router.push({name:T,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=k.INDIVIDUAL){return new Promise((t,n)=>{S.getAll({limit:this.limit,...e===k.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:O.USAGE,scope:e}).then(({data:n})=>{e===k.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{A.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(k.INDIVIDUAL),this.onFetchApplications(k.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){S.create({type:O.USAGE,scope:k.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(k.GLOBAL)})},getRemainingAmount(e){if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`}}}),I={class:`title`},L={key:1,class:`summary-card`},R={class:`icon-wrapper`},z={class:`label`},B={class:`value`},V={class:`description`},H={key:1,class:`flex flex-row justify-between align-center`},U={class:`summary-card`},W={class:`flex justify-start items-center gap-2 mb-2 w-full`},G={class:`icon-wrapper !mb-0`},K={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},q={class:`label`},J={class:`value`},Y={class:`description`},X={class:`flex flex-col items-end gap-2`},Z={class:`copy`},Q={key:0,class:`expired-at`},$={class:`flex flex-wrap items-center justify-end gap-1`},ee={class:`pagination`};function te(n,p,m,h,g,_){let v=d(`el-col`),y=d(`el-row`),b=d(`el-skeleton`),x=d(`font-awesome-icon`),S=d(`el-card`),C=d(`copy-to-clipboard`),w=d(`el-button`),T=d(`el-table-column`),E=d(`el-tag`),D=d(`el-switch`),O=d(`el-table`),k=d(`pagination`),A=u(`loading`);return s(),i(y,{class:`application-list`},{default:f(()=>[a(v,{span:24},{default:f(()=>[a(y,null,{default:f(()=>[a(v,{span:24},{default:f(()=>[t(`h2`,I,o(n.$t(`common.title.allApplications`)),1)]),_:1})]),_:1}),a(y,{gutter:15,class:`mb-3`},{default:f(()=>[a(v,{md:12,xs:24},{default:f(()=>[a(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:f(()=>[n.loading?(s(),i(b,{key:0})):(s(),e(`div`,L,[t(`div`,R,[a(x,{icon:`fa-solid fa-cubes-stacked`})]),t(`p`,z,o(n.$t(`application.title.count`)),1),t(`p`,B,o(n.individualApplicationsTotal),1),t(`p`,V,o(n.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),n.showPayment&&n.globalApplications?.length>0?(s(),i(v,{key:0,md:12,xs:24},{default:f(()=>[a(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:f(()=>[n.loading?(s(),i(b,{key:0})):(s(),e(`div`,H,[t(`div`,U,[t(`div`,W,[t(`div`,G,[a(x,{icon:`fa-solid fa-wallet`})]),t(`span`,K,[r(o(n.$t(`application.field.id`))+`: `+o(n.globalApplications?.[0]?.id)+` `,1),n.globalApplications?.[0]?.id?(s(),i(C,{key:0,content:n.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):l(``,!0)])]),t(`p`,q,o(n.$t(`application.title.globalBalance`)),1),t(`p`,J,o(n.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+o(n.$t(`service.unit.credits`)),1),t(`p`,Y,o(n.$t(`application.message.globalBalanceDescription`)),1)]),t(`div`,X,[a(w,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:p[0]||=e=>n.onGoUsage(n.globalApplications?.[0])},{default:f(()=>[a(x,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),r(` `+o(n.$t(`application.button.usage`)),1)]),_:1}),n.showPayment?(s(),i(w,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:p[1]||=e=>n.onBuyMore(n.globalApplications?.[0])},{default:f(()=>[a(x,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),r(` `+o(n.$t(`application.button.buyMore`)),1)]),_:1})):l(``,!0)])]))]),_:1})]),_:1})):l(``,!0)]),_:1}),a(y,null,{default:f(()=>[a(v,{span:24},{default:f(()=>[a(S,{shadow:`hover`,class:`applications-table-card`},{default:f(()=>[c((s(),i(O,{data:n.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":n.$t(`common.message.noData`)},{default:f(()=>[a(T,{prop:`id`,label:n.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:f(e=>[t(`span`,null,o(e.row.id),1),t(`span`,Z,[a(C,{content:e?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),a(T,{label:n.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:f(e=>[e.row?.type===`Period`?(s(),i(E,{key:0,type:`success`,effect:`dark`,round:``},{default:f(()=>[r(o(n.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(s(),i(E,{key:1,effect:`dark`,round:``},{default:f(()=>[r(o(n.$t(`application.type.usage`)),1)]),_:1})):l(``,!0)]),_:1},8,[`label`]),a(T,{label:n.$t(`application.field.name`),width:`180px`},{default:f(e=>[t(`span`,null,o(e.row?.service?.title),1),e.row?.role===`grantee`?(s(),i(E,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:f(()=>[r(o(n.$t(`application.badge.shared`)),1)]),_:1})):l(``,!0)]),_:1},8,[`label`]),a(T,{prop:`remaining_amount`,label:n.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:f(e=>[t(`span`,null,o(n.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),a(T,{prop:`used_amount`,label:n.$t(`application.field.usedAmount`),width:`150px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:f(e=>[t(`span`,null,o(n.getUsedAmount(e.row)),1)]),_:1},8,[`label`]),a(T,{prop:`allow_consume_global`,label:n.$t(`application.field.allowConsumeGlobal`),width:`120px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:f(e=>[e.row.service?.type===n.serviceType.API?(s(),i(D,{key:0,modelValue:e.row.allow_consume_global,"onUpdate:modelValue":t=>e.row.allow_consume_global=t,"active-value":!0,"inactive-value":!1,onChange:t=>n.updateAllowConsumeGlobal(e.row,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):l(``,!0)]),_:1},8,[`label`]),a(T,{label:n.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:f(t=>[t.row.expired_at?(s(),e(`span`,Q,o(n.$dayjs.format(t.row.expired_at)),1)):l(``,!0)]),_:1},8,[`label`]),a(T,{fixed:`right`,width:`200px`},{default:f(e=>[t(`div`,$,[a(w,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:t=>n.onGoUsage(e?.row)},{default:f(()=>[a(x,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),r(` `+o(n.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),n.showPayment?(s(),i(w,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:t=>n.onBuyMore(e?.row)},{default:f(()=>[a(x,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),r(` `+o(n.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):l(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[A,n.loading]])]),_:1})]),_:1})]),_:1}),a(y,null,{default:f(()=>[a(v,{span:24},{default:f(()=>[t(`div`,ee,[a(k,{"current-page":n.page,"page-size":n.limit,total:n.individualApplicationsTotal,onChange:n.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var ne=w(F,[[`render`,te],[`__scopeId`,`data-v-7182b838`]]);export{ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,D as t,E as n,F as r,N as i,O as a,P as o,Wt as s,Z as c,k as l,tt as u,ut as d}from"./vendor-chart-BJCvKk8-.js";import{t as f}from"./button-DfsQodL-.js";import{t as p}from"./Navigator-
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,D as t,E as n,F as r,N as i,O as a,P as o,Wt as s,Z as c,k as l,tt as u,ut as d}from"./vendor-chart-BJCvKk8-.js";import{t as f}from"./button-DfsQodL-.js";import{t as p}from"./Navigator-DKSj2Vas.js";import{t as m}from"./checkbox-BAeQdLeW.js";import{t as h}from"./divider-LA__Fty9.js";import"./constants-CwLEZ_AF.js";import{An as g,E as _,Mr as v,Mt as y,Sr as b,_r as x,gr as S,kr as C,yr as w}from"./index-CTMytxLX.js";import{t as T}from"./Status-BgvktlpB.js";var E=r({name:`ApplicationConfirm`,components:{ElDialog:v,ElDivider:h,ElCheckbox:m,ElButton:f},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:b,onApply(){if(!this.checked){C.error(this.$t(`application.message.notAgreePolicy`));return}this.$emit(`apply`)}}}),D={class:`content py-[10px] px-[40px]`},O={class:`my-4`},k={class:`policy mb-[10px]`},A={class:`policy-title text-[12px] relative -bottom-[3px]`},j=[`href`];function M(e,n,r,l,f,p){let m=u(`el-divider`),h=u(`el-checkbox`),g=u(`el-button`),_=u(`el-dialog`);return c(),a(_,{"model-value":e.visible,width:`500px`,title:e.$t(`application.message.welcome`),center:``,onClose:n[1]||=t=>e.$emit(`update:visible`,!1)},{default:d(()=>[t(`div`,D,[t(`p`,O,s(e.$t(`application.message.notApplied`)),1),o(m,{class:`my-2`}),t(`div`,k,[o(h,{modelValue:e.checked,"onUpdate:modelValue":n[0]||=t=>e.checked=t,size:`large`,class:`policy-checkbox mr-[10px]`},null,8,[`modelValue`]),t(`span`,A,s(e.$t(`application.message.readPolicy`)),1),t(`a`,{class:`policy-title text-[12px] relative -bottom-[3px] text-[var(--el-color-primary)] cursor-pointer no-underline`,target:`_blank`,href:e.getBaseUrlPlatform()+`/terms`},` \xA0`+s(e.$t(`application.message.policy`)),9,j)]),o(g,{round:``,type:`primary`,onClick:e.onApply},{default:d(()=>[i(s(e.$t(`common.button.start`)),1)]),_:1},8,[`onClick`])])]),_:1},8,[`model-value`,`title`])}var N=r({name:`LayoutMain`,components:{Navigator:p,ApplicationStatus:T,ApplicationConfirm:_(E,[[`render`,M]])},provide(){return{initialized:n(()=>this.initialized)}},data(){return{initialized:!1,applying:!1,mobile:typeof window<`u`&&window.innerWidth<768,initializeRunId:0}},computed:{appName(){return this.$route.meta.appName},application(){return this.$store.state[this.appName]?.application},applications(){let e=this.$store.state[this.appName]?.applications??[];console.debug(`individualApplications`,e);let t=this.$store.state.applications??[];return console.debug(`globalApplications`,t),t.concat(e)},loading(){return this.$store.state[this.appName]?.status?.getApplications===w.Request},service(){return this.$store.state[this.appName]?.service},userId(){return this.$store.state.user?.id}},watch:{appName(){this.initialize()},userId(e,t){e&&e!==t&&this.initialize()}},mounted(){this.initialize(),window.addEventListener(`resize`,this.onResize)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize)},methods:{onResize(){this.mobile=window.innerWidth<768},async initialize(){let e=++this.initializeRunId;if(this.initialized=!1,console.debug(`Fetching all individual and global applications for`,this.appName),await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]),e!==this.initializeRunId)return;console.debug(`Fetched all applications`,this.applications),this.$store.state.applications?.length===0&&await this.onAutoApply();let t=this.$store.state[this.appName]?.application;console.debug(`current application`,t);let n=y(this.applications,t);console.debug(`final application`,n),n&&(console.debug(`set final application`,n,n?.type),await this.$store.dispatch(`${this.appName}/setApplication`,n)),console.debug(`finished initialization`),this.initialized=!0},onApply(){this.onAutoApply()},async onAutoApply(){try{await g.create({type:x.USAGE,scope:S.GLOBAL,user_id:this.$store.getters.user.id}),this.applying=!1,await this.$store.dispatch(`getApplications`),this.showWelcomeToast()}catch(e){e?.response?.data?.code===`duplication`?await this.$store.dispatch(`getApplications`):C.error(this.$t(`application.message.applyFailed`))}},showWelcomeToast(){let e=this.$store.state.applications?.[0],t=Math.floor(e?.remaining_amount??0);C({message:t>0?this.$t(`application.message.welcomeWithCredits`,{credits:t}):this.$t(`application.message.welcomeNoCredits`),type:`success`,duration:6e3,showClose:!0})}}}),P={class:`wrapper`};function F(t,n,r,i,s,d){let f=u(`router-view`),p=u(`navigator`),m=u(`application-status`),h=u(`application-confirm`);return c(),e(`div`,P,[o(f,{class:`main`}),o(p,{class:`navigator`,direction:t.mobile?`row`:`column`},null,8,[`direction`]),t.application?(c(),a(m,{key:0,class:`status-floating fixed right-2 z-[200]`,application:t.application,applications:t.applications,"show-price":!1,authenticated:!!t.$store.state.token.access,service:t.service,onSelect:n[0]||=e=>t.$store.dispatch(`${t.appName}/setApplication`,e)},null,8,[`application`,`applications`,`authenticated`,`service`])):l(``,!0),o(h,{modelValue:t.applying,"onUpdate:modelValue":n[1]||=e=>t.applying=e,modelModifiers:{visible:!0},onApply:t.onApply},null,8,[`modelValue`,`onApply`])])}var I=_(N,[[`render`,F],[`__scopeId`,`data-v-41b86eb8`]]);export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as ee,Vt as s,Wt as c,Z as l,b as u,k as d,tt as f,ut as p}from"./vendor-chart-BJCvKk8-.js";import{t as m}from"./button-DfsQodL-.js";import{t as h}from"./upload--zrGs1_t.js";import{t as g}from"./image-cvBtti-L.js";import{t as _}from"./alert-OvnfgMB-.js";import{n as v,r as y}from"./radio-BmBXySlN.js";import{t as b}from"./switch-Cexn2Stk.js";import{t as x}from"./vendor-axios-Ck2ffRoh.js";import"./constants-CwLEZ_AF.js";import{E as S,Ir as C,J as w,Sr as T,kr as E,kt as te,qt as D}from"./index-CsXA6dkM.js";import{t as O}from"./index.es-D93UqOcB.js";import{t as k}from"./CopyToClipboard-C6tjXA6K.js";import{t as A}from"./Hailuo-DfkZ-KvV.js";import{t as j}from"./BotPlaceholder-CnFAaOE1.js";import{t as M}from"./TabSwitcher-2S5QWcoY.js";var N=4,P=90,F=r({name:`FishRecorder`,components:{ElButton:m,FontAwesomeIcon:O},emits:[`done`,`cancel`,`update:script`],data(){return{state:`idle`,scriptIndex:0,seconds:0,timerId:0,maxTimerId:0,mediaRecorder:null,stream:null,chunks:[],recordedBlob:null,recordedUrl:``,uploading:!1}},computed:{formattedTime(){let e=Math.floor(this.seconds/60),t=this.seconds%60;return`${e.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}`},currentScript(){let e=`fish.script.passage${this.scriptIndex%N+1}`;return this.$t(e)}},beforeUnmount(){this.cleanup()},mounted(){this.$emit(`update:script`,this.currentScript)},methods:{nextScript(){this.scriptIndex=(this.scriptIndex+1)%N,this.$emit(`update:script`,this.currentScript)},async startRecord(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){E.error(this.$t(`fish.message.recorderUnsupported`));return}try{this.stream=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){let t=e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`;E.error(this.$t(t?`fish.message.micDenied`:`fish.message.micError`));return}this.chunks=[];let e=this.pickMimeType();try{this.mediaRecorder=e?new MediaRecorder(this.stream,{mimeType:e}):new MediaRecorder(this.stream)}catch{this.mediaRecorder=new MediaRecorder(this.stream)}this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.chunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.chunks,{type:this.mediaRecorder?.mimeType||`audio/webm`});this.recordedBlob=e,this.recordedUrl=URL.createObjectURL(e),this.state=`recorded`,this.releaseStream()},this.mediaRecorder.start(),this.state=`recording`,this.seconds=0,this.timerId=window.setInterval(()=>{this.seconds++},1e3),this.maxTimerId=window.setTimeout(()=>{this.state===`recording`&&this.stopRecord()},P*1e3)},stopRecord(){this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),window.clearInterval(this.timerId),window.clearTimeout(this.maxTimerId)},reset(){this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl),this.recordedUrl=``,this.recordedBlob=null,this.state=`idle`,this.seconds=0},onCancel(){this.cleanup(),this.$emit(`cancel`)},cleanup(){this.stopRecord(),this.releaseStream(),this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl)},releaseStream(){this.stream?.getTracks().forEach(e=>e.stop()),this.stream=null},pickMimeType(){for(let e of[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg`])if(typeof MediaRecorder<`u`&&MediaRecorder.isTypeSupported?.(e))return e},extensionForMime(e){return e.includes(`webm`)?`webm`:e.includes(`mp4`)?`m4a`:e.includes(`ogg`)?`ogg`:e.includes(`wav`)?`wav`:`mp3`},async useRecording(){if(this.recordedBlob){if(this.seconds<3){E.warning(this.$t(`fish.message.recordingTooShort`));return}this.uploading=!0;try{let e=this.$store.state.token?.access,t=this.extensionForMime(this.recordedBlob.type||``),n=new File([this.recordedBlob],`recording-${Date.now()}.${t}`,{type:this.recordedBlob.type||`audio/webm`}),r=new FormData;r.append(`file`,n);let{data:i}=await x.post(`${T()}/api/v1/files/`,r,{headers:{Authorization:`Bearer ${e}`}}),a=i?.file_url;if(!a){E.error(this.$t(`fish.message.uploadError`));return}this.$emit(`done`,{url:a,text:this.currentScript})}catch(e){E.error(this.$t(`fish.message.uploadError`)),console.error(`recorder upload failed`,e)}finally{this.uploading=!1}}}}}),I={class:`recorder`},L={key:0,class:`script`},R={class:`script-header`},z={class:`label`},B={class:`script-text`},V={class:`controls`},H={class:`status`},U={class:`hint`},W={key:1,class:`preview`},G=[`src`],K={class:`preview-actions`},q={class:`footer`};function J(e,r,ee,u,m,h){let g=f(`font-awesome-icon`),_=f(`el-button`);return l(),t(`div`,I,[e.state===`recorded`?d(``,!0):(l(),t(`div`,L,[n(`div`,R,[o(g,{icon:`fa-solid fa-book-open`,class:`icon mr-1`}),n(`span`,z,c(e.$t(`fish.description.readScript`)),1),o(_,{link:``,size:`small`,class:`ml-auto`,disabled:e.state===`recording`,onClick:e.nextScript},{default:p(()=>[o(g,{icon:`fa-solid fa-shuffle`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.nextScript`)),1)]),_:1},8,[`disabled`,`onClick`])]),n(`p`,B,c(e.currentScript),1)])),n(`div`,V,[e.state===`idle`?(l(),a(_,{key:0,type:`danger`,circle:``,size:`large`,title:e.$t(`fish.button.startRecord`),onClick:e.startRecord},{default:p(()=>[o(g,{icon:`fa-solid fa-microphone`})]),_:1},8,[`title`,`onClick`])):e.state===`recording`?(l(),a(_,{key:1,type:`warning`,circle:``,size:`large`,title:e.$t(`fish.button.stopRecord`),onClick:e.stopRecord},{default:p(()=>[o(g,{icon:`fa-solid fa-stop`})]),_:1},8,[`title`,`onClick`])):d(``,!0),n(`div`,H,[n(`span`,{class:s([`timer`,e.state===`recording`?`live`:``])},c(e.formattedTime),3),n(`span`,U,c(e.state===`idle`?e.$t(`fish.description.recorderIdle`):e.state===`recording`?e.$t(`fish.description.recorderRecording`):e.$t(`fish.description.recorderRecorded`)),1)])]),e.state===`recorded`&&e.recordedUrl?(l(),t(`div`,W,[n(`audio`,{src:e.recordedUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,G),n(`div`,K,[o(_,{size:`small`,disabled:e.uploading,onClick:e.reset},{default:p(()=>[o(g,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.reRecord`)),1)]),_:1},8,[`disabled`,`onClick`]),o(_,{size:`small`,type:`primary`,loading:e.uploading,onClick:e.useRecording},{default:p(()=>[o(g,{icon:`fa-solid fa-check`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])])])):d(``,!0),n(`div`,q,[o(_,{link:``,size:`small`,disabled:e.uploading||e.state===`recording`,onClick:e.onCancel},{default:p(()=>[i(c(e.$t(`fish.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Y=S(F,[[`render`,J],[`__scopeId`,`data-v-1958e4a1`]]),X=50*1024*1024,Z=()=>({title:``,description:``,texts:``,voicesUrl:``,visibility:`unlist`,trainMode:`fast`,enhanceAudio:!0,generateSample:!1}),Q=r({name:`FishModelConfigPanel`,components:{ElButton:m,ElInput:C,ElRadioButton:v,ElRadioGroup:y,ElSwitch:b,ElUpload:h,FontAwesomeIcon:O,Recorder:Y},mixins:[te],emits:[`create`],data(){return{form:Z(),fileList:[],uploading:!1,creating:!1,recording:!1,textsAuto:!0}},computed:{uploadUrl(){return T()+`/api/v1/files/`},uploadHeaders(){return{Authorization:`Bearer ${this.$store.state.token?.access}`}},canCreate(){return!!this.form.title.trim()&&!!this.form.voicesUrl&&!this.uploading&&!this.creating},supportsRecorder(){return!!(typeof navigator<`u`?navigator.mediaDevices:void 0)?.getUserMedia&&typeof MediaRecorder<`u`}},methods:{onBeforeUpload(e){return e.size>X?(E.warning(this.$t(`fish.message.audioSizeExceed`)),!1):(this.uploading=!0,!0)},onExceed(){E.warning(this.$t(`fish.message.audioOnlyOne`))},onUploadError(){this.uploading=!1,E.error(this.$t(`fish.message.uploadError`))},onUploadSuccess(e,t,n){this.uploading=!1;let r=e?.file_url;if(!r){E.error(this.$t(`fish.message.uploadError`)),this.fileList=[];return}this.form.voicesUrl=r,this.fileList=n},onRecorded(e){this.form.voicesUrl=e.url,this.recording=!1,e.text&&this.textsAuto&&(this.form.texts=e.text)},onStartRecord(){this.recording=!0,this.textsAuto=!this.form.texts.trim()},onScriptChange(e){this.textsAuto&&this.recording&&(this.form.texts=e)},onTextsInput(){this.textsAuto=!1},clearAudio(){this.form.voicesUrl=``,this.fileList=[]},onCreate(){let e=this.form.title.trim();if(!e){E.warning(this.$t(`fish.message.titleRequired`));return}if(!this.form.voicesUrl){E.warning(this.$t(`fish.message.audioRequired`));return}let t={title:e,voices:this.form.voicesUrl,visibility:this.form.visibility,train_mode:this.form.trainMode,enhance_audio_quality:this.form.enhanceAudio,generate_sample:this.form.generateSample};this.form.description.trim()&&(t.description=this.form.description.trim()),this.form.texts.trim()&&(t.texts=[this.form.texts.trim()]),this.creating=!0,this.$emit(`create`,t),setTimeout(()=>{this.creating=!1,this.form=Z(),this.fileList=[]},600)}}}),ne={class:`flex flex-col h-full`},re={class:`flex-1 overflow-y-auto p-5`},ie={class:`field-block mb-4`},ae={class:`title font-bold`},oe={class:`field-block mb-4`},se={class:`flex items-baseline justify-between mb-1`},ce={class:`title font-bold`},le={key:0,class:`muted`},ue={class:`hint`},de={key:0,class:`audio-actions`},fe={key:1,class:`hint warn`},pe={key:3,class:`mt-2`},me=[`src`],he={class:`ready-actions`},ge={class:`field-block mb-4`},_e={class:`title font-bold`},ve={class:`hint`},ye={class:`field-block mb-4`},be={class:`title font-bold`},xe={class:`field-block mb-4`},Se={class:`title font-bold`},Ce={class:`field-block mb-4`},we={class:`title font-bold`},Te={class:`field-block mb-3`},Ee={class:`field-row`},De={class:`title font-bold`},Oe={class:`hint mt-0 mb-0`},ke={class:`field-block mb-2`},Ae={class:`field-row`},je={class:`title font-bold`},Me={class:`hint mt-0 mb-0`},Ne={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pe(e,r,ee,s,u,m){let h=f(`el-input`),g=f(`font-awesome-icon`),_=f(`el-button`),v=f(`el-upload`),y=f(`recorder`),b=f(`el-radio-button`),x=f(`el-radio-group`),S=f(`el-switch`);return l(),t(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`h2`,ae,[i(c(e.$t(`fish.name.voiceTitle`))+` `,1),r[9]||=n(`span`,{class:`required`},`*`,-1)]),o(h,{modelValue:e.form.title,"onUpdate:modelValue":r[0]||=t=>e.form.title=t,placeholder:e.$t(`fish.placeholder.voiceTitle`),maxlength:`60`},null,8,[`modelValue`,`placeholder`])]),n(`div`,oe,[n(`div`,se,[n(`h2`,ce,[i(c(e.$t(`fish.name.referenceAudio`))+` `,1),r[10]||=n(`span`,{class:`required`},`*`,-1)]),!e.form.voicesUrl&&!e.recording?(l(),t(`span`,le,c(e.$t(`fish.description.audioRequired`)),1)):d(``,!0)]),n(`p`,ue,c(e.$t(`fish.description.uploadAudio`)),1),!e.form.voicesUrl&&!e.recording?(l(),t(`div`,de,[o(v,{"file-list":e.fileList,"onUpdate:fileList":r[1]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,.ogg,.webm,audio/*`,"show-file-list":!1,"on-exceed":e.onExceed,"on-error":e.onUploadError,"on-success":e.onUploadSuccess,"before-upload":e.onBeforeUpload,headers:e.uploadHeaders},{default:p(()=>[o(_,{type:`primary`,plain:``,round:``,loading:e.uploading},{default:p(()=>[o(g,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+c(e.$t(`fish.button.uploadAudio`)),1)]),_:1},8,[`loading`])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`before-upload`,`headers`]),o(_,{type:`primary`,round:``,disabled:!e.supportsRecorder,onClick:e.onStartRecord},{default:p(()=>[o(g,{icon:`fa-solid fa-microphone`,class:`icon mr-1`}),i(` `+c(e.$t(`fish.button.recordAudio`)),1)]),_:1},8,[`disabled`,`onClick`])])):d(``,!0),!e.supportsRecorder&&!e.form.voicesUrl&&!e.recording?(l(),t(`p`,fe,c(e.$t(`fish.message.recorderUnsupported`)),1)):d(``,!0),e.recording?(l(),a(y,{key:2,class:`mt-2`,onDone:e.onRecorded,onCancel:r[2]||=t=>e.recording=!1,"onUpdate:script":e.onScriptChange},null,8,[`onDone`,`onUpdate:script`])):d(``,!0),e.form.voicesUrl&&!e.recording?(l(),t(`div`,pe,[n(`audio`,{src:e.form.voicesUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,me),n(`div`,he,[o(_,{link:``,size:`small`,onClick:e.clearAudio},{default:p(()=>[o(g,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.replaceAudio`)),1)]),_:1},8,[`onClick`])])])):d(``,!0)]),n(`div`,ge,[n(`h2`,_e,c(e.$t(`fish.name.audioTexts`)),1),n(`p`,ve,c(e.$t(`fish.description.audioTexts`)),1),o(h,{modelValue:e.form.texts,"onUpdate:modelValue":r[3]||=t=>e.form.texts=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.audioTexts`),maxlength:`500`,onInput:e.onTextsInput},null,8,[`modelValue`,`placeholder`,`onInput`])]),n(`div`,ye,[n(`h2`,be,c(e.$t(`fish.name.voiceDescription`)),1),o(h,{modelValue:e.form.description,"onUpdate:modelValue":r[4]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.voiceDescription`),maxlength:`500`},null,8,[`modelValue`,`placeholder`])]),n(`div`,xe,[n(`h2`,Se,c(e.$t(`fish.name.visibility`)),1),o(x,{modelValue:e.form.visibility,"onUpdate:modelValue":r[5]||=t=>e.form.visibility=t,size:`small`},{default:p(()=>[o(b,{label:`private`,value:`private`},{default:p(()=>[i(c(e.$t(`fish.value.private`)),1)]),_:1}),o(b,{label:`unlist`,value:`unlist`},{default:p(()=>[i(c(e.$t(`fish.value.unlist`)),1)]),_:1}),o(b,{label:`public`,value:`public`},{default:p(()=>[i(c(e.$t(`fish.value.public`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Ce,[n(`h2`,we,c(e.$t(`fish.name.trainMode`)),1),o(x,{modelValue:e.form.trainMode,"onUpdate:modelValue":r[6]||=t=>e.form.trainMode=t,size:`small`},{default:p(()=>[o(b,{label:`fast`,value:`fast`},{default:p(()=>[i(c(e.$t(`fish.value.trainModeFast`)),1)]),_:1}),o(b,{label:`precise`,value:`precise`},{default:p(()=>[i(c(e.$t(`fish.value.trainModePrecise`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Te,[n(`div`,Ee,[n(`h2`,De,c(e.$t(`fish.name.enhanceAudio`)),1),o(S,{modelValue:e.form.enhanceAudio,"onUpdate:modelValue":r[7]||=t=>e.form.enhanceAudio=t},null,8,[`modelValue`])]),n(`p`,Oe,c(e.$t(`fish.description.enhanceAudio`)),1)]),n(`div`,ke,[n(`div`,Ae,[n(`h2`,je,c(e.$t(`fish.name.generateSample`)),1),o(S,{modelValue:e.form.generateSample,"onUpdate:modelValue":r[8]||=t=>e.form.generateSample=t},null,8,[`modelValue`])]),n(`p`,Me,c(e.$t(`fish.description.generateSample`)),1)])]),n(`div`,Ne,[o(_,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canCreate||e.creating,loading:e.creating,onClick:e.onCreate},{default:p(()=>[o(g,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+c(e.$t(`fish.button.createModel`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])])])}var Fe=S(Q,[[`render`,Pe],[`__scopeId`,`data-v-d8fc0e55`]]),Ie=r({name:`FishVoiceCard`,components:{ElAlert:_,ElButton:m,ElImage:g,CopyToClipboard:k,FontAwesomeIcon:O},props:{modelValue:{type:Object,required:!0}},computed:{sampleAudioUrl(){let e=this.modelValue?.samples;if(e?.length)return e[0]?.audio},voiceId(){let e=this.modelValue;return(e?.id||e?._id||e?.reference_id||``).toString()},coverSrc(){let e=this.modelValue?.cover_image;return e&&typeof e==`string`?e:void 0},createdAtLabel(){let e=this.modelValue?.created_at;if(e==null||e===``)return null;let t=typeof e==`number`?e:parseFloat(String(e));return!Number.isFinite(t)||t<=0?null:this.$dayjs.format(``+new Date(t*1e3))}},methods:{onUseVoice(){let e=this.voiceId;e&&(this.$store.commit(`fish/setConfig`,{...this.$store.state.fish?.config,reference_id:e}),this.$router.push({name:w}))}}}),Le={class:`card`},Re={class:`left`},ze={class:`main`},Be={class:`header`},Ve={class:`title`},He={key:0,class:`datetime`},Ue={key:0,class:`description`},We={key:1,class:`sample mt-2`},Ge=[`src`],Ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qe={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Je={class:`operations mt-2`};function Ye(e,r,ee,s,m,h){let g=f(`el-image`),_=f(`font-awesome-icon`),v=f(`copy-to-clipboard`),y=f(`el-alert`),b=f(`el-button`);return l(),t(`div`,Le,[n(`div`,Re,[e.coverSrc?(l(),a(g,{key:0,src:e.coverSrc,class:`cover`,fit:`cover`},{error:p(()=>[o(g,{src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`})]),placeholder:p(()=>[...r[0]||=[n(`div`,{class:`cover placeholder`},null,-1)]]),_:1},8,[`src`])):(l(),a(g,{key:1,src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`}))]),n(`div`,ze,[n(`div`,Be,[n(`span`,Ve,c(e.modelValue?.title||e.$t(`fish.name.untitledVoice`)),1),e.createdAtLabel?(l(),t(`span`,He,c(e.createdAtLabel),1)):d(``,!0)]),e.modelValue?.description?(l(),t(`p`,Ue,c(e.modelValue?.description),1)):d(``,!0),e.sampleAudioUrl?(l(),t(`div`,We,[n(`audio`,{src:e.sampleAudioUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,Ge)])):d(``,!0),o(y,{closable:!1,class:`mt-2 success`},{default:p(()=>[e.voiceId?(l(),t(`p`,Ke,[o(_,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+c(e.$t(`fish.name.referenceId`))+`: `+c(e.voiceId)+` `,1),o(v,{content:e.voiceId},null,8,[`content`])])):d(``,!0),e.modelValue?.visibility?(l(),t(`p`,qe,[o(_,{icon:`fa-solid fa-eye`,class:`mr-1`}),i(` `+c(e.$t(`fish.name.visibility`))+`: `+c(e.modelValue?.visibility),1)])):d(``,!0)]),_:1}),n(`div`,Je,[o(b,{type:`primary`,size:`small`,plain:``,disabled:!e.voiceId,onClick:u(e.onUseVoice,[`stop`])},{default:p(()=>[o(_,{icon:`fa-solid fa-volume-high`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.useVoice`)),1)]),_:1},8,[`disabled`,`onClick`])])])])}var Xe=r({name:`FishModelListPanel`,components:{VoiceCard:S(Ie,[[`render`,Ye],[`__scopeId`,`data-v-629e2d04`]]),BotPlaceholder:j,FontAwesomeIcon:O},props:{loading:{type:Boolean,default:!1}},computed:{voices(){return this.$store.state.fish?.voices}}}),Ze={class:`model-list-panel flex flex-col h-full`},Qe={class:`header`},$e={class:`title`},et={key:0,class:`count`},tt={class:`body flex-1 min-h-0`},$={key:0,class:`h-full`},nt={key:1,class:`w-full h-full flex flex-col items-center justify-center text-center px-6`},rt={class:`empty-title`},it={class:`empty-hint`},at={key:2,class:`w-full h-full overflow-y-auto pr-1`};function ot(r,i,s,u,p,m){let h=f(`bot-placeholder`),g=f(`font-awesome-icon`),_=f(`voice-card`);return l(),t(`div`,Ze,[n(`header`,Qe,[n(`h2`,$e,c(r.$t(`fish.title.myVoices`)),1),r.voices?.length?(l(),t(`span`,et,c(r.voices?.length),1)):d(``,!0)]),n(`div`,tt,[r.voices===void 0?(l(),t(`div`,$,[o(h)])):r.voices.length===0?(l(),t(`div`,nt,[o(g,{icon:`fa-solid fa-microphone-lines`,class:`empty-icon`}),n(`p`,rt,c(r.$t(`fish.title.noVoicesYet`)),1),n(`p`,it,c(r.$t(`fish.description.noVoicesYet`)),1)])):(l(),t(`div`,at,[(l(!0),t(ee,null,e(r.voices,e=>(l(),a(_,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]))])])}var st=r({name:`FishModelIndex`,components:{ModelConfigPanel:Fe,Layout:A,ModelListPanel:S(Xe,[[`render`,ot],[`__scopeId`,`data-v-4aab2294`]]),TabSwitcher:M},inject:[`initialized`],data(){return{loading:!1}},computed:{credential(){return this.$store.state.fish?.credential}},watch:{initialized:{async handler(e){e&&await this.onGetVoices()},immediate:!0}},async mounted(){await this.onGetService()},methods:{async onGetService(){await this.$store.dispatch(`fish/getService`)},async onGetVoices(){await this.$store.dispatch(`fish/getVoices`)},async onCreate(e){let t=this.credential?.token;if(!t){console.error(`no token specified`);return}this.loading=!0,E.info(this.$t(`fish.message.creatingModel`));try{await D.createModel(e,{token:t}),E.success(this.$t(`fish.message.createModelSuccess`)),await this.onGetVoices()}catch(e){let t=e?.response?.data;t?.error?.code===`used_up`?E.error(this.$t(`fish.message.usedUp`)):E.error(t?.error?.message||this.$t(`fish.message.createModelFailed`))}finally{this.loading=!1}}}}),ct={class:`flex flex-col h-full`},lt={class:`flex-1 min-h-0`};function ut(e,t,r,i,ee,s){let c=f(`tab-switcher`),u=f(`model-config-panel`),d=f(`model-list-panel`),m=f(`layout`);return l(),a(m,null,{config:p(()=>[n(`div`,ct,[o(c),n(`div`,lt,[o(u,{onCreate:e.onCreate},null,8,[`onCreate`])])])]),result:p(()=>[o(d,{loading:e.loading},null,8,[`loading`])]),_:1})}var dt=S(st,[[`render`,ut]]);export{dt as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,A as t,D as n,F as r,N as i,O as a,P as o,S as ee,Vt as s,Wt as c,Z as l,b as u,k as d,tt as f,ut as p}from"./vendor-chart-BJCvKk8-.js";import{t as m}from"./button-DfsQodL-.js";import{t as h}from"./upload-PztQKfjm.js";import{t as g}from"./image-OB0St7Yu.js";import{t as _}from"./alert-OvnfgMB-.js";import{n as v,r as y}from"./radio-BmBXySlN.js";import{t as b}from"./switch-B2HtIflI.js";import{t as x}from"./vendor-axios-Ck2ffRoh.js";import"./constants-CwLEZ_AF.js";import{E as S,Ir as C,J as w,Sr as T,kr as E,kt as te,qt as D}from"./index-CTMytxLX.js";import{t as O}from"./index.es-DsMKNIuW.js";import{t as k}from"./CopyToClipboard-CRnka5tK.js";import{t as A}from"./Hailuo-BgqAqO-q.js";import{t as j}from"./BotPlaceholder-C1UVVId0.js";import{t as M}from"./TabSwitcher-DuAqLxUz.js";var N=4,P=90,F=r({name:`FishRecorder`,components:{ElButton:m,FontAwesomeIcon:O},emits:[`done`,`cancel`,`update:script`],data(){return{state:`idle`,scriptIndex:0,seconds:0,timerId:0,maxTimerId:0,mediaRecorder:null,stream:null,chunks:[],recordedBlob:null,recordedUrl:``,uploading:!1}},computed:{formattedTime(){let e=Math.floor(this.seconds/60),t=this.seconds%60;return`${e.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}`},currentScript(){let e=`fish.script.passage${this.scriptIndex%N+1}`;return this.$t(e)}},beforeUnmount(){this.cleanup()},mounted(){this.$emit(`update:script`,this.currentScript)},methods:{nextScript(){this.scriptIndex=(this.scriptIndex+1)%N,this.$emit(`update:script`,this.currentScript)},async startRecord(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){E.error(this.$t(`fish.message.recorderUnsupported`));return}try{this.stream=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){let t=e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`;E.error(this.$t(t?`fish.message.micDenied`:`fish.message.micError`));return}this.chunks=[];let e=this.pickMimeType();try{this.mediaRecorder=e?new MediaRecorder(this.stream,{mimeType:e}):new MediaRecorder(this.stream)}catch{this.mediaRecorder=new MediaRecorder(this.stream)}this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.chunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.chunks,{type:this.mediaRecorder?.mimeType||`audio/webm`});this.recordedBlob=e,this.recordedUrl=URL.createObjectURL(e),this.state=`recorded`,this.releaseStream()},this.mediaRecorder.start(),this.state=`recording`,this.seconds=0,this.timerId=window.setInterval(()=>{this.seconds++},1e3),this.maxTimerId=window.setTimeout(()=>{this.state===`recording`&&this.stopRecord()},P*1e3)},stopRecord(){this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),window.clearInterval(this.timerId),window.clearTimeout(this.maxTimerId)},reset(){this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl),this.recordedUrl=``,this.recordedBlob=null,this.state=`idle`,this.seconds=0},onCancel(){this.cleanup(),this.$emit(`cancel`)},cleanup(){this.stopRecord(),this.releaseStream(),this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl)},releaseStream(){this.stream?.getTracks().forEach(e=>e.stop()),this.stream=null},pickMimeType(){for(let e of[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg`])if(typeof MediaRecorder<`u`&&MediaRecorder.isTypeSupported?.(e))return e},extensionForMime(e){return e.includes(`webm`)?`webm`:e.includes(`mp4`)?`m4a`:e.includes(`ogg`)?`ogg`:e.includes(`wav`)?`wav`:`mp3`},async useRecording(){if(this.recordedBlob){if(this.seconds<3){E.warning(this.$t(`fish.message.recordingTooShort`));return}this.uploading=!0;try{let e=this.$store.state.token?.access,t=this.extensionForMime(this.recordedBlob.type||``),n=new File([this.recordedBlob],`recording-${Date.now()}.${t}`,{type:this.recordedBlob.type||`audio/webm`}),r=new FormData;r.append(`file`,n);let{data:i}=await x.post(`${T()}/api/v1/files/`,r,{headers:{Authorization:`Bearer ${e}`}}),a=i?.file_url;if(!a){E.error(this.$t(`fish.message.uploadError`));return}this.$emit(`done`,{url:a,text:this.currentScript})}catch(e){E.error(this.$t(`fish.message.uploadError`)),console.error(`recorder upload failed`,e)}finally{this.uploading=!1}}}}}),I={class:`recorder`},L={key:0,class:`script`},R={class:`script-header`},z={class:`label`},B={class:`script-text`},V={class:`controls`},H={class:`status`},U={class:`hint`},W={key:1,class:`preview`},G=[`src`],K={class:`preview-actions`},q={class:`footer`};function J(e,r,ee,u,m,h){let g=f(`font-awesome-icon`),_=f(`el-button`);return l(),t(`div`,I,[e.state===`recorded`?d(``,!0):(l(),t(`div`,L,[n(`div`,R,[o(g,{icon:`fa-solid fa-book-open`,class:`icon mr-1`}),n(`span`,z,c(e.$t(`fish.description.readScript`)),1),o(_,{link:``,size:`small`,class:`ml-auto`,disabled:e.state===`recording`,onClick:e.nextScript},{default:p(()=>[o(g,{icon:`fa-solid fa-shuffle`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.nextScript`)),1)]),_:1},8,[`disabled`,`onClick`])]),n(`p`,B,c(e.currentScript),1)])),n(`div`,V,[e.state===`idle`?(l(),a(_,{key:0,type:`danger`,circle:``,size:`large`,title:e.$t(`fish.button.startRecord`),onClick:e.startRecord},{default:p(()=>[o(g,{icon:`fa-solid fa-microphone`})]),_:1},8,[`title`,`onClick`])):e.state===`recording`?(l(),a(_,{key:1,type:`warning`,circle:``,size:`large`,title:e.$t(`fish.button.stopRecord`),onClick:e.stopRecord},{default:p(()=>[o(g,{icon:`fa-solid fa-stop`})]),_:1},8,[`title`,`onClick`])):d(``,!0),n(`div`,H,[n(`span`,{class:s([`timer`,e.state===`recording`?`live`:``])},c(e.formattedTime),3),n(`span`,U,c(e.state===`idle`?e.$t(`fish.description.recorderIdle`):e.state===`recording`?e.$t(`fish.description.recorderRecording`):e.$t(`fish.description.recorderRecorded`)),1)])]),e.state===`recorded`&&e.recordedUrl?(l(),t(`div`,W,[n(`audio`,{src:e.recordedUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,G),n(`div`,K,[o(_,{size:`small`,disabled:e.uploading,onClick:e.reset},{default:p(()=>[o(g,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.reRecord`)),1)]),_:1},8,[`disabled`,`onClick`]),o(_,{size:`small`,type:`primary`,loading:e.uploading,onClick:e.useRecording},{default:p(()=>[o(g,{icon:`fa-solid fa-check`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])])])):d(``,!0),n(`div`,q,[o(_,{link:``,size:`small`,disabled:e.uploading||e.state===`recording`,onClick:e.onCancel},{default:p(()=>[i(c(e.$t(`fish.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Y=S(F,[[`render`,J],[`__scopeId`,`data-v-1958e4a1`]]),X=50*1024*1024,Z=()=>({title:``,description:``,texts:``,voicesUrl:``,visibility:`unlist`,trainMode:`fast`,enhanceAudio:!0,generateSample:!1}),Q=r({name:`FishModelConfigPanel`,components:{ElButton:m,ElInput:C,ElRadioButton:v,ElRadioGroup:y,ElSwitch:b,ElUpload:h,FontAwesomeIcon:O,Recorder:Y},mixins:[te],emits:[`create`],data(){return{form:Z(),fileList:[],uploading:!1,creating:!1,recording:!1,textsAuto:!0}},computed:{uploadUrl(){return T()+`/api/v1/files/`},uploadHeaders(){return{Authorization:`Bearer ${this.$store.state.token?.access}`}},canCreate(){return!!this.form.title.trim()&&!!this.form.voicesUrl&&!this.uploading&&!this.creating},supportsRecorder(){return!!(typeof navigator<`u`?navigator.mediaDevices:void 0)?.getUserMedia&&typeof MediaRecorder<`u`}},methods:{onBeforeUpload(e){return e.size>X?(E.warning(this.$t(`fish.message.audioSizeExceed`)),!1):(this.uploading=!0,!0)},onExceed(){E.warning(this.$t(`fish.message.audioOnlyOne`))},onUploadError(){this.uploading=!1,E.error(this.$t(`fish.message.uploadError`))},onUploadSuccess(e,t,n){this.uploading=!1;let r=e?.file_url;if(!r){E.error(this.$t(`fish.message.uploadError`)),this.fileList=[];return}this.form.voicesUrl=r,this.fileList=n},onRecorded(e){this.form.voicesUrl=e.url,this.recording=!1,e.text&&this.textsAuto&&(this.form.texts=e.text)},onStartRecord(){this.recording=!0,this.textsAuto=!this.form.texts.trim()},onScriptChange(e){this.textsAuto&&this.recording&&(this.form.texts=e)},onTextsInput(){this.textsAuto=!1},clearAudio(){this.form.voicesUrl=``,this.fileList=[]},onCreate(){let e=this.form.title.trim();if(!e){E.warning(this.$t(`fish.message.titleRequired`));return}if(!this.form.voicesUrl){E.warning(this.$t(`fish.message.audioRequired`));return}let t={title:e,voices:this.form.voicesUrl,visibility:this.form.visibility,train_mode:this.form.trainMode,enhance_audio_quality:this.form.enhanceAudio,generate_sample:this.form.generateSample};this.form.description.trim()&&(t.description=this.form.description.trim()),this.form.texts.trim()&&(t.texts=[this.form.texts.trim()]),this.creating=!0,this.$emit(`create`,t),setTimeout(()=>{this.creating=!1,this.form=Z(),this.fileList=[]},600)}}}),ne={class:`flex flex-col h-full`},re={class:`flex-1 overflow-y-auto p-5`},ie={class:`field-block mb-4`},ae={class:`title font-bold`},oe={class:`field-block mb-4`},se={class:`flex items-baseline justify-between mb-1`},ce={class:`title font-bold`},le={key:0,class:`muted`},ue={class:`hint`},de={key:0,class:`audio-actions`},fe={key:1,class:`hint warn`},pe={key:3,class:`mt-2`},me=[`src`],he={class:`ready-actions`},ge={class:`field-block mb-4`},_e={class:`title font-bold`},ve={class:`hint`},ye={class:`field-block mb-4`},be={class:`title font-bold`},xe={class:`field-block mb-4`},Se={class:`title font-bold`},Ce={class:`field-block mb-4`},we={class:`title font-bold`},Te={class:`field-block mb-3`},Ee={class:`field-row`},De={class:`title font-bold`},Oe={class:`hint mt-0 mb-0`},ke={class:`field-block mb-2`},Ae={class:`field-row`},je={class:`title font-bold`},Me={class:`hint mt-0 mb-0`},Ne={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pe(e,r,ee,s,u,m){let h=f(`el-input`),g=f(`font-awesome-icon`),_=f(`el-button`),v=f(`el-upload`),y=f(`recorder`),b=f(`el-radio-button`),x=f(`el-radio-group`),S=f(`el-switch`);return l(),t(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`h2`,ae,[i(c(e.$t(`fish.name.voiceTitle`))+` `,1),r[9]||=n(`span`,{class:`required`},`*`,-1)]),o(h,{modelValue:e.form.title,"onUpdate:modelValue":r[0]||=t=>e.form.title=t,placeholder:e.$t(`fish.placeholder.voiceTitle`),maxlength:`60`},null,8,[`modelValue`,`placeholder`])]),n(`div`,oe,[n(`div`,se,[n(`h2`,ce,[i(c(e.$t(`fish.name.referenceAudio`))+` `,1),r[10]||=n(`span`,{class:`required`},`*`,-1)]),!e.form.voicesUrl&&!e.recording?(l(),t(`span`,le,c(e.$t(`fish.description.audioRequired`)),1)):d(``,!0)]),n(`p`,ue,c(e.$t(`fish.description.uploadAudio`)),1),!e.form.voicesUrl&&!e.recording?(l(),t(`div`,de,[o(v,{"file-list":e.fileList,"onUpdate:fileList":r[1]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,.ogg,.webm,audio/*`,"show-file-list":!1,"on-exceed":e.onExceed,"on-error":e.onUploadError,"on-success":e.onUploadSuccess,"before-upload":e.onBeforeUpload,headers:e.uploadHeaders},{default:p(()=>[o(_,{type:`primary`,plain:``,round:``,loading:e.uploading},{default:p(()=>[o(g,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),i(` `+c(e.$t(`fish.button.uploadAudio`)),1)]),_:1},8,[`loading`])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`before-upload`,`headers`]),o(_,{type:`primary`,round:``,disabled:!e.supportsRecorder,onClick:e.onStartRecord},{default:p(()=>[o(g,{icon:`fa-solid fa-microphone`,class:`icon mr-1`}),i(` `+c(e.$t(`fish.button.recordAudio`)),1)]),_:1},8,[`disabled`,`onClick`])])):d(``,!0),!e.supportsRecorder&&!e.form.voicesUrl&&!e.recording?(l(),t(`p`,fe,c(e.$t(`fish.message.recorderUnsupported`)),1)):d(``,!0),e.recording?(l(),a(y,{key:2,class:`mt-2`,onDone:e.onRecorded,onCancel:r[2]||=t=>e.recording=!1,"onUpdate:script":e.onScriptChange},null,8,[`onDone`,`onUpdate:script`])):d(``,!0),e.form.voicesUrl&&!e.recording?(l(),t(`div`,pe,[n(`audio`,{src:e.form.voicesUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,me),n(`div`,he,[o(_,{link:``,size:`small`,onClick:e.clearAudio},{default:p(()=>[o(g,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.replaceAudio`)),1)]),_:1},8,[`onClick`])])])):d(``,!0)]),n(`div`,ge,[n(`h2`,_e,c(e.$t(`fish.name.audioTexts`)),1),n(`p`,ve,c(e.$t(`fish.description.audioTexts`)),1),o(h,{modelValue:e.form.texts,"onUpdate:modelValue":r[3]||=t=>e.form.texts=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.audioTexts`),maxlength:`500`,onInput:e.onTextsInput},null,8,[`modelValue`,`placeholder`,`onInput`])]),n(`div`,ye,[n(`h2`,be,c(e.$t(`fish.name.voiceDescription`)),1),o(h,{modelValue:e.form.description,"onUpdate:modelValue":r[4]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.voiceDescription`),maxlength:`500`},null,8,[`modelValue`,`placeholder`])]),n(`div`,xe,[n(`h2`,Se,c(e.$t(`fish.name.visibility`)),1),o(x,{modelValue:e.form.visibility,"onUpdate:modelValue":r[5]||=t=>e.form.visibility=t,size:`small`},{default:p(()=>[o(b,{label:`private`,value:`private`},{default:p(()=>[i(c(e.$t(`fish.value.private`)),1)]),_:1}),o(b,{label:`unlist`,value:`unlist`},{default:p(()=>[i(c(e.$t(`fish.value.unlist`)),1)]),_:1}),o(b,{label:`public`,value:`public`},{default:p(()=>[i(c(e.$t(`fish.value.public`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Ce,[n(`h2`,we,c(e.$t(`fish.name.trainMode`)),1),o(x,{modelValue:e.form.trainMode,"onUpdate:modelValue":r[6]||=t=>e.form.trainMode=t,size:`small`},{default:p(()=>[o(b,{label:`fast`,value:`fast`},{default:p(()=>[i(c(e.$t(`fish.value.trainModeFast`)),1)]),_:1}),o(b,{label:`precise`,value:`precise`},{default:p(()=>[i(c(e.$t(`fish.value.trainModePrecise`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Te,[n(`div`,Ee,[n(`h2`,De,c(e.$t(`fish.name.enhanceAudio`)),1),o(S,{modelValue:e.form.enhanceAudio,"onUpdate:modelValue":r[7]||=t=>e.form.enhanceAudio=t},null,8,[`modelValue`])]),n(`p`,Oe,c(e.$t(`fish.description.enhanceAudio`)),1)]),n(`div`,ke,[n(`div`,Ae,[n(`h2`,je,c(e.$t(`fish.name.generateSample`)),1),o(S,{modelValue:e.form.generateSample,"onUpdate:modelValue":r[8]||=t=>e.form.generateSample=t},null,8,[`modelValue`])]),n(`p`,Me,c(e.$t(`fish.description.generateSample`)),1)])]),n(`div`,Ne,[o(_,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canCreate||e.creating,loading:e.creating,onClick:e.onCreate},{default:p(()=>[o(g,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+c(e.$t(`fish.button.createModel`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])])])}var Fe=S(Q,[[`render`,Pe],[`__scopeId`,`data-v-d8fc0e55`]]),Ie=r({name:`FishVoiceCard`,components:{ElAlert:_,ElButton:m,ElImage:g,CopyToClipboard:k,FontAwesomeIcon:O},props:{modelValue:{type:Object,required:!0}},computed:{sampleAudioUrl(){let e=this.modelValue?.samples;if(e?.length)return e[0]?.audio},voiceId(){let e=this.modelValue;return(e?.id||e?._id||e?.reference_id||``).toString()},coverSrc(){let e=this.modelValue?.cover_image;return e&&typeof e==`string`?e:void 0},createdAtLabel(){let e=this.modelValue?.created_at;if(e==null||e===``)return null;let t=typeof e==`number`?e:parseFloat(String(e));return!Number.isFinite(t)||t<=0?null:this.$dayjs.format(``+new Date(t*1e3))}},methods:{onUseVoice(){let e=this.voiceId;e&&(this.$store.commit(`fish/setConfig`,{...this.$store.state.fish?.config,reference_id:e}),this.$router.push({name:w}))}}}),Le={class:`card`},Re={class:`left`},ze={class:`main`},Be={class:`header`},Ve={class:`title`},He={key:0,class:`datetime`},Ue={key:0,class:`description`},We={key:1,class:`sample mt-2`},Ge=[`src`],Ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qe={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Je={class:`operations mt-2`};function Ye(e,r,ee,s,m,h){let g=f(`el-image`),_=f(`font-awesome-icon`),v=f(`copy-to-clipboard`),y=f(`el-alert`),b=f(`el-button`);return l(),t(`div`,Le,[n(`div`,Re,[e.coverSrc?(l(),a(g,{key:0,src:e.coverSrc,class:`cover`,fit:`cover`},{error:p(()=>[o(g,{src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`})]),placeholder:p(()=>[...r[0]||=[n(`div`,{class:`cover placeholder`},null,-1)]]),_:1},8,[`src`])):(l(),a(g,{key:1,src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`}))]),n(`div`,ze,[n(`div`,Be,[n(`span`,Ve,c(e.modelValue?.title||e.$t(`fish.name.untitledVoice`)),1),e.createdAtLabel?(l(),t(`span`,He,c(e.createdAtLabel),1)):d(``,!0)]),e.modelValue?.description?(l(),t(`p`,Ue,c(e.modelValue?.description),1)):d(``,!0),e.sampleAudioUrl?(l(),t(`div`,We,[n(`audio`,{src:e.sampleAudioUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,Ge)])):d(``,!0),o(y,{closable:!1,class:`mt-2 success`},{default:p(()=>[e.voiceId?(l(),t(`p`,Ke,[o(_,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+c(e.$t(`fish.name.referenceId`))+`: `+c(e.voiceId)+` `,1),o(v,{content:e.voiceId},null,8,[`content`])])):d(``,!0),e.modelValue?.visibility?(l(),t(`p`,qe,[o(_,{icon:`fa-solid fa-eye`,class:`mr-1`}),i(` `+c(e.$t(`fish.name.visibility`))+`: `+c(e.modelValue?.visibility),1)])):d(``,!0)]),_:1}),n(`div`,Je,[o(b,{type:`primary`,size:`small`,plain:``,disabled:!e.voiceId,onClick:u(e.onUseVoice,[`stop`])},{default:p(()=>[o(_,{icon:`fa-solid fa-volume-high`,class:`mr-1`}),i(` `+c(e.$t(`fish.button.useVoice`)),1)]),_:1},8,[`disabled`,`onClick`])])])])}var Xe=r({name:`FishModelListPanel`,components:{VoiceCard:S(Ie,[[`render`,Ye],[`__scopeId`,`data-v-629e2d04`]]),BotPlaceholder:j,FontAwesomeIcon:O},props:{loading:{type:Boolean,default:!1}},computed:{voices(){return this.$store.state.fish?.voices}}}),Ze={class:`model-list-panel flex flex-col h-full`},Qe={class:`header`},$e={class:`title`},et={key:0,class:`count`},tt={class:`body flex-1 min-h-0`},$={key:0,class:`h-full`},nt={key:1,class:`w-full h-full flex flex-col items-center justify-center text-center px-6`},rt={class:`empty-title`},it={class:`empty-hint`},at={key:2,class:`w-full h-full overflow-y-auto pr-1`};function ot(r,i,s,u,p,m){let h=f(`bot-placeholder`),g=f(`font-awesome-icon`),_=f(`voice-card`);return l(),t(`div`,Ze,[n(`header`,Qe,[n(`h2`,$e,c(r.$t(`fish.title.myVoices`)),1),r.voices?.length?(l(),t(`span`,et,c(r.voices?.length),1)):d(``,!0)]),n(`div`,tt,[r.voices===void 0?(l(),t(`div`,$,[o(h)])):r.voices.length===0?(l(),t(`div`,nt,[o(g,{icon:`fa-solid fa-microphone-lines`,class:`empty-icon`}),n(`p`,rt,c(r.$t(`fish.title.noVoicesYet`)),1),n(`p`,it,c(r.$t(`fish.description.noVoicesYet`)),1)])):(l(),t(`div`,at,[(l(!0),t(ee,null,e(r.voices,e=>(l(),a(_,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]))])])}var st=r({name:`FishModelIndex`,components:{ModelConfigPanel:Fe,Layout:A,ModelListPanel:S(Xe,[[`render`,ot],[`__scopeId`,`data-v-4aab2294`]]),TabSwitcher:M},inject:[`initialized`],data(){return{loading:!1}},computed:{credential(){return this.$store.state.fish?.credential}},watch:{initialized:{async handler(e){e&&await this.onGetVoices()},immediate:!0}},async mounted(){await this.onGetService()},methods:{async onGetService(){await this.$store.dispatch(`fish/getService`)},async onGetVoices(){await this.$store.dispatch(`fish/getVoices`)},async onCreate(e){let t=this.credential?.token;if(!t){console.error(`no token specified`);return}this.loading=!0,E.info(this.$t(`fish.message.creatingModel`));try{await D.createModel(e,{token:t}),E.success(this.$t(`fish.message.createModelSuccess`)),await this.onGetVoices()}catch(e){let t=e?.response?.data;t?.error?.code===`used_up`?E.error(this.$t(`fish.message.usedUp`)):E.error(t?.error?.message||this.$t(`fish.message.createModelFailed`))}finally{this.loading=!1}}}}),ct={class:`flex flex-col h-full`},lt={class:`flex-1 min-h-0`};function ut(e,t,r,i,ee,s){let c=f(`tab-switcher`),u=f(`model-config-panel`),d=f(`model-list-panel`),m=f(`layout`);return l(),a(m,null,{config:p(()=>[n(`div`,ct,[o(c),n(`div`,lt,[o(u,{onCreate:e.onCreate},null,8,[`onCreate`])])])]),result:p(()=>[o(d,{loading:e.loading},null,8,[`loading`])]),_:1})}var dt=S(st,[[`render`,ut]]);export{dt as default};
|