/*! phoscon-app 2023-07-31 */

import{ButtonEvents,GeneralStates,StateEvents,UiStates,KeyEvents}from"./state-constants.js";import{deactivateSettings,startProgressbar}from"./network-main-functions.js";export var clientCase2HandlerFactory=(view,setState)=>event=>{if(event===StateEvents.ENTER_STATE)view.show(),view.page1();else if(event===StateEvents.LEAVE_STATE);else if(event===ButtonEvents.CLOSE_PRESSED)view.hide(),setState(UiStates.CLIENT);else if(event===ButtonEvents.NEXT_PRESSED||event===KeyEvents.ENTER_PRESSED)setState(UiStates.CASE_2_DEACTIVATE);else{if(event!==KeyEvents.ESC_PRESSED)return StateEvents.NOT_HANDLED;view.hide(),setState(UiStates.CLIENT)}};export var clientCase2DeactivateHandlerFactory=(view,setState)=>event=>{if(event===StateEvents.ENTER_STATE)view.pageDeactivate(),deactivateSettings("deactivated").then(()=>startProgressbar("case2ProgressBar",15)).then(()=>view.hide()).then(()=>setState(UiStates.CLIENT));else if(event===StateEvents.LEAVE_STATE);else if(event===ButtonEvents.CLOSE_PRESSED)view.hide(),setState(UiStates.CLIENT);else{if(event!==KeyEvents.ESC_PRESSED)return StateEvents.NOT_HANDLED;view.hide(),setState(UiStates.CLIENT)}};