System.register(["./index-legacy-BGUFxny_.js","./useTitle-legacy-Ck1as0cr.js","./share-legacy-CrDD6m--.js","./DeletePopover-legacy-3-H7HjF3.js"],function(e,r){"use strict";var t,n,a,s,i,l,c,h,d,g,u,o,m,b,f,w,p,_,$,x,y,k,S,v,C,D,j,I,O,V,X,q,z;return{setters:[e=>{t=e.bU,n=e.D,a=e.dw,s=e.S,i=e.a5,l=e.a6,c=e.ab,h=e.o,d=e.aw,g=e.K,u=e.bX,o=e.dt,m=e.cz,b=e.V,f=e.j,w=e.b9,p=e.bq,_=e.bb,$=e.bt,x=e.r,y=e.B,k=e.aW,S=e.aV,v=e.an,C=e.dr,D=e.ds,j=e.R,I=e.du,O=e.dv,V=e.ah},e=>{X=e.b},e=>{q=e.m},e=>{z=e.D}],execute:function(){function r(e){const r=h(),{to:t}=f(),[a,s]=w(()=>p.post(`/share/delete?id=${e.share.id}`)),[i,l]=w(()=>p.post(`/share/${e.share.disabled?"enable":"disable"}?id=${e.share.id}`));return[n(g,{get disabled(){return!e.canShare},onClick:()=>{t(`/@manage/shares/edit/${e.share.id}`)},get children(){return r("global.edit")}}),n(g,{get loading(){return i()},get colorScheme(){return e.share.disabled?"success":"warning"},onClick:async()=>{const r=await l();_(r,()=>{e.refresh()})},get children(){return r("global."+(e.share.disabled?"enable":"disable"))}}),n(z,{get name(){return e.share.id},get loading(){return a()},onClick:async()=>{const t=await s();$(t,()=>{x.success(r("global.delete_success")),e.refresh()})}})]}const A=e=>{if(e.role<0)return null;const r=["info","neutral","accent"];return n(m,{get colorScheme(){return r[e.role]},css:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},get children(){return e.name}})};function B(e){const m=h(),{copy:f}=t();return n(o,{get children(){return[n(a,{get children(){return(()=>{if(0===e.share.files.length)return"";let r=e.share.files[0];return e.share.files.length>1&&(r+=m("shares.files_etc",{more:e.share.files.length-1})),r})()}}),n(a,{get children(){return e.share.id}}),n(s,{get when(){return i.is_admin(l())},get children(){return n(a,{get children(){return n(A,{get name(){return e.share.creator},get role(){return e.share.creator_role}})}})}}),n(a,{get children(){return c(()=>!!e.share.expires)()?new Date(e.share.expires).toLocaleString():""}}),n(a,{get children(){return e.share.max_accessed>0?`${e.share.accessed} / ${e.share.max_accessed}`:`${e.share.accessed}`}}),n(a,{get children(){return m("shares.status_list."+(e.share.disabled?"disabled":e.share.max_accessed>0&&e.share.accessed>=e.share.max_accessed||0===e.share.files.length||e.share.expires&&new Date(e.share.expires)<new Date?"invalid":e.share.creator!==l().username||e.canShare?"work":"denied"))}}),n(a,{get children(){return e.share.remark}}),n(a,{get children(){return n(d,{spacing:"$2",get children(){return[n(g,{colorScheme:"primary",onClick:()=>{const r=q(e.share,{site_title:b("site_title")}),t=u(b("share_summary_content"),r);f(t)},get children(){return m("shares.copy_msg")}}),n(r,e)]}})}})]}})}e("default",()=>{const e=h();X("manage.sidemenu.shares");const{to:r}=f(),[t,a]=w(()=>p.get("/share/list")),[u,m]=y([]),b=async()=>{const e=await a();$(e,e=>m(e.content))},_=i.can(l(),k.findIndex(e=>"share"===e));return b(),n(V,{spacing:"$3",alignItems:"start",w:"$full",get children(){return[n(d,{spacing:"$2",gap:"$2",w:"$full",wrap:{"@initial":"wrap","@md":"unset"},get children(){return[n(g,{colorScheme:"accent",get loading(){return t()},onClick:b,get children(){return e("global.refresh")}}),n(s,{when:!_,get fallback(){return n(g,{onClick:()=>r("/@manage/shares/add"),get children(){return e("global.add")}})},get children(){return n(S,{withArrow:!0,get label(){return e("shares.no_permission_tip")},placement:"right",get children(){return n(g,{disabled:!0,get children(){return[" ",c(()=>e("global.add"))," "]}})}})}})]}}),n(v,{w:"$full",overflowX:"auto",get children(){return n(C,{highlightOnHover:!0,dense:!0,get children(){return[n(D,{get children(){return n(o,{get children(){return[n(j,{each:["files","id"],children:r=>n(I,{get children(){return e(`shares.${r}`)}})}),n(s,{get when(){return i.is_admin(l())},get children(){return n(I,{get children(){return e("shares.creator")}})}}),n(j,{each:["expires","accessed","status","remark"],children:r=>n(I,{get children(){return e(`shares.${r}`)}})}),n(I,{get children(){return e("global.operations")}})]}})}}),n(O,{get children(){return n(j,{get each(){return u()},children:e=>n(B,{share:e,refresh:b,canShare:_})})}})]}})}})]}})})}}});
