import{R as e}from"./Root-rl66e6VO.js";import"./index-D02r7Zsc.js";class m extends e{constructor(){super()}getUserBookmarks(){let t=this.get("accountInfos").id;if(localStorage.getItem("Bookmarks")){let o=JSON.parse(localStorage.getItem("Bookmarks"));if(o[t])return this.set("bookmarks",o[t]),o[t]}this.addUserBookmarksArray(t)}setUserBookmarks(t){let o=this.get("accountInfos").id,r=JSON.parse(localStorage.getItem("Bookmarks"));r[o]=t,this.set("bookmarks",t),localStorage.setItem("Bookmarks",JSON.stringify(r))}addUserBookmarksArray(t){if(localStorage.getItem("Bookmarks")){let r=JSON.parse(localStorage.getItem("Bookmarks"));r[t]=[],this.set("bookmarks",[]),localStorage.setItem("Bookmarks",JSON.stringify(r));return}let o={};o[t]=[],this.set("bookmarks",[]),localStorage.setItem("Bookmarks",JSON.stringify(o))}changeBookmarkState(t){if(localStorage.getItem("Bookmarks")){let o=this.getUserBookmarks();for(let r in o)if(o[r]===t){this.removeBookmark(t);return}this.addBookmark(t);return}}addBookmark(t){let o=this.getUserBookmarks();o.push(t),this.setUserBookmarks(o),this.set("bookmarks",o)}removeBookmark(t){let o=this.getUserBookmarks();for(let r in o)o[r]===t&&o.splice(r,1);this.setUserBookmarks(o),this.set("bookmarks",o)}checkBookmark(t){let o=this.getUserBookmarks();for(let r in o)if(o[r]===t)return!0;return!1}}export{m as default};
