/*! phoscon-app 2025-10-13 */

const{Machine:Machine,actions:actions}=XState,{interpret:interpret}=XStateInterpreter;export const getMachine=(factories,dashboardFactories,groupsFactories,room)=>{const stateHandlerMap={dashboardInitFactory:factories.initDashboard(),dashboardDeleteRoomFactory:dashboardFactories.deleteRoomView(),dashboardCreateRoomFactory:dashboardFactories.createRoomView(),dashboardRoomOffFactory:dashboardFactories.toggleRoom(),dashboardAllOFFFactory:dashboardFactories.allOFF(),dashboardToggleDeviceFactory:dashboardFactories.toggleDevice(),dashboardApplyMigrationFactory:dashboardFactories.applyMigration(),dashboardCheckMigrationFactory:dashboardFactories.checkMigrationRoom(),groupsInitFactory:factories.initGroups(room),dashboardDeleteGroupFactory:groupsFactories.deleteGroupView()};let machine=Machine({id:"dashboardMachine",initial:"rooms",states:{rooms:{on:{DASHBOARD_ROOM_CLICKED:"groups",DASHBOARD_ROOM_DELETED:{actions:["calldashboardDeleteRoomFactory"]},DASHBOARD_ROOM_CREATE:{actions:["calldashboardCreateRoomFactory"]},DASHBOARD_ROOM_OFF:{actions:["calldashboardRoomOffFactory"]},DASHBOARD_ALL_OFF:{actions:["calldashboardAllOFFFactory"]},DASHBOARD_TOGGLE_DEVICE:{actions:["calldashboardToggleDeviceFactory"]},DASHBOARD_TOGGLE_GROUP:{actions:["calldashboardToggleDeviceFactory"]},DASHBOARD_APPLY_MIGRATION:{actions:["calldashboardApplyMigrationFactory"]},DASHBOARD_CHECK_MIGRATION:{actions:["calldashboardCheckMigrationFactory"]}},onEntry:["calldashboardInitFactory"]},groups:{on:{BACK_CLICKED:"rooms",DASHBOARD_INIT:"rooms",DASHBOARD_TOGGLE_DEVICE:{actions:["calldashboardToggleDeviceFactory"]},GROUPS_INIT:{actions:["callgroupsInitFactory"]},DASHBOARD_GROUP_DELETED:{actions:["calldashboardDeleteGroupFactory"]}},onEntry:["callgroupsInitFactory"]}}},{actions:{calldashboardInitFactory:stateHandlerMap.dashboardInitFactory,calldashboardDeleteRoomFactory:stateHandlerMap.dashboardDeleteRoomFactory,calldashboardCreateRoomFactory:stateHandlerMap.dashboardCreateRoomFactory,calldashboardRoomOffFactory:stateHandlerMap.dashboardRoomOffFactory,calldashboardAllOFFFactory:stateHandlerMap.dashboardAllOFFFactory,calldashboardToggleDeviceFactory:stateHandlerMap.dashboardToggleDeviceFactory,calldashboardApplyMigrationFactory:stateHandlerMap.dashboardApplyMigrationFactory,calldashboardCheckMigrationFactory:stateHandlerMap.dashboardCheckMigrationFactory,callgroupsInitFactory:stateHandlerMap.groupsInitFactory,calldashboardDeleteGroupFactory:stateHandlerMap.dashboardDeleteGroupFactory}}),service=interpret(machine).onTransition(state=>{console.log("machine event: "+state.event.type)});return service.start(),{machine:machine,service:service}};