PageSourceSearch

https://shop.fcdynamo.ru/shop_assets/assets/favorite.BU-axKdY.js

js fcdynamo.ru collected 2026-10-02 04:18:02 UTC 2,019 bytes, 1 lines download raw bytes

1import{n as e}from"./pinia.BKJyjgkF.js";import{t}from"./app.zvVM5SnY.js";import{n}from"./client.B3O3p_P-.js";import{t as r}from"./user.uknqhG_s.js";import"./utils.x9ke8ISR.js";var i={uuids(){return n.get(`favorites`).then(e=>e.data.data)},add(e){return n.post(`favorites/`+e).then(e=>e.data.data)},remove(e){return n.delete(`favorites/`+e).then(e=>e.data.data)},bulkAdd(e){return n.post(`favorites/bulk-add`,e).then(e=>e.data.data)}},a=e(`favorite`,{state:()=>({items:[],isLoading:!1}),getters:{isAvailable:()=>!t().isMiniApp},actions:{async init(){if(!this.isLoading&&this.isAvailable){this.isLoading=!0;try{let e=r(),t=this.getLocalItems();if(!e.authenticated){this.items=t;return}let n=await i.uuids()??[],a=t.filter(e=>!n.includes(e));a.length>0&&await i.bulkAdd({uuids:a}),this.items=[...new Set([...n,...a])],this.saveToLocalStorage()}catch(e){console.warn(`Failed to init favorites:`,e),this.items=this.getLocalItems()}finally{this.isLoading=!1}}},async add(e){if(e&&this.isAvailable){if(this.checkItem(e))this.remove(e);else if(this.items.push(e),this.saveToLocalStorage(),r().authenticated)try{await i.add(e)}catch(e){console.warn(`add:`,e)}}},async remove(e){if(e&&this.isAvailable&&this.checkItem(e)&&(this.items=this.items.filter(t=>t!==e),this.saveToLocalStorage(),r().authenticated))try{await i.remove(e)}catch(e){console.warn(`Failed to remove from server:`,e)}},checkItem(e){return!e||!this.isAvailable?!1:this.items?.includes(e)},count(){return this.isAvailable&&this.items?.length||0},async syncWithServer(e){if(this.isAvailable){this.isLoading=!0;try{let t=await i.uuids()??[],n=e.filter(e=>!t.includes(e));n.length>0?(await i.bulkAdd({uuids:n}),this.items=[...new Set([...t,...n])]):this.items=t}catch(t){this.items=e,console.warn(`sync:`,t)}finally{this.isLoading=!1,this.saveToLocalStorage()}}},saveToLocalStorage(){localStorage.setItem(`favorite`,JSON.stringify(this.items))},getLocalItems(){try{let e=localStorage.getItem(`favorite`);return e?JSON.parse(e):[]}catch{return[]}}}});export{a as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.