/*! phoscon-app 2024-10-07 */

const{Machine:Machine,actions:actions}=XState,{interpret:interpret}=XStateInterpreter;export const getMachine=(stateHandlerMap,c)=>{const states=c.States,wizardPageStates={PAGE_INIT:"init",PAGE_SWITCHES:"pageSwitches",PAGE_BUTTONS:"pageButtons",PAGE_FUNCTIONS:"pageFunctions",PAGE_GROUPMODE:"pageGroupMode",PAGE_GROUPMODEINFO:"pageGroupModeInfo"},wizardStates={id:"wizardSub",initial:"init",states:{init:{on:{...wizardPageStates,BTN_ADD_SWITCH_PRESSED:{actions:["callWizardPageSwitches"]},BTN_ADD_RL_PRESSED:{actions:["callWizardPageButtons"]}}},pageSwitches:{on:{...wizardPageStates,SW_MODAL_PRESSED:{actions:["callWizardPageSwitches"]},BTN_PREV_PRESSED:{actions:["callWizardPageSwitches"]},BTN_NEXT_PRESSED:{actions:["callWizardPageSwitches"]},BTN_CLOSE_PRESSED:{actions:["callWizardPageSwitches"]}},onEntry:["callWizardPageSwitches"],onExit:["callWizardPageSwitches"]},pageButtons:{on:{...wizardPageStates,BTN_PREV_PRESSED:{actions:["callWizardPageButtons"]},BTN_NEXT_PRESSED:{actions:["callWizardPageButtons"]},BTN_CLOSE_PRESSED:{actions:["callWizardPageButtons"]},SW_TARGET_PRESSED:{actions:["callWizardPageButtons"]}},onEntry:["callWizardPageButtons"],onExit:["callWizardPageButtons"]},pageFunctions:{on:{...wizardPageStates,BTN_PREV_PRESSED:{actions:["callWizardPageFunctions"]},BTN_NEXT_PRESSED:{actions:["callWizardPageFunctions"]},BTN_CLOSE_PRESSED:{actions:["callWizardPageFunctions"]},FUNC_MODAL_PRESSED:{actions:["callWizardPageFunctions"]},SUBFUNC_MODAL_PRESSED:{actions:["callWizardPageFunctions"]}},onEntry:["callWizardPageFunctions"],onExit:["callWizardPageFunctions"]},pageGroupMode:{on:{...wizardPageStates,BTN_PREV_PRESSED:{actions:["callWizardPageGroupMode"]},BTN_NEXT_PRESSED:{actions:["callWizardPageGroupMode"]},BTN_CLOSE_PRESSED:{actions:["callWizardPageGroupMode"]},BTN_GROUPMODE_PRESSED:{actions:["callWizardPageGroupMode"]},BTN_EDITORMODE_PRESSED:{actions:["callWizardPageGroupMode"]}},onEntry:["callWizardPageGroupMode"],onExit:["callWizardPageGroupMode"]},pageGroupModeInfo:{on:{...wizardPageStates,BTN_PREV_PRESSED:{actions:["callWizardPageGroupModeInfo"]},BTN_NEXT_PRESSED:{actions:["callWizardPageGroupModeInfo"]},BTN_CLOSE_PRESSED:{actions:["callWizardPageGroupModeInfo"]}},onEntry:["callWizardPageGroupModeInfo"],onExit:["callWizardPageGroupModeInfo"]}}};let machine=Machine({id:"switcheditor",type:"parallel",context:{service:null},states:{overview:{on:{SW_PRESSED:{actions:["callOverview"]},RL_PRESSED:{actions:["callOverview"]},FUNC_PRESSED:{actions:["callOverview"]},OVERVIEW:{actions:["callOverview"]},ACTIVESW:{actions:["callOverview"]},ACTIVERL:{actions:["callOverview"]},BTN_SAVE_PRESSED:{actions:["callOverview"]},BTN_DISMISS_PRESSED:{actions:["callOverview"]},BTN_REMOVE_SW_PRESSED:{actions:["callOverview"]},BTN_BACK_MAIN_PRESSED:{actions:["backToMainPage"]}},onEntry:["callOverview"]},wizard:{...wizardStates}}},{actions:{callOverview:stateHandlerMap[states.OVERVIEW],callWizardPageSwitches:stateHandlerMap[states.PAGE_SWITCHES],callWizardPageButtons:stateHandlerMap[states.PAGE_BUTTONS],callWizardPageFunctions:stateHandlerMap[states.PAGE_FUNCTIONS],callWizardPageGroupMode:stateHandlerMap[states.PAGE_GROUPMODE],callWizardPageGroupModeInfo:stateHandlerMap[states.PAGE_GROUPMODEINFO],backToMainPage:function(context,event){var path=sessionStorage.getItem("app.index.path")||"index.html",param=sessionStorage.getItem("app.index.hash")||"";location.assign(path+param)}}}),service=interpret(machine).onTransition(state=>{console.log("Machine ev: "+state.event.type)});return machine.context.service=service,service.start(),service};