/*! phoscon-app 2024-08-14 */

import*as c from"./constants.js";import*as s from"./scan-states.js";export const showPage=(context,event)=>{let pageParams=context.pageParams,initPages=context.initPages;context.getPageContent(event,pageParams,initPages).then(res=>context.view.showPage(res)).then(()=>context.translatePage(context.view)).then(()=>{context.view.el.querySelectorAll(".fade-in .dev-scroll-cont").forEach(el=>context.setShadowClass(el))}).catch(err=>{throw new Error(err)})};export const callOnEntry=(context,event)=>{context.service.send(context.constants.ON_ENTRY)};export function openModal(context,{data:data}){$("#"+data).modal("show");let backboneHistoryFragment=Backbone.history.getFragment();context.nodeHistoryFragment=backboneHistoryFragment};export function updateView(context,{data:data}){let blind=context.generalViews.tableView.views.find(view=>context.noteSw.id==view.model.get("id"));blind&&blind.render()};export function closeModal(context,{data:data}){if($("#"+data).modal("hide"),app.router.navigate(context.nodeHistoryFragment,{trigger:!0}),context.service.send(context.constants.PAGE_INIT),context.view.lastClick&&(context.view.lastClick=null),app.session.vendor&&delete app.session.vendor,app.session.product&&delete app.session.product,app.session.mac&&delete app.session.mac,app.session.installcode&&delete app.session.installcode,app.session.swid&&delete app.session.swid,app.session.fid&&delete app.session.fid,!context.view)return;let animElem=context.view.el.querySelector(".start-animation");animElem&&animElem.classList.remove("start-animation")};export function removeClassElem(context,{data:data}){context.view.removeClass(data)};export function addClassElem(context,{data:data}){context.view.addClass(data)};export function setLightingMode(context){setTimeout(()=>{context.view.setLightingMode()},100)};export function setLightingModeSvg(context){setTimeout(()=>{context.view.setLightingModeSvg()},100)};export function setLightingToModeSvg(context){setTimeout(()=>{context.view.setLightingToModeSvg()},100)};export function callPage(context,event){let frag=context.nodeHistoryFragment;frag&&""!=frag||(frag="table");let route=frag+"/wizard/"+event.data;app.router.navigate(route,{trigger:!0})};export function forwardAsEvent(context,event){context.service.send(event)};export const actions={[c.SHOW_PAGE]:showPage,[c.OPEN_MODAL]:openModal,[c.UPDATE_VIEW]:updateView,[c.CLOSE_MODAL]:closeModal,[c.REMOVE_CLASS_ELEM]:removeClassElem,[c.ADD_CLASS_ELEM]:addClassElem,[c.CALL_PAGE]:callPage,[c.CALL_ON_ENTRY]:callOnEntry,[s.START_SCAN]:forwardAsEvent,[s.STOP_SCAN]:forwardAsEvent,[c.SET_LIGHTING_MODE]:setLightingMode,[c.SET_LIGHTING_MODE_SVG]:setLightingModeSvg,[c.SET_LIGHTING_TO_MODE_SVG]:setLightingToModeSvg};