1import{A as e,C as t,D as n,M as r,T as i,_ as a,g as o,m as s,t as c,v as l,x as u}from"./index-DLsA8nd8.js";var d=u(`<div class=peach-list-empty><span>loading...`),f=u(`<div class=peach-list-empty style="padding:48px 20px;flex-direction:column;gap:6px"><span style=font-size:13px;color:var(--peach-t1)>Trash is empty.</span><span style=font-size:11px;color:var(--peach-t2)>Deleted entries appear here before being removed permanently.`),p=u(`<span class=peach-trash-purge-confirm-label>delete all permanently?`),m=u(`<button class="peach-btn peach-btn--sm peach-btn--danger">yes`),h=u(`<button class="peach-btn peach-btn--ghost peach-btn--sm">cancel`),g=u(`<div class="peach-settings-group peach-trash-list"><p class=peach-settings-sub-label> </p><div class=peach-trash-footer>`),_=u(`<div class="peach-overlay-view ov-enter-right"style=display:flex><div class=peach-overlay-header><button class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"aria-label=Back><svg width=7 height=12 viewBox="0 0 7 12"fill=none stroke=currentColor stroke-width=1.1 stroke-linecap=round stroke-linejoin=round><path d="M6 1L1 6L6 11"></path></svg></button><span class=peach-overlay-title>trash</span><div class=peach-overlay-spacer></div></div><div class=peach-settings-body>`),v=u(`<button class="peach-btn peach-btn--sm peach-btn--danger">delete`),y=u(`<div class=peach-trash-entry-row><div class=peach-trash-entry-info><span class=peach-trash-entry-title></span><span class=peach-trash-entry-meta></span></div><div class=peach-trash-entry-actions><button class="peach-btn peach-btn--subtle peach-btn--sm">restore`),b=u(`<button class=peach-trash-delete-btn aria-label="Delete permanently">×`),x=u(`<button class=peach-trash-purge-all>permanently delete all`);function S(o){let[u,S]=e([]),[C,w]=e(!0),[T,E]=e(null),[D,O]=e(!1);r(async()=>{await k()});async function k(){w(!0),S((await c({type:`GET_DELETED_ENTRIES`})).data??[]),w(!1)}async function A(e){await c({type:`RESTORE_ENTRY`,payload:{id:e}}),o.onRestored(),await k()}async function j(e){await c({type:`PURGE_ENTRY`,payload:{id:e}}),E(null),await k()}async function M(){for(let e of u())await c({type:`PURGE_ENTRY`,payload:{id:e.id}});O(!1),await k()}function N(e){return e?new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`}):``}return(()=>{var e=_(),r=e.firstChild,c=r.firstChild,S=r.nextSibling;return s(c,`click`,o.onBack,!0),a(S,n(i,{get when(){return C()},get children(){return d()}}),null),a(S,n(i,{get when(){return l(()=>!C())()&&u().length===0},get children(){return f()}}),null),a(S,n(i,{get when(){return l(()=>!C())()&&u().length>0},get children(){var e=g(),r=e.firstChild,o=r.firstChild,s=r.nextSibling;return a(r,()=>u().length,o),a(r,()=>u().length===1?`entry`:`entries`,null),a(e,n(t,{get each(){return u()},children:e=>(()=>{var t=y(),r=t.firstChild,o=r.firstChild,s=o.nextSibling,c=r.nextSibling,u=c.firstChild;return a(o,()=>e.title),a(s,()=>N(e.deletedAt),null),a(s,(()=>{var t=l(()=>!!e.url);return()=>t()?` · ${e.url.replace(/^https?:\/\//,``).split(`/`)[0]}`:``})(),null),u.$$click=()=>void A(e.id),a(c,n(i,{get when(){return T()===e.id},get fallback(){return(()=>{var t=b();return t.$$click=()=>E(e.id),t})()},get children(){return[(()=>{var t=v();return t.$$click=()=>void j(e.id),t})(),(()=>{var e=h();return e.$$click=()=>E(null),e})()]}}),null),t})()}),s),a(s,n(i,{get when(){return D()},get fallback(){return(()=>{var e=x();return e.$$click=()=>O(!0),e})()},get children(){return[p(),(()=>{var e=m();return e.$$click=()=>void M(),e})(),(()=>{var e=h();return e.$$click=()=>O(!1),e})()]}})),e}}),null),e})()}o([`click`]);export{S as TrashView};