import{H as a}from"./p-b06e2bef.js";import{d as e}from"./p-2f569553.js";const{state:t,onChange:s}=e({pageNotes:[],allPageNotes:[],onlineStudents:[],dashboardData:null,isConnected:!1,loading:!1,dashboardDataLoading:!1,notesLoading:!1,classes:[],classesLoading:!1}),o={state:t,onChange:s};class r{constructor(){}static getInstance(){return r.instance||(r.instance=new r),r.instance}async fetchClasses(){o.state.classesLoading=!0;let e=await a.http.get("api/v1/Teacher/Classes");return e&&(o.state.classes=e.Data,o.state.classesLoading=!1),e}async fetchDashboardData(e){o.state.dashboardDataLoading=!0;let t=await a.http.get(`api/v1/Teacher/Dashboard/${e.ClassId}`);return t&&(o.state.dashboardData=t.Data,o.state.dashboardDataLoading=!1),t}async fetchNotes(e){o.state.notesLoading=!0;let t=await a.http.get(`api/v1/Teacher/Notes/${e.showAllNotes}`);return t&&(e.showAllNotes?o.state.allPageNotes=t.Data:o.state.pageNotes=t.Data,o.state.notesLoading=!1),t}async addFacilitatorNote(e){o.state.notesLoading=!0;let t=await a.http.post("api/v1/Teacher/Notes",e);return t&&(o.state.pageNotes=[...o.state.pageNotes,t.Data]),o.state.notesLoading=!1,t}async updateFacilitatorNote(e){o.state.notesLoading=!0;let t=await a.http.put(`api/v1/Teacher/Notes/${e.Id}`,e);return t&&(o.state.pageNotes=o.state.pageNotes.map((a=>a.Id==t.Data.Id?t.Data:a))),o.state.notesLoading=!1,t}async deleteFacilitatorNote(e){o.state.notesLoading=!0;let t=await a.http.delete(`api/v1/Teacher/Notes/${e}`);return t&&(o.state.pageNotes=o.state.pageNotes.filter((a=>a.Id!=e))),o.state.notesLoading=!1,t}}export{r as F,o as f}