"use strict";(globalThis.webpackChunkinfinity_hitab_client=globalThis.webpackChunkinfinity_hitab_client||[]).push([[2168],{72168:(t,i,s)=>{s.r(i),s.d(i,{useHistoryStore:()=>P,widgetInfo:()=>d});var e=s(10435),a=s(84522),h=s(74003),o=s(79664);var r=s(80661),n=s.n(r),l=s(94119),y=s(24581),c=s(63477),g=s(73844),m=s(57268),u=s(37587);const d=(0,m.Fl)((()=>(0,u.E)(y.R.history))),P=(0,e.Q_)(a.BU.history,{syncStorage:{watch:["historyList","lastTime","homePageNum"]},state:()=>({modalShow:!1,historyList:[],lastTime:0,homePageNum:1,homePageData:{}}),actions:{setModal(t){l.G.setStatus(y.R.history,t),this.modalShow=t},check(){var t;n()().isAfter(this.lastTime,"day")?this.queryHistoryList(n()().format("M/D")):this.getHistoryDetail(null===(t=this.historyList[this.homePageNum-1])||void 0===t?void 0:t.e_id)},async lastPage(){this.homePageNum>1&&(this.homePageNum-=1,this.homePageData=(await this.getHistoryDetail(this.historyList[this.homePageNum-1].e_id))[0])},async nextPage(){this.homePageNum<this.historyList.length&&(this.homePageNum+=1,this.homePageData=(await this.getHistoryDetail(this.historyList[this.homePageNum-1].e_id))[0])},async queryHistoryList(t){const[i,s]=await(async t=>{try{const i=await o.hj.get(`${h.H}history/list`,{date:t},{_delay:0});if(0===i.code&&i.data.length>0)return[null,i.data];throw i}catch(t){return["catch error"]}})(t);var e;i||(this.lastTime=Date.now(),this.homePageNum=1,this.historyList=s||[],this.getHistoryDetail(null===(e=this.historyList[this.homePageNum-1])||void 0===e?void 0:e.e_id))},async getHistoryDetail(t){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const s=this.historyList.findIndex((i=>i.e_id===t));let e;if(s>=0&&(e=this.historyList[s],e.content))return i&&(this.homePageData=e),[e];const[a,r=[]]=await(async t=>{try{const i=await o.hj.get(`${h.H}history/detail`,{id:t},{_delay:0});if(0===i.code&&i.data.length>0)return[null,i.data];throw i}catch(t){return["catch error"]}})(t);if(!a){var n;if(i)r[0].picUrl.length>0&&await(0,c.pt)(null===(n=r[0].picUrl[0])||void 0===n?void 0:n.url),this.homePageData=r[0];if(e){const t=JSON.parse(JSON.stringify(this.historyList));t[s]=Object.assign(e,r[0]),this.historyList=t}return r||[]}return[]}}});g.i.subscribe("EVERY_DAY",(()=>{P().queryHistoryList(n()().format("M/D"))}))}}]);