import{a as r,d as n}from"./dates-BwbkmdBX.js";import{i as d}from"./vendor-C0xXhvfi.js";import{G as l}from"./get-D04izDFx.js";class u{put(e,i){let o="/api/v1/user-groups/"+parseInt(i.id);return r.put(o,e)}}let f=function(){return{title:"",id:0,errors:{title:[]},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},formStates:{isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!1},formBehaviour:{formType:"update"},changedTitle(){},pageProperties:{},submitForm(){new u().put({title:this.title},{id:this.id}).then(t=>{this.formStates.returnHereButton&&(this.notifications.success.show=!0,this.notifications.success.text=d.t("firefly.updated_administration",{title:t.data.data.attributes.title}),this.notifications.success.url="./administrations"),this.formStates.resetButton&&(this.title=""),this.formStates.returnHereButton||(window.location.href="./administrations?user_group_id="+parseInt(t.data.data.id)+"&message=updated")}).catch(t=>{this.errors.title=t.response.data.errors.title})},cancelForm(){window.location.href="./administrations"},init(){const t=window.location.href.split("/"),e=parseInt(t[t.length-1]);new l().show(e,{}).then(i=>{this.title=i.data.data.attributes.title,this.id=parseInt(i.data.data.id)})}}},s={administrations:f,dates:n};function a(){Object.keys(s).forEach(t=>{console.log(`Loading page component "${t}"`);let e=s[t]();Alpine.data(t,()=>e)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),a()});window.bootstrapped&&(console.log("Loaded through window variable."),a());
