import{r as A,t as F,_ as S,d as x,a as H,o as l,c as a,b as u,e as y,f as s,u as h,g as c,h as m,i as U,m as z,j as L,s as C,k as M,N as $,l as I,n as r,p as R,w,q as p,v as _,x as j}from"./_plugin-vue_export-helper-CdidBNxa.chunk.mjs";import{g as v,l as k,t as o,a as q}from"./logger-DR-VjW92.chunk.mjs";const B={name:"HelpCircleIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},E=["aria-hidden","aria-label"],Z=["fill","width","height"],G={d:"M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"},J={key:0};function K(e,t,i,f,D,N){return l(),a("span",z(e.$attrs,{"aria-hidden":i.title?null:"true","aria-label":i.title,class:"material-design-icon help-circle-icon",role:"img",onClick:t[0]||(t[0]=n=>e.$emit("click",n))}),[(l(),a("svg",{fill:i.fillColor,class:"material-design-icon__svg",width:i.size,height:i.size,viewBox:"0 0 24 24"},[u("path",G,[i.title?(l(),a("title",J,s(i.title),1)):m("",!0)])],8,Z))],16,E)}const O=S(B,[["render",K]]);A(F);const P={class:"settings-section"},Q={class:"settings-section__name"},W=["aria-label","href","title"],X={key:0,class:"settings-section__desc"},Y=x({__name:"NcSettingsSection",props:{name:{},description:{default:""},docUrl:{default:""}},setup(e){const t=H("External documentation");return(i,f)=>(l(),a("div",P,[u("h2",Q,[y(s(e.name)+" ",1),e.docUrl?(l(),a("a",{key:0,"aria-label":h(t),class:"settings-section__info",href:e.docUrl,rel:"noreferrer nofollow",target:"_blank",title:h(t)},[c(O,{size:20})],8,W)):m("",!0)]),e.description?(l(),a("p",X,s(e.description),1)):m("",!0),U(i.$slots,"default",{},void 0,!0)]))}}),ee=S(Y,[["__scopeId","data-v-9cedb949"]]);async function g(e){try{return await L.put(v("/apps/files_downloadlimit/api/v1/limit"),{limit:e}),!0}catch(t){k.error("Failed to set default download limit",{error:t}),C(o("files_downloadlimit","Failed to set default download limit"))}return!1}async function te(){try{return await L.delete(v("/apps/files_downloadlimit/api/v1/limit")),!0}catch(e){k.error("Failed to remove default download limit",{error:e}),C(o("files_downloadlimit","Failed to remove default download limit"))}return!1}const b=q("files_downloadlimit","default-download-limit",-1),ie=x({name:"AdminSettings",components:{NcCheckboxRadioSwitch:$,NcSettingsSection:ee,NcTextField:M},data(){return{limit:Math.max(b,10),enableDefaultLimit:b!==-1,showLoading:!1,showSuccess:!1}},computed:{helperText(){return typeof this.limit=="number"&&this.limit<=0?o("files_downloadlimit","The minimum limit is 1"):""}},watch:{async limit(e){await g(e)&&(this.showSuccess=!0,window.setTimeout(()=>{this.showSuccess=!1},1e3))},async enableDefaultLimit(e,t){this.showLoading=!0;let i;e?i=await g(10):i=await te(),i||(this.enableDefaultLimit=t),this.showLoading=!1}},methods:{t:o}}),le={class:"settings__placeholder"};function ae(e,t,i,f,D,N){const n=r("NcCheckboxRadioSwitch"),T=r("NcTextField"),V=r("NcSettingsSection");return l(),R(V,{name:e.t("files_downloadlimit","Download limit"),description:e.t("files_downloadlimit","Configure the default download limit for external shares.")},{default:w(()=>[c(n,{modelValue:e.enableDefaultLimit,"onUpdate:modelValue":t[0]||(t[0]=d=>e.enableDefaultLimit=d),loading:e.showLoading,type:"switch"},{default:w(()=>[y(s(e.t("files_downloadlimit","Default download limit for external shares")),1)]),_:1},8,["modelValue","loading"]),p(c(T,{modelValue:e.limit,"onUpdate:modelValue":t[1]||(t[1]=d=>e.limit=d),class:"settings__field",disabled:!e.enableDefaultLimit||e.showLoading,label:e.t("files_downloadlimit","Set default download limit"),type:"number",min:"1",helperText:e.helperText,error:!!e.helperText,success:e.showSuccess},null,8,["modelValue","disabled","label","helperText","error","success"]),[[_,e.enableDefaultLimit]]),p(u("div",le,null,512),[[_,!e.enableDefaultLimit]])]),_:1},8,["name","description"])}const se=I(ie,[["render",ae],["__scopeId","data-v-e2b3126e"]]);j(se).mount("#admin-download-limit");
//# sourceMappingURL=files_downloadlimit-admin.mjs.map
