var t=Object.defineProperty,e=(e,a,r)=>((e,a,r)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r)(e,"symbol"!=typeof a?a+"":a,r);import{D as a}from"./vendor-Bsarx7Le.js";class r{constructor(t){e(this,"table"),this.table=t}async save(t){return await this.table.put(t)}async bulkSave(t){return await this.table.bulkPut(t)}async findById(t){return await this.table.get(t)}async delete(t){return await this.table.delete(t)}async clear(){return await this.table.clear()}async getPage(t,e,a,r=!0){const s=(e-1)*a;let i=this.table.orderBy(t);return r&&(i=i.reverse()),await i.offset(s).limit(a).toArray()}}const s=new class extends a{constructor(){super("SouavDatabase"),e(this,"history"),this.version(1).stores({history:"&contentId, updatedAt"})}};const i=new class extends r{constructor(){super(s.history)}async putLocalRecord(t){const e={contentId:t.contentId,title:t.title||"",img:t.img||"",updatedAt:Date.now(),barrage:t.barrage||""};await this.save(e)}async getWatchRecordList(){return await this.table.orderBy("updatedAt").reverse().toArray()}async getWatchRecordListPaged(t,e){return this.getPage("updatedAt",t,e,!0)}async deleteLocalRecord(t){await this.delete(t)}async deleteLocalRecordList(t){await this.table.bulkDelete(t)}async clearAll(){await this.clear()}};export{i as w};
