import{i as e,n as t,r as n,t as r}from"./client-BTeclN8X.js";var i=`interaction-settings-cache`,a=300*1e3;function o(){if(typeof window>`u`)return null;try{let e=localStorage.getItem(i);if(!e)return null;let t=JSON.parse(e);return!t.data||Date.now()-t.ts>a?(localStorage.removeItem(i),null):t.data}catch{return null}}function s(e){if(!(typeof window>`u`))try{localStorage.setItem(i,JSON.stringify({data:e,ts:Date.now()}))}catch{}}function c(){if(!(typeof window>`u`))try{localStorage.removeItem(i)}catch{}}var l={commentsEnabled:!0,likesEnabled:!0,commentAudit:!0};async function u(){let e=o();if(e){let t={...l,...e};return s(t),{code:0,data:t,msg:`ok`}}let n=await t(`/api/v1/settings/interaction`);if(n.code===0&&n.data){let e={...l,...n.data};return s(e),{...n,data:e}}return n}async function d(e){let t={commentsEnabled:e.commentsEnabled!==!1,likesEnabled:e.likesEnabled!==!1,commentAudit:e.commentAudit===!0},r=await n(`/api/v1/admin/settings/interaction`,t);if(r.code===0){let e={...l,...t,...r.data||{}};return s(e),{...r,data:e}}else c();return r}function f(e,n=1,r=20){return t(`/api/v1/posts/${encodeURIComponent(e)}/comments?page=${n}&limit=${r}`)}function p(t,n){return e(`/api/v1/posts/${encodeURIComponent(t)}/comments`,{content:n})}function m(e,t){return r(`/api/v1/posts/${encodeURIComponent(e)}/comments/${t}`)}function h(e,n=1,r=20){let i=new URLSearchParams;return e&&i.append(`status`,e),i.append(`page`,String(n)),i.append(`limit`,String(r)),t(`/api/v1/admin/comments?${i.toString()}`)}function g(e,t){return n(`/api/v1/admin/comments/${e}`,t)}function _(e){return r(`/api/v1/admin/comments/${e}`)}export{f as a,d as c,h as i,_ as n,g as o,m as r,u as s,p as t};