/* COPYRIGHT by SARTORIUS (Sartorius Lab Instruments GmbH & Co. KG) */
!function(t){var e={};function a(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,a),s.l=!0,s.exports}a.m=t,a.c=e,a.d=function(t,e,i){a.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=121)}([function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.PARAM_GROUP="GROUP",t.PARAM_DATE_TIME="DATE_TIME",t.PARAM_MULTIPLE_SELECTION="MULTIPLE_SELECTION",t.PARAM_SELECTION="SELECTION",t.PARAM_QUANTITY="QUANTITY",t.PARAM_MEASURE="MEASURE",t.PARAM_STRING="STRING",t.ALIBI_IDENTIFIER="ALIBI_IDENTIFIER",t.PARAM_TEXT="TEXT",t.PARAM_FORMULA="FORMULA",t.PARAM_PASSWORD="PASSWORD",t.PARAM_BARCODE="BARCODE"}(e.EnumParameterTypes||(e.EnumParameterTypes={})),function(t){t.HIDDEN="HIDDEN",
t.DISABLED="DISABLED",t.ENABLED_PRIMARY="ENABLED_PRIMARY",t.ENABLED_SECONDARY="ENABLED_SECONDARY",t.ENABLED="ENABLED",t.ENABLED_EDITABLE="ENABLED_EDITABLE",t.ENABLED_INVALID="ENABLED_INVALID",t.ENABLED_INVALID_CFG="ENABLED_INVALID_CFG"}(e.EnumAppearance||(e.EnumAppearance={})),function(t){t.CODE128="CODE128",t.QR="QR",t.EAN13="EAN13",t.EAN8="EAN8",t.UPC="UPC",t.CODE39="CODE39",t.ITF14="ITF14",t.ITF="ITF",t.MSI="MSI",t.MSI10="MSI10",t.MSI11="MSI11",t.MSI1010="MSI1010",t.MSI1110="MSI1110",t.Pharmacode="Pharmacode"}(e.EnumBarcodeFormats||(e.EnumBarcodeFormats={})),e.EnumButtonType||(e.EnumButtonType={}),function(t){t.OPEN="OPEN",t.CLOSED="CLOSED",t.MOVE="MOVE"}(e.EnumDraftShieldPosition||(e.EnumDraftShieldPosition={})),function(t){t.NONE="NONE",t.UNLICENSED="UNLICENSED",t.ROWI="ROWI",t.LIWI="LIWI",t.LIRO="LIRO"}(e.EnumDraftShieldType||(e.EnumDraftShieldType={})),function(t){t.TOUCH="TOUCH"}(e.EnumUserEvent||(e.EnumUserEvent={})),function(t){t[t.OPEN=1]="OPEN",t[t.RUNNING=2]="RUNNING",
t[t.CLOSED_SUCCESS=3]="CLOSED_SUCCESS",t[t.CLOSED_FAILED=4]="CLOSED_FAILED"}(e.EnumJobStatus||(e.EnumJobStatus={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MQTT_TOPIC_WILDCARD_UNIQUE_ID="_replaceWithUniqueID_",e.MQTT_TOPIC_WILDCARD_GENERATED_TOKEN="_generatedToken_",e.MQTT_TOPIC_WILDCARD_SCREEN_ID="_replaceWithScreenID_",e.MQTT_TOPIC_WILDCARD_BUTTON_ID="_replaceWithButtonID_",e.MQTT_TOPIC_WILDCARD_TAB_ID="_replaceWithTabID_",function(t){t.DEVELOPER_MODE="/DEVELOPER_MODE",t.QAPP_CLEANUP="/QAPP/CLEANUP",t.QAPP_NAMESPACE="/QAPP",t.QAPP_DEBUG_TOPIC_PREAMBLE="/QAPP/DEBUG",t.QAPP_DEBUG_STOP_HEARTBEAT="/QAPP/DEBUG/stopHeartbeat",t.QAPP_LOGOUT_REQUEST="/QAPP/LOGOUT_REQUEST",t.QAPP_STARTED="/QAPP/STATE/STARTED",t.QAPP_STOPPED="/QAPP/STATE/STOPPED",t.QAPP_ERROR="/QAPP/STATE/ERROR",t.QAPP_HEARTBEAT="/QAPP/HEARTBEAT",t.QAPP_DATABASE_ACTION_DONE="/QAPP/DATABASE_ACTION_DONE",t.DEVICE_MODEL_NAME="/DEVICEINFORMATION/IDENTIFICATION/MODEL_NAME",
t.DEVICE_IS_FUSION="/FIRMWARELOADER/VERSION/IS_FUSION",t.DEVICE_SERIAL_NUMBER="/DEVICEINFORMATION/IDENTIFICATION/SERIAL_NO_BALANCE",t.NETWORK_MAC_ADDRESS="/DEVICEINFORMATION/NETWORK/MACADDRESS",t.NETWORK_HOSTNAME="/DEVICEINFORMATION/NETWORK/HOSTNAME",t.SENSOR_ACTOR_INFO="SENSOR_ACTOR/BALANCE/BALANCE_INFO",t.SENSOR_ACTOR_WEIGHT="SENSOR_ACTOR/BALANCE/WEIGHT",t.LEVELING_STATUS="/LEVELING/STATUS",t.LEVELING_CLOSE="/LEVELING/CLOSE",t.CALADJ_ISOCAL_STATUS="/CALIBRATION_ADJUSTMENT/ISOCAL",t.CALADJ_INTERNAL_RESULT="/CALIBRATION_ADJUSTMENT/RESULT",t.CLIMATE_INT_VALUE="/CLIMA_CONTROL/INT/VALUE",t.CLIMATE_EXT_VALUE="/CLIMA_CONTROL/EXT/VALUE",t.CLIMATE_INT_ID_SERIAL="CLIMA_CONTROL_INT_ID_SERIAL",t.CLIMATE_EXT_ID_SERIAL="CLIMA_CONTROL_EXT_ID_SERIAL",t.CLIMATE_STATUS="/CLIMA_CONTROL/STATUS",t.DRAFTSHIELD_TYPE="/DRAFTSHIELD/TYPE",t.DRAFTSHIELD_POSITION="/DRAFTSHIELD/IONIZER_INFO",t.QAPP_PARAMETERS_TOPIC_PREAMBLE="/QAPP/PARAMS",t.USERMANAGEMENT_AUTO_LOGOUT_EVENT="/USERMANAGEMENT/AUTO_LOG_OFF",
t.USERMANAGEMENT_AUTO_LOGOUT_PREWARNING_EVENT="/USERMANAGEMENT/AUTO_LOG_OFF_PREWARNING",t.REPORTING_SICS_PROTOCOL_HELPER="/SICS/ADD_TO_PROTOCOL",t.REPORTING_SBI_PROTOCOL_HELPER="/REPORTING/SBI/SINGLE_PRINT",t.COMM_SBI_PRINT_AT_STABILITY="SBI_PROTOCOL/STABILITY",t.JOBMGMT_TASK_WORKFLOWDATA="/TASK/WORKFLOWDATA",t.HMI_QAPP_WIZARD_SCREEN_TITLE="/QAPP/SCREENS/WIZARDSCREEN/HEADING_TITLE",t.HMI_VISUAL_SCREEN="/VISUAL_SCREEN",t.HMI_VISUAL_SCREEN_CLOSED="/HMI/VISUAL_SCREEN/CLOSED",t.HMI_OVERLAY_TOP="/HMI/OVERLAY_TOP",t.HMI_EVENT="/HMI/USER/EVENT",t.HMI_LOCK_SCREEN_STATE="HMI/LOCKSCREEN/STATE",t.HMI_ACTIVE_QAPP_SCREEN="/QAPP/SCREEN",t.HMI_ABSTRACT_SCREEN_BARBUTTONS="/QAPP/SCREENS/_replaceWithScreenID_/BARBUTTONS",t.HMI_ABSTRACT_SCREEN_BUTTONS="/QAPP/SCREENS/_replaceWithScreenID_/_replaceWithButtonID_",t.HMI_ABSTRACT_SCREEN_TAB_SINGLE="/QAPP/SCREENS/_replaceWithScreenID_/TAB",t.HMI_ABSTRACT_SCREEN_TABS="/QAPP/SCREENS/_replaceWithScreenID_/TABS/_replaceWithTabID_",
t.HMI_TABBED_SCREEN="/QAPP/SCREENS/TABBEDSCREEN",t.HMI_WEIGHING_SCREEN_BARBUTTONS="/QAPP/SCREENS/WEIGHING/BARBUTTONS",t.HMI_WEIGHING_SCREEN_INSTRUCTION1="/QAPP/SCREENS/WEIGHING/TEXT1",t.HMI_WEIGHING_SCREEN_INSTRUCTION2="/QAPP/SCREENS/WEIGHING/TEXT2",t.HMI_WEIGHING_SCREEN_TITLE="/QAPP/SCREENS/WEIGHING/NAVIGATION/TEXT",t.HMI_WEIGHING_SCREEN_PARAM1_TOPIC="/QAPP/SCREENS/WEIGHING/PARAM1",t.HMI_WEIGHING_SCREEN_PARAM2_TOPIC="/QAPP/SCREENS/WEIGHING/PARAM2",t.HMI_WEIGHINGSPLIT_SCREEN_BARBUTTONS="/QAPP/SCREENS/WEIGHINGSPLIT/BARBUTTONS",t.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION1="/QAPP/SCREENS/WEIGHINGSPLIT/TEXT1",t.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION2="/QAPP/SCREENS/WEIGHINGSPLIT/TEXT2",t.HMI_WEIGHINGSPLIT_SCREEN_TITLE="/QAPP/SCREENS/WEIGHINGSPLIT/NAVIGATION/TEXT",t.HMI_WEIGHINGSPLIT_SCREEN_PARAM1_TOPIC="/QAPP/SCREENS/WEIGHINGSPLIT/PARAM1",t.HMI_WEIGHINGSPLIT_SCREEN_PARAM2_TOPIC="/QAPP/SCREENS/WEIGHINGSPLIT/PARAM2",t.HMI_CHECKBARGRAPH_STATUS="/QAPP/CHECKBARGRAPH/STATUS",
t.HMI_CHECKBARGRAPH_VALUE="/QAPP/CHECKBARGRAPH/VALUE",t.HMI_QAPP_PARAMETER_INPUT="/QAPP/PARAMETER_INPUT",t.HMI_LOCK_SCREEN="/QAPP/SCREENS/LOCK",t.HMI_LOCK_LOADING_MODAL="/QAPP/SCREENS/LOCK/LOADING_MODAL",t.HMI_SINGLETABBUTTONBAR_SCREEN="/QAPP/SCREENS/SINGLETABBUTTONBARSCREEN",t.HMI_SINGLETABBUTTONBAR_SCREEN_BARBUTTONS="/QAPP/SCREENS/SINGLETABBUTTONBARSCREEN/BARBUTTONS",t.HMI_SINGLETABBUTTONBAR_SCREEN_TOPLEFTBUTTON="/QAPP/SCREENS/SINGLETABBUTTONBARSCREEN/TOPLEFTBUTTON",t.HMI_LOCK_LOADING_MODAL_TEXT="/QAPP/SCREENS/LOCK/LOADING_MODAL/TEXT",t.HMI_LOCK_LOADING_MODAL_APPEARANCE="/QAPP/SCREENS/LOCK/LOADING_MODAL/APPEARANCE",t.HMI_LOCK_MESSAGEBOX="/QAPP/SCREENS/LOCK/MESSAGEBOX",t.HMI_LOCK_RESET="/QAPP/SCREENS/LOCK/RESET",t.HMI_LOCK_UNLOCK="/QAPP/SCREENS/LOCK/UNLOCK",t.HMI_LOADING_MODAL="HMI/LOADING_MODAL",t.HMI_LOADING_MODAL_TEXT="HMI/LOADING_MODAL/TEXT",t.HMI_LOADING_MODAL_APPEARANCE="HMI/LOADING_MODAL/APPEARANCE",t.HMI_MESSAGEBOX="/QAPP/MESSAGEBOX",
t.HMI_PARAMDETAILSOVERLAY="/QAPP/PARAMDETAILSOVERLAY",t.HMI_PRINT_HEADER="/HMI/PRINT_HEADER",t.MESSAGE_HANDLER_MESSAGE="/MESSAGE_HANDLER/MESSAGE",t.WEIGHING_VALUE_NET="WEIGHING/WEIGHT/NET",t.WEIGHING_VALUE_NET_HIGH_RES="WEIGHING/WEIGHT/NET_HIGH_RES",t.WEIGHING_VALUE_TARE="WEIGHING/WEIGHT/TARE",t.WEIGHING_VALUE_TARE1="WEIGHING/WEIGHT/TARE1",t.WEIGHING_VALUE_TARE2="WEIGHING/WEIGHT/TARE2",t.WEIGHING_VALUE_GROSS="WEIGHING/WEIGHT/GROSS_CALC",t.WEIGHING_VALUE_DISPLAY="WEIGHING/WEIGHT/DISPLAY",t.WEIGHING_SELECTED_DISPLAY_VALUE="WEIGHING/WEIGHT/DISPLAY/SELECTED",t.WEIGHING_WEIGHT_BLOCK="WEIGHING/WEIGHT/BLOCK",t.WEIGHING_WAITING_FOR_STABILITY="WEIGHING/WAITING_FOR_STABILITY",t.WEIGHING_STATUS_ERROR="WEIGHING/STATUS/ERROR ",t.WEIGHING_TARE_BLOCK="WEIGHING/DOING_ZERO_TARE",t.WEIGHING_STATE="WEIGHING/STATE",t.SURE_ACTIVE="/WEIGHING/SURE/ACTIVE",t.SURE_RANGE_1_A="/WEIGHING/SURE/PARAM_SURE_RANGE_1_A",t.SURE_RANGE_1_B="/WEIGHING/SURE/PARAM_SURE_RANGE_1_B",
t.SURE_RANGE_1_B_EXP="/WEIGHING/SURE/PARAM_SURE_RANGE_1_B_EXP",t.SURE_RANGE_2_A="/WEIGHING/SURE/PARAM_SURE_RANGE_2_A",t.SURE_RANGE_2_B="/WEIGHING/SURE/PARAM_SURE_RANGE_2_B",t.SURE_RANGE_2_B_EXP="/WEIGHING/SURE/PARAM_SURE_RANGE_2_B_EXP",t.SURE_RANGE_3_A="/WEIGHING/SURE/PARAM_SURE_RANGE_3_A",t.SURE_RANGE_3_B="/WEIGHING/SURE/PARAM_SURE_RANGE_3_B",t.SURE_RANGE_3_B_EXP="/WEIGHING/SURE/PARAM_SURE_RANGE_3_B_EXP",t.METROLOGY_MAX_DIGITS="WEIGHING/METROLOGY/MAXIMUM_DIGITS",t.METROLOGY_MAX_DIGITS_DEBUG="/QAPP/DEBUG/WEIGHING/METROLOGY/MAXIMUM_DIGITS",t.METROLOGY_RANGES="WEIGHING/METROLOGY/RANGES",t.METROLOGY_APPROVED_FOR_VERIFICATION="WEIGHING/METROLOGY/APPROVED_FOR_VERIFICATION",t.ESIGNATURE_PERFORM="/HMI/PERFORM_SIGNATURE",t.ESIGNATURE_RESULT="/HMI/ELECTRONIC_SIGNATURE_RESULT",t.REPORTING_PRINTABLE_VALUE="/REPORTING/PRINTABLE_VALUE",t.REPORTING_PRINTQUEUE_DISPLAYED="/HMI/PRINT_QUEUE",t.REPORTING_PRINT_PROCESS_RESULT="/REPORTING/PRINT_PROCESS",
t.CUSTOMIZED_WEIGHT_DISPLAY_VALUE="/QAPP/WEIGHING/WEIGHT/APPLICATION/_replaceWithUniqueID_/VALUE",t.CUSTOMIZED_REST_HANDLER_CONFIGURATION="/QAPP/REST/CFG",t.COMM_QAPP_DIRECT_INTERFACE="/QAPP/QAPP_DIRECT_INTERFACE",t.COMM_FILE_OPERATIONS_ASYNC_TOKEN="/CONNECTORMANAGEMENT/PROGRESS/_generatedToken_"}(e.MqttTopics||(e.MqttTopics={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.cloneJSON=function(t){return JSON.parse(JSON.stringify(t))}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(2),s=a(7),n=a(0);e.isTypeOfIDateTimeParameter=function(t){return t.type===n.EnumParameterTypes.PARAM_DATE_TIME},e.isTypeOfIMultipleSelectionParameter=function(t){return t.type===n.EnumParameterTypes.PARAM_MULTIPLE_SELECTION},e.isTypeOfISelectionParameter=function(t){return t.type===n.EnumParameterTypes.PARAM_SELECTION},e.isTypeOfIQuantityParameter=function(t){return t.type===n.EnumParameterTypes.PARAM_QUANTITY},
e.isTypeOfIMeasureParameter=function(t){return t.type===n.EnumParameterTypes.PARAM_MEASURE},e.isTypeOfIStringParameter=function(t){return t.type===n.EnumParameterTypes.PARAM_STRING},e.isTypeOfIAlibiIdentifierParameter=function(t){return t.type===n.EnumParameterTypes.ALIBI_IDENTIFIER},e.isTypeOfITextParameter=function(t){return t.type===n.EnumParameterTypes.PARAM_TEXT},e.isTypeOfIFormulaParameter=function(t){return t.type===n.EnumParameterTypes.PARAM_FORMULA},e.isTypeOfIPasswordParameter=function(t){return t.type===n.EnumParameterTypes.PARAM_PASSWORD},e.isITextStructure=function(t){return"string"==typeof t.id&&"object"==typeof t.args&&t.args instanceof Array};const r={id:"",args:[]};function o(t){const e=i.cloneJSON(r);return s.isString(t)&&(e.id=t),e}e.createEmptyTextStructure=o;const _={id:"",type:n.EnumParameterTypes.PARAM_GROUP,title:o(),appearance:n.EnumAppearance.HIDDEN,parameters:[]};function E(t){const e=i.cloneJSON(_);return s.isString(t)&&(e.id=t),e}
e.createEmptyParameterGroup=E;const l={id:"",type:n.EnumParameterTypes.PARAM_GROUP,title:o(),appearance:n.EnumAppearance.HIDDEN,parameters:[E()]};e.createEmptyParameterGroupOfGroups=function(){return i.cloneJSON(l)};const u={appearance:n.EnumAppearance.HIDDEN,id:"",text:o()};e.createEmptySelectionParameterOption=function(){return i.cloneJSON(u)};const c={id:"",type:n.EnumParameterTypes.PARAM_SELECTION,value:{selection:{id:""}},header:o(),title:o(),info:{options:[u]},appearance:n.EnumAppearance.HIDDEN};e.createEmptySelectionParameter=function(t){const e=i.cloneJSON(c);return s.isString(t)&&(e.id=t),e};const T={id:"",type:n.EnumParameterTypes.PARAM_MULTIPLE_SELECTION,value:{selections:[]},header:o(),title:o(),info:{options:[u]},appearance:n.EnumAppearance.HIDDEN};e.createEmptyMultipleSelectionParameter=function(t){const e=i.cloneJSON(T);return s.isString(t)&&(e.id=t),e},e.setValueOfSelectionParameter=function(t,e){if(t.type!==n.EnumParameterTypes.PARAM_SELECTION)return!1
;if(s.isString(e)){const a=s.getObjectByID(t.info.options,e);if(s.isObject(a)&&s.isString(a.id)&&a.id===e)return t.value.selection=i.cloneJSON(a),!0}else if(t.info.options.length>0)return t.value.selection=i.cloneJSON(t.info.options[0]),!0;return!1},e.setValueOfMulitpleSelectionParameter=function(t,e){if(t.type!==n.EnumParameterTypes.PARAM_MULTIPLE_SELECTION)return!1;if(s.isObject(e)&&Array.isArray(e)){t.value.selections=[];for(let a=0;a<e.length;a++){const n=s.getObjectByID(t.info.options,e[a]);s.isObject(n)&&s.isString(n.id)&&n.id===e[a]&&t.value.selections.push(i.cloneJSON(n))}return!0}return t.info.options.length>0&&(t.value.selections=i.cloneJSON(t.info.options),!0)},e.SAMPLE_DATE_TIME_ID="SAMPLE_DATE_TIME_ID";const d={id:e.SAMPLE_DATE_TIME_ID,type:n.EnumParameterTypes.PARAM_DATE_TIME,value:{timestamp:0},title:{id:"_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME",args:[]},header:{id:"_QAPP_LIB_PARAM_HEADER_SAMPLE_DATETIME",args:[]},info:{isDate:!0,isTime:!0},
appearance:n.EnumAppearance.HIDDEN};e.createEmptyDateTimeParameter=function(t){const e=i.cloneJSON(d);return s.isString(t)&&(e.id=t),e};const p={id:"",type:n.EnumParameterTypes.PARAM_STRING,value:{string:""},header:o(),title:o(),info:{minimum:{length:0},maximum:{length:0}},appearance:n.EnumAppearance.HIDDEN};e.createEmptyStringParameter=function(t){const e=i.cloneJSON(p);return s.isString(t)&&(e.id=t),e};const A={id:"",type:n.EnumParameterTypes.PARAM_BARCODE,value:{string:"",format:n.EnumBarcodeFormats.CODE128,width:120},header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN};e.createEmptyBarcodeParameter=function(t){const e=i.cloneJSON(A);return s.isString(t)&&(e.id=t),e};const I={id:"",type:n.EnumParameterTypes.PARAM_PASSWORD,value:{string:""},header:o(),title:o(),info:{passwordLength:0,minimum:{length:0},maximum:{length:0}},appearance:n.EnumAppearance.HIDDEN};e.createEmptyPasswordParameter=function(t){const e=i.cloneJSON(I);return s.isString(t)&&(e.id=t),e};const h={id:"",
type:n.EnumParameterTypes.PARAM_TEXT,value:{text:o()},header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN,info:{suppressTitle:!1}};e.createEmptyTextParameter=function(t){const e=i.cloneJSON(h);return s.isString(t)&&(e.id=t),e},e.createEmptyTextParameterValueOnly=function(){let t=i.cloneJSON(h);return t.info.suppressTitle=!0,t};const m={visual:"",eval:""};e.createEmptyFormulaParameterValue=function(){return i.cloneJSON(m)};const N={id:"",type:n.EnumParameterTypes.PARAM_FORMULA,value:[],header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN,info:{maximum:{length:0}}};e.createEmptyFormulaParameter=function(t){const e=i.cloneJSON(N);return s.isString(t)&&(e.id=t),e};const S={mark:"",sign:"",number:"0",decimals:0,auxiliaryDigits:0,unit:"",interval:1,isStable:!1,isSpecial:!1,isWarning:!1,isInvalid:!0};e.createEmptyMeasureParameterValue=function(){return i.cloneJSON(S)};const g={id:"",type:n.EnumParameterTypes.PARAM_MEASURE,value:S,header:o(),title:o(),appearance:n.EnumAppearance.HIDDEN}
;e.createEmptyMeasureParameter=function(t){const e=i.cloneJSON(g);return s.isString(t)&&(e.id=t),e};const R={decimals:0,preferredDecimals:0,numbers:[],unit:""};e.createEmptyQuantityParameterValue=function(){return i.cloneJSON(R)},e.QUANTITY_PARAM_MIN_MAX_NAN="nan",e.QUANTITY_PARAM_NUMBERS_MAX=3;const P={id:"",type:n.EnumParameterTypes.PARAM_QUANTITY,value:R,header:o(),title:o(),info:{minimum:{value:e.QUANTITY_PARAM_MIN_MAX_NAN},maximum:{value:e.QUANTITY_PARAM_MIN_MAX_NAN}},appearance:n.EnumAppearance.HIDDEN};e.createEmptyQuantityParameter=function(t){const e=i.cloneJSON(P);return s.isString(t)&&(e.id=t),e};const O={id:"",type:n.EnumParameterTypes.ALIBI_IDENTIFIER,value:{alibiIdentifier:NaN},header:o(),title:o(),appearance:n.EnumAppearance.ENABLED};e.createEmptyAlibiIdentifier=function(){return i.cloneJSON(O)}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.printParameters="printParameters",
t.printPrintQueueWithElectronicSignature="printPrintQueueWithElectronicSignature",t.printParametersDirect="printParametersDirect",t.getPrintQueue="getPrintQueue",t.isPrintQueueEmpty="isPrintQueueEmpty",t.clearPrintQueue="clearPrintQueue",t.requestPrintableValueComment="requestPrintableValueComment",t.setRedactionStatus="setRedactionStatus",t.getAlibiRecord="getAlibiRecord",t.getAlibiRecordList="getAlibiRecordList",t.setPathAndFilenameForNextReport="setPathAndFilenameForNextReport",t.setMetaDataInCurrentReport="setMetaDataInCurrentReport",t.applyProfiles="applyProfiles",t.printParametersWithProfile="printParametersWithProfile"}(e.RestMethodsREPORTING||(e.RestMethodsREPORTING={})),function(t){t.getTemperature="getTemperature",t.getHumidity="getHumidity",t.getAirPressure="getAirPressure",t.getAirDensity="getAirDensity",t.getTemperatureUncertainty="getTemperatureUncertainty",t.getHumidityUncertainty="getHumidityUncertainty",t.getAirPressureUncertainty="getAirPressureUncertainty",
t.getConfigurationData="getConfigurationData"}(e.RestMethodsCLIMATECONTROL||(e.RestMethodsCLIMATECONTROL={})),function(t){t.getWorkstate="getWorkstate",t.getTaskTemplate="getTaskTemplate",t.createTask="createTask",t.readTask="readTask",t.updateTask="updateTask",t.validate="validate",t.saveWorkstate="saveWorkstate",t.deleteWorkstate="deleteWorkstate",t.getTaskNames="getTaskNames",t.getTaskNamesByOrderNumber="getTaskNamesByOrderNumber",t.setTaskEvent="setTaskEvent"}(e.RestMethodsTASK_MANAGEMENT||(e.RestMethodsTASK_MANAGEMENT={})),function(t){t.getCurrentUser="getCurrentUser",t.checkRightsOfCurrentUser="checkRightsOfCurrentUser"}(e.RestMethodsACCESS_MANAGEMENT||(e.RestMethodsACCESS_MANAGEMENT={})),function(t){t.addEventExt="addEventExt",t.getRecords="getRecords"}(e.RestMethodsAUDITTRAIL||(e.RestMethodsAUDITTRAIL={})),function(t){t.startInternCal="startInternCal",t.disableAutoIsoCal="disableAutoIsoCal"}(e.RestMethodsCALIBRATION||(e.RestMethodsCALIBRATION={})),function(t){
t.getFormatConfiguration="getFormatConfiguration",t.getFormatConfigurationI18n="getFormatConfigurationI18n"}(e.RestMethodsCLOCK_HANDLER||(e.RestMethodsCLOCK_HANDLER={})),function(t){t.getConfigurations="getConfigurations",t.putFileAsync="putFileAsync",t.putFileAsyncWithoutMD5="putFileAsyncWithoutMD5",t.getFileAsyncWithoutMD5="getFileAsyncWithoutMD5",t.listDirectory="listDirectory"}(e.RestMethodsCONNECTOR_MANAGEMENT||(e.RestMethodsCONNECTOR_MANAGEMENT={})),function(t){t.getSerialNoBalance="getSerialNoBalance",t.getModelName="getModelName",t.getVersionBalance="getVersionBalance",t.getVersionPackage="getVersionPackage",t.getParameter="getParameter",t.sendUDPBroadcast="sendUDPBroadcast",t.cancelUDP="cancelUDP",t.listenUDP="listenUDP",t.addRunningActivity="addRunningActivity",t.removeRunningActivity="removeRunningActivity",t.setActuatorsActive="setActuatorsActive",t.setDeviceCleaned="setDeviceCleaned"}(e.RestMethodsDEVICE_INFORMATION||(e.RestMethodsDEVICE_INFORMATION={})),function(t){
t.getQappProtocolPortNumber="getQappProtocolPortNumber",t.getQappProtocolInterfaces="getQappProtocolInterfaces",t.isInterfaceActive="isInterfaceActive",t.setGPIOPorts="setGPIOPorts"}(e.RestMethodsINTERFACE_MANAGEMENT||(e.RestMethodsINTERFACE_MANAGEMENT={})),function(t){t.getLanguage="getLanguage",t.getText="getText",t.getTexts="getTexts"}(e.RestMethodsLOCALIZER||(e.RestMethodsLOCALIZER={})),function(t){t.addMessage="addMessage",t.deleteMessageByCategory="deleteMessageByCategory",t.getAllMessagesByCategory="getAllMessagesByCategory",t.deleteMessagesByCategory="deleteMessagesByCategory",t.removeMessage="removeMessage"}(e.RestMethodsMESSAGE_HANDLER||(e.RestMethodsMESSAGE_HANDLER={})),function(t){t.loadProfile="loadProfile",t.getProfiles="getProfiles"}(e.RestMethodsPROFILE_MANAGEMENT||(e.RestMethodsPROFILE_MANAGEMENT={})),function(t){t.playEndOfActionSound="playEndOfActionSound",t.playMessageSound="playMessageSound"}(e.RestMethodsSOUND_MANAGEMENT||(e.RestMethodsSOUND_MANAGEMENT={})),
function(t){t.isAutoLogout="isAutoLogout",t.getListRoles="getListRoles"}(e.RestMethodsUSER_MANAGEMENT||(e.RestMethodsUSER_MANAGEMENT={})),function(t){t.createWeightApplication="createWeightApplication",t.enableWeightApplication="enableWeightApplication",t.selectWeightApplication="selectWeightApplication",t.destroyWeightApplication="destroyWeightApplication",t.setButton="setButton",t.triggerStableWeightBlock="triggerStableWeightBlock",t.cancelStableWeightBlock="cancelStableWeightBlock",t.doZero="doZero",t.clearTare="clearTare",t.clearTare1="clearTare1",t.clearTare2="clearTare2",t.clearTareAll="clearTareAll",t.doTare="doTare",t.doTare1="doTare1",t.doTare2="doTare2",t.doTareAuto="doTareAuto",t.doZeroTare="doZeroTare",t.doZeroTareAuto="doZeroTareAuto",t.setTare1="setTare1",t.cancelDoing="cancelDoing",t.setTare2="setTare2",t.setUnit="setUnit",t.getParameter="getParameter",t.getParameterIds="getParameterIds",t.getRangeParameters="getRangeParameters",t.setMinUsp="setMinUsp",
t.setMinWeight="setMinWeight",t.insertWeightInvalidation="insertWeightInvalidation",t.removeWeightInvalidation="removeWeightInvalidation",t.setAmbientCondition="setAmbientCondition"}(e.RestMethodsWEIGHING||(e.RestMethodsWEIGHING={})),function(t){t.openLast="openLast",t.closeAll="closeAll",t.openLeft="openLeft",t.openRight="openRight",t.openTop="openTop"}(e.RestMethodsDRAFTSHIELD||(e.RestMethodsDRAFTSHIELD={})),function(t){t.setJobStatusAndReason="setJobStatusAndReason"}(e.RestMethodsJOB_MANAGEMENT||(e.RestMethodsJOB_MANAGEMENT={})),function(t){t.disableChecker="disableChecker",t.enableChecker="enableChecker"}(e.RestMethodsSELF_MONITOR||(e.RestMethodsSELF_MONITOR={})),function(t){t.start="start"}(e.RestMethodsLEVELING||(e.RestMethodsLEVELING={})),function(t){t.getConfigData="getConfigData"}(e.RestMethodsMENU_HANDLER||(e.RestMethodsMENU_HANDLER={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(14),s=a(1);var n;!function(t){
t[t.SHOW_SCREEN=0]="SHOW_SCREEN",t[t.HIDE_SCREEN=1]="HIDE_SCREEN",t[t.SHOW_OVERLAY=2]="SHOW_OVERLAY",t[t.HIDE_OVERLAY=3]="HIDE_OVERLAY",t[t.SHOW_LOADINGSCREEN=4]="SHOW_LOADINGSCREEN",t[t.HIDE_LOADINGSCREEN=5]="HIDE_LOADINGSCREEN",t[t.SHOW_MESSAGEBOX=6]="SHOW_MESSAGEBOX",t[t.HIDE_MESSAGEBOX=7]="HIDE_MESSAGEBOX",t[t.SHOW_LOCKSCREEN=8]="SHOW_LOCKSCREEN",t[t.HIDE_LOCKSCREEN=9]="HIDE_LOCKSCREEN",t[t.SHOW_LOCKLOADINGSCREEN=10]="SHOW_LOCKLOADINGSCREEN",t[t.HIDE_LOCKLOADINGSCREEN=11]="HIDE_LOCKLOADINGSCREEN",t[t.SHOW_LOCKMESSAGEBOX=12]="SHOW_LOCKMESSAGEBOX",t[t.HIDE_LOCKMESSAGEBOX=13]="HIDE_LOCKMESSAGEBOX"}(n=e.ScreenEventType||(e.ScreenEventType={}));e.AbstractScreen=class{constructor(t){this.events$=new i.Subject,this.mqttHandler=t}show(){console.log("AbstractScreen: show "+this.getId()+" @ "+s.MqttTopics.HMI_ACTIVE_QAPP_SCREEN),this.mqttHandler.publish(s.MqttTopics.HMI_ACTIVE_QAPP_SCREEN,'{ "screen":"'+this.getId()+'" }'),this.events$.next({type:n.SHOW_SCREEN,id:this.getId()})}hide(){}
publishContent(t,e,a=!0){let i=t?this.getMqttTopicBaseExtensible()+t:this.getMqttTopicBase();console.log("AbstractScreen: publishContent @ "+i),this.mqttHandler.publish(i,e,{retain:a})}getMqttTopicBase(){return"SCREENS/"+this.getId()}getMqttTopicBaseExtensible(){return this.getMqttTopicBase()+"/"}getButton(t){}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(54),s="SUCCESS",n="FAILED";e.CubisRestResponse=class{constructor(t){if(this.restResponse=void 0,"boolean"==typeof t)this.result=t?s:n,this.rawReturns={};else{let e;this.restResponse=t;try{e=JSON.parse(this.restResponse.stdout.toString())}catch(t){throw t.message+="\nreceived: "+this.restResponse.stdout.toString(),t}this.rawReturns=e.returns,this.result=e.result}}isSuccess(){return this.result===s}};e.BaseProxy=class{constructor(){this.body={method:"",params:{}}}syncRequest(){let t,e=JSON.stringify(this.body),a=`http://127.0.0.1:8080/rest/${this.restEndpoint}`;const s=process.hrtime()
;let n=[a,"-H","Accept:application/json","-H","Content-Type:application/json","-H","Expect:","--data","@-"];t=i.spawnSync("curl",n,{input:e});const r=process.hrtime(s);return console.log(`${this.body.method} (hr): ${r[0]}s ${r[1]/1e6}ms`),t}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(2);function s(t){return null!=t&&null!==t&&void 0!=t&&void 0!==t&&("number"==typeof t&&!isNaN(t))}function n(t){return null!=t&&null!==t&&void 0!=t&&void 0!==t&&"string"==typeof t}function r(t){return null!=t&&null!==t&&void 0!=t&&void 0!==t&&"object"==typeof t}function o(t,e,a){if(r(t)){n(a)||(a="id"),a=a;for(let i=0;i<t.length;i++)if(t[i].hasOwnProperty(a)&&n(t[i][a])&&t[i][a]===e)return i}}e.isNumber=s,e.isString=n,e.isObject=r,e.isBoolean=function(t){return null!=t&&null!==t&&void 0!=t&&void 0!==t&&"boolean"==typeof t},e.getObjectByID=function(t,e,a){let i=o(t,e,a);if(s(i))return t[i]},e.getIndexByID=o,e.overwriteExistingAttributes=function(t,e){
if(r(t)&&r(e)){let a=Object.keys(e);for(let s=0;s<a.length;s++)"function"!=typeof e[a[s]]&&t.hasOwnProperty(a[s])&&typeof e[a[s]]==typeof t[a[s]]&&(e[a[s]]=i.cloneJSON(t[a[s]]))}},e.setEnumSafely=function(t,e,a){const i=Object.keys(e);for(const a of i)if(e[a]===t)return e[a];return n(a)?a:i.length>0?e[i[0]]:void 0}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.QAPP_TIMER_EVENT="QAPP_TIMER_EVENT";e.QAppTimerEvent=class{constructor(t){this.payload=t,this.type=e.QAPP_TIMER_EVENT}},e.QAPP_INTERVAL_EVENT="QAPP_INTERVAL_EVENT";e.QAppIntervalEvent=class{constructor(t){this.payload=t,this.type=e.QAPP_INTERVAL_EVENT}},e.IMMEDIATE_EVENT="IMMEDIATE_EVENT";e.ImmediateEvent=class{constructor(t){this.payload=t,this.type=e.IMMEDIATE_EVENT}},e.SIMPLE_EVENT="SIMPLE_EVENT";e.SimpleEvent=class{constructor(t){this.payload=t,this.type=e.SIMPLE_EVENT}},e.QAPP_SYNC_CALL_DONE_EVENT="QAPP_SYNC_CALL_DONE_EVENT",function(t){t.SYNC_CALL_SAVE_WORKSTATE="SYNC_CALL_SAVE_WORKSTATE"
}(e.QAPP_SYNC_CALL_DONE_EVENT_TYPE||(e.QAPP_SYNC_CALL_DONE_EVENT_TYPE={}));e.QAppSyncCallDoneEvent=class{constructor(t){this.payload=t,this.type=e.QAPP_SYNC_CALL_DONE_EVENT}},e.QAPP_ASYNC_CALL_DONE_EVENT="QAPP_ASYNC_CALL_DONE_EVENT",e.QAPP_ASYNC_CALL_FAIL_EVENT="QAPP_ASYNC_CALL_FAIL_EVENT";e.QAppAsyncCallDoneEvent=class{constructor(t){this.payload=t,this.type=e.QAPP_ASYNC_CALL_DONE_EVENT}};e.QAppAsyncCallFailEvent=class{constructor(t){this.payload=t,this.type=e.QAPP_ASYNC_CALL_FAIL_EVENT}}},function(t,e){t.exports=require("tslib")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(2);function n(t){return s.cloneJSON({module:"qappHandler",method:"buttonClickEvent",params:{buttonId:t||""}})}function r(t){let e={nameId:"",appearance:"HIDDEN",type:"",label:{id:"",args:[]},effect:n()};return void 0!==t.nameId&&(e.nameId=t.nameId),void 0!==t.labelCenter&&(e.labelCenter=t.labelCenter),void 0!==t.labelRight&&(e.labelRight=t.labelRight),
void 0!==t.icon&&(e.icon=t.icon),void 0!==t.lastSelected&&(e.lastSelected=t.lastSelected),e.label=t.label,e.appearance=t.appearance,e.effect.params.buttonId=t.buttonId,t.longPressButtonId&&(e.longPressEffect=n(),e.longPressEffect.params.buttonId=t.longPressButtonId),void 0!==t.labelAlign&&(e.labelAlign=t.labelAlign),void 0!==t.labelCenterAlign&&(e.labelCenterAlign=t.labelCenterAlign),void 0!==t.labelRightAlign&&(e.labelRightAlign=t.labelRightAlign),e}e.createButtonEmptyEffect=n,e.IButtonParameterInterface2IButtonJsonInterface=r,e.IButtonJsonInterface2IButtonParameterInterface=function(t){let e={buttonId:t.effect.params.buttonId,appearance:t.appearance,label:t.label};return t.nameId&&(e.nameId=t.nameId),t.labelCenter&&(e.labelCenter=t.labelCenter),t.labelRight&&(e.labelRight=t.labelRight),t.longPressEffect&&(e.longPressButtonId=t.longPressEffect.params.buttonId),void 0!==t.icon&&(e.icon=t.icon),void 0!==t.lastSelected&&(e.lastSelected=t.lastSelected),
void 0!==t.labelAlign&&(e.labelAlign=t.labelAlign),void 0!==t.labelCenterAlign&&(e.labelCenterAlign=t.labelCenterAlign),void 0!==t.labelRightAlign&&(e.labelRightAlign=t.labelRightAlign),e};class o{constructor(t,e,a){this.lastPublishedTabContent="",this.mqttHandler=t,this.buttonTopic="SCREENS/"+e.getId()+"/"+a.buttonId,this.buttonJson=r(a)}setButtonId(t,e=!0){this.buttonJson.effect.params.buttonId=t,e&&this.publish()}setLongPressButtonId(t,e=!0){t?(this.buttonJson.longPressEffect||(this.buttonJson.longPressEffect=n()),this.buttonJson.longPressEffect.params.buttonId=t):delete this.buttonJson.longPressEffect,e&&this.publish()}setJson(t){this.buttonJson=JSON.parse(t),this.publish()}setNameId(t,e=!0){this.buttonJson.nameId=t,e&&this.publish()}getNameId(){return this.buttonJson.nameId}setAppearance(t,e=!0){this.buttonJson.appearance=t,e&&this.publish()}setType(t,e=!0){this.buttonJson.type=t,e&&this.publish()}getType(){return this.buttonJson.type}getLabel(){return this.buttonJson.label}
setLabel(t,e=!0){this.buttonJson.label=t,e&&this.publish()}getIcon(){return this.buttonJson.icon}setIcon(t,e=!0){void 0!==t&&t.length>0?this.buttonJson.icon=t:delete this.buttonJson.icon,e&&this.publish()}getLabelCenter(){return this.buttonJson.labelCenter}setLabelCenter(t,e=!0){this.buttonJson.labelCenter=t,e&&this.publish()}getLabelRight(){return this.buttonJson.labelRight}setLabelRight(t,e=!0){this.buttonJson.labelRight=t,e&&this.publish()}getAppearance(){let t=i.EnumAppearance.HIDDEN;return this.buttonJson.appearance&&"string"==typeof this.buttonJson.appearance&&Object.keys(i.EnumAppearance).indexOf(this.buttonJson.appearance)?this.buttonJson.appearance:t}getJson(){return this.buttonJson}getTopic(){return this.buttonTopic}getButtonId(){return this.buttonJson.effect.params.buttonId}getLongPressButtonId(){return this.buttonJson.longPressEffect?this.buttonJson.longPressEffect.params.buttonId:null}publish(){let t=JSON.stringify(this.buttonJson)
;t!==this.lastPublishedTabContent&&(this.mqttHandler.publish(this.buttonTopic,t),this.lastPublishedTabContent=t)}show(){this.publish()}}e.Button=o,e.default=o},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.INFO="INFO",t.ERROR="ERROR",t.WARNING="WARNING",t.QUESTION="QUESTION"}(e.EnumMessageboxType||(e.EnumMessageboxType={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.ZERO="_FONT_ICON_ZERO",t.TARE="_FONT_ICON_TARE",t.TARE_1="_FONT_ICON_TARE1",t.CLR_TARE1="_FONT_ICON_CLR_TARE1",t.SHOW_TARE1="_FONT_ICON_SHOW_TARE1",t.HIDE_TARE1="_FONT_ICON_HIDE_TARE1",t.DELETE="_FONT_ICON_DELETE",t.EDIT="_FONT_ICON_EDIT",t.PRINT="_FONT_ICON_PRINT",t.OK="_FONT_ICON_OK",t.CANCEL="_FONT_ICON_CANCEL",t.ERROR="_FONT_ICON_ERROR",t.WARNING="_FONT_ICON_WARNING",t.INFO="_FONT_ICON_INFO",t.NEXT10="_FONT_ICON_NEXT_10",t.NEXT="_FONT_ICON_NEXT",t.PREV="_FONT_ICON_PREV",t.PREV10="_FONT_ICON_PREV_10",
t.RESULT="_FONT_ICON_RESULT",t.IONIZER="_FONT_ICON_IONIZER",t.PRINT_ADD="_FONT_ICON_PRINT_ADD",t.X_ACROSS="_FONT_ICON_X_ACROSS",t.RESULT_ADD="_FONT_ICON_RESULT_ADD",t.RHO="_FONT_ICON_RHO",t.BACK="_FONT_ICON_BACK",t.MIN_USP="_FONT_ICON_MIN_USP",t.START="_FONT_ICON_START",t.END="_FONT_ICON_END",t.DOCU="_FONT_ICON_DOCU",t.INVALIDATE_SAMPLE="_FONT_ICON_INVALID_SAMPLE",t.SEARCH="_FONT_ICON_SEARCH",t.SEARCH_ACTIVE="_FONT_ICON_SEARCH_ACTIVE",t.FILTER="_FONT_ICON_FILTER",t.FILTER_ACTIVE="_FONT_ICON_FILTER_ACTIVE",t.ADD="_FONT_ICON_ADD",t.LOGOUT="_FONT_ICON_LOGOUT",t.RELOAD="_FONT_ICON_RELOAD",t.WEIGHING="_FONT_ICON_WEIGHING",t.QUESTION="_FONT_ICON_QUESTION",t.SKIP="_FONT_ICON_SKIP",t.HELP="_FONT_ICON_HELP",t.LIST="FONT_ICON_LIST",t.SAMPLE="_FONT_ICON_SAMPLE",t.SUBSAMPLE="_FONT_ICON_SUBSAMPLE",t.SUBSAMPLE_DONE="_FONT_ICON_SUBSAMPLE_DONE",t.REQUEST="_FONT_ICON_REQUEST",t.REQUEST_DONE="_FONT_ICON_REQUEST_DONE",t.TASK_SUBSAMPLE="_FONT_ICON_TASK_SUBSAMPLE",t.EXCHANGE="_FONT_ICON_TASK_CONTROLLED",
t.OMNIS="_FONT_ICON_OMNIS"}(e.EnumFontLabels||(e.EnumFontLabels={}))},function(t,e){t.exports=require("lodash")},function(t,e){t.exports=require("rxjs/Subject")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(72),s=a(73),n=a(74),r=a(50),o=a(76),_=a(8),E=a(24),l=a(77),u=a(25),c=a(80),T=a(53),d=a(55),p=a(46),A=a(59),I=a(84),h=a(85),m=a(61),N=a(11),S=a(39),g=a(3),R=a(87),P=a(5),O=a(28),D=a(63),C=a(60),M=a(29),L=a(13),b=a(17),f=a(88),y=a(37),B=a(33),v=a(47),U=a(2),G=a(12),x=a(89),H=a(90),Q=a(91),F=a(51),w=a(92),V=a(30),k=a(1),Y=a(0),W=a(7);a(93),e.HEARTBEAT_INTERVAL_MS=2e3;const q=100,K=500;e.STORAGE_LOCATION_BASE="/data/installedQApps/qapps/data";const j="STATE_SUSPENDING_INTERNAL",X="STATE_RESTARTING_INTERNAL",J="_START_FSM_",$="_INTERNAL_DEVEL_VERSION_INFO_STATE_",z="BTN_INTERNAL_DEVEL_VERSION_INFO";e.FORCED_SUSPEND_HOME_BUTTON_ID="BTN_HOME",e.LOGOUT_BUTTON_ID="BTN_LOGOUT",e.PRINT_RESTART_BUTTON_ID="BTN_PRINT_RESTART"
;const Z="BTN_SUSPEND_QUESTION_YES",tt="BTN_SUSPEND_QUESTION_NO",et="BTN_LOGOUT_QUESTION_YES",at="BTN_LOGOUT_QUESTION_NO",it="BTN_RESTART_QUESTION_YES",st="BTN_RESTART_QUESTION_NO",nt="CANCEL_LOGOUT",rt="REMEMBER_LOGOUT";e.TASK_ERROR_STR_TASK_NAME_NOT_UNIQUE="_TASK_NAME_NOT_UNIQUE",e.TASK_ERROR_STR_TASK_NAME_EMPTY="_TASK_NAME_EMPTY";const ot="TASK/IDENTIFICATION",_t="TASK/PROFILE";var Et,lt;e.TASK_PROFILE_REPORTING_ID_PREFIX=_t+"/REPORTING_PROFILES",e.TASK_PROFILE_WEIGHING_ID=_t+"/WEIGHING",e.ASYNC_CALL_DB_CONNECTION_CREATE="ASYNC_CALL_DB_CONNECTION_CREATE",function(t){t.FUNC_BTN_TAKEOVER="FUNC_BTN_TAKEOVER",t.FUNC_BTN_DOCU="FUNC_BTN_DOCU",t.FUNC_BTN_OTHER="FUNC_BTN_OTHER"}(Et=e.EnumFunctionalButtonType||(e.EnumFunctionalButtonType={})),function(t){t.SUSPEND_NO_SUSPEND="SUSPEND_NO_SUSPEND",t.SUSPEND_HOME="SUSPEND_HOME",t.SUSPEND_LOGOUT="SUSPEND_LOGOUT",t.SUSPEND_APP="SUSPEND_APP"}(lt=e.EnumSuspendReason||(e.EnumSuspendReason={})),e.dbg=function(t){
null===t?console.log(" ## DEBUG ## null"):void 0===t?console.log(" ## DEBUG ## undefined"):"string"==typeof t||"number"==typeof t||"boolean"==typeof t?console.log(" ## DEBUG ## "+b.inspect(t).toString()):(console.log(" ## DEBUG ##"),console.log(b.inspect(t,!1,20)),console.log(" ##########"))};class ut{constructor(t){this.suppressGlobalHomeBtnHandling=!1,this.suppressGlobalLogoutBtnHandling=!1,this.suppressGlobalRestartBtnHandling=!1,this.isDevelVersion=!1,this.screens={},this.hideLoadingScreenOnShowScreens=!0,this.buttons={takeoverBtn:void 0,docuButton:void 0,others:[]},this.lastRequestedTakeoverBtnAppearance=Y.EnumAppearance.HIDDEN,this.aspects={},this.scriptPath=void 0,this.qAppOrderNumber=void 0,this.qAppVersion=void 0,this.taskId=void 0,this.isErrorStatePublished=!1,this.exitTimeOutPending=!1,this.suspendReason=lt.SUSPEND_NO_SUSPEND,this.heartbeatCount=0,this.eventQueue=[],this.eventQueuePending=!1,this.subscriptions=[],this.outstandingAsyncCalls=[],this.debugCfg={doConsoleLog:!0,
enableHeartbeatLog:!1,url:null},this.pendingMsgBox=void 0,this.currentMsgBox=void 0,this.isCurrentMsgPrio=!1,this.debugCfg.doConsoleLog=t,console.error=((...t)=>{console.log("ERR: ",t)});let s=a(29);if(console.log("try reading debug config from file"),s.existsSync("/data/installedQApps/qapps/data/qapplog.conf"))try{console.log("...found config file");let t=JSON.parse(s.readFileSync("/data/installedQApps/qapps/data/qapplog.conf","utf8").toString());console.log("...got it"),Object.assign(this.debugCfg,t),console.log("...debug config (with defaults): "+b.inspect(this.debugCfg))}catch(t){console.log("...invalid JSON content in qapplog.conf: "+t),console.log("...disable logging at all"),console.log=((...t)=>{})}else console.log("No qapplog file found.");let n=console.log;console.log("...saved original stdout");let r=null;if(null!==this.debugCfg.url){console.log("...there seems to be an url for remote logging configured");try{r=new F.URL(this.debugCfg.url),
console.log("...valid url for remote logging")}catch(t){r=null,console.log('...invalid URL like "ws://hostname.port" in qapplog.conf')}}if(this.debugCfg.doConsoleLog||(console.log("...disable local output"),console.log=((...t)=>{})),null!==r){console.log("...valid url for remote logging");let t=new w.Socket;t.on("error",()=>{try{console.log("...no logging redirected - error"),t.end()}catch(t){}}),t.connect(Number.parseInt(r.port),r.hostname,()=>{try{console.log(`...logging remote redirected to external client (local: ${this.debugCfg.doConsoleLog})`),console.log=((...e)=>{let a="";if(e.forEach(t=>{a+=t}),this.debugCfg.doConsoleLog)try{n(a)}catch(t){}a+="\n";try{t.write(a)}catch(t){}}),t.setNoDelay(!0),t.write("Hello, server! Love, Client.")}catch(t){}})}console.log("QAppBase: constr"),ut.clientSingleton=this,this.restHandler=new c.RestHandler,this.mqttHandler=new l.MqttHandler,this.taskMngProxy=new d.TaskProxy,this.localizerProxy=new T.LocalizerProxy,
this.weighingProxy=new p.WeighingProxy,this.accessControlProxy=new I.AccessControlProxy,this.reportingProxy=new m.ReportingProxy,this.devicInformationProxy=new f.DeviceInformationProxy,this.messageHandlerProxy=new y.MessageHandlerProxy,this.messageHandlerHelper=new B.MessageHandlerHelper(this.messageHandlerProxy),this.taskHandler=new A.TaskHandler,this.heartbeatInterval$=i.interval(e.HEARTBEAT_INTERVAL_MS)}getQAppOrderNumber(){return this.qAppOrderNumber}getQAppVersion(){return this.qAppVersion}getTaskId(){return this.taskId}getSerialNumber(){return this.devicInformationProxy.getSerialNo()}getWeighingProfileId(){let t=this.taskHandler.getParameter(e.TASK_PROFILE_WEIGHING_ID);return void 0!==t&&g.isTypeOfISelectionParameter(t)?t.value.selection.id:void 0}registerAspect(t){this.aspects[t.getId()]=t}init(){let t=new R.LoadingOverlay(this.mqttHandler);this.registerScreen(t)}postInit(){}loadTask(){if(this.taskId){console.log("QAppBase: read task for: ",this.taskId);try{
this.taskHandler.setTask(this.taskMngProxy.readTask(this.taskId)),console.log("QAppBase: read task ...done");let t=this.taskHandler.getTask();t&&(this.qAppOrderNumber=t.qappOrderNumber,this.qAppVersion=t.qappVersion),console.log("QAppBase: got qAppOrderNumber from Task-Info: "+this.qAppOrderNumber+"@"+this.qAppVersion)}catch(t){this.exitError("QAppBase::loadTask - error reading: "+(t?t.toString():""))}}else this.exitError("QAppBase::loadTask - Workflow script called without taskId")}getTaskName(){let t=void 0;if(void 0!==this.taskHandler){let e=this.taskHandler.getParameter("TASK/IDENTIFICATION/NAME");void 0!==e&&(t=e.value.string)}return t}registerScreen(t){console.log("QAppBase: register screen with id: "+t.getId()),this.screens[t.getId()]=t;try{t.events$.subscribe(t=>{t.type===P.ScreenEventType.SHOW_SCREEN&&this.hideLoadingScreenOnShowScreens&&this.hideLoadingScreen(),t.type,P.ScreenEventType.SHOW_LOADINGSCREEN,t.type,P.ScreenEventType.SHOW_MESSAGEBOX})}catch(t){}}showScreen(t){
if(!this.exitTimeOutPending)switch(t.getId()){case R.LOADING_OVERLAY_ID:case h.MESSAGEBOX_ID:this.exitError("QAppBase::showScreen() was called for messagebox or loading screen - not allowed");break;default:let e=this.hideLoadingScreenOnShowScreens;this.hideLoadingScreenOnShowScreens=!1,t.show(),this.closeAllScreensExcept(t),this.hideLoadingScreenOnShowScreens=e}}closeAllScreensExcept(t){switch(t.getId()){case R.LOADING_OVERLAY_ID:case h.MESSAGEBOX_ID:this.exitError("QAppBase::closeAllScreensExcept() was called for messagebox or loading screen - not allowed");break;default:for(let e in this.screens){let a=this.screens[e];a.getId()!==t.getId()&&a.getId()!==R.LOADING_OVERLAY_ID&&a.getId()!==Q.LOCK_LOADING_OVERLAY_ID&&a.getId()!==H.LOCKMESSAGEBOX_ID&&(a.getId()===h.MESSAGEBOX_ID?this.hideMsgBox():a.hide())}this.hidePrintQueue()}}getLoadingScreen(){let t=this.screens[R.LOADING_OVERLAY_ID];return void 0===t&&(t=new R.LoadingOverlay(this.mqttHandler),this.registerScreen(t)),t}
showLoadingScreen(t){if(!this.exitTimeOutPending){console.log("QAppBase::showLoadingScreen()");let e=this.getLoadingScreen();t?e.setText(t):e.setText({id:"",args:[]}),e.show()}}hideLoadingScreen(){console.log("QAppBase::hideLoadingScreen()");try{this.getLoadingScreen().hide()}catch(t){}}checkForLoadingScreenEnableEvent(t){try{return t.payload.event===O.MQTT_ADMIN_EVENT_PACKET_SENT&&t.payload.packet.topic===k.MqttTopics.HMI_LOADING_MODAL_APPEARANCE&&JSON.parse(t.payload.packet.payload.toString()).appearance===Y.EnumAppearance.ENABLED}catch(t){return!1}}checkForLoadingScreenDisabledEvent(t){try{return t.payload.event===O.MQTT_ADMIN_EVENT_PACKET_SENT&&t.payload.packet.topic===k.MqttTopics.HMI_LOADING_MODAL_APPEARANCE&&JSON.parse(t.payload.packet.payload.toString()).appearance===Y.EnumAppearance.HIDDEN}catch(t){return!1}}showMessageBox(t){this.exitTimeOutPending||(void 0===this.currentMsgBox?(console.log("QAppBase::showMessageBox(): check no current active one -> prep and show"),
this.currentMsgBox=t,this.prepAndShowMsgBox(this.currentMsgBox),this.isCurrentMsgPrio=!1,this.pendingMsgBox=void 0):(console.log("QAppBase::showMessageBox(): queue msgbox"),this.pendingMsgBox=t))}hideMsgBox(){console.log("QAppBase::hideMsgBox()"),this.pendingMsgBox=void 0,void 0===this.currentMsgBox||this.isCurrentMsgPrio||(console.log("QAppBase::hideMsgBox(): check non-prio -> hide"),this.currentMsgBox=void 0,this.hideMsgBoxInternal())}showPriorMsgBox(t){this.exitTimeOutPending||(void 0!==this.currentMsgBox&&(this.isCurrentMsgPrio||(console.log("QAppBase::showPriorMsgBox(): queue the current non prio msgbox"),this.pendingMsgBox=this.currentMsgBox)),console.log("QAppBase::showPriorMsgBox(): prep and how prio msgbox"),this.currentMsgBox=t,this.prepAndShowMsgBox(this.currentMsgBox),this.isCurrentMsgPrio=!0)}hidePriorMsgBox(){void 0!==this.pendingMsgBox?(this.currentMsgBox=this.pendingMsgBox,this.pendingMsgBox=void 0,this.prepAndShowMsgBox(this.currentMsgBox)):(this.currentMsgBox=void 0,
this.hideMsgBoxInternal()),this.isCurrentMsgPrio=!1}hideAllMsgBox(){this.pendingMsgBox=void 0,this.currentMsgBox=void 0,this.isCurrentMsgPrio=!1,this.hideMsgBoxInternal()}getMsgbox(){let t=this.screens[h.MESSAGEBOX_ID];return void 0===t&&(t=new h.MessageBox(this.mqttHandler),this.registerScreen(t)),t}prepAndShowMsgBox(t){if(!this.exitTimeOutPending){let e=this.getMsgbox();e.setMessageBoxData(t),console.log("QAppBase::prepAndShowMsgBox(): show"),e.show(),console.log("QAppBase::prepAndShowMsgBox(): done")}}hideMsgBoxInternal(){console.log("QAppBase::hideMsgBoxInternal()"),this.getMsgbox().hide()}showPrintQueue(){if(!this.exitTimeOutPending){console.log("QAppBase::showPrintQueue()");let t={enabled:!0};this.mqttHandler.publish(k.MqttTopics.REPORTING_PRINTQUEUE_DISPLAYED,JSON.stringify(t),{retain:!1})}}hidePrintQueue(){console.log("QAppBase::hidePrintQueue()");this.mqttHandler.publish(k.MqttTopics.REPORTING_PRINTQUEUE_DISPLAYED,JSON.stringify({enabled:!1}),{retain:!1})}clearPrintQueue(){
void 0!==this.buttons.docuButton&&this.buttons.docuButton.setAppearance(Y.EnumAppearance.DISABLED),this.reportingProxy.clearPrintQueue()}registerButton(t,e){switch(t){case Et.FUNC_BTN_TAKEOVER:this.buttons.takeoverBtn=e,this.lastRequestedTakeoverBtnAppearance=e.getAppearance();break;case Et.FUNC_BTN_DOCU:this.buttons.docuButton=e,this.buttons.docuButton.setAppearance(Y.EnumAppearance.DISABLED);break;default:this.buttons.others.push(e)}}addTimer(t,e){const a=n.setTimeout(()=>{this.addToEventQueue(new _.QAppTimerEvent(e))},t);return a.unref(),a}cancelTimer(t){void 0!==t&&n.clearTimeout(t)}addInterval(t,e){return n.setInterval(()=>{this.addToEventQueue(new _.QAppIntervalEvent(e))},t)}cancelInterval(t){void 0!==t&&n.clearInterval(t)}generateAsyncCallidentifier(){let t=Math.random();for(;this.outstandingAsyncCalls.find(e=>e===t);)t=Math.random();return t}enqueAsyncCall(t,a,i=5*e.HEARTBEAT_INTERVAL_MS,s=!1){let r=this.getCurrentState()
;console.log("QAppBase::enqueAsyncCall in state: "+r+" (timeout: "+i+"/fetchAfter: "+s+") with metadata: "+b.inspect(a));let _=this.generateAsyncCallidentifier();this.outstandingAsyncCalls.push(_);let E=new v.QAppAsyncCallTimeoutError(r,a),l=n.setTimeout(()=>{console.log("QAppBase async call timeout - add timeout to event queue");let t=new o.InternalAsyncCallEvent({type:s?o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT_WITH_FETCHING_RESP:o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT,data:{sourceState:r,reason:E,metadata:a},id:_});this.addToEventQueue(t)},i);t.then(t=>{console.log("QAppBase async call passed - add result to event queue");let e=new o.InternalAsyncCallEvent({type:o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_SUCCESS,data:{sourceState:r,result:t,metadata:a},id:_,timerId:l});this.addToEventQueue(e)}).catch(t=>{console.log("QAppBase async call failed - add reason to event queue"),console.log(b.inspect(t))
;let e=new o.InternalAsyncCallEvent({type:o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_FAIL,data:{sourceState:r,reason:t,metadata:a},id:_,timerId:l});this.addToEventQueue(e)}),console.log("QAppBase::enqueAsyncCall done...")}addToEventQueue(t){t.type===_.IMMEDIATE_EVENT||t.type===o.INTERNAL_SUSPEND_EVENT||t.type===o.INTERNAL_RESTART_EVENT||t.type===o.HEARTBEAT_EVENT?this.eventQueue.push(t):this.eventQueue.unshift(t),this.eventQueuePending||(setImmediate(()=>{this.processEventQueue(this)}),this.eventQueuePending=!0)}processEventQueue(t){if(this.exitTimeOutPending)return;t.eventQueuePending=!1;let e=t.eventQueue.length,a=t.eventQueue.pop();for(;a&&e>0&&!this.exitTimeOutPending;)e--,t.handleEvent(a),e>0&&(a=t.eventQueue.pop())}run(){if(!this.isErrorStatePublished){console.log("QAppBase: run"),this.processCLParameters(process.argv),this.heartbeat({message:":-)",value:this.heartbeatCount++});let t=this.provideStartFsmState()
;this.qappStates=this.prepareAndExtendFsmStates(t),console.log("QAppBase: register internal event handler"),this.subscriptions.push(s.merge(this.mqttHandler.mqttUpdateEvent$,this.mqttHandler.mqttAdminEvent$,this.restHandler.buttonClickEvent$,this.restHandler.paramChangedEvent$,this.restHandler.paramDetailEvent$,this.restHandler.restRequestEvent$).subscribe(t=>{this.addToEventQueue(t)})),this.subscriptions.push(this.mqttHandler.mqttUpdateEvent$.subscribe(t=>{try{switch(t.payload.topic){case k.MqttTopics.METROLOGY_MAX_DIGITS:case k.MqttTopics.METROLOGY_MAX_DIGITS_DEBUG:this.weighingProxy.updateWeighValueMaxDigits(parseInt(t.payload.value.toString(),10));break;case k.MqttTopics.METROLOGY_RANGES:this.weighingProxy.updateMetrologyRanges(JSON.parse(t.payload.value.toString()));break;case k.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE:this.weighingProxy.updateLastSelectedDisplayValue(JSON.parse(t.payload.value.toString()))}}catch(e){
this.exitError("unexpected value content for incoming MQTT event: "+t.payload.topic)}})),console.log("QAppBase: create the FSM with all custom states"),this.qappFsm=r.createFsm(this.qappStates),delete this.__machina__,this.eventQueue.splice(0),this.qappFsm.on("transition",this.onFsmTransitionInternal),this.mqttHandler.subscribe(k.MqttTopics.QAPP_DEBUG_TOPIC_PREAMBLE+"/#"),this.onRunning(),console.log("QAppBase: schedule transition to custom start state"),setTimeout(()=>{console.log("QAppBase: start heartbeating"),this.heartbeatIntervalSubscription=this.heartbeatInterval$.subscribe(()=>{this.addHeartbeatEvent(":-)")}),console.log("QAppBase: initiate transition to custom start state"),this.qappFsm.handle(this,J,this.isDevelVersion?$:t),console.log("QAppBase: initiated transition to custom start state")},q),console.log("QAppBase: run finished")}}canSuspend(){if(console.log("QAppBase: Can suspend?"),this.suspendReason===lt.SUSPEND_APP)return!0;if(console.log("QAppBase: Check printQueue"),
this.reportingProxy.isPrintQueueEmpty())return console.log("QAppBase: printQueue is empty, exiting the QApp."),!0;if(this.suspendReason===lt.SUSPEND_LOGOUT)this.showPriorMsgBox({type:N.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TITLE",args:[]},buttons:[{id:et,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:Y.EnumAppearance.ENABLED_SECONDARY},{id:at,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:Y.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_top",args:[]},{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_mid",args:[this.getTaskName()]},{id:"_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_bottom",args:[]}]});else{if(this.suspendReason!==lt.SUSPEND_HOME)return!1;this.showPriorMsgBox({type:N.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_HOME_WARNING_TITLE",args:[]},buttons:[{id:Z,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:Y.EnumAppearance.ENABLED_SECONDARY},{id:tt,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},
appearance:Y.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_HOME_WARNING_TEXT_top",args:[]},{id:"_QAPP_LIB_MBOX_HOME_WARNING_TEXT_mid",args:[this.getTaskName()]},{id:"_QAPP_LIB_MBOX_HOME_WARNING_TEXT_bottom",args:[]}]})}return console.log("QAppBase: printQueue is not empty, asking for permission to exist task."),!1}continueSuspend(){this.suspendReason!==lt.SUSPEND_NO_SUSPEND?(console.log("QAppBase: Continue last suspend request"),this.clearPrintQueue(),this.handleEvent(new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_EXECFINALLY))):console.log("QAppBase: No suspend pending continue")}cancelSuspend(){console.log("QAppBase: Cancel last suspend request"),this.suspendReason=lt.SUSPEND_NO_SUSPEND}cancelLogout(){console.log("QAppBase: Cancel last logout request"),this.cancelSuspend(),this.forgetLogout()}rememberLogout(){this.mqttHandler.publish(k.MqttTopics.QAPP_LOGOUT_REQUEST,JSON.stringify({request:rt}))}forgetLogout(){
this.mqttHandler.publish(k.MqttTopics.QAPP_LOGOUT_REQUEST,JSON.stringify({request:nt}))}suspend(){console.log("QAppBase: QApp suspend request"),this.suspendReason=lt.SUSPEND_APP,this.handleEvent(new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_EXECFINALLY))}doSuspend(){this.isErrorStatePublished||(console.log("QAppBase: suspend"),this.onSuspending(),this.doCloseAllOverlays(),console.log("QAppBase: publish STOPPED event of qapp"),this.mqttHandler.publish(k.MqttTopics.QAPP_STOPPED,this.taskId?""+this.taskId:"",{retain:!1}),setTimeout(()=>{console.log("process.exit"),process.exit(0)},K),this.exitTimeOutPending=!0)}canRestart(){return console.log("QAppBase: can restart? - check printQueue"),this.reportingProxy.isPrintQueueEmpty()?(console.log("QAppBase: printQueue is empty, restart the QApp."),!0):(this.showPriorMsgBox({type:N.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MBOX_RESTART_QUESTION_TITLE",args:[]},buttons:[{id:it,label:{id:"_QAPP_LIB_MBOX_BTN_YES",
args:[]},appearance:Y.EnumAppearance.ENABLED_SECONDARY},{id:st,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:Y.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_RESTART_QUESTION_TEXT_top",args:[this.getTaskName()]},{id:"_QAPP_LIB_MBOX_RESTART_QUESTION_TEXT_bottom",args:[]}]}),console.log("QAppBase: printQueue is not empty, asking for permission to restart task."),!1)}continueRestart(){console.log("QAppBase: Continue last restart request"),this.handleEvent(new o.InternalRestartEvent(o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_EXECFINALLY))}doCloseAllOverlays(){this.hidePrintQueue();for(let t in this.screens){let e=this.screens[t].getButton(S.CANCEL_BARBUTTON_ID);if(e&&e.setAppearance(Y.EnumAppearance.HIDDEN),t!==R.LOADING_OVERLAY_ID)try{this.screens[t].hide()}catch(t){}}this.hideAllMsgBox()}exitError(t){this.isErrorStatePublished=!0;let e=(new Error).stack;console.log("QAppBase: exit with error: "+t),console.log("exitError: "),console.log(e),
this.doCloseAllOverlays(),this.messageHandlerHelper.addMessage(B.EMsgHandlerMsgs.ERR_799_GENERIC_INTERNAL_ERROR,t,void 0,[y.createMessageHandlerButton(void 0,void 0,y.MessageHandlerCallTarget.REMOVE_MESSAGE)]),this.onErrorExiting(t),this.mqttHandler.publish(k.MqttTopics.QAPP_ERROR,(this.taskId?""+this.taskId:"")+"error: "+t,{retain:!1}),setTimeout(()=>{console.error("QAppBase: exit with error: "+t),process.exit(-1)},K),this.exitTimeOutPending=!0}heartbeat(t){this.isErrorStatePublished||(this.debugCfg.enableHeartbeatLog&&console.log("."),this.mqttHandler.publish(k.MqttTopics.QAPP_HEARTBEAT,JSON.stringify(t),{retain:!1}))}addHeartbeatEvent(t){this.addToEventQueue(new o.HeartbeatEvent({message:t,value:this.heartbeatCount++}))}checkForCustomHeartbeatEvent(t,e){try{return t.payload.event===O.MQTT_ADMIN_EVENT_PACKET_SENT&&t.payload.packet.topic===k.MqttTopics.QAPP_HEARTBEAT&&JSON.parse(t.payload.packet.payload.toString()).message===e}catch(t){return!1}}adaptFsmStates(t){}
prepareAndExtendFsmStates(t){let e;if(console.log("QAppBase::prepareAndExtendFsmStates: create state machine with QApp specific states"),void 0===this.qappStates){e=this.provideFsmStates();for(let t in this.aspects)Object.assign(e,this.aspects[t].getAspectStates());e[$]={_onEnter:function(t){t.showMessageBox({type:N.EnumMessageboxType.INFO,title:{id:"_QAPP_LIB_MBOX_DEMO_INFO_TITLE",args:[]},buttons:[{id:z,label:{id:G.EnumFontLabels.OK,args:[]},appearance:Y.EnumAppearance.ENABLED_SECONDARY}],textList:[{id:"_QAPP_LIB_MBOX_DEMO_INFO_TEXT",args:[]}]})},_onExit:function(t){},EV_HMI_BTN_CLICKED:function(e,a){return a.payload.buttonId===z&&(e.hideMsgBox(),this.transition(e,t)),""}},this.adaptFsmStates(e);for(let t in this.aspects)if(this.aspects[t].getId()===x.LOCKING_ASPECT){this.aspects[t].adaptFsmStates(e);break}let a=function(t,e){t.heartbeat(e.payload)};for(let t in e)e.hasOwnProperty(t)&&(e[t]._FSM_HEARTBEAT_EVENT_=a,e[t]._INTERNAL_SUSPEND_EVENT_=function(t,e){switch(e.payload){
case o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_HOME:case o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_LOGOUT:console.log("QAppBase: HOME/LOGOUT button suspend request"),e.payload===o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_HOME?t.suspendReason=lt.SUSPEND_HOME:t.suspendReason=lt.SUSPEND_LOGOUT,t.canSuspend()?this.transition(t,j):console.log("QAppBase: HOME/LOGOUT suspend interrupted by QApp");break;case o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT:console.log("QAppBase: auto logout suspend request"),t.suspendReason=lt.SUSPEND_HOME,this.transition(t,j);break;case o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_EXECFINALLY:this.transition(t,j)}},e[t]._INTERNAL_RESTART_EVENT_=function(t,e){switch(e.payload){case o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_REQUEST:t.canRestart()?this.transition(t,X):console.log("QAppBase: restart interrupted by QApp");break;case o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_EXECFINALLY:
this.transition(t,X)}});e[j]={_onEnter:function(t){t.showLoadingScreen({id:"",args:[]})},_onExit:function(t){},MQTT_ADMIN_EVENT:function(t,e){t.checkForLoadingScreenEnableEvent(e)&&t.doSuspend()},_FSM_HEARTBEAT_EVENT_:a},e[X]={_onEnter:function(t){t.showLoadingScreen({id:"_QAPP_LIB_LOADING_OVERLAY_TEXT_RESTARTING_APP",args:[t.getTaskName()]})},_onExit:function(t){},MQTT_ADMIN_EVENT:function(t,e){t.checkForLoadingScreenEnableEvent(e)&&(t.clearPrintQueue(),this.transition(t,r.STATE_UNINITIALIZED_INTERNAL),t.restart(),t.run())},_FSM_HEARTBEAT_EVENT_:a}}else e=this.qappStates;return e}handleEvent(t){if(this.qappFsm){if(t instanceof E.MqttUpdateDebugEvent&&t.payload.topic===k.MqttTopics.QAPP_DEBUG_STOP_HEARTBEAT&&(console.log("DEBUG: stop heartbeat received"),this.heartbeatIntervalSubscription&&(console.log("DEBUG: stop heartbeat > unsubscribe on heartbeatInterval"),this.heartbeatIntervalSubscription.unsubscribe())),
t instanceof u.HmiButtonClickedEvent)if(t.payload.buttonId!==V.BTN_HOME_ID||this.suppressGlobalHomeBtnHandling)if(t.payload.buttonId!==V.BTN_LOGOUT_ID||this.suppressGlobalLogoutBtnHandling){if(t.payload.buttonId===Z)return void this.continueSuspend();if(t.payload.buttonId===et)return void this.continueSuspend();if(t.payload.buttonId===tt)return this.cancelSuspend(),this.hidePriorMsgBox(),void this.hideLoadingScreen();if(t.payload.buttonId===at)return this.cancelLogout(),this.hidePriorMsgBox(),void this.hideLoadingScreen();if(t.payload.buttonId!==e.PRINT_RESTART_BUTTON_ID||this.suppressGlobalRestartBtnHandling){if(t.payload.buttonId===it)return void this.continueRestart();if(t.payload.buttonId===st)return this.hidePriorMsgBox(),void this.hideLoadingScreen();if(void 0!==this.buttons.docuButton&&t.payload.buttonId===this.buttons.docuButton.getButtonId())return void this.handleDocuButton()}else t=new o.InternalRestartEvent(o.INTERNAL_RESTART_EVENT_TYPE.RESTART_EVENT_TYPE_REQUEST)
}else t=new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_LOGOUT);else t=new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_HOME);if(t instanceof E.MqttUpdateEvent&&t.payload.topic===k.MqttTopics.USERMANAGEMENT_AUTO_LOGOUT_EVENT)try{JSON.parse(t.payload.value.toString()).logOff&&(t=new o.InternalSuspendEvent(o.INTERNAL_SUSPEND_EVENT_TYPE.SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT))}catch(t){}if(t instanceof o.InternalAsyncCallEvent){let e=this.outstandingAsyncCalls.findIndex(e=>e===t.payload.id);if(-1===e)return void console.log(`QAppBase::handleEvent: async event already handled - discard result (${t.payload.type}) for metadata: ${t.payload.data.metadata}`);switch(t.payload.type){case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_SUCCESS:t.payload.timerId&&n.clearTimeout(t.payload.timerId),this.outstandingAsyncCalls.splice(e,1),t=new _.QAppAsyncCallDoneEvent(t.payload.data);break
;case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_FAIL:t.payload.timerId&&n.clearTimeout(t.payload.timerId),this.outstandingAsyncCalls.splice(e,1),t=new _.QAppAsyncCallFailEvent(t.payload.data);break;case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT:this.outstandingAsyncCalls.splice(e,1),t=new _.QAppAsyncCallFailEvent(t.payload.data);break;case o.INTERNAL_ASYNC_CALL_EVENT_TYPE.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT_WITH_FETCHING_RESP:t=new _.QAppAsyncCallFailEvent(t.payload.data)}}this.qappFsm.handle(this,t.type,t)}else this.exitError("QAppBase::handleEvent - no fsm instance set, unexpectedly")}onFsmTransitionInternal(t){if(console.log("QAppBase: transition from <",t.fromState,"> to <",t.toState,"> (machina ev: <",t.action,">)"),t.fromState){let e=t.client.qappFsm.states[t.fromState]._transTo;if(e){let a=e[t.toState];a?a(t.client,t):(a=e["~"])&&a(t.client,t),(a=e["*"])&&a(t.client,t)}if(t.fromState===r.STATE_UNINITIALIZED_INTERNAL){
t.client.mqttHandler.subscribe(k.MqttTopics.METROLOGY_MAX_DIGITS),t.client.mqttHandler.subscribe(k.MqttTopics.METROLOGY_MAX_DIGITS_DEBUG),t.client.mqttHandler.subscribe(k.MqttTopics.METROLOGY_RANGES),t.client.mqttHandler.subscribe(k.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE),t.client.mqttHandler.subscribe(k.MqttTopics.USERMANAGEMENT_AUTO_LOGOUT_EVENT),console.log("QAppBase: handle transition to custom initial state: initTaskHandler"),t.client.initTaskHandler(),console.log("QAppBase: handle transition to custom initial state: adaptTaskHandler"),t.client.adaptTaskHandler(),console.log("QAppBase: clear all task and QApp errors from messageHandler");let e=[],a=t.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP);a&&e.push({categoryAsString:y.MessageHandlerCategory.QAPP,secret:a});let i=t.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP_DB_ERROR);i&&e.push({categoryAsString:y.MessageHandlerCategory.QAPP,secret:i})
;let s=t.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP_RUNTIME_COMM_ERROR);s&&e.push({categoryAsString:y.MessageHandlerCategory.QAPP,secret:s});let n=t.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP_RUNTIME_EXIT_ERROR);n&&e.push({categoryAsString:y.MessageHandlerCategory.QAPP,secret:n});let r=void 0;void 0!==t.client.taskId&&(r=t.client.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.TASKID))&&e.push({categoryAsString:y.MessageHandlerCategory.QAPP,secret:r});let o=!1;try{o=!t.client.messageHandlerProxy.deleteMessagesByCategory(e).isSuccess()}catch(t){o=!0}o&&(console.log("QAppBase: bulk call failed/not supported - use multiple messageHandler calls instead"),a&&t.client.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,a),i&&t.client.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,i),
s&&t.client.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,s),n&&t.client.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,n),r&&t.client.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,r)),console.log("QAppBase: handle transition to custom initial state: init"),t.client.init(),console.log("QAppBase: handle transition to custom initial state: init all aspects");for(let e in t.client.aspects)console.log("init aspect: ",e),t.client.aspects[e].init(t.client);console.log("QAppBase: handle transition to custom initial state: postInit"),t.client.postInit(),console.log("QAppBase: handle transition to custom initial state: ...done")}}if(t.client.onFsmTransition(t),t.fromState===r.STATE_UNINITIALIZED_INTERNAL&&(console.log("QAppBase: publish running state of qapp"),t.client.mqttHandler.publish(k.MqttTopics.QAPP_STARTED,t.client.taskId?""+t.client.taskId:"create Task",{retain:!1})),t.toState){
let e=t.client.qappFsm.states[t.toState]._transFrom;if(e){let a=e[t.fromState];a?a(t.client,t):(a=e["~"])&&a(t.client,t),(a=e["*"])&&a(t.client,t)}}}getCurrentState(){let t=this.__machina__._qappStm_.state;return console.log("QAppBase::getCurrentState: ",t),t}onRunning(){console.log("QAppBase: default callback after QApp published RUNNING event")}restart(){this.announceRestart(),this.specificRestart(),this.onSuspending(),this.doCloseAllOverlays();for(let t of this.subscriptions)t.unsubscribe();this.heartbeatIntervalSubscription&&this.heartbeatIntervalSubscription.unsubscribe(),this.mqttHandler.unsubscribeTopics(),this.weighingProxy.clearTare1AndTare2()}announceRestart(){console.log("QAppBase: announce restart to system"),this.taskMngProxy.setTaskEvent(this.taskId?this.taskId:"---",d.EnumTaskManagementEvent.EVENT_RESTART)}specificRestart(){console.log("QAppBase: default callback before QApp restarts")}onSuspending(){
console.log("QAppBase: default callback before QApp publishes STOPPED event and exits")}onErrorExiting(t){console.log("QAppBase: default callback before QApp publishes ERROR event and aborts")}onFsmTransition(t){console.log("QAppBase: default callback for transitions")}getStorageLocation(t){let a=void 0,i=this.taskHandler.getTask();switch(t){case D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT:a=e.STORAGE_LOCATION_BASE;break;case D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC:i&&(a=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT)+C.sep+i.qappOrderNumber);break;case D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION:i&&(a=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC)+C.sep+i.qappVersion);break;case D.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC:i&&this.taskId&&(a=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION)+C.sep+this.taskId)}return a}
createStorageLocation(t){let e=a(29),i=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT);if(void 0!==i){if(!e.existsSync(i))return!1;if(t!==D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT){let a=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC);if(void 0!==a){if(e.existsSync(a)||e.mkdirSync(a),t!==D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC){let a=this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION);if(void 0!==a){if(e.existsSync(a)||e.mkdirSync(a),t!==D.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION){return void 0!==this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC)&&(e.existsSync(this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC))||e.mkdirSync(this.getStorageLocation(D.EnumPersistencyScope.PERSISTENCY_SCOPE_TASk_SPECIFIC)),!0)}return!0}return!1}return!0}return!1}return!0}return!1}
readQAppDescQTFAsJSON(t,e){let a=void 0,i=void 0,s="";if(W.isString(e)&&e.length>0)s=e;else{if(!this.scriptPath)return void console.log("QAppConfigBase::readQAppDescAsJSON - internal error - no scriptPath is set.");s=C.dirname(this.scriptPath)+"/../"}let n="";try{n=s+"qapp.desc_"+t+".json",i=M.readFileSync(n)}catch(t){console.log("QAppConfigBase: - no "+n+" found - try DEFAULT");try{n=s+"qapp.desc_DEFAULT.json",i=M.readFileSync(n)}catch(t){return void console.log("QAppConfigBase::readQAppDescAsJSON - "+n+" (fallback) missing")}}try{i&&(a=JSON.parse(i.toString("utf-8")))}catch(t){return void console.log("QAppConfigBase::readQAppDescAsJSON - "+n+" not valid JSON")}return a.name=a.hasOwnProperty("name")?a.name:"ERROR",a.shortDescription=a.hasOwnProperty("shortDescription")?a.shortDescription:"ERROR",a.longDescription=a.hasOwnProperty("longDescription")?a.longDescription:"ERROR",a}relevantParamsAreEqual(t,a){let i=U.cloneJSON(t),s=U.cloneJSON(a);return i.forEach((t,a)=>{
t.id===ot?delete i[a]:t.id===_t&&t.parameters.forEach((t,s)=>{t.id.startsWith(e.TASK_PROFILE_REPORTING_ID_PREFIX)?delete i[a].parameters[s]:t.id===e.TASK_PROFILE_WEIGHING_ID&&(t.info.options=[])})}),s.forEach((t,a)=>{t.id===ot?delete s[a]:t.id===_t&&t.parameters.forEach((t,i)=>{t.id.startsWith(e.TASK_PROFILE_REPORTING_ID_PREFIX)?delete s[a].parameters[i]:t.id===e.TASK_PROFILE_WEIGHING_ID&&(t.info.options=[])})}),L.isEqual(i,s)}deleteDBError(){let t=this.messageHandlerHelper.buildSecret(B.MESSAGE_HANDLER_SECRET_TYPE.QAPP_DB_ERROR);t&&this.messageHandlerProxy.deleteMessageByCategory(y.MessageHandlerCategory.QAPP,t)}}e.QAppBase=ut},function(t,e){t.exports=require("typeorm")},function(t,e){t.exports=require("util")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(23),s=a(36),n=a(7),r=a(2);var o,_;function E(t,a,s){let n=e.unitsMap[_.NONE],r=e.unitsMap[_.NONE];if(null==t)return i.bignumber(NaN);if(!e.unitsMap.hasOwnProperty(a))return t
;if(!e.unitsMap.hasOwnProperty(s))return t;if(n=e.unitsMap[a],r=e.unitsMap[s],n.id===r.id)return t;if(n.unitConversionBase===o.UNDEFINED||r.unitConversionBase===o.UNDEFINED||void 0==n.conversionFactor||void 0==r.conversionFactor)return t;const E=[o.MASS,o.VOLUME];if(!(n.unitConversionBase===r.unitConversionBase||E.includes(n.unitConversionBase)&&E.includes(r.unitConversionBase)))return t;switch(n.unitConversionBase){case o.MASS:case o.VOLUME:case o.PRESSURE:return t.times(r.conversionFactor).dividedBy(n.conversionFactor);case o.TEMPERATURE:{let e=t;switch(n.id){case _.GRAD_CELSIUS:e=t.add(273.15);break;case _.GRAD_FAHRENHEIT:e=t.sub(32).dividedBy(n.conversionFactor).add(273.15)}switch(r.id){case _.GRAD_CELSIUS:return e.sub(273.15);case _.GRAD_FAHRENHEIT:return e.sub(273.15).times(r.conversionFactor).add(32);case _.KELVIN:return e}return t}default:return t}}function l(t,e,a){let s=E(n.isNumber(t)?i.bignumber(t):t,e,a);return null==s?NaN:s.toNumber()}function u(t,e){
return I(t,e).toFixed(Math.max(0,e))}function c(t,a){let i=r.cloneJSON(t);i.alibi=void 0,i.alibiId=void 0;let n=e.unitsMap[t.unit],_=e.unitsMap[a];if(n.id===_.id)return i;if(n.unitConversionBase===o.UNDEFINED||_.unitConversionBase===o.UNDEFINED)return i;const E=[o.MASS,o.VOLUME];return n.unitConversionBase===_.unitConversionBase||E.includes(n.unitConversionBase)&&E.includes(_.unitConversionBase)?(i.value=l(i.value,t.unit,a),i.unit=a,i.decimals=i.decimals-s.getUnitShift(t.unit)+s.getUnitShift(a),i.decimals<0&&(i.decimals=0),delete i.alibiId,i):i}function T(t){return t?e.unitsMap.hasOwnProperty(t.toString())?e.unitsMap[t].mark:t.toString():""}function d(t){const a=n.getObjectByID(Object.values(e.unitsMap),t,"mark");return null!=a?a.id:_.NONE}function p(t){let e=[];if(null==t||void 0===t)return e;if(0==t.length)return e;let a=_.NONE
;for(let i=0;i<t.length;i++)n.isNumber(t[i])?e.push(t[i]):n.isObject(t[i])&&t[i].hasOwnProperty("value")&&n.isNumber(t[i].value)&&t[i].hasOwnProperty("unit")&&(a!==_.NONE?e.push(c(t[i],a).value):(e.push(t[i].value),a=t[i].unit));return e}function A(t){let e=0;if(null==t||void 0===t)return e;if(0==t.length)return e;for(let a=0;a<t.length;a++)"object"==typeof t[a]&&t[a].hasOwnProperty("decimals")&&(e=t[a].decimals>e?t[a].decimals:e);return e}function I(t,e){let a=i.bignumber(t),s=i.bignumber(10).pow(e);return a.times(s).round().dividedBy(s).toNumber()}function h(t){let e=p(t);return n.isObject(e)&&0!==e.length?i.sum(e):NaN}function m(t){let e=p(t);return n.isObject(t)&&0!==t.length?i.mean(e):NaN}function N(t,e){let a=[];for(let i=0;i<t.length;i++)n.isNumber(t[i].value)&&(a[i]=c(t[i],e));return{value:m(a),unit:e,decimals:A(a)}}function S(t,e){return n.isObject(t)?i.bignumber(t.value).dividedBy(e).toNumber():i.bignumber(t).dividedBy(e).toNumber()}function g(t){let e=p(t)
;return n.isObject(e)&&0!==e.length?i.std(e,"unbiased"):NaN}function R(t,e){let a=[];for(let i=0;i<t.length;i++)n.isNumber(t[i].value)&&(a[i]=c(t[i],e));return{value:g(a),unit:e,decimals:A(a)}}function P(t,e,a){if(t<2||!n.isNumber(e)||!n.isNumber(a))return NaN;const s=i.bignumber(1).dividedBy(i.bignumber(t).minus(1)),r=i.bignumber(a).minus(i.bignumber(e).pow(2).dividedBy(i.bignumber(t)));return s.isNaN()||r.isNaN()?NaN:i.sqrt(s.times(r.abs())).toNumber()}function O(t){let e=p(t);return n.isObject(e)&&0!==e.length?i.min(e):NaN}function D(t){let e=p(t);return n.isObject(e)&&0!==e.length?i.max(e):NaN}function C(t){let e=p(t);return n.isObject(e)&&0!==e.length?M(g(e),m(e)):NaN}function M(t,e){let a=0,s=0;return a=n.isObject(t)?t.value:t,s=n.isObject(e)?e.value:e,n.isObject(t)&&n.isObject(e)&&(a=c(t,e.unit).value),i.bignumber(a).dividedBy(s).times(100).toNumber()}function L(t,e,a){let s=NaN,r=NaN,o=NaN,E=_.NONE;return n.isObject(t)?(s=t.value,E=t.unit):s=t,
n.isObject(e)?E!==_.NONE?r=c(e,E).value:(r=e.value,E=e.unit):r=e,n.isObject(a)?E!==_.NONE?o=c(a,E).value:(o=a.value,E=a.unit):o=a,i.bignumber(o).minus(r).dividedBy(i.bignumber(s).times(6)).toNumber()}function b(t,e,a){return{value:L(t,e,a),unit:_.NONE,decimals:3}}function f(t,e,a,s){let r=NaN,o=NaN,E=NaN,l=NaN,u=_.NONE;return n.isObject(t)?(r=t.value,u=t.unit):r=t,n.isObject(e)?u!==_.NONE?o=c(e,u).value:(o=e.value,u=e.unit):o=e,n.isObject(a)?u!==_.NONE?E=c(a,u).value:(E=a.value,u=a.unit):E=a,n.isObject(s)?u!==_.NONE?l=c(s,u).value:(l=s.value,u=s.unit):l=s,i.min(i.bignumber(o).minus(E).dividedBy(i.bignumber(r).times(3)),i.bignumber(l).minus(o).dividedBy(i.bignumber(r).times(3))).toNumber()}function y(t,e,a,i){return{value:f(t,e,a,i),unit:_.NONE,decimals:3}}!function(t){t.UNDEFINED="UNDEFINED",t.MASS="MASS",t.TEMPERATURE="TEMPERATURE",t.PRESSURE="PRESSURE",t.VOLUME="VOLUME"}(o=e.EnumUnitType||(e.EnumUnitType={})),function(t){t.NONE="NONE",t.DIGIT="DIGIT",t.UNIVERSAL="UNIVERSAL",
t.MICROGRAM="MICROGRAM",t.MILLIGRAM="MILLIGRAM",t.GRAM="GRAM",t.KILOGRAM="KILOGRAM",t.TONNE="TONNE",t.MILLICARAT="MILLICARAT",t.CARAT="CARAT",t.KILOCARAT="KILOCARAT",t.KARAT="KARAT",t.POUND="POUND",t.OUNCE="OUNCE",t.POUND_OUNCE="POUND_OUNCE",t.TROYOUNCE="TROYOUNCE",t.PENNYWEIGHT="PENNYWEIGHT",t.GRAIN="GRAIN",t.PARTS_PER_POUND="PARTS_PER_POUND",t.TAEL_HONGKONG="TAEL_HONGKONG",t.TAEL_SINGAPORE="TAEL_SINGAPORE",t.TAEL_TAIWAN="TAEL_TAIWAN",t.TAEL_CHINA="TAEL_CHINA",t.MOMME="MOMME",t.TOLA="TOLA",t.BAHT="BAHT",t.MESGHAL="MESGHAL",t.NEWTON="NEWTON",t.WARNING="WARNING",t.PIECES="PIECES",t.PERCENT="PERCENT",t.MILLIMETER="MILLIMETER",t.CENTIMETER="CENTIMETER",t.METER="METER",t.KILOMETER="KILOMETER",t.GRAM_PER_MILLILITER="GRAM_PER_MILLILITER",t.MILLION_CELLS_PER_MILLILITER="MILLION_CELLS_PER_MILLILITER",t.MICROGRAM_PER_MILLILITER="MICROGRAM_PER_MILLILITER",t.MICROGRAM_PER_LITER="MICROGRAM_PER_LITER",t.MILLIGRAM_PER_MILLILITER="MILLIGRAM_PER_MILLILITER",t.MILLIGRAM_PER_LITER="MILLIGRAM_PER_LITER",
t.MILLIMOL_PER_MILLILITER="MILLIMOL_PER_MILLILITER",t.GRAM_PER_CUBICCENTIMETRE="GRAM_PER_CUBICCENTIMETRE",t.CUBICCENTIMETRE="CUBICCENTIMETRE",t.SQUARECENTIMETRE="SQUARECENTIMETRE",t.SQUAREMETRE="SQUAREMETRE",t.GRAMMAGE="GRAMMAGE",t.MICROLITER="MICROLITER",t.MILLILITER="MILLILITER",t.MILLILITER_PER_SECOND="MILLILITER_PER_SECOND",t.MILLILITER_PER_MINUTE="MILLILITER_PER_MINUTE",t.MILLILITER_PER_HOUR="MILLILITER_PER_HOUR",t.LITER="LITER",t.MILLIMOL="MILLIMOL",t.GRAD_CELSIUS="GRAD_CELSIUS",t.GRAD_FAHRENHEIT="GRAD_FAHRENHEIT",t.SECOND="SECOND",t.MINUTE="MINUTE",t.HOUR="HOUR",t.DAY="DAY",t.TIME_AM="TIME_AM",t.TIME_PM="TIME_PM",t.VOLT="VOLT",t.MILLIAMPER="MILLIAMPER",t.HECTOPASCAL="HECTOPASCAL",t.KILOPASCAL="KILOPASCAL",t.GRAM_PER_MOL="GRAM_PER_MOL",t.INVALID="INVALID",t.RPM="RPM",t.MILLIVOLT="MILLIVOLT",t.MILLIVOLT_PER_PH="MILLIVOLT_PER_PH",t.MICROSIEMENS_PER_CENTIMETER="MICROSIEMENS_PER_CENTIMETER",t.GRAM_PER_SQUARE_CENTIMETER="GRAM_PER_SQUARE_CENTIMETER",t.GRAM_PER_METER="GRAM_PER_METER",
t.CENTILITER="CENTILITER",t.DENSITY="DENSITY",t.VOLUME="VOLUME",t.KG_M3="KG_M3",t.MMHG="MMHG",t.KELVIN="KELVIN",t.PASCAL="PASCAL"}(_=e.EnumUnit||(e.EnumUnit={})),e.unitsMap={NONE:{id:_.NONE,mark:"",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},DIGIT:{id:_.DIGIT,mark:"d",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},UNIVERSAL:{id:_.UNIVERSAL,mark:"o",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROGRAM:{id:_.MICROGRAM,mark:"µg",unitConversionBase:o.MASS,conversionFactor:1e6,conversionDecimalPlacesShift:-6},MILLIGRAM:{id:_.MILLIGRAM,mark:"mg",unitConversionBase:o.MASS,conversionFactor:1e3,conversionDecimalPlacesShift:-3},GRAM:{id:_.GRAM,mark:"g",unitConversionBase:o.MASS,conversionFactor:1,conversionDecimalPlacesShift:0},KILOGRAM:{id:_.KILOGRAM,mark:"kg",unitConversionBase:o.MASS,conversionFactor:.001,conversionDecimalPlacesShift:3},TONNE:{
id:_.TONNE,mark:"t",unitConversionBase:o.MASS,conversionFactor:1e-6,conversionDecimalPlacesShift:6},MILLICARAT:{id:_.MILLICARAT,mark:"mct",unitConversionBase:o.MASS,conversionFactor:5e3,conversionDecimalPlacesShift:-3},CARAT:{id:_.CARAT,mark:"ct",unitConversionBase:o.MASS,conversionFactor:5,conversionDecimalPlacesShift:0},KILOCARAT:{id:_.KILOCARAT,mark:"kct",unitConversionBase:o.MASS,conversionFactor:.005,conversionDecimalPlacesShift:3},KARAT:{id:_.KARAT,mark:"K",unitConversionBase:o.MASS,conversionFactor:5,conversionDecimalPlacesShift:0},POUND:{id:_.POUND,mark:"lb",unitConversionBase:o.MASS,conversionFactor:.00220462262184878,conversionDecimalPlacesShift:3},OUNCE:{id:_.OUNCE,mark:"oz",unitConversionBase:o.MASS,conversionFactor:.0352739619495804,conversionDecimalPlacesShift:2},POUND_OUNCE:{id:_.POUND_OUNCE,mark:"lb:oz",unitConversionBase:o.MASS,conversionFactor:.035273962,conversionDecimalPlacesShift:2},TROYOUNCE:{id:_.TROYOUNCE,mark:"ozt",unitConversionBase:o.MASS,
conversionFactor:.032150747,conversionDecimalPlacesShift:2},PENNYWEIGHT:{id:_.PENNYWEIGHT,mark:"dwt",unitConversionBase:o.MASS,conversionFactor:.643014931,conversionDecimalPlacesShift:1},GRAIN:{id:_.GRAIN,mark:"GN",unitConversionBase:o.MASS,conversionFactor:15.43235835,conversionDecimalPlacesShift:-1},PARTS_PER_POUND:{id:_.PARTS_PER_POUND,mark:"/lb",unitConversionBase:o.MASS,conversionFactor:1.1287667712,conversionDecimalPlacesShift:0},TAEL_HONGKONG:{id:_.TAEL_HONGKONG,mark:"tlh",unitConversionBase:o.MASS,conversionFactor:.02671725,conversionDecimalPlacesShift:2},TAEL_SINGAPORE:{id:_.TAEL_SINGAPORE,mark:"tls",unitConversionBase:o.MASS,conversionFactor:.02645544638,conversionDecimalPlacesShift:2},TAEL_TAIWAN:{id:_.TAEL_TAIWAN,mark:"tlt",unitConversionBase:o.MASS,conversionFactor:.02666666,conversionDecimalPlacesShift:2},TAEL_CHINA:{id:_.TAEL_CHINA,mark:"tlc",unitConversionBase:o.MASS,conversionFactor:.02645547175,conversionDecimalPlacesShift:2},MOMME:{id:_.MOMME,mark:"mom",
unitConversionBase:o.MASS,conversionFactor:.26666666666666666,conversionDecimalPlacesShift:1},TOLA:{id:_.TOLA,mark:"tol",unitConversionBase:o.MASS,conversionFactor:.0857333381,conversionDecimalPlacesShift:1},BAHT:{id:_.BAHT,mark:"bat",unitConversionBase:o.MASS,conversionFactor:.06578947436,conversionDecimalPlacesShift:2},MESGHAL:{id:_.MESGHAL,mark:"MS",unitConversionBase:o.MASS,conversionFactor:.217,conversionDecimalPlacesShift:1},NEWTON:{id:_.NEWTON,mark:"N",unitConversionBase:o.MASS,conversionFactor:.00980665,conversionDecimalPlacesShift:2},WARNING:{id:_.WARNING,mark:"!",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},PIECES:{id:_.PIECES,mark:"pcs",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},PERCENT:{id:_.PERCENT,mark:"%",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIMETER:{id:_.MILLIMETER,mark:"mm",unitConversionBase:o.UNDEFINED,
conversionFactor:void 0,conversionDecimalPlacesShift:void 0},CENTIMETER:{id:_.CENTIMETER,mark:"cm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},METER:{id:_.METER,mark:"m",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},KILOMETER:{id:_.KILOMETER,mark:"km",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAM_PER_MILLILITER:{id:_.GRAM_PER_MILLILITER,mark:"g/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLION_CELLS_PER_MILLILITER:{id:_.MILLION_CELLS_PER_MILLILITER,mark:"10^6 cls/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROGRAM_PER_MILLILITER:{id:_.MICROGRAM_PER_MILLILITER,mark:"µg/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROGRAM_PER_LITER:{id:_.MICROGRAM_PER_LITER,mark:"µg/l",
unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIGRAM_PER_MILLILITER:{id:_.MILLIGRAM_PER_MILLILITER,mark:"mg/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIGRAM_PER_LITER:{id:_.MILLIGRAM_PER_LITER,mark:"mg/l",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIMOL_PER_MILLILITER:{id:_.MILLIMOL_PER_MILLILITER,mark:"mmol/ml",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAM_PER_CUBICCENTIMETRE:{id:_.GRAM_PER_CUBICCENTIMETRE,mark:"g/cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},CUBICCENTIMETRE:{id:_.CUBICCENTIMETRE,mark:"cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},SQUARECENTIMETRE:{id:_.SQUARECENTIMETRE,mark:"cm²",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,
conversionDecimalPlacesShift:void 0},SQUAREMETRE:{id:_.SQUAREMETRE,mark:"m²",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAMMAGE:{id:_.GRAMMAGE,mark:"g/m²",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROLITER:{id:_.MICROLITER,mark:"µl",unitConversionBase:o.VOLUME,conversionFactor:1e3,conversionDecimalPlacesShift:-3},MILLILITER:{id:_.MILLILITER,mark:"ml",unitConversionBase:o.VOLUME,conversionFactor:1,conversionDecimalPlacesShift:0},MILLILITER_PER_SECOND:{id:_.MILLILITER_PER_SECOND,mark:"ml/s",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLILITER_PER_MINUTE:{id:_.MILLILITER_PER_MINUTE,mark:"ml/min",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLILITER_PER_HOUR:{id:_.MILLILITER_PER_HOUR,mark:"ml/h",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},
LITER:{id:_.LITER,mark:"l",unitConversionBase:o.VOLUME,conversionFactor:.001,conversionDecimalPlacesShift:3},MILLIMOL:{id:_.MILLIMOL,mark:"mmol",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAD_CELSIUS:{id:_.GRAD_CELSIUS,mark:"°C",unitConversionBase:o.TEMPERATURE,conversionFactor:1,conversionDecimalPlacesShift:0},GRAD_FAHRENHEIT:{id:_.GRAD_FAHRENHEIT,mark:"°F",unitConversionBase:o.TEMPERATURE,conversionFactor:1.8,conversionDecimalPlacesShift:0},SECOND:{id:_.SECOND,mark:"sec",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MINUTE:{id:_.MINUTE,mark:"min",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},HOUR:{id:_.HOUR,mark:"h",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},DAY:{id:_.DAY,mark:"d",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},TIME_AM:{id:_.TIME_AM,
mark:"am",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},TIME_PM:{id:_.TIME_PM,mark:"pm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},VOLT:{id:_.VOLT,mark:"V",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIAMPER:{id:_.MILLIAMPER,mark:"mA",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},HECTOPASCAL:{id:_.HECTOPASCAL,mark:"hPa",unitConversionBase:o.PRESSURE,conversionFactor:.01,conversionDecimalPlacesShift:2},KILOPASCAL:{id:_.KILOPASCAL,mark:"kPa",unitConversionBase:o.PRESSURE,conversionFactor:.001,conversionDecimalPlacesShift:3},GRAM_PER_MOL:{id:_.GRAM_PER_MOL,mark:"g/mol",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},INVALID:{id:_.INVALID,mark:"!invalid!",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},RPM:{
id:_.RPM,mark:"rpm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIVOLT:{id:_.MILLIVOLT,mark:"mV",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MILLIVOLT_PER_PH:{id:_.MILLIVOLT_PER_PH,mark:"mV/pH",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MICROSIEMENS_PER_CENTIMETER:{id:_.MICROSIEMENS_PER_CENTIMETER,mark:"µS/cm",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAM_PER_SQUARE_CENTIMETER:{id:_.GRAM_PER_SQUARE_CENTIMETER,mark:"g/cm²",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},GRAM_PER_METER:{id:_.GRAM_PER_METER,mark:"g/m",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},CENTILITER:{id:_.CENTILITER,mark:"cl",unitConversionBase:o.VOLUME,conversionFactor:.1,conversionDecimalPlacesShift:1},DENSITY:{id:_.DENSITY,
mark:"g/cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},VOLUME:{id:_.VOLUME,mark:"cm³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},KG_M3:{id:_.KG_M3,mark:"kg/m³",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},MMHG:{id:_.MMHG,mark:"mmHg",unitConversionBase:o.UNDEFINED,conversionFactor:void 0,conversionDecimalPlacesShift:void 0},KELVIN:{id:_.KELVIN,mark:"K",unitConversionBase:o.TEMPERATURE,conversionFactor:1,conversionDecimalPlacesShift:0},PASCAL:{id:_.PASCAL,mark:"Pa",unitConversionBase:o.PRESSURE,conversionFactor:1,conversionDecimalPlacesShift:0}},e.convertValueToTargetUnitBigNumber=E,e.convertValueToTargetUnit=l,e.createQuantity=function(t,e,a){let i={value:NaN,unit:_.NONE,decimals:0};if(n.isObject(t)){i=Object.assign(i,t)
;for(const t of Object.keys(i))["value","unit","decimals","auxiliaryDigits","alibiId","alibi","deviceserial","stable","timestamp","info"].includes(t)||delete i[t]}else if(n.isObject(e))(e=e).value.numbers.length>0&&(i.value=parseFloat(e.value.numbers[0])),i.unit=d(e.value.unit),i.decimals=e.value.decimals;else if(n.isObject(a)){const t=(a=a).value;i.value=parseFloat(t.number),n.isNumber(i.value)||(i.info=t.number),n.isNumber(i.value)&&"-"===t.sign&&(i.value*=-1),i.decimals=t.decimals,i.unit=d(t.unit),i.stable=t.isStable,n.isNumber(t.auxiliaryDigits)&&t.auxiliaryDigits>0&&(i.auxiliaryDigits=t.auxiliaryDigits)}return"BATH"===i.unit&&(i.unit=_.BAHT),i.unit=n.setEnumSafely(i.unit,_,_.NONE),i},e._formatQuantityParam_numberOnly=u,e.formatQuantityParam_numberOnly=function(t){return null!==t&&t.hasOwnProperty("value")&&t.hasOwnProperty("decimals")?n.isNumber(t.value)?u(t.value,t.decimals):"NaN":"N.A."},e.formatQuantityParam=function(t){
return null!==t&&t.hasOwnProperty("value")&&t.hasOwnProperty("unit")&&t.hasOwnProperty("decimals")?n.isNumber(t.value)?u(t.value,t.decimals)+" "+T(t.unit):"NaN":"N.A."},e.convertToTargetUnit=c,e.getUnitString=T,e.getUnitEnum=d,e.math_getSimple_numberArray=p,e.math_count=function(t){return p(t).length},e.math_getMaximumDecimals=A,e.math_roundUp=function(t,e){let a=i.bignumber(t),s=a.minus(a.floor()),n=(s=s.times(i.bignumber(10).pow(e))).minus(s.floor());return i.larger(n,0)&&(s=s.minus(n).add(1)),s=s.dividedBy(i.bignumber(10).pow(e)),a.floor().add(s).toNumber()},e.math_roundAuto=I,e.math_detectLeastSignificantDigit=function(t){let e=0,a=1,s=i.bignumber(t).abs(),n=s.floor(),r=s.minus(n);for(;r.greaterThan(0);)e++,n=(r=r.times(10)).floor(),r=r.minus(n);return e>0&&(a=n.dividedBy(i.bignumber(10).pow(e)).toNumber()),a},e.math_sum=h,e.math_Sum=function(t,e){let a=[];for(let i=0;i<t.length;i++)n.isNumber(t[i].value)&&(a[i]=c(t[i],e));return{value:h(a),unit:e,decimals:A(a)}},e.math_mean=m,
e.math_Mean=N,e.math_mean_longterm=S,e.math_Mean_Longterm=function(t,e,a){const i=c(t,a);return i.value=S(i,e),i},e.math_standard_deviation=g,e.math_Standard_Deviation=R,e.math_standard_deviation_longterm=P,e.math_Standard_Deviation_Longterm=function(t,e,a,i){return c({value:P(t,(e=c(e,a.unit)).value,a.value),unit:a.unit,decimals:a.decimals},i)},e.math_minimum=O,e.math_Minimum=function(t,e){let a=[];for(let i=0;i<t.length;i++)n.isNumber(t[i].value)&&(a[i]=c(t[i],e));return{value:O(a),unit:e,decimals:A(a)}},e.math_maximum=D,e.math_Maximum=function(t,e){let a=[];for(let i=0;i<t.length;i++)n.isNumber(t[i].value)&&(a[i]=c(t[i],e));return{value:D(a),unit:e,decimals:A(a)}},e.math_variation_coefficient=C,e.math_Variation_Coefficient=function(t){let e=[];for(let a=0;a<t.length;a++)n.isNumber(t[a].value)&&(e[a]=c(t[a],_.GRAM));return{value:C(e),unit:_.PERCENT,decimals:2}},e.math_variation_coefficient_longterm=M,e.math_Variation_Coefficient_Longterm=function(t,e){return{value:M(c(t,e.unit),e),
unit:_.PERCENT,decimals:2}},e.math_cp=function(t,e,a){let i=p(t);return n.isObject(t)&&0!==t.length?L(g(i),e,a):NaN},e.math_Cp=function(t,e,a){return b(R(t,e.unit),e,a)},e.math_cp_longterm=L,e.math_Cp_Longterm=b,e.math_cpk=function(t,e,a){return f(g(t),m(t),e,a)},e.math_Cpk=function(t,e,a){return y(R(t,e.unit),N(t,e.unit),e,a)},e.math_cpk_longterm=f,e.math_Cpk_Longterm=y},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(2);e.AbstractQAppAspect=class{configure(t){this.cfg=Object.assign(void 0!==this.cfg?this.cfg:{},t)}getConfig(){return i.cloneJSON(this.cfg)}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(3),s=a(49),n=a(17),r=a(36),o=a(0);e.digitsLimit=9,e.QUANTITY_PARAM_MAX_DIGITS_GENERAL=e.digitsLimit;class _{static setValue(t,a,i=0,s=e.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return _.setValueValueWithDecimals(t.value,a,t.value.preferredDecimals,i,s)}
static setValueValue(t,a,i=0,s=e.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return _.setValueValueWithDecimals(t,a,t.preferredDecimals,i,s)}static setValueWithDecimals(t,a,i,s=0,n=e.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return _.setValueValueWithDecimals(t.value,a,i,s,n)}static setValueValueWithDecimals(t,a,r,o=0,_=e.QUANTITY_PARAM_MAX_DIGITS_GENERAL,E=!1){let l="number"==typeof a?a:a.value,u=_-Math.floor(Math.abs(l)).toString().length,c=Math.min(u,r);c=Math.max(c,0),0===o&&t&&(t.decimals=c);let T=s.SartoMath.roundExactToDecimals(l,c).toFixed(c);if(t){if(E||0!==o)"number"!=typeof a&&(n.isArray(t.unit)?t.unit[0]=a.unit:t.unit=a.unit);else{for(let e=i.QUANTITY_PARAM_NUMBERS_MAX-2;e>=o;e--)void 0!==t.numbers[e]&&(t.numbers[e+1]=t.numbers[e]);if("number"==typeof a){if(n.isArray(t.unit))for(let e=i.QUANTITY_PARAM_NUMBERS_MAX-2;e>=o;e--)void 0!==t.unit[e]&&(t.unit[e+1]=t.unit[e])}else if(n.isArray(t.unit)){for(let e=i.QUANTITY_PARAM_NUMBERS_MAX-2;e>=o;e--)void 0!==t.unit[e]&&(t.unit[e+1]=t.unit[e])
;t.unit[0]=a.unit}else t.unit=a.unit}t.numbers[o]=T}return T}static roundToDecimalPlaces(t,a=e.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return _.roundToDecimalPlacesValue(t.value,a)}static roundToDecimalPlacesAllNumbers(t,a=e.QUANTITY_PARAM_MAX_DIGITS_GENERAL){return _.roundToDecimalPlacesValue(t.value,a,!0)}static roundToDecimalPlacesValue(t,a=e.QUANTITY_PARAM_MAX_DIGITS_GENERAL,i=!1){return t.numbers.forEach((e,s)=>{(0===s||i)&&-1!==t.preferredDecimals&&_.setValueValueWithDecimals(t,parseFloat(e),t.preferredDecimals,s,a,!0)}),t.numbers.map(t=>parseFloat(t))}static getValue(t,e=0){let a,i=(a=void 0!==t.value?t.value:t).numbers[e];return void 0!==i?parseFloat(i):Number.NaN}static getIntValue(t,e=0){let a,i=(a=void 0!==t.value?t.value:t).numbers[e];return void 0!==i?parseInt(i,10):Number.NaN}static changeUnit(t,a){let i;i=void 0!==t.value?t.value:t;const s=r.unitStringToLong(i.unit);i.numbers.forEach((t,n)=>{const o=r.convertWgtUnit(parseFloat(t),s,a)
;_.setValueValueWithDecimals(i,o,i.preferredDecimals,n,e.QUANTITY_PARAM_MAX_DIGITS_GENERAL,!0)}),i.unit=r.unitStringToShort(a)}}e.QuantityParameter=_;e.WeightBlockHelper=class{static getMeasureParameter(t,e){for(const a of t.parameters)for(const t of a.parameters)if(t.id===e&&t.type===o.EnumParameterTypes.PARAM_MEASURE)return t}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TASK_DYNAMIC_ID_GROUPS_PREFIX="TASK/DYNAMIC_ID",e.TASK_DYNAMIC_ID_CNT_GROUP_ID=e.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_CNT",e.TASK_DYNAMIC_ID_LID_GROUP_ID=e.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_LID",e.TASK_DYNAMIC_ID_SID_GROUP_ID=e.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_SID",e.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID=e.TASK_DYNAMIC_ID_GROUPS_PREFIX+"_DB_CONN_CONFIG",e.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID=e.TASK_DYNAMIC_ID_CNT_GROUP_ID+"/LID_CNT",e.TASK_DYNAMIC_ID_LID_X_PARAM_ID_PREFIX=e.TASK_DYNAMIC_ID_LID_GROUP_ID+"/LID_",e.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_HEADER="H_",
e.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_TITLE="T_",e.TASK_DYNAMIC_ID_LID_CNT_MIN=0,e.TASK_DYNAMIC_ID_LID_CNT_MAX=5,e.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID=e.TASK_DYNAMIC_ID_CNT_GROUP_ID+"/SID_CNT",e.TASK_DYNAMIC_ID_SID_X_PARAM_ID_PREFIX=e.TASK_DYNAMIC_ID_SID_GROUP_ID+"/SID_",e.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_HEADER="H_",e.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_TITLE="T_",e.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_MODE="M_",e.TASK_DYNAMIC_ID_SID_CNT_MIN=0,e.TASK_DYNAMIC_ID_SID_CNT_MAX=5,e.TASK_DYNAMIC_ID_DB_TYPES_PARAM_ID=e.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/TYPES",e.TASK_DYNAMIC_ID_DB_USERNAME_PARAM_ID=e.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/USERNAME",e.TASK_DYNAMIC_ID_DB_PASSWORD_PARAM_ID=e.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/PASSWORD",e.TASK_DYNAMIC_ID_DB_DATABASE_PARAM_ID=e.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/DATABASE",e.TASK_DYNAMIC_ID_DB_SCHEMA_PARAM_ID=e.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/SCHEMA",
e.TASK_DYNAMIC_ID_DB_IP_PARAM_ID=e.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/IP",e.TASK_DYNAMIC_ID_DB_PORT_PARAM_ID=e.TASK_DYNAMIC_ID_DB_CONN_CONFIG_GROUP_ID+"/PORT",e.TASK_DYNAMIC_ID_CNT_OPTION_PREFIX="CNT_",function(t){t.POSTGRES="postgres",t.MYSQL="mysql",t.MSSQL="mssql",t.SQLITE="sqlite"}(e.EnumDatabaseTypesOptions||(e.EnumDatabaseTypesOptions={})),function(t){t.OFF="OFF",t.ON="ON"}(e.EnumLotIdentifierOptions||(e.EnumLotIdentifierOptions={})),function(t){t.OFF="OFF",t.ON="ON",t.ON_AUTO_INC="ON_AUTO_INC",t.ON_AUTO_DEC="ON_AUTO_DEC"}(e.EnumSampleIdentifierOptions||(e.EnumSampleIdentifierOptions={})),e.createIDCntOption=function(t){return e.TASK_DYNAMIC_ID_CNT_OPTION_PREFIX+t.toFixed(0)},e.getConfiguredIds=function(t){return parseInt(t.value.selection.id.replace(e.TASK_DYNAMIC_ID_CNT_OPTION_PREFIX,""),10)},e.createLIDParamId=function(t,a){return e.TASK_DYNAMIC_ID_LID_X_PARAM_ID_PREFIX+a+t.toFixed(0)},e.createSIDParamId=function(t,a){
return e.TASK_DYNAMIC_ID_SID_X_PARAM_ID_PREFIX+a+t.toFixed(0)}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(3),n=a(101);e.TAB_MQTT_SCREENS_STRING="SCREENS/",e.TAB_MQTT_TABS_STRING="/TABS/",e.TAB_MQTT_TAB_STRING="/TAB";e.TabBase=class{constructor(t,e,a=!1){this.tabData=void 0,this.screenId="",this.publishPending=!1,this.lastPublishedTabContent="",this.mqttHandler=t,this.screenId=e,this.singleTab=a}setTabData(t,e=!0){this.tabData=t,e&&this.publishIfEnabled()}publishIfEnabled(){this.publishPending=!1,void 0!==this.tabData&&this.tabData.appearance===i.EnumAppearance.ENABLED&&this.publish()}getTabId(){return void 0!==this.tabData?this.tabData.id:""}setTabContainerTitle(t,e=!0){void 0!==this.tabData&&(this.tabData.containerTitle=t,e&&this.publishIfEnabled())}getTabContainerTitle(){return void 0!==this.tabData?this.tabData.containerTitle:s.createEmptyTextStructure()}setTabTitle(t,e=!0){void 0!==this.tabData&&(this.tabData.title=t,
e&&this.publishIfEnabled())}getTabContainerIcon(){return void 0!==this.tabData&&this.tabData.topIcon||""}setTabContainerIcon(t,e=!0){void 0!==this.tabData&&(this.tabData.topIcon=t,e&&this.publishIfEnabled())}getTabTitle(){return void 0!==this.tabData?this.tabData.title:s.createEmptyTextStructure()}clearTabTopButtons(t=!0){void 0!==this.tabData&&(this.tabData.topbuttons.splice(0,this.tabData.topbuttons.length),t&&this.publishIfEnabled())}getButton(t){}getTabTopButtons(){return void 0!==this.tabData?this.tabData.topbuttons:[]}publishId(){return this.singleTab?e.TAB_MQTT_SCREENS_STRING+this.screenId+e.TAB_MQTT_TAB_STRING:void 0!==this.tabData?e.TAB_MQTT_SCREENS_STRING+this.screenId+e.TAB_MQTT_TABS_STRING+this.tabData.id:""}publish(){if(void 0!==this.tabData){let t=JSON.stringify(this.tabData,n.functionReplacer);t!==this.lastPublishedTabContent&&(this.lastPublishedTabContent=t,this.mqttHandler.publish(this.publishId(),this.lastPublishedTabContent))}}setAppearance(t,e=!0){
void 0!==this.tabData&&(this.tabData.appearance=t,e&&this.publish())}getId(){return this.screenId}hide(){this.setAppearance(i.EnumAppearance.HIDDEN)}show(){this.setAppearance(i.EnumAppearance.ENABLED)}}},function(t,e){t.exports=require("mathjs")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EV_MQTT_UPDATE="EV_MQTT_UPDATE";class i{constructor(t){this.payload=t,this.type=e.EV_MQTT_UPDATE}}e.MqttUpdateEvent=i,e.EV_MQTT_UPDATE_DEBUG="EV_MQTT_UPDATE_DEBUG";e.MqttUpdateDebugEvent=class extends i{constructor(){super(...arguments),this.type=e.EV_MQTT_UPDATE_DEBUG}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EV_HMI_BTN_CLICKED="EV_HMI_BTN_CLICKED",e.EV_HMI_PARAM_CHANGED="EV_HMI_PARAM_CHANGED",e.EV_HMI_PARAM_DETAIL="EV_HMI_PARAM_DETAIL",e.EV_REST_REQUEST="EV_REST_REQUEST";const i=a(51);e.HmiButtonClickedEvent=class{constructor(t){this.payload=t,this.type=e.EV_HMI_BTN_CLICKED}};e.HmiParamChangedEvent=class{constructor(t){
this.payload=t,this.type=e.EV_HMI_PARAM_CHANGED}};e.HmiParamDetailEvent=class{constructor(t){this.payload=t,this.type=e.EV_HMI_PARAM_DETAIL}};e.RestRequestEvent=class{constructor(t){this.payload=t,this.type=e.EV_REST_REQUEST}},e.getParamsForRestRequestEvent=function(t){return new i.URL("http://127.0.0.1/"+t.payload.subUrl).searchParams}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(2),s=a(0);var n;!function(t){t.TAB_PARAMLIST="PARAMLIST",t.TAB_FIGURE="FIGURE",t.TAB_GRAPH="GRAPH",t.TAB_MENU="MENU",t.TAB_TABLE="TABLE",t.TAB_BASE=""}(n=e.EnumTabType||(e.EnumTabType={})),e.TAB_PARAMLIST_TYPE_TOPIC="topics",e.TAB_PARAMLIST_TYPE_BULK="bulk",e.isITabParamList=function(t){return t.paramType===e.TAB_PARAMLIST_TYPE_TOPIC||void 0===t.paramType},e.isITabBulkParamList=function(t){return t.paramType===e.TAB_PARAMLIST_TYPE_BULK};const r={id:"",appearance:s.EnumAppearance.HIDDEN,type:n.TAB_FIGURE,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]
},topbuttons:[],imgref:{}};e.createEmptyITabFigure=function(){return i.cloneJSON(r)};const o={id:"",appearance:s.EnumAppearance.HIDDEN,type:n.TAB_PARAMLIST,displayHeader:!0,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],params:[],paramType:e.TAB_PARAMLIST_TYPE_TOPIC};e.createEmptyITabGraph=function(){return E};const _={};e.createEmptyIGraphInterface=function(){return i.cloneJSON(_)},e.createEmptyITabParamList=function(){return i.cloneJSON(o)};const E={id:"",appearance:s.EnumAppearance.HIDDEN,type:n.TAB_GRAPH,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],data:{}};e.TAB_MENU_TYPE_TOPIC="topics",e.TAB_MENU_TYPE_BULK="bulk",e.isITabMenu=function(t){return t.menuType===e.TAB_MENU_TYPE_TOPIC},e.isITabBulkMenu=function(t){return t.menuType===e.TAB_MENU_TYPE_BULK};const l={id:"",appearance:s.EnumAppearance.HIDDEN,type:n.TAB_MENU,containerTitle:{id:"",args:[]},topIcon:"",title:{id:"",args:[]},topbuttons:[],
menuType:e.TAB_MENU_TYPE_TOPIC,menubuttons:[],scrollToTop:!1};e.createEmptyITabMenu=function(){return i.cloneJSON(l)},e.isITabTable=function(t){return t.tableType===e.TAB_MENU_TYPE_TOPIC},e.isITabBulkTable=function(t){return t.tableType===e.TAB_MENU_TYPE_BULK}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(3),s=a(2),n=a(1);class r{constructor(t,e){this.publishedId="",this.publishPending=!0,this.parameter=e,this.publishedId=n.MqttTopics.QAPP_PARAMETERS_TOPIC_PREAMBLE+"/"+this.parameter.id,this.mqttHandler=t,this.publish()}getId(){return this.parameter.id}getPublishedId(){return this.publishedId}setValue(t){this.parameter=t,this.publish()}getValue(){return this.parameter}setParamId(t,e=!0){(this.parameter.id!==t||this.publishPending)&&(this.parameter.id=t,e?this.publish():this.publishPending=!0)}setParamAppearance(t,e=!0){(this.parameter.appearance!==t||this.publishPending)&&(this.parameter.appearance=t,e?this.publish():this.publishPending=!0)}
setParamType(t,e=!0){(this.parameter.type!==t||this.publishPending)&&(this.parameter.type=t,e?this.publish():this.publishPending=!0)}setParamTitle(t,e=!0){(this.parameter.title.id!==t.id||this.parameter.title.args.join("")!==t.args.join("")||this.publishPending)&&(this.parameter.title=t,e?this.publish():this.publishPending=!0)}setParamHeader(t,e=!0){(this.parameter.header.id!==t.id||this.parameter.header.args.join("")!==t.args.join("")||this.publishPending)&&(this.parameter.header=t,e?this.publish():this.publishPending=!0)}publish(){if(this.publishPending=!1,i.isTypeOfIPasswordParameter(this.parameter)){let t=s.cloneJSON(this.parameter);t.info.passwordLength=t.value.string.length,t.value.string="",this.mqttHandler.publish(this.publishedId,JSON.stringify(t))}else this.mqttHandler.publish(this.publishedId,JSON.stringify(this.parameter))}}e.Param=r,e.default=r},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MQTT_ADMIN_EVENT="MQTT_ADMIN_EVENT",
e.MQTT_ADMIN_EVENT_PACKET_SENT="packetsend";e.MqttAdminEvent=class{constructor(t){this.payload=t,this.type=e.MQTT_ADMIN_EVENT}}},function(t,e){t.exports=require("fs")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(12),n=a(2),r={BTN_INVALIDATE_SAMPLE:10,BTN_DOCU:20,BTN_EVAL:30,BTN_PRINT_LABEL:40,BTN_ADD:50,BTN_START:60,BTN_PRINTADD:60,BTN_NEXT:60};e.getButtonPriority=function(t){return void 0!==r[t]?r[t]:0},e.BTN_EVAL_ID="BTN_EVAL";const o={buttonId:e.BTN_EVAL_ID,label:{id:s.EnumFontLabels.RESULT,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createEvalButtonData=function(){return n.cloneJSON(o)},e.BTN_NEXT_ID="BTN_NEXT";const _={buttonId:e.BTN_NEXT_ID,label:{id:s.EnumFontLabels.NEXT,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createNextButtonData=function(){return n.cloneJSON(_)},e.BTN_PREV_ID="BTN_PREV";const E={buttonId:e.BTN_PREV_ID,label:{id:s.EnumFontLabels.PREV,args:[]},appearance:i.EnumAppearance.HIDDEN}
;e.createPrevButtonData=function(){return n.cloneJSON(E)},e.BTN_BACK_ID="BTN_BACK",e.BTN_LONG_BACK_ID="BTN_LONG_BACK";const l={buttonId:e.BTN_BACK_ID,label:{id:s.EnumFontLabels.BACK,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createBackButtonData=function(t=!1){let a=n.cloneJSON(l);return t&&(a.longPressButtonId=e.BTN_LONG_BACK_ID),a},e.BTN_DOCU_ID="BTN_DOCU";const u={buttonId:e.BTN_DOCU_ID,label:{id:s.EnumFontLabels.DOCU,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createDocuButtonData=function(){return n.cloneJSON(u)},e.BTN_SEND_ID="BTN_SEND";const c={buttonId:e.BTN_SEND_ID,label:{id:s.EnumFontLabels.DOCU,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createSendButtonData=function(){return n.cloneJSON(c)},e.BTN_INVALIDATE_SAMPLE_ID="BTN_INVALIDATE_SAMPLE";const T={buttonId:e.BTN_INVALIDATE_SAMPLE_ID,label:{id:s.EnumFontLabels.INVALIDATE_SAMPLE,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createInvalidateSampleButtonData=function(){return n.cloneJSON(T)},
e.BTN_PRINT_LABEL_ID="BTN_PRINT_LABEL";const d={buttonId:e.BTN_PRINT_LABEL_ID,label:{id:"_QAPP_LIB_PRINT_LABEL_BTN_TITLE",args:[]},appearance:i.EnumAppearance.HIDDEN};e.createPrintLabelButtonData=function(){return n.cloneJSON(d)},e.BTN_START_ID="BTN_START";const p={buttonId:e.BTN_START_ID,label:{id:s.EnumFontLabels.START,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createStartButtonData=function(){return n.cloneJSON(p)},e.BTN_END_ID="BTN_END";const A={buttonId:e.BTN_END_ID,label:{id:s.EnumFontLabels.END,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createEndButtonData=function(){return n.cloneJSON(A)},e.BTN_PRINTADD_ID="BTN_PRINTADD";const I={buttonId:e.BTN_PRINTADD_ID,label:{id:s.EnumFontLabels.PRINT_ADD,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createPrintAddButtonData=function(){return n.cloneJSON(I)},e.BTN_CANCEL_ID="BTN_CANCEL";const h={buttonId:e.BTN_CANCEL_ID,label:{id:s.EnumFontLabels.CANCEL,args:[]},appearance:i.EnumAppearance.HIDDEN}
;e.createCancelButtonData=function(){return n.cloneJSON(h)},e.BTN_SEARCH_ID="BTN_SEARCH";const m={buttonId:e.BTN_SEARCH_ID,label:{id:s.EnumFontLabels.SEARCH,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createSearchButtonData=function(){return n.cloneJSON(m)},e.setNoSearchActive=function(t,e=!0){t.setLabel({id:s.EnumFontLabels.SEARCH,args:[]},e)},e.setSearchActive=function(t,e=!0){t.setLabel({id:s.EnumFontLabels.SEARCH_ACTIVE,args:[]},e)},e.BTN_FILTER_ID="BTN_FILTER";const N={buttonId:e.BTN_FILTER_ID,label:{id:s.EnumFontLabels.FILTER,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createFilterButtonData=function(){return n.cloneJSON(N)},e.setNoFilterActive=function(t,e=!0){t.setLabel({id:s.EnumFontLabels.FILTER,args:[]},e)},e.setFilterActive=function(t,e=!0){t.setLabel({id:s.EnumFontLabels.FILTER_ACTIVE,args:[]},e)},e.BTN_ADD_ID="BTN_ADD";const S={buttonId:e.BTN_ADD_ID,label:{id:s.EnumFontLabels.ADD,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createAddButtonData=function(){
return n.cloneJSON(S)},e.BTN_DELETE_ID="BTN_DELETE";const g={buttonId:e.BTN_DELETE_ID,label:{id:s.EnumFontLabels.DELETE,args:[]},appearance:i.EnumAppearance.HIDDEN};e.createDeleteButtonData=function(){return n.cloneJSON(g)},e.BTN_HOME_ID="BTN_HOME",e.HOME_BUTTON_ICON="./02_menu";const R={buttonId:e.BTN_HOME_ID,label:{id:s.EnumFontLabels.CANCEL,args:[]},icon:e.HOME_BUTTON_ICON,appearance:i.EnumAppearance.HIDDEN};e.createHomeButtonData=function(){return n.cloneJSON(R)},e.BTN_LOGOUT_ID="BTN_LOGOUT";const P={buttonId:e.BTN_LOGOUT_ID,label:{id:s.EnumFontLabels.LOGOUT,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY};e.createLogoutButtonData=function(){return n.cloneJSON(P)},e.BTN_RELOAD_ID="BTN_RELOAD";const O={buttonId:e.BTN_RELOAD_ID,label:{id:s.EnumFontLabels.RELOAD,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY};e.createReloadButtonData=function(){return n.cloneJSON(O)},e.BTN_OPEN_WEIGHING_ID="BTN_OPEN_WEIGHING";const D={buttonId:e.BTN_OPEN_WEIGHING_ID,label:{
id:s.EnumFontLabels.WEIGHING,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY};e.createOpenWeighingButtonData=function(){return n.cloneJSON(D)},e.BTN_OK_ID="BTN_OK";const C={buttonId:e.BTN_OK_ID,label:{id:s.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY};e.createOKButtonData=function(){return n.cloneJSON(C)}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(9),s=a(16);class n{constructor(){this.id=0,this.serial="",this.taskId="",this.version=0}static createTableNameNoSchemaVersion(t,e){return`${0===t.length?"global":t}_${e}`}static createTableName(t,e,a){return n.generateTableNameWithVersion(n.createTableNameNoSchemaVersion(t,e),a)}static generateTableNameWithVersion(t,e){if(isNaN(e))throw new Error("QApp entities are not permitted to have no schema version");return`${t}_${e}`}static getSchemaVersionFromTableName(t){return parseInt(t.substr(t.lastIndexOf("_")+1),10)}static getPureTableNameFromTableName(t){
return t.substr(0,t.lastIndexOf("_"))}prepForUpdate(){delete this.version,delete this.serial,delete this.taskId}}i.__decorate([s.PrimaryGeneratedColumn(),i.__metadata("design:type",Number)],n.prototype,"id",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],n.prototype,"serial",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],n.prototype,"taskId",void 0),i.__decorate([s.VersionColumn(),i.__metadata("design:type",Number)],n.prototype,"version",void 0),e.QAppBaseEntity=n},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(11),s=a(0),n=a(12);e.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID="BTN_OK",e.ParamUpdateUserActionSimpleAccept={type:i.EnumMessageboxType.ERROR,title:{id:"_QAPP_LIB_MSG_BOX_WARNING_UPDATE_TASK_PARAM",args:[]},textList:[],buttons:[{appearance:s.EnumAppearance.ENABLED_SECONDARY,label:{id:n.EnumFontLabels.OK,args:[]},id:e.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID}]}},function(t,e,a){
"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(37),s=a(3),n=a(57),r=a(15),o=a(81),_="_QAPP_MSG_HANDLER_",E="_TITLE",l="_REASON",u="_SOLUTION";var c;function T(t){return t+"_"+i.MESSAGEHANDLER_OK_BTN_ID}!function(t){t.TASKID="TASKID",t.QAPP="QAPP",t.QAPP_DB_ERROR="QAPP_DB_ERROR",t.QAPP_RUNTIME_COMM_ERROR="QAPP_RUNTIME_COMM_ERROR",t.QAPP_RUNTIME_EXIT_ERROR="QAPP_RUNTIME_EXIT_ERROR",t.MANUAL="MANUAL"}(c=e.MESSAGE_HANDLER_SECRET_TYPE||(e.MESSAGE_HANDLER_SECRET_TYPE={})),function(t){t.ERR_702_ACTION_LIMIT="ERR_702",t.ERR_703_ACTION_LIMIT="ERR_703",t.INFO_USERCAL_CAL_OVERALL_PASSED="INFO_USERCAL_CAL_OVERALL_PASSED",t.INFO_USERCAL_ERROR_NO_INVALIDATION="INFO_USERCAL_ERROR_NO_INVALIDATION",t.ERR_704_UNIT_UNAVAILABLE="ERR_704",t.ERR_710_STARLIMS_WARN_LIMIT="ERR_710",t.INFO_STARLIMS_CAL_OVERALL_PASSED="INFO_STARLIMS_CAL_OVERALL_PASSED",t.ERR_711_STARLIMS_WEIGHING_SERIAL="ERR_711",t.ERR_712_STARLIMS_CAL_SERIAL="ERR_712",t.ERR_713_STARLIMS_WEIGHING_PARAM="ERR_713",
t.ERR_714_STARLIMS_CAL_PARAM="ERR_714",t.ERR_715_STARLIMS_ERROR_RESPONSE="ERR_715",t.ERR_716_STARLIMS_NO_CONNECTION="ERR_716",t.ERR_717_STARLIMS_USER_AUTORIZED="ERR_717",t.ERR_718_STARLIMS_NOT_IN_SERVICE="ERR_718",t.ERR_790_GENERIC_DB_ERROR="ERR_790",t.ERR_791_DB_MIGRATION_RUNTIME_ERROR="ERR_791",t.ERR_792_DB_CONN_WORKFLOW_ERROR="ERR_792",t.ERR_793_DB_OPERATION_TIMEOUT_ERROR="ERR_793",t.ERR_794_DB_MIGRATION_UNSUPPORTED_ERROR="ERR_794",t.ERR_795_DB_MIGRATION_FAILED_ERROR="ERR_795",t.ERR_796_DB_CONN_LOST_ERROR="ERR_796",t.ERR_797_DB_CONN_CONFWORKFLOW_ERROR="ERR_797",t.ERR_798_GENERIC_EXTERNAL_COMM_ERROR="ERR_798",t.ERR_799_GENERIC_INTERNAL_ERROR="ERR_799"}(e.EMsgHandlerMsgs||(e.EMsgHandlerMsgs={})),e.getMessageHandlerOkButtonId=T,e.isMessageHandlerOkButton=function(t){return t.endsWith(i.MESSAGEHANDLER_OK_BTN_ID)};const d={ERR_702:{errorCode:702,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.USER_CAL,
lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_EXPLICIT_DELETION,secretType:c.MANUAL},ERR_703:{errorCode:703,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.WARNING,category:i.MessageHandlerCategory.USER_CAL,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},INFO_USERCAL_CAL_OVERALL_PASSED:{errorCode:0,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.INFORMATION,category:i.MessageHandlerCategory.USER_CAL,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},INFO_USERCAL_ERROR_NO_INVALIDATION:{errorCode:0,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.USER_CAL,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_704:{errorCode:704,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.TASKID},
ERR_710:{errorCode:710,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.WARNING,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},INFO_STARLIMS_CAL_OVERALL_PASSED:{errorCode:0,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.INFORMATION,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_711:{errorCode:711,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_712:{errorCode:712,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_713:{errorCode:713,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,
lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_714:{errorCode:714,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_715:{errorCode:715,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_716:{errorCode:716,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_717:{errorCode:717,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_718:{errorCode:718,
type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.MANUAL},ERR_790:{errorCode:790,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(T(790))]},ERR_791:{errorCode:791,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(T(791))]},ERR_792:{errorCode:792,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(T(792))]},ERR_793:{
errorCode:793,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(T(793))]},ERR_794:{errorCode:794,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(T(794))]},ERR_795:{errorCode:795,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(T(795))]},ERR_796:{errorCode:796,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,
secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(T(796))]},ERR_797:{errorCode:797,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_DB_ERROR,buttons:[i.createMessageHandlerButton(T(797))]},ERR_798:{errorCode:798,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_RUNTIME_COMM_ERROR},ERR_799:{errorCode:799,type:i.MESSAGE_HANDLER_MESSAGE_TYPE.ERROR,category:i.MessageHandlerCategory.QAPP,lifetime:i.MESSAGE_HANDLER_LIFETIME.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE,secretType:c.QAPP_RUNTIME_EXIT_ERROR}};e.MessageHandlerHelper=class{constructor(t){this.messageHandlerProxy=t}buildSecret(t){switch(t){case c.TASKID:return r.QAppBase.clientSingleton.getTaskId();case c.QAPP:
return r.QAppBase.clientSingleton.getQAppOrderNumber();case c.QAPP_DB_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+c.QAPP_DB_ERROR;case c.QAPP_RUNTIME_COMM_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+c.QAPP_RUNTIME_COMM_ERROR;case c.QAPP_RUNTIME_EXIT_ERROR:return r.QAppBase.clientSingleton.getQAppOrderNumber()+c.QAPP_RUNTIME_EXIT_ERROR;case c.MANUAL:default:return}}addMessage(t,e,a,i){console.log(`messageHandlerHelper::addMessage: ${t}`);let c=s.createEmptyTextStructure(),T=s.createEmptyTextStructure(),p=s.createEmptyTextStructure(),A=0;0===d[t].errorCode?(c.id=_+t+E,T.id=_+t+l,p.id=_+t+u):A=d[t].errorCode;let I=[];for(799!==d[t].errorCode&&798!==d[t].errorCode||I.push(r.QAppBase.clientSingleton.getQAppOrderNumber()),790!==d[t].errorCode&&791!==d[t].errorCode&&792!==d[t].errorCode&&793!==d[t].errorCode&&794!==d[t].errorCode&&795!==d[t].errorCode&&796!==d[t].errorCode&&797!==d[t].errorCode||(I.push(r.QAppBase.clientSingleton.getQAppOrderNumber()),
I.push(r.QAppBase.clientSingleton.getQAppVersion())),void 0!==e&&("string"==typeof e?(I.push("Error"),I.push(e)):n.isError(e)?o.isHttpRestError(e)?(I.push(`${e.name} (HTTP(s)/${e.statusCode})`),I.push(e.message)):(I.push(e.name),I.push(e.message)):I.push(...e));I.length<4;)I.push("");T.args=I;let h=this.buildSecret(d[t].secretType);return void 0!==h&&(a=h),console.log(`messageHandlerHelper::addMessage: add msg handler msg ${A} with secret ${a}`),this.messageHandlerProxy.addMessage(A,d[t].type,d[t].category,d[t].lifetime,c,T,p,a||"",i||(d[t].buttons?d[t].buttons:void 0),d[t].showMessageInFutureSeconds?d[t].showMessageInFutureSeconds:void 0)}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(106),s=a(13),n=a(64),r=a(7);var o,_,E;!function(t){t.DATE_FORMAT_CHARTS="DATE_FORMAT_CHARTS",t.DATE_FORMAT_DATEFORMAT_LIB="DATE_FORMAT_DATEFORMAT_LIB"}(o=e.EDateFormats||(e.EDateFormats={})),function(t){
t.DD_MM_YYYY_SLASHSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_DD_MM_YYYY_SLASHSEPERATOR",t.MM_DD_YYYY_SLASHSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_MM_DD_YYYY_SLASHSEPERATOR",t.DD_MM_YYYY_POINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_DD_MM_YYYY_POINTSEPERATOR",t.YYYY_MM_DD_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_YYYY_MM_DD_MINUSSEPERATOR",t.YYYY_MM_DD_DOUBLEPOINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_YYYY_MM_DD_DOUBLEPOINTSEPERATOR",t.YYYY_MM_DD_POINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_YYYY_MM_DD_POINTSEPERATOR",t.DD_MMM_YYYY_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_DD_MMM_YYYY_MINUSSEPERATOR",t.MMM_DD_YYYY_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_DATEFORMAT_TEXT_MMM_DD_YYYY_MINUSSEPERATOR",t.YYYY_MM_DD_NO_SEPARATOR="CUSTOM_YYYY_MM_DD_NO_SEPARATOR"}(_=e.EDateConfiguration||(e.EDateConfiguration={})),function(t){
t.HH_MM_SS_MINUSSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_MINUSSEPERATOR",t.HH_MM_SS_POINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_POINTSEPERATOR",t.HH_MM_SS_DOUBLEPOINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_DOUBLEPOINTSEPERATOR",t.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR="CLOCKHANDLER_CONFIGURATION_TIME_TIMEFORMAT_TEXT_HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR",t.HH_MM_SS_NO_SEPARATOR="CUSTOM_HH_MM_SS_NO_SEPARATOR"}(E=e.ETimeConfiguration||(e.ETimeConfiguration={}));const l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function u(t,e,a){let i="YYYY-MM-DD",s="HH:mm:ss";switch(console.log("parseDateTimeFormat: for format "+t),t){case o.DATE_FORMAT_CHARTS:i="YYYY-MM-DD",s="HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="yyyy-mm-dd",s="HH:MM:ss"}if(void 0!==e){let a=e.value.selection.text.id;switch(console.log("parseDateTimeFormat: date "+a),a){case _.DD_MM_YYYY_SLASHSEPERATOR:
switch(t){case o.DATE_FORMAT_CHARTS:i="DD/MM/YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="dd-mm-yyyy"}break;case _.MM_DD_YYYY_SLASHSEPERATOR:switch(t){case o.DATE_FORMAT_CHARTS:i="MM/DD/YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="mm-dd-yyyy"}break;case _.DD_MM_YYYY_POINTSEPERATOR:switch(t){case o.DATE_FORMAT_CHARTS:i="DD.MM.YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="dd.mm.yyyy"}break;case _.YYYY_MM_DD_MINUSSEPERATOR:switch(t){case o.DATE_FORMAT_CHARTS:i="YYYY-MM-DD";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="yyyy-mm-dd"}break;case _.YYYY_MM_DD_DOUBLEPOINTSEPERATOR:switch(t){case o.DATE_FORMAT_CHARTS:i="YYYY:MM:DD";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="yyyy:mm:dd"}break;case _.DD_MMM_YYYY_MINUSSEPERATOR:switch(t){case o.DATE_FORMAT_CHARTS:i="DD-MMM-YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="dd-mmm-yyyy"}break;case _.MMM_DD_YYYY_MINUSSEPERATOR:switch(t){case o.DATE_FORMAT_CHARTS:i="MMM-DD-YYYY";break;case o.DATE_FORMAT_DATEFORMAT_LIB:i="mmm.dd.yyyy"}break
;default:i=a}}if(void 0!==a){let e=a.value.selection.text.id;switch(console.log("parseDateTimeFormat: time "+e),e){case E.HH_MM_SS_POINTSEPERATOR:switch(t){case o.DATE_FORMAT_CHARTS:s="HH.mm.ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:s="HH.MM.ss"}break;case E.HH_MM_SS_DOUBLEPOINTSEPERATOR:switch(t){case o.DATE_FORMAT_CHARTS:s="HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:s="HH:MM:ss"}break;case E.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR:switch(t){case o.DATE_FORMAT_CHARTS:s="hh:mm:ss a";break;case o.DATE_FORMAT_DATEFORMAT_LIB:s="hh:MM:ss TT"}break;default:s=e}}let n=`${i} ${s}`;return console.log("parseDateTimeFormat: final format "+n),n}function c(t,e){let a=t.toFixed(0);for(;a.length<e;)a="0"+a;return a}function T(){let t=(new i.ClockHandlerProxy).getFormatConfigurationI18n();if(t.isSuccess()){let e,a,n=JSON.parse(t.rawReturns.configuration),r=s.find(n,t=>t.id===i.CLOCKHANDLER_DATEFORMAT_PARAM_ID),o=s.find(n,t=>t.id===i.CLOCKHANDLER_TIMEFORMAT_PARAM_ID);if(void 0!==r){
let t=r.value.selection.text.id;e=Object.values(_).includes(t)?t:_.YYYY_MM_DD_MINUSSEPERATOR}else e=_.YYYY_MM_DD_MINUSSEPERATOR;if(void 0!==o){let t=o.value.selection.text.id;a=Object.values(E).includes(t)?t:E.HH_MM_SS_DOUBLEPOINTSEPERATOR}else a=E.HH_MM_SS_DOUBLEPOINTSEPERATOR;return{dateConfiguration:e,timeConfiguration:a}}return{dateConfiguration:_.YYYY_MM_DD_MINUSSEPERATOR,timeConfiguration:E.HH_MM_SS_DOUBLEPOINTSEPERATOR}}function d(t,e){let a,i,s=new Date(t);switch(e.dateConfiguration){case _.DD_MM_YYYY_SLASHSEPERATOR:a=c(s.getDate(),2)+"/"+c(s.getMonth()+1,2)+"/"+c(s.getFullYear(),4);break;case _.MM_DD_YYYY_SLASHSEPERATOR:a=c(s.getMonth()+1,2)+"/"+c(s.getDate(),2)+"/"+c(s.getFullYear(),4);break;case _.DD_MM_YYYY_POINTSEPERATOR:a=c(s.getDate(),2)+"."+c(s.getMonth()+1,2)+"."+c(s.getFullYear(),4);break;case _.YYYY_MM_DD_MINUSSEPERATOR:a=c(s.getFullYear(),4)+"-"+c(s.getMonth()+1,2)+"-"+c(s.getDate(),2);break;case _.YYYY_MM_DD_DOUBLEPOINTSEPERATOR:
a=c(s.getFullYear(),4)+":"+c(s.getMonth()+1,2)+":"+c(s.getDate(),2);break;case _.YYYY_MM_DD_POINTSEPERATOR:a=c(s.getFullYear(),4)+"."+c(s.getMonth()+1,2)+"."+c(s.getDate(),2);break;case _.DD_MMM_YYYY_MINUSSEPERATOR:a=c(s.getDate(),2)+"-"+l[s.getMonth()]+"-"+c(s.getFullYear(),4);break;case _.MMM_DD_YYYY_MINUSSEPERATOR:a=l[s.getMonth()]+"-"+c(s.getDate(),2)+"-"+c(s.getFullYear(),4);break;case _.YYYY_MM_DD_NO_SEPARATOR:a=c(s.getFullYear(),4)+c(s.getMonth()+1,2)+c(s.getDate(),2);break;default:a=c(s.getFullYear(),4)+"-"+c(s.getMonth()+1,2)+"-"+c(s.getDate(),2)}switch(e.timeConfiguration){case E.HH_MM_SS_MINUSSEPERATOR:i=c(s.getHours(),2)+"-"+c(s.getMinutes(),2)+"-"+c(s.getSeconds(),2);break;case E.HH_MM_SS_POINTSEPERATOR:i=c(s.getHours(),2)+"."+c(s.getMinutes(),2)+"."+c(s.getSeconds(),2);break;case E.HH_MM_SS_DOUBLEPOINTSEPERATOR:i=c(s.getHours(),2)+":"+c(s.getMinutes(),2)+":"+c(s.getSeconds(),2);break;case E.HH_MM_SS_AM_PM_DOUBLEPOINTSEPERATOR:let t=function(t){let e=t>=12?"pm":"am"
;return{hours:t=0!=(t%=12)?t:12,ampm:e}}(s.getHours());i=c(t.hours,2)+":"+c(s.getMinutes(),2)+":"+c(s.getSeconds(),2)+" "+t.ampm;break;case E.HH_MM_SS_NO_SEPARATOR:i=c(s.getHours(),2)+c(s.getMinutes(),2)+c(s.getSeconds(),2);break;default:i=c(s.getHours(),2)+":"+c(s.getMinutes(),2)+":"+c(s.getSeconds(),2)}return{date:a,time:i}}e.getDateTimeFormat=function(t){let e="";switch(t){case o.DATE_FORMAT_CHARTS:e="YYYY-MM-DD HH:mm:ss";break;case o.DATE_FORMAT_DATEFORMAT_LIB:e="yyyy-mm-dd HH:MM:ss"}let a=(new i.ClockHandlerProxy).getFormatConfigurationI18n();if(a.isSuccess()){let n=JSON.parse(a.rawReturns.configuration);e=`${u(t,s.find(n,t=>t.id===i.CLOCKHANDLER_DATEFORMAT_PARAM_ID),s.find(n,t=>t.id===i.CLOCKHANDLER_TIMEFORMAT_PARAM_ID))}`}return e},e.parseDateTimeFormat=u,e.getDateTimeConfiguration=T,e.convertToDateTimeFormat=d,e.getDateTime=function(t,e,a,i,s=!0,o=!0){switch(void 0==a&&(a=Date.now()),r.isNumber(a)||r.isString(a)||(a=0),void 0==i&&(i=r.isString(a)?"iso":"ms"),
void 0==t&&(t="ms"),i){case"ms":a=r.isNumber(a)?a:0;break;case"s":a=r.isNumber(a)?1e3*a:0;break;case"iso":case"isoTimezone":a=r.isString(a)?new Date(a).valueOf():0,a=r.isNumber(a)?a:0}if("ms"===t)return a;if("s"===t)return Math.trunc(a/1e3);if("iso"===t)return new Date(a).toISOString();if("isoTimezone"===t&&(t="frmt",e="yyyy-mm-dd HH:MM:sso"),void 0==e&&(e=T()),0===a&&(a=.1),e.hasOwnProperty("dateConfiguration")){let t=d(a,e),i=s?t.date:"";return i+=o&&""!==i?" ":"",i+=o?t.time:""}if("string"==typeof e.toLowerCase())return n(a,e);{let t=o?"HH:MM:ss":"";return t+=s&&""!==t?" ":"",n(a,t+=s?"dd.mm.yyyy":"")}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(3),s=a(27),n=a(5),r=a(1);e.CANCEL_BUTTON_ID="BTN_CANCEL",e.CANCEL_BUTTON_NAME="_CANCEL";class o extends n.AbstractScreen{constructor(t){super(t),this.paramList=[],this.parameterCategoryList=[],this.isLastCategoryVisible=!1,this.mqttHandler=t}setShowLastVisibleCategory(t,e=!0){
this.isLastCategoryVisible=t,e&&this.createAndPublishParamsAndPage()}readFromTaskhandler(t){let e=t.getTaskGroupsAndParameters();this.readFromParameterGroupArray(e)}readFromParameterGroupArray(t){this.paramList.splice(0,this.paramList.length),this.parameterCategoryList.splice(0,this.parameterCategoryList.length);for(let e of t){let t={},a={},n=i.createEmptyTextStructure();n=e.title,a.title=n,t.category=a,t.category.id=e.id,t.params=[];for(let a of e.parameters){let e=new s.default(this.mqttHandler,a);this.paramList.push(e),t.params.push(e.getPublishedId())}this.parameterCategoryList.push(t)}}createAndPublishParamsAndPage(){let t={params:{}};t.params=this.parameterCategoryList,t.showLastVisibleCategory=this.isLastCategoryVisible;const e=r.MqttTopics.QAPP_NAMESPACE+"/SCREENS/"+this.getId()+"/PARAMSANDPAGE";console.log("ParamListBase: publishContent @ "+e),this.mqttHandler.publish(e,JSON.stringify(t),{retain:!0})}updateParameter(t){
for(let e of this.paramList)if(e.getId()===t.id)return void e.setValue(t)}}e.ParamListBase=o,e.default=o},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(49),s=a(23);var n=a(23);e.bignumber=n.bignumber,e.abs=n.abs;const r=a(18);function o(t){let e=void 0;return r.unitsMap.hasOwnProperty(t)&&(e=r.unitsMap[t].conversionDecimalPlacesShift),void 0===e&&(e=1),e}var _;e.calcInterval=function(t,e,a){return s.bignumber(a).times(i.SartoMath.decPowers(o(t))).times(i.SartoMath.decPowers(-1*o(e))).toNumber()},e.calcDecimals=function(t){return t>=1?0:Math.ceil(-1*Math.log10(t))},e.unitStringToShort=function(t){return r.unitsMap.hasOwnProperty(t)?r.unitsMap[t].mark:r.unitsMap[r.EnumUnit.INVALID].mark},e.getUnitFactor=function(t){let e=void 0;return r.unitsMap.hasOwnProperty(t)&&(e=r.unitsMap[t].conversionFactor),void 0===e&&(e=1),e},e.getUnitShift=o,function(t){t.none="NONE",t.o="UNIVERSAL",t["µg"]="MICROGRAM",t.mg="MILLIGRAM",t.g="GRAM",t.kg="KILOGRAM",
t.t="TONNE",t.mct="MILLICARAT",t.ct="CARAT",t.kct="KILOCARAT",t.K="KARAT",t.lb="POUND",t.oz="OUNCE",t.lb_oz="POUND_OUNCE",t.ozt="TROYOUNCE",t.dwt="PENNYWEIGHT",t.GN="GRAIN",t.per_lb="PARTS_PER_POUND",t.tlh="TAEL_HONGKONG",t.tls="TAEL_SINGAPORE",t.tlt="TAEL_TAIWAN",t.tlc="TAEL_CHINA",t.mom="MOMME",t.tol="TOLA",t.bat="BAHT",t.MS="MESGHAL",t.N="NEWTON",t.war="WARNING",t.pcs="PIECES",t.per="PERCENT",t.mm="MILLIMETER",t.cm="CENTIMETER",t.m="METER",t.km="KILOMETER",t.g_ml="GRAM_PER_MILLILITER",t.Mcls_ml="MILLION_CELLS_PER_MILLILITER",t["µg_ml"]="MICROGRAM_PER_MILLILITER",t["µg_l"]="MICROGRAM_PER_LITER",t.mg_ml="MILLIGRAM_PER_MILLILITER",t.mg_l="MILLIGRAM_PER_LITER",t.mmol_ml="MILLIMOL_PER_MILLILITER",t.g_cm3="DENSITY",t.cm3="VOLUME",t.cm2="SQUARECENTIMETRE",t.m2="SQUAREMETRE",t.g_cm2="GRAM_PER_SQUARE_CENTIMETER",t.g_m2="GRAMMAGE",t.g_m="GRAM_PER_METER",t["µl"]="MICROLITER",t.ml="MILLILITER",t.cl="CENTILITER",t.l="LITER",t.mmol="MILLIMOL",t.C="GRAD_CELSIUS",t.F="GRAD_FAHRENHEIT",
t.sec="SECOND",t.min="MINUTE",t.h="HOUR",t.am="TIME_AM",t.pm="TIME_PM",t.V="VOLT",t.mA="MILLIAMPER",t.hPa="HECTOPASCAL",t.kPa="KILOPASCAL",t.g_mol="GRAM_PER_MOL",t.kg_m3="KG_M3",t.mmHg="MMHG",t.invalid="!invalid!",t.rpm="RPM"}(_=e.EnumUnitStrings||(e.EnumUnitStrings={}));const E={[_.none]:"none",[_.o]:"o",[_.µg]:"µg",[_.mg]:"mg",[_.g]:"g",[_.kg]:"kg",[_.t]:"t",[_.mct]:"mct",[_.ct]:"ct",[_.kct]:"kct",[_.K]:"K",[_.lb]:"lb",[_.oz]:"oz",[_.lb_oz]:"lb_oz",[_.ozt]:"ozt",[_.dwt]:"dwt",[_.GN]:"GN",[_.per_lb]:"per_lb",[_.tlh]:"tlh",[_.tls]:"tls",[_.tlt]:"tlt",[_.tlc]:"tlc",[_.mom]:"mom",[_.tol]:"tol",[_.bat]:"bat",[_.MS]:"MS",[_.N]:"N",[_.war]:"war",[_.pcs]:"pcs",[_.per]:"per",[_.mm]:"mm",[_.cm]:"cm",[_.m]:"m",[_.km]:"km",[_.g_ml]:"g_ml",[_.Mcls_ml]:"Mcls_ml",[_.µg_ml]:"µg_ml",[_.µg_l]:"µg_l",[_.mg_ml]:"mg_ml",[_.mg_l]:"mg_l",[_.mmol_ml]:"mmol_ml",[_.g_cm3]:"g_cm3",[_.cm3]:"cm3",[_.cm2]:"cm2",[_.m2]:"m2",[_.g_cm2]:"g_cm2",[_.g_m2]:"g_m2",[_.g_m]:"g_m",[_.µl]:"µl",[_.ml]:"ml",[_.cl]:"cl",
[_.l]:"l",[_.mmol]:"mmol",[_.C]:"C",[_.F]:"F",[_.sec]:"sec",[_.min]:"min",[_.h]:"h",[_.am]:"am",[_.pm]:"pm",[_.V]:"V",[_.mA]:"mA",[_.hPa]:"hPa",[_.kPa]:"kPa",[_.g_mol]:"g_mol",[_.kg_m3]:"kg_m3",[_.mmHg]:"mmHg",[_.invalid]:"invalid",[_.rpm]:"rpm"};e.unitStringToLong=function(t){const e=Array.isArray(t)?t[0]:t;if(0===e.length)return _.none;for(const[t,a]of Object.entries(E))if(a===e)return t;return _.invalid},e.convertWgtUnit=function(t,e,a){return r.convertValueToTargetUnit(t,e,a)},e.convertWgtUnitBigNumber=function(t,e,a){return r.convertValueToTargetUnitBigNumber(t,e,a)},e.convertTempUnit=function(t,e,a){const i=[r.EnumUnit.GRAD_CELSIUS,r.EnumUnit.GRAD_FAHRENHEIT,_.C,_.F];return i.includes(e)&&i.includes(a)?r.convertValueToTargetUnit(t,e,a):t},e.convertPressureUnit=function(t,e,a){const i=[r.EnumUnit.HECTOPASCAL,r.EnumUnit.KILOPASCAL,_.hPa,_.kPa];return i.includes(e)&&i.includes(a)?r.convertValueToTargetUnit(t,e,a):t},e.UnitEnum_Api2Lib=function(t){let e=_
;for(let a in e)if(e[a].toString()===t.toString())return a;return null},e.UnitEnum_Lib2Api=function(t){return r.getUnitEnum(t)}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(6),s=a(0),n=a(17),r=a(12),o=a(4);var _,E,l;function u(t,a,i){return{appearance:s.EnumAppearance.ENABLED_SECONDARY,type:E.CALLBACK,name:a||r.EnumFontLabels.OK,effect:{method:"buttonClickEvent",module:"qappHandler",params:{buttonId:t||e.MESSAGEHANDLER_OK_BTN_ID},calltarget:i||l.ReST}}}!function(t){t.FATAL="FATAL",t.ERROR="ERROR",t.WARNING="WARNING",t.INFORMATION="INFORMATION"}(_=e.MESSAGE_HANDLER_MESSAGE_TYPE||(e.MESSAGE_HANDLER_MESSAGE_TYPE={})),function(t){t.UNTIL_EXPLICIT_DELETION="UNTIL_EXPLICIT_DELETION",t.UNTIL_EXPLICIT_DELETION_OR_REBOOT="UNTIL_EXPLICIT_DELETION_OR_REBOOT",t.UNTIL_USER_ACKNOWLEDGE_WITH_REBOOT_PERSISTENCE="UNTIL_USER_ACKNOWLEDGE_WITH_REBOOT_PERSISTENCE",
t.UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE="UNTIL_USER_ACKNOWLEDGE_WITHOUT_REBOOT_PERSISTENCE"}(e.MESSAGE_HANDLER_LIFETIME||(e.MESSAGE_HANDLER_LIFETIME={})),function(t){t.NAVIGATETO="NavigateTo",t.CALLBACK="Callback"}(E=e.MESSAGE_HANDLER_BUTTON_TYPE||(e.MESSAGE_HANDLER_BUTTON_TYPE={})),function(t){t.MQTT="MQTT",t.ReST="ReST",t.REMOVE_MESSAGE="REMOVE_MESSAGE"}(l=e.MessageHandlerCallTarget||(e.MessageHandlerCallTarget={})),function(t){t.NONE="NONE",t.USER_CAL="USER_CAL",t.QAPP="QAPP"}(e.MessageHandlerCategory||(e.MessageHandlerCategory={})),e.MESSAGEHANDLER_OK_BTN_ID="BTN_OK_MESSAGEHANDLER",e.MESSAGEHANDLER_CLOSE_QAPP_BTN_I18N="_QAPP_LIB_CONNECTION_ERROR_CLOSE_QAPP_BTN",e.createMessageHandlerButton=u;e.MessageHandlerProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="messagehandler"}addMessage(t,e,a,s,r,_,E,l,c,T){return this.body.method=o.RestMethodsMESSAGE_HANDLER.addMessage,this.body.params={message:{errorCode:t,type:e,lifetime:s,title:r,
reason:_,solution:E,buttons:c||[u()],category:a,categorysecret:l},showMessageInFutureMillis:T||0,uniqueMessageId:0},console.log("addMessageHandler: "+n.inspect(this.body.params.message)),new i.CubisRestResponse(this.syncRequest()).rawReturns.uniqueMessageId}deleteMessageByCategory(t,e){return this.body.method=o.RestMethodsMESSAGE_HANDLER.deleteMessageByCategory,this.body.params={categoryAsString:t,secret:e},console.log("deleteMessageByCategory: "+n.inspect(this.body.params)),new i.CubisRestResponse(this.syncRequest())}deleteMessagesByCategory(t){return this.body.method=o.RestMethodsMESSAGE_HANDLER.deleteMessagesByCategory,this.body.params={categorySecretArray:JSON.stringify({arraySize:t.length,data:t})},console.log("deleteMessagesByCategory: "+n.inspect(this.body.params)),new i.CubisRestResponse(this.syncRequest())}getAllMessagesByCategory(t){this.body.method=o.RestMethodsMESSAGE_HANDLER.getAllMessagesByCategory,this.body.params={categoryAsString:t,messages:{}}
;let e=new i.CubisRestResponse(this.syncRequest());return JSON.parse(e.rawReturns.messages).data}getAllErrorMessagesByCategory(t){let e=this.getAllMessagesByCategory(t),a=[];for(let t of e)t.type===_.ERROR&&a.push(t);return a}removeMessage(t){return this.body.method=o.RestMethodsMESSAGE_HANDLER.removeMessage,this.body.params={uniqueMessageId:t},new i.CubisRestResponse(this.syncRequest())}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(9),s=a(55),n=a(2),r=a(6),o=a(7),_=a(0),E=a(54),l=a(83),u=a(52),c=a(4),T=a(18);function d(t){return o.isNumber(t)&&(t=t.toFixed(0)),e.DYNAMIC_PARAMID_PREQUEL+"CONFIG_SCREEN"+t}function p(t,e){o.isString(e)||(e="_"),e=e,!1!==o.isString(t)&&0!==t.length||(t=e);let a=new RegExp(/[^0-9A-Za-z._-]+/g),i=new RegExp(/[\/\?<>\\:\*\|"]/g),s=new RegExp(/[\x00-\x1f\x80-\x9f]/g),n=new RegExp(/^\.+$/),r=new RegExp(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i),_=new RegExp(/[\. ]+$/)
;return(t=(t=(t=(t=(t=(t=t.replace(a,e)).replace(i,e)).replace(s,e)).replace(n,e)).replace(r,e)).replace(_,e)).length>255&&(t=t.substring(0,255)),t}function A(t){if(e.fs.existsSync(t))if(e.fs.lstatSync(t).isDirectory()){let i=e.fs.readdirSync(t,{encoding:"utf8",withFileTypes:!1});for(var a=0;a<i.length;a++)A(e.path.join(t,i[a]));e.fs.rmdirSync(t)}else e.fs.unlinkSync(t)}var I;function h(t){let e={title:"",header:"",value:"",automaticManipulation:I.NONE};return o.isObject(t)&&(e=Object.assign(e,t)),e}function m(t,e,a){let i={method:e,params:a},s=JSON.stringify(i),n=["http://127.0.0.1:8080/rest/"+t,"-H","Accept:application/json","-H","Content-Type:application/json","-H","Expect:","--data","@-"],o=E.spawnSync("curl",n,{input:s}),_=new r.CubisRestResponse(!1);try{_=new r.CubisRestResponse(o)}catch(t){_.rawReturns=t}return _}function N(t,e,a){return i.__awaiter(this,void 0,void 0,function*(){let i=u;return"https"===t&&(i=l),new Promise(function(t,s){let n=i.request(e,function(e){let a=[]
;e.on("data",function(t){a.push(t)}),e.on("end",function(){try{t({headers:e.headers,url:e.url,statusCode:e.statusCode,body:Buffer.concat(a)})}catch(t){s(t)}})});n.on("error",function(t){s(t)}),n.on("timeout",function(){n.abort(),s("Request timeout")}),a&&n.write(a),n.end()})})}function S(t){let e={unit:T.EnumUnit.NONE,decimals:0,d:0,e:0,max:0,min:0,extended:{d:T.createQuantity(),e:T.createQuantity(),max:T.createQuantity(),min:T.createQuantity()},ranges:{1:{d:T.createQuantity(),e:T.createQuantity(),max:T.createQuantity(),min:T.createQuantity()}},activeRangeIndex:"1"};return o.isObject(t)&&o.overwriteExistingAttributes(t,e),e}e.fs=a(29),e.path=a(60),e.DYNAMIC_PARAMID_PREQUEL="TASK/DYNAMIC_",e.sortKeys=function(t){if(!1===o.isObject(t))return[];let e=[];e=Array.isArray(t)?t:Object.keys(t);let a=[],i=[],s=[];for(let t=0;t<e.length;t++)o.isNumber(Number(e[t]))?a.push(e[t]):o.isString(e[t])?i.push(e[t]):s.push(e[t]);return i=i.sort(),s=s.sort(),(a=(a=a.sort(function(t,e){
return Number(t)-Number(e)})).concat(i)).concat(s)},e.determineNearestNumberInArray=function(t,e){for(let a=0;a<e.length;a++)if(t<e[a])return a<=0?a:t<=e[a]-(e[a]-e[a-1])/2?a-1:a;return e.length-1},e.loadWorkstate_DATA_CONTAINER=function(t){let e=void 0;if(!o.isString(t))return e;let a=m("task/management",c.RestMethodsTASK_MANAGEMENT.getWorkstate,{id:t,workstate:{}});try{e=(e=JSON.parse(a.rawReturns.workstate).workstate).DATA_CONTAINER}catch(t){e=void 0}return e},e.storeWorkstate_DATA_CONTAINER=function(t,e){if(!o.isString(t))return new r.CubisRestResponse(!1);let a={DATA_CONTAINER:e};return m("task/management",c.RestMethodsTASK_MANAGEMENT.saveWorkstate,{id:t,workstate:a})},e.loadTaskConfig_DATA_CONTAINER=function(t){let a=t.getGroup(d(54321));if(void 0===a)return;let i=[],s=d(54321)+"/"+e.DYNAMIC_PARAMID_PREQUEL+"DATA_CONTAINER_";for(let t=0;t<a.parameters.length;t++)if(a.parameters[t].type===_.EnumParameterTypes.PARAM_STRING&&a.parameters[t].id.startsWith(s)){
let e=parseInt(a.parameters[t].id.substring(s.length));o.isNumber(e)&&(i[e]=a.parameters[t].value.string)}try{return JSON.parse(i.join())}catch(t){return}},e.storeTaskConfig_DATA_CONTAINER=function(t,a,i){let s=t.getGroup(d(54321));if(i=!!o.isBoolean(i)&&i,void 0===s&&(t.addDynamicGroup({id:d(54321),type:_.EnumParameterTypes.PARAM_GROUP,appearance:_.EnumAppearance.HIDDEN,title:{id:"",args:[]},parameters:[]}),s=t.getGroup(d(54321))),void 0===s)return new r.CubisRestResponse(!1);s.parameters=[];let n=JSON.stringify(a),E=0,l=0;for(;E<n.length;){(l=E+1e5)>n.length&&(l=n.length);let a={id:d(54321)+"/"+e.DYNAMIC_PARAMID_PREQUEL+"DATA_CONTAINER_"+s.parameters.length.toFixed(0),type:_.EnumParameterTypes.PARAM_STRING,appearance:_.EnumAppearance.HIDDEN,title:{id:"",args:[]},header:{id:"",args:[]},value:{string:n.substring(E,l)},info:{minimum:{length:0},maximum:{length:1e5}}};E=l,s.parameters.push(a),t.updateParameter(a)}return!1===i?m("task/management",c.RestMethodsTASK_MANAGEMENT.updateTask,{
task:JSON.stringify(t.getTask()),errorList:[]}):new r.CubisRestResponse(!0)},e.get_taskConfig_paramGroupID=d,e.getCompliantFilename=p,e.checkFileNameCompliancy=function(t,e){if(p(t)!==t)return!1;e=void 0!==e?e:[];for(let a=0;a<e.length;a++)if(t.includes(e[a]))return!1;return!0},e.getCreateTaskSpecificFolder=function(t,a){let i="",n=t.getTask(),r=t.getParameter("TASK/IDENTIFICATION/NAME"),o=e.fs.readdirSync(a,{encoding:"utf8",withFileTypes:!1}),_=new s.TaskProxy,E=[];try{E=_.getTaskNamesByOrderNumber(n.qappOrderNumber)}catch(t){}for(var l=0;l<o.length;l++)if(o[l].toString().startsWith("_RENAME_TASK_ID_")&&o[l].toString().endsWith(".json")){var u=e.fs.readFileSync(e.path.join(a,o[l]),"utf8");(c=JSON.parse(u))&&c.taskname&&c.foldername&&!E.includes(c.taskname)&&(A(e.path.join(a,c.foldername)),A(e.path.join(a,o[l])))}else if(o[l].toString().startsWith("_TASK_"))try{_.readTask(o[l].toString().substring("_TASK_".length))}catch(t){A(e.path.join(a,o[l]))}if(null==n._id||""==n._id){
let t=Date.now(),s={taskname:r.value.string,foldername:"_RENAME_TASK_ID_"+t};e.fs.writeFileSync(e.path.join(a,"_RENAME_TASK_ID_"+t+".json"),JSON.stringify(s)),i=e.path.join(a,"_RENAME_TASK_ID_"+t)}else for(i=e.path.join(a,"_TASK_"+n._id),l=0;l<o.length;l++)if(o[l].toString().startsWith("_RENAME_TASK_ID_")&&o[l].toString().endsWith(".json")){var c;u=e.fs.readFileSync(e.path.join(a,o[l]),"utf8"),(c=JSON.parse(u))&&c.taskname&&c.foldername&&c.taskname==r.value.string&&(e.fs.existsSync(e.path.join(a,c.foldername))?e.fs.existsSync(i)?(A(e.path.join(a,c.foldername)),A(e.path.join(a,o[l]))):(e.fs.renameSync(e.path.join(a,c.foldername),i),A(e.path.join(a,o[l]))):A(e.path.join(a,o[l])))}return e.fs.existsSync(i)||e.fs.mkdirSync(i),i},e.deleteFileFolderRecursive=A,e.createFolder=function(t){e.fs.existsSync(t)||e.fs.mkdirSync(t)},function(t){t.NONE="NONE",t.INCREMENT="INCREMENT",t.DECREMENT="DECREMENT"}(I=e.EnumIdentifierAutoManipulation||(e.EnumIdentifierAutoManipulation={})),
e.EnumMapIdentifierAutoManipulation={[I.NONE]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON",[I.INCREMENT]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON_AUTO_INC",[I.DECREMENT]:"_QAPP_LIB_PARAM_SELECT_OPTION_SID_ON_AUTO_DEC"},e.getLotIDsParameterID=function(t){o.isNumber(t)||(t=1),t=t;const a=d("_RESERVED_LOT_ID_SETTINGS");return{paramGroupID:a,settingsLockedInfo:a+"/"+e.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_settingsLocked",mainCounter:a+"/"+e.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_counter",header:a+"/"+e.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_"+t.toFixed(0)+"_header",title:a+"/"+e.DYNAMIC_PARAMID_PREQUEL+"RESERVED_LOT_ID_"+t.toFixed(0)+"_title"}},e.getSampleIDsParameterID=function(t){o.isNumber(t)||(t=1),t=t;const a=d("_RESERVED_SAMPLE_ID_SETTINGS");return{paramGroupID:a,settingsLockedInfo:a+"/"+e.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_settingsLocked",mainCounter:a+"/"+e.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_counter",
header:a+"/"+e.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+t.toFixed(0)+"_header",title:a+"/"+e.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+t.toFixed(0)+"_title",manipulator:a+"/"+e.DYNAMIC_PARAMID_PREQUEL+"RESERVED_SAMPLE_ID_"+t.toFixed(0)+"_manipulator"}},e.createStandardIdentifier=h,e.preManipulateIdentifier=function(t){let e=h();void 0!==t&&(e=n.cloneJSON(t));let a=void 0,i=0;const s=/\d*$/,r=e.value.match(s);switch(null!=r&&r.length>0&&o.isString(r[0])&&(i=r[0].length,a=parseInt(r[0])),e.automaticManipulation){case I.INCREMENT:""===e.value?e.value="001":""===e.value||o.isNumber(a)?""!==e.value&&o.isNumber(a)&&(a++,e.value=e.value.replace(s,a.toFixed(0).padStart(i,"0"))):e.value+="-2";break;case I.DECREMENT:""!==e.value&&o.isNumber(a)&&a>0&&(a--,e.value=e.value.replace(s,a.toFixed(0).padStart(i,"0")))}return e},e.perform_InternalWebserviceRequest=m,e.perform_WebserviceRequest=function(t,e,a,s,n,r,_,E,c,T,d){return i.__awaiter(this,void 0,void 0,function*(){
o.isNumber(e)||(e="http"===a?80:443),o.isNumber(d)||(d=1e4);let i,p={hostname:t,port:e,path:n,method:s,followRedirects:!1,headers:r,timeout:d};c&&T&&(p.auth=c+":"+T),p.agent="https"===a?new l.Agent({host:t,keepAlive:!0,rejectUnauthorized:!1,port:e}):new u.Agent({keepAlive:!0}),_&&void 0!==_&&(E=JSON.stringify(_)),E&&(p.headers["content-length"]=Buffer.byteLength(E));try{i=yield N(a,p,E).then(t=>({isSuccess:!0,error:"",statusCode:t.statusCode,headers:t.headers,body:t.body,url:t.url,metadata:n}))}catch(t){return{isSuccess:!1,error:t?t.toString():"",statusCode:0,headers:{},body:void 0,url:p.hostname+p.path,metadata:n}}return i})},e.httpRequest=N,e.getConfiguredPrintProfiles=function(){let t=[];const e=m("profilemanagement",c.RestMethodsPROFILE_MANAGEMENT.getProfiles,{filter:'[{"type":{"ne":"WEIGHING_PROFILE_NAME"}}]',rProfiles:{}});if(e.isSuccess()&&o.isString(e.rawReturns.rProfiles)){const a=JSON.parse(e.rawReturns.rProfiles.toString());for(let e=0;e<a.data.length;e++){
const i=o.getObjectByID(a.data[e].params,"PROFILE/IDENTIFICATION","id");if(o.isObject(i)&&o.isObject(i.parameters)){const s=o.getObjectByID(i.parameters,"PROFILE/IDENTIFICATION/NAME","id");o.isObject(s)&&o.isObject(s.value)&&t.push({id:a.data[e]._id,type:a.data[e].type,title:s.value.string})}}}return t},e.createMetrology=S,e.getMetrology=function(t){let e=S(),a=m("weighing",c.RestMethodsWEIGHING.getParameter,{id:"WEIGHING/METROLOGY/RANGE",rObject:{}}),i="";if(a.isSuccess()&&a.hasOwnProperty("rawReturns")&&a.rawReturns.hasOwnProperty("rObject")&&(a=JSON.parse(a.rawReturns.rObject))&&a.hasOwnProperty("id")&&a.hasOwnProperty("parameters")){let t=o.getObjectByID(a.parameters,"WEIGHING/METROLOGY/RANGE/MAXIMUM");t&&(i=t.value.numbers[0])}const s=m("weighing",c.RestMethodsWEIGHING.getRangeParameters,{parameters:{}});if(!(s.isSuccess()&&s.hasOwnProperty("rawReturns")&&s.rawReturns.hasOwnProperty("parameters")))return e;const n=JSON.parse(s.rawReturns.parameters)
;if(!(n.hasOwnProperty("list")&&Array.isArray(n.list)&&n.list.length>0))return e;const r=o.getObjectByID(n.list,"WEIGHING/METROLOGY/RANGES");if(!o.isObject(r))return e;e.ranges={};for(let a of Object.values(r.parameters)){if(!o.isString(a.id)||!o.isObject(a.parameters))continue;let s="";const n=a.id.split("/");if(0===(s=n[n.length-1]).length)continue;const r={d:T.createQuantity(),e:T.createQuantity(),max:T.createQuantity(),min:T.createQuantity()};let _=o.getObjectByID(a.parameters,"WEIGHING/METROLOGY/RANGES/"+s+"/INTERVAL");_&&(r.d.value=parseFloat(_.value.numbers[0]),r.d.decimals=_.value.decimals,r.d.unit=T.getUnitEnum(_.value.unit.toString())),(_=o.getObjectByID(a.parameters,"WEIGHING/METROLOGY/RANGES/"+s+"/PRECISION"))&&(r.e.value=parseFloat(_.value.numbers[0]),r.e.decimals=_.value.decimals,r.e.unit=T.getUnitEnum(_.value.unit.toString())),(_=o.getObjectByID(a.parameters,"WEIGHING/METROLOGY/RANGES/"+s+"/MINIMUM"))&&(r.min.value=parseFloat(_.value.numbers[0]),
r.min.decimals=_.value.decimals,r.min.unit=T.getUnitEnum(_.value.unit.toString())),(_=o.getObjectByID(a.parameters,"WEIGHING/METROLOGY/RANGES/"+s+"/MAXIMUM"))&&(r.max.value=parseFloat(_.value.numbers[0]),r.max.decimals=_.value.decimals,r.max.unit=T.getUnitEnum(_.value.unit.toString()),i===_.value.numbers[0]&&(e.activeRangeIndex=s)),void 0===t&&(t=r.d.unit),r.d=T.convertToTargetUnit(r.d,t),r.e=T.convertToTargetUnit(r.e,t),r.e.decimals=r.d.decimals,r.min=T.convertToTargetUnit(r.min,t),r.min.decimals=r.d.decimals,r.max=T.convertToTargetUnit(r.max,t),r.max.decimals=r.d.decimals,e.ranges[s]=r}e.extended.d.value=1/0,e.extended.e.value=1/0,e.extended.min.value=1/0,e.extended.max.value=-1/0;for(let t of Object.values(e.ranges))t.d.value<e.extended.d.value&&(e.extended.d=t.d),t.e.value<e.extended.e.value&&(e.extended.e=t.e),t.min.value<e.extended.min.value&&(e.extended.min=t.min),t.max.value>e.extended.max.value&&(e.extended.max=t.max);return e.unit=e.extended.d.unit,
e.decimals=e.extended.d.decimals,e.d=e.extended.d.value,e.e=e.extended.e.value,e.min=e.extended.min.value,e.max=e.extended.max.value,e},e.get_device_roles=function(){let t=m("user",c.RestMethodsUSER_MANAGEMENT.getListRoles,{list:{},start:0,end:-1}),e=[];try{let a=JSON.parse(t.rawReturns.list).data;for(let t=0;t<a.length;t++)e.push({id:a[t]._id,name:o.getObjectByID(a[t].params,"ROLE/NAME").value.string,editable:a[t].editable,locked:a[t].locked})}catch(t){}return e},e.get_device_user=function(){let t={id:"",name:"",display_name:"",description:"",role_id:"",role_name:""},e=m("access",c.RestMethodsACCESS_MANAGEMENT.getCurrentUser,{user:""});try{let a=JSON.parse(e.rawReturns.user);t.id=a._id;let i=o.getObjectByID(a.params,"USER/SETTINGS");t.name=o.getObjectByID(i.parameters,"USER/SETTINGS/LOGINNAME").value.string,t.display_name=o.getObjectByID(i.parameters,"USER/SETTINGS/NAME").value.string,t.description=o.getObjectByID(i.parameters,"USER/SETTINGS/DESCRIPTION").value.string,
t.role_id=o.getObjectByID(i.parameters,"USER/SETTINGS/ROLES").value.selection.id,t.role_name=o.getObjectByID(i.parameters,"USER/SETTINGS/ROLES").value.selection.text.id}catch(t){}return t},e.EnumMapUnit=null,e.harmonizeWeightParam=function(t){},e.tryAssign_taskParameter_to_IQuantity=function(t,e,a){},e.tryAssign_IQuantity_to_taskParameter=function(t,e,a){}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(10),s=a(62),n=a(0),r=a(5),o=a(30),_=a(1);e.WEIGHING_SCREEN_ID="WEIGHING",e.CANCEL_BARBUTTON_ID="BTN_BAR_CANCEL";const E={buttonId:"BARBUTTON/CANCEL",label:{id:"",args:[]},appearance:n.EnumAppearance.HIDDEN};e.WeighingScreen=class extends r.AbstractScreen{constructor(t,e){super(t),this.buttonList=[],this.text1={value:"",wildcards:[]},this.text2={value:"",wildcards:[]},this.param1="",this.param2="",this.title=void 0,this.createBarButtons(e),this.publishBarButtons(),this.checkBarGraph=new s.CheckBarGraph(t),
this.cancelBarButton=new i.default(this.mqttHandler,this,E)}getId(){return e.WEIGHING_SCREEN_ID}getBarButtonId(){return _.MqttTopics.HMI_WEIGHING_SCREEN_BARBUTTONS}createBarButtons(t){t.sort(this.compareButtonBarButtons);for(let e of t){let t=new i.default(this.mqttHandler,this,e);this.buttonList.push(t),t.publish()}}publishBarButtons(){let t=[];for(let e of this.buttonList)t.push(_.MqttTopics.QAPP_NAMESPACE+"/"+e.getTopic());this.mqttHandler.publish(this.getBarButtonId(),JSON.stringify(t))}setText1(t,e,a){let i=!1;this.text1.value!==t&&(this.text1.value=t,i=!0),e&&this.text1.wildcards.join()!==e.join()&&(this.text1.wildcards=e,i=!0),a?this.text1.color!==a&&(this.text1.color=a,i=!0):this.text1.color&&(this.text1.color=void 0,i=!0),i&&this.publishText1()}compareButtonBarButtons(t,e){return o.getButtonPriority(t.buttonId)-o.getButtonPriority(e.buttonId)}publishText1(){this.mqttHandler.publish(_.MqttTopics.HMI_WEIGHING_SCREEN_INSTRUCTION1,JSON.stringify(this.text1),{retain:!0})}
publishText2(){this.mqttHandler.publish(_.MqttTopics.HMI_WEIGHING_SCREEN_INSTRUCTION2,JSON.stringify(this.text2),{retain:!0})}setText2(t,e,a){let i=!1;this.text2.value!==t&&(this.text2.value=t,i=!0),e&&this.text2.wildcards.join()!==e.join()&&(this.text2.wildcards=e,i=!0),a?this.text2.color!==a&&(this.text2.color=a,i=!0):this.text2.color&&(this.text2.color=void 0,i=!0),i&&this.publishText2()}publishTitle(){this.title?this.mqttHandler.publish(_.MqttTopics.HMI_WEIGHING_SCREEN_TITLE,JSON.stringify(this.title),{retain:!0}):this.mqttHandler.publish(_.MqttTopics.HMI_WEIGHING_SCREEN_TITLE,"",{retain:!0})}setTitle(t){let e=void 0;this.title&&(e=JSON.stringify(this.title)),this.title=t,this.title!==e&&this.publishTitle()}getText1(){return this.text1}getText2(){return this.text2}publishParam1(){this.mqttHandler.publish(_.MqttTopics.HMI_WEIGHING_SCREEN_PARAM1_TOPIC,JSON.stringify(this.param1),{retain:!0})}publishParam2(){
this.mqttHandler.publish(_.MqttTopics.HMI_WEIGHING_SCREEN_PARAM2_TOPIC,JSON.stringify(this.param2),{retain:!0})}setParam1(t){this.param1!==t&&(this.param1=t,this.publishParam1())}setParam2(t){this.param2!==t&&(this.param2=t,this.publishParam2())}getParam1(){return this.param1}getParam2(){return this.param2}getButton(t){if(t===e.CANCEL_BARBUTTON_ID)return this.cancelBarButton;for(let e of this.buttonList)if(e.getButtonId()===t)return e}show(){this.publishText1(),this.publishText2(),this.publishTitle(),this.publishParam1(),this.publishParam2();for(let t of this.buttonList)t.publish();super.show()}getCheckBarGraph(){return this.checkBarGraph}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(5);e.AbstractOverlay=class extends s.AbstractScreen{show(){this.publishContent("",'{ "appearance":"'+i.EnumAppearance.ENABLED+'" }'),this.events$.next({type:s.ScreenEventType.SHOW_OVERLAY,id:this.getId()})}hide(){
this.publishContent("",'{ "appearance":"'+i.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:s.ScreenEventType.HIDE_OVERLAY,id:this.getId()})}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CONNECTION_ASPECT="CONNECTION_ASPECT",e.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE="STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE",function(t){t[t.MIGRATION_NEEDED=0]="MIGRATION_NEEDED",t[t.MIGRATION_NOT_NEEDED=1]="MIGRATION_NOT_NEEDED",t[t.MIGRATION_NOT_POSSIBLE=2]="MIGRATION_NOT_POSSIBLE",t[t.MIGRATION_DONE=3]="MIGRATION_DONE",t[t.MIGRATION_FAILED=4]="MIGRATION_FAILED"}(e.EMigrationResult||(e.EMigrationResult={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(3),n=a(13),r=a(5),o=a(14),_=a(1);e.KEYBOARD_SCREEN_ID="PARAMETER_INPUT";e.KeyboardScreen=class{constructor(t,e){this.keyboardObject={appearance:i.EnumAppearance.HIDDEN,param:{}},this.events$=new o.Subject,
e?(this.keyboardParam=s.createEmptySelectionParameter(),this.keyboardParam.appearance=i.EnumAppearance.HIDDEN):(this.keyboardParam=s.createEmptyStringParameter(),this.keyboardParam.appearance=i.EnumAppearance.HIDDEN),this.keyboardObject.param=this.keyboardParam,this.mqttHandler=t}setAppearance(t){this.keyboardObject.appearance!==t&&(t!==i.EnumAppearance.HIDDEN&&t!==i.EnumAppearance.ENABLED||(this.keyboardObject.appearance=t,this.mqttHandler.publish(_.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify(this.keyboardObject))))}getAppearance(){return this.keyboardObject.appearance}publishIfEnabled(){this.keyboardObject.appearance===i.EnumAppearance.ENABLED&&this.mqttHandler.publish(_.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify(this.keyboardObject))}setParamId(t){this.keyboardObject.param.id!==t&&(this.keyboardObject.param.id=t,this.publishIfEnabled())}getParamId(){return this.keyboardObject.param.id}setParamType(t){
this.keyboardObject.param.type!==t&&(this.keyboardObject.param.type=t,this.publishIfEnabled())}getParamType(){return this.keyboardObject.param.type}setParamAppearance(t){this.keyboardObject.param.appearance=t,this.publishIfEnabled()}getParamAppearance(){return this.keyboardObject.param.appearance}checkTextStructEqual(t,e){let a=!0;return t.id!==e.id&&(a=!1),t.args.join()!==e.args.join()&&(a=!1),a}setParamTitle(t){this.checkTextStructEqual(t,this.keyboardObject.param.title)||(this.keyboardObject.param.title=t,this.publishIfEnabled())}getParamTitle(){return this.keyboardObject.param.title}setParamHeader(t){this.checkTextStructEqual(t,this.keyboardObject.param.header)||(this.keyboardObject.param.header=t,this.publishIfEnabled())}getParamHeader(){return this.keyboardObject.param.header}setParam(t){n.isEqual(this.keyboardObject.param,t)||(this.keyboardObject.param=t,this.publishIfEnabled())}getParam(){return this.keyboardObject.param}getId(){return e.KEYBOARD_SCREEN_ID}getButton(t){}hide(){
this.keyboardObject.appearance===i.EnumAppearance.ENABLED&&(this.setAppearance(i.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_OVERLAY,id:this.getId()}))}show(){this.keyboardObject.appearance===i.EnumAppearance.HIDDEN&&(this.setAppearance(i.EnumAppearance.ENABLED),this.events$.next({type:r.ScreenEventType.SHOW_OVERLAY,id:this.getId()}))}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(100),s=a(102),n=a(103),r=a(30),o=a(104),_=a(105),E="SCREENS/",l="/TABLIST",u="/REQUESTEDTAB",c="/QAPP/";class T{constructor(t,e){this.tabScreenTablistObject=[],this.tabScreenRequestedObject="",this.tabList=[],this.mqttHandler=t,this.screenId=e,this.tabScreenTopic=E+this.screenId,this.tabScreenTablistTopic=this.tabScreenTopic+l,this.tabScreenRequestedTopic=this.tabScreenTopic+u}publishTabList(){this.mqttHandler.publish(this.tabScreenTablistTopic,JSON.stringify(this.tabScreenTablistObject))}publishRequestedTab(){
this.mqttHandler.publish(this.tabScreenRequestedTopic,JSON.stringify(this.tabScreenRequestedObject))}static createFigureTab(t,e,a,s,n){return a.topbuttons=void 0!==n?T.sortTopButtons(n):a.topbuttons,new i.TabFigure(a,t,e,s)}addFigureTab(t,e,a){e.id=t;let i=T.createFigureTab(this.mqttHandler,this.screenId,e,!1,a);return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}static createGraphTab(t,e,a,i,n){return a.topbuttons=void 0!==n?T.sortTopButtons(n):a.topbuttons,new s.TabGraph(a,t,e,i)}addGraphTab(t,e,a){e.id=t;let i=T.createGraphTab(this.mqttHandler,this.screenId,e,!1,a);return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}static createParamListTab(t,e,a,i,s){return a.topbuttons=void 0!==s?T.sortTopButtons(s):a.topbuttons,new n.TabParamList(a,t,e,i)}addParamListTab(t,e,a){e.id=t;let i=T.createParamListTab(this.mqttHandler,this.screenId,e,!1,a);return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}
static createMenuTab(t,e,a,i,s){return a.topbuttons=void 0!==s?T.sortTopButtons(s):a.topbuttons,new o.TabMenu(a,t,e,i)}static createTableTab(t,e,a,i,s){return a.topbuttons=void 0!==s?T.sortTopButtons(s):a.topbuttons,new _.TabTable(a,t,e,i)}addMenuTab(t,e,a){e.id=t;let i=T.createMenuTab(this.mqttHandler,this.screenId,e,!1,a);return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}addTableTab(t,e,a){e.id=t;let i=T.createTableTab(this.mqttHandler,this.screenId,e,!1,a);return this.tabScreenTablistObject.push(c+i.publishId()),this.tabList.push(i),i}getTab(t){let e=void 0;for(let a of this.tabList)a.getTabId()===t&&(e=a);return e}getTabList(){return this.tabList}clearTabList(){this.tabList.splice(0,this.tabList.length),this.tabScreenTablistObject.splice(0,this.tabScreenTablistObject.length)}requestTab(t){void 0!==this.getTab(t)&&(this.tabScreenRequestedObject=t,this.publishRequestedTab())}static sortTopButtons(t){
return t.sort((t,e)=>r.getButtonPriority(t.getButtonId())-r.getButtonPriority(e.getButtonId())).map(t=>`/QAPP/${t.getTopic()}`)}}e.TabApi=T},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(2),s=a(18),n=a(7),r=a(34);var o,_,E,l,u,c,T,d;function p(t){let e={valid_dataset:!1,product_id:"",article_id:"",prod_test_type:c.USER_DEFINED,prod_type:u.LIQUID,proc_tare_type:T.EMPTY_FILLED,count_target:0,prod_target:{value:0,unit:s.EnumUnit.MILLILITER,decimals:3},prod_min2:{value:0,unit:s.EnumUnit.MILLILITER,decimals:3},prod_min1:{value:0,unit:s.EnumUnit.MILLILITER,decimals:3},prod_max1:{value:0,unit:s.EnumUnit.MILLILITER,decimals:3},prod_max2:{value:0,unit:s.EnumUnit.MILLILITER,decimals:3},density:{value:1,unit:s.EnumUnit.GRAM_PER_MILLILITER,decimals:4},prod_print_wgt:E.ENABLED,tare_plausibility:{value:0,unit:s.EnumUnit.GRAM,decimals:3},use_tare_limits:l.ENABLED,tare_target:{value:0,unit:s.EnumUnit.GRAM,decimals:3},tare_min2:{value:0,unit:s.EnumUnit.GRAM,
decimals:3},tare_min1:{value:0,unit:s.EnumUnit.GRAM,decimals:3},tare_max1:{value:0,unit:s.EnumUnit.GRAM,decimals:3},tare_max2:{value:0,unit:s.EnumUnit.GRAM,decimals:3},proc_tare_method:_.TARE_SINGLE,prod_print_tare:E.ENABLED};return n.isObject(t)&&n.overwriteExistingAttributes(t,e),e}function A(t){let a=-1,i={target:t.prod_target.unit,min1:t.prod_min1.unit,min2:t.prod_min1.unit};t.prod_target=s.convertToTargetUnit(t.prod_target,s.EnumUnit.GRAM),t.prod_min1=s.convertToTargetUnit(t.prod_min1,s.EnumUnit.GRAM),t.prod_min2=s.convertToTargetUnit(t.prod_min2,s.EnumUnit.GRAM);for(let i=0;i<e.PRODUCT_LIMITS_76_211_EEC.length;i++)e.PRODUCT_LIMITS_76_211_EEC[i].lower_equal_boundary<=t.prod_target.value&&t.prod_target.value<e.PRODUCT_LIMITS_76_211_EEC[i].upper_boundary&&(a=i);a>=0?"absolute"===e.PRODUCT_LIMITS_76_211_EEC[a].limit_unit?(t.prod_min1.value=t.prod_target.value-e.PRODUCT_LIMITS_76_211_EEC[a].limit_value,
t.prod_min2.value=t.prod_target.value-2*e.PRODUCT_LIMITS_76_211_EEC[a].limit_value):(t.prod_min1.value=t.prod_target.value*((100-e.PRODUCT_LIMITS_76_211_EEC[a].limit_value)/100),t.prod_min2.value=t.prod_target.value*((100-2*e.PRODUCT_LIMITS_76_211_EEC[a].limit_value)/100),t.prod_min1.value=s.math_roundUp(t.prod_min1.value,1),t.prod_min2.value=s.math_roundUp(t.prod_min2.value,1)):(t.prod_min1.value=t.prod_target.value,t.prod_min2.value=t.prod_target.value),t.prod_target=s.convertToTargetUnit(t.prod_target,i.target),t.prod_min1=s.convertToTargetUnit(t.prod_min1,i.min1),t.prod_min2=s.convertToTargetUnit(t.prod_min2,i.min2)}function I(t){let e={wgt_full:{value:NaN,unit:s.EnumUnit.NONE,decimals:0},wgt_tare:{value:NaN,unit:s.EnumUnit.NONE,decimals:0},wgt_filling:{value:NaN,unit:s.EnumUnit.NONE,decimals:0},rslt_filling:{value:NaN,unit:s.EnumUnit.NONE,decimals:0},tare_status:d.PENDING,full_status:d.PENDING,rslt_status:d.PENDING,get tare_properly_processed(){
return this.tare_status!==d.PENDING&&this.tare_status!==d.SKIPPED},get rslt_properly_processed(){return this.rslt_status!==d.PENDING&&this.rslt_status!==d.SKIPPED}};return n.isObject(t)&&n.overwriteExistingAttributes(t,e),e}e.QAPP_ID="QAPP006",e.PRODUCT_LIMITS_76_211_EEC=[{lower_equal_boundary:5,upper_boundary:50,limit_value:9,limit_unit:"relative"},{lower_equal_boundary:50,upper_boundary:100,limit_value:4.5,limit_unit:"absolute"},{lower_equal_boundary:100,upper_boundary:200,limit_value:4.5,limit_unit:"relative"},{lower_equal_boundary:200,upper_boundary:300,limit_value:9,limit_unit:"absolute"},{lower_equal_boundary:300,upper_boundary:500,limit_value:3,limit_unit:"relative"},{lower_equal_boundary:500,upper_boundary:1e3,limit_value:15,limit_unit:"absolute"},{lower_equal_boundary:1e3,upper_boundary:1e4,limit_value:1.5,limit_unit:"relative"},{lower_equal_boundary:1e4,upper_boundary:15e3,limit_value:150,limit_unit:"absolute"},{lower_equal_boundary:15e3,upper_boundary:5e4,limit_value:1,
limit_unit:"relative"},{lower_equal_boundary:5e4,upper_boundary:1e5,limit_value:500,limit_unit:"absolute"},{lower_equal_boundary:1e5,upper_boundary:1/0,limit_value:.5,limit_unit:"relative"}],e.BALANCE_PRECISION_76_211_EEC=[{lower_equal_boundary:5,upper_boundary:10,limit_value:.1},{lower_equal_boundary:10,upper_boundary:25,limit_value:.2},{lower_equal_boundary:25,upper_boundary:150,limit_value:.5},{lower_equal_boundary:150,upper_boundary:350,limit_value:1},{lower_equal_boundary:350,upper_boundary:1750,limit_value:2},{lower_equal_boundary:1750,upper_boundary:3500,limit_value:5},{lower_equal_boundary:3500,upper_boundary:7e3,limit_value:10},{lower_equal_boundary:7e3,upper_boundary:25e3,limit_value:20},{lower_equal_boundary:25e3,upper_boundary:5e4,limit_value:50},{lower_equal_boundary:5e4,upper_boundary:1e5,limit_value:100},{lower_equal_boundary:1e5,upper_boundary:6e5,limit_value:200},{lower_equal_boundary:6e5,upper_boundary:15e5,limit_value:500}],function(t){t.ENABLED="ENABLED",
t.DISABLED="DISABLED"}(o=e.EnumQuickTestEnabled||(e.EnumQuickTestEnabled={})),e.EnumMapQuickTestEnabled={[o.ENABLED]:"_QAPP006_PARAMVAL_QUICKTEST_ENABLED",[o.DISABLED]:"_QAPP006_PARAMVAL_QUICKTEST_DISABLED"},function(t){t.TARE_SINGLE="TARE_SINGLE",t.TARE_MEAN="TARE_MEAN",t.TARE_MEAN_SINGLES="TARE_MEAN_SINGLES",t.TARE_ENTER="TARE_ENTER"}(_=e.EnumTareMethod||(e.EnumTareMethod={})),e.EnumMapTareMethod={[_.TARE_SINGLE]:"_QAPP006_PARAMVAL_PROC_METHOD_TARE_SINGLE",[_.TARE_MEAN]:"_QAPP006_PARAMVAL_PROC_METHOD_TARE_MEAN",[_.TARE_MEAN_SINGLES]:"_QAPP006_PARAMVAL_PROC_METHOD_TARE_MEAN_SINGLES",[_.TARE_ENTER]:"_QAPP006_PARAMVAL_PROC_METHOD_TARE_ENTER"},function(t){t.ENABLED="ENABLED",t.DISABLED="DISABLED"}(E=e.EnumProductPrint||(e.EnumProductPrint={})),e.EnumMapProductPrint={[E.ENABLED]:"_QAPP006_PARAMVAL_PRODUCT_PRINT_ENABLED",[E.DISABLED]:"_QAPP006_PARAMVAL_PRODUCT_PRINT_DISABLED"},function(t){t.ENABLED="ENABLED",t.DISABLED="DISABLED"
}(l=e.EnumProductUseTareLmits||(e.EnumProductUseTareLmits={})),e.EnumMapProductUseTareLmits={[l.ENABLED]:"_QAPP006_PARAMVAL_PRODUCT_USE_TARE_LIMITS_ENABLED",[l.DISABLED]:"_QAPP006_PARAMVAL_PRODUCT_USE_TARE_LIMITS_DISABLED"},function(t){t.LIQUID="LIQUID",t.SOLID="SOLID"}(u=e.EnumProductType||(e.EnumProductType={})),e.EnumMapProductType={[u.LIQUID]:"_QAPP006_PARAMVAL_PRODUCT_TYPE_LIQUID",[u.SOLID]:"_QAPP006_PARAMVAL_PRODUCT_TYPE_SOLID"},function(t){t.USER_DEFINED="USER_DEFINED",t.ACCORDING_76_211_EEC="ACCORDING_76_211_EEC"}(c=e.EnumProductTestType||(e.EnumProductTestType={})),e.EnumMapProductTestType={[c.USER_DEFINED]:"_QAPP006_PARAMVAL_PRODUCT_TEST_TYPE_USER_DEFINED",[c.ACCORDING_76_211_EEC]:"_QAPP006_PARAMVAL_PRODUCT_TEST_TYPE_ACCORDING_76_211_EEC"},function(t){t.NO_TARE="NO_TARE",t.EMPTY_FILLED="EMPTY_FILLED",t.FILLED_EMPTY="FILLED_EMPTY"}(T=e.EnumTareType||(e.EnumTareType={})),e.EnumMapTareType={[T.NO_TARE]:"_QAPP006_PARAMVAL_PRODUCT_TARE_TYPE_NO_TARE",
[T.EMPTY_FILLED]:"_QAPP006_PARAMVAL_PRODUCT_TARE_TYPE_EMPTY_FILLED",[T.FILLED_EMPTY]:"_QAPP006_PARAMVAL_PRODUCT_TARE_TYPE_FILLED_EMPTY"},function(t){t.PENDING="PENDING",t.MIN2_VIOLATION="MIN2_VIOLATION",t.MIN1_VIOLATION="MIN1_VIOLATION",t.OK="OK",t.MAX1_VIOLATION="MAX1_VIOLATION",t.MAX2_VIOLATION="MAX2_VIOLATION",t.SKIPPED="SKIPPED"}(d=e.EnumSampleResultStatus||(e.EnumSampleResultStatus={})),e.EnumMapSampleResultStatus={[d.PENDING]:"_QAPP006_PRINTLABEL_SINGLE_VALUE_PENDING",[d.MIN2_VIOLATION]:"_QAPP006_PRINTLABEL_SINGLE_VALUE_MIN2_VIOLATION",[d.MIN1_VIOLATION]:"_QAPP006_PRINTLABEL_SINGLE_VALUE_MIN1_VIOLATION",[d.OK]:"",[d.MAX1_VIOLATION]:"_QAPP006_PRINTLABEL_SINGLE_VALUE_MAX1_VIOLATION",[d.MAX2_VIOLATION]:"_QAPP006_PRINTLABEL_SINGLE_VALUE_MAX2_VIOLATION",[d.SKIPPED]:"_QAPP006_PRINTLABEL_SINGLE_VALUE_SKIPPED"},e.createTaskConfig=function(t){let e={supervisor_roles:[],auto_acquisition:{value:1,unit:s.EnumUnit.DIGIT,decimals:0},enable_quicktest:o.DISABLED,last_used_SIDs:[],
last_used_LIDs:[]};return n.isObject(t)&&n.overwriteExistingAttributes(t,e),e},e.createProduct=p,e.verifyProduct=function(t){t.valid_dataset=!0,t.prod_type===u.SOLID&&(t.density.value=1,t.prod_print_wgt=E.DISABLED),t.proc_tare_type===T.NO_TARE&&(t.prod_print_tare=E.DISABLED),t.proc_tare_method===_.TARE_ENTER&&(t.use_tare_limits=l.DISABLED),""===t.product_id&&(t.valid_dataset=!1),t.count_target<=0&&(t.valid_dataset=!1),t.proc_tare_type!==T.NO_TARE&&t.use_tare_limits===l.ENABLED&&(0<=t.tare_min2.value&&t.tare_min2.value<t.tare_min1.value&&t.tare_min1.value<t.tare_target.value&&t.tare_target.value<t.tare_max1.value&&t.tare_min1.value<t.tare_max1.value&&t.tare_max1.value<t.tare_max2.value&&t.tare_max2.value<t.tare_plausibility.value||(t.valid_dataset=!1));let e=s.convertToTargetUnit(t.prod_target,s.EnumUnit.GRAM);return t.prod_test_type===c.ACCORDING_76_211_EEC&&(A(t),5<=e.value&&e.value<15e5||(t.valid_dataset=!1)),
0<=t.prod_min2.value&&t.prod_min2.value<t.prod_min1.value&&t.prod_min1.value<t.prod_target.value&&t.prod_target.value<t.prod_max1.value&&t.prod_max1.value<t.prod_max2.value||(t.valid_dataset=!1),t.valid_dataset},e.determineProductTolerances76211EEC=A,e.createSample=I,e.createBatch=function(t,e){let a={get lot_id(){return n.isString(this.lot_ids[0])?this.lot_ids[0]:""},set lot_id(t){this.lot_ids[0]=t},lot_ids:[],product:p(e),time_start:r.getDateTime("iso",void 0,0),time_end:r.getDateTime("iso",void 0,0),lt_count:0,lt_count_min2:0,lt_count_min1:0,lt_count_passed:0,lt_count_max1:0,lt_count_max2:0,lt_count_skipped:0,lt_rslt_mean:{value:NaN,unit:s.EnumUnit.NONE,decimals:3},lt_rslt_stddev:{value:NaN,unit:s.EnumUnit.NONE,decimals:3},lt_rslt_sum:{value:0,unit:s.EnumUnit.NONE,decimals:3},lt_rslt_square_sum_in_stddev_unit:{value:0,unit:s.EnumUnit.NONE,decimals:3},lt_rslt_minimum:{value:NaN,unit:s.EnumUnit.NONE,decimals:3},lt_rslt_maximum:{value:NaN,unit:s.EnumUnit.NONE,decimals:3},
lt_rslt_range:{value:NaN,unit:s.EnumUnit.NONE,decimals:3},processes:{}};return n.isObject(t)&&(n.overwriteExistingAttributes(t,a),a.product=p(a.product)),a},e.createProcess=function(t,e){let a=p(e),o={batch_test_id:"1",product_currentUnit:a,density:i.cloneJSON(a.density),current_idx:0,samples:[],get curr_sample(){return void 0===this.samples[this.current_idx]?I():this.samples[this.current_idx]},set curr_sample(t){},count_min2:0,count_min1:0,count_passed:0,count_max1:0,count_max2:0,count_skipped:0,rslt_mean:{value:NaN,unit:a.prod_target.unit,decimals:a.prod_target.decimals},rslt_stddev:{value:NaN,unit:a.prod_target.unit,decimals:a.prod_target.decimals},rslt_minimum:{value:NaN,unit:a.prod_target.unit,decimals:a.prod_target.decimals},rslt_maximum:{value:NaN,unit:a.prod_target.unit,decimals:a.prod_target.decimals},rslt_range:{value:NaN,unit:a.prod_target.unit,decimals:a.prod_target.decimals},wgt_tare_count_min2:0,wgt_tare_count_min1:0,wgt_tare_count_passed:0,wgt_tare_count_max1:0,
wgt_tare_count_max2:0,wgt_tare_mean:{value:NaN,unit:s.EnumUnit.GRAM,decimals:0},wgt_tare_stddev:{value:NaN,unit:s.EnumUnit.GRAM,decimals:0},wgt_tare_minimum:{value:NaN,unit:s.EnumUnit.GRAM,decimals:0},wgt_tare_maximum:{value:NaN,unit:s.EnumUnit.GRAM,decimals:0},wgt_tare_range:{value:NaN,unit:s.EnumUnit.GRAM,decimals:0},time_start:r.getDateTime("iso",void 0,0),time_end:r.getDateTime("iso",void 0,0)};for(let t=0;t<a.count_target;t++)o.samples[t]=I();return n.isObject(t)&&n.overwriteExistingAttributes(t,o),o}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(3),s=a(20),n=a(32),r=a(2);e.checkGeneralParamRules=function(t){let e=void 0;if(i.isTypeOfIQuantityParameter(t)){let a=s.QuantityParameter.getValue(t);if(Number.isNaN(a)){if(!0!==t.info.isNoValueAllowed){let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==t.info.noValueErrorMsg?"string"==typeof t.info.noValueErrorMsg?a.textList=[{id:t.info.noValueErrorMsg,args:[]
}]:a.textList=[t.info.noValueErrorMsg]:a.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_QUANT_PARAM_EMPTY_NOT_ALLOWED",args:[]}],e={updatedParameter:t,message:a}}}else try{if(a<parseFloat(t.info.minimum.value)){let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);a.textList=[{id:t.info.minimum.errorMsg?t.info.minimum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_QUANT_PARAM_EXCEED_MIN",args:[]}],e={updatedParameter:t,message:a}}else if(a>parseFloat(t.info.maximum.value)){let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);a.textList=[{id:t.info.maximum.errorMsg?t.info.maximum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_QUANT_PARAM_EXCEED_MAX",args:[]}],e={updatedParameter:t,message:a}}}catch(t){}}else if(i.isTypeOfIStringParameter(t)){let a=t.value.string;try{if(void 0===a){if(0!==t.info.minimum.length&&!0!==t.info.isNoValueAllowed){let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==t.info.noValueErrorMsg?"string"==typeof t.info.noValueErrorMsg?a.textList=[{id:t.info.noValueErrorMsg,
args:[]}]:a.textList=[t.info.noValueErrorMsg]:a.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],e={updatedParameter:t,message:a}}}else if(a.length<t.info.minimum.length)if(0===a.length){if(console.log("StringParam: empty"),!0!==t.info.isNoValueAllowed){let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==t.info.noValueErrorMsg?"string"==typeof t.info.noValueErrorMsg?a.textList=[{id:t.info.noValueErrorMsg,args:[]}]:a.textList=[t.info.noValueErrorMsg]:a.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],e={updatedParameter:t,message:a}}}else{console.log("StringParam: min exceed");let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);a.textList=[{id:t.info.minimum.errorMsg?t.info.minimum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_SHORT",args:[]}],e={updatedParameter:t,message:a}}else if(a.length>t.info.maximum.length)if(console.log("StringParam: max exceed"),
!0===t.info.maximum.autoCut)console.log("StringParam: autocut"),t.value.string=a.substr(0,t.info.maximum.length);else{let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);a.textList=[{id:t.info.maximum.errorMsg?t.info.maximum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_LONG",args:[]}],e={updatedParameter:t,message:a}}}catch(t){}}else if(i.isTypeOfIPasswordParameter(t)){let a=t.value.string;try{if(void 0===a){if(0!==t.info.minimum.length&&!0!==t.info.isNoValueAllowed){let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);void 0!==t.info.noValueErrorMsg?"string"==typeof t.info.noValueErrorMsg?a.textList=[{id:t.info.noValueErrorMsg,args:[]}]:a.textList=[t.info.noValueErrorMsg]:a.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],e={updatedParameter:t,message:a}}}else if(a.length<t.info.minimum.length)if(0===a.length){if(console.log("PasswordParam: empty"),!0!==t.info.isNoValueAllowed){let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept)
;void 0!==t.info.noValueErrorMsg?"string"==typeof t.info.noValueErrorMsg?a.textList=[{id:t.info.noValueErrorMsg,args:[]}]:a.textList=[t.info.noValueErrorMsg]:a.textList=[{id:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_MANDATORY",args:[]}],e={updatedParameter:t,message:a}}}else{console.log("PasswordParam: min exceed");let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);a.textList=[{id:t.info.minimum.errorMsg?t.info.minimum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_SHORT",args:[]}],e={updatedParameter:t,message:a}}else if(a.length>t.info.maximum.length){console.log("PasswordParam: max exceed");let a=r.cloneJSON(n.ParamUpdateUserActionSimpleAccept);a.textList=[{id:t.info.maximum.errorMsg?t.info.maximum.errorMsg:"_QAPP_LIB_MSG_BOX_ERROR_CFG_STRING_PARAM_TOO_LONG",args:[]}],e={updatedParameter:t,message:a}}}catch(t){}}return e}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0})
;const i=a(13),s=a(56),n=a(6),r=a(20),o=a(37),_=a(33),E=a(15),l=a(82),u=a(4),c=a(18),T=a(58);var d,p=a(56);e.Subscription=p.Subscription,e.Observable=p.Observable,e.WEIGHING_BUTTON_UNIT="UNIT",e.WEIGHING_BUTTON_DO_ZERO="DO_ZERO",e.WEIGHING_BUTTON_DO_TARE="DO_TARE",e.WEIGHING_BUTTON_DO_TARE1="DO_TARE1",e.WEIGHING_BUTTON_CLR_TARE1="CLR_TARE1",e.WEIGHING_BUTTON_SET_TARE1="SET_TARE1",e.WEIGHING_BUTTON_SHOW_TARE1="SHOW_TARE1",e.WEIGHING_BUTTON_HIDE_TARE1="HIDE_TARE1",e.WEIGHING_BUTTON_DISPLAY="DISPLAY",function(t){t.WEIGHING_DOZEROTARE_BEHAVIOR_AS_CONFIGURED="AS_CONFIGURED",t.WEIGHING_DOZEROTARE_BEHAVIOR_WITHOUT_STABILITY="WITHOUT_STABILITY",t.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY="AFTER_STABILITY"}(e.WEIGHING_DOZEROTARE_BEHAVIOR||(e.WEIGHING_DOZEROTARE_BEHAVIOR={})),function(t){t.SELECTED_DOMAIN_UNDEFINED="",t.SELECTED_DOMAIN_WEIGHING="ORIGINAL",t.SELECTED_DOMAIN_APP="APPLICATION"}(d=e.ISelectedWeightDisplayValueDomains||(e.ISelectedWeightDisplayValueDomains={}))
;const A="WEIGHING_ERROR_UNKNOWN_UNIT_ID";e.WeighingProxy=class extends n.BaseProxy{constructor(){super(...arguments),this.restEndpoint="weighing",this.weighValueMaxDigits=7,this.registeredApplications=[],this.weighingButtonAppearances={[T.WEIGHING_BUTTON_ID.UNIT]:"undefined",[T.WEIGHING_BUTTON_ID.DO_ZERO]:"undefined",[T.WEIGHING_BUTTON_ID.DO_TARE]:"undefined",[T.WEIGHING_BUTTON_ID.DO_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.CLR_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.SET_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.SHOW_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.HIDE_TARE1]:"undefined",[T.WEIGHING_BUTTON_ID.DISPLAY]:"undefined"},this.metrologyMaximum$=new s.ReplaySubject(1),this.metrologyMinimum$=new s.ReplaySubject(1),this.highestRangeInterval$=new s.ReplaySubject(1),this.lowestRangeInterval$=new s.ReplaySubject(1),this.highestRangePrecision$=new s.ReplaySubject(1),this.lowestRangePrecision$=new s.ReplaySubject(1),this.metrologyRanges$=new s.ReplaySubject(1),
this.selectedDisplayValue$=new s.ReplaySubject(1),this.lastSelectedDisplayValueInfo={currentSelectedDomain:d.SELECTED_DOMAIN_UNDEFINED,currentSelectedId:"",lastSelectedApplicationId:""}}createWeightApplication(t,e,a,i,s=!1){if(this.registeredApplications.find(e=>e===t))return this.enableWeightApplication(t,s);{this.body.method=u.RestMethodsWEIGHING.createWeightApplication,this.body.params={id:t,title:e,header:a,isDynamic:i};let r=new n.CubisRestResponse(this.syncRequest());if(r.isSuccess()){try{this.enableWeightApplication(t,s)}catch(t){}this.registeredApplications.push(t)}return r}}enableWeightApplication(t,e){return this.body.method=u.RestMethodsWEIGHING.enableWeightApplication,this.body.params={id:t,isEnabled:e},new n.CubisRestResponse(this.syncRequest())}enableWeightApplicationBulk(t,e){if(!e){let e=this.getSelectedDisplayValue();if(e){let a=e.lastSelectedApplicationId;if(a){let e=!1;return t.forEach(t=>{t!==a?this.enableWeightApplication(t,!1):e=!0}),
void(e&&this.enableWeightApplication(a,!1))}}}t.forEach(t=>{this.enableWeightApplication(t,e)})}selectWeightApplication(t){return this.body.method=u.RestMethodsWEIGHING.selectWeightApplication,this.body.params={id:t},new n.CubisRestResponse(this.syncRequest())}destroyWeightApplication(t){this.body.method=u.RestMethodsWEIGHING.destroyWeightApplication,this.body.params={id:t};let e=new n.CubisRestResponse(this.syncRequest());if(e.isSuccess()){let e=this.registeredApplications.findIndex(e=>e===t);e>=0&&this.registeredApplications.splice(e,1)}return e}setButton(t,e){return this.weighingButtonAppearances[t]===e?new n.CubisRestResponse(!0):(this.weighingButtonAppearances[t]=e,this.body.method=u.RestMethodsWEIGHING.setButton,this.body.params={name:t,appearance:e},new n.CubisRestResponse(this.syncRequest()))}triggerStableWeightBlock(){return this.body.method=u.RestMethodsWEIGHING.triggerStableWeightBlock,this.body.params={},new n.CubisRestResponse(this.syncRequest())}cancelStableWeightBlock(){
return this.body.method=u.RestMethodsWEIGHING.cancelStableWeightBlock,this.body.params={},new n.CubisRestResponse(this.syncRequest())}doZero(t){return this.body.method=u.RestMethodsWEIGHING.doZero,this.body.params={behavior:t},new n.CubisRestResponse(this.syncRequest())}clearTare1(){return this.body.method=u.RestMethodsWEIGHING.clearTare1,this.body.params={},new n.CubisRestResponse(this.syncRequest())}clearTare2(){return this.body.method=u.RestMethodsWEIGHING.clearTare2,this.body.params={},new n.CubisRestResponse(this.syncRequest())}clearTare1AndTare2(){return{clearTare1Response:this.clearTare1(),clearTare2Response:this.clearTare2()}}clearTareAll(){return this.body.method=u.RestMethodsWEIGHING.clearTareAll,this.body.params={},new n.CubisRestResponse(this.syncRequest())}doTare(t){return this.body.method=u.RestMethodsWEIGHING.doTare,this.body.params={behavior:t},new n.CubisRestResponse(this.syncRequest())}doTare1(t){return this.body.method=u.RestMethodsWEIGHING.doTare1,this.body.params={
behavior:t},new n.CubisRestResponse(this.syncRequest())}doTareAuto(t){return this.body.method=u.RestMethodsWEIGHING.doTareAuto,this.body.params={behavior:t},new n.CubisRestResponse(this.syncRequest())}doZeroTareAuto(t){return this.body.method=u.RestMethodsWEIGHING.doZeroTareAuto,this.body.params={behavior:t},new n.CubisRestResponse(this.syncRequest())}setTare1(t){return this.body.method=u.RestMethodsWEIGHING.setTare1,this.body.params={value:t},new n.CubisRestResponse(this.syncRequest())}cancelDoing(){return this.body.method=u.RestMethodsWEIGHING.cancelDoing,this.body.params={},new n.CubisRestResponse(this.syncRequest())}setTare2(t){return this.body.method=u.RestMethodsWEIGHING.setTare2,this.body.params={value:t},new n.CubisRestResponse(this.syncRequest())}setUnit(t,e=!0){this.body.method=u.RestMethodsWEIGHING.setUnit,this.body.params={unitId:t};let a=new n.CubisRestResponse(this.syncRequest());if(a.isSuccess())return!0;if(a.result===A){if(e){
let e=new _.MessageHandlerHelper(new o.MessageHandlerProxy),a=new l.ProfileManagementProxy,i=E.QAppBase.clientSingleton.getWeighingProfileId();e.addMessage(_.EMsgHandlerMsgs.ERR_704_UNIT_UNAVAILABLE,[E.QAppBase.clientSingleton.getTaskName()||"",c.getUnitString(t),i?a.getWeighingProfileName(i):""],void 0,[o.createMessageHandlerButton(void 0,void 0,o.MessageHandlerCallTarget.REMOVE_MESSAGE)]),E.QAppBase.clientSingleton.doSuspend()}return!1}return!1}getParameter(t){return this.body.method=u.RestMethodsWEIGHING.getParameter,this.body.params={rObject:{},id:t},new n.CubisRestResponse(this.syncRequest())}getParameterIds(){return this.body.method=u.RestMethodsWEIGHING.getParameterIds,this.body.params={rIds:{}},new n.CubisRestResponse(this.syncRequest())}setMinUsp(t){return this.body.method=u.RestMethodsWEIGHING.setMinUsp,this.body.params={isEnabled:!0,value:r.QuantityParameter.getValue(t),unit:t.unit},new n.CubisRestResponse(this.syncRequest())}setMinWeight(t){
return this.body.method=u.RestMethodsWEIGHING.setMinWeight,this.body.params=Object.assign({},t),new n.CubisRestResponse(this.syncRequest())}getWeighValueMaxDigits(){return this.weighValueMaxDigits}updateWeighValueMaxDigits(t){console.log("Weighing proxy: set new max weight value digit count: "+t),this.weighValueMaxDigits=t}updateMetrologyRanges(t){let e=i.last(t.parameters),a=i.head(t.parameters);if(this.metrologyRanges$.next(t),void 0!==e){let t=e.parameters.find(t=>"MAXIMUM"===i.last(t.id.split("/"))),a=e.parameters.find(t=>"INTERVAL"===i.last(t.id.split("/"))),s=e.parameters.find(t=>"PRECISION"===i.last(t.id.split("/")));void 0!==t&&this.metrologyMaximum$.next({maxUnit:t.value.unit,maxValue:r.QuantityParameter.getValue(t),maxDecimals:t.value.decimals}),void 0!==a&&this.highestRangeInterval$.next({intervalUnit:a.value.unit,intervalValue:r.QuantityParameter.getValue(a),intervalDecimals:a.value.decimals}),void 0!==s&&this.highestRangePrecision$.next({precisionUnit:s.value.unit,
precisionValue:r.QuantityParameter.getValue(s),precisionDecimals:s.value.decimals})}if(void 0!==a){let t=a.parameters.find(t=>"MINIMUM"===i.last(t.id.split("/"))),e=a.parameters.find(t=>"INTERVAL"===i.last(t.id.split("/"))),s=a.parameters.find(t=>"PRECISION"===i.last(t.id.split("/")));void 0!==t&&this.metrologyMinimum$.next({minUnit:t.value.unit,minValue:r.QuantityParameter.getValue(t),minDecimals:t.value.decimals}),void 0!==e&&this.lowestRangeInterval$.next({intervalUnit:e.value.unit,intervalValue:r.QuantityParameter.getValue(e),intervalDecimals:e.value.decimals}),void 0!==s&&this.lowestRangePrecision$.next({precisionUnit:s.value.unit,precisionValue:r.QuantityParameter.getValue(s),precisionDecimals:s.value.decimals})}}getSelectedDisplayValue(){return this.lastSelectedDisplayValueInfo}restoreLastSelectedDisplayValue(t){void 0!==this.lastSelectedDisplayValueInfo&&(this.lastSelectedDisplayValueInfo.lastSelectedApplicationId=t,
this.selectedDisplayValue$.next(this.lastSelectedDisplayValueInfo))}updateLastSelectedDisplayValue(t){try{console.log("WeighingProxy::updateLastSelectedDisplayValue: "+JSON.stringify(t));let e={currentSelectedDomain:t.show,currentSelectedId:t.id,lastSelectedApplicationId:""};e.currentSelectedDomain===d.SELECTED_DOMAIN_APP?e.lastSelectedApplicationId=t.id:void 0!==this.lastSelectedDisplayValueInfo&&(e.lastSelectedApplicationId=this.lastSelectedDisplayValueInfo.lastSelectedApplicationId),this.lastSelectedDisplayValueInfo=e,console.log("WeighingProxy::updateLastSelectedDisplayValue: new: "+JSON.stringify(this.lastSelectedDisplayValueInfo)),this.selectedDisplayValue$.next(this.lastSelectedDisplayValueInfo)}finally{}}insertWeightInvalidation(t,e){return this.body.method=u.RestMethodsWEIGHING.insertWeightInvalidation,this.body.params={group:t,topic:e},new n.CubisRestResponse(this.syncRequest())}removeWeightInvalidation(t,e){
return this.body.method=u.RestMethodsWEIGHING.removeWeightInvalidation,this.body.params={group:t,topic:e},new n.CubisRestResponse(this.syncRequest())}setAmbientCondition(t){return this.body.method=u.RestMethodsWEIGHING.setAmbientCondition,this.body.params={ambientConditionId:t},new n.CubisRestResponse(this.syncRequest())}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.QAppAsyncCallTimeoutErrorName="QAppAsyncCallTimeoutError";class i extends Error{constructor(t,a,s){super(),this.originalState=t,this.metadata=a,this.name=e.QAppAsyncCallTimeoutErrorName,s&&(this.stack=s),Object.setPrototypeOf(this,i.prototype),this.message="Async call timeout."+(a?` metadata: ${a}`:"")}}e.QAppAsyncCallTimeoutError=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(19),s=a(42),n=a(27),r=a(0),o=a(8),_=a(21),E=a(12),l=a(11),u=a(66),c=a(13),T=a(32),d=a(45),p=a(2),A=a(3);e.IDENTIFIER_ASPECT="IDENTIFIER_ASPECT",
e.STATE_ASPECT_IDENTIFIER_PREFIX="STATE_ASPECT_IDENTIFIER",e.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT=e.STATE_ASPECT_IDENTIFIER_PREFIX+"_ENTER_LOT_INPUT",e.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT=e.STATE_ASPECT_IDENTIFIER_PREFIX+"_ENTER_SID_INPUT";const I=e.STATE_ASPECT_IDENTIFIER_PREFIX+"_LOT_INPUT_DO",h=e.STATE_ASPECT_IDENTIFIER_PREFIX+"_SID_INPUT_DO";e.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE=u.LID_SID_USER_INPUT_STRING_VALUES,e.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE=15;const m=0,N="-1";e.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_OK="BTN_ID_ASP_ID_A_INC_WARN_OK",e.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_YES="BTN_ID_ASP_ID_A_INC_WARN_YES",e.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO="BTN_ID_ASP_ID_A_INC_WARN_NO";const S="PARAM_ID_RT_LOT",g="PARAM_ID_RT_SID",R="PARAM_ID_RT_IDENTIFIER_INP";class P extends i.AbstractQAppAspect{constructor(){super(),this.states={STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT:{_onEnter:function(t){let a=t.aspects[e.IDENTIFIER_ASPECT];a.inputIdx=0,
a.evalLotInput()?(console.log("IdentifierAspect - at least one (more) LID configured"),t.addToEventQueue(new o.ImmediateEvent({from:e.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT,to:I}))):(console.log("IdentifierAspect - no (further) LIDs configured"),t.addToEventQueue(new o.ImmediateEvent({from:e.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT,to:a.cfg.returnState})))},_onExit:function(t){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,a){a.payload.from===e.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT&&this.transition(t,a.payload.to)}},STATE_ASPECT_IDENTIFIER_LOT_INPUT_DO:{_onEnter:function(t){},_onExit:function(t){t.screens[s.KEYBOARD_SCREEN_ID].hide()},_transTo:{},_transFrom:{},EV_HMI_PARAM_CHANGED:function(t,a){console.log("IdentifierAspect - param change in STATE_ASPECT_IDENTIFIER_LOT_INPUT_DO");let i=t.aspects[e.IDENTIFIER_ASPECT];if(a.payload.parameter.id===R+i.inputIdx){let e=d.checkGeneralParamRules(a.payload.parameter),n=a.payload.parameter.value.string
;void 0===e?(i.setLotID(i.inputIdx,n),i.inputIdx++,i.evalLotInput()||(console.log("IdentifierAspect - no (further) LIDs configured"),this.transition(t,i.cfg.returnState))):(t.showMessageBox(e.message),i.sPIn_4_identifier.value.string=n,i.client.screens[s.KEYBOARD_SCREEN_ID].setParam(i.sPIn_4_identifier))}},EV_HMI_BTN_CLICKED:function(t,e){e.payload.buttonId===T.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID&&t.hideMsgBox()}},STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT:{_onEnter:function(t){let a=t.aspects[e.IDENTIFIER_ASPECT];a.inputIdx=0,a.evalSidInput()?(console.log("IdentifierAspect - at least one (more) SID configured"),t.addToEventQueue(new o.ImmediateEvent({from:e.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT,to:h}))):(console.log("IdentifierAspect - no (further) SIDs configured"),t.addToEventQueue(new o.ImmediateEvent({from:e.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT,to:a.cfg.returnState})))},_onExit:function(t){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,a){
a.payload.from===e.STATE_ASPECT_IDENTIFIER_ENTER_SID_INPUT&&this.transition(t,a.payload.to)}},STATE_ASPECT_IDENTIFIER_SID_INPUT_DO:{_onEnter:function(t){},_onExit:function(t){t.screens[s.KEYBOARD_SCREEN_ID].hide();let a=t.aspects[e.IDENTIFIER_ASPECT];a.cfg.autoRememberSIDs&&(a.sIDsPrevSample=a.sIDs)},_transTo:{},_transFrom:{},EV_HMI_PARAM_CHANGED:function(t,a){console.log("IdentifierAspect - param change in STATE_ASPECT_IDENTIFIER_SID_INPUT_DO");let i=t.aspects[e.IDENTIFIER_ASPECT];if(a.payload.parameter.id===R+i.inputIdx){let e=d.checkGeneralParamRules(a.payload.parameter),n=a.payload.parameter.value.string;if(void 0===e){i.setSID(i.inputIdx,n);let e=P.getSIDState(i.inputIdx,i.getTaskHandler());if(e===_.EnumSampleIdentifierOptions.ON_AUTO_INC||e===_.EnumSampleIdentifierOptions.ON_AUTO_DEC){let r=e===_.EnumSampleIdentifierOptions.ON_AUTO_INC,o=D(r,a.payload.parameter.value.string);o.success?this.transition(t,i.sIdInputDone()):(i.sPIn_4_identifier.value.string=n,
i.client.screens[s.KEYBOARD_SCREEN_ID].setParam(i.sPIn_4_identifier),i.client.showMessageBox(C(r,o.result,!0)))}else this.transition(t,i.sIdInputDone())}else t.showMessageBox(e.message),i.sPIn_4_identifier.value.string=n,i.client.screens[s.KEYBOARD_SCREEN_ID].setParam(i.sPIn_4_identifier)}},EV_HMI_BTN_CLICKED:function(t,a){let i=t.aspects[e.IDENTIFIER_ASPECT];a.payload.buttonId===e.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_OK?(t.screens[s.KEYBOARD_SCREEN_ID].show(),t.hideMsgBox()):a.payload.buttonId===T.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID?t.hideMsgBox():a.payload.buttonId===e.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_YES?(t.hideMsgBox(),this.transition(t,i.sIdInputDone())):a.payload.buttonId===e.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO&&t.hideMsgBox()}}},this.sP_4_lotA=[],this.sP_4_sidA=[],this.lotIDs=[],this.sIDs=[],this.sIDsPrevSample=void 0,this.inputIdx=0,this.cfgGroupCnt=void 0,this.cfgGroupLID=void 0,this.cfgGroupSID=void 0,
this.sPIn_4_identifier=A.createEmptyStringParameter()}getId(){return e.IDENTIFIER_ASPECT}getAspectStates(){return this.states}static getConfiguredLIDCount(t){let e=t.getParameter(_.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);return void 0!==e?_.getConfiguredIds(e):0}static getConfiguredSIDCount(t){let e=t.getParameter(_.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return void 0!==e?_.getConfiguredIds(e):0}static createLIDParams(t,a,i){let s=[],o=P.getConfiguredLIDCount(i);console.log("IdentifierAspect::createLIDParams: create params for "+o+" LIDs");for(let E=1;E<=o;E++){let o=i.getParameter(_.createLIDParamId(E,_.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_TITLE)),l=i.getParameter(_.createLIDParamId(E,_.TASK_DYNAMIC_ID_LID_X_PARAM_ID_SUFFIX_HEADER)),u=A.createEmptyStringParameter();u.id=S+E+(t?"_"+t:""),u.appearance=r.EnumAppearance.HIDDEN,u.title={id:o.value.string,args:[]},u.header={id:l.value.string,args:[]},u.info={minimum:{length:0},maximum:{length:e.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}},
s.push(new n.default(a,u))}return s}static createSIDParams(t,a,i){let s=[],o=P.getConfiguredSIDCount(i);console.log("IdentifierAspect::createSIDParams: create params for "+o+" SIDs");for(let E=1;E<=o;E++){let o=i.getParameter(_.createSIDParamId(E,_.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_TITLE)),l=i.getParameter(_.createSIDParamId(E,_.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_HEADER)),u=A.createEmptyStringParameter();u.id=g+E+(t?"_"+t:""),u.appearance=r.EnumAppearance.HIDDEN,u.title={id:o.value.string,args:[]},u.header={id:l.value.string,args:[]},u.info={minimum:{length:0},maximum:{length:e.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}},s.push(new n.default(a,u))}return s}init(t){if(this.client=t,this.client){if(console.log("IdentifierAspect::init"),!this.client.screens[s.KEYBOARD_SCREEN_ID]){let t=new s.KeyboardScreen(this.client.mqttHandler);this.client.registerScreen(t)}this.sPIn_4_identifier=A.createEmptyStringParameter(),this.sPIn_4_identifier.id=R,
this.sPIn_4_identifier.appearance=r.EnumAppearance.ENABLED,this.sPIn_4_identifier.title={id:"",args:[]},this.sPIn_4_identifier.header={id:"",args:[]},this.sPIn_4_identifier.info={isNoValueAllowed:!0,minimum:{length:0},maximum:{autoCut:!1,length:e.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}}}else console.log("IdentifierAspect::init - aspect not correctly initialized (no client set) - skip init")}configure(t){super.configure(t),void 0===this.cfg.showPreviouslySetLIDs&&(this.cfg.showPreviouslySetLIDs=!1);let e=this.getTaskHandler().getGroup(_.TASK_DYNAMIC_ID_CNT_GROUP_ID),a=this.getTaskHandler().getGroup(_.TASK_DYNAMIC_ID_LID_GROUP_ID),i=this.getTaskHandler().getGroup(_.TASK_DYNAMIC_ID_SID_GROUP_ID);console.log("IdentifierAspect::configure"),
c.isEqual(this.cfgGroupCnt,e)&&c.isEqual(this.cfgGroupLID,a)&&c.isEqual(this.cfgGroupSID,i)?console.log("IdentifierAspect::configure: no content update of taskHandler - keep params for IDs"):(console.log("IdentifierAspect::configure: update of taskHandler - create params for IDs"),this.cfgGroupCnt=p.cloneJSON(e),this.cfgGroupLID=p.cloneJSON(a),this.cfgGroupSID=p.cloneJSON(i),e&&a&&i&&(console.log("IdentifierAspect::configure - create LID params"),this.sP_4_lotA=P.createLIDParams("",this.client.mqttHandler,this.getTaskHandler()),this.sP_4_lotA.forEach(t=>{t.publish()}),console.log("IdentifierAspect::configure - create SID params"),this.sP_4_sidA=P.createSIDParams("",this.client.mqttHandler,this.getTaskHandler()),this.sP_4_sidA.forEach(t=>{t.publish()})))}getTaskHandler(){return this.cfg.taskHandler}getLotVisualParams(){return this.sP_4_lotA}getSIDVisualParams(){return this.sP_4_sidA}prepLotInput(t){this.client.screens[s.KEYBOARD_SCREEN_ID].hide(),this.sPIn_4_identifier.id=R+t,
this.sPIn_4_identifier.title=this.sP_4_lotA[this.inputIdx].getValue().title,this.sPIn_4_identifier.header=this.sP_4_lotA[this.inputIdx].getValue().header,this.sPIn_4_identifier.info.maximum.length=e.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE,this.cfg.showPreviouslySetLIDs?this.sPIn_4_identifier.value.string=void 0!==this.lotIDs[t]?this.lotIDs[t]:"":this.sPIn_4_identifier.value.string="",console.log("IdentifierAspect::prepLotInput - prepare input of: "+JSON.stringify(this.sPIn_4_identifier.header)),this.client.screens[s.KEYBOARD_SCREEN_ID].setParam(this.sPIn_4_identifier),this.client.screens[s.KEYBOARD_SCREEN_ID].show()}prepSidInput(t,a,i){if(this.client.screens[s.KEYBOARD_SCREEN_ID].hide(),this.sPIn_4_identifier.id=R+t,this.sPIn_4_identifier.title=this.sP_4_sidA[t].getValue().title,this.sPIn_4_identifier.header=this.sP_4_sidA[t].getValue().header,this.sPIn_4_identifier.info.maximum.length=e.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE,
!a.length||0===a.length)switch(P.getSIDState(t,this.getTaskHandler())){case _.EnumSampleIdentifierOptions.ON_AUTO_INC:case _.EnumSampleIdentifierOptions.ON_AUTO_DEC:this.sPIn_4_identifier.info.maximum.length=e.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE}this.sPIn_4_identifier.value.string=a,console.log("IdentifierAspect::prepSidInput - prepare input of: "+JSON.stringify(this.sPIn_4_identifier.header)),this.client.screens[s.KEYBOARD_SCREEN_ID].setParam(this.sPIn_4_identifier),i&&this.client.screens[s.KEYBOARD_SCREEN_ID].show()}static updateAndPublishIDParamStatic(t,e){e&&e.length>0?(t.getValue().value.string=e,t.getValue().appearance=r.EnumAppearance.ENABLED):(t.getValue().value.string="",t.getValue().appearance=r.EnumAppearance.HIDDEN),t.publish()}static setLotIDsStatic(t,e){for(let a=0;a<e.length;a++)this.updateAndPublishIDParamStatic(e[a],t[a])}setLotIDs(t){this.lotIDs=t,P.setLotIDsStatic(this.lotIDs,this.sP_4_lotA)}setLotID(t,e){this.lotIDs[t]=e,
P.updateAndPublishIDParamStatic(this.sP_4_lotA[t],this.lotIDs[t])}static setSIDsStatic(t,e){for(let a=0;a<e.length;a++)P.updateAndPublishIDParamStatic(e[a],t[a])}setSIDs(t,e){this.sIDs=t,this.cfg.autoRememberSIDs||(this.sIDsPrevSample=e),P.setSIDsStatic(this.sIDs,this.sP_4_sidA)}isPreviouSampleIdsPresent(){return void 0!==this.sIDsPrevSample&&void 0!==this.sIDsPrevSample[this.inputIdx]}setSID(t,e){this.sIDs[t]=e,P.updateAndPublishIDParamStatic(this.sP_4_sidA[t],this.sIDs[t])}static getLotState(t,e){let a=_.EnumLotIdentifierOptions.OFF,i=e.getParameter(_.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);return t>=0&&t<_.getConfiguredIds(i)&&(a=_.EnumLotIdentifierOptions.ON),console.log("IdentifierAspect::getLotState for idx:"+t+" -> "+a),a}static getSIDState(t,e){let a=t+1,i=_.EnumSampleIdentifierOptions.OFF,s=e.getParameter(_.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return t>=0&&t<_.getConfiguredIds(s)&&(i=e.getParameter(_.createSIDParamId(a,_.TASK_DYNAMIC_ID_SID_X_PARAM_ID_SUFFIX_MODE)).value.selection.id),
i}static getIdxFirstEnabledSID(t){let e=t.getParameter(_.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);return _.getConfiguredIds(e)>0?0:NaN}evalLotInput(){let t=this.getTaskHandler().getParameter(_.TASK_DYNAMIC_ID_LID_CNT_PARAM_ID);for(let e=this.inputIdx;e<_.getConfiguredIds(t);e++)return this.inputIdx=e,this.prepLotInput(this.inputIdx),!0;return!1}evalSidInput(){console.log("IdentifierAspect - evalSidInput");let t=this.getTaskHandler().getParameter(_.TASK_DYNAMIC_ID_SID_CNT_PARAM_ID);for(let e=this.inputIdx;e<_.getConfiguredIds(t);e++){console.log("IdentifierAspect - evalSidInput: loop:"+e);let t=P.getSIDState(e,this.getTaskHandler());if(t===_.EnumSampleIdentifierOptions.ON)return console.log("IdentifierAspect - request input for SID idx:"+e),this.inputIdx=e,this.prepSidInput(this.inputIdx,this.sIDsPrevSample&&this.sIDsPrevSample[this.inputIdx]?this.sIDsPrevSample[this.inputIdx]:"",!0),!0;if(t===_.EnumSampleIdentifierOptions.ON_AUTO_INC||t===_.EnumSampleIdentifierOptions.ON_AUTO_DEC){
this.inputIdx=e;let a=t===_.EnumSampleIdentifierOptions.ON_AUTO_INC;if(this.sIDsPrevSample&&void 0!==this.sIDsPrevSample[this.inputIdx]){console.log("IdentifierAspect - AutoInc/Dec for SID idx:"+this.inputIdx);let t=D(a,this.sIDsPrevSample[this.inputIdx]);return t.success?this.prepSidInput(this.inputIdx,t.result,!0):(console.log("IdentifierAspect - AutoInc/Dec failed show warning for SID idx:"+this.inputIdx),this.prepSidInput(this.inputIdx,this.sIDsPrevSample[this.inputIdx],!1),this.client.showMessageBox(C(a,t.result))),!0}return console.log("IdentifierAspect - AutoInc/Dec, but first sample -> request input for SID idx:"+this.inputIdx),this.prepSidInput(this.inputIdx,"",!0),!0}}return!1}resetSIDsPrevSample(){this.sIDsPrevSample=void 0}sIdInputDone(){let t="";return console.log("IdentifierAspect - sIdInputDone"),this.inputIdx++,this.evalSidInput()?console.log("IdentifierAspect - at least one more SIDs configured"):(console.log("IdentifierAspect - no (further) SIDs configured"),
t=this.cfg.returnState),t}}var O;function D(t,a,i=e.IDENTIFIER_MAX_LENGTH_LID_SID_VALUE){console.log("IdentifierAspect - AutoInc/Dec, not first sample > check for number");let s=a.match("^\\d*$");if(s&&void 0!==s[0]){let a;if(console.log("IdentifierAspect - AutoInc, not first sample > inc number"),""===s[0]){if(a=0,!t)return{success:!1,result:{id:O.NONUMBERFOUND,args:[]}}}else{if(s[0].length>e.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE)return{success:!1,result:{id:O.NUMBERTOOLARGE,args:[]}};a=parseInt(s[0],10)}if(t)a++;else{if(!(a>m))return{success:!1,result:{id:O.LOWERBOUNDARY,args:[]}};a--}let n=a.toFixed(0);return n.length>i?{success:!1,result:{id:O.SIDTOOLARGE,args:[i.toString()]}}:{success:!0,result:n}}{let s=a.match("(.*[\\-_.#\\s])(\\d*)$");if(s&&void 0!==s[2]){let a;if(console.log("IdentifierAspect - AutoInc/Dec, not first sample > inc/dec suffix"),""===s[2]){if(a=0,!t)return{success:!1,result:{id:O.NONUMBERFOUND,args:[]}}}else{
if(s[2].length>e.IDENTIFIER_MAX_LENGTH_LID_SID_NUMBER_VALUE)return{success:!1,result:{id:O.NUMBERTOOLARGE,args:[]}};a=parseInt(s[2],10)}if(t)a++;else{if(!(a>m))return{success:!1,result:{id:O.LOWERBOUNDARY,args:[]}};a--}let n=s[1]+a.toFixed();return n.length>i?{success:!1,result:{id:O.SIDTOOLARGE,args:[i.toString()]}}:{success:!0,result:n}}if(console.log("IdentifierAspect - AutoInc, not first sample > add suffix"),t){let t=a+N;return t.length>i?{success:!1,result:{id:O.SIDTOOLARGE,args:[i.toString()]}}:{success:!0,result:t}}return{success:!1,result:{id:O.NOSEPARATORFOUND,args:[]}}}}function C(t,a,i=!1){let s=[],n=[];return t?i?s.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_WARNING_FOR_NEXT_SID",args:[]}):s.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_WARNING",args:[]}):i?s.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_FOR_NEXT_SID",args:[]}):s.push({id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING",args:[]}),s.push(a),i&&s.push({
id:"_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_CONTINUE",args:[]}),n=i?[{id:e.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_YES,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:r.EnumAppearance.ENABLED_SECONDARY},{id:e.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:r.EnumAppearance.ENABLED_SECONDARY}]:[{id:e.BTN_ID_ASPECT_IDENTIFIER_AUTO_INC_DEC_WARNING_OK,label:{id:E.EnumFontLabels.OK,args:[]},appearance:r.EnumAppearance.ENABLED_SECONDARY}],{type:l.EnumMessageboxType.WARNING,title:{id:"_QAPP_LIB_MBOX_TITLE_IDENTIFIER_AUTO_INC_DEC_WARNING",args:[]},textList:s,buttons:n}}e.IdentifierAspect=P,function(t){t.NUMBERTOOLARGE="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_NO_TOO_LARGE",t.LOWERBOUNDARY="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_LOWER_BOUNDARY",t.SIDTOOLARGE="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_INC_DEC_WARNING_SID_TOO_LARGE",
t.NOSEPARATORFOUND="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_NO_SEPARATOR_FOUND",t.NONUMBERFOUND="_QAPP_LIB_MBOX_TEXT_IDENTIFIER_AUTO_DEC_WARNING_NO_NUMBER_FOUND"}(O=e.IncreaseDecreaseFailEnum||(e.IncreaseDecreaseFailEnum={})),e.increaseDecreaseId=D,e.getWarningNoIdChange=C},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(23);class s{static roundExactToDecimals(t,e){return this.nTimesTen(this.roundExact(this.nTimesTen(t,e)),-1*e)}static roundExact(t){return t=t>=0?Math.floor(t+.5+Number.EPSILON):Math.ceil(t-.5-Number.EPSILON)}static nTimesTen(t,e){return i.bignumber(t).times(s.decPowers(e)).toNumber()}static countDecimals(t){return i.bignumber(t).decimalPlaces()}static decPowers(t){switch(t){case-15:return 1e-15;case-14:return 1e-14;case-13:return 1e-13;case-12:return 1e-12;case-11:return 1e-11;case-10:return 1e-10;case-9:return 1e-9;case-8:return 1e-8;case-7:return 1e-7;case-6:return 1e-6;case-5:return 1e-5;case-4:return 1e-4;case-3:
return.001;case-2:return.01;case-1:return.1;case 0:return 1;case 1:return 10;case 2:return 100;case 3:return 1e3;case 4:return 1e4;case 5:return 1e5;case 6:return 1e6;case 7:return 1e7;case 8:return 1e8;case 9:return 1e9;case 10:return 1e10;case 11:return 1e11;case 12:return 1e12;case 13:return 1e13;case 14:return 1e14;case 15:return 1e15;default:return Math.pow(10,t)}}}e.SartoMath=s},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});let i=a(75);e.STATE_UNINITIALIZED_INTERNAL="STATE_UNINITIALIZED_INTERNAL",e.createFsm=function(t){return new i.BehavioralFsm({namespace:"_qappStm_",states:{STATE_UNINITIALIZED_INTERNAL:{_onEnter:function(t){console.log("FSM: enter STATE_UNINITIALIZED_INTERNAL state")},_onExit:function(t){console.log("FSM: exit STATE_UNINITIALIZED_INTERNAL state")},_transTo:{},_transFom:{},_START_FSM_:function(t,e){this.transition(t,e)},"*":function(t){this.deferUntilTransition(t)}}},initialize:function(e){Object.assign(e.states,e.states,t)},
initialState:e.STATE_UNINITIALIZED_INTERNAL,myHandler:function(t,e,a){let i;e.some(function(e){return i=e.nextState,e.guardFn(t,a)})&&i&&this.transition(t,i)}})}},function(t,e){t.exports=require("url")},function(t,e){t.exports=require("http")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(6),s=a(4);e.LocalizerProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="localizer"}getLanguage(){let t;return this.body.method=s.RestMethodsLOCALIZER.getLanguage,this.body.params={rLanguageId:""},(t=new i.CubisRestResponse(this.syncRequest())).isSuccess()?t.rawReturns.rLanguageId:""}getText(t,e=[]){let a;return this.body.method=s.RestMethodsLOCALIZER.getText,this.body.params={id:t,rText:"",args:e},(a=new i.CubisRestResponse(this.syncRequest())).isSuccess()?a.rawReturns.rText:t}getTexts(t){let e;return this.body.method=s.RestMethodsLOCALIZER.getTexts,this.body.params={textObjects:t,rTexts:""},
(e=new i.CubisRestResponse(this.syncRequest())).isSuccess()?JSON.parse(e.rawReturns.rTexts):[]}}},function(t,e){t.exports=require("child_process")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(6),s=a(4);!function(t){t.EVENT_RESTART="restart"}(e.EnumTaskManagementEvent||(e.EnumTaskManagementEvent={}));class n extends i.CubisRestResponse{constructor(t){super(t)}getErrorList(){return JSON.parse(this.rawReturns.errorList)}getStoredTask(){return JSON.parse(this.rawReturns.task)}}e.TaskValCreaUpdResponse=n;e.TaskProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="task/management"}getTaskTemplate(){let t,e;return this.body.method=s.RestMethodsTASK_MANAGEMENT.getTaskTemplate,this.body.params={taskTemplate:{}},t=new i.CubisRestResponse(this.syncRequest()),e=JSON.parse(t.rawReturns.taskTemplate)}readTask(t,e=!0){let a,n;if(this.body.method=s.RestMethodsTASK_MANAGEMENT.readTask,this.body.params={document:{},dbId:t,
updateOptions:e},!(a=new i.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error reading task with id '"+t+"'");return n=JSON.parse(a.rawReturns.document)}getTaskName(t){try{let e=this.readTask(t).params.find(t=>"TASK/IDENTIFICATION"===t.id);if(void 0!==e){let t=e.parameters.find(t=>"TASK/IDENTIFICATION/NAME"===t.id);if(void 0!==t)return t.value.string}return}catch(t){return}}createTask(t){return this.body.method=s.RestMethodsTASK_MANAGEMENT.createTask,this.body.params={task:JSON.stringify(t),errorList:[]},new n(this.syncRequest())}updateTask(t){return this.body.method=s.RestMethodsTASK_MANAGEMENT.updateTask,this.body.params={task:JSON.stringify(t),errorList:[]},new n(this.syncRequest())}validateTask(t){return this.body.method=s.RestMethodsTASK_MANAGEMENT.validate,this.body.params={task:JSON.stringify(t),errorList:[]},new n(this.syncRequest())}saveWorkstate(t,e){let a;if(this.body.method=s.RestMethodsTASK_MANAGEMENT.saveWorkstate,this.body.params={id:e,workstate:t},
!(a=new i.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error saving workstate with id '"+e+"'");return a}deleteWorkstate(t){let e;if(this.body.method=s.RestMethodsTASK_MANAGEMENT.deleteWorkstate,this.body.params={id:t},!(e=new i.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error deleting workstate with id '"+t+"'");return e}getWorkstate(t){let e,a;if(this.body.method=s.RestMethodsTASK_MANAGEMENT.getWorkstate,this.body.params={id:t,workstate:{}},!(e=new i.CubisRestResponse(this.syncRequest())).isSuccess())throw new Error("Error reading task with id '"+t+"'");return a=JSON.parse(e.rawReturns.workstate).workstate}getTaskNamesByOrderNumber(t){let e;if(this.body.method=s.RestMethodsTASK_MANAGEMENT.getTaskNamesByOrderNumber,this.body.params={orderNumber:t,taskNames:[]},(e=new i.CubisRestResponse(this.syncRequest())).isSuccess())return JSON.parse(e.rawReturns.taskNames);throw new Error("Error getting used taskNames for '"+t+"'")}setTaskEvent(t,e){
let a;console.log(`TaskManagementProxy: send event: '${e}'`),this.body.method=s.RestMethodsTASK_MANAGEMENT.setTaskEvent,this.body.params={taskId:t,event:e};try{return(a=new i.CubisRestResponse(this.syncRequest())).isSuccess()}catch(t){return console.log("Something went wrong when calling sendTaskEvent"),console.log(t),!1}}}},function(t,e){t.exports=require("rxjs")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(3),s=a(12),n=a(0);function r(t){return"string"==typeof t.name&&"string"==typeof t.message}e.ERRORMSGBOX_OK_BTN_ID="BTN_OK_ERRORMSGBOX",e.isError=r,e.createMsgBoxData=function(t,a,o,_,E){let l=[];return r(o)?l.push({id:o.name+":"+o.message,args:[]}):i.isITextStructure(o)?l.push(o):l.push({id:o.error.name+":"+o.error.message,args:o.msgargs}),void 0!==_&&l.push(_),{type:t,title:a,textList:l,buttons:[{id:E||e.ERRORMSGBOX_OK_BTN_ID,label:{id:s.EnumFontLabels.OK,args:[]},appearance:n.EnumAppearance.ENABLED_SECONDARY}]}}},function(t,e,a){
"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.UNIT="UNIT",t.DO_ZERO="DO_ZERO",t.DO_TARE="DO_TARE",t.DO_TARE1="DO_TARE1",t.CLR_TARE1="CLR_TARE1",t.SET_TARE1="SET_TARE1",t.SHOW_TARE1="SHOW_TARE1",t.HIDE_TARE1="HIDE_TARE1",t.DISPLAY="DISPLAY"}(e.WEIGHING_BUTTON_ID||(e.WEIGHING_BUTTON_ID={})),function(t){t.AS_CONFIGURED="AS_CONFIGURED",t.WITHOUT_STABILITY="WITHOUT_STABILITY",t.AFTER_STABILITY="AFTER_STABILITY"}(e.WEIGHING_ZEROTARE_BEHAVIOR||(e.WEIGHING_ZEROTARE_BEHAVIOR={})),function(t){t.VERY_STABLE="VERY_STABLE",t.STABLE="STABLE",t.UNSTABLE="UNSTABLE",t.VERY_UNSTABLE="VERY_UNSTABLE"}(e.WEIGHING_AMBIENT_CONDITION||(e.WEIGHING_AMBIENT_CONDITION={})),function(t){t.ADMIN_ROLE_ID="adminRoleDbId",t.SERVICE_ROLE_ID="serviceRoleDbId",t.OPERATOR_ROLE_ID="operatorRoleDbId",t.GUEST_ROLE_ID="guestRoleDbId"}(e.ACCESS_CONTROL_ROLE_DB_IDS||(e.ACCESS_CONTROL_ROLE_DB_IDS={})),function(t){t.MANAGE_PROFILES="ACCESS_MANAGE_PROFILES",
t.MANAGE_DEVICE_SETTINGS="ACCESS_MANAGE_DEVICE_SETTINGS",t.MANAGE_ROLES="ACCESS_MANAGE_ROLES",t.MANAGE_ACCESS_MANAGEMENT="ACCESS_MANAGE_ACCESS_MANAGEMENT",t.MANAGE_LDAP_SETTINGS="ACCESS_MANAGE_LDAP_SETTINGS",t.MANAGE_TIMER_CONTROLLED_ACTIONS="ACCESS_MANAGE_TIMER_CONTROLLED_ACTIONS",t.MANAGE_CONNECTIONS="ACCESS_MANAGE_CONNECTIONS",t.REDIRECT_FAILED_TRANSFERS="ACCESS_REDIRECT_FAILED_TRANSFERS",t.DELETE_FAILED_TRANSFERS="ACCESS_DELETE_FAILED_TRANSFERS",t.MAINTENANCE_FIRMWARE_UPDATE="ACCESS_MAINTENANCE_FIRMWARE_UPDATE",t.MAINTENANCE_MANAGE_QAPPS="ACCESS_MAINTENANCE_MANAGE_QAPPS",t.MAINTENANCE_BACKUP_RESTORE="ACCESS_MAINTENANCE_BACKUP_RESTORE",t.MAINTENANCE_EXPORT_IMPORT="ACCESS_MAINTENANCE_EXPORT_IMPORT",t.MAINTENANCE_FACTORY_RESET="ACCESS_MAINTENANCE_FACTORY_RESET",t.UNLOCK_DEVICE="ACCESS_UNLOCK_DEVICE",t.REMOTE_VIEW="ACCESS_REMOTE_VIEW",t.REMOTE_CONTROL="ACCESS_REMOTE_CONTROL",t.MANAGE_JOBS="ACCESS_MANAGE_JOBS",t.ACCESS_AUDIT_TRAIL="ACCESS_AUDIT_TRAIL",t.ACCESS_ALIBI="ACCESS_ALIBI",
t.EXECUTE_TASKS="EXECUTE_TASKS",t.ACCESS_CALIBRATION_REPORTS="ACCESS_CALIBRATION_REPORTS",t.ACCESS_LAST_REPORTS="ACCESS_LAST_REPORTS",t.ACCESS_MASS_STORAGES="ACCESS_MASS_STORAGES",t.REMOVE_USERCAL_INVALIDATION="REMOVE_USERCAL_INVALIDATION",t.CREATE_UPDATE_DELETE_USER="CREATE_UPDATE_DELETE_USER",t.CREATE_UPDATE_DELETE_TASK="CREATE_UPDATE_DELETE_TASK",t.ACCESS_QAPP_CENTER="ACCESS_QAPP_CENTER",t.SETUP_MENU_ACCESS="SETUP_MENU_ACCESS"}(e.EnumUserRights||(e.EnumUserRights={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(21),n=a(2),r=a(38);class o{constructor(t){this.task=t||void 0}splitParamId(t){let e=t.split("/");return e.length>1&&(e[0]=`${e[0]}/${e[1]}`,e.splice(1,1)),e}setTask(t){this.task=t}getTaskGroupsAndParameters(){return this.task?this.task.params:[]}getTask(){return this.task}updateGroup(t){if(!this.task)return!1;return!!this.task.params.some((e,a)=>!!this.task&&(e.id===t.id&&(this.task.params[a]=t,
!0)))&&(console.log(`Group ${t.id} updated!`),!0)}updateParameter(t){let e=this.splitParamId(t.id)[0];return!!this.task&&(!!this.task.params.some((a,i)=>{if(a.id===e)return a.parameters.some((e,a)=>!(e.id!==t.id||!this.task)&&(this.task.params[i].parameters[a]=t,!0))})&&(console.log(`Parameter ${t.id} updated!`),!0))}getGroup(t){let e;if(this.task)return(e=this.task.params.find(e=>e.id===t))||void console.log(`Group ${t} not found!`)}getParameter(t){let e,a=this.splitParamId(t)[0];if(this.task)return this.task.params.find(i=>i.id===a&&(e=i.parameters.find(e=>e.id===t),!0)),e||void console.log(`Parameter ${t} not found!`)}addDynamicGroup(t){if(!this.task)return!1;if(!t.id.startsWith(r.DYNAMIC_PARAMID_PREQUEL))return console.log(`GroupId does not start with '${r.DYNAMIC_PARAMID_PREQUEL}'`),!1;if(t.id.includes("/",r.DYNAMIC_PARAMID_PREQUEL.length))return console.log('No additional "/" allowed in the name of a dynamic group!',t.id),!1
;if(this.task.params.some(e=>e.id===t.id))return console.log("The DynamicGroup already exists!",t.id),!1;t.parameters.forEach(e=>{e.id.startsWith(t.id)||(console.log(`parameterId starts with parameterName only. Extend parameterId with own groupId '${t.id}'.`),e.id=t.id+"/"+e.id)});let e=!1;for(let a=0;a<this.task.params.length;a++)if(this.task.params[a].id.startsWith(s.TASK_DYNAMIC_ID_GROUPS_PREFIX)||!this.task.params[a].id.startsWith(r.DYNAMIC_PARAMID_PREQUEL)){this.task.params.splice(a,0,t),e=!0;break}return e||this.task.params.push(t),!0}addDynamicParameter(t){let e="";if(this.getParameter(t.id))return this.updateParameter(t),!0;{e=this.splitParamId(t.id)[0];let a=this.getGroup(e);if(a)return a.parameters.push(t),!0}return!1}addDynamicParameterToFront(t){let e="";if(this.getParameter(t.id))return this.updateParameter(t),!0;{e=this.splitParamId(t.id)[0];let a=this.getGroup(e);if(a)return a.parameters.unshift(t),!0}return!1}addDynamicParameterInFrontOf(t,e){
let a=this.splitParamId(t.id)[0],i=this.splitParamId(e)[0];if(a===i){let i=this.getGroup(a);if(void 0!==i){let a=i.parameters.findIndex(t=>t.id===e);if(-1!==a)return i.parameters.splice(a,0,t),!0}}return console.log("addDynamicParameterInFrontOf - groups of new and existing parameter do not match: "+a+" vs. "+i),!1}static sortGroup(t){let e=t.parameters.map(function(t,e){return{idx:e,data:t}});e.sort((t,e)=>{if((void 0===t.data.fixed||!0===t.data.fixed)>(void 0===e.data.fixed||!0===e.data.fixed))return 1;if((void 0===t.data.fixed||!0===t.data.fixed)<(void 0===e.data.fixed||!0===e.data.fixed))return-1;if(!(void 0!==t.data.fixed&&!0!==t.data.fixed||void 0!==e.data.fixed&&!0!==e.data.fixed)){if((t.data.appearance===i.EnumAppearance.ENABLED||t.data.appearance===i.EnumAppearance.ENABLED_INVALID_CFG)<(e.data.appearance===i.EnumAppearance.ENABLED||e.data.appearance===i.EnumAppearance.ENABLED_INVALID_CFG))return 1
;if((t.data.appearance===i.EnumAppearance.ENABLED||t.data.appearance===i.EnumAppearance.ENABLED_INVALID_CFG)>(e.data.appearance===i.EnumAppearance.ENABLED||e.data.appearance===i.EnumAppearance.ENABLED_INVALID_CFG))return-1}return t.idx-e.idx}),t.parameters=e.map(function(t){return t.data})}getFilteredTask(){let t,e;return this.task&&((e=(t=n.cloneJSON(this.task)).params.filter(t=>t.id.startsWith(r.DYNAMIC_PARAMID_PREQUEL))).forEach(t=>{t.id.startsWith(s.TASK_DYNAMIC_ID_GROUPS_PREFIX)?t.parameters.forEach((t,e)=>{t.appearance=i.EnumAppearance.HIDDEN}):(t.parameters.forEach((t,e)=>{void 0!==t.fixed&&!0!==t.fixed||t.appearance===i.EnumAppearance.HIDDEN||(t.appearance=i.EnumAppearance.DISABLED)}),o.sortGroup(t),t.parameters.forEach((t,e)=>{void 0!==t.fixed&&delete t.fixed}))}),t.params=e),t}}e.TaskHandler=o},function(t,e){t.exports=require("path")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(6),s=a(3),n=a(20),r=a(1),o=a(4);var _;!function(t){
t.STABLE="STABLE",t.CANCELED="CANCELED"}(e.ReportingPrintableValueStateEnum||(e.ReportingPrintableValueStateEnum={})),function(t){t.wrongAlibiId="No alibi entry exists for this alibi id.",t.wrongTopic="Weighing topic not found for this alibi entry.",t.getAlibiListFailed="The rest call to get the Alibilist has failed!"}(_=e.AlibiEntryError||(e.AlibiEntryError={})),e.isAlibiEntryError=function(t){return t===_.wrongAlibiId||t===_.wrongTopic||t===_.getAlibiListFailed},e.REPORTING_CATEGORY_NONE="",e.REPORTING_CATEGORY_INIT="_QAPP_LIB_REPORTING_CATERGORY_INIT",e.REPORTING_CATEGORY_COMPONENTS="_QAPP_LIB_REPORTING_CATERGORY_COMPONENTS",e.REPORTING_CATEGORY_RESULT="_QAPP_LIB_REPORTING_CATERGORY_RESULT",e.REPORTING_CATEGORY_STATISTIC="_QAPP_LIB_REPORTING_CATERGORY_STATISTIC";class E extends i.CubisRestResponse{constructor(t){super(t)}getPrintItemIdentifier(){return this.rawReturns.printItemIdentifier}}e.ReportingPrintParamResponse=E;e.ReportingProxy=class extends i.BaseProxy{constructor(){
super(...arguments),this.restEndpoint="reporting",this._isPrintQueueEmpty=!0}printParameters(t,e,a,i=-1){this.body.method=o.RestMethodsREPORTING.printParameters,this.body.params={parameters:JSON.stringify(t),category:e,redactable:a,printItemIdentifier:i};let s=new E(this.syncRequest());return s.isSuccess()&&(this._isPrintQueueEmpty=!1),s}printPrintQueue(){return this.body.method=o.RestMethodsREPORTING.printPrintQueueWithElectronicSignature,this.body.params={},new i.CubisRestResponse(this.syncRequest())}printParametersDirect(t,e,a){return this.body.method=o.RestMethodsREPORTING.printParametersDirect,this.body.params={parameters:JSON.stringify(t),category:e,silent:a},new i.CubisRestResponse(this.syncRequest())}getPrintQueue(){return this.body.method=o.RestMethodsREPORTING.getPrintQueue,this.body.params={printQueue:{}},new i.CubisRestResponse(this.syncRequest())}isPrintQueueEmpty(){let t;this.body.method=o.RestMethodsREPORTING.isPrintQueueEmpty,this.body.params={rResult:!1};try{
return!!(t=new i.CubisRestResponse(this.syncRequest())).isSuccess()&&t.rawReturns.rResult}catch(t){return console.log("Something went wrong when calling isPrintQueueEmpty"),console.log(t),this._isPrintQueueEmpty}}clearPrintQueue(){this.body.method=o.RestMethodsREPORTING.clearPrintQueue,this.body.params={};let t=new i.CubisRestResponse(this.syncRequest());return t.isSuccess()&&(this._isPrintQueueEmpty=!0),console.log("clearPrintQueue() result: "+t.isSuccess()),t}requestPrintableValue(t){return this.body.method=o.RestMethodsREPORTING.requestPrintableValueComment,this.body.params={comment:t},new i.CubisRestResponse(this.syncRequest())}setRedactionStatus(t,e,a){return this.body.method=o.RestMethodsREPORTING.setRedactionStatus,this.body.params={printItemIdentifier:t,redacted:e,reason:a},new i.CubisRestResponse(this.syncRequest())}getAlibiRecord(t){return this.body.method=o.RestMethodsREPORTING.getAlibiRecord,this.body.params={identifier:t,record:""},
new i.CubisRestResponse(this.syncRequest())}getAlibiRecordList(t){return this.body.method=o.RestMethodsREPORTING.getAlibiRecordList,this.body.params={identifiers:t,records:[]},new i.CubisRestResponse(this.syncRequest())}getDateFromAlibi(t){let e;if(t instanceof i.CubisRestResponse){if(!t.isSuccess())return _.getAlibiListFailed;e=JSON.parse(t.rawReturns.record)}else{if("number"==typeof t){let e=this.getAlibiRecord(t);return e.isSuccess()?JSON.parse(e.rawReturns.record).timestamp:_.wrongAlibiId}e=t}return e.timestamp}getWeightFromAlibi(t,e){let a;if(t instanceof i.CubisRestResponse){if(!t.isSuccess())return _.getAlibiListFailed;a=JSON.parse(t.rawReturns.record)}else if("number"==typeof t){let e=this.getAlibiRecord(t);if(!e.isSuccess())return _.wrongAlibiId;a=JSON.parse(e.rawReturns.record)}else a=t;return this.parseMeasureParameterFromAlibiResponse(a,e)}getWeightFromAlibiList(t,e){let a=[],s=[];if(t instanceof i.CubisRestResponse){if(!t.isSuccess())return _.getAlibiListFailed
;s=JSON.parse(t.rawReturns.records)}else if(0!==(n=t).length&&"number"!=typeof n[0])s=t;else{let e=this.getAlibiRecordList(t);if(!e.isSuccess())return _.getAlibiListFailed;s=JSON.parse(e.rawReturns.records)}var n;return s.forEach(t=>{a=[...a,this.parseMeasureParameterFromAlibiResponse(t,e)]}),a}parseMeasureParameterFromAlibiResponse(t,e){let a=s.createEmptyParameterGroupOfGroups();if(null===t)return _.wrongAlibiId;{a.parameters[0].parameters=JSON.parse(t.weighingblock);let i=n.WeightBlockHelper.getMeasureParameter(a,e||r.MqttTopics.WEIGHING_VALUE_NET);return void 0===i?_.wrongTopic:i}}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(86),n=a(1),r=1;e.CheckBarGraph=class{constructor(t){this.barGraphStatusObject={appearance:i.EnumAppearance.HIDDEN,areas:s.EnumAreaCount.FOUR_AREAS},this.barGraphValueObject={area:1,perc:0},this.mqttHandler=t}publishValue(){
this.mqttHandler.publish(n.MqttTopics.HMI_CHECKBARGRAPH_VALUE,JSON.stringify(this.barGraphValueObject))}publishStatus(){this.mqttHandler.publish(n.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify(this.barGraphStatusObject))}setAppearance(t,e=!0){this.barGraphStatusObject.appearance!==t&&(t!==i.EnumAppearance.ENABLED&&t!==i.EnumAppearance.HIDDEN||(this.barGraphStatusObject.appearance=t,e&&(this.publishStatus(),this.publishValue())))}getAppearance(){return this.barGraphStatusObject.appearance}setAreas(t,e=!0){this.barGraphStatusObject.areas!==t&&(t!==s.EnumAreaCount.FOUR_AREAS&&t!==s.EnumAreaCount.SIX_AREAS||(this.barGraphStatusObject.areas=t,e&&this.publishStatus()))}getAreas(){return this.barGraphStatusObject.areas}setAreaPerc(t,e=!0){this.barGraphValueObject.area===t.area&&this.barGraphValueObject.perc===t.perc||t.area>=r&&t.area<=(this.barGraphStatusObject.areas===s.EnumAreaCount.FOUR_AREAS?4:6)&&(this.barGraphValueObject=t,e&&this.publishValue())}calc4AreaPerc(t,e,a,i,s,n=!0){
let r=1,o=0;return t>0&&(0<t&&t<e?(r=1,o=t/e*100):e<=t&&t<=s?(r=2,o=(t-e)/(s-e)*100):s<t&&t<=a?(r=3,o=(t-s)/(a-s)*100):a<t&&t<=i&&(r=4,o=(t-a)/(i-a)*100)),n&&this.setAreaPerc({area:r,perc:o}),{area:r,perc:o}}calc6AreaPerc(t,e,a,i,s,n,r,o=!0){let _=1,E=0;return t>0&&(0<t&&t<e?(_=1,E=t/e*100):e<=t&&t<a?(_=2,E=(t-e)/(a-e)*100):a<=t&&t<=r?(_=3,E=(t-a)/(r-a)*100):r<t&&t<=i?(_=4,E=(t-r)/(i-r)*100):i<t&&t<=s?(_=5,E=(t-i)/(s-i)*100):s<t&&t<=n&&(_=6,E=(t-s)/(n-s)*100)),this.setAreaPerc({area:_,perc:E},o),{area:_,perc:E}}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.PERSISTENCY_SCOPE_QAPP_INDEPENDENT="PERSISTENCY_SCOPE_QAPP_INDEPENDENT",t.PERSISTENCY_SCOPE_QAPP_SPECIFIC="PERSISTENCY_SCOPE_QAPP_SPECIFIC",t.PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION="PERSISTENCY_SCOPE_QAPP_SPECIFIC_VERSION",t.PERSISTENCY_SCOPE_TASk_SPECIFIC="PERSISTENCY_SCOPE_TASk_SPECIFIC"}(e.EnumPersistencyScope||(e.EnumPersistencyScope={}))},function(t,e){
t.exports=require("dateformat")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(70),n=a(32),r=a(8),o=a(19),_=a(71),E=a(27),l=a(45),u=a(7),c=a(35);e.CFG_PARAMS_ASPECT="CFG_PARAMS_ASPECT",e.STATE_ASPECT_CFG_PARAM_EDIT_ENTER="STATE_ASPECT_CFG_PARAM_EDIT_ENTER",e.STATE_ASPECT_CFG_PARAM_EDIT_REENTER="STATE_ASPECT_CFG_PARAM_EDIT_REENTER";const T="STATE_ASPECT_CFG_PARAM_EDIT",d="STATE_ASPECT_CFG_PARAM_EDIT_USER_ACTION",p="STATE_ASPECT_CFG_PARAM_INSPECT",A="TASK_HANDLER_NO_PARAMETERS";e.ConfigParamsAspect=class extends o.AbstractQAppAspect{constructor(){super(...arguments),this.states={STATE_ASPECT_CFG_PARAM_EDIT_ENTER:{_onEnter:function(t){t.aspects[e.CFG_PARAMS_ASPECT].parametersEmpty()?t.addToEventQueue(new r.ImmediateEvent(A)):t.addToEventQueue(new r.ImmediateEvent(T))},_onExit:function(t){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,a){a.payload===T&&this.transition(t,T),
a.payload===A&&this.transition(t,t.aspects[e.CFG_PARAMS_ASPECT].cfg.returnState)},"*":function(t){this.deferUntilTransition(t)}},STATE_ASPECT_CFG_PARAM_EDIT_REENTER:{_onEnter:function(t){t.aspects[e.CFG_PARAMS_ASPECT].parametersEmpty()?t.addToEventQueue(new r.ImmediateEvent(A)):t.addToEventQueue(new r.ImmediateEvent(T))},_onExit:function(t){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,a){a.payload===T&&this.transition(t,T),a.payload===A&&this.transition(t,t.aspects[e.CFG_PARAMS_ASPECT].cfg.returnState)},"*":function(t){this.deferUntilTransition(t)}},STATE_ASPECT_CFG_PARAM_EDIT:{_onEnter:function(t){let a=t.screens[s.PARAM_LIST_SCREENID].getButton(s.FINISH_BUTTON_ID);if(void 0!==a){let s=t.aspects[e.CFG_PARAMS_ASPECT].cfg.isValidFn();a.setAppearance(s?i.EnumAppearance.ENABLED_PRIMARY:i.EnumAppearance.DISABLED)}},_onExit:function(t){},_transTo:{},_transFrom:{STATE_ASPECT_CFG_PARAM_EDIT_ENTER:function(t,a){let n=t.screens[s.PARAM_LIST_SCREENID]
;n.readFromTaskhandler(t.aspects[e.CFG_PARAMS_ASPECT].cfg.taskHandler),n.setShowLastVisibleCategory(!1);let r=n.getButton(s.FINISH_BUTTON_ID);if(void 0!==r){let a=t.aspects[e.CFG_PARAMS_ASPECT].cfg.isValidFn();r.setAppearance(a?i.EnumAppearance.ENABLED_PRIMARY:i.EnumAppearance.DISABLED)}n.show()},STATE_ASPECT_CFG_PARAM_EDIT_REENTER:function(t,a){let n=t.screens[s.PARAM_LIST_SCREENID];n.readFromTaskhandler(t.aspects[e.CFG_PARAMS_ASPECT].cfg.taskHandler),n.setShowLastVisibleCategory(!0);let r=n.getButton(s.FINISH_BUTTON_ID);if(void 0!==r){let a=t.aspects[e.CFG_PARAMS_ASPECT].cfg.isValidFn();r.setAppearance(a?i.EnumAppearance.ENABLED_PRIMARY:i.EnumAppearance.DISABLED)}n.show()}},EV_HMI_BTN_CLICKED:function(t,a){if(a.payload.buttonId===s.FINISH_BUTTON_ID&&t.aspects[e.CFG_PARAMS_ASPECT].cfg.isValidFn()&&this.transition(t,t.aspects[e.CFG_PARAMS_ASPECT].cfg.returnState),a.payload.buttonId===c.CANCEL_BUTTON_ID){const a=t.aspects[e.CFG_PARAMS_ASPECT].cfg.cancelState
;u.isString(a)?this.transition(t,a):t.suspend()}},EV_HMI_PARAM_CHANGED:function(t,a){let i=t.aspects[e.CFG_PARAMS_ASPECT].updateTaskParameterGeneric(a.payload.parameter),s=[{guardFn:function(t,e){return void 0===i},nextState:""},{guardFn:function(t,e){return void 0!==i},nextState:d}];this.myHandler(t,s,a)},EV_HMI_PARAM_DETAIL:function(t,a){t.aspects[e.CFG_PARAMS_ASPECT].inspectTaskParameter(a.payload.parameter),this.transition(t,p)}},STATE_ASPECT_CFG_PARAM_INSPECT:{_onEnter:function(t){},_onExit:function(t){},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(t,e){e.payload.buttonId===c.CANCEL_BUTTON_ID&&this.transition(t,T)}},STATE_ASPECT_CFG_PARAM_EDIT_USER_ACTION:{_onEnter:function(t){},_onExit:function(t){},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(t,a){if(a.payload.buttonId===c.CANCEL_BUTTON_ID)t.suspend();else{let i=t.aspects[e.CFG_PARAMS_ASPECT].handleParamUpdateUserActionGeneric(a);"boolean"==typeof i&&i&&this.transition(t,T)}}}},
this.currentParamUpdateUserAction=void 0,this.isLastUserActionGenericError=!1}getId(){return e.CFG_PARAMS_ASPECT}getAspectStates(){return this.states}init(t){if(this.client=t,this.client){console.log("ConfigParamAspect::init");let t=new s.ParameterListScreen(this.client.mqttHandler);this.client.registerScreen(t)}else console.log("ConfigParamAspect::init - aspect not correctly initialized (no client set) - skip init")}publishParameter(t){void 0!==this.client&&this.client.screens[s.PARAM_LIST_SCREENID]&&this.client.screens[s.PARAM_LIST_SCREENID].updateParameter(t)}setCurrentParamUpdateUserAction(t){t?this.updateMessageBoxFromActionMessageAndShow(t.message):this.currentParamUpdateUserAction&&this.client.hideMsgBox(),this.currentParamUpdateUserAction=t}getCurrentParamUpdateUserAction(){return this.currentParamUpdateUserAction}updateTaskParameterGeneric(t){console.log("ConfigParamAspect: updateTaskParameterGeneric");let e=void 0;!0!==t.suppressLibRuleChecks&&(e=l.checkGeneralParamRules(t)),
void 0!==e?this.isLastUserActionGenericError=!0:(this.isLastUserActionGenericError=!1,e=this.cfg.updateTaskParameterFn(t)),this.setCurrentParamUpdateUserAction(e);let a=this.client.screens[s.PARAM_LIST_SCREENID].getButton(s.FINISH_BUTTON_ID);return void 0!==a&&a.setAppearance(this.cfg.isValidFn()?i.EnumAppearance.ENABLED_PRIMARY:i.EnumAppearance.DISABLED),e}handleParamUpdateUserActionGeneric(t){console.log("ConfigParamsAspect: handleParamUpdateUserActionGeneric");let e=!1,a=this.getCurrentParamUpdateUserAction();return a?(this.isLastUserActionGenericError&&t.payload.buttonId===n.ParamUpdateUserActionSimpleAccept_OK_BUTTON_ID?(this.isLastUserActionGenericError=!1,e=!0):e=this.cfg.handleParamUpdateUserActionFn(a,t),("boolean"==typeof e&&e||"object"==typeof e)&&(console.log("action handled"),this.setCurrentParamUpdateUserAction(void 0)),"object"==typeof e&&(console.log("new action present"),
this.setCurrentParamUpdateUserAction(e))):this.client.exitError("ConfigParamsAspect: handleParamUpdateUserActionGeneric - called in state, although no action set"),e}updateMessageBoxFromActionMessageAndShow(t){this.client.showMessageBox(t)}inspectTaskParameter(t){if(this.cfg.getDetailForTaskParameterFn){let e=this.cfg.getDetailForTaskParameterFn(t);this.showDetailTaskParameter(e)}else console.log("Error: Inspect parameter was clicked, but no getDetailForTaskParameterFn was configured in ConfigParamsAspect")}showDetailTaskParameter(t){let e=new _.default(this.client.mqttHandler);e.setTitle(t.title.id,t.title.args),e.setAppearance(i.EnumAppearance.HIDDEN);let a=[];for(const e of t.params){let t=new E.default(this.client.mqttHandler,e);t.publish(),a.push(t.getPublishedId())}e.setParams(a),e.show()}parametersEmpty(){let t=this.cfg.taskHandler.getTaskGroupsAndParameters(),e=!0;for(let a of t)for(let t of a.parameters)t.appearance!==i.EnumAppearance.HIDDEN&&(e=!1);return e}}
},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PARAM_TITLE=40,e.PARAM_HEADER=8,e.USER_GUIDANCE=45,e.BUTTON_DISPLAY=8,e.BUTTON_APPL=8,e.PARAMLIST_TITLE=40,e.MSG_TITLE=25,e.MSG_DESCRIPTION=200,e.BUTTON_MSG=20,e.GROUP_PARAM_TITLE=25,e.PARAM_SELECTION=25,e.DETAIL_TITLE=25,e.MAXIMUM_LENGTH_TASK_NAME=50,e.MAXIMUM_LENGTH_TASK_DESCRIPTION=60,e.USER_INPUT_STRING_NAMES=50,e.LID_SID_USER_INPUT_STRING_VALUES=60},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(10),s=a(43),n=a(0),r=a(5),o=a(14),_=a(1);e.TAB_SCREEN_ID="TABBEDSCREEN",e.BACK_BUTTON_ID="BTN_BACK",e.BACK_BUTTON_ID_PREFIX=e.BACK_BUTTON_ID+"_";const E={buttonId:"BUTTONS/"+e.BACK_BUTTON_ID,label:{id:"",args:[]},appearance:n.EnumAppearance.ENABLED};e.TabScreen=class extends s.TabApi{constructor(t){super(t,e.TAB_SCREEN_ID),this.events$=new o.Subject,this.backButton=new i.Button(this.mqttHandler,this,E)}hide(){
this.mqttHandler.publish(_.MqttTopics.HMI_TABBED_SCREEN,'{ "appearance":"'+n.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:r.ScreenEventType.HIDE_OVERLAY,id:this.getId()})}show(){this.backButton.publish(),this.getTabList().forEach(t=>t.publish()),this.mqttHandler.publish(_.MqttTopics.HMI_TABBED_SCREEN,'{ "appearance":"'+n.EnumAppearance.ENABLED+'" }'),this.events$.next({type:r.ScreenEventType.SHOW_OVERLAY,id:this.getId()})}getId(){return e.TAB_SCREEN_ID}getButton(t){if(t===e.BACK_BUTTON_ID)return this.backButton}hideBackButton(){this.backButton.setAppearance(n.EnumAppearance.HIDDEN)}showBackButton(){this.backButton.setAppearance(n.EnumAppearance.ENABLED)}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(9),s=a(16),n=a(44),r=a(31),o=a(7);e.DB_SCHEMA_VERSION_BATCHES=1,e.DB_TABLE_NAME_BATCHES="QAPP006_batch_"+e.DB_SCHEMA_VERSION_BATCHES.toFixed(0);let _=class extends r.QAppBaseEntity{constructor(t){super(),this.id=0,this.serial="",
this.taskId="",this.version=0,this.lot_id="",this.product_id="",this.valid_dataset=!0,this.time_start="",this.time_end="",this.content="",!1===o.isObject(t)&&(t=n.createBatch()),this.content=JSON.stringify(t),this.lot_id=t.lot_id,this.product_id=t.product.product_id,this.time_start=t.time_start,this.time_end=t.time_end}getEntityTableNameNoSchemaVersion(){return r.QAppBaseEntity.createTableNameNoSchemaVersion(n.QAPP_ID,e.DB_TABLE_NAME_BATCHES)}getSchemaVersion(){return e.DB_SCHEMA_VERSION_BATCHES}};i.__decorate([s.PrimaryGeneratedColumn(),i.__metadata("design:type",Number)],_.prototype,"id",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"serial",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"taskId",void 0),i.__decorate([s.VersionColumn(),i.__metadata("design:type",Number)],_.prototype,"version",void 0),i.__decorate([s.Column({unique:!0}),i.__metadata("design:type",String)],_.prototype,"lot_id",void 0),
i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"product_id",void 0),i.__decorate([s.Column(),i.__metadata("design:type",Boolean)],_.prototype,"valid_dataset",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"time_start",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"time_end",void 0),i.__decorate([s.Column("simple-json"),i.__metadata("design:type",String)],_.prototype,"content",void 0),_=i.__decorate([s.Entity(e.DB_TABLE_NAME_BATCHES),s.Index("IDX_"+e.DB_TABLE_NAME_BATCHES+"_Main",["id"],{unique:!0}),i.__metadata("design:paramtypes",[Object])],_),e.BatchEntity=_},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(9),s=a(16),n=a(44),r=a(31),o=a(7);e.DB_SCHEMA_VERSION_PRODUCTS=1,e.DB_TABLE_NAME_PRODUCTS="QAPP006_product_"+e.DB_SCHEMA_VERSION_PRODUCTS.toFixed(0);let _=class extends r.QAppBaseEntity{constructor(t){super(),this.id=0,this.serial="",this.taskId="",
this.version=0,this.product_id="",this.article_id="",this.valid_dataset=!1,this.prod_test_type="",this.proc_tare_type="",this.content="",!1===o.isObject(t)&&(t=n.createProduct()),this.content=JSON.stringify(t),this.product_id=t.product_id,this.article_id=t.article_id,this.prod_test_type=t.prod_test_type,this.proc_tare_type=t.proc_tare_type,this.valid_dataset=t.valid_dataset}getEntityTableNameNoSchemaVersion(){return r.QAppBaseEntity.createTableNameNoSchemaVersion(n.QAPP_ID,e.DB_TABLE_NAME_PRODUCTS)}getSchemaVersion(){return e.DB_SCHEMA_VERSION_PRODUCTS}};i.__decorate([s.PrimaryGeneratedColumn(),i.__metadata("design:type",Number)],_.prototype,"id",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"serial",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"taskId",void 0),i.__decorate([s.VersionColumn(),i.__metadata("design:type",Number)],_.prototype,"version",void 0),i.__decorate([s.Column({unique:!0
}),i.__metadata("design:type",String)],_.prototype,"product_id",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"article_id",void 0),i.__decorate([s.Column(),i.__metadata("design:type",Boolean)],_.prototype,"valid_dataset",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"prod_test_type",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],_.prototype,"proc_tare_type",void 0),i.__decorate([s.Column("simple-json"),i.__metadata("design:type",String)],_.prototype,"content",void 0),_=i.__decorate([s.Entity(e.DB_TABLE_NAME_PRODUCTS),s.Index("IDX_"+e.DB_TABLE_NAME_PRODUCTS+"_Main",["id"],{unique:!0}),i.__metadata("design:paramtypes",[Object])],_),e.ProductEntity=_},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(10),s=a(0),n=a(35);e.PARAM_LIST_SCREENID="PARAMLIST",e.FINISH_BUTTON_ID="BTN_FIN";e.ParameterListScreen=class extends n.ParamListBase{constructor(t){super(t)
;let a={};a.label={id:n.CANCEL_BUTTON_NAME,args:[]},a.appearance=s.EnumAppearance.ENABLED_PRIMARY,a.buttonId=n.CANCEL_BUTTON_ID,this.cancelButton=new i.default(t,this,a),a.appearance=s.EnumAppearance.HIDDEN,a.label.id="_FINISH",a.buttonId=e.FINISH_BUTTON_ID,this.finishButton=new i.default(t,this,a)}getId(){return"PARAMLIST"}getButton(t){let a;return a=t===n.CANCEL_BUTTON_ID?this.cancelButton:t===e.FINISH_BUTTON_ID?this.finishButton:void 0}setFinishButtonLabel(t){this.finishButton.setLabel(t,!1)}show(){this.finishButton.publish(),this.createAndPublishParamsAndPage(),super.show()}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(5),n=a(14),r=a(1);class o{constructor(t){this.paramDetailsOverlayObject={appearance:i.EnumAppearance.HIDDEN,title:{id:"",args:[]},params:[]},this.events$=new n.Subject,this.mqttHandler=t}setAppearance(t){
this.paramDetailsOverlayObject.appearance!==t&&(t!==i.EnumAppearance.HIDDEN&&t!==i.EnumAppearance.ENABLED||(this.paramDetailsOverlayObject.appearance=t,this.mqttHandler.publish(r.MqttTopics.HMI_PARAMDETAILSOVERLAY,JSON.stringify(this.paramDetailsOverlayObject))))}getAppearance(){return this.paramDetailsOverlayObject.appearance}setTitle(t,e){this.paramDetailsOverlayObject.title.id===t&&this.paramDetailsOverlayObject.title.args.join("")===e.join("")||(this.paramDetailsOverlayObject.title.id=t,this.paramDetailsOverlayObject.title.args=e,this.paramDetailsOverlayObject.appearance!==i.EnumAppearance.HIDDEN&&this.mqttHandler.publish(r.MqttTopics.HMI_PARAMDETAILSOVERLAY,JSON.stringify(this.paramDetailsOverlayObject)))}getTitle(){return this.paramDetailsOverlayObject.title}setParams(t){this.paramDetailsOverlayObject.params.join("")!==t.join("")&&(this.paramDetailsOverlayObject.params=t,
this.paramDetailsOverlayObject.appearance!==i.EnumAppearance.HIDDEN&&this.mqttHandler.publish(r.MqttTopics.HMI_PARAMDETAILSOVERLAY,JSON.stringify(this.paramDetailsOverlayObject)))}getParams(){return this.paramDetailsOverlayObject.params}getId(){return"PARAMDETAILSOVERLAY"}getButton(t){}hide(){this.paramDetailsOverlayObject.appearance===i.EnumAppearance.ENABLED&&(this.setAppearance(i.EnumAppearance.HIDDEN),this.events$.next({type:s.ScreenEventType.HIDE_OVERLAY,id:this.getId()}))}show(){this.paramDetailsOverlayObject.appearance===i.EnumAppearance.HIDDEN&&(this.setAppearance(i.EnumAppearance.ENABLED),this.events$.next({type:s.ScreenEventType.SHOW_OVERLAY,id:this.getId()}))}}e.ParamDetailsOverlay=o,e.default=o},function(t,e){t.exports=require("rxjs/observable/interval")},function(t,e){t.exports=require("rxjs/observable/merge")},function(t,e){t.exports=require("timers")},function(t,e){t.exports=require("machina")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0
}),e.INTERNAL_SUSPEND_EVENT="_INTERNAL_SUSPEND_EVENT_",function(t){t.SUSPEND_EVENT_TYPE_FORCED_HOME="SUSPEND_EVENT_TYPE_FORCED_HOME",t.SUSPEND_EVENT_TYPE_FORCED_LOGOUT="SUSPEND_EVENT_TYPE_FORCED_LOGOUT",t.SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT="SUSPEND_EVENT_TYPE_FORCED_AUTO_LOGOUT",t.SUSPEND_EVENT_TYPE_EXECFINALLY="SUSPEND_EVENT_TYPE_EXECFINALLY"}(e.INTERNAL_SUSPEND_EVENT_TYPE||(e.INTERNAL_SUSPEND_EVENT_TYPE={}));e.InternalSuspendEvent=class{constructor(t){this.payload=t,this.type=e.INTERNAL_SUSPEND_EVENT}},e.INTERNAL_RESTART_EVENT="_INTERNAL_RESTART_EVENT_",function(t){t.RESTART_EVENT_TYPE_REQUEST="RESTART_EVENT_TYPE_REQUEST",t.RESTART_EVENT_TYPE_EXECFINALLY="RESTART_EVENT_TYPE_EXECFINALLY"}(e.INTERNAL_RESTART_EVENT_TYPE||(e.INTERNAL_RESTART_EVENT_TYPE={}));e.InternalRestartEvent=class{constructor(t){this.payload=t,this.type=e.INTERNAL_RESTART_EVENT}},e.HEARTBEAT_EVENT="_FSM_HEARTBEAT_EVENT_";e.HeartbeatEvent=class{constructor(t){this.payload=t,this.type=e.HEARTBEAT_EVENT}},
function(t){t.INTERNAL_ASYNC_CALL_EVENT_TYPE_SUCCESS="SUCCESS",t.INTERNAL_ASYNC_CALL_EVENT_TYPE_FAIL="FAIL",t.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT="TIMEOUT",t.INTERNAL_ASYNC_CALL_EVENT_TYPE_TIMEOUT_WITH_FETCHING_RESP="TIMEOUT_FETCH_RESP"}(e.INTERNAL_ASYNC_CALL_EVENT_TYPE||(e.INTERNAL_ASYNC_CALL_EVENT_TYPE={})),e.INTERNAL_ASYNC_CALL_EVENT="_INTERNAL_ASYNC_CALL_EVENT_";e.InternalAsyncCallEvent=class{constructor(t){this.payload=t,this.type=e.INTERNAL_ASYNC_CALL_EVENT}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(78),s=a(14),n=a(79),r=a(28),o=a(24),_=a(1);e.MqttHandler=class{constructor(){this.mqttOptions={host:"127.0.0.1",port:1883,clientId:`qapp_${Math.random().toString(16).substring(2,8)}`,will:{topic:_.MqttTopics.QAPP_CLEANUP,payload:"",qos:1,retain:0}},this.listeningForUpdateEvent=!1,this.listeningForAdminEvent=!1,this.mqttUpdateEvent$=new s.Subject,this.mqttAdminEvent$=new s.Subject,this.weighingNet={str:_.MqttTopics.WEIGHING_VALUE_NET,
subscribe:()=>this.subscribe(_.MqttTopics.WEIGHING_VALUE_NET),unsubscribe:()=>this.unsubscribe(_.MqttTopics.WEIGHING_VALUE_NET)},this.client=i.connect(this.mqttOptions),this.startListeningForUpdateEvent(),this.startListeningForAdminEvent(),this.listOfPublishedTopics=[],this.listOfSubscribedTopics=[]}startListeningForUpdateEvent(){this.listeningForUpdateEvent||(this.client.on("message",(t,e,a)=>{let i={topic:t,value:e,packet:a};i.topic.startsWith(_.MqttTopics.QAPP_DEBUG_TOPIC_PREAMBLE)?this.mqttUpdateEvent$.next(new o.MqttUpdateDebugEvent(i)):this.mqttUpdateEvent$.next(new o.MqttUpdateEvent(i))}),this.listeningForUpdateEvent=!0)}startListeningForAdminEvent(){this.listeningForAdminEvent||(this.client.on("offline",()=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"offline",message:"client is offline!"}))}),this.client.on("close",()=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"close",message:"client has disconnected!"}))}),this.client.on("reconnect",()=>{
this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"reconnect",message:"client is reconnecting!"}))}),this.client.on("error",t=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"error",message:"client cannot connect or a parsing error occured!",error:t}))}),this.client.on("packetsend",t=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"packetsend",message:"client send packet!",packet:t}))}),this.client.on("packetreceive",t=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"packetreceive",message:"client recieved packet!",packet:t}))}),this.client.on("connect",t=>{this.mqttAdminEvent$.next(new r.MqttAdminEvent({event:"connect",message:"client has successfully connected!",connack:t}))}),this.listeningForAdminEvent=!0)}publish(t,e,a,i){let s,r;"function"==typeof a?(r=a,s=void 0):(s=a,r=i);let o={qos:n.EnumMqttQos.AtMostOnce,retain:!0,dup:!1};Object.assign(o,s),"/"!==t.substring(0,1)&&(t="~"===t.substring(0,1)?t.substring(1):`${_.MqttTopics.QAPP_NAMESPACE}/${t}`),
t.startsWith(_.MqttTopics.QAPP_NAMESPACE)&&(this.listOfPublishedTopics.includes(t)||this.listOfPublishedTopics.push(t)),this.client.publish(t,e,o,t=>{r&&r(t)})}subscribe(t,e,a){if("object"==typeof t)this.subscribe(t,(t,e)=>{a&&a(t,e)});else{"function"==typeof e&&(a=e,e=void 0);let i={qos:0};Object.assign(i,e),-1===this.listOfSubscribedTopics.indexOf(t)&&this.listOfSubscribedTopics.push(t),this.client.subscribe(t,i,(t,e)=>{a&&a(t,e)})}}unsubscribe(t,e){this.client.unsubscribe(t,t=>{e&&e(t)})}end(t,e){let a=!1,i=void 0;"function"==typeof t?(a=!1,i=t):"boolean"==typeof t&&(a=t,i=e),this.client.end(a,()=>{i&&i()})}removeOutgoingMessage(t){this.client.removeOutgoingMessage(t)}reconnect(t){this.client.reconnect(t)}getLastMessageId(){return this.client.getLastMessageId()}handleMessage(t,e){this.client.handleMessage(t,(t,a)=>{e(t,a)})}reconnecting(){return this.client.reconnecting}connected(){return this.client.connected}clearPublishedTopics(){this.publish(_.MqttTopics.QAPP_CLEANUP,"")
;for(let t of this.listOfPublishedTopics)this.publish(t,"");this.publish(_.MqttTopics.QAPP_CLEANUP,"")}unsubscribeTopics(){this.unsubscribe(this.listOfSubscribedTopics)}}},function(t,e){t.exports=require("mqtt")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.AtMostOnce=0]="AtMostOnce",t[t.AtLeastOnce=1]="AtLeastOnce",t[t.ExactlyOnce=2]="ExactlyOnce"}(e.EnumMqttQos||(e.EnumMqttQos={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(52),s=a(14),n=a(25),r=a(17),o=a(1),_="/rest/qapp/paramDetail",E="/rest/qapp/paramChanged",l="/rest/qapp/buttonClick",u="/rest/qapp/extern",c=5e3;function T(t,e,a,i,s){t.statusCode=e,void 0!==a&&(t.statusMessage=a),console.log(`RestHandler::finalizeResponse: send ${e} (${a}) response: ${r.inspect(i)}`),void 0===i?t.end():"object"==typeof i?(t.setHeader("Content-Type","application/json"),t.end(JSON.stringify(i,s))):(t.setHeader("Content-Type","plain/text"),t.end(i))}
e.RestHandler=class{constructor(t){this.buttonClickEvent$=new s.Subject,this.paramChangedEvent$=new s.Subject,this.paramDetailEvent$=new s.Subject,this.restRequestEvent$=new s.Subject,this.restController=((t,e)=>{if(t.url)if(t.url.startsWith(u)){let a=t.url.replace(u,"");console.log(`RestHandler: rx extern REST request (${t.method})for URL ${a}`),this.handleRequest(t,i=>{console.log("RestHandler: rx all data for REST request - create and enqueue event"),e.setTimeout(c);let s={subUrl:a,request:t,body:i,response:e};this.restRequestEvent$.next(new n.RestRequestEvent(s))})}else switch(console.log(`RestHandler: rx internal REST request: ${t.url}`),t.url){case l:"POST"===t.method?this.handleRequest(t,t=>{t.buttonId&&(console.log(`RestHandler::restController received buttonID: ${t.buttonId}`),this.buttonClickEvent$.next(new n.HmiButtonClickedEvent(t)),T(e,200,"Event Accepted and Forwarded","ok"))}):T(e,405,"Method Not Allowed","failure");break;case E:
"POST"===t.method?this.handleRequest(t,t=>{t&&(this.paramChangedEvent$.next(new n.HmiParamChangedEvent({parameter:t})),T(e,200,"Event Accepted and Forwarded","ok"))}):T(e,405,"Method Not Allowed","failure");break;case _:"POST"===t.method?this.handleRequest(t,t=>{t&&(this.paramDetailEvent$.next(new n.HmiParamDetailEvent({parameter:t})),T(e,200,"Event Accepted and Forwarded","ok"))}):T(e,405,"Method Not Allowed","failure");break;default:T(e,404,"Not Found","failure")}else T(e,404,"Not Found","failure")}),this.port=t||8081,this.server=i.createServer(this.restController),this.server.listen(this.port,t=>{t&&console.log(t),console.log(`listening on port ${this.port}`)}),this.server.on("clientError",(t,e)=>{console.log("clientError"),console.log(t),console.log(t.stack),e.end("HTTP/1.1 400 Bad Request\r\n\r\n")})}stopServer(){this.server.close(()=>{console.log("HttpServer closed")})}handleRequest(t,e){let a,i=[""];t.on("error",e=>{console.log("RestHandler::handleRequest: "+e),t.socket.end()
}).on("data",t=>{console.log("RestHandler::handleRequest: data"),"string"!=typeof t?i.push(t.toString()):i.push(t)}).on("end",()=>{if(console.log("RestHandler::handleRequest: end"),a=i.reduce((t,e)=>t+e),"application/json"===t.headers["content-type"])try{e(JSON.parse(a))}catch(t){e(a)}else e(a)})}registerRestEndpoints(t,e){t.publish(o.MqttTopics.CUSTOMIZED_REST_HANDLER_CONFIGURATION,JSON.stringify(e))}},e.finalizeResponse=T},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HttpRestErrorName="HttpRestError";class i extends Error{constructor(t,a,s,n){super(),this.statusCode=a,this.headers=s,this.body=n,this.name=e.HttpRestErrorName,Object.setPrototypeOf(this,i.prototype),this.message=t}}e.HttpRestError=i,e.isHttpRestError=function(t){return"object"==typeof t&&t.hasOwnProperty("statusCode")&&t.hasOwnProperty("headers")&&t.hasOwnProperty("body")}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0})
;const i=a(6),s=a(0),n=a(4),r="WEIGHING/CONFIGURATION/PROFILE/ZERO_TARE",o=r+"/TARE1",_="ON",E="PROFILE/IDENTIFICATION",l="PROFILE/IDENTIFICATION/NAME";e.ProfileManagementProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="profilemanagement"}loadProfile(t){return this.body.method=n.RestMethodsPROFILE_MANAGEMENT.loadProfile,this.body.params={rProfile:"",id:t},new i.CubisRestResponse(this.syncRequest())}isPresetTareEnabled(t){let e;if(t instanceof i.CubisRestResponse)e=JSON.parse(t.rawReturns.rProfile).params;else if("string"==typeof t){let a=this.loadProfile(t);e=JSON.parse(a.rawReturns.rProfile).params}else e=t.params;for(let t of e)if(t.id===r)for(let e of t.parameters)if(e.id===o)return e.value.selection.id===_;return!1}getWeighingProfileName(t){let e;if(t instanceof i.CubisRestResponse)e=JSON.parse(t.rawReturns.rProfile).params;else if("string"==typeof t){let a=this.loadProfile(t);e=JSON.parse(a.rawReturns.rProfile).params}else e=t.params
;for(let t of e)if(t.id===E)for(let e of t.parameters)if(e.id===l)return e.value.string;return""}getAvailableWeighingUnitsInWeighingProfile(t){let e=t.params.find(t=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY"===t.id);if(void 0!==e){let t=e.parameters.find(t=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY/UNITS"===t.id);return void 0===t?void 0:t.value.selections.map(t=>t.id)}}getUnitsAvailableOnBalance(t){let e=t.params.find(t=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY"===t.id);if(void 0!==e){let t=e.parameters.find(t=>"WEIGHING/CONFIGURATION/PROFILE/UNITS_ACCURACY/UNITS"===t.id);if(void 0===t)return;{let e=[];return t.info.options.forEach(t=>{t.appearance===s.EnumAppearance.ENABLED&&(e=[...e,t.id])}),0===e.length?void 0:e}}}}},function(t,e){t.exports=require("https")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(6),s=a(3),n=a(4);e.AccessControlProxy=class extends i.BaseProxy{constructor(){super(...arguments),
this.restEndpoint="access"}getCurrentUser(){let t,e;return this.body.method=n.RestMethodsACCESS_MANAGEMENT.getCurrentUser,this.body.params={user:""},t=new i.CubisRestResponse(this.syncRequest()),e=JSON.parse(t.rawReturns.user)}getCurrentUserName(t){let e,a="";return(e=void 0!==t?t:this.getCurrentUser()).params.find(t=>"USER/SETTINGS"===t.id&&t.parameters.find(t=>"USER/SETTINGS/NAME"===t.id&&(a=t.value.string,!0))),a}getCurrentUserRoles(t){let e;e=void 0!==t?t:this.getCurrentUser();let a=s.createEmptySelectionParameter();return e.params.find(t=>"USER/SETTINGS"===t.id&&t.parameters.find(t=>"USER/SETTINGS/ROLES"===t.id&&(a=t,!0))),a}checkRightsOfCurrentUser(t){let e;return this.body.method=n.RestMethodsACCESS_MANAGEMENT.checkRightsOfCurrentUser,this.body.params={permissionGranted:!1,arrayOfRightsToCheck:t},(e=new i.CubisRestResponse(this.syncRequest())).rawReturns.permissionGranted}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0})
;const i=a(10),s=a(0),n=a(11),r=a(5),o=a(14),_=a(1);e.MESSAGEBOX_ID="MESSAGEBOX";class E{constructor(t){this.appearance=s.EnumAppearance.HIDDEN,this.lastPublishedTabContent={appearance:s.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.messageBoxObject={appearance:s.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.events$=new o.Subject,this.mqttHandler=t,this.buttonList=[]}setMessageBoxData(t,e=!0){this.setBackgroundColor(t.backgroundColor,!1),this.setIconColor(t.iconColor,!1),this.setType(t.type,!1),this.setTitle(t.title,!1),this.setTextsList(t.textList,!1),this.createButtons(t.buttons.map(t=>({buttonId:t.id,label:t.label,appearance:t.appearance}))),this.publish(e)}createButtons(t){this.buttonList.splice(0,this.buttonList.length),this.messageBoxObject.buttons.splice(0,this.messageBoxObject.buttons.length),
console.log("MessageBox: createButtons buttonlist cleared: "+this.buttonList.length),console.log("MessageBox: createButtons buttonlist json cleared: "+this.messageBoxObject.buttons.length);for(let e of t)if(void 0===this.getButton(e.buttonId)){let t=new i.default(this.mqttHandler,this,e);this.buttonList.push(t),this.messageBoxObject.buttons.push(t.getJson())}else console.error("MessageBox: Duplicate Button: "+e.buttonId);console.log("MessageBox: createButtons number of buttons: "+this.buttonList.length),console.log("MessageBox: createButtons json result: "+JSON.stringify(this.messageBoxObject))}removeButtons(t){console.log("MessageBox: removeButtons ");for(let e of t){for(let t=0;t<this.buttonList.length;t++)this.buttonList[t].getButtonId()===e&&(console.log("MessageBox: splice for index: "+t),this.buttonList.splice(t,1),console.log("MessageBox: Buttonlist buttons left: "+this.buttonList.length),t=0);console.log("MessageBox: Clearing json buttons")
;for(let t=0;t<this.messageBoxObject.buttons.length;t++){let a=this.messageBoxObject.buttons[t];if(console.log("MessageBox: buttonId "+a.effect.params.buttonId),a.effect.params.buttonId===e){let e=this.messageBoxObject.buttons.splice(t,1);console.log("MessageBox: Removed JSON Button: "+e[0]),console.log("MessageBox: ButtonJSON buttons left: "+this.messageBoxObject.buttons.length),t=0}}}console.log("MessageBox: Messagebox json: "+JSON.stringify(this.messageBoxObject))}publish(t=!0){let e=JSON.stringify(this.messageBoxObject),a=JSON.stringify(this.lastPublishedTabContent);t&&(e!==a&&this.messageBoxObject.appearance===s.EnumAppearance.ENABLED||this.lastPublishedTabContent.appearance===s.EnumAppearance.ENABLED&&this.messageBoxObject.appearance===s.EnumAppearance.HIDDEN)&&(this.mqttHandler.publish(_.MqttTopics.HMI_MESSAGEBOX,e),this.lastPublishedTabContent=JSON.parse(e))}getButtonByTopic(t){for(let e of this.buttonList){if(e.getTopic().substring(e.getTopic().lastIndexOf("/")+1)===t)return e
}}getButton(t){for(let e of this.buttonList)if(e.getButtonId()===t)return e}setAppearance(t,e=!0){"HIDDEN"!==t&&"ENABLED"!==t||(this.appearance=t,this.messageBoxObject.appearance=t,this.publish(e))}getAppearance(){return this.appearance}setBackgroundColor(t,e=!0){this.messageBoxObject.backgroundColor=t,this.publish(e)}getBackgroundColor(){return this.messageBoxObject.backgroundColor}setIconColor(t,e=!0){this.messageBoxObject.iconColor=t,this.publish(e)}getIconColor(){return this.messageBoxObject.iconColor}setType(t,e=!0){this.messageBoxObject.type=t,this.publish(e)}getType(){return this.messageBoxObject.type}setTitle(t,e=!0){this.messageBoxObject.title=t,this.publish(e)}getTitle(){return this.messageBoxObject.title}setTextsList(t,e=!0){this.messageBoxObject.textsList=t,this.publish(e)}getTextsList(){return this.messageBoxObject.textsList}getText(){return this.messageBoxObject.textsList[0]}getId(){return e.MESSAGEBOX_ID}hide(){
this.appearance===s.EnumAppearance.ENABLED&&(this.setAppearance(s.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_MESSAGEBOX,id:this.getId()}))}show(){this.appearance===s.EnumAppearance.HIDDEN&&(this.setAppearance(s.EnumAppearance.ENABLED),this.events$.next({type:r.ScreenEventType.SHOW_MESSAGEBOX,id:this.getId()}))}}e.MessageBox=E,e.default=E},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.FOUR_AREAS="4",t.SIX_AREAS="6"}(e.EnumAreaCount||(e.EnumAreaCount={}))},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(40),n=a(5),r=a(1);e.LOADING_OVERLAY_ID="LOADING_MODAL";e.LoadingOverlay=class extends s.AbstractOverlay{setText(t){this.publishContent("TEXT",JSON.stringify(t))}show(){this.publishContent("APPEARANCE",'{ "appearance":"'+i.EnumAppearance.ENABLED+'" }'),this.events$.next({type:n.ScreenEventType.SHOW_LOADINGSCREEN,id:this.getId()})}hide(){this.publishContent("TEXT",""),
this.publishContent("APPEARANCE",'{ "appearance":"'+i.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:n.ScreenEventType.HIDE_LOADINGSCREEN,id:this.getId()})}getMqttTopicBase(){return"~"+r.MqttTopics.HMI_LOADING_MODAL}getId(){return e.LOADING_OVERLAY_ID}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(6),s=a(4);e.DeviceInformationProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="deviceinformation"}getSerialNo(){let t;return this.body.method=s.RestMethodsDEVICE_INFORMATION.getSerialNoBalance,this.body.params={rString:""},(t=new i.CubisRestResponse(this.syncRequest())).isSuccess()?t.rawReturns.rString:""}getModelName(){let t;return this.body.method=s.RestMethodsDEVICE_INFORMATION.getModelName,this.body.params={rString:""},(t=new i.CubisRestResponse(this.syncRequest())).isSuccess()?t.rawReturns.rString:""}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),
e.LOCKING_ASPECT="LOCKING_ASPECT"},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(10),s=a(0),n=a(11),r=a(5),o=a(14),_=a(1);e.LOCKMESSAGEBOX_ID="LOCKMESSAGEBOX";class E{constructor(t){this.appearance=s.EnumAppearance.HIDDEN,this.lastPublishedTabContent={appearance:s.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.messageBoxObject={appearance:s.EnumAppearance.HIDDEN,type:n.EnumMessageboxType.INFO,title:{id:"",args:[]},text:{id:"",args:[]},textsList:[],buttons:[]},this.events$=new o.Subject,this.mqttHandler=t,this.buttonList=[]}setMessageBoxData(t,e=!0){this.setBackgroundColor(t.backgroundColor,!1),this.setIconColor(t.iconColor,!1),this.setType(t.type,!1),this.setTitle(t.title,!1),this.setTextsList(t.textList,!1),this.createButtons(t.buttons.map(t=>({buttonId:t.id,label:t.label,appearance:t.appearance}))),this.publish(e)}createButtons(t){
this.buttonList.splice(0,this.buttonList.length),this.messageBoxObject.buttons.splice(0,this.messageBoxObject.buttons.length),console.log("LockMessageBox: createButtons buttonlist cleared: "+this.buttonList.length),console.log("LockMessageBox: createButtons buttonlist json cleared: "+this.messageBoxObject.buttons.length);for(let e of t)if(void 0===this.getButton(e.buttonId)){let t=new i.default(this.mqttHandler,this,e);this.buttonList.push(t),this.messageBoxObject.buttons.push(t.getJson())}else console.error("LockMessageBox: Duplicate Button: "+e.buttonId);console.log("LockMessageBox: createButtons number of buttons: "+this.buttonList.length),console.log("LockMessageBox: createButtons json result: "+JSON.stringify(this.messageBoxObject))}removeButtons(t){console.log("LockMessageBox: removeButtons ");for(let e of t){for(let t=0;t<this.buttonList.length;t++)this.buttonList[t].getButtonId()===e&&(console.log("LockMessageBox: splice for index: "+t),this.buttonList.splice(t,1),
console.log("LockMessageBox: Buttonlist buttons left: "+this.buttonList.length),t=0);console.log("LockMessageBox: Clearing json buttons");for(let t=0;t<this.messageBoxObject.buttons.length;t++){let a=this.messageBoxObject.buttons[t];if(console.log("LockMessageBox: buttonId "+a.effect.params.buttonId),a.effect.params.buttonId===e){let e=this.messageBoxObject.buttons.splice(t,1);console.log("LockMessageBox: Removed JSON Button: "+e[0]),console.log("LockMessageBox: ButtonJSON buttons left: "+this.messageBoxObject.buttons.length),t=0}}}}publish(t=!0){let e=JSON.stringify(this.messageBoxObject),a=JSON.stringify(this.lastPublishedTabContent);t&&(e!==a&&this.messageBoxObject.appearance===s.EnumAppearance.ENABLED||this.lastPublishedTabContent.appearance===s.EnumAppearance.ENABLED&&this.messageBoxObject.appearance===s.EnumAppearance.HIDDEN)&&(this.mqttHandler.publish(_.MqttTopics.HMI_LOCK_MESSAGEBOX,e),this.lastPublishedTabContent=JSON.parse(e))}getButtonByTopic(t){
for(let e of this.buttonList){if(e.getTopic().substring(e.getTopic().lastIndexOf("/")+1)===t)return e}}getButton(t){for(let e of this.buttonList)if(e.getButtonId()===t)return e}setAppearance(t,e=!0){"HIDDEN"!==t&&"ENABLED"!==t||(this.appearance=t,this.messageBoxObject.appearance=t,this.publish(e))}getAppearance(){return this.appearance}setBackgroundColor(t,e=!0){this.messageBoxObject.backgroundColor=t,this.publish(e)}getBackgroundColor(){return this.messageBoxObject.backgroundColor}setIconColor(t,e=!0){this.messageBoxObject.iconColor=t,this.publish(e)}getIconColor(){return this.messageBoxObject.iconColor}setType(t,e=!0){this.messageBoxObject.type=t,this.publish(e)}getType(){return this.messageBoxObject.type}setTitle(t,e=!0){this.messageBoxObject.title=t,this.publish(e)}getTitle(){return this.messageBoxObject.title}setTextsList(t,e=!0){this.messageBoxObject.textsList=t,this.publish(e)}getTextsList(){return this.messageBoxObject.textsList}getText(){
return this.messageBoxObject.textsList[0]}getId(){return e.LOCKMESSAGEBOX_ID}hide(){this.appearance===s.EnumAppearance.ENABLED&&(this.setAppearance(s.EnumAppearance.HIDDEN),this.events$.next({type:r.ScreenEventType.HIDE_LOCKMESSAGEBOX,id:this.getId()}))}show(){this.appearance===s.EnumAppearance.HIDDEN&&(this.setAppearance(s.EnumAppearance.ENABLED),this.events$.next({type:r.ScreenEventType.SHOW_LOCKMESSAGEBOX,id:this.getId()}))}}e.LockMessageBox=E,e.default=E},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(40),n=a(5),r=a(1);e.LOCK_LOADING_OVERLAY_ID="LOCK_LOADING_MODAL";e.LockLoadingOverlay=class extends s.AbstractOverlay{setText(t){this.publishContent("TEXT",JSON.stringify(t))}show(){this.publishContent("APPEARANCE",'{ "appearance":"'+i.EnumAppearance.ENABLED+'" }'),this.events$.next({type:n.ScreenEventType.SHOW_LOCKLOADINGSCREEN,id:this.getId()})}hide(){this.publishContent("TEXT",""),
this.publishContent("APPEARANCE",'{ "appearance":"'+i.EnumAppearance.HIDDEN+'" }'),this.events$.next({type:n.ScreenEventType.HIDE_LOCKLOADINGSCREEN,id:this.getId()})}getMqttTopicBase(){return r.MqttTopics.HMI_LOCK_LOADING_MODAL}getId(){return e.LOCK_LOADING_OVERLAY_ID}}},function(t,e){t.exports=require("net")},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getTime=function(){return Math.trunc(Date.now()/1e3)}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(9),s=a(95),n=a(3),r=a(25),o=a(24),_=a(8),E=a(28),l=a(10),u=a(67),c=a(27),T=a(26),d=a(38),p=a(34),A=a(107),I=a(42),h=a(39),m=a(108),N=a(12),S=a(6),g=a(109),R=a(2),P=a(1),O=a(0),D=a(4),C=a(18),M=a(7),L=a(36),b=a(58);let f,y=a(64);function B(t,e){return void 0!==f?f.l(t,e):t}e.PROXY_BUTTON_DEFAULT_ID="BUTTON_DOES_NOT_EXIST_proxy_default",e.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC="RESERVED_REPORTING_INTERVAL",
e.REPORTING_QUEUE_DONE_EVENT="RESERVED_REPORTING_INTERVAL_DONE",e.REPORTING_QUEUE_MINIMUM_WAIT_MS=25,e.REPORTING_QUEUE_FAILED_WAIT_MS=100,e.REPORTING_QUEUE_REQUEST_TIMEOUT=1e4,e.PREVENT_AUTO_LOGOUT_INTERVAL_EVENT="RESERVED_PREVENT_AUTO_LOGOUT",e.l=B;let v={},U={get:function(t,a,i){return null!=a&&void 0!==a&&t.hasOwnProperty(a)&&null!=t[a]&&void 0!==t[a]?Reflect.get(t,a,i):void 0!==f?new l.Button(f.mqttHandler,f.mainScreen,{buttonId:e.PROXY_BUTTON_DEFAULT_ID,appearance:O.EnumAppearance.ENABLED,label:{id:"ERR_PXY_BTN",args:[]}}):void 0}};e.btn=new Proxy(v,U);e.wfRunner=class extends s.QAppAdvBase{constructor(t){super(t),this.QAPP_ID="",this.QAPP_TOKEN="",this.IDEXTEND_PARAM="TASK/DYNAMIC_PARAMETER_",this.IDEXTEND_BUTTON="TASK/DYNAMIC_BUTTON_",this.IDEXTEND_BUTTON_MENU="TASK/DYNAMIC_BUTTON_MENU_",this.IDEXTEND_BUTTON_PARAM="TASK/DYNAMIC_BUTTON_PARAM_",this.IDEXTEND_BUTTON_MSG="TASK/DYNAMIC_BUTTON_MSG_",this.IDEXTEND_BUTTON_TAB="TASK/DYNAMIC_BUTTON_TAB_",
this.IDEXTEND_BUTTON_WEIGHING="TASK/DYNAMIC_BUTTON_WGH_",this.IDEXTEND_SCREEN="TASK/DYNAMIC_SCREEN_",this.IDEXTEND_STATE_SCREEN="STATE_SCREEN_",this.DEFAULT_CANCEL_BTN_ID="_CANCEL",this.STATES={},this.STATE_FUNCTIONS=[],this.ENTRY_STATE="",this.SERIAL_NUMBER="",this.MODEL_NAME="",this.DEVICE_ID1="",this.DEVICE_ID2="",this.DEVICE_APPROVED=!1,this.USER={id:"",name:"",display_name:"",description:"",role_id:"",role_name:""},this.IS_SERVICE=!1,this.IS_ADMIN=!1,this.IS_OPERATOR=!1,this.IS_GUEST=!1,this.localizerTextBuffer={},this.weighingScreenButtons=[],this.weighingSplitScreenButtons=[],this.auditTrailProxy=new g.AuditTrailProxy,this.Metrology=d.createMetrology(),this.lastHeartbeatTimestamp=0,this.reportingPrintBlocksQueue=[],this.reportingQueueActive=!1,this.reportingPrintItemIdentifierMap={},this.reportingQueueTimer=void 0,this.bargraphObject={active:!1,updateTimestamp:0,areaCount:1,effectiveMinimum:0,effectiveMaximum:0,min2:0,min1:0,target:0,max1:0,max2:0},this.messageBoxesCache={},
this.preventAutoLogoutInterval=void 0,this.rejectFastButtonPressWaitDuration=650,this.rejectFastButtonPress=!1,this.rejectFastButtonPressUntilTimestamp=0,f=this;let e=this.GET_QAPP_META_DATA();e.hasOwnProperty("qappID")&&(this.QAPP_ID=e.qappID),e.hasOwnProperty("qappToken")&&(this.QAPP_TOKEN=e.qappToken,this.IDEXTEND_PARAM+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON_MENU+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON_PARAM+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON_MSG+=this.QAPP_TOKEN+"_",this.IDEXTEND_BUTTON_WEIGHING+=this.QAPP_TOKEN+"_",this.IDEXTEND_SCREEN+=this.QAPP_TOKEN+"_",this.IDEXTEND_STATE_SCREEN+=this.QAPP_TOKEN+"_",this.DEFAULT_CANCEL_BTN_ID=this.QAPP_TOKEN+"_"+this.DEFAULT_CANCEL_BTN_ID),e.hasOwnProperty("stateScreenFunctions")&&(this.STATE_FUNCTIONS=e.stateScreenFunctions),e.hasOwnProperty("initialStateFunction")&&(this.ENTRY_STATE=this[e.initialStateFunction]()),this.SERIAL_NUMBER=this.getSerialNumber(),
this.MODEL_NAME=this.devicInformationProxy.getModelName(),this.USER=d.get_device_user(),this.IS_SERVICE=this.USER.role_id===b.ACCESS_CONTROL_ROLE_DB_IDS.SERVICE_ROLE_ID,this.IS_ADMIN=this.USER.role_id===b.ACCESS_CONTROL_ROLE_DB_IDS.ADMIN_ROLE_ID||this.IS_SERVICE,this.IS_OPERATOR=this.USER.role_id===b.ACCESS_CONTROL_ROLE_DB_IDS.OPERATOR_ROLE_ID,this.IS_GUEST=this.USER.role_id===b.ACCESS_CONTROL_ROLE_DB_IDS.GUEST_ROLE_ID,this.DATETIME_CONFIGURATION=p.getDateTimeConfiguration(),this.mqttHandler.mqttUpdateEvent$.subscribe(t=>{M.isObject(t)&&M.isObject(t.payload)&&M.isString(t.payload.topic)&&this.handleMqttEventsGlobally(t)});let a=this.perform_InternalWebserviceRequest("deviceinformation",D.RestMethodsDEVICE_INFORMATION.getParameter,{rObject:{},id:"DEVICEINFORMATION/SETUP"});try{let t=JSON.parse(a.rawReturns.rObject),e=M.getObjectByID(t.parameters,"DEVICEINFORMATION/SETUP/ID1");e&&(this.DEVICE_ID1=e.value.string),
(e=M.getObjectByID(t.parameters,"DEVICEINFORMATION/SETUP/ID2"))&&(this.DEVICE_ID2=e.value.string)}catch(t){}this.skipLotInput=!0,this.ignoreSaveWorkstate=!0,this.skipConfigParamAspect=!0,this.suppressGlobalHomeBtnHandling=!0,this.suppressGlobalLogoutBtnHandling=!0,this.constructor_screens(),this.constructor_states()}constructor_screens(){let t=[];this.mainScreen=new A.SingleTabButtonBarScreen(this.mqttHandler,[],{buttonId:this.DEFAULT_CANCEL_BTN_ID,appearance:O.EnumAppearance.ENABLED,label:{id:N.EnumFontLabels.CANCEL,args:[]}}),this.registerScreen(this.mainScreen);let e={id:"",appearance:O.EnumAppearance.ENABLED,containerTitle:{id:"",args:[]},title:{id:"",args:[]},topbuttons:[],type:T.EnumTabType.TAB_MENU,menuType:T.TAB_MENU_TYPE_TOPIC,menubuttons:[],scrollToTop:!1};this.mainScreen.setMenuTab(e),this.paramSelectionScreen=new I.KeyboardScreen(this.mqttHandler,!0),this.registerScreen(this.paramSelectionScreen),this.weighingScreen=new h.WeighingScreen(this.mqttHandler,[]),
this.registerScreen(this.weighingScreen),t=[];for(let e=0;e<5;e++)this.weighingScreenButtons[e]=new l.Button(this.mqttHandler,this.weighingScreen,{buttonId:this.IDEXTEND_BUTTON_WEIGHING+e.toFixed(0),appearance:O.EnumAppearance.HIDDEN,label:n.createEmptyTextStructure()}),this.weighingScreenButtons[e].publish(),t.push("/QAPP/"+this.weighingScreenButtons[e].getTopic());this.mqttHandler.publish(this.weighingScreen.getBarButtonId(),JSON.stringify(t)),this.weighingSplitScreen=new m.WeighingSplitScreen(this.mqttHandler,[]),this.registerScreen(this.weighingSplitScreen),t=[];for(let e=0;e<5;e++)this.weighingSplitScreenButtons[e]=new l.Button(this.mqttHandler,this.weighingSplitScreen,{buttonId:this.IDEXTEND_BUTTON_WEIGHING+"SPLIT"+e.toFixed(0),appearance:O.EnumAppearance.HIDDEN,label:n.createEmptyTextStructure()}),this.weighingSplitScreenButtons[e].publish(),t.push("/QAPP/"+this.weighingSplitScreenButtons[e].getTopic())
;this.mqttHandler.publish(this.weighingSplitScreen.getBarButtonId(),JSON.stringify(t)),this.tabScreen=new u.TabScreen(this.mqttHandler),this.registerScreen(this.tabScreen)}constructor_states(){this.STATE_FUNCTIONS.forEach(t=>{try{if(""===this[t]())return;let a=JSON.parse(this[t](void 0,"GET_EVENT_LISTENER"));a.push(r.EV_HMI_BTN_CLICKED,r.EV_HMI_PARAM_CHANGED,_.QAPP_TIMER_EVENT,_.QAPP_INTERVAL_EVENT,_.IMMEDIATE_EVENT),this.STATES[this[t]()]={_onEnter:function(e){e[t](this,"onEnter")},_onExit:function(a){a[t](this,"onExit");for(const t of Object.values(e.btn))try{a.mqttHandler.publish(t.getTopic(),"")}catch(t){}v={},e.btn=new Proxy(v,U);for(let t=0;t<a.weighingScreenButtons.length;t++)a.weighingScreenButtons[t].setAppearance(O.EnumAppearance.HIDDEN);for(let t=0;t<a.weighingSplitScreenButtons.length;t++)a.weighingSplitScreenButtons[t].setAppearance(O.EnumAppearance.HIDDEN);a.hideBargraph()}},a.includes(r.EV_HMI_BTN_CLICKED)&&(this.STATES[this[t]()].EV_HMI_BTN_CLICKED=function(e,a){
e[t](this,a)}),a.includes(r.EV_HMI_PARAM_CHANGED)&&(this.STATES[this[t]()].EV_HMI_PARAM_CHANGED=function(e,a){e[t](this,a)}),a.includes(r.EV_HMI_PARAM_DETAIL)&&(this.STATES[this[t]()].EV_HMI_PARAM_DETAIL=function(e,a){e[t](this,a)}),this.STATES[this[t]()].EV_MQTT_UPDATE=function(e,i){a.includes(o.EV_MQTT_UPDATE)&&e[t](this,i)},a.includes(_.IMMEDIATE_EVENT)&&(this.STATES[this[t]()].IMMEDIATE_EVENT=function(e,a){e[t](this,a)}),a.includes(r.EV_REST_REQUEST)&&(this.STATES[this[t]()].EV_REST_REQUEST=function(e,a){e[t](this,a)}),a.includes(E.MQTT_ADMIN_EVENT)&&(this.STATES[this[t]()].MQTT_ADMIN_EVENT=function(e,a){e[t](this,a)}),a.includes(E.MQTT_ADMIN_EVENT_PACKET_SENT)&&(this.STATES[this[t]()].MQTT_ADMIN_EVENT_PACKET_SENT=function(e,a){e[t](this,a)}),a.includes(_.SIMPLE_EVENT)&&(this.STATES[this[t]()].SIMPLE_EVENT=function(e,a){e[t](this,a)}),a.includes(_.QAPP_SYNC_CALL_DONE_EVENT)&&(this.STATES[this[t]()].QAPP_SYNC_CALL_DONE_EVENT=function(e,a){e[t](this,a)}),
a.includes(_.QAPP_ASYNC_CALL_DONE_EVENT)&&(this.STATES[this[t]()].QAPP_ASYNC_CALL_DONE_EVENT=function(e,a){e[t](this,a)}),a.includes(_.QAPP_ASYNC_CALL_FAIL_EVENT)&&(this.STATES[this[t]()].QAPP_ASYNC_CALL_FAIL_EVENT=function(e,a){e[t](this,a)}),this.STATES[this[t]()].QAPP_TIMER_EVENT=function(e,i){a.includes(_.QAPP_TIMER_EVENT)&&e[t](this,i)},this.STATES[this[t]()].QAPP_INTERVAL_EVENT=function(e,i){a.includes(_.QAPP_INTERVAL_EVENT)&&e[t](this,i)}}catch(t){}})}adaptFsmStates(t){super.adaptFsmStates(t);for(let a of Object.keys(t)){const i=t[a].EV_MQTT_UPDATE,s=t[a].EV_HMI_BTN_CLICKED,n=t[a].QAPP_TIMER_EVENT,r=t[a].QAPP_INTERVAL_EVENT;t[a].EV_MQTT_UPDATE=function(t,e){void 0!==i&&i.call(this,t,e),e&&e.payload&&e.payload.topic===P.MqttTopics.WEIGHING_VALUE_NET&&t.handleBargraphUpdate(e),t.report_handleReportingMessages(e)},t[a].EV_HMI_BTN_CLICKED=function(t,e){if(!0===t.rejectFastButtonPress){
if(p.getDateTime("ms")<t.rejectFastButtonPressUntilTimestamp)return void console.log("wfRunner: Fast button press rejected");t.rejectFastButtonPress=!1}t.rejectFastButtonPress=!0,t.rejectFastButtonPressUntilTimestamp=p.getDateTime("ms")+t.rejectFastButtonPressWaitDuration,void 0!==s&&s.call(this,t,e)},t[a].QAPP_TIMER_EVENT=function(t,e){void 0!==n&&n.call(this,t,e),t.report_handleQueuedPrintBlocks(e)},t[a].QAPP_INTERVAL_EVENT=function(t,a){void 0!==r&&r.call(this,t,a),M.isObject(a)&&M.isString(a.payload)&&a.payload===e.PREVENT_AUTO_LOGOUT_INTERVAL_EVENT&&t.preventAutoLogout("justOnce")}}}postInit(){super.postInit(),this.mqttHandler.subscribe(P.MqttTopics.WEIGHING_VALUE_NET),this.mqttHandler.subscribe(P.MqttTopics.REPORTING_PRINTABLE_VALUE),this.mqttHandler.subscribe(P.MqttTopics.MESSAGE_HANDLER_MESSAGE),this.mqttHandler.subscribe(P.MqttTopics.METROLOGY_APPROVED_FOR_VERIFICATION),this.mqttHandler.subscribe(P.MqttTopics.METROLOGY_RANGES)}handleMqttEventsGlobally(t){
switch(t.payload.topic){case P.MqttTopics.METROLOGY_APPROVED_FOR_VERIFICATION:{const e=JSON.parse(t.payload.value.toString());return void(M.isBoolean(e.isApproved)&&(this.DEVICE_APPROVED=e.isApproved,console.log("wfRunner: Changed approval state")))}case P.MqttTopics.METROLOGY_RANGES:return void this.updateMetrology()}}updateMetrology(){return this.Metrology=d.getMetrology(),this.Metrology.unit!==C.EnumUnit.NONE}onSuspending(){super.onSuspending(),this.showLoadingScreen(),this.hideInput(),this.paramSelectionScreen.hide(),this.weighingScreen.hide(),this.weighingSplitScreen.hide(),this.mainScreen.hide(),this.tabScreen.hide(),this.hideMsgBox(),this.preventAutoLogout("disableConstantly"),this.cancelTimer(this.reportingQueueTimer),this.reportingQueueTimer=void 0,this.mqttHandler.publish(P.MqttTopics.HMI_VISUAL_SCREEN,JSON.stringify({closed:!0})),this.weighingProxy.clearTareAll(),this.mqttHandler.unsubscribeTopics()}_____________________GUI__________________(){}l(t,e){
if(null!=e&&void 0!==e){if(this.localizerTextBuffer.hasOwnProperty(t)||(this.localizerTextBuffer[t]=this.localizerProxy.getText(t)),M.isBoolean(e))return this.localizerTextBuffer[t].valueOf();if(Array.isArray(e)){let a=this.localizerTextBuffer[t].valueOf();for(let t=0;t<e.length;t++)a=a.replace(new RegExp("%arg"+t.toFixed(0)+"%","g"),e[t]);return a}}return t}preloadTextBuffer(t){let e=[];for(let a=0;a<t.length;a++)this.localizerTextBuffer.hasOwnProperty(t[a])||e.push({id:t[a],args:[]});if(e.length<=0)return!0;const a=this.localizerProxy.getTexts(e);if(a.length===t.length){for(let e=0;e<t.length;e++)this.localizerTextBuffer[t[e]]=a[e];return!0}return!1}rejectFastButtonPressSetNextDuration(t){this.rejectFastButtonPress=!0,this.rejectFastButtonPressUntilTimestamp=p.getDateTime("ms")+t}createWeighingScreenButton(t,e,a){let i=n.createEmptyTextStructure();return"string"==typeof e?i.id=e:i=e,i.id=void 0!==i.id?i.id:"",void 0===a&&(a=O.EnumAppearance.ENABLED),
this.weighingScreenButtons[t].setAppearance(a),this.weighingScreenButtons[t].setLabel(i),this.weighingScreenButtons[t].publish(),this.weighingScreenButtons[t]}showBargraph(t,e,a,i,s){void 0!=t?(this.bargraphObject.areaCount=1,this.bargraphObject.effectiveMinimum=0,this.bargraphObject.effectiveMaximum=this.Metrology.max,void 0!==t&&void 0!==e&&void 0!==a&&(M.isNumber(t)?this.bargraphObject.target=t:this.bargraphObject.target=C.convertToTargetUnit(t,this.Metrology.unit).value,M.isNumber(e)?this.bargraphObject.min1=e:this.bargraphObject.min1=C.convertToTargetUnit(e,this.Metrology.unit).value,M.isNumber(a)?this.bargraphObject.max1=a:this.bargraphObject.max1=C.convertToTargetUnit(a,this.Metrology.unit).value,this.bargraphObject.min1<this.bargraphObject.target&&this.bargraphObject.target<this.bargraphObject.max1&&(this.bargraphObject.areaCount=4,
this.bargraphObject.effectiveMinimum=this.bargraphObject.min1<=this.bargraphObject.effectiveMinimum?this.bargraphObject.min1-this.Metrology.d:this.bargraphObject.effectiveMinimum,this.bargraphObject.effectiveMaximum=this.bargraphObject.max1>=this.bargraphObject.effectiveMaximum?this.bargraphObject.max1+this.Metrology.d:this.bargraphObject.effectiveMaximum)),4===this.bargraphObject.areaCount&&void 0!==i&&void 0!==s&&(M.isNumber(i)?this.bargraphObject.min2=i:this.bargraphObject.min2=C.convertToTargetUnit(i,this.Metrology.unit).value,M.isNumber(s)?this.bargraphObject.max2=s:this.bargraphObject.max2=C.convertToTargetUnit(s,this.Metrology.unit).value,this.bargraphObject.min2<this.bargraphObject.min1&&this.bargraphObject.max1<this.bargraphObject.max2&&(this.bargraphObject.areaCount=6,this.bargraphObject.effectiveMinimum=this.bargraphObject.min2<=this.bargraphObject.effectiveMinimum?this.bargraphObject.min2-this.Metrology.d:this.bargraphObject.effectiveMinimum,
this.bargraphObject.effectiveMaximum=this.bargraphObject.max2>=this.bargraphObject.effectiveMaximum?this.bargraphObject.max2+this.Metrology.d:this.bargraphObject.effectiveMaximum)),this.mqttHandler.publish(P.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify({appearance:O.EnumAppearance.ENABLED,areas:this.bargraphObject.areaCount.toFixed(0)})),this.bargraphObject.updateTimestamp=0,this.bargraphObject.active=this.bargraphObject.areaCount>1):this.bargraphObject.areaCount>1&&(this.mqttHandler.publish(P.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify({appearance:O.EnumAppearance.ENABLED,areas:this.bargraphObject.areaCount.toFixed(0)})),this.bargraphObject.updateTimestamp=0,this.bargraphObject.active=!0)}hideBargraph(){this.bargraphObject.active=!1,this.mqttHandler.publish(P.MqttTopics.HMI_CHECKBARGRAPH_STATUS,JSON.stringify({appearance:O.EnumAppearance.HIDDEN,areas:this.bargraphObject.areaCount.toFixed(0)}))}handleBargraphUpdate(t){
if(1==this.bargraphObject.active&&Date.now()-this.bargraphObject.updateTimestamp>200){const e=this.parse_MQTT_Weight(t,"any");if(e){let t={area:1,perc:0},a=0,i=0,s=e.value;if(M.isNumber(s)){switch(this.bargraphObject.areaCount){case 4:s<this.bargraphObject.min1?(t.area=1,a=this.bargraphObject.effectiveMinimum,i=this.bargraphObject.min1):s<this.bargraphObject.target?(t.area=2,a=this.bargraphObject.min1,i=this.bargraphObject.target):s<=this.bargraphObject.max1?(t.area=3,a=this.bargraphObject.target,i=this.bargraphObject.max1):(t.area=4,a=this.bargraphObject.max1,i=this.bargraphObject.effectiveMaximum);break;case 6:s<this.bargraphObject.min2?(t.area=1,a=this.bargraphObject.effectiveMinimum,i=this.bargraphObject.min2):s<this.bargraphObject.min1?(t.area=2,a=this.bargraphObject.min2,i=this.bargraphObject.min1):s<this.bargraphObject.target?(t.area=3,a=this.bargraphObject.min1,i=this.bargraphObject.target):s<=this.bargraphObject.max1?(t.area=4,a=this.bargraphObject.target,
i=this.bargraphObject.max1):s<=this.bargraphObject.max2?(t.area=5,a=this.bargraphObject.max1,i=this.bargraphObject.max2):(t.area=6,a=this.bargraphObject.max2,i=this.bargraphObject.effectiveMaximum)}t.perc=(s-a)/Math.abs(i-a)*100,t.perc=Math.max(t.perc,0),t.perc=Math.min(t.perc,100)}else e.info&&"HIGH"===e.info.toString().toUpperCase()?(s=this.bargraphObject.effectiveMaximum,t.area=this.bargraphObject.areaCount,t.perc=100):(s=this.bargraphObject.effectiveMinimum,t.area=1,t.perc=0);this.mqttHandler.publish(P.MqttTopics.HMI_CHECKBARGRAPH_VALUE,JSON.stringify(t))}this.bargraphObject.updateTimestamp=Date.now()}}createWeighingSplitScreenButton(t,e,a){let i=n.createEmptyTextStructure();return M.isString(e)?i.id=e:i=e,i.id=void 0!==i.id?i.id:"",void 0===a&&(a=O.EnumAppearance.ENABLED),this.weighingSplitScreenButtons[t].setAppearance(a),this.weighingSplitScreenButtons[t].setLabel(i),this.weighingSplitScreenButtons[t].publish(),this.weighingSplitScreenButtons[t]}createParameterButton(t,e){
return this.createButton(this.mainScreen,this.IDEXTEND_BUTTON_PARAM,t,e)}createMenuButton(t,e,a){return this.createButton(this.mainScreen,this.IDEXTEND_BUTTON_MENU,t,e,a)}createMessageButton(t,e){return this.createButton(this.mainScreen,this.IDEXTEND_BUTTON_MSG,t,e)}createTabscreenButton(t,e){return this.createButton(this.tabScreen,this.IDEXTEND_BUTTON_TAB,t,e)}createButton(t,e,a,i,s){let r=n.createEmptyTextStructure();M.isString(a)?r.id=a:r=a,r.id=void 0!==r.id?r.id:"",void 0===i&&(i=O.EnumAppearance.ENABLED),M.isBoolean(s)||(s=!0);let o=e;o+=((r.id.length+1)*Math.floor(100*Math.random()+1)).toString().substring(-4)+Math.floor(p.getDateTime("ms")).toString().substring(-4)+Math.floor(10*Math.random()+1).toString();let _=new l.Button(this.mqttHandler,t,{buttonId:o,appearance:i,label:r});return!0===s&&_.publish(),_}showMessageBox(t,e,a,i,s,n){if(M.isObject(t))return void super.showMessageBox(t);if(t=t,
void 0===e||void 0===a||!Array.isArray(i))return void console.log("wfRunner: showMessageBox: missing arguments");let r=[];for(let t=0;t<i.length;t++)r[t]={appearance:i[t].getAppearance(),label:i[t].getLabel(),id:i[t].getButtonId()};M.isString(e)&&(e={id:e,args:[]}),e=e;let o=[];if(Array.isArray(a))o=a;else{let t="";M.isString(a)&&(t=this.l(a,!0));let e=t.split("<br>");1===e.length&&(e=t.split("\n"));for(var _=0;_<e.length;_++)o.push({id:e[_],args:[]})}s=M.isString(s)&&7===s.length?s:"#FFFFFF",M.isNumber(n)||(n=1),n=n;let E={type:t,title:e,textList:o,buttons:r,backgroundColor:s};this.messageBoxesCache[n]=E,n>=this.getMostPriorMessageBoxIndex()&&this.showMostPriorMessageBox(),console.log("wfRunner: Number of messages in cache: "+Object.keys(this.messageBoxesCache).length)}hideMsgBox(t){if(M.isNumber(t)||(t=1),-1===(t=t))return this.hideMostPriorMessageBox(),void(this.messageBoxesCache={});t===this.getMostPriorMessageBoxIndex()&&this.hideMostPriorMessageBox(),
this.messageBoxesCache.hasOwnProperty(t)&&delete this.messageBoxesCache[t],this.showMostPriorMessageBox(),console.log("wfRunner: Number of messages in cache: "+Object.keys(this.messageBoxesCache).length)}showMostPriorMessageBox(){const t=this.getMostPriorMessageBoxIndex();t>0&&(super.hideMsgBox(),super.showMessageBox(this.messageBoxesCache[t]))}hideMostPriorMessageBox(){super.hideMsgBox()}getMostPriorMessageBoxIndex(){let t=d.sortKeys(this.messageBoxesCache);return t.length>0?parseInt(t[t.length-1]):0}setWeighingScreenParams(t,e,a,i,s,n){return this._setWeighingScreenParams(this.weighingScreen,t,e,a,i,s,n)}setWeighingSplitScreenParams(t,e,a,i,s,n){return this._setWeighingScreenParams(this.weighingSplitScreen,t,e,a,i,s,n)}_setWeighingScreenParams(t,e,a,i,s,r,o){let _=n.createEmptyTextStructure();M.isString(a)?_.id=a:_=a;let E=n.createEmptyTextStructure();M.isString(i)?E.id=i:E=i,M.isString(r)||(r=this.QAPP_TOKEN+"_WGHSCR_PARAM_"+e.toFixed()),M.isBoolean(o)||(o=!1)
;const l=new c.Param(this.mqttHandler,{id:r,header:_,title:E,type:O.EnumParameterTypes.PARAM_STRING,appearance:!0===o?O.EnumAppearance.ENABLED_EDITABLE:O.EnumAppearance.ENABLED,info:{minimum:{length:0},maximum:{length:1/0}},value:{string:s}});return l.publish(),1===e?t.setParam1(l.getPublishedId()):2===e&&t.setParam2(l.getPublishedId()),l}getSplitScreenTabParamList(t){let e={id:this.IDEXTEND_SCREEN+Math.floor(Math.random()*Math.floor(1e6)).toString(),appearance:O.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_PARAMLIST,containerTitle:n.createEmptyTextStructure(),title:n.createEmptyTextStructure(),topbuttons:[],displayHeader:!1,params:[]};for(var a=0;a<t.length;a++){let i=new c.Param(this.mqttHandler,{id:this.IDEXTEND_PARAM+Math.floor(Math.random()*Math.floor(1e5)).toString(),type:O.EnumParameterTypes.PARAM_STRING,appearance:O.EnumAppearance.ENABLED,value:{string:t[a].value},title:{id:t[a].title,args:[]},header:{id:"",args:[]},info:{maximum:{length:NaN},minimum:{length:NaN}}})
;i.publish(),e.params.push(i.getPublishedId())}return e}setSplitScreenTabHeader(t,e){if(t>0)for(let e=0;e<t;e++){let t=this.weighingSplitScreen.getTabApi().getTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString());t&&void 0!==t||this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString())}let a=this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString(),i=this.weighingSplitScreen.getTabApi().getTab(a);i&&void 0!==i||(i=this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString())),(i=i).setTabTitle({id:e,args:[]})}setSplitScreenTabParamList(t,e,a,i,s){if(M.isBoolean(s)||(s=!0),t>0)for(let e=0;e<t;e++){let t=this.weighingSplitScreen.getTabApi().getTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString());t&&void 0!==t||this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString())}let r=this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString(),o=this.weighingSplitScreen.getTabApi().getTab(r)
;o&&void 0!==o||(o=this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString())),o=o;let _=n.createEmptyStringParameter();M.isString(a)?(_.value.string=a,_.info={minimum:{length:NaN},maximum:{length:NaN}}):_=a,_.id=this.IDEXTEND_PARAM+"SPLITSCREEN_"+t.toString()+"_PARAM"+e,_.appearance=O.EnumAppearance.ENABLED,_.title={id:void 0!==i?i:"",args:[]};const E=new c.Param(this.mqttHandler,_);let l=o.getTabParams();l.includes(E.getPublishedId())||l.push(E.getPublishedId()),o.setTabParams(l),!0===s&&o.publishTabParams()}setSplitScreenTabText(t,e,a){if(t>0)for(let e=0;e<t;e++){let t=this.weighingSplitScreen.getTabApi().getTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString());t&&void 0!==t||this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+e.toString())}let i=this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString(),s=this.weighingSplitScreen.getTabApi().getTab(i);s&&void 0!==s||(s=this.addSplitScreenTab(this.IDEXTEND_SCREEN+"SPLITSCREEN_"+t.toString())),s=s
;let n=new c.Param(this.mqttHandler,{id:this.IDEXTEND_PARAM+"SPLITSCREEN_"+t.toString()+"_TEXT",type:O.EnumParameterTypes.PARAM_STRING,appearance:O.EnumAppearance.ENABLED,value:{string:e},title:{id:"",args:[]},header:{id:"",args:[]},info:{maximum:{length:NaN},minimum:{length:NaN}}});n.publish();let r=s.getTabParams();r.includes(n.getPublishedId())||r.push(n.getPublishedId()),s.setTabParams(r),void 0!==a&&s.setTabTitle({id:a,args:[]}),s.publishTabParams()}addSplitScreenTab(t,e){let a={id:t,appearance:O.EnumAppearance.ENABLED,type:T.EnumTabType.TAB_PARAMLIST,containerTitle:n.createEmptyTextStructure(),title:n.createEmptyTextStructure(),topbuttons:[],displayHeader:!1,params:[]};return this.weighingSplitScreen.getTabApi().addParamListTab(t,a),this.weighingSplitScreen.getTabApi().publishTabList(),this.weighingSplitScreen.getTabApi().getTab(t)}_____________________PARAMETER_INPUT__________________(){}openESignature(){return this.hideMostPriorMessageBox(),
this.mqttHandler.publish(P.MqttTopics.ESIGNATURE_PERFORM,JSON.stringify({appearance:O.EnumAppearance.ENABLED})),!0}openInputText(t,e,a,i,s){let r=n.createEmptyStringParameter();r.id=t,r.appearance=O.EnumAppearance.ENABLED;let o=n.createEmptyTextStructure();return M.isString(e)?o.id=e:o=e,r.header=o,r.title=o,r.value.string=M.isString(a)?a:"",r.info={minimum:{length:M.isNumber(i)?i:0},maximum:{length:M.isNumber(s)?s:255}},this.mqttHandler.publish(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.ENABLED,param:r})),!0}openInputDateTime(t,e,a,i,s){let r=n.createEmptyDateTimeParameter();r.id=t,r.appearance=O.EnumAppearance.ENABLED;let o=n.createEmptyTextStructure();return M.isString(e)?o.id=e:o=e,r.header=o,r.title=o,r.value.timestamp=M.isNumber(a)?a:p.getDateTime("s",void 0,a,"iso"),r.info={isDate:!M.isBoolean(i)||i,isTime:!M.isBoolean(s)||s},this.mqttHandler.publish(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.ENABLED,
param:r})),!0}openInputNumber(t,e,a,i,s,r){let o=n.createEmptyQuantityParameter();o.id=t,o.appearance=O.EnumAppearance.ENABLED;let _=n.createEmptyTextStructure();M.isString(e)?_.id=e:_=e,o.header=_,o.title=_;let E={value:0,unit:C.EnumUnit.NONE,decimals:0},l=[];if(M.isNumber(a)?l.push(a.toString()):M.isObject(a)&&(l.push(C.formatQuantityParam_numberOnly(a)),E=a),o.directInput=!0,M.isObject(r)&&r.length>0){r=r;for(let t=0;t<r.length;t++){let e="";M.isNumber(r[t])?e=r[t].toString():M.isObject(r[t])&&(e=C.formatQuantityParam_numberOnly(r[t])),l.indexOf(e)>=0||l.push(e)}l.length>1&&(o.directInput=!1)}return o.value={decimals:E.decimals,preferredDecimals:E.decimals,numbers:l,unit:C.getUnitString(E.unit)},(i=M.isNumber(i)?i:-1/0)>(s=M.isNumber(s)?s:1/0)&&(s=1/0),o.info={minimum:{value:i.toString()},maximum:{value:s.toString()}},this.mqttHandler.publish(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.ENABLED,param:o})),!0}openInputSelection(t,e,a,i,s){
let r,o={id:""},_=[];if(!0===(s=!!M.isBoolean(s)&&s)){r=n.createEmptyMultipleSelectionParameter(),void 0!=i&&M.isString(i)&&(i=[i]);for(let t=0;t<i.length;t++)_.push({id:i[t]})}else r=n.createEmptySelectionParameter(),void 0!=i&&(Array.isArray(i)&&i.length>0&&(i=i[0]),o.id=M.isString(i)?i:"");r.id=t,r.appearance=O.EnumAppearance.ENABLED;let E=n.createEmptyTextStructure();M.isString(e)?E.id=e:E=e,r.header=E,r.title=E;let l=[];for(let t=0;t<a.length;t++)if(""!==a[t].id){let e=n.createEmptyTextStructure();M.isString(a[t].text)?e.id=a[t].text:e=a[t].text,null==M.getObjectByID(l,a[t].id)&&l.push({id:a[t].id,text:e,appearance:M.isString(a[t].appearance)?a[t].appearance:O.EnumAppearance.ENABLED})}return r.info={options:l},r.type===O.EnumParameterTypes.PARAM_SELECTION?r.value.selection=o:r.type===O.EnumParameterTypes.PARAM_MULTIPLE_SELECTION&&(r.value.selections=_),this.mqttHandler.publish(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.ENABLED,param:r})),!0}
parseParamInput(t){let e="";return M.isObject(t)&&M.isString(t.type)&&t.type===r.EV_HMI_PARAM_CHANGED&&M.isObject(t.payload)&&M.isObject(t.payload.parameter)?{id:e=t.payload.parameter.id,isHandled:!0,get isValid(){if(t.payload.parameter.type===O.EnumParameterTypes.PARAM_STRING){if(M.isObject(t.payload.parameter.value)&&M.isString(t.payload.parameter.value.string))return!0}else if(t.payload.parameter.type===O.EnumParameterTypes.PARAM_SELECTION){if(M.isObject(t.payload.parameter.value)&&M.isObject(t.payload.parameter.value.selection)&&M.isString(t.payload.parameter.value.selection.id)&&M.isObject(t.payload.parameter.value.selection.text))return!0}else if(t.payload.parameter.type===O.EnumParameterTypes.PARAM_MULTIPLE_SELECTION){if(M.isObject(t.payload.parameter.value)&&M.isObject(t.payload.parameter.value.selections)&&Array.isArray(t.payload.parameter.value.selections))return!0}else if(t.payload.parameter.type===O.EnumParameterTypes.PARAM_QUANTITY){
if(M.isObject(t.payload.parameter.value)&&M.isObject(t.payload.parameter.value.numbers)&&M.isString(t.payload.parameter.value.numbers[0])&&M.isNumber(parseFloat(t.payload.parameter.value.numbers[0])))return!0}else if(t.payload.parameter.type===O.EnumParameterTypes.PARAM_DATE_TIME&&M.isObject(t.payload.parameter.value)&&M.isNumber(t.payload.parameter.value.timestamp))return!0;return!1},get rString(){return M.isObject(t.payload.parameter.value)&&M.isString(t.payload.parameter.value.string)?t.payload.parameter.value.string:""},get rInteger(){return M.isObject(t.payload.parameter.value)&&M.isObject(t.payload.parameter.value.numbers)&&M.isString(t.payload.parameter.value.numbers[0])&&M.isNumber(parseInt(t.payload.parameter.value.numbers[0]))?parseInt(t.payload.parameter.value.numbers[0]):NaN},get rFloat(){
return M.isObject(t.payload.parameter.value)&&M.isObject(t.payload.parameter.value.numbers)&&M.isString(t.payload.parameter.value.numbers[0])&&M.isNumber(parseFloat(t.payload.parameter.value.numbers[0]))?parseFloat(t.payload.parameter.value.numbers[0]):NaN},get rSelectionID(){return M.isObject(t.payload.parameter.value)&&M.isObject(t.payload.parameter.value.selection)&&M.isString(t.payload.parameter.value.selection.id)?t.payload.parameter.value.selection.id:""},get rMultipleSelectionIDs(){if(M.isObject(t.payload.parameter.value)&&M.isObject(t.payload.parameter.value.selections)&&Array.isArray(t.payload.parameter.value.selections)){let e=[];for(let a=0;a<t.payload.parameter.value.selections.length;a++)e.push(t.payload.parameter.value.selections[a].id);return e}return[]},get rDateTimeISO(){return M.isObject(t.payload.parameter.value)&&M.isNumber(t.payload.parameter.value.timestamp)?p.getDateTime("iso",void 0,t.payload.parameter.value.timestamp,"s"):p.getDateTime("iso",void 0,0)},
get rDateTimeISOtimezone(){return M.isObject(t.payload.parameter.value)&&M.isNumber(t.payload.parameter.value.timestamp)?p.getDateTime("isoTimezone",void 0,t.payload.parameter.value.timestamp,"s"):p.getDateTime("isoTimezone",void 0,0)},get rDateTimeSeconds(){return M.isObject(t.payload.parameter.value)&&M.isNumber(t.payload.parameter.value.timestamp)?t.payload.parameter.value.timestamp:0}}:{id:"",isHandled:!1,isValid:!1,get rString(){return""},get rInteger(){return 0},get rFloat(){return 0},get rSelectionID(){return""},get rMultipleSelectionIDs(){return[]},get rDateTimeISO(){return p.getDateTime("iso",void 0,0)},get rDateTimeISOtimezone(){return p.getDateTime("isoTimezone",void 0,0)},get rDateTimeSeconds(){return 0}}}hideInput(){this.mqttHandler.publish(P.MqttTopics.HMI_QAPP_PARAMETER_INPUT,JSON.stringify({appearance:O.EnumAppearance.HIDDEN,param:{}}))}_____________________EVENT_HANDLING__________________(){}parse_MQTT_Weight(t,e){
if(!(t&&t.payload&&t.payload.value&&t.payload.topic&&[P.MqttTopics.REPORTING_PRINTABLE_VALUE,P.MqttTopics.WEIGHING_WEIGHT_BLOCK,P.MqttTopics.WEIGHING_VALUE_NET,P.MqttTopics.WEIGHING_VALUE_GROSS,P.MqttTopics.WEIGHING_VALUE_TARE,P.MqttTopics.WEIGHING_VALUE_TARE1,P.MqttTopics.WEIGHING_VALUE_TARE2].includes(t.payload.topic)))return null;void 0===e&&(e="any");const a=JSON.parse(t.payload.value.toString());let i=!1,s=!1,n=!1,r={value:NaN,unit:C.EnumUnit.NONE,decimals:0,timestamp:p.getDateTime("ms"),deviceserial:this.SERIAL_NUMBER};if(a&&a.alibiId&&a.alibiId>0&&t.payload.topic&&t.payload.topic===P.MqttTopics.REPORTING_PRINTABLE_VALUE){if("STABLE"!==a.state)return null;if(r.alibiId=a.alibiId,a.hasOwnProperty("weightBlock")&&a.weightBlock.length>0&&a.weightBlock[0].hasOwnProperty("value")&&(r.value=parseFloat(a.weightBlock[0].value.number),M.isNumber(r.value)||(r.info=a.weightBlock[0].value.number),M.isNumber(r.value)&&"-"===a.weightBlock[0].value.sign&&(r.value*=-1),
r.decimals=a.weightBlock[0].value.decimals,r.unit=L.UnitEnum_Lib2Api(a.weightBlock[0].value.unit),r.stable=a.weightBlock[0].value.isStable,i=a.weightBlock[0].value.isSpecial,s=a.weightBlock[0].value.isInvalid,n=a.weightBlock[0].value.isWarning,M.isNumber(r.value))){if(r.alibi=C._formatQuantityParam_numberOnly(r.value,r.decimals),M.isNumber(a.weightBlock[0].value.auxiliaryDigits)&&a.weightBlock[0].value.auxiliaryDigits>0){r.auxiliaryDigits=a.weightBlock[0].value.auxiliaryDigits;let t=r.alibi.length-(a.weightBlock[0].value.auxiliaryDigits+(a.weightBlock[0].value.auxiliaryDigits>r.decimals?1:0)),e=r.alibi.substring(0,t)+"[";r.alibi=e+r.alibi.substring(t)+"]"}r.stable&&(r.alibi+=" "+C.getUnitString(r.unit))}}else if(a&&a.id&&a.id==P.MqttTopics.WEIGHING_WEIGHT_BLOCK){
if(a.hasOwnProperty("parameters")&&a.parameters.length>0)for(var o=0;o<a.parameters.length;o++)if(a.parameters[o].id&&a.parameters[o].id==P.MqttTopics.WEIGHING_WEIGHT_BLOCK+"/ORIGINAL"&&a.parameters[o].parameters&&a.parameters[o].parameters.length>0){r.value=parseFloat(a.parameters[o].parameters[0].value.number),M.isNumber(r.value)||(r.info=a.parameters[o].parameters[0].value.number),M.isNumber(r.value)&&"-"===a.parameters[o].parameters[0].value.sign&&(r.value*=-1),r.decimals=a.parameters[o].parameters[0].value.decimals,r.unit=L.UnitEnum_Lib2Api(a.parameters[o].parameters[0].value.unit),r.stable=a.parameters[o].parameters[0].value.isStable,M.isNumber(a.parameters[o].parameters[0].value.auxiliaryDigits)&&a.parameters[o].parameters[0].value.auxiliaryDigits>0&&(r.auxiliaryDigits=a.parameters[o].parameters[0].value.auxiliaryDigits),i=a.parameters[o].parameters[0].value.isSpecial,s=a.parameters[o].parameters[0].value.isInvalid,n=a.parameters[o].parameters[0].value.isWarning;break}
}else a&&a.id&&[P.MqttTopics.WEIGHING_VALUE_NET,P.MqttTopics.WEIGHING_VALUE_GROSS,P.MqttTopics.WEIGHING_VALUE_TARE,P.MqttTopics.WEIGHING_VALUE_TARE1,P.MqttTopics.WEIGHING_VALUE_TARE2].indexOf(a.id)>=0&&a.hasOwnProperty("value")&&(r.value=parseFloat(a.value.number),M.isNumber(r.value)||(r.info=a.value.number),M.isNumber(r.value)&&"-"===a.value.sign&&(r.value*=-1),r.decimals=a.value.decimals,r.unit=L.UnitEnum_Lib2Api(a.value.unit),r.stable=a.value.isStable,M.isNumber(a.value.auxiliaryDigits)&&a.value.auxiliaryDigits>0&&(r.auxiliaryDigits=a.value.auxiliaryDigits),i=a.value.isSpecial,s=a.value.isInvalid,n=a.value.isWarning);return i&&M.isNumber(r.value)&&(r.info=r.value.toString(),r.value=Number.NaN),"any"!==e&&!M.isNumber(r.value)||("valid"===e||"alibi"===e)&&(i||s)?null:"alibi"===e&&(n||void 0===r.alibiId||r.alibiId<0)?null:r}parse_MQTT_WebserviceRequest(t){if(!t||!t.payload)return;let e={isSuccess:!0,error:"",statusCode:0,headers:{},body:null,url:"",metadata:""}
;if(e.metadata=M.isString(t.payload.metadata)?t.payload.metadata:"",void 0===t.payload.result)return e.isSuccess=!1,e.error="Missing WebserviceRequest Promise data",e;try{e.isSuccess=!0===t.payload.result.isSuccess,e.error=t.payload.result.error.toString(),e.statusCode=1*t.payload.result.statusCode,e.headers=t.payload.result.headers,e.body=t.payload.result.body,e.url=t.payload.result.url.toString()}catch(t){return e.isSuccess=!1,e.error="Malformated WebserviceRequest Promise data",e}return e.isSuccess&&M.isString(t.payload.sourceState)&&t.payload.sourceState!==this.getCurrentState()?void 0:(e.isSuccess&&e.statusCode>=300&&(e.isSuccess=!1,e.error="Server responded with status code: "+e.statusCode),e)}parse_MQTT_ESignature(t){if(M.isObject(t)&&M.isString(t.type)&&t.type===o.EV_MQTT_UPDATE&&M.isObject(t)&&M.isObject(t.payload)&&t.payload.topic===P.MqttTopics.ESIGNATURE_RESULT){let e=JSON.parse(t.payload.value.toString());return this.showMostPriorMessageBox(),{isHandled:!0,
signatureSucessful:e.signatureSucessful,hasUserPassword:e.hasUserPassword}}return{isHandled:!1,signatureSucessful:!1,hasUserPassword:!1}}_____________________REPORTING__________________(){}report_clearPrintQueue(){return this.reportingQueueActive=!1,this.reportingPrintBlocksQueue=[],this.reportingPrintItemIdentifierMap={},this.reportingProxy.clearPrintQueue().isSuccess()}report_getTitleHeaderValue(t,e,a){return this.report_getKeyValuePair(e,a,t)}report_getValueString(t){return this.report_getKeyValuePair("","",t)}report_getTitleValue(t,e){return this.report_getKeyValuePair("",e,t)}report_getKeyValuePair(t,e,a){let i;return null!=a&&void 0!==a&&""!==a||(a=" "),null!=t&&void 0!==t&&""!==t||(t=" "),(i=M.isString(e)?this.report_getStringParam("",a,t,e):M.isObject(e)&&M.isNumber(e.value)&&M.isNumber(e.decimals)?this.report_getMeasureParam("",a,t,e):this.report_getStringParam("",a,t,"N.A.")).appearance=O.EnumAppearance.ENABLED,i}report_getStringParam(t,e,a,i){
let s=n.createEmptyStringParameter();return null!=e&&void 0!==e&&""!==e||(e=" "),null!=a&&void 0!==a&&""!==a||(a=" "),s.id=t,s.title.id=e,s.header.id=a,s.value.string=i,s.info={minimum:{length:0},maximum:{length:1e6}},s.appearance=O.EnumAppearance.ENABLED,s}report_getDateTimeParam(t,e,a){let i=n.createEmptyDateTimeParameter();return e=M.isString(e)?e.length>0?e:" ":B("_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME"),i.id=t,i.title.id=e,i.value.timestamp=a,i.appearance=O.EnumAppearance.ENABLED,i}report_getTextParam(t,e){let a=n.createEmptyTextParameter();return a.id=t,a.info.suppressTitle=!0,a.title.id=" ",a.header.id=" ",a.value.text.id=e,a.appearance=O.EnumAppearance.ENABLED,a}report_getDSDParam(t,e){let a=this.report_getTextParam(t,"WRONG DSD FORMAT"),i=-1;if(M.isNumber(e)?i=e:M.isObject(e)&&M.isNumber(e.value)&&(i=e.alibiId),M.isNumber(i)&&i>0){let e=this.reportingProxy.getAlibiRecord(i)
;a=e.isSuccess()?this.reportingProxy.getWeightFromAlibi(e):this.report_getTextParam(t,"MISSING DSD ENTRY ("+i.toFixed(0)+")")}return a.id=t,a.appearance=O.EnumAppearance.ENABLED,a}report_getDSD_IDParam(t,e){let a=this.report_getTextParam(t,"WRONG DSD FORMAT"),i=-1;return M.isNumber(e)?i=e:M.isObject(e)&&M.isNumber(e.value)&&(i=e.alibiId),M.isNumber(i)&&i>0&&(this.reportingProxy.getAlibiRecord(i).isSuccess()?(a=n.createEmptyAlibiIdentifier()).value.alibiIdentifier=i:a=this.report_getTextParam(t,"MISSING DSD ENTRY ("+i.toFixed(0)+")")),a.id=t,a.appearance=O.EnumAppearance.ENABLED,a}report_getQuantityParam(t,e,a,i){let s=n.createEmptyQuantityParameter();return null!=e&&void 0!==e&&""!==e||(e=" "),null!=a&&void 0!==a&&""!==a||(a=" "),s.id=t,s.title.id=e,s.header.id=a,M.isNumber(i)?(s.value.numbers[0]=i.toFixed(0),s.value.decimals=0,s.value.preferredDecimals=0,s.value.unit=" "):M.isObject(i)&&M.isNumber(i.value)&&(i=i,s.value.numbers[0]=C.formatQuantityParam_numberOnly(i),
s.value.decimals=i.decimals,s.value.preferredDecimals=i.decimals,s.value.unit=" "+C.getUnitString(i.unit)),s.appearance=O.EnumAppearance.ENABLED,s}report_getMeasureParam(t,e,a,i){let s=n.createEmptyMeasureParameter();return null!=e&&void 0!==e&&""!==e||(e=" "),null!=a&&void 0!==a&&""!==a||(a=" "),s.id=t,s.title.id=e,s.header.id=a,M.isNumber(i)?(s.value=n.createEmptyMeasureParameterValue(),s.value.mark=B(a,!0),s.value.sign=i<0?"-":"",s.value.number=i.toFixed(0),s.value.decimals=0,s.value.auxiliaryDigits=0,s.value.unit=" ",s.value.interval=1,s.value.isStable=!0,s.value.isSpecial=!1,s.value.isWarning=!1,s.value.isInvalid=!1):M.isObject(i)&&M.isNumber(i.value)&&(i=i,s.value=n.createEmptyMeasureParameterValue(),s.value.mark=B(a,!0),s.value.sign=i.value<0?"-":"",s.value.number=i.value.toFixed(i.decimals),s.value.decimals=i.decimals,s.value.auxiliaryDigits=void 0!==i.auxiliaryDigits?i.auxiliaryDigits:0,s.value.unit=" "+C.getUnitString(i.unit),s.value.interval=Math.pow(10,-1*i.decimals),
s.value.isStable=void 0!==i.stable&&i.stable,s.value.isSpecial=!1,s.value.isWarning=!1,s.value.isInvalid=!1),s.appearance=O.EnumAppearance.ENABLED,s}report_getCodeParam(t,e,a){let i=n.createEmptyBarcodeParameter();return a=void 0!==a?a:O.EnumBarcodeFormats.QR,i.id=t,i.title.id=" ",i.header.id=" ",i.value.string=e,i.value.format=a,i.appearance=O.EnumAppearance.ENABLED,i}report_enqueuePrintBlock(t,a,i,s,n,r){return M.isBoolean(i)||(i=!1),M.isBoolean(s)||(s=!1),M.isString(n)||(n=""),this.reportingPrintBlocksQueue.push({requestType:"ADD_PRINT_BLOCK",printItemIdentifierMapID:r,printItemIdentifierReference:-1,lines:a,blockHeader:t,redactable:i,timeoutTimestamp:-1,invalidationPreset:s,invalidationPresetComment:n}),!1===this.reportingQueueActive&&(this.reportingQueueActive=!0,this.reportingQueueTimer=this.addTimer(e.REPORTING_QUEUE_MINIMUM_WAIT_MS,e.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC),console.log("wfRunner: Start processing queued REPORTING requests")),!0}
report_enqueueInvalidateBlock(t,a,i){return M.isString(i)||(i=""),this.reportingPrintBlocksQueue.push({requestType:"SET_INVALIDATION",printItemIdentifierMapID:void 0,printItemIdentifierReference:a,lines:[],blockHeader:"",redactable:!0,timeoutTimestamp:-1,invalidationPreset:t,invalidationPresetComment:i}),!1===this.reportingQueueActive&&(this.reportingQueueActive=!0,this.reportingQueueTimer=this.addTimer(e.REPORTING_QUEUE_MINIMUM_WAIT_MS,e.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC),console.log("wfRunner: Start processing queued REPORTING requests")),!0}report_setupDestinationDirectory(t,e){void 0===t?t="CUBIS_"+this.getSerialNumber()+"_"+y(Date.now(),"yyyy-mm-dd_HH-MM-ss"):t.startsWith("/")&&(t=t.substring(1)),""===t&&(t="CUBIS_"+this.getSerialNumber()+"_"+y(Date.now(),"yyyy-mm-dd_HH-MM-ss")),void 0===e?e="":(e.endsWith("/")||(e+="/"),e.startsWith("/")&&(e=e.substring(1))),this.perform_InternalWebserviceRequest("reporting",D.RestMethodsREPORTING.setPathAndFilenameForNextReport,{
path:e+d.getCompliantFilename(t)})}report_printQueue(t,e){return(M.isString(t)||M.isString(e))&&this.report_setupDestinationDirectory(t,e),this.perform_InternalWebserviceRequest("reporting",D.RestMethodsREPORTING.printPrintQueueWithElectronicSignature,{}).isSuccess()}report_handleQueuedPrintBlocks(t){if(M.isObject(t)&&M.isString(t.payload)&&t.payload===e.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC){if(!1===this.reportingQueueActive)return;if(0===this.reportingPrintBlocksQueue.length)return console.log("wfRunner: Stopped REPORTING with empty queue"),this.reportingQueueActive=!1,void this.addToEventQueue(new _.ImmediateEvent({topic:e.REPORTING_QUEUE_DONE_EVENT,success:!1}));this.reportingPrintBlocksQueue[0].timeoutTimestamp<0&&(this.reportingPrintBlocksQueue[0].timeoutTimestamp=Date.now()+e.REPORTING_QUEUE_REQUEST_TIMEOUT,console.log("wfRunner: Started processing REPORTING request with ID #"+this.reportingPrintBlocksQueue[0].timeoutTimestamp.toString()))
;const t=R.cloneJSON(this.reportingPrintBlocksQueue[0]);this.reportingQueueActive=!0;let a=new S.CubisRestResponse(!1),i=!1;return"ADD_PRINT_BLOCK"===t.requestType?i=(a=this.reportingProxy.printParameters(t.lines,t.blockHeader,t.redactable)).isSuccess()&&a.rawReturns.printItemIdentifier>=0:"SET_INVALIDATION"===t.requestType&&(i=(a=this.report_setPrintBlockInvalidation(!0,t.printItemIdentifierReference,t.invalidationPresetComment)).isSuccess()),!1===i?void(Date.now()<t.timeoutTimestamp?this.reportingQueueTimer=this.addTimer(e.REPORTING_QUEUE_FAILED_WAIT_MS,e.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC):(console.log("wfRunner: Timeout for processing REPORTING request with ID #"+t.timeoutTimestamp.toString()),console.log("wfRunner: Cancelled processing queued REPORTING requests"),this.reportingPrintBlocksQueue=[],this.reportingQueueActive=!1,this.addToEventQueue(new _.ImmediateEvent({topic:e.REPORTING_QUEUE_DONE_EVENT,success:!1
})))):("ADD_PRINT_BLOCK"===t.requestType?(M.isString(t.printItemIdentifierMapID)&&(this.reportingPrintItemIdentifierMap[t.printItemIdentifierMapID]=a.rawReturns.printItemIdentifier),!0===t.invalidationPreset&&this.report_enqueueInvalidateBlock(!0,a.rawReturns.printItemIdentifier,t.invalidationPresetComment),console.log("wfRunner: Successfully printed new block (request ID #"+t.timeoutTimestamp.toString()+")"),this.reportingPrintBlocksQueue.splice(0,1)):"SET_INVALIDATION"===t.requestType&&(console.log("wfRunner: Successfully set redaction status for printItemIdentifier "+t.printItemIdentifierReference+" (request ID #"+t.timeoutTimestamp.toString()+")"),this.reportingPrintBlocksQueue.splice(0,1)),0===this.reportingPrintBlocksQueue.length?(console.log("wfRunner: Done all queued REPORTING requests"),this.reportingQueueActive=!1,void this.addToEventQueue(new _.ImmediateEvent({topic:e.REPORTING_QUEUE_DONE_EVENT,success:!0
}))):void(this.reportingQueueTimer=this.addTimer(e.REPORTING_QUEUE_MINIMUM_WAIT_MS,e.REPORTING_QUEUE_PROCESS_NEXT_ITEM_TOPIC)))}}report_setPrintBlockInvalidation(t,e,a){let i=-1;return M.isString(e)&&this.reportingPrintItemIdentifierMap.hasOwnProperty(e)?i=this.reportingPrintItemIdentifierMap[e]:M.isNumber(e)&&(i=e),!M.isNumber(i)||i<0?(console.log("wfRunner: call for setRedactionStatus failed due to missing printItemIdentifier"),new S.CubisRestResponse(!1)):(M.isString(a)||(a=""),this.reportingProxy.setRedactionStatus(i,t,a))}report_handleReportingMessages(t){if(M.isObject(t)&&M.isString(t.payload.topic)&&t.payload.topic===P.MqttTopics.MESSAGE_HANDLER_MESSAGE){let a={_id:-1,title:{id:"",args:[]}};try{a=JSON.parse(t.payload.value.toString())}catch(t){return}if(a.title.id.includes("ERROR861_")&&this.reportingPrintBlocksQueue.length>0&&this.messageHandlerProxy.removeMessage(a._id),
a.title.id.includes("ERROR860_"))return!0===this.reportingQueueActive&&(console.log("wfRunner: Stopped reporting queue because of error 860 (maximum number of lines)"),this.addToEventQueue(new _.ImmediateEvent({topic:e.REPORTING_QUEUE_DONE_EVENT,success:!1}))),this.reportingQueueActive=!1,void(this.reportingPrintBlocksQueue=[]);if(a.title.id.includes("ERROR360_")||a.title.id.includes("ERROR361_"))return!0===this.reportingQueueActive&&(console.log("wfRunner: Stopped reporting queue because interface is not prepared for protocol (error 360/361)"),this.addToEventQueue(new _.ImmediateEvent({topic:e.REPORTING_QUEUE_DONE_EVENT,success:!1}))),this.reportingQueueActive=!1,void(this.reportingPrintBlocksQueue=[])}}_____________________MISC__________________(){}sleep(t){let e=Math.floor(t/1e3),a=t-1e3*e,i=0;for(let t=0;t<e;t++)for(this.heartbeat({message:"busy sleep for a second",value:this.heartbeatCount++}),i=Date.now()+1e3;Date.now()<i;);for(this.heartbeat({message:"busy sleep rest ms",
value:this.heartbeatCount++}),i=Date.now()+a;Date.now()<i;);}preventAutoLogout(t){switch(t){case"justOnce":this.mqttHandler.publish(P.MqttTopics.HMI_EVENT,"auto_logout_timer_reset");break;case"enableConstantly":this.preventAutoLogout("justOnce"),this.preventAutoLogout("disableConstantly"),this.preventAutoLogoutInterval=this.addInterval(3e4,e.PREVENT_AUTO_LOGOUT_INTERVAL_EVENT);break;case"disableConstantly":this.cancelInterval(this.preventAutoLogoutInterval),this.preventAutoLogoutInterval=void 0}}perform_InternalWebserviceRequest(t,e,a){return d.perform_InternalWebserviceRequest(t,e,a)}perform_WebserviceRequest(t,e,a,s,n,r,o,_,E,l,u){return i.__awaiter(this,void 0,void 0,function*(){return d.perform_WebserviceRequest(t,e,a,s,n,r,o,_,E,l,u)})}areEqual(t,e){if(Date.now()-this.lastHeartbeatTimestamp>1e3&&(this.heartbeat({message:"areEqual check",value:this.heartbeatCount++}),this.lastHeartbeatTimestamp=Date.now()),null==t||void 0===t)return null==e||void 0===e
;if(null==e||void 0===e)return!1;if(typeof t!=typeof e)return!1;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t===e;for(let a of Object.keys(t)){if(!e.hasOwnProperty(a))return!1;if(!this.areEqual(t[a],e[a]))return!1}return!0}_____________________QAPPBASE_STUFF__________________(){}provideStartFsmStateAfterLotIdentifier(){return this.ENTRY_STATE}confIdentifierAspect(t,e=""){}addRemainingDataToPQ(){return[]}providePQInitTaskParams(){return[]}resumeAdvAspectIsForcedReinitModificationDetectedFn(){return!1}resumeAdvAspectIsReinitConditionDetectedFn(){return!0}calcResumeState(){return this.ENTRY_STATE}provideSpecificAdvFsmStates(){return this.STATES}doAddSampleDuringReinit2PQ(t){return!1}provideSamplePQParams(t){return[]}reinitWorkstate(){this.prepReinitializedWorkstate({identifiers:[],samples:[]})}initFromWorkstate(){}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0})
;const i=a(65),s=a(96),n=a(59),r=a(97),o=a(50),_=a(8),E=a(48),l=a(20),u=a(28),c=a(2),T=a(1),d=a(0),p="STATE_RECONFIG_DONE",A="STATE_LOT_IDENTIFIER_DONE";e.QAppAdvBase=class extends r.QAppWorkflowBase{constructor(t){super(t),this.advBaseStates={STATE_ASPECT_RESUME_ADV_REINIT_EXIT:{_onEnter:function(t){t.addToEventQueue(new _.ImmediateEvent(s.STATE_ASPECT_RESUME_ADV_REINIT_EXIT))},_onExit:function(t){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,e){e.payload===s.STATE_ASPECT_RESUME_ADV_REINIT_EXIT&&(t.reinitialize(),this.transition(t,t.skipConfigParamAspect?p:i.STATE_ASPECT_CFG_PARAM_EDIT_ENTER))}},STATE_RECONFIG_DONE:{_onEnter:function(t){t.addToEventQueue(new _.ImmediateEvent(p))},_onExit:function(t){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,e){e.payload===p&&(t.confIdentifierAspect(!0),this.transition(t,t.skipLotInput?A:E.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT))}},STATE_LOT_IDENTIFIER_DONE:{_onEnter:function(t){t.saveWorkstate(!0)},_onExit:function(t){},
_transTo:{},_transFrom:{},QAPP_SYNC_CALL_DONE_EVENT:function(t,e){e.payload===_.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE&&this.transition(t,s.STATE_ASPECT_RESUME_ADV_CONT_EXIT)}},STATE_ASPECT_RESUME_ADV_CONT_EXIT:{_onEnter:function(t){t.showLoadingScreen({id:"_QAPP_LIB_LOADING_OVERLAY_TEXT_PREP_CONT_APP",args:[t.getTaskName()]})},_onExit:function(t){},_transTo:{},_transFrom:{},MQTT_ADMIN_EVENT:function(t,e){t.checkForLoadingScreenEnableEvent(e)?(t.confIdentifierAspect(!0),t.aspects[E.IDENTIFIER_ASPECT].setLotIDs(t.workstate.measurementData.identifiers),t.restoreLastSelectedDisplayValueInfo(),t.initFromWorkstate(),t.addHeartbeatEvent("INIT_PRINTQUEUE_HEARTBEAT")):t.checkForCustomHeartbeatEvent(e,"INIT_PRINTQUEUE_HEARTBEAT")&&(console.log("QAppAdvBase: clearing printQueue."),t.reportingProxy.clearPrintQueue(),t.initPQ(!0)?(console.log("QAppAdvBase: init PQ fin"),
this.transition(t,t.calcResumeState())):(console.log("QAppAdvBase: there are more samples to print - add trigger to queue"),t.addToEventQueue(new _.SimpleEvent("STATE_ASPECT_RESUME_ADV_CONT_EXIT_contInitPQ"))))},SIMPLE_EVENT:function(t,e){"STATE_ASPECT_RESUME_ADV_CONT_EXIT_contInitPQ"===e.payload&&(t.initPQ(!1)?(console.log("QAppAdvBase: init PQ fin"),this.transition(t,t.calcResumeState())):(console.log("QAppAdvBase: there are more samples to print - add trigger to queue"),t.addToEventQueue(new _.SimpleEvent("STATE_ASPECT_RESUME_ADV_CONT_EXIT_contInitPQ"))))}}},this.skipConfigParamAspect=!1,this.skipLotInput=!1,this.workstate=void 0,this.isNewInitialized=!1,this.ignoreSaveWorkstate=!1,this.saveDisplayValueSelectionWithWorkstate=!1,this.initPQIdx=0,this.cfgParamAspect=new i.ConfigParamsAspect,this.registerAspect(this.cfgParamAspect),this.resAdvAspect=new s.ResumeAdvancedAspect,this.registerAspect(this.resAdvAspect),this.workflowTaskHandler=new n.TaskHandler}init(){
console.log("QAppAdvBase::init"),super.init()}postInit(){console.log("QAppAdvBase: postInit"),super.postInit(),this.confParamConfigAspect(),this.confResumeAdvAspect()}confParamConfigAspect(){console.log("QAppAdvBase::confParamConfigAspect"),this.aspects[i.CFG_PARAMS_ASPECT].configure({isValidFn:()=>this.cfgParamAspectIsValidFn(),updateTaskParameterFn:t=>this.cfgParamAspectUpdateTaskParameterFn(t),handleParamUpdateUserActionFn:(t,e)=>this.cfgParamAspectHandleParamUpdateUserActionFn(t,e),returnState:p,taskHandler:this.workflowTaskHandler})}confResumeAdvAspect(){console.log("QAppAdvBase::confResumeAdvAspect"),this.aspects[s.RESUME_ADV_ASPECT].configure({isForcedReinitModificationDetectedFn:()=>this.resumeAdvAspectIsForcedReinitModificationDetectedFn(),isReinitConditionDetectedFn:()=>this.resumeAdvAspectIsReinitConditionDetectedFn(),isContinueConditionDetectedFn:()=>this.resumeAdvAspectIsContinueConditionDetectedFn(),isPersitentWorkstatePresentFn:()=>{let t=void 0!==this.workstate
;return console.log("QAppAdvBase::isPersitentWorkstatePresentFn: ",t),t}})}confIdentifierAspect(t,e=""){console.log("QAppAdvBase::confIdentifierAspect"),this.aspects[E.IDENTIFIER_ASPECT].configure({returnState:t?A:e,taskHandler:this.workflowTaskHandler,autoRememberSIDs:!1}),t&&this.workstate&&this.workstate.measurementData&&this.aspects[E.IDENTIFIER_ASPECT].setLotIDs(this.workstate.measurementData.identifiers)}cfgParamAspectUpdateTaskParameterFn(t){console.log("QAppAdvBase::cfgParamAspectUpdateTaskParameterFn"),this.cfgParamAspectUpdateTaskHandlerAndPublish(t)}cfgParamAspectUpdateTaskHandlerAndPublish(t){return t.type===d.EnumParameterTypes.PARAM_QUANTITY&&l.QuantityParameter.roundToDecimalPlaces(t),!!this.workflowTaskHandler.updateParameter(t)&&(this.cfgParamAspect.publishParameter(t),!0)}cfgParamAspectHandleParamUpdateUserActionFn(t,e){return!0}cfgParamAspectIsValidFn(){return!0}resumeAdvAspectIsForcedReinitModificationDetectedFn(){let t=!1,e=this.taskHandler.getTask()
;return console.log("QAppAdvBase::resumeAdvAspectIsForcedReinitModificationDetectedFn"),this.workstate&&this.workstate.initialTaskHandlerData&&e?(t=!this.relevantParamsAreEqual(this.workstate.initialTaskHandlerData.params,e.params),console.log("QAppAdvBase::resumeAdvAspectIsForcedReinitModificationDetectedFn - return ",t)):console.log("QAppAdvBase::resumeAdvAspectIsForcedReinitModificationDetectedFn: no workstate - return ",t),t}resumeAdvAspectIsContinueConditionDetectedFn(){return!1}adaptTaskHandler(){console.log("QAppAdvBase::adaptTaskHandler")}reinitialize(){console.log("QAppAdvBase::reinitialize"),this.reinitWorkstate()}prepReinitializedWorkstate(t){let e=this.taskHandler.getFilteredTask();e?(console.log("QAppAdvBase::prepReinitializedWorkstate - got filtered task parameter"),this.workstate={measurementData:t,initialTaskHandlerData:c.cloneJSON(this.taskHandler.getTask()),workflowTaskHandlerData:e},
this.workflowTaskHandler.setTask(this.workstate.workflowTaskHandlerData)):this.exitError("QAppAdvBase::prepReinitializedWorkstate: No task parameters in taskHandler - unexpected.")}provideStartFsmState(){return s.STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER}provideFsmStates(){return Object.assign(this.advBaseStates,this.provideSpecificAdvFsmStates())}adaptFsmStates(t){console.log("QAppAdvBase::adaptFsmStates");for(let e in t){let a=t[e].MQTT_ADMIN_EVENT;void 0!==a&&(t[e].MQTT_ADMIN_EVENT_CHILD=a),t[e].MQTT_ADMIN_EVENT=function(a,i){let s=!1;try{s=i.payload.event===u.MQTT_ADMIN_EVENT_PACKET_SENT&&i.payload.packet.topic===T.MqttTopics.HMI_LOADING_MODAL_TEXT&&JSON.parse(i.payload.packet.payload.toString()).args[1]===_.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE}catch(t){}s&&(a.saveWorkstateIntern(),a.addToEventQueue(new _.QAppSyncCallDoneEvent(_.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE))),
void 0!==t[e].MQTT_ADMIN_EVENT_CHILD&&t[e].MQTT_ADMIN_EVENT_CHILD.call(this,a,i)}}}onFsmTransition(t){if(t.fromState===o.STATE_UNINITIALIZED_INTERNAL){console.log("QAppAdvBase::onFsmTransition - try to load workstate");try{this.workstate=this.taskMngProxy.getWorkstate(this.taskId),console.log("QAppAdvBase::onFsmTransition - got workstate from persistency")}catch(t){console.log("QAppAdvBase::onFsmTransition - no workstate found - error: "+t),this.workstate=void 0}this.workstate&&this.workflowTaskHandler.setTask(this.workstate.workflowTaskHandlerData)}}saveWorkstateIntern(){this.taskMngProxy.saveWorkstate(this.workstate,this.taskId)}saveWorkstate(t=!0){this.workstate&&!this.ignoreSaveWorkstate?(console.log("QAppAdvBase::saveWorkstate - save workstate: "),t?this.showLoadingScreen({id:"_QAPP_LIB_LOADING_OVERLAY_TEXT_SAVE_WORKSTATE",args:[this.getTaskName(),_.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE]}):(this.saveWorkstateIntern(),
this.addToEventQueue(new _.QAppSyncCallDoneEvent(_.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE)))):this.addToEventQueue(new _.QAppSyncCallDoneEvent(_.QAPP_SYNC_CALL_DONE_EVENT_TYPE.SYNC_CALL_SAVE_WORKSTATE))}deleteWorkstate(){this.workstate&&this.taskMngProxy.deleteWorkstate(this.taskId)}specificRestart(){if(void 0!==this.workstate){try{this.taskMngProxy.deleteWorkstate(this.taskId)}catch(t){console.log("QAppAdvBase Restart: No workstate to delete")}this.workstate=void 0}}onSuspending(){void 0!==this.workstate&&this.saveDisplayValueSelectionWithWorkstate&&(console.log("save last display value info in workstate"),this.workstate.lastDisplayValDomain=this.lastDisplayValDomain,this.workstate.lastDisplayValAppId=this.weighingProxy.getSelectedDisplayValue().lastSelectedApplicationId,this.saveWorkstateIntern()),super.onSuspending()}restoreLastSelectedDisplayValueInfo(){
void 0!==this.workstate&&this.saveDisplayValueSelectionWithWorkstate&&(console.log("restoreLastSelectedDisplayValueInfo"),void 0!==this.workstate.lastDisplayValDomain&&(this.lastDisplayValDomain=this.workstate.lastDisplayValDomain),void 0!==this.workstate.lastDisplayValAppId&&this.weighingProxy.restoreLastSelectedDisplayValue(this.workstate.lastDisplayValAppId))}initPQ(t,e=!1){if(this.workstate&&this.workstate.measurementData&&this.workstate.measurementData.identifiers){t?(console.log("QAppAdvBase::initPQ: start initPQ"),this.addLotIds2PQ(this.workstate.measurementData.identifiers),this.addInitParams2PQ(this.providePQInitTaskParams()),this.initPQIdx=0):console.log("QAppAdvBase::initPQ: continue initPQ"),console.log("QAppAdvBase::initPQ start initPQIdx = "+this.initPQIdx);let a=0;for(;this.initPQIdx<this.workstate.measurementData.samples.length&&(a<10||e);){let t=this.workstate.measurementData.samples[this.initPQIdx];if(this.initPQIdx++,this.doAddSampleDuringReinit2PQ(t)){
let e=this.addSample2PQ(t,!0,!1);t.valid||void 0===e||this.reportingProxy.setRedactionStatus(e.getPrintItemIdentifier(),!0,t.invalidationReason),this.sampleAdded(),a++}}return console.log("QAppAdvBase::initPQ end initPQIdx = "+this.initPQIdx),this.initPQIdx>=this.workstate.measurementData.samples.length}return!0}addSample2PQ(t,e,a){console.log("QAppAdvBase::addSample2PQ"),this.sampleAdded();let i=this.addSample2PQ_withIds(t.identifiers,this.provideSamplePQParams(t),e,a);return this.updateInvalidationAspectSampleConfig({sample:t}),i}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(8),n=a(19),r=a(11),o=a(12);e.RESUME_ADV_ASPECT="RESUME_ADV_ASPECT",e.STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER="STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER",e.STATE_ASPECT_RESUME_ADV_REINIT_EXIT="STATE_ASPECT_RESUME_ADV_REINIT_EXIT",e.STATE_ASPECT_RESUME_ADV_CONT_EXIT="STATE_ASPECT_RESUME_ADV_CONT_EXIT"
;const _="STATE_ASPECT_RESUME_ADV_FORCE_REINIT",E="STATE_ASPECT_RESUME_ADV_QUESTION_CONT",l="BTN_OK",u="BTN_REINIT",c="BTN_CONT";e.ResumeAdvancedAspect=class extends n.AbstractQAppAspect{constructor(){super(...arguments),this.states={STATE_ASPECT_RESUME_ADV_CHECK_STARTUP_ENTER:{_onEnter:function(t){t.aspects[e.RESUME_ADV_ASPECT].cfg.isPersitentWorkstatePresentFn()?t.aspects[e.RESUME_ADV_ASPECT].cfg.isForcedReinitModificationDetectedFn()?t.addToEventQueue(new s.ImmediateEvent(_)):t.aspects[e.RESUME_ADV_ASPECT].cfg.isReinitConditionDetectedFn()?t.addToEventQueue(new s.ImmediateEvent(e.STATE_ASPECT_RESUME_ADV_REINIT_EXIT)):t.aspects[e.RESUME_ADV_ASPECT].cfg.isContinueConditionDetectedFn()?t.addToEventQueue(new s.ImmediateEvent(e.STATE_ASPECT_RESUME_ADV_CONT_EXIT)):t.addToEventQueue(new s.ImmediateEvent(E)):t.addToEventQueue(new s.ImmediateEvent(e.STATE_ASPECT_RESUME_ADV_REINIT_EXIT))},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,e){this.transition(t,e.payload)
}},STATE_ASPECT_RESUME_ADV_FORCE_REINIT:{_onEnter:function(t){t.showMessageBox({type:r.EnumMessageboxType.INFO,title:{id:"_QAPP_LIB_MSG_BOX_INFO_REINIT_TASK_NECESSARY",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_INFO_REINIT_TASK_NECESSARY_TEXT",args:[]}],buttons:[{id:l,label:{id:o.EnumFontLabels.OK,args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]})},_onExit:function(t){t.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(t,a){a.payload.buttonId===l&&this.transition(t,e.STATE_ASPECT_RESUME_ADV_REINIT_EXIT)}},STATE_ASPECT_RESUME_ADV_QUESTION_CONT:{_onEnter:function(t){t.showMessageBox({type:r.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_TEXT",args:[]}],buttons:[{id:u,label:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_BTN_REINIT",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY},{id:c,label:{id:"_QAPP_LIB_MSG_BOX_QUESTION_RESUME_CONTINUE_BTN_CONTINUE",
args:[]},appearance:i.EnumAppearance.ENABLED_PRIMARY}]})},_onExit:function(t){t.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(t,a){a.payload.buttonId===u?this.transition(t,e.STATE_ASPECT_RESUME_ADV_REINIT_EXIT):a.payload.buttonId===c&&this.transition(t,e.STATE_ASPECT_RESUME_ADV_CONT_EXIT)}}}}getId(){return e.RESUME_ADV_ASPECT}getAspectStates(){return this.states}init(t){this.client=t,this.client?console.log("ResumeAdvancedAspect::init"):console.log("ResumeAdvancedAspect::init - aspect not correctly initialized (no client set) - skip init")}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(15),s=a(48),n=a(13),r=a(61),o=a(3),_=a(21),E=a(24),l=a(8),u=a(98),c=a(99),T=a(46),d=a(25),p=a(2),A=a(1),I=a(0);e.QAppWorkflowBase=class extends i.QAppBase{constructor(t){super(t),this.takeoverBtnPending=!1,this.lastDisplayValDomain=T.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_UNDEFINED,this.doRememberLastDisplayValDomain=!1,
this.identifierAspect=new s.IdentifierAspect,this.registerAspect(this.identifierAspect),this.weighingProxy.selectedDisplayValue$.subscribe(t=>{this.doRememberLastDisplayValDomain&&(this.lastDisplayValDomain=t.currentSelectedDomain)})}init(){console.log("QAppWorkflowBase::init"),super.init(),this.identifierAspect.resetSIDsPrevSample(),this.mqttHandler.subscribe(A.MqttTopics.HMI_PRINT_HEADER),this.lastDisplayValDomain=T.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_UNDEFINED,this.doRememberLastDisplayValDomain=!1}postInit(){console.log("QAppWorkflowBase::postInit"),super.postInit(),this.confIdentifierAspect(!0,"")}processCLParameters(t){t.length>=5?(this.scriptPath=t[1],this.taskId=t[4],console.log("QAppWorkflowBase: got taskId: "+this.taskId)):(this.taskId=void 0,this.exitError("QAppWorkflowBase::processCLParameters - workflow-Script called without taskId parameter"))}initTaskHandler(){console.log("QAppWorkflowBase: initTaskHandler"),this.loadTask()}adaptTaskHandler(){
console.log("QAppWorkflowBase: adaptTaskHandler")}handleDocuButton(){let t=this.addRemainingDataToPQ();t.length>0&&this.updateRemainingDataPQIDs(t),this.showPrintQueue()}handleEvent(t){if(t instanceof E.MqttUpdateEvent&&t.payload.topic===A.MqttTopics.HMI_PRINT_HEADER)try{JSON.parse(t.payload.value.toString()).isPrintHeaderDisplayed||(this.updateTakeoverBtnToLastRequestedAppearance(),this.takeoverBtnPending=!1)}catch(t){}else{if(t instanceof l.QAppTimerEvent&&"TAKEOVER_BTN_TIMER"===t.payload.id)return this.updateTakeoverBtnToLastRequestedAppearance(),void(this.takeoverBtnPending=!1)
;t instanceof d.HmiButtonClickedEvent&&void 0!==this.buttons.takeoverBtn&&t.payload.buttonId===this.buttons.takeoverBtn.getButtonId()&&(this.buttons.takeoverBtn.getAppearance()!==I.EnumAppearance.ENABLED&&this.buttons.takeoverBtn.getAppearance()!==I.EnumAppearance.ENABLED_SECONDARY&&this.buttons.takeoverBtn.getAppearance()!==I.EnumAppearance.ENABLED_PRIMARY||this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.ENABLED&&this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.ENABLED_SECONDARY&&this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.ENABLED_PRIMARY)||super.handleEvent(t)}}notifyTakeOver(t=!1){this.buttons.takeoverBtn&&(this.takeoverBtnPending=!0,this.lastRequestedTakeoverBtnAppearance!==I.EnumAppearance.HIDDEN&&this.buttons.takeoverBtn.setAppearance(I.EnumAppearance.DISABLED),t&&this.addTimer(1e3,{id:"TAKEOVER_BTN_TIMER"}))}updateRequestedTakeoverButtonAppearance(t){this.lastRequestedTakeoverBtnAppearance=t,
this.takeoverBtnPending||this.updateTakeoverBtnToLastRequestedAppearance()}updateTakeoverBtnToLastRequestedAppearance(){this.buttons.takeoverBtn&&this.buttons.takeoverBtn.setAppearance(this.lastRequestedTakeoverBtnAppearance)}rememberLastSelectedDisplayValueDomain(t){this.doRememberLastDisplayValDomain=t}getLastSelectedDisplayValueDomain(){return this.lastDisplayValDomain}selectLastSelectedDisplayValue(t){this.lastDisplayValDomain===T.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_APP?""!==this.weighingProxy.getSelectedDisplayValue().lastSelectedApplicationId?(console.log("restore last selected display display value: "+this.weighingProxy.getSelectedDisplayValue().lastSelectedApplicationId),this.weighingProxy.selectWeightApplication(this.weighingProxy.getSelectedDisplayValue().lastSelectedApplicationId)):(console.log("restore last selected display value: no AppId stored -> select QApp default: "+t),
this.weighingProxy.selectWeightApplication(t)):this.lastDisplayValDomain===T.ISelectedWeightDisplayValueDomains.SELECTED_DOMAIN_UNDEFINED?(console.log("restore last selected display value: undefined domain -> select QApp default: "+t),this.weighingProxy.selectWeightApplication(t)):console.log("restore last selected display value: WEIGHING was selected - do nothing")}addInitParams2PQ(t){if(console.log("QAppWorkflowBase::addInitParams2PQ"),t.length>0)return this.reportingProxy.printParameters(t,r.REPORTING_CATEGORY_INIT,!1)}addLotIds2PQ(t){console.log("QAppWorkflowBase::addLotIds2PQ");let e=[],a=this.identifierAspect.getLotVisualParams().map(t=>p.cloneJSON(t.getValue()));return t.forEach((t,i)=>{s.IdentifierAspect.getLotState(i,this.taskHandler)!==_.EnumLotIdentifierOptions.OFF&&""!==t&&(a[i].value.string=t,a[i].appearance=I.EnumAppearance.ENABLED,e.push(a[i]))}),this.addInitParams2PQ(e)}addSample2PQ_withIds(t,e,a,i){console.log("QAppWorkflowBase::addSample2PQ_withIds")
;let s=[],o=n.remove(e,t=>t.id===c.PARAM_ID_SAMPLE_NO);s.push(...o),s.push(...this.prepSampleIdParams4PQ(t)),o=n.remove(e,t=>t.id===c.PARAM_ID_SAMPLE_DATE),s.push(...o),s.push(...e);let _=this.reportingProxy.printParameters(s,a?r.REPORTING_CATEGORY_COMPONENTS:r.REPORTING_CATEGORY_NONE,i);return this.updateLastSamplePQID(_.getPrintItemIdentifier()),this.updateRemainingDataPQIDs([]),console.log("QAppWorkflowBase::addSample2PQ_withIds: done"),_}prepSampleIdParams4PQ(t){console.log("QAppWorkflowBase::prepSampleIdParams4PQ");let e=[],a=this.identifierAspect.getSIDVisualParams().map(t=>p.cloneJSON(t.getValue()));return t.forEach((t,i)=>{s.IdentifierAspect.getSIDState(i,this.taskHandler)!==_.EnumSampleIdentifierOptions.OFF&&""!==t&&(a[i].value.string=t,a[i].appearance=I.EnumAppearance.ENABLED,e.push(a[i]))}),e}addStatistic2PQ(t,e){if(console.log("QAppWorkflowBase::addStatistic2PQ"),e&&e.getValues().currCalcValues.numSamples>0){let a=[],i=e.getValues().currStatPublishableParameters;if(t){
let e=o.createEmptyTextParameter();e.value.text.id=t,e.info.suppressTitle=!0,a.push(e)}if(i.n.getValue().appearance!==I.EnumAppearance.HIDDEN&&a.push(i.n.getValue()),i.avg.getValue().appearance!==I.EnumAppearance.HIDDEN&&a.push(i.avg.getValue()),i.dev.getValue().appearance!==I.EnumAppearance.HIDDEN&&a.push(i.dev.getValue()),i.variation.getValue().appearance!==I.EnumAppearance.HIDDEN&&a.push(i.variation.getValue()),i.sum.getValue().appearance!==I.EnumAppearance.HIDDEN&&a.push(i.sum.getValue()),i.min.getValue().appearance!==I.EnumAppearance.HIDDEN&&a.push(i.min.getValue()),i.max.getValue().appearance!==I.EnumAppearance.HIDDEN&&a.push(i.max.getValue()),i.diff.getValue().appearance!==I.EnumAppearance.HIDDEN&&a.push(i.diff.getValue()),a.length>0)return this.reportingProxy.printParameters(a,r.REPORTING_CATEGORY_STATISTIC,!1)}}sampleAdded(){console.log("QAppWorkflowBase::sampleAdded"),void 0!==this.buttons.docuButton&&this.buttons.docuButton.setAppearance(I.EnumAppearance.ENABLED_SECONDARY)}
updateRemainingDataPQIDs(t){console.log("QAppWorkflowBase::updateRemainingDataPQIDs ids: "+t),this.updateInvalidationAspectSampleConfig({dependentPrintItemIds:t})}updateLastSamplePQID(t){console.log("QAppWorkflowBase::updateLastSamplePQID id: "+t),this.updateInvalidationAspectSampleConfig({samplePrintItemId:t})}updateInvalidationAspectSampleConfig(t){console.log("QAppWorkflowBase::updateInvalidationAspectSampleConfig");for(let e in this.aspects)if(e===u.INVAL_SAMPLE_ASPECT)return void this.aspects[e].updateCfgSampleOnly(t)}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(0),s=a(8),n=a(19),r=a(11),o=a(42),_=a(3);e.INVAL_SAMPLE_ASPECT="INVAL_SAMPLE_ASPECT",e.STATE_ASPECT_INVAL_SAMPLE_ENTER="STATE_ASPECT_INVAL_SAMPLE_ENTER",e.STATE_ASPECT_INVAL_SAMPLE_REASON="STATE_ASPECT_INVAL_SAMPLE_REASON";const E="BTN_INVAL_YES",l="BTN_INVAL_DONT";e.PARAM_ID_RT_INVAL_REASON_INP="PARAM_ID_RT_INVAL_REASON_INP";class u extends n.AbstractQAppAspect{constructor(){
super(),this.states={STATE_ASPECT_INVAL_SAMPLE_ENTER:{_onEnter:function(t){let a=t.aspects[e.INVAL_SAMPLE_ASPECT];void 0!==a.cfg.sample&&a.cfg.sample.valid?t.showMessageBox({type:r.EnumMessageboxType.QUESTION,title:{id:"",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_INVALIDATE_TEXT",args:[a.cfg.sample.sampleNo.toString()]}],buttons:[{id:E,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY},{id:l,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},appearance:i.EnumAppearance.ENABLED_SECONDARY}]}):t.addToEventQueue(new s.ImmediateEvent({from:e.STATE_ASPECT_INVAL_SAMPLE_ENTER,to:a.cfg.exitState}))},_onExit:function(t){t.hideMsgBox()},_transTo:{},_transFrom:{},EV_HMI_BTN_CLICKED:function(t,a){let i=t.aspects[e.INVAL_SAMPLE_ASPECT];a.payload.buttonId===l?this.transition(t,i.cfg.exitState):a.payload.buttonId===E&&(void 0!==i.cfg.sample&&(i.cfg.sample.valid=!1),this.transition(t,e.STATE_ASPECT_INVAL_SAMPLE_REASON))},IMMEDIATE_EVENT:function(t,a){
a.payload.from&&a.payload.from===e.STATE_ASPECT_INVAL_SAMPLE_ENTER&&this.transition(t,a.payload.to)}},STATE_ASPECT_INVAL_SAMPLE_REASON:{_onEnter:function(t){t.screens[o.KEYBOARD_SCREEN_ID].hide();let a=t.aspects[e.INVAL_SAMPLE_ASPECT];t.screens[o.KEYBOARD_SCREEN_ID].setParam(a.sP_4_InvalReason),t.screens[o.KEYBOARD_SCREEN_ID].show()},_onExit:function(t){t.screens[o.KEYBOARD_SCREEN_ID].hide()},_transTo:{},_transFrom:{},EV_HMI_PARAM_CHANGED:function(t,a){console.log("InvalidateSampleAspect - param change in STATE_ASPECT_INVAL_SAMPLE_REASON");let i=t.aspects[e.INVAL_SAMPLE_ASPECT];if(a.payload.parameter.id===e.PARAM_ID_RT_INVAL_REASON_INP){let e=i.cfg.sample;void 0!==e&&(e.invalidationReason=a.payload.parameter.value.string,void 0===i.cfg.samplePrintItemId||isNaN(i.cfg.samplePrintItemId)||t.reportingProxy.setRedactionStatus(i.cfg.samplePrintItemId,!0,e.invalidationReason),void 0!==i.cfg.dependentPrintItemIds&&i.cfg.dependentPrintItemIds.forEach(a=>{
t.reportingProxy.setRedactionStatus(a,!0,e.invalidationReason)})),this.transition(t,i.cfg.exitState)}}}},this.sP_4_InvalReason=u.createInvalidReasonParam(e.PARAM_ID_RT_INVAL_REASON_INP)}static createInvalidReasonParam(t){let e=_.createEmptyStringParameter();return e.id=t,e.title={id:"_QAPP_LIB_PARAM_TITLE_RT_INVAL_REASON",args:[]},e.header={id:"_QAPP_LIB_PARAM_HEADER_RT_INVAL_REASON",args:[]},e}updateCfgSampleOnly(t){this.cfg=Object.assign(this.cfg,t)}getId(){return e.INVAL_SAMPLE_ASPECT}getAspectStates(){return this.states}init(t){if(this.client=t,this.client){if(console.log("InvalidateSampleAspect::init"),!this.client.screens[o.KEYBOARD_SCREEN_ID]){let t=new o.KeyboardScreen(this.client.mqttHandler);this.client.registerScreen(t)}}else console.log("InvalidateSampleAspect::init - aspect not correctly initialized (no client set) - skip init")}}e.InvalidateSampleAspect=u},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(2),s=a(0)
;e.PARAM_ID_SAMPLE_NO="QAPP_LIB_SAMPLE_NO";const n={id:e.PARAM_ID_SAMPLE_NO,type:s.EnumParameterTypes.PARAM_STRING,value:{string:""},header:{id:"_QAPP_LIB_PARAM_HEADER_SAMPLE_NO",args:[]},title:{id:"_QAPP_LIB_PARAM_TITLE_SAMPLE_NO",args:[]},appearance:s.EnumAppearance.HIDDEN,info:{minimum:{length:0},maximum:{length:0}}};function r(){return i.cloneJSON(n)}e.getSampleNumberStringParameter=r,e.createSampleNumberStringParameter=function(t){let e=i.cloneJSON(r());return e.id=t,e},e.PARAM_ID_SAMPLE_DATE="QAPP_LIB_SAMPLE_DATE";const o={id:e.PARAM_ID_SAMPLE_DATE,type:s.EnumParameterTypes.PARAM_DATE_TIME,value:{timestamp:0},header:{id:"_QAPP_LIB_PARAM_HEADER_SAMPLE_DATETIME",args:[]},title:{id:"_QAPP_LIB_PARAM_TITLE_SAMPLE_DATETIME",args:[]},appearance:s.EnumAppearance.HIDDEN,info:{isTime:!0,isDate:!0}};function _(){return i.cloneJSON(o)}e.getSampleDateDTParameter=_,e.createSampleDateDTParameter=function(t){let e=i.cloneJSON(_());return e.id=t,e}},function(t,e,a){"use strict"
;Object.defineProperty(e,"__esModule",{value:!0});const i=a(22);e.TabFigure=class extends i.TabBase{constructor(t,e,a,i=!1){super(e,a,i),this.imageUrl={url:""},this.imageId={id:""},this.setTabData(t)}setTabImgRefUrl(t){this.imageUrl.url!==t&&(this.imageUrl.url=t,this.tabData.imgref=this.imageUrl,this.publishIfEnabled())}setTabImgRefId(t){this.imageId.id!==t&&(this.imageId.id=t,this.tabData.imgref=this.imageId,this.publishIfEnabled())}getTabImgRef(){return this.tabData.imgref}getTabData(){return this.tabData}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.functionReplacer=function(t,e){return"function"==typeof e?e.toString().replace(/(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)/gm,"").replace(/\s\s+/g,""):e},e.functionReviver=function(t,e){if(""===t)return e;if("string"==typeof e){let t=/function[^\(]*\(([^\)]*)\)[^\{]*\{([^]*)\}/,a=e.match(t);if(a){let t=a[1].split(",").map(function(t){return t.replace(/\s+/,"")});return new Function(...t,a[2])}}return e}
},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(22),s=a(13);e.TabGraph=class extends i.TabBase{constructor(t,e,a,i=!1){super(e,a,i),this.setTabData(t)}setData(t,e=!0){s.isEqual(this.tabData.data,t)||(this.tabData.data=t,e?this.publishIfEnabled():this.publishPending=!0)}getData(){return this.tabData.data}getTabData(){return this.tabData}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(22),s=a(26);e.TabParamList=class extends i.TabBase{constructor(t,e,a,i=!1){super(e,a,i),this.setTabData(t)}setTabParams(t){if(this.tabData)if(!s.isITabParamList(this.tabData)||"string"!=typeof t[0]&&0!==t.length){if(!s.isITabBulkParamList(this.tabData)||"object"!=typeof t[0]&&0!==t.length)throw new Error("TabParamList: given type for parameters and mode of tab does not match");this.tabData.bulkParameters.join()!==t.join()&&(this.tabData.bulkParameters=t,this.publishIfEnabled())
}else this.tabData.params.join()!==t.join()&&(this.tabData.params=t,this.publishIfEnabled())}getTabParams(){if(this.tabData){if(s.isITabParamList(this.tabData))return this.tabData.params;if(s.isITabBulkParamList(this.tabData))return this.tabData.bulkParameters;throw new Error("TabParamList expected type of tabdata found")}return[]}setTabDisplayHeader(t){this.tabData.displayHeader!==t&&(this.tabData.displayHeader=t,this.publishIfEnabled())}getTabDisplayHeader(){return this.tabData.displayHeader}publishTabParams(){this.publish()}getTabData(){return this.tabData}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(22),s=a(26),n=a(10);e.TabMenu=class extends i.TabBase{constructor(t,e,a,i=!1){super(e,a,i),this.setTabData(t)}setTabMenuButtons(t,e=!0){if(this.tabData&&t.length>0)if(console.log("isMenu:"+s.isITabMenu(this.tabData)),console.log("isMenuBulk:"+s.isITabBulkMenu(this.tabData)),console.log("buttons:"+JSON.stringify(t)),
s.isITabMenu(this.tabData)&&"string"==typeof t[0])this.tabData.menubuttons.join()!==t.join()&&(this.tabData.menubuttons=t,e&&this.publishIfEnabled());else{if(!s.isITabBulkMenu(this.tabData)||"object"!=typeof t[0])throw new Error("TabMenu: given type for buttons and mode of tab does not match");JSON.stringify(this.tabData.menuBulkButtons)!==JSON.stringify(t)&&(this.tabData.menuBulkButtons=t.map(t=>n.IButtonParameterInterface2IButtonJsonInterface(t)),e&&this.publishIfEnabled())}}getTabMenuButtons(){if(this.tabData){if(s.isITabMenu(this.tabData))return this.tabData.menubuttons;if(s.isITabBulkMenu(this.tabData))return this.tabData.menuBulkButtons.map(t=>n.IButtonJsonInterface2IButtonParameterInterface(t));throw new Error("TabMenu expected type of tabdata found")}return[]}getTabData(){return this.tabData}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(22),s=a(26);e.TabTable=class extends i.TabBase{constructor(t,e,a,i=!1){super(e,a,i),
this.setTabData(t)}setTabMenuButtons(t,e=!0){if(this.tabData&&t.length>0)if(console.log("isTable:"+s.isITabTable(this.tabData)),console.log("isMTableBulk:"+s.isITabBulkTable(this.tabData)),console.log("buttons:"+JSON.stringify(t)),s.isITabTable(this.tabData)&&"string"==typeof t[0])this.tabData.menubuttons.join()!==t.join()&&(this.tabData.menubuttons=t,e&&this.publishIfEnabled());else{if(!s.isITabBulkTable(this.tabData)||"object"!=typeof t[0])throw new Error("TabMTable: given type for buttons and mode of tab does not match");JSON.stringify(this.tabData.menuBulkButtons)!==JSON.stringify(t)&&(this.tabData.menuBulkButtons=t,e&&this.publishIfEnabled())}}getTabMenuButtons(){if(this.tabData){if(s.isITabTable(this.tabData))return this.tabData.menubuttons;if(s.isITabBulkTable(this.tabData))return this.tabData.menuBulkButtons;throw new Error("TabTable expected type of tabdata found")}return[]}getTabData(){return this.tabData}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{
value:!0});const i=a(6),s=a(4);e.CLOCKHANDLER_DATEFORMAT_PARAM_ID="CLOCKHANDLER/CONFIGURATION/TIME/DATEFORMAT",e.CLOCKHANDLER_TIMEFORMAT_PARAM_ID="CLOCKHANDLER/CONFIGURATION/TIME/TIMEFORMAT",e.CLOCKHANDLER_TIMEZONE_PARAM_ID="CLOCKHANDLER/CONFIGURATION/TIME/TIMEZONE";e.ClockHandlerProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="clockHandler"}getFormatConfiguration(){return this.body.method=s.RestMethodsCLOCK_HANDLER.getFormatConfiguration,this.body.params={configuration:""},new i.CubisRestResponse(this.syncRequest())}getFormatConfigurationI18n(){return this.body.method=s.RestMethodsCLOCK_HANDLER.getFormatConfigurationI18n,this.body.params={configuration:""},new i.CubisRestResponse(this.syncRequest())}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(10),s=a(0),n=a(43),r=a(40),o=a(1);e.SINGLE_TAB_BUTTON_BAR_SCREEN_ID="SINGLETABBUTTONBARSCREEN";e.SingleTabButtonBarScreen=class extends r.AbstractOverlay{
constructor(t,e,a){super(t),this.buttonList=[],this.tab=void 0,this.createBarButtons(e),this.publishBarButtons(),this.topLeftButton=new i.Button(this.mqttHandler,this,a),this.publishTopLeftButton()}getTab(){return this.tab}setFigureTab(t,a){let i=n.TabApi.createFigureTab(this.mqttHandler,e.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,t,!0,a);return this.tab=i,i}setGraphTab(t,a){let i=n.TabApi.createGraphTab(this.mqttHandler,e.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,t,!0,a);return this.tab=i,i}setParamListTab(t,a){let i=n.TabApi.createParamListTab(this.mqttHandler,e.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,t,!0,a);return this.tab=i,i}setMenuTab(t,a){let i=n.TabApi.createMenuTab(this.mqttHandler,e.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,t,!0,a);return this.tab=i,i}setTableTab(t,a){let i=n.TabApi.createTableTab(this.mqttHandler,e.SINGLE_TAB_BUTTON_BAR_SCREEN_ID,t,!0,a);return this.tab=i,i}show(){if(void 0!==this.tab){this.topLeftButton.publish();for(let t of this.buttonList)t.publish();this.tab.show(),super.show()}}hide(){
super.hide()}getId(){return e.SINGLE_TAB_BUTTON_BAR_SCREEN_ID}getBarButtonId(){return o.MqttTopics.HMI_SINGLETABBUTTONBAR_SCREEN_BARBUTTONS}getTopLeftButtonId(){return o.MqttTopics.HMI_SINGLETABBUTTONBAR_SCREEN_TOPLEFTBUTTON}getButton(t){for(let e of this.buttonList)if(e.getButtonId()===t)return e;if(t===this.topLeftButton.getButtonId())return this.topLeftButton}createBarButtons(t){for(let e of t){let t=new i.Button(this.mqttHandler,this,e);this.buttonList.push(t),t.publish()}}publishBarButtons(){let t=[];for(let e of this.buttonList)t.push(o.MqttTopics.QAPP_NAMESPACE+"/"+e.getTopic());this.mqttHandler.publish(this.getBarButtonId(),JSON.stringify(t))}publishTopLeftButton(){this.mqttHandler.publish(this.getTopLeftButtonId(),JSON.stringify(o.MqttTopics.QAPP_NAMESPACE+"/"+this.topLeftButton.getTopic()))}hideTopLeftButton(t=!0){this.topLeftButton.setAppearance(s.EnumAppearance.HIDDEN,t)}showTopLeftButton(t=!0){this.topLeftButton.setAppearance(s.EnumAppearance.ENABLED,t)}
setTopLeftButton(t,e=!0){this.topLeftButton.setLabel(t.label,!1),this.topLeftButton.setIcon(t.icon,!1),t.nameId&&this.topLeftButton.setNameId(t.nameId,!1),t.labelCenter&&this.topLeftButton.setLabelCenter(t.labelCenter,!1),t.labelRight&&this.topLeftButton.setLabelRight(t.labelRight,!1),this.topLeftButton.setAppearance(t.appearance,!1),this.topLeftButton.setButtonId(t.buttonId,e)}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(39),s=a(43),n=a(1),r=a(5),o=a(10),_=a(30),E=a(62),l=a(0);e.WEIGHING_SPLIT_SCREEN_ID="WEIGHINGSPLIT";const u={buttonId:"BARBUTTON/CANCEL",label:{id:"",args:[]},appearance:l.EnumAppearance.HIDDEN};e.WeighingSplitScreen=class extends r.AbstractScreen{constructor(t,e){super(t),this.buttonList=[],this.text1={value:"",wildcards:[]},this.text2={value:"",wildcards:[]},this.param1="",this.param2="",this.title=void 0,this.createBarButtons(e),this.publishBarButtons(),this.checkBarGraph=new E.CheckBarGraph(t),
this.cancelBarButton=new o.default(this.mqttHandler,this,u),this.tabApi=new s.TabApi(t,this.getId())}getId(){return e.WEIGHING_SPLIT_SCREEN_ID}getTabApi(){return this.tabApi}getBarButtonId(){return n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_BARBUTTONS}createBarButtons(t){t.sort(this.compareButtonBarButtons);for(let e of t){let t=new o.default(this.mqttHandler,this,e);this.buttonList.push(t),t.publish()}}publishBarButtons(){let t=[];for(let e of this.buttonList)t.push(n.MqttTopics.QAPP_NAMESPACE+"/"+e.getTopic());this.mqttHandler.publish(this.getBarButtonId(),JSON.stringify(t))}setText1(t,e){let a=!1;this.text1.value!==t&&(this.text1.value=t,a=!0),e&&this.text1.wildcards.join()!==e.join()&&(this.text1.wildcards=e,a=!0),a&&this.publishText1()}compareButtonBarButtons(t,e){return _.getButtonPriority(t.buttonId)-_.getButtonPriority(e.buttonId)}publishText1(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION1,JSON.stringify(this.text1),{retain:!0})}publishText2(){
this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_INSTRUCTION2,JSON.stringify(this.text2),{retain:!0})}setText2(t,e){let a=!1;this.text2.value!==t&&(this.text2.value=t,a=!0),e&&this.text2.wildcards.join()!==e.join()&&(this.text2.wildcards=e,a=!0),a&&this.publishText2()}publishTitle(){this.title?this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_TITLE,JSON.stringify(this.title),{retain:!0}):this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_TITLE,"",{retain:!0})}setTitle(t){let e=void 0;this.title&&(e=JSON.stringify(this.title)),this.title=t,this.title!==e&&this.publishTitle()}getText1(){return this.text1}getText2(){return this.text2}publishParam1(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_PARAM1_TOPIC,JSON.stringify(this.param1),{retain:!0})}publishParam2(){this.mqttHandler.publish(n.MqttTopics.HMI_WEIGHINGSPLIT_SCREEN_PARAM2_TOPIC,JSON.stringify(this.param2),{retain:!0})}setParam1(t){this.param1!==t&&(this.param1=t,
this.publishParam1())}setParam2(t){this.param2!==t&&(this.param2=t,this.publishParam2())}getParam1(){return this.param1}getParam2(){return this.param2}getButton(t){if(t===i.CANCEL_BARBUTTON_ID)return this.cancelBarButton;for(let e of this.buttonList)if(e.getButtonId()===t)return e}show(){this.publishText1(),this.publishText2(),this.publishTitle(),this.publishParam1(),this.publishParam2();for(let t of this.buttonList)t.publish();super.show()}getCheckBarGraph(){return this.checkBarGraph}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(6),s=a(3),n=a(53),r=a(3),o=a(0),_=a(13),E=a(34),l=a(4);var u;!function(t){t.EVENT_CREATED="Created",t.EVENT_CHANGED="Changed",t.EVENT_DELETED="Deleted",t.EVENT_LOGIN="Login",t.EVENT_LOGUT="Logout",t.EVENT_ISOCAL="isoCAL",t.EVENT_INTERNALADJUST="InternalAdjustment",t.EVENT_EXTERNALADJUST="ExternalAdjustment",t.EVENT_USERCAL="User Calibration",t.EVENT_MESSAGE="Message",t.EVENT_ELEC_SIGNATURE="Electronic Signature",
t.EVENT_OP_START="Operation Start",t.EVENT_OP_END="Operation End",t.EVENT_LICENSED="Licensed"}(e.EnumAuditTrailEvent||(e.EnumAuditTrailEvent={})),function(t){t.WORKFLOWMANAGEMENT="WORKFLOWMANAGEMENT",t.USERMANAGEMENT="USERMANAGEMENT",t.ROLEMANAGEMENT="ROLEMANAGEMENT",t.CONFIGURATIONMANAGEMENT="CONFIGURATIONMANAGEMENT",t.AUDITTRAIL="AUDITTRAIL",t.ACCESSCONTROL="ACCESSCONTROL",t.DATAHANDLER="DATAHANDLER",t.DATABASEDRIVER="DATABASEDRIVER",t.ENCRYPTIONHELPER="ENCRYPTIONHELPER",t.RESULTMANAGEMENT="RESULTMANAGEMENT",t.EXTERNALCOMMUNICATION="EXTERNALCOMMUNICATION",t.IPPCLIENT="IPPCLIENT",t.LDAPCLIENT="LDAPCLIENT",t.NTPCLIENT="NTPCLIENT",t.SMBCLIENT="SMBCLIENT",t.INTERNALCOMMUNICATION="INTERNALCOMMUNICATION",t.WORKFLOWAUTOMATIONHANDLER="WORKFLOWAUTOMATIONHANDLER",t.REPORTING="REPORTING",t.BACKUPRESTOREHANDLER="BACKUPRESTOREHANDLER",t.DEVICEDATA="DEVICEDATA",t.TIMERDAEMON="TIMERDAEMON",t.MODBUS="MODBUS",t.OSHELPER="OSHELPER",t.STATUSSERVICE="STATUSSERVICE",t.MESSAGEBROKER="MESSAGEBROKER",
t.RESTCALLHANDLER="RESTCALLHANDLER",t.MENUHANDLER="MENUHANDLER",t.LOCALIZER="LOCALIZER",t.PARAMETER="PARAMETER",t.MESSAGEHANDLER="MESSAGEHANDLER",t.SELFMONITOR="SELFMONITOR",t.SENSORACTORHANDLER="SENSORACTORHANDLER",t.TASKMANAGEMENT="TASKMANAGEMENT",t.CALENDAR="CALENDAR",t.QAPP_FRAMEWORK="QAPP_FRAMEWORK",t.QAPPHANDLER="QAPPHANDLER",t.QAPPMANAGEMENT="QAPPMANAGEMENT",t.PROFILEMANAGEMENT="PROFILEMANAGEMENT",t.FIRMWARELOADER="FIRMWARELOADER",t.DEVICEMANAGER="DEVICEMANAGER",t.EXTERNALDEVICESERVICE="EXTERNALDEVICESERVICE",t.INTERFACEMANAGEMENT="INTERFACEMANAGEMENT",t.MOTIONSENSOR="MOTIONSENSOR",t.ALIBIMEMORY="ALIBIMEMORY",t.CLOCKHANDLER="CLOCKHANDLER",t.WATCHDOG="WATCHDOG",t.CALIBRATIONADJUSTMENT="CALIBRATIONADJUSTMENT",t.CLIMATECONTROL="CLIMATECONTROL",t.DEVICEINFORMATION="DEVICEINFORMATION",t.DRAFTSHIELD="DRAFTSHIELD",t.IONIZER="IONIZER",t.LEVELING="LEVELING",t.WEIGHING="WEIGHING",t.COUNTING="COUNTING",t.PERCENTAGE="PERCENTAGE",t.CHECKWEIGHING="CHECKWEIGHING",t.CALCULATION="CALCULATION",
t.PAPERWEIGHT="PAPERWEIGHT",t.LDAP="LDAP",t.MINUSP="MINUSP",t.QAPP="QAPP",t.CONNECTORMANAGEMENT="CONNECTORMANAGEMENT",t.IMPORTEXPORT="IMPORTEXPORT",t.TRANSFERMANAGEMENT="TRANSFERMANAGEMENT",t.__LAST__="__LAST__"}(u=e.EnumAuditTrailModule||(e.EnumAuditTrailModule={}));const c="QAPP_AUDITTRAIL_ENTRY_TASK_NAME";e.AuditTrailProxy=class extends i.BaseProxy{constructor(){super(...arguments),this.restEndpoint="audit"}addEventWithParameters(t,e,a,i=""){let E=new n.LocalizerProxy,l=_.flatten(a.map(t=>{let e=[{id:t.title.id,args:t.title.args},{id:t.header.id,args:t.header.args}];return s.isTypeOfITextParameter(t)&&(e=[...e,{id:t.value.text.id,args:t.value.text.args}]),e}));"object"==typeof e&&(l=[...l,{id:"GLP_TASK_NAME_TITLE",args:[]},{id:"GLP_TASK_NAME_HEADER",args:[]}]);let T=E.getTexts(l),d=0;for(let t of a)t.title.id=T[d++],t.title.args=[],t.header.id=T[d++],t.header.args=[],s.isTypeOfITextParameter(t)&&(t.value.text.id=T[d++],t.value.text.args=[]);if("object"==typeof e){
let t=r.createEmptyTextParameter();t.appearance=o.EnumAppearance.ENABLED,t.id=c,t.title.id=T[d++],t.header.id=T[d++],t.value.text.id=e.getTaskName()||"---",a=[t,...a],e=u.QAPP}else if(e===u.QAPP)throw new Error("AuditTrailProxy::addEventWithParameters called with QAPP module enum but no QApp instance given.");let p=JSON.stringify(this.convertToEventParameters(a));return console.log(`AuditTrailProxy: send operation string: ' ${p}'`),this.addEventInternal(t,e,p,i)}addEvent(t,e,a,i=!1,s=""){let n;return i?(n=r.createEmptyStringParameter()).value.string=a:((n=r.createEmptyTextParameter()).value.text.id=a,n.info.suppressTitle=!0),n.id=c,n.appearance=o.EnumAppearance.ENABLED,n.title.id="AUDITTRAIL_TITLE_NONE",n.header.id="AUDITTRAIL_HEADER_NONE",this.addEventWithParameters(t,e,[n],s)}addEventInternal(t,e,a,s=""){let n;this.body.method=l.RestMethodsAUDITTRAIL.addEventExt,this.body.params={auditTrailEvent:t,moduleName:e,operation:a,destination:s};try{
return(n=new i.CubisRestResponse(this.syncRequest())).isSuccess()}catch(t){return console.log("Something went wrong when calling addEventExt"),console.log(t),!1}}convertToEventParameters(t){let e=new n.LocalizerProxy;return Array.from(t,t=>{let a=r.createEmptyTextParameter();switch(a.appearance=t.appearance,a.id=t.id,a.title=t.title,a.header=t.header,t.type){case o.EnumParameterTypes.PARAM_STRING:a.value.text.id=t.value.string;break;case o.EnumParameterTypes.PARAM_SELECTION:{const i=t.value.selection.id,s=t.info.options.find(t=>t.id===i),n=void 0!==s?e.getText(s.text.id,s.text.args):"---";a.value.text.id=n;break}case o.EnumParameterTypes.PARAM_MULTIPLE_SELECTION:{const i=t.value.selections.map(e=>t.info.options.find(t=>t.id===e.id)).map(t=>void 0===t?{id:"---",args:[]}:{id:t.text.id,args:t.text.args}),s=e.getTexts(i);a.value.text.id=s.join(", ");break}case o.EnumParameterTypes.PARAM_QUANTITY:{const e=t.value;a.value.text.id=`${e.numbers[0]} ${e.unit}`;break}
case o.EnumParameterTypes.PARAM_MEASURE:{const e=t.value;a.value.text.id=`${e.sign} ${e.number} ${e.unit}`;break}case o.EnumParameterTypes.PARAM_DATE_TIME:{const e=1e3*t.value.timestamp,{isDate:i,isTime:s}=t.info,n=E.getDateTimeConfiguration(),r=E.convertToDateTimeFormat(e,n);a.value.text.id=i&&!s?`${r.date}`:!i&&s?`${r.time}`:i&&s?`${r.date} ${r.time}`:"---";break}case o.EnumParameterTypes.PARAM_FORMULA:a.value.text.id=t.value[0].visual;break;case o.EnumParameterTypes.PARAM_TEXT:a.value=t.value;break;default:a.value.text.id="---"}return a})}getRecords(t){let e;if(this.body.method=l.RestMethodsAUDITTRAIL.getRecords,this.body.params=t,this.body.params.document="",(e=new i.CubisRestResponse(this.syncRequest())).isSuccess()){let t=e.rawReturns.document;return JSON.parse(t).data}return console.log("AuditTrailProxy::getRecords: error returned: "+e.rawReturns),[]}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0})
;const i=a(9),s=a(15),n=a(16),r=a(111),o=a(19),_=a(112),E=a(8),l=a(57),u=a(11),c=a(33),T=a(31),d=a(47),p=a(21),A=a(41),I=a(0),h=a(113),m=a(17),N=a(63),S=a(20),g=a(114),R="STATE_CONNECTION_ASPECT_GET_TABLES",P="STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY",O="STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE",D="STATE_CONNECTION_ASPECT_CHECK_ENTITIES",C="STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES",M="STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION",L="STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION",b="STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF",f="STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE",y="STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE",B="STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND",v="ASYNC_CHECK_LOG_ENTITY_TABLE_OPEN_CONN",U="ASYNC_CHECK_LOG_ENTITY_TABLE_GET_TABLE",G="ASYNC_CREATE_LOG_ENTITY_TABLE",x="ASYNC_CREATE_LOG_ENTITY_TABLE_LOG_CREATION",H="ASYNC_CHECK_ENTITIES_ADD_MIGRATION_LOG",Q="ASYNC_CHECK_CLOSE_MAIN_CONNECTION",F="ASYNC_CHECK_CLOSE_LOG_CONNECTION",w="TYPEORM_MAIN_CONNECTION",V="TYPEORM_LOG_CONNECTION",k="BTN_ID_CONNECTION_ASPECT_YES",Y="BTN_ID_CONNECTION_ASPECT_NO"
;e.ConnectionAspect=class extends o.AbstractQAppAspect{constructor(){super(),this.foundTablesInDb=[],this.entityCheckResults=[],this.foundMissingTables=[],this.generalCheckMigrationLogStr="",this.migrationResult=void 0,this.databaseType="sqlite",this.databaseUpdateQAsked=!1,this.states={STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,e){e.payload.from===A.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE&&this.transition(t,e.payload.to)},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(e))},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){t.aspects[A.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(e)},EV_HMI_BTN_CLICKED:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT]
;(e.payload.buttonId===l.ERRORMSGBOX_OK_BTN_ID||c.isMessageHandlerOkButton(e.payload.buttonId))&&(t.hideMsgBox(),t.deleteDBError(),a.cfg.workflow?this.transition(t,B):this.transition(t,y))}},STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY(e))},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){t.aspects[A.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(e)},EV_HMI_BTN_CLICKED:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];(e.payload.buttonId===l.ERRORMSGBOX_OK_BTN_ID||c.isMessageHandlerOkButton(e.payload.buttonId))&&(t.hideMsgBox(),t.deleteDBError(),a.cfg.workflow?this.transition(t,B):this.transition(t,y))}},
STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(e))},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){t.aspects[A.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(e)},EV_HMI_BTN_CLICKED:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];c.isMessageHandlerOkButton(e.payload.buttonId)||e.payload.buttonId===Y?(t.hideMsgBox(),t.deleteDBError(),a.cfg.workflow?this.transition(t,B):this.transition(t,y)):e.payload.buttonId===k&&(t.hideMsgBox(),a.doCreateLogEntityTable())}},STATE_CONNECTION_ASPECT_GET_TABLES:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_GET_TABLES()},_onExit:function(){},
_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_GET_TABLES(e))},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){t.aspects[A.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_GET_TABLES(e)},EV_HMI_BTN_CLICKED:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];c.isMessageHandlerOkButton(e.payload.buttonId)&&(t.hideMsgBox(),t.deleteDBError(),a.cfg.workflow?this.transition(t,B):this.transition(t,y))}},STATE_CONNECTION_ASPECT_CHECK_ENTITIES:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,e){e.payload.from===D&&this.transition(t,e.payload.to)}},STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES()},
_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(e))},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){t.aspects[A.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(e)},IMMEDIATE_EVENT:function(t,e){e.payload.from===C&&this.transition(t,e.payload.to)},EV_HMI_BTN_CLICKED:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];c.isMessageHandlerOkButton(e.payload.buttonId)&&(t.hideMsgBox(),t.deleteDBError(),a.cfg.workflow?this.transition(t,B):this.transition(t,y))}},STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT]
;this.transition(t,a.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(e))},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){t.aspects[A.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(e)},EV_HMI_BTN_CLICKED:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];c.isMessageHandlerOkButton(e.payload.buttonId)&&(t.hideMsgBox(),t.deleteDBError(),a.cfg.workflow?this.transition(t,B):this.transition(t,y))}},STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,e){e.payload.from===L&&this.transition(t,e.payload.to)},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(e))},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){
let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(e))},EV_HMI_BTN_CLICKED:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];c.isMessageHandlerOkButton(e.payload.buttonId)||e.payload.buttonId===Y?(t.hideMsgBox(),t.deleteDBError(),a.cfg.workflow?this.transition(t,B):this.transition(t,y)):e.payload.buttonId===k&&(t.hideMsgBox(),a.doMigration())}},STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){t.aspects[A.CONNECTION_ASPECT].handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(e)},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){t.aspects[A.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(e)},IMMEDIATE_EVENT:function(t,e){
e.payload.from===b&&this.transition(t,e.payload.to)},EV_HMI_BTN_CLICKED:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];c.isMessageHandlerOkButton(e.payload.buttonId)&&(t.hideMsgBox(),t.deleteDBError(),a.cfg.workflow?this.transition(t,B):this.transition(t,y))}},STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,e){e.payload.from===f&&this.transition(t,e.payload.to)},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(e))},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(e))}},STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE:{_onEnter:function(t){
t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE()},_onExit:function(){},_transTo:{},_transFrom:{},IMMEDIATE_EVENT:function(t,e){e.payload.from===y&&this.transition(t,e.payload.to)},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(e))},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){let a=t.aspects[A.CONNECTION_ASPECT];this.transition(t,a.handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(e))}},STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND:{_onEnter:function(t){t.aspects[A.CONNECTION_ASPECT].onEnter_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND()},_onExit:function(){},_transTo:{},_transFrom:{},QAPP_ASYNC_CALL_DONE_EVENT:function(t,e){t.aspects[A.CONNECTION_ASPECT].handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(e)},QAPP_ASYNC_CALL_FAIL_EVENT:function(t,e){
t.aspects[A.CONNECTION_ASPECT].handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(e)}}}}getId(){return A.CONNECTION_ASPECT}getAspectStates(){return this.states}init(t){this.client=t}configure(t){t.qappSpecificSqliteDatabaseLocation=void 0===t.qappSpecificSqliteDatabaseLocation||t.qappSpecificSqliteDatabaseLocation,super.configure(t);let e=this.cfg.taskHandler.getParameter(p.TASK_DYNAMIC_ID_DB_TYPES_PARAM_ID);void 0!==e?this.databaseType=e.value.selection.id:this.client.exitError("ConnectAspect::configure: ConnectionURLParameter not found in the taskHandler")}getConnection(){let t=void 0;try{t=n.getConnection(w)}catch(t){console.log("ConnectionAspect::getConnection: no connection found")}return t}getLogConnection(){let t=void 0;try{t=n.getConnection(V)}catch(t){console.log("ConnectionAspect::getLogConnection: no connection found")}return t}createLogEntry(t,e,a){if(!0===this.cfg.useLogTable){let i=new r.LogEntity;i.qappOrderNo=this.client.getQAppOrderNumber(),
i.qappVersion=this.client.getQAppVersion(),i.action=t,i.details=e,this.client.enqueAsyncCall(this.getLogConnection().getRepository(r.LogEntity).save(i),a)}else this.client.addToEventQueue(new E.QAppAsyncCallDoneEvent({sourceState:this.client.getCurrentState(),result:void 0,metadata:a}))}getConnectionOptions(t,e,a=!1){if("sqlite"===this.databaseType){let i=`${this.client.getStorageLocation(N.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_INDEPENDENT)}/qapp.sqlite`;return!0===this.cfg.qappSpecificSqliteDatabaseLocation&&(i=`${this.client.getStorageLocation(N.EnumPersistencyScope.PERSISTENCY_SCOPE_QAPP_SPECIFIC)}/qapp.sqlite`),{name:t,type:this.databaseType,database:i,synchronize:a,entities:e,subscribers:[_.QAppBaseSubscriber]}}if("postgres"===this.databaseType){
let i=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_USERNAME_PARAM_ID}/${this.databaseType.toUpperCase()}`),s=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_PASSWORD_PARAM_ID}/${this.databaseType.toUpperCase()}`),n=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_DATABASE_PARAM_ID}/${this.databaseType.toUpperCase()}`),r=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_IP_PARAM_ID}/${this.databaseType.toUpperCase()}`),o=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_PORT_PARAM_ID}/${this.databaseType.toUpperCase()}`);return{name:t,type:this.databaseType,host:r.value.string,port:S.QuantityParameter.getValue(o),username:i.value.string,password:s.value.string,database:n.value.string,synchronize:a,entities:e,subscribers:[_.QAppBaseSubscriber]}}if("mssql"===this.databaseType){
let i=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_USERNAME_PARAM_ID}/${this.databaseType.toUpperCase()}`),s=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_PASSWORD_PARAM_ID}/${this.databaseType.toUpperCase()}`),n=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_DATABASE_PARAM_ID}/${this.databaseType.toUpperCase()}`),r=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_SCHEMA_PARAM_ID}/${this.databaseType.toUpperCase()}`),o=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_IP_PARAM_ID}/${this.databaseType.toUpperCase()}`),E=this.client.taskHandler.getParameter(`${p.TASK_DYNAMIC_ID_DB_PORT_PARAM_ID}/${this.databaseType.toUpperCase()}`);return{name:t,type:this.databaseType,host:o.value.string,port:S.QuantityParameter.getValue(E),username:i.value.string,password:s.value.string,database:n.value.string,schema:r.value.string,synchronize:a,entities:e,subscribers:[_.QAppBaseSubscriber],requestTimeout:15e3,connectionTimeout:1e4,
maxQueryExecutionTime:1e4,dialectOptions:{options:{requestTimeout:1e4}},pool:{acquireTimeoutMillis:2e4}}}return{name:""}}onEnter_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE"),this.client.showLoadingScreen({id:"_QAPP_LIB_LOADING_SCREEN_ESTABLISHING_DATABASE_CONNECTION",args:[]});let t=this.getConnection();this.databaseUpdateQAsked=!1,void 0!==t&&t.isConnected?(console.log("already connected"),this.client.addToEventQueue(new E.ImmediateEvent({from:A.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE,to:f}))):(console.log("open new connection"),this.client.enqueAsyncCall(n.createConnection(this.getConnectionOptions(w,this.cfg.qappEntities,this.cfg.syncByTypeorm)),A.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE))}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(t){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE"),
console.log("Connected successfully"),P}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(t){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE"),this.cfg.workflow?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_792_DB_CONN_WORKFLOW_ERROR,t.payload.reason):this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_797_DB_CONN_CONFWORKFLOW_ERROR,t.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY(){if(console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY"),!0===this.cfg.useLogTable){let t=this.getLogConnection();void 0!==t&&t.isConnected?(console.log("Log connection already exists!"),this.getLogTable()):(console.log("Creating new log connection."),this.client.enqueAsyncCall(n.createConnection(this.getConnectionOptions(V,[r.LogEntity],this.cfg.syncByTypeorm)),v))}else{console.log("Skipping log table checking/creation!");let t=function(){
return i.__awaiter(this,void 0,void 0,function*(){})};this.client.enqueAsyncCall(t(),R)}}getLogTable(){let t=n.getConnection(V);this.client.enqueAsyncCall(function(){return i.__awaiter(this,void 0,void 0,function*(){let e=t.createQueryRunner();yield e.connect();try{return yield e.getTables([t.entityMetadatas[0].tableName])}finally{yield e.release()}})}(),U)}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY(t){if(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_LOG_ENTITY"),!0!==this.cfg.useLogTable)return R;if(t.payload.metadata===v)return this.getLogTable(),"";if(t.payload.metadata===U){let e=n.getConnection(V);return void 0!==t.payload.result.find(t=>t.name===e.entityMetadatas[0].tableName)?R:this.cfg.workflow?(this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_791_DB_MIGRATION_RUNTIME_ERROR),""):O}return""}onEnter_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(){
console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE"),this.client.showMessageBox({type:u.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MSG_BOX_TITLE_DATABASE_NOT_PREPARED_ERROR",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_DATABASE_NOT_PREPARED_ERROR",args:[]}],buttons:[{appearance:I.EnumAppearance.ENABLED_SECONDARY,label:{id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},id:k},{appearance:I.EnumAppearance.ENABLED_SECONDARY,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},id:Y}]}),this.databaseUpdateQAsked=!0}doCreateLogEntityTable(){let t=this.getLogConnection();if(t&&t.isConnected){let e=this.databaseType,a=function(t){return i.__awaiter(this,void 0,void 0,function*(){let a=t.createQueryRunner();yield a.connect();try{return yield a.query(r.LOG_QUERY_STRINGS[e])}finally{yield a.release()}})};this.client.enqueAsyncCall(a(t),G)}else this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR)}
handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(t){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE"),t.payload.metadata===G?(this.createLogEntry(r.DB_LOG_ACTION_ADMIN,"Created log table in DB.",x),""):t.payload.metadata===x?R:""}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CREATE_LOG_ENTITY_TABLE(t){t.payload.reason.name===d.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):t.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,t.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_GET_TABLES(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_GET_TABLES");let t=this.getConnection();if(t&&t.isConnected){
let e=this.getTableNamesForAllEntities(t),a=function(t){return i.__awaiter(this,void 0,void 0,function*(){let a=t.createQueryRunner();yield a.connect();try{return yield a.getTables(e)}finally{yield a.release()}})};this.client.enqueAsyncCall(a(t),R)}else this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR)}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_GET_TABLES(t){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_GET_TABLES"),this.foundTablesInDb=t.payload.result,D}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_GET_TABLES(t){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_GET_TABLES"),
t.payload.reason.name===d.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):t.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,t.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES");let t=this.getConnection();if(t&&t.isConnected){this.generalCheckMigrationLogStr="",this.entityCheckResults=[],console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES: check expected tables to be found in DB");let e=!1;t.entityMetadatas.forEach(t=>{if(t.target!==r.LogEntity){let a=T.QAppBaseEntity.getSchemaVersionFromTableName(t.tableName);this.foundTablesInDb.find((e,a)=>e.name===t.tableName)?(console.log(`found table ${t.tableName}`),
this.entityCheckResults.push({metadata:t,expectedEntitySchemaVersion:a,lastFoundVersion:a,migrationNeeded:!0,migrationPossible:!1,migrationDoneSameVersion:!1,migrationDone:!1})):(e=!0,this.generalCheckMigrationLogStr+=`Missing table ${t.tableName}\n`,console.log(`missing table ${t.tableName} -> mark for searching older versions`),this.entityCheckResults.push({metadata:t,expectedEntitySchemaVersion:a,lastFoundVersion:NaN,migrationNeeded:!0,migrationPossible:!1,migrationDoneSameVersion:!1,migrationDone:!1}))}}),e?(console.log("some tables missing for this version of QApp"),this.client.addToEventQueue(new E.ImmediateEvent({from:D,to:C}))):(console.log("all current versions of tables found - nevertheless ask QApps for migrations (for the case that a QApp needs to update data in existing tables)"),this.client.addToEventQueue(new E.ImmediateEvent({from:D,to:M})))}else this.client.exitError("onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES: no connection object")}
onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES");let t=this.getConnection();if(t&&t.isConnected){let e=[];if(this.entityCheckResults.forEach(t=>{if(Number.isNaN(t.lastFoundVersion)&&t.expectedEntitySchemaVersion>1){this.generalCheckMigrationLogStr+=`Check for older schema version tables for ${t.metadata.tableName}.\n`,console.log(`Check for older schema version tables for ${t.metadata.tableName}.`);for(let a=t.expectedEntitySchemaVersion;a>=1;a--){let i=T.QAppBaseEntity.generateTableNameWithVersion(T.QAppBaseEntity.getPureTableNameFromTableName(t.metadata.tableName),a);console.log(`add search for ${i}`),e.push(i)}
}else Number.isNaN(t.lastFoundVersion)?console.log(`Table ${t.metadata.tableName} not found but expected in schema version 1 - skip...`):console.log(`Table ${t.metadata.tableName} found in expected version ${t.expectedEntitySchemaVersion} - skip getting older schema version tables`)}),e.length<=0)console.log("No tables to search for."),this.client.addToEventQueue(new E.ImmediateEvent({from:C,to:M}));else{console.log(`Find tables: '${e}'`);let a=function(t){return i.__awaiter(this,void 0,void 0,function*(){let a=t.createQueryRunner();yield a.connect();try{return yield a.getTables(e)}finally{yield a.release()}})};this.client.enqueAsyncCall(a(t),C)}}else this.client.exitError("onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES: no connection object")}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(t){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES"),
t.payload.metadata===C?(this.foundMissingTables=t.payload.result,this.entityCheckResults.forEach(t=>{if(Number.isNaN(t.lastFoundVersion)&&t.expectedEntitySchemaVersion>1)for(let e=t.expectedEntitySchemaVersion;e>=1;e--){let a=T.QAppBaseEntity.generateTableNameWithVersion(T.QAppBaseEntity.getPureTableNameFromTableName(t.metadata.tableName),e);if(this.foundMissingTables.find(t=>t.name===a)){t.lastFoundVersion=e,this.generalCheckMigrationLogStr+=`Found older schema version table ${a}.\n`,console.log(`Found older schema version table ${a}.`);break}}else Number.isNaN(t.lastFoundVersion)?console.log(`Table ${t.metadata.tableName} not found but expected in schema version 1 - skip...`):console.log(`Table ${t.metadata.tableName} found in expected version - skip...`)}),M):""}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES(t){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_GET_OLD_TABLES"),
t.payload.reason.name===d.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):t.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,t.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION"),this.client.enqueAsyncCall(this.cfg.checkMigration(this.getConnection(),this.entityCheckResults),M)}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(t){if(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION"),t.payload.metadata===M){this.migrationResult=t.payload.result,
this.migrationResult.logStr="QApp checkMigration() result:\n"+this.migrationResult.logStr,this.generalCheckMigrationLogStr.length>0&&(this.migrationResult.logStr=this.generalCheckMigrationLogStr+"\n"+this.migrationResult.logStr);let e="";switch(this.migrationResult.result){case A.EMigrationResult.MIGRATION_NOT_NEEDED:e=f;break;case A.EMigrationResult.MIGRATION_NEEDED:this.cfg.workflow?(this.migrationResult.logStr+="\nQApp not prepared in DB for running workflow",e=b):e=L;break;case A.EMigrationResult.MIGRATION_NOT_POSSIBLE:this.migrationResult.logStr+="\nQApp cannot migrate DB",e=b;break;default:this.client.exitError("ConnectAspec::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION: EMigrationResult has unexpected value: "+this.migrationResult.result)}return e}return""}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION(t){
console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_CHECK_MIGRATION"),t.payload.reason.name===d.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):t.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,t.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION"),!1===this.databaseUpdateQAsked?(this.client.showMessageBox({type:u.EnumMessageboxType.QUESTION,title:{id:"_QAPP_LIB_MSG_BOX_TITLE_DATABASE_MIGRATION_NEEDED",args:[]},textList:[{id:"_QAPP_LIB_MSG_BOX_QUESTION_DATABASE_MIGRATION_NEEDED",args:[]}],buttons:[{appearance:I.EnumAppearance.ENABLED_SECONDARY,label:{
id:"_QAPP_LIB_MBOX_BTN_YES",args:[]},id:k},{appearance:I.EnumAppearance.ENABLED_SECONDARY,label:{id:"_QAPP_LIB_MBOX_BTN_NO",args:[]},id:Y}]}),this.databaseUpdateQAsked=!0):this.doMigration()}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(t){if(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION"),t.payload.metadata===L){this.migrationResult.result=t.payload.result.result,this.migrationResult.logStr+="\nQApp doMigration() result:\n"+t.payload.result.logStr;let e="";switch(this.migrationResult.result){case A.EMigrationResult.MIGRATION_FAILED:this.migrationResult.logStr+="\nQApp failed during DB migration",e=b;break;case A.EMigrationResult.MIGRATION_DONE:this.migrationResult.logStr+="\nQApp succeeded DB migration",console.log(`QApp succeeded DB migration: ${this.migrationResult.logStr}`),console.log("record migration log - after that we should be successfully connected"),
this.createLogEntry(r.DB_LOG_ACTION_MIGRATION_SUCCEEDED,this.migrationResult.logStr,H);break;default:this.client.exitError("EMigrationResult has unexpected value")}return e}return t.payload.metadata===H?(console.log("migration log successfully recorded - connected"),f):""}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION(t){return console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_CHECK_ENTITIES_DO_MIGRATION"),t.payload.metadata===L?(this.migrationResult.result=A.EMigrationResult.MIGRATION_FAILED,t.payload.reason.name===d.QAppAsyncCallTimeoutErrorName?(this.migrationResult.logStr+="\nQApp failed during DB migration with timeout",b):(this.migrationResult.logStr+=`\nQApp failed during DB migration with error: ${this.getRootCauseStringForMigrationError(t.payload.reason)}`,
b)):t.payload.metadata===H?(t.payload.reason.name===d.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,t.payload.reason),""):""}doMigration(){this.client.enqueAsyncCall(function(t,e,a,s){return i.__awaiter(this,void 0,void 0,function*(){let i=t.createQueryRunner();yield i.connect(),yield i.startTransaction(g.getIsolationLevel(s));try{let t=yield e(i,a);return yield i.commitTransaction(),t}catch(t){throw yield i.rollbackTransaction(),t}finally{yield i.release()}})}(this.getConnection(),this.cfg.doMigration,this.entityCheckResults,this.databaseType),L)}getRootCauseStringForMigrationError(t){return`${t.name}: ${t.message}`}onEnter_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF"),
this.cfg.workflow?this.createLogEntry(r.DB_LOG_ACTION_MIGRATION_NEEDED_WORKFLOW,this.migrationResult.logStr,b):this.createLogEntry(r.DB_LOG_ACTION_MIGRATION_FAILED,this.migrationResult.logStr,b)}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(t){switch(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF"),this.migrationResult.result){case A.EMigrationResult.MIGRATION_FAILED:this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_795_DB_MIGRATION_FAILED_ERROR);break;case A.EMigrationResult.MIGRATION_NOT_POSSIBLE:this.cfg.workflow?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_791_DB_MIGRATION_RUNTIME_ERROR):this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_794_DB_MIGRATION_UNSUPPORTED_ERROR);break;case A.EMigrationResult.MIGRATION_NEEDED:this.cfg.workflow&&this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_791_DB_MIGRATION_RUNTIME_ERROR)
;break;default:this.client.exitError("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF: incorrect migr result: "+this.migrationResult.result)}}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF(t){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_MIGRATION_FAILED_OR_NEEDED_WF"),t.payload.reason.name===d.QAppAsyncCallTimeoutErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_793_DB_OPERATION_TIMEOUT_ERROR):t.payload.reason.name===h.ConnectionLostErrorName?this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_796_DB_CONN_LOST_ERROR):this.client.messageHandlerHelper.addMessage(c.EMsgHandlerMsgs.ERR_790_GENERIC_DB_ERROR,t.payload.reason)}onEnter_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE");const t=this.getLogConnection()
;t&&t.isConnected?this.client.enqueAsyncCall(t.close(),F,s.HEARTBEAT_INTERVAL_MS):(console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE - log connection already closed or lost."),this.client.addToEventQueue(new E.ImmediateEvent({from:f,to:this.cfg.nextState})))}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(t){return console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE"),this.cfg.nextState}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE(t){return console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_NEXT_STATE: "+m.inspect(t.payload)),this.cfg.nextState}onEnter_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE");const t=this.getConnection(),e=this.getLogConnection();t&&t.isConnected?(console.log("Closing main connection"),
this.client.enqueAsyncCall(t.close(),Q,s.HEARTBEAT_INTERVAL_MS)):e&&e.isConnected?(console.log("Closing log connection"),this.client.enqueAsyncCall(e.close(),F,s.HEARTBEAT_INTERVAL_MS)):(console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE - log connection already closed or lost."),this.client.addToEventQueue(new E.ImmediateEvent({from:y,to:this.cfg.cancelState})))}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(t){if(console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE"),t.payload.metadata===Q){const t=this.getLogConnection();if(t&&t.isConnected)return console.log("Closing log connection"),this.client.enqueAsyncCall(t.close(),F,s.HEARTBEAT_INTERVAL_MS),""}return this.cfg.cancelState}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE(t){
if(console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_CANCEL_STATE: "+m.inspect(t.payload)),t.payload.metadata===Q){const t=this.getLogConnection();if(t&&t.isConnected)return console.log("Closing log connection"),this.client.enqueAsyncCall(t.close(),F,s.HEARTBEAT_INTERVAL_MS),""}return this.cfg.cancelState}onEnter_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(){console.log("ConnectionAspect::onEnter_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND"),this.client.suspend()}handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(t){console.log("ConnectionAspect::handleAsyncCallDoneEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND"),this.client.suspend()}handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND(t){console.log("ConnectionAspect::handleAsyncCallFailEvent_STATE_CONNECTION_ASPECT_INTERNAL_SUSPEND: "+m.inspect(t.payload)),this.client.suspend()}getTableNamesForAllEntities(t){return t.entityMetadatas.map(t=>t.tableName)}}},function(t,e,a){
"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(9),s=a(16),n=a(31);e.DB_LOG_ACTION_MIGRATION_FAILED="MIGRATION_FAILED",e.DB_LOG_ACTION_MIGRATION_NEEDED_WORKFLOW="MIGRATION_NEEDED_WORKFLOW",e.DB_LOG_ACTION_MIGRATION_SUCCEEDED="MIGRATION_SUCCEEDED",e.DB_LOG_ACTION_ADMIN="ADMIN",e.LOG_QUERY_STRINGS={mssql:"",mysql:"CREATE TABLE `log` (`id` int NOT NULL AUTO_INCREMENT, `serial` varchar(255) NOT NULL, `taskId` varchar(255) NOT NULL, `version` int NOT NULL, `date` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `qappOrderNo` varchar(255) NOT NULL, `qappVersion` varchar(255) NOT NULL, `action` varchar(255) NOT NULL, `details` text NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB",
postgres:'CREATE TABLE "log" ("id" SERIAL NOT NULL, "serial" character varying NOT NULL, "taskId" character varying NOT NULL, "version" integer NOT NULL, "date" TIMESTAMP NOT NULL DEFAULT now(), "qappOrderNo" character varying NOT NULL, "qappVersion" character varying NOT NULL, "action" character varying NOT NULL, "details" text NOT NULL, CONSTRAINT "PK_f77cbf8486ae8b6fd0342d62208" PRIMARY KEY ("id"))',sqlite:'CREATE TABLE "log" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "serial" varchar NOT NULL, "taskId" varchar NOT NULL, "version" integer NOT NULL, "date" datetime NOT NULL DEFAULT (datetime(\'now\')), "qappOrderNo" varchar NOT NULL, "qappVersion" varchar NOT NULL, "action" varchar NOT NULL, "details" text NOT NULL)'};let r=class extends n.QAppBaseEntity{constructor(){super(...arguments),this.id=0,this.qappOrderNo="",this.qappVersion="",this.action="",this.details=""}getEntityTableNameNoSchemaVersion(){return"log"}getSchemaVersion(){return NaN}}
;i.__decorate([s.PrimaryGeneratedColumn(),i.__metadata("design:type",Number)],r.prototype,"id",void 0),i.__decorate([s.CreateDateColumn(),i.__metadata("design:type",Date)],r.prototype,"date",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],r.prototype,"qappOrderNo",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],r.prototype,"qappVersion",void 0),i.__decorate([s.Column(),i.__metadata("design:type",String)],r.prototype,"action",void 0),i.__decorate([s.Column({type:"text"}),i.__metadata("design:type",String)],r.prototype,"details",void 0),r=i.__decorate([s.Entity("log")],r),e.LogEntity=r},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(9),s=a(16),n=a(15);let r=class{beforeInsert(t){""===t.entity.serial&&(t.entity.serial=n.QAppBase.clientSingleton.getSerialNumber()),""===t.entity.taskId&&(t.entity.taskId=n.QAppBase.clientSingleton.getTaskId()||"create Task")}beforeUpdate(t){
void 0!==t.entity&&(""===t.entity.serial&&(t.entity.serial=n.QAppBase.clientSingleton.getSerialNumber()),""===t.entity.taskId&&(t.entity.taskId=n.QAppBase.clientSingleton.getTaskId()||"create Task"))}};r=i.__decorate([s.EventSubscriber()],r),e.QAppBaseSubscriber=r},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConnectionLostErrorName="ConnectionLostError";class i extends Error{constructor(){super(),this.name=e.ConnectionLostErrorName,Object.setPrototypeOf(this,i.prototype),this.message="Lost connection to database."}}e.ConnectionLostError=i},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getIsolationLevel=function(t){switch(t){case"sqlite":return"SERIALIZABLE";case"postgres":case"mysql":case"mssql":return"READ COMMITTED";default:return}}},,function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(13);!function(t){t.GREEN="#8CD31C",t.LIGHT_GREEN="#D8E4C0",t.YELLOW="#FADD37",
t.WHITE="#FFFFFF",t.RED="#E60046",t.BLUE="#0069BE",t.LIGHT_RED="#E6B9B5",t.GREY="#C4C4C4"}(e.EnumColors||(e.EnumColors={}));e.BaseChart=class{constructor(){this.initialized=!1,this.canRemoveLastValue=!0,this.chartValues=[],this.chartConfiguration={}}removeLastValue(){if(!this.initialized)throw new Error("Chart object still not initialized.");this.canRemoveLastValue&&(this.chartValues.pop(),this.canRemoveLastValue=!1),this.recalculateChartData()}resetGraphTab(t){if(!this.initialized)throw new Error("Chart object still not initialized.");void 0!==t?(this.chartValues=t,this.canRemoveLastValue=!0):this.chartValues=[],this.recalculateChartData()}getChartData(){if(this.initialized)return this.chartValues;throw new Error("Chart object still not initialized.")}sortByKeys(t){const e=[...Object.keys(t)].sort((t,e)=>parseFloat(t)-parseFloat(e));return i.map(e,e=>[e,t[e]])}getChartConfiguration(){if(this.initialized)return this.chartConfiguration
;throw new Error("Chart object still not initialized.")}}},,,,,function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(9),s=a(25),n=a(3),r=a(122),o=a(67),_=a(11),E=a(26),l=a(12),u=a(24),c=a(46),T=a(0),d=a(2),p=a(38),A=a(94),I=a(116),h=a(44),m=a(48),N=a(8),S=a(41),g=a(110),R=a(17),P=a(23),O=a(1),D=a(4),C=a(7),M=a(34),L=a(18),b=a(15),f=a(123),y=a(68),B=a(69),v="/QAPP/DATABASE_ACTION_DONE",U=500,G=500,x=50;var H,Q,F,w;!function(t){t[t.create_product=0]="create_product",t[t.modify_product=1]="modify_product",t[t.create_batch=2]="create_batch",t[t.modify_batch=3]="modify_batch",t[t.perform_test=4]="perform_test",t[t.result_tare_measurement=5]="result_tare_measurement",t[t.result_test_process=6]="result_test_process",t[t.interim_result_test_process=7]="interim_result_test_process",t[t.result_finish_batch=8]="result_finish_batch",t[t.interim_result_batch=9]="interim_result_batch"}(H||(H={})),function(t){t[t.load_product_list=0]="load_product_list",
t[t.store_product=1]="store_product",t[t.load_product=2]="load_product",t[t.load_all_products=3]="load_all_products",t[t.remove_product=4]="remove_product",t[t.load_batch_list=5]="load_batch_list",t[t.store_batch=6]="store_batch",t[t.load_batch=7]="load_batch",t[t.remove_batch=8]="remove_batch"}(Q||(Q={})),function(t){t.init="init",t.wait_clear_pan="wait_clear_pan",t.wait_zero="wait_zero",t.wait_auto_acquisition="wait_auto_acquisition",t.wait_dsd="wait_dsd",t.got_dsd="got_dsd"}(F||(F={})),function(t){t[t.product_import=0]="product_import",t[t.product_import_list_files=1]="product_import_list_files",t[t.product_import_do_transfer=2]="product_import_do_transfer",t[t.product_export=3]="product_export",t[t.product_export_do_transfer=4]="product_export_do_transfer"}(w||(w={}));let V="",k=h.createTaskConfig(),Y={},W={},q=h.createProduct(),K=h.createBatch(),j=h.createProcess();function X(){p.fs.existsSync(b.STORAGE_LOCATION_BASE)||p.fs.mkdirSync(b.STORAGE_LOCATION_BASE)
;let t=p.path.join(b.STORAGE_LOCATION_BASE,h.QAPP_ID);p.fs.existsSync(t)||p.fs.mkdirSync(t),V=t,console.log("Directories initiated")}e.initDirectories=X;class J extends A.wfRunner{constructor(){super(!0),this.dbConn=void 0,this.dbMigrationResult=f.createDatabaseMigration(),this.workflowState=H.create_product,this.weighingScreenState=F.init,this.dataTransferState=w.product_export,this.isQuickTest=!1,this.dataTransferProgressTopic="",this.dataTransferSelectedConnector="",this.dataTransferCacheFilePath="",this.dataTransferImportDBproductKeys=[],this.weighingWaitingTimeout=0,this.selectableListButtons={},this.LID_parameters=[],this.fsmTimers={},this.registerAspect(new g.ConnectionAspect)}GET_QAPP_META_DATA(){return{qappID:h.QAPP_ID,qappToken:h.QAPP_ID,
stateScreenFunctions:[this.alias_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE.name,this.CHECK_DATABASE.name,this.CHECK_FOR_DATABASE_MIGRATION.name,this.MAIN_MENU.name,this.SELECT_BATCH.name,this.ENTER_BATCH_DATA.name,this.SELECT_PRODUCT.name,this.ENTER_PRODUCT_DATA.name,this.ENTER_PRODUCT_DATA_TARES.name,this.BATCH_MENU.name,this.ENTER_INPROCESS_DATA.name,this.PROCESS_EF_EMPTY_MEASUREMENT.name,this.PROCESS_EF_FILLING_MEASUREMENT.name,this.PROCESS_FE_FILLED_MEASUREMENT.name,this.PROCESS_FE_EMPTY_MEASUREMENT.name,this.PERFORM_PRODUCT_EXPORT.name,this.PERFORM_PRODUCT_IMPORT.name,this.SHOW_PROCESS_RESULT.name,this.SHOW_BATCH_RESULT.name],initialStateFunction:this.alias_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE.name}}_____________________INTIALIZATION__________________(){}postInit(){super.postInit(),k=h.createTaskConfig(p.loadTaskConfig_DATA_CONTAINER(this.taskHandler)),X(),this.dataTransferCacheFilePath=p.path.join(V,"transfer.cache"),this.identifierAspect.configure({
returnState:this.MAIN_MENU(),taskHandler:this.taskHandler,autoRememberSIDs:!1,showPreviouslySetLIDs:!0}),this.identifierAspect.setLotIDs(k.last_used_LIDs),this.aspects[S.CONNECTION_ASPECT].configure({nextState:this.CHECK_DATABASE(),cancelState:this.CHECK_DATABASE(),workflow:!0,qappEntities:[B.ProductEntity,y.BatchEntity],checkMigration:function(t){return i.__awaiter(this,void 0,void 0,function*(){return{result:S.EMigrationResult.MIGRATION_NOT_NEEDED,logStr:""}})},doMigration:function(){return i.__awaiter(this,void 0,void 0,function*(){return{result:S.EMigrationResult.MIGRATION_NOT_NEEDED,logStr:""}})},taskHandler:this.taskHandler,qappSpecificSqliteDatabaseLocation:!0,useLogTable:!1,syncByTypeorm:!1}),this.mqttHandler.subscribe(O.MqttTopics.WEIGHING_WAITING_FOR_STABILITY)}alias_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE(t,e){
return t||e?!t&&e&&C.isString(e)&&"GET_EVENT_LISTENER"===e?JSON.stringify([]):e&&t?"":(console.log(" ## DEBUG ## "+this.alias_STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE()+": Missing argument"),""):S.STATE_CONNECTION_ASPECT_CONNECT_TO_DATABASE}CHECK_DATABASE(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.CHECK_DATABASE.name;if(!t&&e&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED]);if(!e||!t)return console.log(" ## DEBUG ## "+this.CHECK_DATABASE()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){A.btn.msg_ok=this.createMessageButton(l.EnumFontLabels.OK);let e=this.aspects[S.CONNECTION_ASPECT].getConnection();return this.dbConn=void 0===e?void 0:e,this.hideMsgBox(),this.hideLoadingScreen(),void 0!==this.dbConn&&this.dbConn.isConnected?(t.transition(this,this.CHECK_FOR_DATABASE_MIGRATION()),
""):(this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_DB_NOT_ACCESSIBLE"),A.l("_QAPP006_MESSAGE_DB_NOT_ACCESSIBLE"),[A.btn.msg_ok]),"")}return C.isString(e)&&"onExit"===e?(this.hideMsgBox(),this.showLoadingScreen(),""):(C.isObject(e)&&e.type&&e.type===s.EV_HMI_BTN_CLICKED&&e.payload.buttonId===A.btn.msg_ok.getButtonId()&&this.suspend(),"")}CHECK_FOR_DATABASE_MIGRATION(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.CHECK_FOR_DATABASE_MIGRATION.name;if(!t&&e&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,N.SIMPLE_EVENT]);if(!e||!t)return console.log(" ## DEBUG ## "+this.CHECK_FOR_DATABASE_MIGRATION()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e)return A.btn.msgDbQueryFailed=this.createMessageButton(l.EnumFontLabels.OK),A.btn.msgDbMigrationDone=this.createMessageButton(l.EnumFontLabels.OK),f.databaseMigration(this,"DATABASE_MIGRATION"),"";if(C.isString(e)&&"onExit"===e)return this.hideMsgBox(),
this.showLoadingScreen(),"";if(C.isObject(e)&&e.type&&e.type===s.EV_HMI_BTN_CLICKED){if(e.payload.buttonId===A.btn.msgDbQueryFailed.getButtonId())return this.suspend(),"";if(e.payload.buttonId===A.btn.msgDbMigrationDone.getButtonId())return t.transition(this,this.MAIN_MENU()),""}const a=f.parseDatabaseEvent(e);if(!0===a.isHandled){if(!0!==a.success)return this.DatabaseErrorMsg(a.result,[A.btn.msgDbQueryFailed]),"";switch(a.context){case"DATABASE_MIGRATION":{this.dbMigrationResult=a.result;let e=!0,i="";for(const t of Object.values(this.dbMigrationResult))switch(t.status){case S.EMigrationResult.MIGRATION_DONE:case S.EMigrationResult.MIGRATION_NEEDED:i+="<br>- "+t.message;break;case S.EMigrationResult.MIGRATION_FAILED:e=!1,i+="<br>- "+t.message}return i.length>0?(this.hideLoadingScreen(),!0===e?(this.showMessageBox(_.EnumMessageboxType.INFO,A.l("_QAPP006_HEADER_DB_MIGRATION"),A.l("_QAPP006_MESSAGE_DB_MIGRATION_SUCCESSFULL",[i]),[A.btn.msgDbMigrationDone]),
""):(this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_DB_MIGRATION"),A.l("_QAPP006_MESSAGE_DB_MIGRATION_FAILED",[i]),[A.btn.msgDbMigrationDone]),"")):(t.transition(this,this.MAIN_MENU()),"")}}}return""}_____________________SCREENS__________________(){}MAIN_MENU(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.MAIN_MENU.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED]);if(!e||!t)return console.log(" ## DEBUG ## "+this.MAIN_MENU()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){if(!k.supervisor_roles.includes(this.USER.role_id))return t.transition(this,this.SELECT_BATCH()),"";A.btn.quick_test=this.createMenuButton(A.l("_QAPP006_QUICK_TEST"),T.EnumAppearance.HIDDEN),A.btn.select_batch=this.createMenuButton(A.l("_QAPP006_SELECT_BATCHES"),T.EnumAppearance.ENABLED),A.btn.select_product=this.createMenuButton(A.l("_QAPP006_SELECT_CONF_PRODUCTS")),A.btn.msg_ok=this.createMessageButton(l.EnumFontLabels.OK),
A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK),this.weighingProxy.clearTare2();let e={id:this.IDEXTEND_SCREEN+this.MAIN_MENU.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_MAIN_MENU"),args:[]},title:n.createEmptyTextStructure(),topbuttons:[],menuType:E.TAB_MENU_TYPE_TOPIC,menubuttons:["/QAPP/"+A.btn.quick_test.getTopic(),"/QAPP/"+A.btn.select_batch.getTopic(),"/QAPP/"+A.btn.select_product.getTopic()],scrollToTop:!1};this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.CANCEL,args:[]}),this.mainScreen.showTopLeftButton(),this.mainScreen.setMenuTab(e),this.showScreen(this.mainScreen),this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.loadProductList()}else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox(),""
;if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED)e.payload.buttonId===A.btn.quick_test.getButtonId()?(this.workflowState=H.perform_test,this.isQuickTest=!0,t.transition(this,this.SELECT_PRODUCT())):e.payload.buttonId===A.btn.select_batch.getButtonId()?(this.isQuickTest=!1,t.transition(this,this.SELECT_BATCH())):e.payload.buttonId===A.btn.select_product.getButtonId()?(this.workflowState=H.modify_product,t.transition(this,this.SELECT_PRODUCT())):e.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID?this.suspend():e.payload.buttonId===A.btn.msg_ok.getButtonId()?this.hideMsgBox():e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId()&&this.hideMsgBox();else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT&&C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let t=e.payload;t.context===Q.load_product_list?!0===t.success?(A.btn.select_product.setLabelRight({id:Object.keys(Y).length.toFixed(0),args:[]}),
k.enable_quicktest===h.EnumQuickTestEnabled.ENABLED&&A.btn.quick_test.setAppearance(Object.keys(Y).length>0?T.EnumAppearance.ENABLED:T.EnumAppearance.DISABLED,!0),this.loadBatchList()):this.DatabaseErrorMsg(t.result,[A.btn.msg_dbquery_failed]):t.context===Q.load_batch_list&&(!0===t.success?(A.btn.select_batch.setLabelRight({id:Object.keys(W).length.toFixed(0),args:[]}),this.hideLoadingScreen()):this.DatabaseErrorMsg(t.result,[A.btn.msg_dbquery_failed]))}}return""}SELECT_PRODUCT(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.SELECT_PRODUCT.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED]);if(!e||!t)return console.log(" ## DEBUG ## "+this.SELECT_PRODUCT()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e)A.btn.new_product=this.createMenuButton(l.EnumFontLabels.ADD),A.btn.im_ex_port=this.createMenuButton(A.l("_QAPP006_BUTTON_TRANSFER"),T.EnumAppearance.ENABLED),
A.btn.msg_im_ex_port_cancel=this.createMessageButton(l.EnumFontLabels.BACK),A.btn.msg_import=this.createMessageButton(A.l("_QAPP006_BUTTON_TRANSFER_IMPORT")),A.btn.msg_export=this.createMessageButton(A.l("_QAPP006_BUTTON_TRANSFER_EXPORT")),A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.loadProductList();else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox(),"";if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED){if(!0===this.InitializeTestRun(t,e,!1))return"";if(e.payload.buttonId===A.btn.new_product.getButtonId())q=h.createProduct(),this.workflowState=H.create_product,
t.transition(this,this.ENTER_PRODUCT_DATA());else if(this.selectableListButtons.hasOwnProperty(e.payload.buttonId))this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.loadProduct(this.selectableListButtons[e.payload.buttonId].metadata);else{if(e.payload.buttonId===A.btn.im_ex_port.getButtonId())return this.showMessageBox(_.EnumMessageboxType.QUESTION,A.l("_QAPP006_HEADER_IM_EXPORT_PRODUCTS"),A.l("_QAPP006_MESSAGE_IM_EXPORT_PRODUCTS"),[A.btn.msg_im_ex_port_cancel,A.btn.msg_export,A.btn.msg_import]),"";e.payload.buttonId===A.btn.msg_im_ex_port_cancel.getButtonId()?this.hideMsgBox():e.payload.buttonId===A.btn.msg_export.getButtonId()?(this.dataTransferState=w.product_export,t.transition(this,this.PERFORM_PRODUCT_EXPORT())):e.payload.buttonId===A.btn.msg_import.getButtonId()?(this.dataTransferState=w.product_import,
t.transition(this,this.PERFORM_PRODUCT_IMPORT())):e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId()?this.hideMsgBox():e.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID&&(this.workflowState===H.create_batch?t.transition(this,this.ENTER_BATCH_DATA()):t.transition(this,this.MAIN_MENU()))}}else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT&&C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let a=e.payload;if(a.context===Q.load_product_list)if(!0===a.success){let t=[];this.selectableListButtons={};let e=p.sortKeys(Y);for(let a=0;a<e.length;a++)if(Y.hasOwnProperty(e[a])){let i="RESERVED_BUTTONID_productList_"+a.toFixed(0);A.btn[i]=this.createMenuButton(e[a],T.EnumAppearance.ENABLED,!1),A.btn[i].setLabelRight({id:h.EnumMapTareType[Y[e[a]].proc_tare_type],args:[]}),!1===Y[e[a]].valid_dataset&&(A.btn[i].setLabelCenter({id:A.l("_QAPP006_PARAMVAL_INFO_INVALID"),args:[]}),
this.workflowState!==H.create_batch&&this.workflowState!==H.perform_test||A.btn[i].setAppearance(T.EnumAppearance.DISABLED)),t.push(A.btn[i].getJson()),this.selectableListButtons[A.btn[i].getButtonId()]={button:A.btn[i],metadata:e[a]}}let a={id:this.IDEXTEND_SCREEN+this.SELECT_PRODUCT.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_SELECT_PRODUCTS"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:E.TAB_MENU_TYPE_BULK,menuBulkButtons:t,scrollToTop:!1},i=[];this.workflowState!==H.create_batch&&this.workflowState!==H.perform_test&&(i.push(A.btn.im_ex_port),Object.keys(Y).length<U&&i.push(A.btn.new_product)),this.mainScreen.setMenuTab(a,i),this.hideLoadingScreen()
}else this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]);else a.context===Q.load_product&&(!0===a.success?this.workflowState===H.create_batch?t.transition(this,this.ENTER_BATCH_DATA()):this.workflowState===H.modify_product?t.transition(this,this.ENTER_PRODUCT_DATA()):this.workflowState===H.perform_test&&!0===this.isQuickTest&&(this.hideLoadingScreen(),(K=h.createBatch()).product=d.cloneJSON(q),K.lot_ids[0]="QUICKTEST",this.InitializeTestRun(t,e,!0)):this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]))}}return""}PERFORM_PRODUCT_EXPORT(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.PERFORM_PRODUCT_EXPORT.name;if(!t&&e&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,u.EV_MQTT_UPDATE]);if(!e||!t)return console.log(" ## DEBUG ## "+this.PERFORM_PRODUCT_EXPORT()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){A.btn.msg_transfer_succeeded=this.createMessageButton(l.EnumFontLabels.OK),
A.btn.msg_transfer_failed=this.createMessageButton(l.EnumFontLabels.OK),A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK),A.btn.info_select_connector=this.createMenuButton(A.l("_QAPP006_SCREENTITLE_SELECT_CONNECTOR"),T.EnumAppearance.DISABLED),A.btn.info_select_file=this.createMenuButton(A.l("_QAPP006_SCREENTITLE_SELECT_FILE"),T.EnumAppearance.DISABLED);let t=this.perform_InternalWebserviceRequest("connman",D.RestMethodsCONNECTOR_MANAGEMENT.getConfigurations,{type:"",category:"MASS_STORAGE",rConfigurations:{}}),e=JSON.parse(t.rawReturns.rConfigurations).data,a=[];a.push("/QAPP/"+A.btn.info_select_connector.getTopic()),this.selectableListButtons={};for(let t=0;t<e.length;t++)if("INTERNAL_SD"!==e[t].configType){let i="RESERVED_BUTTONID_fileconnectorList_"+t.toFixed(0),s="";for(let a=0;a<e[t].params.length;a++)"FILETRANSFERNAME/CONFIGURATION/NAME"===e[t].params[a].id&&(s=e[t].params[a].value.string);A.btn[i]=this.createMenuButton(s),
a.push("/QAPP/"+A.btn[i].getTopic()),this.selectableListButtons[A.btn[i].getButtonId()]={button:A.btn[i],metadata:e[t]._id}}let i={id:this.IDEXTEND_SCREEN+this.PERFORM_PRODUCT_EXPORT.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_EXPORT_FILE"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:E.TAB_MENU_TYPE_TOPIC,menubuttons:a,scrollToTop:!1};this.mainScreen.setMenuTab(i,[]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.hideMsgBox(),"";if(C.isObject(e)&&e.type&&e.type===s.EV_HMI_BTN_CLICKED)this.selectableListButtons.hasOwnProperty(e.payload.buttonId)?this.dataTransferState===w.product_export&&(this.dataTransferSelectedConnector=this.selectableListButtons[e.payload.buttonId].metadata,this.showLoadingScreen({
id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.loadAllProducts()):e.payload.buttonId===A.btn.msg_transfer_succeeded.getButtonId()?t.transition(this,this.SELECT_PRODUCT()):e.payload.buttonId===A.btn.msg_transfer_failed.getButtonId()?this.hideMsgBox():e.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID?t.transition(this,this.SELECT_PRODUCT()):e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId()&&this.hideMsgBox();else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT){if(C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let t=e.payload;if(t.context===Q.load_all_products)if(!0===t.success){this.showLoadingScreen({id:A.l("_QAPP006_LOADING_SCREEN_DATA_TRANSFER"),args:[]}),p.fs.writeFileSync(this.dataTransferCacheFilePath,JSON.stringify(Y));let t=this.perform_InternalWebserviceRequest("connman",D.RestMethodsCONNECTOR_MANAGEMENT.putFileAsyncWithoutMD5,{connectorIdentifier:this.dataTransferSelectedConnector,
targetFilePathInConnector:M.getDateTime("frmt","yymmdd_HHMMss")+"."+h.QAPP_ID+".products"+B.DB_SCHEMA_VERSION_PRODUCTS.toFixed(0),sourceFilePathOnFileSystem:this.dataTransferCacheFilePath,progressTopic:""});t&&t.isSuccess()&&C.isObject(t.rawReturns)&&C.isString(t.rawReturns.progressTopic)?(this.dataTransferState=w.product_export_do_transfer,this.dataTransferProgressTopic=t.rawReturns.progressTopic,this.mqttHandler.subscribe(this.dataTransferProgressTopic)):(this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_TRANSFER_FAIL"),A.l("_QAPP006_MESSAGE_TRANSFER_FAIL",[C.isObject(t.restResponse)?t.restResponse.error.message:"- unknown error -"]),[A.btn.msg_transfer_failed]),this.hideLoadingScreen())}else this.DatabaseErrorMsg(t.result,[A.btn.msg_dbquery_failed])}}else if(C.isObject(e)&&e.type&&e.type===u.EV_MQTT_UPDATE&&e.payload.topic===this.dataTransferProgressTopic){let t=JSON.parse(e.payload.value.toString())
;C.isObject(t)&&C.isString(t.state)&&("SUCCESS"===t.state?(this.showMessageBox(_.EnumMessageboxType.INFO,A.l("_QAPP006_HEADER_TRANSFER_SUCCESS"),A.l("_QAPP006_MESSAGE_TRANSFER_SUCCESS"),[A.btn.msg_transfer_succeeded]),this.hideLoadingScreen(),p.fs.unlinkSync(this.dataTransferCacheFilePath)):"FAILURE"===t.state&&(this.dataTransferState=w.product_export,this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_TRANSFER_FAIL"),A.l("_QAPP006_MESSAGE_TRANSFER_FAIL",[t.resultInfo]),[A.btn.msg_transfer_failed]),this.hideLoadingScreen()))}}return""}PERFORM_PRODUCT_IMPORT(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.PERFORM_PRODUCT_IMPORT.name;if(!t&&e&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,u.EV_MQTT_UPDATE]);if(!e||!t)return console.log(" ## DEBUG ## "+this.PERFORM_PRODUCT_IMPORT()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){A.btn.msg_transfer_succeeded=this.createMessageButton(l.EnumFontLabels.OK),
A.btn.msg_transfer_failed=this.createMessageButton(l.EnumFontLabels.OK),A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK),A.btn.info_select_connector=this.createMenuButton(A.l("_QAPP006_SCREENTITLE_SELECT_CONNECTOR"),T.EnumAppearance.DISABLED),A.btn.info_select_file=this.createMenuButton(A.l("_QAPP006_SCREENTITLE_SELECT_FILE"),T.EnumAppearance.DISABLED);let t=this.perform_InternalWebserviceRequest("connman",D.RestMethodsCONNECTOR_MANAGEMENT.getConfigurations,{type:"",category:"MASS_STORAGE",rConfigurations:{}}),e=JSON.parse(t.rawReturns.rConfigurations).data,a=[];a.push("/QAPP/"+A.btn.info_select_connector.getTopic()),this.selectableListButtons={};for(let t=0;t<e.length;t++)if("INTERNAL_SD"!==e[t].configType){let i="RESERVED_BUTTONID_fileconnectorList_"+t.toFixed(0),s="";for(let a=0;a<e[t].params.length;a++)"FILETRANSFERNAME/CONFIGURATION/NAME"===e[t].params[a].id&&(s=e[t].params[a].value.string);A.btn[i]=this.createMenuButton(s),
a.push("/QAPP/"+A.btn[i].getTopic()),this.selectableListButtons[A.btn[i].getButtonId()]={button:A.btn[i],metadata:e[t]._id}}let i={id:this.IDEXTEND_SCREEN+this.PERFORM_PRODUCT_IMPORT.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_IMPORT_FILE"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:E.TAB_MENU_TYPE_TOPIC,menubuttons:a,scrollToTop:!1};this.mainScreen.setMenuTab(i,[]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else if(C.isString(e)&&"onExit"===e)this.showLoadingScreen(),this.hideMsgBox();else if(C.isObject(e)&&e.type&&e.type===N.QAPP_TIMER_EVENT){if("LOADING_SCREEN_IS_OVERWHELMING"===e.payload){let t=this.perform_InternalWebserviceRequest("connman",D.RestMethodsCONNECTOR_MANAGEMENT.listDirectory,{connectorIdentifier:this.dataTransferSelectedConnector,directoryPath:"",
filter:JSON.stringify({type:"DONT_CARE",regex:".*"}),sorting:JSON.stringify({type:"ALPHANUMERIC",order:"DESCENDING"}),contentList:[]});if(t&&t.isSuccess()&&C.isObject(t.rawReturns)&&C.isObject(t.rawReturns.contentList)){this.dataTransferState=w.product_import_list_files;let e=[];e.push("/QAPP/"+A.btn.info_select_file.getTopic()),this.selectableListButtons={};for(let a=0;a<t.rawReturns.contentList.length;a++)if(t.rawReturns.contentList[a].endsWith("."+h.QAPP_ID+".products"+B.DB_SCHEMA_VERSION_PRODUCTS.toFixed(0))||t.rawReturns.contentList[a].endsWith(".QAPP999_VIAL_CHECKER_ADV_STATS.products")){let i="RESERVED_BUTTONID_fileList_"+a.toFixed(0);A.btn[i]=this.createMenuButton(t.rawReturns.contentList[a]),e.push("/QAPP/"+A.btn[i].getTopic()),this.selectableListButtons[A.btn[i].getButtonId()]={button:A.btn[i],metadata:t.rawReturns.contentList[a]}}let a={id:this.IDEXTEND_SCREEN+this.PERFORM_PRODUCT_IMPORT.name+"_2",appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,
containerTitle:{id:A.l("_QAPP006_SCREENTITLE_IMPORT_FILE"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:E.TAB_MENU_TYPE_TOPIC,menubuttons:e,scrollToTop:!1};this.mainScreen.setMenuTab(a,[]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_TRANSFER_FAIL"),A.l("_QAPP006_MESSAGE_TRANSFER_FAIL",["Unexpected error at listDirectory"]),[A.btn.msg_transfer_failed]),this.hideLoadingScreen()}}else if(C.isObject(e)&&e.type&&e.type===s.EV_HMI_BTN_CLICKED)if(this.selectableListButtons.hasOwnProperty(e.payload.buttonId)){if(this.dataTransferState===w.product_import)this.dataTransferSelectedConnector=this.selectableListButtons[e.payload.buttonId].metadata,this.showLoadingScreen({id:A.l("_QAPP006_LOADING_SCREEN_DATA_TRANSFER"),args:[]}),
this.addTimer(200,"LOADING_SCREEN_IS_OVERWHELMING");else if(this.dataTransferState===w.product_import_list_files){let t=this.selectableListButtons[e.payload.buttonId].metadata;this.showLoadingScreen({id:A.l("_QAPP006_LOADING_SCREEN_DATA_TRANSFER"),args:[]});let a=this.perform_InternalWebserviceRequest("connman",D.RestMethodsCONNECTOR_MANAGEMENT.getFileAsyncWithoutMD5,{connectorIdentifier:this.dataTransferSelectedConnector,targetFileOnFilesystem:this.dataTransferCacheFilePath,sourceFilePathInConnector:t,progressTopic:""});return a&&a.isSuccess()&&C.isObject(a.rawReturns)&&C.isString(a.rawReturns.progressTopic)?(this.dataTransferState=w.product_import_do_transfer,this.dataTransferProgressTopic=a.rawReturns.progressTopic,
this.mqttHandler.subscribe(this.dataTransferProgressTopic)):(this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_TRANSFER_FAIL"),A.l("_QAPP006_MESSAGE_TRANSFER_FAIL",[C.isObject(a.restResponse)?a.restResponse.error.message:"- unknown error -"]),[A.btn.msg_transfer_failed]),this.hideLoadingScreen()),""}}else e.payload.buttonId===A.btn.msg_transfer_succeeded.getButtonId()?t.transition(this,this.SELECT_PRODUCT()):e.payload.buttonId===A.btn.msg_transfer_failed.getButtonId()?this.hideMsgBox():e.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID?t.transition(this,this.SELECT_PRODUCT()):e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId()&&this.hideMsgBox();else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT){if(C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let t=e.payload
;if(t.context===Q.load_product_list)!0===t.success?this.hideLoadingScreen():this.DatabaseErrorMsg(t.result,[A.btn.msg_dbquery_failed]);else if(t.context===Q.store_product){if(!0!==t.success)return this.dataTransferState=w.product_import_list_files,this.DatabaseErrorMsg(t.result,[A.btn.msg_dbquery_failed]),this.hideLoadingScreen(),this.dataTransferImportDBproductKeys=[],"";if(this.dataTransferImportDBproductKeys.shift(),0===this.dataTransferImportDBproductKeys.length)return this.showMessageBox(_.EnumMessageboxType.INFO,A.l("_QAPP006_HEADER_TRANSFER_SUCCESS"),A.l("_QAPP006_MESSAGE_TRANSFER_SUCCESS"),[A.btn.msg_transfer_succeeded]),this.hideLoadingScreen(),"";this.storeProduct(Y[this.dataTransferImportDBproductKeys[0]])}}}else if(C.isObject(e)&&e.type&&e.type===u.EV_MQTT_UPDATE&&e.payload.topic===this.dataTransferProgressTopic){let t=JSON.parse(e.payload.value.toString());if(C.isObject(t)&&C.isString(t.state))if("SUCCESS"===t.state){let t=[],e={};this.dataTransferImportDBproductKeys=[]
;try{var a=p.fs.readFileSync(this.dataTransferCacheFilePath,"utf8");e=JSON.parse(a),t=Object.keys(e),p.fs.unlinkSync(this.dataTransferCacheFilePath)}catch(t){return p.fs.existsSync(this.dataTransferCacheFilePath)&&p.fs.unlinkSync(this.dataTransferCacheFilePath),this.dataTransferState=w.product_import_list_files,this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_TRANSFER_FAIL"),A.l("_QAPP006_MESSAGE_TRANSFER_FAIL",["<br>"+t]),[A.btn.msg_transfer_failed]),this.hideLoadingScreen(),""}for(let a=0;a<t.length;a++){let i=h.createProduct(e[t[a]]);C.isString(i.product_id)&&""!==i.product_id&&(Y[i.product_id]=i,h.verifyProduct(Y[i.product_id]),this.dataTransferImportDBproductKeys.push(i.product_id))}if(!(this.dataTransferImportDBproductKeys.length>0))return this.dataTransferState=w.product_import_list_files,
this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_TRANSFER_FAIL"),A.l("_QAPP006_MESSAGE_TRANSFER_FAIL",["Empty file - no changes made"]),[A.btn.msg_transfer_failed]),this.hideLoadingScreen(),"";this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.storeProduct(Y[this.dataTransferImportDBproductKeys[0]])}else"FAILURE"===t.state&&(this.dataTransferState=w.product_import_list_files,this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_TRANSFER_FAIL"),A.l("_QAPP006_MESSAGE_TRANSFER_FAIL",[t.resultInfo]),[A.btn.msg_transfer_failed]),this.hideLoadingScreen())}return""}ENTER_PRODUCT_DATA(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.ENTER_PRODUCT_DATA.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,s.EV_HMI_PARAM_CHANGED]);if(!e||!t)return console.log(" ## DEBUG ## "+this.ENTER_PRODUCT_DATA()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){
A.btn.param_product_id=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID"),this.workflowState===H.create_product?T.EnumAppearance.ENABLED:T.EnumAppearance.DISABLED),A.btn.param_article_number=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_ARTICLE_NO")),A.btn.param_prod_type=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_TYPE")),A.btn.param_prod_test_type=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_TEST_TYPE")),A.btn.param_prod_tare_type=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_TARE_TYPE")),A.btn.param_count_target=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_TARE_COUNT_SAMPLES")),A.btn.param_target_filling=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_TARGET_VOL")),A.btn.param_min_filling2=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_TOL_MIN2"),q.prod_test_type===h.EnumProductTestType.ACCORDING_76_211_EEC?T.EnumAppearance.DISABLED:T.EnumAppearance.ENABLED),
A.btn.param_min_filling1=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_TOL_MIN1"),q.prod_test_type===h.EnumProductTestType.ACCORDING_76_211_EEC?T.EnumAppearance.DISABLED:T.EnumAppearance.ENABLED),A.btn.param_max_filling1=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_TOL_MAX1")),A.btn.param_max_filling2=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_TOL_MAX2")),A.btn.param_density=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_DENSITY")),A.btn.param_print_wgt=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_PRINT_WGT")),A.btn.param_product_id.setLabelRight({id:q.product_id,args:[]}),A.btn.param_article_number.setLabelRight({id:q.article_id,args:[]}),A.btn.param_prod_type.setLabelRight({id:h.EnumMapProductType[q.prod_type],args:[]}),A.btn.param_prod_test_type.setLabelRight({id:h.EnumMapProductTestType[q.prod_test_type],args:[]}),A.btn.param_prod_tare_type.setLabelRight({id:h.EnumMapTareType[q.proc_tare_type],args:[]}),
A.btn.param_count_target.setLabelRight({id:q.count_target.toString(),args:[]}),A.btn.param_target_filling.setLabelRight({id:L.formatQuantityParam(q.prod_target),args:[]}),A.btn.param_min_filling2.setLabelRight({id:L.formatQuantityParam(q.prod_min2),args:[]}),A.btn.param_min_filling1.setLabelRight({id:L.formatQuantityParam(q.prod_min1),args:[]}),A.btn.param_max_filling1.setLabelRight({id:L.formatQuantityParam(q.prod_max1),args:[]}),A.btn.param_max_filling2.setLabelRight({id:L.formatQuantityParam(q.prod_max2),args:[]}),A.btn.param_density.setLabelRight({id:L.formatQuantityParam(q.density),args:[]}),A.btn.param_print_wgt.setLabelRight({id:h.EnumMapProductPrint[q.prod_print_wgt],args:[]}),q.prod_type===h.EnumProductType.LIQUID?(A.btn.param_density.setAppearance(T.EnumAppearance.ENABLED),A.btn.param_print_wgt.setAppearance(T.EnumAppearance.ENABLED)):(A.btn.param_density.setAppearance(T.EnumAppearance.HIDDEN),A.btn.param_print_wgt.setAppearance(T.EnumAppearance.HIDDEN)),
A.btn.save=this.createMenuButton(l.EnumFontLabels.OK),A.btn.delete=this.createMenuButton(l.EnumFontLabels.DELETE),A.btn.taresettings=this.createMenuButton(A.l("_QAPP006_BUTTON_TARESETTINGS"),q.proc_tare_type===h.EnumTareType.NO_TARE?T.EnumAppearance.DISABLED:T.EnumAppearance.ENABLED),A.btn.msg_ok=this.createMessageButton(l.EnumFontLabels.OK),A.btn.msg_delete_yes=this.createMessageButton(A.l("_QAPP006_BUTTON_YES"),T.EnumAppearance.ENABLED_PRIMARY),A.btn.msg_delete_no=this.createMessageButton(A.l("_QAPP006_BUTTON_NO")),A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK);let t={id:this.IDEXTEND_SCREEN+this.ENTER_PRODUCT_DATA.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:this.workflowState===H.modify_product?A.l("_QAPP006_SCREENTITLE_MODIFY_PRODUCT"):A.l("_QAPP006_SCREENTITLE_CREATE_PRODUCT"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:E.TAB_MENU_TYPE_TOPIC,
menubuttons:["/QAPP/"+A.btn.param_product_id.getTopic(),"/QAPP/"+A.btn.param_article_number.getTopic(),"/QAPP/"+A.btn.param_prod_type.getTopic(),"/QAPP/"+A.btn.param_prod_test_type.getTopic(),"/QAPP/"+A.btn.param_prod_tare_type.getTopic(),"/QAPP/"+A.btn.param_count_target.getTopic(),"/QAPP/"+A.btn.param_target_filling.getTopic(),"/QAPP/"+A.btn.param_min_filling2.getTopic(),"/QAPP/"+A.btn.param_min_filling1.getTopic(),"/QAPP/"+A.btn.param_max_filling1.getTopic(),"/QAPP/"+A.btn.param_max_filling2.getTopic(),"/QAPP/"+A.btn.param_density.getTopic(),"/QAPP/"+A.btn.param_print_wgt.getTopic()],scrollToTop:!1};this.mainScreen.setMenuTab(t,this.workflowState===H.modify_product?[A.btn.taresettings,A.btn.delete,A.btn.save]:[A.btn.taresettings,A.btn.save]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.CANCEL,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),
this.mainScreen.hide(),this.hideMsgBox(),"";if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED)if(e.payload.buttonId===A.btn.save.getButtonId()){if(h.verifyProduct(q),this.workflowState===H.create_product){if(""===q.product_id)return this.showMessageBox(_.EnumMessageboxType.INFO,{id:A.l("_QAPP006_HEADER_INVALID_PARAMETER"),args:[A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID")]},A.l("_QAPP006_MESSAGE_MANDATORY_INPUT"),[A.btn.msg_ok]),"";if(Y.hasOwnProperty(q.product_id))return this.showMessageBox(_.EnumMessageboxType.INFO,{id:A.l("_QAPP006_HEADER_INVALID_PARAMETER"),args:[A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID")]},A.l("_QAPP006_MESSAGE_ID_ALREADY_EXIST"),[A.btn.msg_ok]),""}if(0===q.count_target)return this.showMessageBox(_.EnumMessageboxType.INFO,{id:A.l("_QAPP006_HEADER_INVALID_PARAMETER"),args:[A.l("_QAPP006_PARAM_TITLE_TARE_COUNT_SAMPLES")]},A.l("_QAPP006_MESSAGE_MANDATORY_INPUT"),[A.btn.msg_ok]),""
;if(!(0<=q.prod_min2.value&&q.prod_min2.value<q.prod_min1.value&&q.prod_min1.value<q.prod_target.value&&q.prod_target.value<q.prod_max1.value&&q.prod_max1.value<q.prod_max2.value))return this.showMessageBox(_.EnumMessageboxType.INFO,{id:A.l("_QAPP006_HEADER_INVALID_TOLERANCES"),args:[]},A.l("_QAPP006_MESSAGE_INVALID_TOLERANCES_PRODUCT"),[A.btn.msg_ok]),"";let t=L.convertToTargetUnit(q.prod_target,L.EnumUnit.GRAM);if(q.prod_test_type===h.EnumProductTestType.ACCORDING_76_211_EEC&&!(5<=t.value&&t.value<15e5))return this.showMessageBox(_.EnumMessageboxType.INFO,{id:A.l("_QAPP006_HEADER_INVALID_TOLERANCES"),args:[]},A.l("_QAPP006_MESSAGE_INVALID_TOLERANCES_PRODUCT_76211EEC"),[A.btn.msg_ok]),""
;if(q.proc_tare_type!==h.EnumTareType.NO_TARE&&q.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&!(0<=q.tare_min2.value&&q.tare_min2.value<q.tare_min1.value&&q.tare_min1.value<q.tare_target.value&&q.tare_target.value<q.tare_max1.value&&q.tare_min1.value<q.tare_max1.value&&q.tare_max1.value<q.tare_max2.value&&q.tare_max2.value<q.tare_plausibility.value))return A.btn.taresettings.setAppearance(T.EnumAppearance.ENABLED_PRIMARY),this.showMessageBox(_.EnumMessageboxType.INFO,{id:A.l("_QAPP006_HEADER_INVALID_TOLERANCES"),args:[]},A.l("_QAPP006_MESSAGE_INVALID_TOLERANCES_TARE"),[A.btn.msg_ok]),"";this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.storeProduct(q)}else if(e.payload.buttonId===A.btn.msg_ok.getButtonId())this.hideMsgBox();else{if(e.payload.buttonId===A.btn.delete.getButtonId())return this.showMessageBox(_.EnumMessageboxType.QUESTION,A.l("_QAPP006_HEADER_PRODUCT_REMOVE"),[{id:A.l("_QAPP006_MESSAGE_PRODUCT_REMOVE"),args:[q.product_id]
}],[A.btn.msg_delete_no,A.btn.msg_delete_yes]),"";if(e.payload.buttonId===A.btn.msg_delete_yes.getButtonId())this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.removeProduct(q.product_id),this.hideMsgBox();else if(e.payload.buttonId===A.btn.msg_delete_no.getButtonId())this.hideMsgBox();else{if(e.payload.buttonId===A.btn.taresettings.getButtonId())return t.transition(this,this.ENTER_PRODUCT_DATA_TARES()),"";if(e.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID)return this.workflowState=H.modify_product,t.transition(this,this.SELECT_PRODUCT()),"";e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId()&&this.hideMsgBox()}}else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT&&C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let a=e.payload;a.context===Q.store_product?!0===a.success?(this.workflowState=H.modify_product,
t.transition(this,this.SELECT_PRODUCT())):this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]):a.context===Q.remove_product&&(!0===a.success?(this.workflowState=H.modify_product,t.transition(this,this.SELECT_PRODUCT())):this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]))}}return this.ENTER_PRODUCT_DATA_handleParameters(e),""}ENTER_PRODUCT_DATA_handleParameters(t){
C.isObject(t)&&C.isString(t.type)&&t.type===s.EV_HMI_BTN_CLICKED&&(t.payload.buttonId===A.btn.param_product_id.getButtonId()?this.openInputText(A.btn.param_product_id.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_ID"),q.product_id):t.payload.buttonId===A.btn.param_article_number.getButtonId()?this.openInputText(A.btn.param_article_number.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_ARTICLE_NO"),q.article_id):t.payload.buttonId===A.btn.param_target_filling.getButtonId()?this.openInputNumber(A.btn.param_target_filling.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_TARGET_VOL"),q.prod_target):t.payload.buttonId===A.btn.param_min_filling2.getButtonId()?this.openInputNumber(A.btn.param_min_filling2.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_TOL_MIN2"),q.prod_min2):t.payload.buttonId===A.btn.param_min_filling1.getButtonId()?this.openInputNumber(A.btn.param_min_filling1.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_TOL_MIN1"),q.prod_min1):t.payload.buttonId===A.btn.param_max_filling1.getButtonId()?this.openInputNumber(A.btn.param_max_filling1.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_TOL_MAX1"),q.prod_max1):t.payload.buttonId===A.btn.param_max_filling2.getButtonId()?this.openInputNumber(A.btn.param_max_filling2.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_TOL_MAX2"),q.prod_max2):t.payload.buttonId===A.btn.param_density.getButtonId()?this.openInputNumber(A.btn.param_density.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_DENSITY"),q.density,1e-4,1/0):t.payload.buttonId===A.btn.param_prod_type.getButtonId()?this.openInputSelection(A.btn.param_prod_type.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_TYPE"),[{
id:h.EnumProductType.LIQUID,text:{id:h.EnumMapProductType[h.EnumProductType.LIQUID],args:[]},appearance:T.EnumAppearance.ENABLED},{id:h.EnumProductType.SOLID,text:{id:h.EnumMapProductType[h.EnumProductType.SOLID],args:[]},appearance:T.EnumAppearance.ENABLED}],q.prod_type):t.payload.buttonId===A.btn.param_prod_test_type.getButtonId()?this.openInputSelection(A.btn.param_prod_test_type.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_TEST_TYPE"),[{id:h.EnumProductTestType.USER_DEFINED,text:{id:h.EnumMapProductTestType[h.EnumProductTestType.USER_DEFINED],args:[]},appearance:T.EnumAppearance.ENABLED},{id:h.EnumProductTestType.ACCORDING_76_211_EEC,text:{id:h.EnumMapProductTestType[h.EnumProductTestType.ACCORDING_76_211_EEC],args:[]},appearance:T.EnumAppearance.ENABLED}],q.prod_test_type):t.payload.buttonId===A.btn.param_prod_tare_type.getButtonId()?this.openInputSelection(A.btn.param_prod_tare_type.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_TARE_TYPE"),[{
id:h.EnumTareType.NO_TARE,text:{id:h.EnumMapTareType[h.EnumTareType.NO_TARE],args:[]},appearance:T.EnumAppearance.ENABLED},{id:h.EnumTareType.EMPTY_FILLED,text:{id:h.EnumMapTareType[h.EnumTareType.EMPTY_FILLED],args:[]},appearance:T.EnumAppearance.ENABLED},{id:h.EnumTareType.FILLED_EMPTY,text:{id:h.EnumMapTareType[h.EnumTareType.FILLED_EMPTY],args:[]},appearance:T.EnumAppearance.ENABLED}],q.proc_tare_type):t.payload.buttonId===A.btn.param_print_wgt.getButtonId()?this.openInputSelection(A.btn.param_print_wgt.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_PRINT_WGT"),[{id:h.EnumProductPrint.ENABLED,text:{id:h.EnumMapProductPrint[h.EnumProductPrint.ENABLED],args:[]},appearance:T.EnumAppearance.ENABLED},{id:h.EnumProductPrint.DISABLED,text:{id:h.EnumMapProductPrint[h.EnumProductPrint.DISABLED],args:[]},appearance:T.EnumAppearance.ENABLED
}],q.prod_print_wgt):t.payload.buttonId===A.btn.param_count_target.getButtonId()&&this.openInputNumber(A.btn.param_count_target.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_TARE_COUNT_SAMPLES"),q.count_target,1,200));const e=this.parseParamInput(t);return e.isHandled&&e.isValid&&(e.id===A.btn.param_product_id.getButtonId()+"_param"?(q.product_id=e.rString,A.btn.param_product_id.setLabelRight({id:q.product_id,args:[]},!0)):e.id===A.btn.param_article_number.getButtonId()+"_param"?(q.article_id=e.rString,A.btn.param_article_number.setLabelRight({id:q.article_id,args:[]},!0)):e.id===A.btn.param_target_filling.getButtonId()+"_param"?(q.prod_target.value=e.rFloat,A.btn.param_target_filling.setLabelRight({id:L.formatQuantityParam(q.prod_target),args:[]},!0),q.prod_test_type===h.EnumProductTestType.ACCORDING_76_211_EEC&&(h.determineProductTolerances76211EEC(q),A.btn.param_min_filling1.setLabelRight({id:L.formatQuantityParam(q.prod_min1),args:[]},!0),
A.btn.param_min_filling2.setLabelRight({id:L.formatQuantityParam(q.prod_min2),args:[]},!0))):e.id===A.btn.param_min_filling2.getButtonId()+"_param"?(q.prod_min2.value=e.rFloat,A.btn.param_min_filling2.setLabelRight({id:L.formatQuantityParam(q.prod_min2),args:[]},!0)):e.id===A.btn.param_min_filling1.getButtonId()+"_param"?(q.prod_min1.value=e.rFloat,A.btn.param_min_filling1.setLabelRight({id:L.formatQuantityParam(q.prod_min1),args:[]},!0)):e.id===A.btn.param_max_filling1.getButtonId()+"_param"?(q.prod_max1.value=e.rFloat,A.btn.param_max_filling1.setLabelRight({id:L.formatQuantityParam(q.prod_max1),args:[]},!0)):e.id===A.btn.param_max_filling2.getButtonId()+"_param"?(q.prod_max2.value=e.rFloat,A.btn.param_max_filling2.setLabelRight({id:L.formatQuantityParam(q.prod_max2),args:[]},!0)):e.id===A.btn.param_density.getButtonId()+"_param"?(q.density.value=e.rFloat,A.btn.param_density.setLabelRight({id:L.formatQuantityParam(q.density),args:[]
},!0)):e.id===A.btn.param_print_wgt.getButtonId()+"_param"?(q.prod_print_wgt=e.rSelectionID,A.btn.param_print_wgt.setLabelRight({id:h.EnumMapProductPrint[q.prod_print_wgt],args:[]},!0)):e.id===A.btn.param_count_target.getButtonId()+"_param"?(q.count_target=e.rFloat,A.btn.param_count_target.setLabelRight({id:q.count_target.toFixed(0),args:[]},!0)):e.id===A.btn.param_prod_type.getButtonId()+"_param"?(q.prod_type=e.rSelectionID,A.btn.param_prod_type.setLabelRight({id:h.EnumMapProductType[q.prod_type],args:[]},!0),q.prod_type===h.EnumProductType.LIQUID?(A.btn.param_density.setAppearance(T.EnumAppearance.ENABLED,!0),A.btn.param_print_wgt.setAppearance(T.EnumAppearance.ENABLED,!0),q.prod_max2.unit=L.EnumUnit.MILLILITER,q.prod_max1.unit=L.EnumUnit.MILLILITER,q.prod_min1.unit=L.EnumUnit.MILLILITER,q.prod_min2.unit=L.EnumUnit.MILLILITER,q.prod_target.unit=L.EnumUnit.MILLILITER):(A.btn.param_density.setAppearance(T.EnumAppearance.HIDDEN,!0),
A.btn.param_print_wgt.setAppearance(T.EnumAppearance.HIDDEN,!0),q.prod_max2.unit=L.EnumUnit.GRAM,q.prod_max1.unit=L.EnumUnit.GRAM,q.prod_min1.unit=L.EnumUnit.GRAM,q.prod_min2.unit=L.EnumUnit.GRAM,q.prod_target.unit=L.EnumUnit.GRAM),A.btn.param_target_filling.setLabelRight({id:L.formatQuantityParam(q.prod_target),args:[]},!0),A.btn.param_min_filling2.setLabelRight({id:L.formatQuantityParam(q.prod_min2),args:[]},!0),A.btn.param_min_filling1.setLabelRight({id:L.formatQuantityParam(q.prod_min1),args:[]},!0),A.btn.param_max_filling1.setLabelRight({id:L.formatQuantityParam(q.prod_max1),args:[]},!0),A.btn.param_max_filling2.setLabelRight({id:L.formatQuantityParam(q.prod_max2),args:[]},!0)):e.id===A.btn.param_prod_test_type.getButtonId()+"_param"?(q.prod_test_type=e.rSelectionID,A.btn.param_prod_test_type.setLabelRight({id:h.EnumMapProductTestType[q.prod_test_type],args:[]},!0),
q.prod_test_type===h.EnumProductTestType.USER_DEFINED?(A.btn.param_min_filling1.setAppearance(T.EnumAppearance.ENABLED,!0),A.btn.param_min_filling2.setAppearance(T.EnumAppearance.ENABLED,!0)):(A.btn.param_min_filling1.setAppearance(T.EnumAppearance.DISABLED),A.btn.param_min_filling2.setAppearance(T.EnumAppearance.DISABLED),h.determineProductTolerances76211EEC(q),A.btn.param_min_filling1.setLabelRight({id:L.formatQuantityParam(q.prod_min1),args:[]},!0),A.btn.param_min_filling2.setLabelRight({id:L.formatQuantityParam(q.prod_min2),args:[]},!0))):e.id===A.btn.param_prod_tare_type.getButtonId()+"_param"&&(q.proc_tare_type=e.rSelectionID,A.btn.param_prod_tare_type.setLabelRight({id:h.EnumMapTareType[q.proc_tare_type],args:[]},!0),A.btn.taresettings.setAppearance(q.proc_tare_type===h.EnumTareType.NO_TARE?T.EnumAppearance.DISABLED:T.EnumAppearance.ENABLED,!0)),this.hideInput()),""}ENTER_PRODUCT_DATA_TARES(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.ENTER_PRODUCT_DATA_TARES.name
;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,s.EV_HMI_PARAM_CHANGED]);if(!e||!t)return console.log(" ## DEBUG ## "+this.ENTER_PRODUCT_DATA_TARES()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){A.btn.info_tares=this.createMenuButton(l.EnumFontLabels.INFO),A.btn.info_tares_ok=this.createMessageButton(l.EnumFontLabels.OK),A.btn.param_proc_method=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_TARE_PROC_METHOD")),A.btn.param_use_tare_limits=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_TARE_USE_LIMITS")),A.btn.param_tara_target=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_TARE_TARE_TARGET"),q.use_tare_limits===h.EnumProductUseTareLmits.ENABLED?T.EnumAppearance.ENABLED:T.EnumAppearance.HIDDEN),A.btn.param_min_tara2=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_TARE_TARE_TOL_MIN2"),q.use_tare_limits===h.EnumProductUseTareLmits.ENABLED?T.EnumAppearance.ENABLED:T.EnumAppearance.HIDDEN),
A.btn.param_min_tara1=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_TARE_TARE_TOL_MIN1"),q.use_tare_limits===h.EnumProductUseTareLmits.ENABLED?T.EnumAppearance.ENABLED:T.EnumAppearance.HIDDEN),A.btn.param_max_tara1=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_TARE_TARE_TOL_MAX1"),q.use_tare_limits===h.EnumProductUseTareLmits.ENABLED?T.EnumAppearance.ENABLED:T.EnumAppearance.HIDDEN),A.btn.param_max_tara2=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_TARE_TARE_TOL_MAX2"),q.use_tare_limits===h.EnumProductUseTareLmits.ENABLED?T.EnumAppearance.ENABLED:T.EnumAppearance.HIDDEN),A.btn.param_plausibility=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_TARE_TARE_TOL_PLAUSIBILITY")),A.btn.param_print_tare=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_PRINT_TARE")),A.btn.param_proc_method.setLabelRight({id:h.EnumMapTareMethod[q.proc_tare_method],args:[]}),A.btn.param_use_tare_limits.setLabelRight({id:h.EnumMapProductUseTareLmits[q.use_tare_limits],args:[]
}),A.btn.param_tara_target.setLabelRight({id:L.formatQuantityParam(q.tare_target),args:[]}),A.btn.param_min_tara2.setLabelRight({id:L.formatQuantityParam(q.tare_min2),args:[]}),A.btn.param_min_tara1.setLabelRight({id:L.formatQuantityParam(q.tare_min1),args:[]}),A.btn.param_max_tara1.setLabelRight({id:L.formatQuantityParam(q.tare_max1),args:[]}),A.btn.param_max_tara2.setLabelRight({id:L.formatQuantityParam(q.tare_max2),args:[]}),A.btn.param_plausibility.setLabelRight({id:L.formatQuantityParam(q.tare_plausibility),args:[]}),A.btn.param_print_tare.setLabelRight({id:h.EnumMapProductPrint[q.prod_print_tare],args:[]});let t={id:this.IDEXTEND_SCREEN+this.ENTER_PRODUCT_DATA_TARES.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_MODIFY_PRODUCT_TARES"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:E.TAB_MENU_TYPE_TOPIC,
menubuttons:["/QAPP/"+A.btn.param_proc_method.getTopic(),"/QAPP/"+A.btn.param_use_tare_limits.getTopic(),"/QAPP/"+A.btn.param_tara_target.getTopic(),"/QAPP/"+A.btn.param_min_tara2.getTopic(),"/QAPP/"+A.btn.param_min_tara1.getTopic(),"/QAPP/"+A.btn.param_max_tara1.getTopic(),"/QAPP/"+A.btn.param_max_tara2.getTopic(),"/QAPP/"+A.btn.param_plausibility.getTopic(),"/QAPP/"+A.btn.param_print_tare.getTopic()],scrollToTop:!1};this.mainScreen.setMenuTab(t,[A.btn.info_tares]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox(),""
;C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED&&(e.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID?t.transition(this,this.ENTER_PRODUCT_DATA()):e.payload.buttonId===A.btn.info_tares.getButtonId()?this.showMessageBox(_.EnumMessageboxType.INFO,A.l("_QAPP006_HEADER_PRODUCT_TARE_INFO"),[{id:A.l("_QAPP006_MESSAGE_PRODUCT_TARE_INFO"),args:[h.EnumMapTareMethod[h.EnumTareMethod.TARE_SINGLE],h.EnumMapTareMethod[h.EnumTareMethod.TARE_MEAN],h.EnumMapTareMethod[h.EnumTareMethod.TARE_MEAN_SINGLES],h.EnumMapTareMethod[h.EnumTareMethod.TARE_ENTER]]}],[A.btn.info_tares_ok]):e.payload.buttonId===A.btn.info_tares_ok.getButtonId()&&this.hideMsgBox())}return this.ENTER_PRODUCT_DATA_TARES_handleParameters(e),""}ENTER_PRODUCT_DATA_TARES_handleParameters(t){
C.isObject(t)&&C.isString(t.type)&&t.type===s.EV_HMI_BTN_CLICKED&&(t.payload.buttonId===A.btn.param_print_tare.getButtonId()?this.openInputSelection(A.btn.param_print_tare.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_PRINT_TARE"),[{id:h.EnumProductPrint.ENABLED,text:{id:h.EnumMapProductPrint[h.EnumProductPrint.ENABLED],args:[]},appearance:T.EnumAppearance.ENABLED},{id:h.EnumProductPrint.DISABLED,text:{id:h.EnumMapProductPrint[h.EnumProductPrint.DISABLED],args:[]},appearance:T.EnumAppearance.ENABLED}],q.prod_print_tare):t.payload.buttonId===A.btn.param_proc_method.getButtonId()?this.openInputSelection(A.btn.param_proc_method.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_TARE_PROC_METHOD"),[{id:h.EnumTareMethod.TARE_SINGLE,text:{id:h.EnumMapTareMethod[h.EnumTareMethod.TARE_SINGLE],args:[]},appearance:T.EnumAppearance.ENABLED},{id:h.EnumTareMethod.TARE_MEAN,text:{id:h.EnumMapTareMethod[h.EnumTareMethod.TARE_MEAN],args:[]},appearance:T.EnumAppearance.ENABLED},{
id:h.EnumTareMethod.TARE_MEAN_SINGLES,text:{id:h.EnumMapTareMethod[h.EnumTareMethod.TARE_MEAN_SINGLES],args:[]},appearance:T.EnumAppearance.ENABLED},{id:h.EnumTareMethod.TARE_ENTER,text:{id:h.EnumMapTareMethod[h.EnumTareMethod.TARE_ENTER],args:[]},appearance:T.EnumAppearance.ENABLED}],q.proc_tare_method):t.payload.buttonId===A.btn.param_use_tare_limits.getButtonId()?this.openInputSelection(A.btn.param_use_tare_limits.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_TARE_USE_LIMITS"),[{id:h.EnumProductUseTareLmits.ENABLED,text:{id:h.EnumMapProductUseTareLmits[h.EnumProductUseTareLmits.ENABLED],args:[]},appearance:T.EnumAppearance.ENABLED},{id:h.EnumProductUseTareLmits.DISABLED,text:{id:h.EnumMapProductUseTareLmits[h.EnumProductUseTareLmits.DISABLED],args:[]},appearance:T.EnumAppearance.ENABLED
}],q.use_tare_limits):t.payload.buttonId===A.btn.param_tara_target.getButtonId()?this.openInputNumber(A.btn.param_tara_target.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_TARE_TARE_TARGET"),q.tare_target):t.payload.buttonId===A.btn.param_min_tara2.getButtonId()?this.openInputNumber(A.btn.param_min_tara2.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_TARE_TARE_TOL_MIN2"),q.tare_min2):t.payload.buttonId===A.btn.param_min_tara1.getButtonId()?this.openInputNumber(A.btn.param_min_tara1.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_TARE_TARE_TOL_MIN1"),q.tare_min1):t.payload.buttonId===A.btn.param_max_tara1.getButtonId()?this.openInputNumber(A.btn.param_max_tara1.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_TARE_TARE_TOL_MAX1"),q.tare_max1):t.payload.buttonId===A.btn.param_max_tara2.getButtonId()?this.openInputNumber(A.btn.param_max_tara2.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_TARE_TARE_TOL_MAX2"),q.tare_max2):t.payload.buttonId===A.btn.param_plausibility.getButtonId()&&this.openInputNumber(A.btn.param_plausibility.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_TARE_TARE_TOL_PLAUSIBILITY"),q.tare_plausibility))
;const e=this.parseParamInput(t);e.isHandled&&e.isValid&&(e.id===A.btn.param_print_tare.getButtonId()+"_param"?(q.prod_print_tare=e.rSelectionID,A.btn.param_print_tare.setLabelRight({id:h.EnumMapProductPrint[q.prod_print_tare],args:[]},!0)):e.id===A.btn.param_proc_method.getButtonId()+"_param"?(q.proc_tare_method=e.rSelectionID,A.btn.param_proc_method.setLabelRight({id:h.EnumMapTareMethod[q.proc_tare_method],args:[]},!0)):e.id===A.btn.param_use_tare_limits.getButtonId()+"_param"?(q.use_tare_limits=e.rSelectionID,A.btn.param_use_tare_limits.setLabelRight({id:h.EnumMapProductUseTareLmits[q.use_tare_limits],args:[]},!0)):e.id===A.btn.param_tara_target.getButtonId()+"_param"?(q.tare_target.value=e.rFloat,A.btn.param_tara_target.setLabelRight({id:L.formatQuantityParam(q.tare_target),args:[]},!0)):e.id===A.btn.param_min_tara2.getButtonId()+"_param"?(q.tare_min2.value=e.rFloat,A.btn.param_min_tara2.setLabelRight({id:L.formatQuantityParam(q.tare_min2),args:[]
},!0)):e.id===A.btn.param_min_tara1.getButtonId()+"_param"?(q.tare_min1.value=e.rFloat,A.btn.param_min_tara1.setLabelRight({id:L.formatQuantityParam(q.tare_min1),args:[]},!0)):e.id===A.btn.param_max_tara1.getButtonId()+"_param"?(q.tare_max1.value=e.rFloat,A.btn.param_max_tara1.setLabelRight({id:L.formatQuantityParam(q.tare_max1),args:[]},!0)):e.id===A.btn.param_max_tara2.getButtonId()+"_param"?(q.tare_max2.value=e.rFloat,A.btn.param_max_tara2.setLabelRight({id:L.formatQuantityParam(q.tare_max2),args:[]},!0)):e.id===A.btn.param_plausibility.getButtonId()+"_param"&&(q.tare_plausibility.value=e.rFloat,A.btn.param_plausibility.setLabelRight({id:L.formatQuantityParam(q.tare_plausibility),args:[]},!0)),this.hideInput());let a=q.use_tare_limits===h.EnumProductUseTareLmits.DISABLED;return a=a||q.proc_tare_method===h.EnumTareMethod.TARE_ENTER,A.btn.param_use_tare_limits.setAppearance(q.proc_tare_method===h.EnumTareMethod.TARE_ENTER?T.EnumAppearance.HIDDEN:T.EnumAppearance.ENABLED,!0),
A.btn.param_tara_target.setAppearance(a?T.EnumAppearance.HIDDEN:T.EnumAppearance.ENABLED,!0),A.btn.param_min_tara2.setAppearance(a?T.EnumAppearance.HIDDEN:T.EnumAppearance.ENABLED,!0),A.btn.param_min_tara1.setAppearance(a?T.EnumAppearance.HIDDEN:T.EnumAppearance.ENABLED,!0),A.btn.param_max_tara1.setAppearance(a?T.EnumAppearance.HIDDEN:T.EnumAppearance.ENABLED,!0),A.btn.param_max_tara2.setAppearance(a?T.EnumAppearance.HIDDEN:T.EnumAppearance.ENABLED,!0),""}ENTER_BATCH_DATA(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.ENTER_BATCH_DATA.name;if(!t&&e&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED]);if(!e||!t)return console.log(" ## DEBUG ## "+this.ENTER_BATCH_DATA()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){A.btn.param_batch=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_BATCH_ID")),A.btn.param_product=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID")),this.updateSIDsLIDs(),
K.lot_ids=d.cloneJSON(k.last_used_LIDs),A.btn.continue=this.createMenuButton(l.EnumFontLabels.OK),A.btn.msg_ok=this.createMessageButton(l.EnumFontLabels.OK),A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK);let t={id:this.IDEXTEND_SCREEN+this.ENTER_BATCH_DATA.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_NEW_BATCH"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:E.TAB_MENU_TYPE_TOPIC,menubuttons:["/QAPP/"+A.btn.param_batch.getTopic(),"/QAPP/"+A.btn.param_product.getTopic()],scrollToTop:!1};this.mainScreen.setMenuTab(t,[A.btn.continue]),this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.hideMsgBox(),this.mainScreen.hide(),""
;if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED)if(e.payload.buttonId===A.btn.param_batch.getButtonId())this.OpenLIDInput(t,this.ENTER_BATCH_DATA());else if(e.payload.buttonId===A.btn.param_product.getButtonId())this.workflowState=H.create_batch,t.transition(this,this.SELECT_PRODUCT());else if(e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId())this.hideMsgBox();else if(e.payload.buttonId===A.btn.continue.getButtonId()){if(""===K.lot_id)return this.showMessageBox(_.EnumMessageboxType.INFO,{id:A.l("_QAPP006_HEADER_INVALID_PARAMETER"),args:[A.l("_QAPP006_PARAM_TITLE_BATCH_ID")]},A.l("_QAPP006_MESSAGE_MANDATORY_INPUT"),[A.btn.msg_ok]),"";if(W.hasOwnProperty(K.lot_id))return this.showMessageBox(_.EnumMessageboxType.INFO,{id:A.l("_QAPP006_HEADER_INVALID_PARAMETER"),args:[A.l("_QAPP006_PARAM_TITLE_BATCH_ID")]},A.l("_QAPP006_MESSAGE_ID_ALREADY_EXIST"),[A.btn.msg_ok]),"";K.product=d.cloneJSON(q),K.lt_rslt_maximum.unit=K.product.prod_target.unit,
K.lt_rslt_minimum.unit=K.product.prod_target.unit,K.lt_rslt_mean.unit=K.product.prod_target.unit,K.lt_rslt_range.unit=K.product.prod_target.unit,K.lt_rslt_stddev.unit=K.product.prod_target.unit,K.lt_rslt_sum.unit=K.lt_rslt_stddev.unit,K.lt_rslt_square_sum_in_stddev_unit.unit=K.lt_rslt_stddev.unit,this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.storeBatch(K)}else e.payload.buttonId===A.btn.msg_ok.getButtonId()?this.hideMsgBox():e.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID&&t.transition(this,this.MAIN_MENU());else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT&&C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let a=e.payload;a.context===Q.store_batch&&(!0===a.success?t.transition(this,this.BATCH_MENU()):this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]))}}return A.btn.param_batch.setLabelRight({id:K.lot_id,args:[]},!0),A.btn.param_product.setLabelRight({id:q.product_id,args:[]},!0),""}SELECT_BATCH(t,e){
if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.SELECT_BATCH.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED]);if(!e||!t)return console.log(" ## DEBUG ## "+this.SELECT_BATCH()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e)A.btn.add_batch=this.createMenuButton(l.EnumFontLabels.ADD),A.btn.msg_ok=this.createMessageButton(l.EnumFontLabels.OK),A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK),this.mainScreen.topLeftButton.setLabel({id:k.supervisor_roles.includes(this.USER.role_id)?l.EnumFontLabels.BACK:l.EnumFontLabels.CANCEL,args:[]}),this.mainScreen.showTopLeftButton(),this.showScreen(this.mainScreen),this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.loadBatchList();else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox(),""
;if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED)this.selectableListButtons.hasOwnProperty(e.payload.buttonId)?(this.workflowState=H.modify_batch,this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.loadBatch(this.selectableListButtons[e.payload.buttonId].metadata)):e.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID?k.supervisor_roles.includes(this.USER.role_id)?t.transition(this,this.MAIN_MENU()):this.suspend():e.payload.buttonId===A.btn.add_batch.getButtonId()?(this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.loadProductList()):e.payload.buttonId===A.btn.msg_ok.getButtonId()?this.hideMsgBox():e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId()&&this.hideMsgBox();else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT&&C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let a=e.payload;if(a.context===Q.load_batch_list)if(!0===a.success){let t=[];this.selectableListButtons={}
;let e=p.sortKeys(W);for(let a=0;a<e.length;a++)if(W.hasOwnProperty(e[a])){let i="RESERVED_BUTTONID_batchList_"+a.toFixed(0);A.btn[i]=this.createMenuButton(e[a],T.EnumAppearance.ENABLED,!1),A.btn[i].setLabelRight({id:A.l("_QAPP006_BUTTON_INFO_PRODUCT_OF_BATCH"),args:[W[e[a]].product.product_id]}),t.push(A.btn[i].getJson()),this.selectableListButtons[A.btn[i].getButtonId()]={button:A.btn[i],metadata:e[a]}}let a={id:this.IDEXTEND_SCREEN+this.SELECT_BATCH.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_SELECT_OPEN_BATCH"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:E.TAB_MENU_TYPE_BULK,menuBulkButtons:t,scrollToTop:!1};this.mainScreen.setMenuTab(a,Object.keys(W).length<G?[A.btn.add_batch]:[]),this.hideLoadingScreen()
}else this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]);else if(a.context===Q.load_batch)!0===a.success?t.transition(this,this.BATCH_MENU()):this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]);else if(a.context===Q.load_product_list)if(!0===a.success){let e="";for(let t in Y)if(Y[t].valid_dataset){e=t;break}if(""===e)return this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_MISSING_CONFIG"),A.l("_QAPP006_MESSAGE_MISSING_CONFIG_PRODUCT"),[A.btn.msg_ok]),this.hideLoadingScreen(),"";C.isObject(q)&&Y.hasOwnProperty(q.product_id)&&q.valid_dataset?((K=h.createBatch(void 0,q)).time_start=M.getDateTime("iso"),t.transition(this,this.ENTER_BATCH_DATA())):(this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.loadProduct(e))}else this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]);else a.context===Q.load_product&&(!0===a.success?((K=h.createBatch(void 0,q)).time_start=M.getDateTime("iso"),
t.transition(this,this.ENTER_BATCH_DATA())):this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]))}}return""}BATCH_MENU(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.BATCH_MENU.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED]);if(!e||!t)return console.log(" ## DEBUG ## "+this.BATCH_MENU()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){A.btn.msg_finish_yes=this.createMessageButton(A.l("_QAPP006_BUTTON_YES")),A.btn.msg_finish_no=this.createMessageButton(A.l("_QAPP006_BUTTON_NO")),A.btn.new_test=this.createMenuButton(A.l("_QAPP006_SELECT_START_TEST"),Object.keys(K.processes).length<x?T.EnumAppearance.ENABLED:T.EnumAppearance.DISABLED),A.btn.new_test.setLabelRight({id:Object.keys(K.processes).length.toFixed(0)+"/"+x.toFixed(0),args:[]}),A.btn.interim_report=this.createMenuButton(A.l("_QAPP006_SELECT_INTERIM_REPORT")),A.btn.close_batch=this.createMenuButton(A.l("_QAPP006_SELECT_CLOSE_BATCH")),
A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK);let t={id:this.IDEXTEND_SCREEN+this.BATCH_MENU.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_BATCH_MENU"),args:[]},title:{id:"",args:[]},topbuttons:[],menuType:E.TAB_MENU_TYPE_TOPIC,menubuttons:["/QAPP/"+A.btn.new_test.getTopic(),"/QAPP/"+A.btn.interim_report.getTopic(),"/QAPP/"+A.btn.close_batch.getTopic()],scrollToTop:!1};this.mainScreen.topLeftButton.setLabel({id:l.EnumFontLabels.BACK,args:[]}),this.mainScreen.showTopLeftButton(),this.mainScreen.setMenuTab(t,[]),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.mainScreen.hide(),this.hideMsgBox(),"";if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED){if(!0===this.InitializeTestRun(t,e,e.payload.buttonId===A.btn.new_test.getButtonId()))return""
;e.payload.buttonId===A.btn.interim_report.getButtonId()?(this.workflowState=H.interim_result_batch,t.transition(this,this.SHOW_BATCH_RESULT())):e.payload.buttonId===A.btn.close_batch.getButtonId()?this.showMessageBox(_.EnumMessageboxType.QUESTION,A.l("_QAPP006_HEADER_FINISH_BATCH"),A.l("_QAPP006_MESSAGE_FINISH_BATCH"),[A.btn.msg_finish_no,A.btn.msg_finish_yes]):e.payload.buttonId===A.btn.msg_finish_yes.getButtonId()?(K.time_end=M.getDateTime("iso"),this.workflowState=H.result_finish_batch,this.showLoadingScreen({id:A.l("_QAPP006_DATABASE_QUERY"),args:[]}),this.removeBatch(K.lot_id),this.hideMsgBox()):e.payload.buttonId===A.btn.msg_finish_no.getButtonId()?this.hideMsgBox():e.payload.buttonId===this.DEFAULT_CANCEL_BTN_ID?t.transition(this,this.SELECT_BATCH()):e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId()&&this.hideMsgBox()}else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT&&C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){
let a=e.payload;a.context===Q.remove_batch&&(!0===a.success?t.transition(this,this.SHOW_BATCH_RESULT()):this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]))}}return""}PROCESS_EF_EMPTY_MEASUREMENT(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.PROCESS_EF_EMPTY_MEASUREMENT.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,u.EV_MQTT_UPDATE,N.SIMPLE_EVENT]);if(!e||!t)return console.log(" ## DEBUG ## "+this.PROCESS_EF_EMPTY_MEASUREMENT()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e)A.btn.skip=this.createWeighingSplitScreenButton(0,A.l("_QAPP006_BUTTON_SKIP_SAMPLE"),K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.DISABLED),A.btn.skip_all_next=this.createWeighingSplitScreenButton(1,l.EnumFontLabels.CANCEL,K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.DISABLED),
A.btn.msg_skip_all_next_yes=this.createMessageButton(A.l("_QAPP006_BUTTON_YES")),A.btn.msg_skip_all_next_no=this.createMessageButton(A.l("_QAPP006_BUTTON_NO")),this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),this.weighingScreenState=F.init,this.weighingSplitScreen.getTabApi().clearTabList(),this.setSplitScreenTabHeader(0,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_TARE_PROCESS")),!1===this.isQuickTest&&this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_BATCH_ID"),K.lot_id,A.l("_QAPP006_PARAM_TITLE_BATCH_ID")),this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID"),K.product.product_id,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID")),this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ARTICLE_NO"),K.product.article_id,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ARTICLE_NO")),K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&(this.applyProcessProductLimits(),
this.setSplitScreenTabHeader(1,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_TARE_PROCESS")),this.setSplitScreenTabHeader(2,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_TARE_PROCESS")),this.setSplitScreenTabParamList(1,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),L.formatQuantityParam(j.product_currentUnit.tare_min2),L.formatQuantityParam(j.product_currentUnit.tare_min1),L.formatQuantityParam(j.product_currentUnit.tare_target),L.formatQuantityParam(j.product_currentUnit.tare_max1),L.formatQuantityParam(j.product_currentUnit.tare_max2)])),
this.setSplitScreenTabParamList(2,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_2",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_2",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),j.wgt_tare_count_min2.toFixed(0),j.wgt_tare_count_min1.toFixed(0),j.wgt_tare_count_passed.toFixed(0),j.wgt_tare_count_max1.toFixed(0),j.wgt_tare_count_max2.toFixed(0),j.count_skipped.toFixed(0)])),this.showBargraph(j.product_currentUnit.tare_target,j.product_currentUnit.tare_min1,j.product_currentUnit.tare_max1,j.product_currentUnit.tare_min2,j.product_currentUnit.tare_max2)),this.showScreen(this.weighingSplitScreen),this.addTimer(750,"init_timeout");else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.weighingProxy.setButton(c.WEIGHING_BUTTON_DO_TARE,T.EnumAppearance.ENABLED_SECONDARY),this.weighingSplitScreen.setText1("",[]),this.weighingSplitScreen.hide(),this.hideBargraph(),this.hideMsgBox(),""
;if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED)if(e.payload.buttonId===A.btn.skip.getButtonId())j.curr_sample.tare_status=h.EnumSampleResultStatus.SKIPPED,j.curr_sample.rslt_status=h.EnumSampleResultStatus.SKIPPED,this.addToEventQueue(new N.SimpleEvent("nextSample"));else{if(e.payload.buttonId===A.btn.skip_all_next.getButtonId())return this.showMessageBox(_.EnumMessageboxType.QUESTION,A.l("_QAPP006_HEADER_FINISH_TEST_PREMATURELY"),A.l("_QAPP006_MESSAGE_FINISH_TEST_PREMATURELY",[j.current_idx.toFixed(0)]),[A.btn.msg_skip_all_next_no,A.btn.msg_skip_all_next_yes]),"";if(e.payload.buttonId===A.btn.msg_skip_all_next_yes.getButtonId())j.samples.splice(j.current_idx),this.hideMsgBox(),this.addToEventQueue(new N.SimpleEvent("nextSample"));else{if(e.payload.buttonId===A.btn.msg_skip_all_next_no.getButtonId())return this.hideMsgBox(),"";this.HandleHomeOrLogoutButtons(e)}
}else if(C.isObject(e)&&e.type&&e.type===N.QAPP_TIMER_EVENT)C.isString(e.payload)&&"init_timeout"===e.payload&&(this.hideLoadingScreen(),K.product.proc_tare_method===h.EnumTareMethod.TARE_ENTER?t.transition(this,this.ENTER_INPROCESS_DATA()):this.addToEventQueue(new N.SimpleEvent("nextSample")));else if(C.isObject(e)&&e.type&&e.type===N.SIMPLE_EVENT){if(C.isString(e.payload)&&"nextSample"===e.payload){j.current_idx=0;for(let t=0;t<j.samples.length&&(j.current_idx=t,j.samples[t].tare_status!==h.EnumSampleResultStatus.PENDING);t++);this.calculateStatistics_tares(K.product.tare_target.unit),
K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&(this.setSplitScreenTabParamList(1,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),L.formatQuantityParam(j.product_currentUnit.tare_min2),L.formatQuantityParam(j.product_currentUnit.tare_min1),L.formatQuantityParam(j.product_currentUnit.tare_target),L.formatQuantityParam(j.product_currentUnit.tare_max1),L.formatQuantityParam(j.product_currentUnit.tare_max2)])),this.setSplitScreenTabParamList(2,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_2",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_2",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),j.wgt_tare_count_min2.toFixed(0),j.wgt_tare_count_min1.toFixed(0),j.wgt_tare_count_passed.toFixed(0),j.wgt_tare_count_max1.toFixed(0),j.wgt_tare_count_max2.toFixed(0),j.count_skipped.toFixed(0)]))),
this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),A.btn.skip.setAppearance(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.DISABLED),A.btn.skip_all_next.setAppearance(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.DISABLED),this.hideBargraph(),this.weighingScreenState=F.wait_clear_pan}}else if(C.isObject(e)&&C.isString(e.type)&&e.type===u.EV_MQTT_UPDATE){if(e.payload.topic===O.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE&&e.payload.value)return K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&(this.applyProcessProductLimits(),
this.setSplitScreenTabParamList(1,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),L.formatQuantityParam(j.product_currentUnit.tare_min2),L.formatQuantityParam(j.product_currentUnit.tare_min1),L.formatQuantityParam(j.product_currentUnit.tare_target),L.formatQuantityParam(j.product_currentUnit.tare_max1),L.formatQuantityParam(j.product_currentUnit.tare_max2)])),this.weighingScreenState!==F.wait_clear_pan&&this.weighingScreenState!==F.wait_zero&&this.showBargraph(j.product_currentUnit.tare_target,j.product_currentUnit.tare_min1,j.product_currentUnit.tare_max1,j.product_currentUnit.tare_min2,j.product_currentUnit.tare_max2)),"";if(this.weighingScreenState===F.wait_clear_pan){let a=this.parse_MQTT_Weight(e,"anyNumber")
;if(a&&a.value<P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber())return j.current_idx+1===j.samples.length&&j.curr_sample.tare_status!==h.EnumSampleResultStatus.PENDING?(this.showLoadingScreen(),j.time_end=M.getDateTime("iso"),j.current_idx=0,t.transition(this,this.ENTER_INPROCESS_DATA()),""):(this.weighingProxy.doZero(c.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.preventAutoLogout("justOnce"),this.weighingScreenState=F.wait_zero,"")}else if(this.weighingScreenState===F.wait_zero){let t=this.parse_MQTT_Weight(e,"anyNumber")
;if(t&&!0===t.stable&&0===t.value)return K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_TARE_MEAN"),[j.samples.length.toFixed(0)]):K.product.proc_tare_method!==h.EnumTareMethod.TARE_SINGLE&&K.product.proc_tare_method!==h.EnumTareMethod.TARE_MEAN_SINGLES||this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_TARE_SINGLE"),[(j.current_idx+1).toFixed(0),j.samples.length.toFixed(0)]),A.btn.skip.setAppearance(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.ENABLED_SECONDARY),A.btn.skip_all_next.setAppearance(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:j.current_idx>0?T.EnumAppearance.ENABLED_SECONDARY:T.EnumAppearance.DISABLED),K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&this.showBargraph(),this.weighingScreenState=F.wait_auto_acquisition,"";if(e.payload.topic===O.MqttTopics.WEIGHING_WAITING_FOR_STABILITY){
return!1===JSON.parse(e.payload.value.toString()).state?(this.weighingScreenState=F.wait_clear_pan,""):""}}let a=!1;if(this.weighingScreenState===F.wait_auto_acquisition||this.weighingScreenState===F.wait_dsd){let t=this.parse_MQTT_Weight(e,"valid");t&&t.stable&&t.value>=P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber()&&(K.product.proc_tare_method!==h.EnumTareMethod.TARE_SINGLE&&K.product.proc_tare_method!==h.EnumTareMethod.TARE_MEAN_SINGLES||t.value<=j.product_currentUnit.tare_plausibility.value&&(a=!0),K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN&&(a=!0))}if(this.weighingScreenState===F.wait_auto_acquisition&&a)return this.weighingScreenState=F.wait_dsd,this.reportingProxy.requestPrintableValue(h.QAPP_ID+"; Batch: "+K.lot_id+"; Product: "+K.product.product_id+"; Test: "+j.batch_test_id+"; Sample: "+(j.current_idx+1).toFixed(0)+" (Empty)"),this.weighingWaitingTimeout=M.getDateTime("ms")+2e3,"";if(this.weighingScreenState===F.wait_dsd){
if(M.getDateTime("ms")>this.weighingWaitingTimeout)return A.btn.skip.setAppearance(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.ENABLED_SECONDARY),A.btn.skip_all_next.setAppearance(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:j.current_idx>0?T.EnumAppearance.ENABLED_SECONDARY:T.EnumAppearance.DISABLED),this.weighingScreenState=F.wait_auto_acquisition,"";let t=this.parse_MQTT_Weight(e,"alibi");if(t&&(t.value>=0||(a=!1),a)){if(this.weighingScreenState=F.got_dsd,K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN_SINGLES&&t.value>j.product_currentUnit.tare_plausibility.value)return this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),this.hideBargraph(),this.weighingScreenState=F.wait_clear_pan,"";if(K.product.proc_tare_method===h.EnumTareMethod.TARE_SINGLE||K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN_SINGLES)j.curr_sample.wgt_tare=d.cloneJSON(t),
this.evaluateSampleTareStatus(j.curr_sample,K.product);else if(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN){t.value=P.bignumber(t.value).dividedBy(j.samples.length).toNumber(),t.alibiId=void 0;for(let e=0;e<j.samples.length;e++)j.samples[e].wgt_tare=d.cloneJSON(t),this.evaluateSampleTareStatus(j.samples[e],K.product)}this.addToEventQueue(new N.SimpleEvent("nextSample"))}}}}return""}PROCESS_EF_FILLING_MEASUREMENT(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.PROCESS_EF_FILLING_MEASUREMENT.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,u.EV_MQTT_UPDATE,N.SIMPLE_EVENT]);if(!e||!t)return console.log(" ## DEBUG ## "+this.PROCESS_EF_FILLING_MEASUREMENT()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e)return this.applyProcessProductLimits(),
this.showBargraph(j.product_currentUnit.prod_target,j.product_currentUnit.prod_min1,j.product_currentUnit.prod_max1,j.product_currentUnit.prod_min2,j.product_currentUnit.prod_max2),A.btn.repeat_zero=this.createWeighingSplitScreenButton(0,l.EnumFontLabels.ZERO,T.EnumAppearance.HIDDEN),A.btn.skip=this.createWeighingSplitScreenButton(1,A.l("_QAPP006_BUTTON_SKIP_SAMPLE"),T.EnumAppearance.DISABLED),A.btn.show_graphs=this.createWeighingSplitScreenButton(2,l.EnumFontLabels.RESULT,T.EnumAppearance.ENABLED_SECONDARY),A.btn.skip_all_next=this.createWeighingSplitScreenButton(3,l.EnumFontLabels.CANCEL,T.EnumAppearance.DISABLED),A.btn.msg_cancel_back=this.createMessageButton(A.l("_QAPP006_BUTTON_BACK")),A.btn.msg_cancel_abort=this.createMessageButton(A.l("_QAPP006_BUTTON_CANCEL")),A.btn.msg_cancel_finish=this.createMessageButton(A.l("_QAPP006_BUTTON_FINISH_PROCESS")),A.btn.msg_skip_all_next_yes=this.createMessageButton(A.l("_QAPP006_BUTTON_YES")),
A.btn.msg_skip_all_next_no=this.createMessageButton(A.l("_QAPP006_BUTTON_NO")),A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK),this.weighingSplitScreen.getTabApi().clearTabList(),this.setSplitScreenTabHeader(0,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_FILLED_PROCESS")),this.setSplitScreenTabHeader(1,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_FILLED_PROCESS")),this.setSplitScreenTabHeader(2,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_FILLED_PROCESS")),!1===this.isQuickTest&&this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_BATCH_ID"),K.lot_id,A.l("_QAPP006_PARAM_TITLE_BATCH_ID")),this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID"),K.product.product_id,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID")),this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ARTICLE_NO"),K.product.article_id,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ARTICLE_NO")),
this.setSplitScreenTabParamList(1,"_QAPP006_INFO_PROCESS_SPLITSCREEN_1",A.l("_QAPP006_INFO_PROCESS_SPLITSCREEN_1",[L.formatQuantityParam(j.rslt_mean),L.formatQuantityParam(j.rslt_stddev),L.formatQuantityParam(j.product_currentUnit.prod_min2),L.formatQuantityParam(j.product_currentUnit.prod_min1),L.formatQuantityParam(j.product_currentUnit.prod_target),L.formatQuantityParam(j.product_currentUnit.prod_max1),L.formatQuantityParam(j.product_currentUnit.prod_max2)])),this.setSplitScreenTabParamList(2,"_QAPP006_INFO_PROCESS_SPLITSCREEN_2",A.l("_QAPP006_INFO_PROCESS_SPLITSCREEN_2",[L.formatQuantityParam(j.rslt_mean),L.formatQuantityParam(j.rslt_stddev),j.count_min2.toFixed(0),j.count_min1.toFixed(0),j.count_passed.toFixed(0),j.count_max1.toFixed(0),j.count_max2.toFixed(0),j.count_skipped.toFixed(0)])),K.product.prod_type===h.EnumProductType.LIQUID&&(this.setWeighingSplitScreenParams(1,"",A.l("_QAPP006_PARAM_TITLE_PRODUCT_TARGET_VOL"),L.formatQuantityParam(K.product.prod_target)),
this.setWeighingSplitScreenParams(2,"",A.l("_QAPP006_PARAM_TITLE_PRODUCT_DENSITY"),L.formatQuantityParam(j.density))),this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),this.weighingScreenState=F.init,this.showScreen(this.weighingSplitScreen),this.addTimer(750,"init_timeout"),"";if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.weighingSplitScreen.setText1("",[]),this.setWeighingSplitScreenParams(1,"","",""),this.setWeighingSplitScreenParams(2,"","",""),this.weighingProxy.setButton(c.WEIGHING_BUTTON_DO_ZERO,T.EnumAppearance.ENABLED_SECONDARY),this.hideBargraph(),this.weighingSplitScreen.hide(),this.hideMsgBox(),"";if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED){if(e.payload.buttonId===A.btn.repeat_zero.getButtonId())return this.weighingProxy.clearTare2(),this.weighingScreenState=F.wait_zero,this.weighingProxy.doZero(c.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),""
;if(e.payload.buttonId===A.btn.show_graphs.getButtonId())return this.workflowState=H.interim_result_test_process,t.transition(this,this.SHOW_PROCESS_RESULT()),"";if(e.payload.buttonId===A.btn.skip.getButtonId())return j.curr_sample.rslt_status=h.EnumSampleResultStatus.SKIPPED,this.addToEventQueue(new N.SimpleEvent("nextSample")),"";if(e.payload.buttonId===A.btn.skip_all_next.getButtonId())return this.showMessageBox(_.EnumMessageboxType.QUESTION,A.l("_QAPP006_HEADER_FINISH_TEST_PREMATURELY"),A.l("_QAPP006_MESSAGE_FINISH_TEST_PREMATURELY",[j.current_idx.toFixed(0)]),[A.btn.msg_skip_all_next_no,A.btn.msg_skip_all_next_yes]),"";if(e.payload.buttonId===A.btn.msg_skip_all_next_yes.getButtonId())return j.samples.splice(j.current_idx),this.hideMsgBox(),this.addToEventQueue(new N.SimpleEvent("nextSample")),"";if(e.payload.buttonId===A.btn.msg_skip_all_next_no.getButtonId())return this.hideMsgBox(),"";if(e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId())return this.hideMsgBox(),""
;this.HandleHomeOrLogoutButtons(e)}else if(C.isObject(e)&&e.type&&e.type===N.QAPP_TIMER_EVENT){if(C.isString(e.payload)&&"init_timeout"===e.payload)return this.hideLoadingScreen(),this.addToEventQueue(new N.SimpleEvent("nextSample")),"";if(C.isString(e.payload)&&"applyPresetTare"===e.payload){let t=L.convertToTargetUnit(j.curr_sample.wgt_tare,this.Metrology.unit).value;return K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN_SINGLES&&(t=L.convertToTargetUnit(j.wgt_tare_mean,this.Metrology.unit).value),this.weighingProxy.setTare2(t).isSuccess()?(A.btn.repeat_zero.setAppearance(T.EnumAppearance.ENABLED_SECONDARY),this.weighingProxy.setButton(c.WEIGHING_BUTTON_DO_ZERO,T.EnumAppearance.HIDDEN),this.addToEventQueue(new N.SimpleEvent("switchTo_wait_auto_acquisition")),""):(this.addToEventQueue(new N.SimpleEvent("tryZeroAgain")),"")}}else if(C.isObject(e)&&e.type&&e.type===N.SIMPLE_EVENT){if(C.isString(e.payload)&&"nextSample"===e.payload){j.current_idx=0
;for(let t=0;t<j.samples.length&&(j.current_idx=t,j.samples[t].rslt_status!==h.EnumSampleResultStatus.PENDING||K.product.proc_tare_type!==h.EnumTareType.NO_TARE&&j.samples[t].tare_status===h.EnumSampleResultStatus.PENDING);t++);return this.calculateStatistics_fillings(K.product.prod_target.unit),this.setSplitScreenTabParamList(1,"_QAPP006_INFO_PROCESS_SPLITSCREEN_1",A.l("_QAPP006_INFO_PROCESS_SPLITSCREEN_1",[L.formatQuantityParam(j.rslt_mean),L.formatQuantityParam(j.rslt_stddev),L.formatQuantityParam(j.product_currentUnit.prod_min2),L.formatQuantityParam(j.product_currentUnit.prod_min1),L.formatQuantityParam(j.product_currentUnit.prod_target),L.formatQuantityParam(j.product_currentUnit.prod_max1),L.formatQuantityParam(j.product_currentUnit.prod_max2)])),
this.setSplitScreenTabParamList(2,"_QAPP006_INFO_PROCESS_SPLITSCREEN_2",A.l("_QAPP006_INFO_PROCESS_SPLITSCREEN_2",[L.formatQuantityParam(j.rslt_mean),L.formatQuantityParam(j.rslt_stddev),j.count_min2.toFixed(0),j.count_min1.toFixed(0),j.count_passed.toFixed(0),j.count_max1.toFixed(0),j.count_max2.toFixed(0),j.count_skipped.toFixed(0)])),this.hideBargraph(),this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),this.weighingProxy.setButton(c.WEIGHING_BUTTON_DO_ZERO,T.EnumAppearance.ENABLED_SECONDARY),A.btn.repeat_zero.setAppearance(T.EnumAppearance.HIDDEN),A.btn.skip.setAppearance(T.EnumAppearance.DISABLED),A.btn.skip_all_next.setAppearance(T.EnumAppearance.DISABLED),this.weighingProxy.clearTare2(),this.weighingScreenState=F.wait_clear_pan,""}if(C.isString(e.payload)&&"tryZeroAgain"===e.payload)return this.hideBargraph(),this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),
this.weighingProxy.setButton(c.WEIGHING_BUTTON_DO_ZERO,T.EnumAppearance.ENABLED_SECONDARY),A.btn.repeat_zero.setAppearance(T.EnumAppearance.HIDDEN),this.weighingProxy.clearTare2(),this.weighingScreenState=F.wait_clear_pan,"";if(C.isString(e.payload)&&"switchTo_wait_auto_acquisition"===e.payload)return this.showBargraph(),this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_PLACE"),[(j.current_idx+1).toString(),j.samples.length.toFixed(0)]),A.btn.skip.setAppearance(T.EnumAppearance.ENABLED_SECONDARY),A.btn.skip_all_next.setAppearance(j.current_idx>0?T.EnumAppearance.ENABLED_SECONDARY:T.EnumAppearance.DISABLED),this.weighingScreenState=F.wait_auto_acquisition,""}else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT){if(C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let a=e.payload;if(a.context===Q.store_batch)return!0===a.success?(t.transition(this,this.SHOW_PROCESS_RESULT()),
""):(this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]),"")}}else if(C.isObject(e)&&C.isString(e.type)&&e.type===u.EV_MQTT_UPDATE){if(e.payload.topic===O.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE&&e.payload.value)return this.applyProcessProductLimits(),this.setSplitScreenTabParamList(1,"_QAPP006_INFO_PROCESS_SPLITSCREEN_1",A.l("_QAPP006_INFO_PROCESS_SPLITSCREEN_1",[L.formatQuantityParam(j.rslt_mean),L.formatQuantityParam(j.rslt_stddev),L.formatQuantityParam(j.product_currentUnit.prod_min2),L.formatQuantityParam(j.product_currentUnit.prod_min1),L.formatQuantityParam(j.product_currentUnit.prod_target),L.formatQuantityParam(j.product_currentUnit.prod_max1),L.formatQuantityParam(j.product_currentUnit.prod_max2)])),this.showBargraph(j.product_currentUnit.prod_target,j.product_currentUnit.prod_min1,j.product_currentUnit.prod_max1,j.product_currentUnit.prod_min2,j.product_currentUnit.prod_max2),
this.weighingScreenState!==F.wait_clear_pan&&this.weighingScreenState!==F.wait_zero||this.hideBargraph(),"";if(this.weighingScreenState===F.wait_clear_pan){let a=this.parse_MQTT_Weight(e,"anyNumber");if(a&&a.value<P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber())return j.current_idx+1===j.samples.length&&j.curr_sample.rslt_status!==h.EnumSampleResultStatus.PENDING?(this.showLoadingScreen(),this.finishTestProcess(),this.workflowState=H.result_test_process,!0===this.isQuickTest?(t.transition(this,this.SHOW_PROCESS_RESULT()),""):(this.weighingScreenState=F.init,this.storeBatch(K),"")):(this.weighingProxy.doZero(c.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.weighingScreenState=F.wait_zero,"")}else if(this.weighingScreenState===F.wait_zero){let t=this.parse_MQTT_Weight(e,"anyNumber");if(t&&!0===t.stable&&0===t.value)return K.product.proc_tare_type===h.EnumTareType.NO_TARE?(this.weighingScreenState=F.init,
this.addToEventQueue(new N.SimpleEvent("switchTo_wait_auto_acquisition")),""):(this.weighingScreenState=F.init,this.addTimer(500,"applyPresetTare"),"");if(e&&e.payload&&e.payload.topic===O.MqttTopics.WEIGHING_WAITING_FOR_STABILITY){return!1===JSON.parse(e.payload.value.toString()).state?(this.weighingScreenState=F.init,this.addToEventQueue(new N.SimpleEvent("tryZeroAgain")),""):""}}if(this.weighingScreenState===F.wait_auto_acquisition){let t=this.parse_MQTT_Weight(e,"valid");if(t&&t.stable&&t.value>=P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber())return this.weighingScreenState=F.wait_dsd,this.reportingProxy.requestPrintableValue(h.QAPP_ID+"; Batch: "+K.lot_id+"; Product: "+K.product.product_id+"; Test: "+j.batch_test_id+"; Sample: "+(j.current_idx+1).toFixed(0)+" (Full)"),this.weighingWaitingTimeout=M.getDateTime("ms")+2e3,""}if(this.weighingScreenState===F.wait_dsd){
if(M.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingScreenState=F.wait_auto_acquisition,"";let t=this.parse_MQTT_Weight(e,"alibi");if(t&&C.isObject(t))return t.value<P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber()?(this.weighingScreenState=F.wait_auto_acquisition,""):(this.weighingScreenState=F.got_dsd,j.curr_sample.wgt_filling=d.cloneJSON(t),j.curr_sample.wgt_full=L.convertToTargetUnit(j.curr_sample.wgt_tare,j.curr_sample.wgt_filling.unit),j.curr_sample.wgt_full.value=P.bignumber(j.curr_sample.wgt_full.value).add(j.curr_sample.wgt_filling.value).toNumber(),this.calculateSampleFillingResult(j.curr_sample,K.product,j.density),this.addToEventQueue(new N.SimpleEvent("nextSample")),"")}}return""}ENTER_INPROCESS_DATA(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.ENTER_INPROCESS_DATA.name;if(!t&&e&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,s.EV_HMI_PARAM_CHANGED,N.SIMPLE_EVENT])
;if(!e||!t)return console.log(" ## DEBUG ## "+this.ENTER_INPROCESS_DATA()+": Missing argument"),"";let a=P.bignumber(1).dividedBy(Math.pow(10,j.density.decimals)).toNumber(),i=L.convertToTargetUnit(K.product.tare_plausibility,L.EnumUnit.GRAM);if(C.isString(e)&&"onEnter"===e)if(K.product.prod_type===h.EnumProductType.LIQUID||K.product.proc_tare_method===h.EnumTareMethod.TARE_ENTER){A.btn.info_enter_preset_tare=this.createMenuButton(A.l("_QAPP006_INFO_ENTER_PRESET_TARE"),K.product.proc_tare_method===h.EnumTareMethod.TARE_ENTER&&K.product.proc_tare_type!==h.EnumTareType.NO_TARE?T.EnumAppearance.DISABLED:T.EnumAppearance.HIDDEN),A.btn.param_tare=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_ENTERED_PROCESS_TARE"),K.product.proc_tare_method===h.EnumTareMethod.TARE_ENTER&&K.product.proc_tare_type!==h.EnumTareType.NO_TARE?T.EnumAppearance.ENABLED:T.EnumAppearance.HIDDEN),
A.btn.info_enter_density=this.createMenuButton(A.l("_QAPP006_INFO_ENTER_PROCESS_DENSITY"),K.product.prod_type===h.EnumProductType.LIQUID?T.EnumAppearance.DISABLED:T.EnumAppearance.HIDDEN),A.btn.param_density=this.createParameterButton(A.l("_QAPP006_PARAM_TITLE_PRODUCT_DENSITY"),K.product.prod_type===h.EnumProductType.LIQUID?T.EnumAppearance.ENABLED:T.EnumAppearance.HIDDEN),A.btn.param_tare.setLabelRight({id:L.formatQuantityParam(j.wgt_tare_mean),args:[]}),A.btn.param_density.setLabelRight({id:L.formatQuantityParam(j.density),args:[]}),A.btn.continue=this.createMenuButton(l.EnumFontLabels.NEXT),A.btn.msg_missing_tare_entry=this.createMessageButton(l.EnumFontLabels.OK),A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK);let t={id:this.IDEXTEND_SCREEN+this.ENTER_INPROCESS_DATA.name,appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_MENU,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_ENTER_INPROCESS_DATA"),args:[]},title:{id:"",args:[]},topbuttons:[],
menuType:E.TAB_MENU_TYPE_TOPIC,menubuttons:["/QAPP/"+A.btn.info_enter_preset_tare.getTopic(),"/QAPP/"+A.btn.param_tare.getTopic(),"/QAPP/"+A.btn.info_enter_density.getTopic(),"/QAPP/"+A.btn.param_density.getTopic()],scrollToTop:!1};this.mainScreen.setMenuTab(t,[A.btn.continue]),this.mainScreen.hideTopLeftButton(),this.showScreen(this.mainScreen),this.hideLoadingScreen()}else this.addToEventQueue(new N.SimpleEvent("continueToNextStep"));else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.hideMsgBox(),this.mainScreen.hide(),"";if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED)if(e.payload.buttonId===A.btn.param_tare.getButtonId()){let t=L.convertToTargetUnit({value:this.Metrology.d,decimals:this.Metrology.decimals,unit:this.Metrology.unit},L.EnumUnit.GRAM);i.decimals=t.decimals,j.wgt_tare_mean=C.isNumber(j.wgt_tare_mean.value)?j.wgt_tare_mean:{value:0,unit:t.unit,decimals:t.decimals},
this.openInputNumber(A.btn.param_tare.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_ENTERED_PROCESS_TARE"),C.isNumber(j.wgt_tare_mean.value)?j.wgt_tare_mean:{value:0,unit:t.unit,decimals:t.decimals},t.value,i.value)}else if(e.payload.buttonId===A.btn.param_density.getButtonId())this.openInputNumber(A.btn.param_density.getButtonId()+"_param",A.l("_QAPP006_PARAM_HEADER_PRODUCT_DENSITY"),j.density,a,1/0);else if(e.payload.buttonId===A.btn.continue.getButtonId()){if(K.product.proc_tare_type!==h.EnumTareType.NO_TARE&&K.product.proc_tare_method===h.EnumTareMethod.TARE_ENTER&&(!C.isNumber(j.wgt_tare_mean.value)||j.wgt_tare_mean.value<=0||j.wgt_tare_mean.value>i.value))return this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_ENTER_TARE_MISSING"),A.l("_QAPP006_MESSAGE_ENTER_TARE_MISSING"),[A.btn.msg_missing_tare_entry]),"";this.addToEventQueue(new N.SimpleEvent("continueToNextStep"))}else{
if(e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId())return this.hideMsgBox(),"";e.payload.buttonId===A.btn.msg_missing_tare_entry.getButtonId()&&this.hideMsgBox()}else if(C.isObject(e)&&e.type&&e.type===N.SIMPLE_EVENT){if(C.isString(e.payload)&&"continueToNextStep"===e.payload){if(K.product.proc_tare_method===h.EnumTareMethod.TARE_ENTER){for(let t=0;t<j.samples.length;t++)j.samples[t].wgt_tare=d.cloneJSON(j.wgt_tare_mean),this.evaluateSampleTareStatus(j.samples[t],K.product);this.calculateStatistics_tares(K.product.tare_target.unit),j.time_end=M.getDateTime("iso"),j.current_idx=0}switch(K.product.proc_tare_type){case h.EnumTareType.NO_TARE:case h.EnumTareType.EMPTY_FILLED:t.transition(this,this.PROCESS_EF_FILLING_MEASUREMENT());break;case h.EnumTareType.FILLED_EMPTY:if(K.product.proc_tare_method===h.EnumTareMethod.TARE_ENTER)return this.showLoadingScreen(),this.finishTestProcess(),this.workflowState=H.result_test_process,
!0===this.isQuickTest?(t.transition(this,this.SHOW_PROCESS_RESULT()),""):(this.weighingScreenState=F.init,this.storeBatch(K),"");t.transition(this,this.PROCESS_FE_EMPTY_MEASUREMENT());break;default:t.transition(this,this.MAIN_MENU())}return""}}else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT&&C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let a=e.payload;if(a.context===Q.store_batch)return!0===a.success?(t.transition(this,this.SHOW_PROCESS_RESULT()),""):(this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]),"")}}const n=this.parseParamInput(e);return n.isHandled&&n.isValid&&(n.id===A.btn.param_tare.getButtonId()+"_param"?(j.wgt_tare_mean.value=n.rFloat,(!C.isNumber(j.wgt_tare_mean.value)||j.wgt_tare_mean.value<=0||j.wgt_tare_mean.value>i.value)&&(j.wgt_tare_mean.value=0),A.btn.param_tare.setLabelRight({id:L.formatQuantityParam(j.wgt_tare_mean),args:[]},!0)):n.id===A.btn.param_density.getButtonId()+"_param"&&(j.density.value=n.rFloat,
(!C.isNumber(j.density.value)||j.density.value<a)&&(j.density.value=a),A.btn.param_density.setLabelRight({id:L.formatQuantityParam(j.density),args:[]},!0)),this.hideInput(),this.mainScreen.show()),""}PROCESS_FE_FILLED_MEASUREMENT(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.PROCESS_FE_FILLED_MEASUREMENT.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,u.EV_MQTT_UPDATE,N.SIMPLE_EVENT]);if(!e||!t)return console.log(" ## DEBUG ## "+this.PROCESS_FE_FILLED_MEASUREMENT()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e)A.btn.skip=this.createWeighingSplitScreenButton(0,A.l("_QAPP006_BUTTON_SKIP_SAMPLE"),T.EnumAppearance.DISABLED),A.btn.skip_all_next=this.createWeighingSplitScreenButton(1,l.EnumFontLabels.CANCEL,T.EnumAppearance.DISABLED),A.btn.msg_skip_all_next_yes=this.createMessageButton(A.l("_QAPP006_BUTTON_YES")),A.btn.msg_skip_all_next_no=this.createMessageButton(A.l("_QAPP006_BUTTON_NO")),
A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK),this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),this.weighingScreenState=F.init,this.weighingSplitScreen.getTabApi().clearTabList(),this.setSplitScreenTabHeader(0,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_FILLED_PROCESS")),!1===this.isQuickTest&&this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_BATCH_ID"),K.lot_id,A.l("_QAPP006_PARAM_TITLE_BATCH_ID")),this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID"),K.product.product_id,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID")),this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ARTICLE_NO"),K.product.article_id,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ARTICLE_NO")),this.setWeighingSplitScreenParams(1,"",A.l("_QAPP006_PARAM_TITLE_PRODUCT_TARGET_VOL"),L.formatQuantityParam(K.product.prod_target)),
K.product.prod_type===h.EnumProductType.LIQUID&&this.setWeighingSplitScreenParams(2,"",A.l("_QAPP006_PARAM_TITLE_PRODUCT_DENSITY"),L.formatQuantityParam(j.density)),this.showScreen(this.weighingSplitScreen),this.addTimer(750,"init_timeout");else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.weighingSplitScreen.setText1("",[]),this.setWeighingSplitScreenParams(1,"","",""),this.setWeighingSplitScreenParams(2,"","",""),this.weighingSplitScreen.hide(),this.hideBargraph(),this.hideMsgBox(),"";if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED)if(e.payload.buttonId===A.btn.skip.getButtonId())j.curr_sample.tare_status=h.EnumSampleResultStatus.SKIPPED,j.curr_sample.full_status=h.EnumSampleResultStatus.SKIPPED,j.curr_sample.rslt_status=h.EnumSampleResultStatus.SKIPPED,this.addToEventQueue(new N.SimpleEvent("nextSample"));else{
if(e.payload.buttonId===A.btn.skip_all_next.getButtonId())return this.showMessageBox(_.EnumMessageboxType.QUESTION,A.l("_QAPP006_HEADER_FINISH_TEST_PREMATURELY"),A.l("_QAPP006_MESSAGE_FINISH_TEST_PREMATURELY",[j.current_idx.toFixed(0)]),[A.btn.msg_skip_all_next_no,A.btn.msg_skip_all_next_yes]),"";if(e.payload.buttonId===A.btn.msg_skip_all_next_yes.getButtonId())j.samples.splice(j.current_idx),this.hideMsgBox(),this.addToEventQueue(new N.SimpleEvent("nextSample"));else{if(e.payload.buttonId===A.btn.msg_skip_all_next_no.getButtonId())return this.hideMsgBox(),"";if(e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId())return this.hideMsgBox(),"";this.HandleHomeOrLogoutButtons(e)}}else if(C.isObject(e)&&e.type&&e.type===N.QAPP_TIMER_EVENT)C.isString(e.payload)&&"init_timeout"===e.payload&&(this.hideLoadingScreen(),this.addToEventQueue(new N.SimpleEvent("nextSample")));else if(C.isObject(e)&&e.type&&e.type===N.SIMPLE_EVENT){if(C.isString(e.payload)&&"nextSample"===e.payload){
j.current_idx=0;for(let t=0;t<j.samples.length&&(j.current_idx=t,j.samples[t].full_status!==h.EnumSampleResultStatus.PENDING);t++);this.hideBargraph(),this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),A.btn.skip.setAppearance(T.EnumAppearance.DISABLED),A.btn.skip_all_next.setAppearance(T.EnumAppearance.DISABLED),this.weighingScreenState=F.wait_clear_pan}}else if(C.isObject(e)&&C.isString(e.type)&&e.type===u.EV_MQTT_UPDATE){if(this.weighingScreenState===F.wait_clear_pan){let a=this.parse_MQTT_Weight(e,"anyNumber");if(a&&a.value<P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber())return j.current_idx+1===j.samples.length&&j.curr_sample.full_status!==h.EnumSampleResultStatus.PENDING?(this.showLoadingScreen(),j.time_end=M.getDateTime("iso"),t.transition(this,this.ENTER_INPROCESS_DATA()),""):(this.weighingProxy.doZero(c.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.weighingScreenState=F.wait_zero,"")
}else if(this.weighingScreenState===F.wait_zero){let t=this.parse_MQTT_Weight(e,"anyNumber");if(t&&!0===t.stable&&0===t.value)return this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_PLACE"),[(j.current_idx+1).toFixed(0),j.samples.length.toFixed(0)]),A.btn.skip.setAppearance(T.EnumAppearance.ENABLED_SECONDARY),A.btn.skip_all_next.setAppearance(j.current_idx>0?T.EnumAppearance.ENABLED_SECONDARY:T.EnumAppearance.DISABLED),this.weighingScreenState=F.wait_auto_acquisition,"";if(e.payload.topic===O.MqttTopics.WEIGHING_WAITING_FOR_STABILITY){return!1===JSON.parse(e.payload.value.toString()).state?(this.weighingScreenState=F.wait_clear_pan,""):""}}let a=!1;if(this.weighingScreenState===F.wait_auto_acquisition||this.weighingScreenState===F.wait_dsd){let t=this.parse_MQTT_Weight(e,"valid");t&&t.stable&&t.value>=P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber()&&(a=!0)}
if(this.weighingScreenState===F.wait_auto_acquisition&&a)return this.weighingScreenState=F.wait_dsd,this.reportingProxy.requestPrintableValue(h.QAPP_ID+"; Batch: "+K.lot_id+"; Product: "+K.product.product_id+"; Test: "+j.batch_test_id+"; Sample: "+(j.current_idx+1).toFixed(0)+" (Full)"),this.weighingWaitingTimeout=M.getDateTime("ms")+2e3,"";if(this.weighingScreenState===F.wait_dsd){if(M.getDateTime("ms")>this.weighingWaitingTimeout)return A.btn.skip.setAppearance(T.EnumAppearance.ENABLED_SECONDARY),A.btn.skip_all_next.setAppearance(j.current_idx>0?T.EnumAppearance.ENABLED_SECONDARY:T.EnumAppearance.DISABLED),this.weighingScreenState=F.wait_auto_acquisition,"";let t=this.parse_MQTT_Weight(e,"alibi");t&&(this.weighingScreenState=F.got_dsd,t.value>=0&&a&&(j.curr_sample.wgt_full=d.cloneJSON(t),j.curr_sample.full_status=h.EnumSampleResultStatus.OK),this.addToEventQueue(new N.SimpleEvent("nextSample")))}}}return""}PROCESS_FE_EMPTY_MEASUREMENT(t,e){
if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.PROCESS_FE_EMPTY_MEASUREMENT.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED,u.EV_MQTT_UPDATE,N.SIMPLE_EVENT]);if(!e||!t)return console.log(" ## DEBUG ## "+this.PROCESS_FE_EMPTY_MEASUREMENT()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){if(A.btn.skip=this.createWeighingSplitScreenButton(0,A.l("_QAPP006_BUTTON_SKIP_SAMPLE"),K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.DISABLED),A.btn.show_graphs=this.createWeighingSplitScreenButton(1,l.EnumFontLabels.RESULT,K.product.proc_tare_method===h.EnumTareMethod.TARE_SINGLE?T.EnumAppearance.ENABLED_SECONDARY:T.EnumAppearance.HIDDEN),A.btn.skip_all_next=this.createWeighingSplitScreenButton(2,l.EnumFontLabels.CANCEL,K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.DISABLED),
A.btn.msg_cancel_back=this.createMessageButton(A.l("_QAPP006_BUTTON_BACK")),A.btn.msg_cancel_abort=this.createMessageButton(A.l("_QAPP006_BUTTON_CANCEL")),A.btn.msg_cancel_finish=this.createMessageButton(A.l("_QAPP006_BUTTON_FINISH_PROCESS")),A.btn.msg_skip_all_next_yes=this.createMessageButton(A.l("_QAPP006_BUTTON_YES")),A.btn.msg_skip_all_next_no=this.createMessageButton(A.l("_QAPP006_BUTTON_NO")),A.btn.msg_dbquery_failed=this.createMessageButton(l.EnumFontLabels.OK),this.applyProcessProductLimits(),this.weighingSplitScreen.getTabApi().clearTabList(),this.setSplitScreenTabHeader(0,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_TARE_PROCESS")),!1===this.isQuickTest&&this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_BATCH_ID"),K.lot_id,A.l("_QAPP006_PARAM_TITLE_BATCH_ID")),this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID"),K.product.product_id,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ID")),
this.setSplitScreenTabParamList(0,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ARTICLE_NO"),K.product.article_id,A.l("_QAPP006_PARAM_TITLE_PRODUCT_ARTICLE_NO")),K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&(this.setSplitScreenTabHeader(1,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_TARE_PROCESS")),this.setSplitScreenTabParamList(1,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),L.formatQuantityParam(j.product_currentUnit.tare_min2),L.formatQuantityParam(j.product_currentUnit.tare_min1),L.formatQuantityParam(j.product_currentUnit.tare_target),L.formatQuantityParam(j.product_currentUnit.tare_max1),L.formatQuantityParam(j.product_currentUnit.tare_max2)])),this.setSplitScreenTabHeader(2,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_TARE_PROCESS")),
this.setSplitScreenTabParamList(2,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_2",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_2",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),j.wgt_tare_count_min2.toFixed(0),j.wgt_tare_count_min1.toFixed(0),j.wgt_tare_count_passed.toFixed(0),j.wgt_tare_count_max1.toFixed(0),j.wgt_tare_count_max2.toFixed(0),j.count_skipped.toFixed(0)])),this.showBargraph(j.product_currentUnit.tare_target,j.product_currentUnit.tare_min1,j.product_currentUnit.tare_max1,j.product_currentUnit.tare_min2,j.product_currentUnit.tare_max2)),K.product.proc_tare_method===h.EnumTareMethod.TARE_SINGLE){let t=K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED?3:1;this.setSplitScreenTabHeader(t,A.l("_QAPP006_SCREENTITLE_SPLITSCREEN_TARE_PROCESS_CALC_RESULTS")),
this.setSplitScreenTabParamList(t,"_QAPP006_INFO_PROCESS_SPLITSCREEN_2",A.l("_QAPP006_INFO_PROCESS_SPLITSCREEN_2",[L.formatQuantityParam(j.rslt_mean),L.formatQuantityParam(j.rslt_stddev),j.count_min2.toFixed(0),j.count_min1.toFixed(0),j.count_passed.toFixed(0),j.count_max1.toFixed(0),j.count_max2.toFixed(0),j.count_skipped.toFixed(0)]))}this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),this.weighingScreenState=F.init,this.showScreen(this.weighingSplitScreen),this.addTimer(750,"init_timeout")}else{if(C.isString(e)&&"onExit"===e)return this.showLoadingScreen(),this.weighingSplitScreen.setText1("",[]),this.setWeighingSplitScreenParams(1,"","",""),this.setWeighingSplitScreenParams(2,"","",""),this.hideBargraph(),this.weighingSplitScreen.hide(),this.hideMsgBox(),"";if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED){if(e.payload.buttonId===A.btn.show_graphs.getButtonId())return this.workflowState=H.interim_result_test_process,
t.transition(this,this.SHOW_PROCESS_RESULT()),"";if(e.payload.buttonId===A.btn.skip.getButtonId())j.curr_sample.tare_status=h.EnumSampleResultStatus.SKIPPED,j.curr_sample.full_status=h.EnumSampleResultStatus.SKIPPED,j.curr_sample.rslt_status=h.EnumSampleResultStatus.SKIPPED,this.addToEventQueue(new N.SimpleEvent("nextSample"));else{if(e.payload.buttonId===A.btn.skip_all_next.getButtonId())return this.showMessageBox(_.EnumMessageboxType.QUESTION,A.l("_QAPP006_HEADER_FINISH_TEST_PREMATURELY"),A.l("_QAPP006_MESSAGE_FINISH_TEST_PREMATURELY",[j.current_idx.toFixed(0)]),[A.btn.msg_skip_all_next_no,A.btn.msg_skip_all_next_yes]),"";if(e.payload.buttonId===A.btn.msg_skip_all_next_yes.getButtonId())j.samples.splice(j.current_idx),this.hideMsgBox(),this.addToEventQueue(new N.SimpleEvent("nextSample"));else{if(e.payload.buttonId===A.btn.msg_skip_all_next_no.getButtonId())return this.hideMsgBox(),"";if(e.payload.buttonId===A.btn.msg_dbquery_failed.getButtonId())return this.hideMsgBox(),""
;this.HandleHomeOrLogoutButtons(e)}}}else if(C.isObject(e)&&e.type&&e.type===N.QAPP_TIMER_EVENT)C.isString(e.payload)&&"init_timeout"===e.payload&&(this.hideLoadingScreen(),this.addToEventQueue(new N.SimpleEvent("nextSample")));else if(C.isObject(e)&&e.type&&e.type===N.SIMPLE_EVENT){if(C.isString(e.payload)&&"nextSample"===e.payload){j.current_idx=0;for(let t=0;t<j.samples.length&&(j.current_idx=t,j.samples[t].full_status===h.EnumSampleResultStatus.PENDING||j.samples[t].full_status===h.EnumSampleResultStatus.SKIPPED||j.samples[t].tare_status!==h.EnumSampleResultStatus.PENDING);t++);if(this.calculateStatistics_tares(K.product.tare_target.unit),
K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&(this.setSplitScreenTabParamList(1,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),L.formatQuantityParam(j.product_currentUnit.tare_min2),L.formatQuantityParam(j.product_currentUnit.tare_min1),L.formatQuantityParam(j.product_currentUnit.tare_target),L.formatQuantityParam(j.product_currentUnit.tare_max1),L.formatQuantityParam(j.product_currentUnit.tare_max2)])),this.setSplitScreenTabParamList(2,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_2",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_2",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),j.wgt_tare_count_min2.toFixed(0),j.wgt_tare_count_min1.toFixed(0),j.wgt_tare_count_passed.toFixed(0),j.wgt_tare_count_max1.toFixed(0),j.wgt_tare_count_max2.toFixed(0),j.count_skipped.toFixed(0)]))),
K.product.proc_tare_method===h.EnumTareMethod.TARE_SINGLE){let t=K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED?3:1;this.setSplitScreenTabParamList(t,"_QAPP006_INFO_PROCESS_SPLITSCREEN_2",A.l("_QAPP006_INFO_PROCESS_SPLITSCREEN_2",[L.formatQuantityParam(j.rslt_mean),L.formatQuantityParam(j.rslt_stddev),j.count_min2.toFixed(0),j.count_min1.toFixed(0),j.count_passed.toFixed(0),j.count_max1.toFixed(0),j.count_max2.toFixed(0),j.count_skipped.toFixed(0)]))}A.btn.skip.setAppearance(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.DISABLED),A.btn.skip_all_next.setAppearance(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?T.EnumAppearance.HIDDEN:T.EnumAppearance.DISABLED),this.hideBargraph(),this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),this.weighingScreenState=F.wait_clear_pan}}else if(C.isObject(e)&&C.isString(e.type)&&e.type===N.IMMEDIATE_EVENT){
if(C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==v){let a=e.payload;if(a.context===Q.store_batch)return!0===a.success?(t.transition(this,this.SHOW_PROCESS_RESULT()),""):(this.DatabaseErrorMsg(a.result,[A.btn.msg_dbquery_failed]),"")}}else if(C.isObject(e)&&C.isString(e.type)&&e.type===u.EV_MQTT_UPDATE){if(e.payload.topic===O.MqttTopics.WEIGHING_SELECTED_DISPLAY_VALUE&&e.payload.value)return K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&(this.applyProcessProductLimits(),this.setSplitScreenTabParamList(1,"_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",A.l("_QAPP006_INFO_TARE_PROCESS_SPLITSCREEN_1",[L.formatQuantityParam(j.wgt_tare_mean),L.formatQuantityParam(j.wgt_tare_stddev),L.formatQuantityParam(j.product_currentUnit.tare_min2),L.formatQuantityParam(j.product_currentUnit.tare_min1),L.formatQuantityParam(j.product_currentUnit.tare_target),L.formatQuantityParam(j.product_currentUnit.tare_max1),L.formatQuantityParam(j.product_currentUnit.tare_max2)])),
this.showBargraph(j.product_currentUnit.tare_target,j.product_currentUnit.tare_min1,j.product_currentUnit.tare_max1,j.product_currentUnit.tare_min2,j.product_currentUnit.tare_max2),this.weighingScreenState!==F.wait_clear_pan&&this.weighingScreenState!==F.wait_zero||this.hideBargraph()),"";if(this.weighingScreenState===F.wait_clear_pan){let a=this.parse_MQTT_Weight(e,"anyNumber");if(a&&a.value<P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber())return j.current_idx+1===j.samples.length&&j.curr_sample.tare_status!==h.EnumSampleResultStatus.PENDING?(this.showLoadingScreen(),this.finishTestProcess(),this.workflowState=H.result_test_process,!0===this.isQuickTest?(t.transition(this,this.SHOW_PROCESS_RESULT()),""):(this.weighingScreenState=F.init,this.storeBatch(K),"")):(this.weighingProxy.doZero(c.WEIGHING_DOZEROTARE_BEHAVIOR.WEIGHING_DOZEROTARE_BEHAVIOR_AFTER_STABILITY),this.preventAutoLogout("justOnce"),this.weighingScreenState=F.wait_zero,"")
}else if(this.weighingScreenState===F.wait_zero){let t=this.parse_MQTT_Weight(e,"anyNumber");if(t&&!0===t.stable&&0===t.value)K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&this.showBargraph(),K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_TARE_MEAN"),[j.samples.length.toFixed(0)]):K.product.proc_tare_method!==h.EnumTareMethod.TARE_SINGLE&&K.product.proc_tare_method!==h.EnumTareMethod.TARE_MEAN_SINGLES||(this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_TARE_SINGLE"),[(j.current_idx+1).toFixed(0),j.samples.length.toFixed(0)]),A.btn.skip.setAppearance(T.EnumAppearance.ENABLED_SECONDARY),A.btn.skip_all_next.setAppearance(j.current_idx>0?T.EnumAppearance.ENABLED_SECONDARY:T.EnumAppearance.DISABLED)),this.weighingScreenState=F.wait_auto_acquisition;else if(e.payload.topic===O.MqttTopics.WEIGHING_WAITING_FOR_STABILITY){return!1===JSON.parse(e.payload.value.toString()).state?(this.hideBargraph(),
this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),this.weighingScreenState=F.wait_clear_pan,""):""}}if(this.weighingScreenState===F.wait_auto_acquisition){let t=this.parse_MQTT_Weight(e,"valid");if(t&&t.stable&&t.value>=P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber())return this.weighingScreenState=F.wait_dsd,this.reportingProxy.requestPrintableValue(h.QAPP_ID+"; Batch: "+K.lot_id+"; Product: "+K.product.product_id+"; Test: "+j.batch_test_id+"; Sample: "+(j.current_idx+1).toFixed(0)+" (Empty)"),this.weighingWaitingTimeout=M.getDateTime("ms")+2e3,""}if(this.weighingScreenState===F.wait_dsd){if(M.getDateTime("ms")>this.weighingWaitingTimeout)return this.weighingScreenState=F.wait_auto_acquisition,"";let t=this.parse_MQTT_Weight(e,"alibi");if(t&&C.isObject(t)){if(t.value<P.bignumber(k.auto_acquisition.value).times(this.Metrology.d).toNumber())return this.weighingScreenState=F.wait_auto_acquisition,""
;if(t.value>j.product_currentUnit.tare_plausibility.value)return this.hideBargraph(),this.weighingSplitScreen.setText1(A.l("_QAPP006_INFO_PROCESS_SAMPLE_REMOVE"),[]),this.weighingScreenState=F.wait_clear_pan,"";if(this.weighingScreenState=F.got_dsd,K.product.proc_tare_method===h.EnumTareMethod.TARE_SINGLE||K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN_SINGLES){if(j.curr_sample.wgt_tare=d.cloneJSON(t),this.evaluateSampleTareStatus(j.curr_sample,K.product),K.product.proc_tare_method===h.EnumTareMethod.TARE_SINGLE){j.curr_sample.wgt_filling=L.convertToTargetUnit(j.curr_sample.wgt_full,j.curr_sample.wgt_tare.unit),j.curr_sample.wgt_filling.value=P.bignumber(j.curr_sample.wgt_filling.value).minus(j.curr_sample.wgt_tare.value).toNumber(),j.curr_sample.wgt_filling.value=j.curr_sample.wgt_filling.value>=0?j.curr_sample.wgt_filling.value:0,this.calculateSampleFillingResult(j.curr_sample,K.product,j.density),this.calculateStatistics_fillings(K.product.prod_target.unit)
;let t=K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED?3:1;this.setSplitScreenTabParamList(t,"_QAPP006_INFO_PROCESS_SPLITSCREEN_2",A.l("_QAPP006_INFO_PROCESS_SPLITSCREEN_2",[L.formatQuantityParam(j.rslt_mean),L.formatQuantityParam(j.rslt_stddev),j.count_min2.toFixed(0),j.count_min1.toFixed(0),j.count_passed.toFixed(0),j.count_max1.toFixed(0),j.count_max2.toFixed(0),j.count_skipped.toFixed(0)]))}}else if(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN){t.value=P.bignumber(t.value).dividedBy(j.samples.length).toNumber(),t.alibiId=void 0;for(let e=0;e<j.samples.length;e++)j.samples[e].wgt_tare=d.cloneJSON(t),this.evaluateSampleTareStatus(j.samples[e],K.product)}this.addToEventQueue(new N.SimpleEvent("nextSample"))}}}}return""}SHOW_PROCESS_RESULT(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.SHOW_PROCESS_RESULT.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED])
;if(!e||!t)return console.log(" ## DEBUG ## "+this.SHOW_PROCESS_RESULT()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){this.tabScreen.clearTabList(),this.tabScreen.showBackButton(),A.btn.docu=this.createTabscreenButton(l.EnumFontLabels.DOCU,T.EnumAppearance.HIDDEN),A.btn.close_result_screen=this.createTabscreenButton(l.EnumFontLabels.CANCEL,T.EnumAppearance.HIDDEN);let t=this.tabScreen.addGraphTab("toleranceCountersTab",{id:"toleranceCountersTab",appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_GRAPH,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_PROCESSSTAT_CHART_TOLERANCES"),args:[]},title:{id:"",args:[]},topbuttons:[],data:{}},[A.btn.close_result_screen,A.btn.docu]),e=new r.CheckweighingCounterChart;e.init({splittScreenTab:t,tabbedScreenTab:t},{minMax:{minTol:0,maxTol:0},minMax2:{minTol:0,maxTol:0},plausibility:void 0}),e.overwriteDataDivision({ltPlausible:void 0,ltMin1:j.count_min1,ltMin2:j.count_min2,target:j.count_passed,gtMax1:j.count_max1,gtMax2:j.count_max2
});let a=this.tabScreen.addGraphTab("singleValuesTab",{id:"singleValuesTab",appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_GRAPH,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_PROCESSSTAT_CHART_SINGLE_VALUES"),args:[]},title:{id:"",args:[]},topbuttons:[],data:{}},[A.btn.close_result_screen,A.btn.docu]),i=[],s=[],n=[];for(let t=0;t<j.samples.length;t++)s.push((t+1).toString()),i.push(parseFloat(L.formatQuantityParam_numberOnly(L.convertToTargetUnit(j.samples[t].wgt_filling,this.Metrology.unit)))),n.push(L.formatQuantityParam(j.samples[t].rslt_filling));return a.setData(this.getXYbarsChartData(i,s,K.product.prod_type===h.EnumProductType.LIQUID?n:[],L.getUnitString(this.Metrology.unit)),!0),this.tabScreen.publishTabList(),this.tabScreen.show(),this.workflowState===H.result_test_process?(this.reportTestProcess(),A.btn.docu.setAppearance(T.EnumAppearance.ENABLED),this.tabScreen.hideBackButton()):(this.hideLoadingScreen(),this.tabScreen.showBackButton()),""}
if(C.isString(e)&&"onExit"===e)return this.clearPrintQueue(),this.showLoadingScreen(),this.hidePrintQueue(),this.tabScreen.hide(),this.hideMsgBox(),"";if(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED)if(e.payload.buttonId===A.btn.docu.getButtonId())this.showPrintQueue(),A.btn.close_result_screen.setAppearance(T.EnumAppearance.ENABLED);else if(e.payload.buttonId===A.btn.close_result_screen.getButtonId())!0===this.isQuickTest?t.transition(this,this.MAIN_MENU()):t.transition(this,this.BATCH_MENU());else if(e.payload.buttonId.startsWith(o.BACK_BUTTON_ID))switch(K.product.proc_tare_type){case h.EnumTareType.NO_TARE:case h.EnumTareType.EMPTY_FILLED:t.transition(this,this.PROCESS_EF_FILLING_MEASUREMENT());break;case h.EnumTareType.FILLED_EMPTY:t.transition(this,this.PROCESS_FE_EMPTY_MEASUREMENT())
}else this.HandleHomeOrLogoutButtons(e);else C.isObject(e)&&e.type&&e.type===N.IMMEDIATE_EVENT&&C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==A.REPORTING_QUEUE_DONE_EVENT&&this.hideLoadingScreen();return""}SHOW_BATCH_RESULT(t,e){if(!t&&!e)return this.IDEXTEND_STATE_SCREEN+this.SHOW_BATCH_RESULT.name;if(!t&&C.isString(e)&&"GET_EVENT_LISTENER"===e)return JSON.stringify([s.EV_HMI_BTN_CLICKED]);if(!e||!t)return console.log(" ## DEBUG ## "+this.SHOW_BATCH_RESULT()+": Missing argument"),"";if(C.isString(e)&&"onEnter"===e){this.showLoadingScreen(),this.reportBatch(),this.tabScreen.clearTabList(),this.workflowState===H.result_finish_batch?this.tabScreen.hideBackButton():this.workflowState===H.interim_result_batch&&this.tabScreen.showBackButton(),A.btn.docu=this.createTabscreenButton(l.EnumFontLabels.DOCU),A.btn.close_result_screen=this.createTabscreenButton(l.EnumFontLabels.CANCEL,T.EnumAppearance.HIDDEN);let t=this.tabScreen.addGraphTab("toleranceCountersTab",{
id:"toleranceCountersTab",appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_GRAPH,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_BATCHSTAT_CHART_TOLERANCES"),args:[]},title:{id:"",args:[]},topbuttons:[],data:{}},[A.btn.close_result_screen,A.btn.docu]),e=new r.CheckweighingCounterChart;e.init({splittScreenTab:t,tabbedScreenTab:t},{minMax:{minTol:0,maxTol:0},minMax2:{minTol:0,maxTol:0},plausibility:void 0}),e.overwriteDataDivision({ltPlausible:void 0,ltMin1:K.lt_count_min1,ltMin2:K.lt_count_min2,target:K.lt_count_passed,gtMax1:K.lt_count_max1,gtMax2:K.lt_count_max2});let a=this.tabScreen.addGraphTab("meanValuesTab",{id:"meanValuesTab",appearance:T.EnumAppearance.ENABLED,type:E.EnumTabType.TAB_GRAPH,containerTitle:{id:A.l("_QAPP006_SCREENTITLE_BATCHSTAT_CHART_SINGLE_PROCESSES"),args:[]},title:{id:"",args:[]},topbuttons:[],data:{}},[A.btn.close_result_screen,A.btn.docu]),i=[],s=[],n=[],o=p.sortKeys(K.processes),_=L.EnumUnit.MILLILITER;o.length>0&&(_=K.processes[o[0]].rslt_mean.unit)
;for(let t=0;t<o.length;t++)s.push((t+1).toString()),i.push(parseFloat(L.formatQuantityParam_numberOnly(K.processes[o[t]].rslt_mean))),n.push(M.getDateTime("frmt",this.DATETIME_CONFIGURATION,K.processes[o[t]].time_end,"iso"));return a.setData(this.getXYbarsChartData(i,s,n,L.getUnitString(_)),!0),this.tabScreen.publishTabList(),this.tabScreen.show(),""}return C.isString(e)&&"onExit"===e?(this.clearPrintQueue(),this.showLoadingScreen(),this.hidePrintQueue(),this.tabScreen.hide(),this.hideMsgBox(),""):(C.isObject(e)&&C.isString(e.type)&&e.type===s.EV_HMI_BTN_CLICKED?e.payload.buttonId===A.btn.docu.getButtonId()?(this.showPrintQueue(),
this.workflowState===H.result_finish_batch&&A.btn.close_result_screen.setAppearance(T.EnumAppearance.ENABLED)):e.payload.buttonId===A.btn.close_result_screen.getButtonId()?t.transition(this,this.MAIN_MENU()):e.payload.buttonId.startsWith(o.BACK_BUTTON_ID)?t.transition(this,this.BATCH_MENU()):this.HandleHomeOrLogoutButtons(e):C.isObject(e)&&e.type&&e.type===N.IMMEDIATE_EVENT&&C.isObject(e.payload)&&C.isString(e.payload.topic)&&e.payload.topic==A.REPORTING_QUEUE_DONE_EVENT&&this.hideLoadingScreen(),"")}onSuspending(){p.storeTaskConfig_DATA_CONTAINER(this.taskHandler,k);for(let t of Object.keys(this.fsmTimers))this.cancelTimer(t);super.onSuspending()}__________________METHODS__________________(){}HandleHomeOrLogoutButtons(t){A.btn.msg_RESERVED_logout_yes.getButtonId()===A.PROXY_BUTTON_DEFAULT_ID&&(A.btn.msg_RESERVED_logout_yes=this.createMessageButton(A.l("_QAPP006_BUTTON_YES"))),
A.btn.msg_RESERVERD_home_yes.getButtonId()===A.PROXY_BUTTON_DEFAULT_ID&&(A.btn.msg_RESERVERD_home_yes=this.createMessageButton(A.l("_QAPP006_BUTTON_YES"))),A.btn.msg_RESERVED_close_no.getButtonId()===A.PROXY_BUTTON_DEFAULT_ID&&(A.btn.msg_RESERVED_close_no=this.createMessageButton(A.l("_QAPP006_BUTTON_NO"))),
"BTN_HOME"===t.payload.buttonId?this.showMessageBox(_.EnumMessageboxType.QUESTION,A.l("_QAPP_LIB_MBOX_HOME_WARNING_TITLE"),A.l("_QAPP_LIB_MBOX_HOME_WARNING_TEXT_top",!0)+"<br>"+A.l("_QAPP_LIB_MBOX_HOME_WARNING_TEXT_mid",[void 0!==this.getTaskName()?this.getTaskName():""])+"<br>"+A.l("_QAPP_LIB_MBOX_HOME_WARNING_TEXT_bottom"),[A.btn.msg_RESERVERD_home_yes,A.btn.msg_RESERVED_close_no]):"BTN_LOGOUT"===t.payload.buttonId?this.showMessageBox(_.EnumMessageboxType.QUESTION,A.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TITLE"),A.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_top",!0)+"<br>"+A.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_mid",[void 0!==this.getTaskName()?this.getTaskName():""])+"<br>"+A.l("_QAPP_LIB_MBOX_LOGOUT_WARNING_TEXT_bottom",!0),[A.btn.msg_RESERVED_logout_yes,A.btn.msg_RESERVED_close_no]):t.payload.buttonId===A.btn.msg_RESERVERD_home_yes.getButtonId()?(this.hideMsgBox(),this.suspend()):t.payload.buttonId===A.btn.msg_RESERVED_logout_yes.getButtonId()?(this.hideMsgBox(),this.rememberLogout(),
this.suspend()):t.payload.buttonId===A.btn.msg_RESERVED_close_no.getButtonId()&&this.hideMsgBox()}OpenLIDInput(t,e){this.identifierAspect.configure({returnState:e,taskHandler:this.taskHandler,autoRememberSIDs:!1,showPreviouslySetLIDs:!0}),this.identifierAspect.setLotIDs(k.last_used_LIDs),t.transition(this,m.STATE_ASPECT_IDENTIFIER_ENTER_LOT_INPUT)}InitializeTestRun(t,e,a){if(A.btn.msg_RESERVED_not_compatible_ok.getButtonId()===A.PROXY_BUTTON_DEFAULT_ID&&(A.btn.msg_RESERVED_not_compatible_ok=this.createMessageButton(l.EnumFontLabels.OK)),A.btn.msg_RESERVED_maybe_not_compatible_continue.getButtonId()===A.PROXY_BUTTON_DEFAULT_ID&&(A.btn.msg_RESERVED_maybe_not_compatible_continue=this.createMessageButton(A.l("_QAPP006_BUTTON_YES"))),A.btn.msg_RESERVED_maybe_not_compatible_stop.getButtonId()===A.PROXY_BUTTON_DEFAULT_ID&&(A.btn.msg_RESERVED_maybe_not_compatible_stop=this.createMessageButton(A.l("_QAPP006_BUTTON_NO"))),a){
if(!1===this.CheckBalanceCompatibility(A.btn.msg_RESERVED_not_compatible_ok,A.btn.msg_RESERVED_maybe_not_compatible_stop,A.btn.msg_RESERVED_maybe_not_compatible_continue))return!0}else{if(e.payload.buttonId!==A.btn.msg_RESERVED_maybe_not_compatible_continue.getButtonId())return(e.payload.buttonId===A.btn.msg_RESERVED_not_compatible_ok.getButtonId()||e.payload.buttonId===A.btn.msg_RESERVED_maybe_not_compatible_stop.getButtonId())&&(this.hideMsgBox(),!0);this.hideMsgBox()}if((j=h.createProcess(void 0,K.product)).time_start=M.getDateTime("iso"),!0===this.isQuickTest)j.batch_test_id="QUICKTEST";else{let t=1;for(;K.processes.hasOwnProperty(t.toFixed(0));)t++;j.batch_test_id=t.toFixed(0)}switch(this.workflowState=H.perform_test,this.weighingProxy.clearTareAll(),K.product.proc_tare_type){case h.EnumTareType.NO_TARE:t.transition(this,this.ENTER_INPROCESS_DATA());break;case h.EnumTareType.EMPTY_FILLED:t.transition(this,this.PROCESS_EF_EMPTY_MEASUREMENT());break;case h.EnumTareType.FILLED_EMPTY:
t.transition(this,this.PROCESS_FE_FILLED_MEASUREMENT())}return!0}cancelTimer(t){C.isString(t)?(t=t,this.fsmTimers.hasOwnProperty(t)&&(super.cancelTimer(this.fsmTimers[t]),this.fsmTimers[t]=void 0,delete this.fsmTimers[t])):super.cancelTimer(t)}CheckBalanceCompatibility(t,e,a){let i=L.convertToTargetUnit({value:this.Metrology.e,unit:this.Metrology.unit,decimals:this.Metrology.decimals},L.EnumUnit.GRAM),s=L.convertToTargetUnit({value:this.Metrology.d,unit:this.Metrology.unit,decimals:this.Metrology.decimals},L.EnumUnit.GRAM),n=L.convertToTargetUnit({value:this.Metrology.max,unit:this.Metrology.unit,decimals:this.Metrology.decimals
},L.EnumUnit.GRAM),r=L.convertToTargetUnit(K.product.prod_target,L.EnumUnit.GRAM),o=L.convertToTargetUnit(K.product.prod_min2,L.EnumUnit.GRAM),E=L.convertToTargetUnit(K.product.prod_max2,L.EnumUnit.GRAM),l=L.convertToTargetUnit(K.product.tare_target,L.EnumUnit.GRAM),u=L.convertToTargetUnit(K.product.tare_min2,L.EnumUnit.GRAM),c=L.convertToTargetUnit(K.product.tare_max2,L.EnumUnit.GRAM);if(K.product.prod_test_type===h.EnumProductTestType.ACCORDING_76_211_EEC){if(!1===this.DEVICE_APPROVED)return this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_BALANCE_NOT_SUITABLE_FOR_PRODUCT"),A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_PRODUCT_NOT_VERIFIED"),[t]),!1;let e=-1;for(let t=0;t<h.BALANCE_PRECISION_76_211_EEC.length;t++)if(h.BALANCE_PRECISION_76_211_EEC[t].lower_equal_boundary<=r.value&&r.value<h.BALANCE_PRECISION_76_211_EEC[t].upper_boundary){e=t;break}
if(!(e>=0))return this.showMessageBox(_.EnumMessageboxType.ERROR,A.l("_QAPP006_HEADER_BALANCE_NOT_SUITABLE_FOR_PRODUCT"),A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_PRODUCT_PRECISION",[L.formatQuantityParam(i),L.formatQuantityParam(r)]),[t]),!1;if(i.value>h.BALANCE_PRECISION_76_211_EEC[e].limit_value)return this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_BALANCE_NOT_SUITABLE_FOR_PRODUCT"),A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_PRODUCT_PRECISION",[L.formatQuantityParam(i),L.formatQuantityParam(r)]),[t]),!1}if(r.value<s.value)return this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_BALANCE_NOT_SUITABLE_FOR_PRODUCT"),A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_PRODUCT_NOMINAL",[L.formatQuantityParam(s),L.formatQuantityParam(n),L.formatQuantityParam(r)]),[t]),!1;if(K.product.proc_tare_type===h.EnumTareType.NO_TARE||K.product.use_tare_limits===h.EnumProductUseTareLmits.DISABLED){
if(r.value>n.value)return this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_BALANCE_NOT_SUITABLE_FOR_PRODUCT"),A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_PRODUCT_NOMINAL",[L.formatQuantityParam(s),L.formatQuantityParam(n),L.formatQuantityParam(r)]),[t]),!1}else{if(l.value<s.value)return this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_BALANCE_NOT_SUITABLE_FOR_PRODUCT"),A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_PRODUCT_TARE",[L.formatQuantityParam(s),L.formatQuantityParam(n),L.formatQuantityParam(l)]),[t]),!1;if(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN&&l.value*K.product.count_target>n.value)return this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_BALANCE_NOT_SUITABLE_FOR_PRODUCT"),A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_PRODUCT_TARE",[L.formatQuantityParam(s),L.formatQuantityParam(n),L.formatQuantityParam(l)+" * "+K.product.count_target.toFixed(0)]),[t]),!1
;if(r.value+l.value>n.value)return this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_BALANCE_NOT_SUITABLE_FOR_PRODUCT"),A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_PRODUCT_NOMINAL",[L.formatQuantityParam(s),L.formatQuantityParam(n),L.formatQuantityParam(r)+" + Tare "+L.formatQuantityParam(l)]),[t]),!1}let T="";return o.value>0&&o.value<s.value&&(T+="<br>"+A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_TOLERANCES_PRODUCT_LOWER_LIMIT",[L.formatQuantityParam(o),L.formatQuantityParam(s)])),E.value>n.value&&(T+="<br>"+A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_TOLERANCES_PRODUCT_UPPER_LIMIT",[L.formatQuantityParam(E),L.formatQuantityParam(n)])),
K.product.proc_tare_type!==h.EnumTareType.NO_TARE&&K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&(K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN?(u.value>0&&u.value*K.product.count_target<s.value&&(T+="<br>"+A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_TOLERANCES_TARE_LOWER_LIMIT",[L.formatQuantityParam(u)+" * "+K.product.count_target.toFixed(0),L.formatQuantityParam(s)])),c.value*K.product.count_target>n.value&&(T+="<br>"+A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_TOLERANCES_TARE_UPPER_LIMIT",[L.formatQuantityParam(c)+" * "+K.product.count_target.toFixed(0),L.formatQuantityParam(n)]))):(u.value>0&&u.value<s.value&&(T+="<br>"+A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_TOLERANCES_TARE_LOWER_LIMIT",[L.formatQuantityParam(u),L.formatQuantityParam(s)])),c.value>n.value&&(T+="<br>"+A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_TOLERANCES_TARE_UPPER_LIMIT",[L.formatQuantityParam(c),L.formatQuantityParam(n)])))),
!(T.length>0)||(T=A.l("_QAPP006_MESSAGE_BALANCE_NOT_SUITABLE_FOR_TOLERANCES_GENERAL",!0)+T,this.showMessageBox(_.EnumMessageboxType.INFO,A.l("_QAPP006_HEADER_BALANCE_NOT_SUITABLE_FOR_TOLERANCES"),T,[e,a]),!1)}updateSIDsLIDs(){this.LID_parameters=[],k.last_used_LIDs=[];let t=this.identifierAspect.getLotVisualParams();for(let e=0;e<t.length;e++)this.LID_parameters[e]=t[e].getValue(),k.last_used_LIDs.push(this.LID_parameters[e].value.string)}getLIDprintParams(){this.updateSIDsLIDs();let t=[];for(let e=0;e<K.lot_ids.length;e++){let a=n.createEmptyStringParameter();a.appearance=T.EnumAppearance.ENABLED,C.isObject(this.LID_parameters[e])&&(a.title=this.LID_parameters[e].title,a.header=this.LID_parameters[e].header),a.value.string=K.lot_ids[e],0===e?a.header.id=""!==a.header.id?a.header.id:A.l("_QAPP006_PRINTLABEL_BATCH"):a.appearance=""===a.value.string?T.EnumAppearance.HIDDEN:T.EnumAppearance.ENABLED,t.push(a)}return t}evaluateSampleTareStatus(t,e){
if(e.use_tare_limits===h.EnumProductUseTareLmits.ENABLED){let a=L.convertToTargetUnit(t.wgt_tare,e.tare_min2.unit);a.value<e.tare_min2.value?t.tare_status=h.EnumSampleResultStatus.MIN2_VIOLATION:a.value<e.tare_min1.value?t.tare_status=h.EnumSampleResultStatus.MIN1_VIOLATION:a.value>e.tare_max2.value?t.tare_status=h.EnumSampleResultStatus.MAX2_VIOLATION:a.value>e.tare_max1.value?t.tare_status=h.EnumSampleResultStatus.MAX1_VIOLATION:t.tare_status=h.EnumSampleResultStatus.OK}else t.tare_status=h.EnumSampleResultStatus.OK}calculateSampleFillingResult(t,e,a){t.rslt_filling=L.convertToTargetUnit(t.wgt_filling,e.prod_target.unit),e.prod_type===h.EnumProductType.LIQUID&&(t.rslt_filling.value=P.bignumber(t.rslt_filling.value).dividedBy(a.value).toNumber()),
t.rslt_filling.value<e.prod_min2.value?t.rslt_status=h.EnumSampleResultStatus.MIN2_VIOLATION:t.rslt_filling.value<e.prod_min1.value?t.rslt_status=h.EnumSampleResultStatus.MIN1_VIOLATION:t.rslt_filling.value>e.prod_max2.value?t.rslt_status=h.EnumSampleResultStatus.MAX2_VIOLATION:t.rslt_filling.value>e.prod_max1.value?t.rslt_status=h.EnumSampleResultStatus.MAX1_VIOLATION:t.rslt_status=h.EnumSampleResultStatus.OK,t.full_status=h.EnumSampleResultStatus.OK}calculateStatistics_tares(t){j.wgt_tare_count_passed=0,j.wgt_tare_count_min2=0,j.wgt_tare_count_min1=0,j.wgt_tare_count_max1=0,j.wgt_tare_count_max2=0,j.count_skipped=0;let e=[]
;for(let t=0;t<j.samples.length;t++)j.samples[t].tare_status===h.EnumSampleResultStatus.MIN2_VIOLATION?j.wgt_tare_count_min2++:j.samples[t].tare_status===h.EnumSampleResultStatus.MIN1_VIOLATION?j.wgt_tare_count_min1++:j.samples[t].tare_status===h.EnumSampleResultStatus.MAX2_VIOLATION?j.wgt_tare_count_max2++:j.samples[t].tare_status===h.EnumSampleResultStatus.MAX1_VIOLATION?j.wgt_tare_count_max1++:j.samples[t].tare_status===h.EnumSampleResultStatus.OK?j.wgt_tare_count_passed++:j.samples[t].tare_status!==h.EnumSampleResultStatus.SKIPPED&&j.samples[t].rslt_status!==h.EnumSampleResultStatus.SKIPPED||j.count_skipped++,j.samples[t].tare_status!==h.EnumSampleResultStatus.PENDING&&j.samples[t].tare_status!==h.EnumSampleResultStatus.SKIPPED&&e.push(j.samples[t].wgt_tare);j.wgt_tare_mean=L.math_Mean(e,t),j.wgt_tare_minimum=L.math_Minimum(e,t),j.wgt_tare_maximum=L.math_Maximum(e,t),j.wgt_tare_range={value:P.bignumber(j.wgt_tare_maximum.value).minus(j.wgt_tare_minimum.value).toNumber(),
unit:j.wgt_tare_maximum.unit,decimals:j.wgt_tare_maximum.decimals},j.wgt_tare_stddev=L.math_Standard_Deviation(e,t)}calculateStatistics_fillings(t){j.count_passed=0,j.count_min2=0,j.count_min1=0,j.count_max1=0,j.count_max2=0,j.count_skipped=0;let e=[];for(let t=0;t<j.samples.length;t++)j.samples[t].rslt_status===h.EnumSampleResultStatus.MIN2_VIOLATION?j.count_min2++:j.samples[t].rslt_status===h.EnumSampleResultStatus.MIN1_VIOLATION?j.count_min1++:j.samples[t].rslt_status===h.EnumSampleResultStatus.MAX2_VIOLATION?j.count_max2++:j.samples[t].rslt_status===h.EnumSampleResultStatus.MAX1_VIOLATION?j.count_max1++:j.samples[t].rslt_status===h.EnumSampleResultStatus.OK?j.count_passed++:j.samples[t].tare_status!==h.EnumSampleResultStatus.SKIPPED&&j.samples[t].rslt_status!==h.EnumSampleResultStatus.SKIPPED||j.count_skipped++,j.samples[t].rslt_properly_processed&&e.push(j.samples[t].rslt_filling);j.rslt_mean=L.math_Mean(e,t),j.rslt_minimum=L.math_Minimum(e,t),j.rslt_maximum=L.math_Maximum(e,t),
j.rslt_range={value:P.bignumber(j.rslt_maximum.value).minus(j.rslt_minimum.value).toNumber(),unit:j.rslt_maximum.unit,decimals:j.rslt_maximum.decimals},j.rslt_stddev=L.math_Standard_Deviation(e,t)}recalculateCompleteSamplesOnBaseOfMeanTare(){for(let t=0;t<j.samples.length;t++)if(j.samples[t].tare_properly_processed)if(j.samples[t].full_status===h.EnumSampleResultStatus.SKIPPED)j.samples[t].rslt_status=h.EnumSampleResultStatus.SKIPPED;else{let e=L.convertToTargetUnit(j.samples[t].wgt_tare,j.samples[t].wgt_full.unit);K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN_SINGLES&&(e=L.convertToTargetUnit(j.wgt_tare_mean,j.samples[t].wgt_full.unit)),j.samples[t].wgt_filling=L.convertToTargetUnit(j.samples[t].wgt_full,j.samples[t].wgt_full.unit),j.samples[t].wgt_filling.value=P.bignumber(j.samples[t].wgt_filling.value).minus(e.value).toNumber(),j.samples[t].wgt_filling.value=j.samples[t].wgt_filling.value>=0?j.samples[t].wgt_filling.value:0,
this.calculateSampleFillingResult(j.samples[t],K.product,j.density)}}finishTestProcess(){switch(j.time_end=M.getDateTime("iso"),K.product.proc_tare_type){case h.EnumTareType.NO_TARE:this.calculateStatistics_fillings(K.product.prod_target.unit);break;case h.EnumTareType.EMPTY_FILLED:this.calculateStatistics_tares(K.product.prod_target.unit),this.calculateStatistics_fillings(K.product.prod_target.unit);break;case h.EnumTareType.FILLED_EMPTY:this.calculateStatistics_tares(K.product.prod_target.unit),K.product.proc_tare_method!==h.EnumTareMethod.TARE_MEAN_SINGLES&&K.product.proc_tare_method!==h.EnumTareMethod.TARE_MEAN&&K.product.proc_tare_method!==h.EnumTareMethod.TARE_ENTER||this.recalculateCompleteSamplesOnBaseOfMeanTare(),this.calculateStatistics_fillings(K.product.prod_target.unit)}if(!0===this.isQuickTest)return;let t=[]
;for(let e=0;e<j.samples.length;e++)if((K.product.proc_tare_type===h.EnumTareType.NO_TARE||j.samples[e].tare_properly_processed)&&j.samples[e].rslt_properly_processed){t.push(j.samples[e].rslt_filling);let a=L.convertToTargetUnit(j.samples[e].rslt_filling,K.lt_rslt_square_sum_in_stddev_unit.unit);K.lt_rslt_square_sum_in_stddev_unit.value=P.bignumber(K.lt_rslt_square_sum_in_stddev_unit.value).add(Math.pow(a.value,2)).toNumber()}K.lt_count+=t.length,K.lt_count_max2+=j.count_max2,K.lt_count_max1+=j.count_max1,K.lt_count_min1+=j.count_min1,K.lt_count_min2+=j.count_min2,K.lt_count_passed+=j.count_passed,K.lt_count_skipped+=j.count_skipped,K.lt_rslt_minimum=L.math_Minimum([K.lt_rslt_minimum,j.rslt_minimum],K.lt_rslt_minimum.unit),K.lt_rslt_maximum=L.math_Maximum([K.lt_rslt_maximum,j.rslt_maximum],K.lt_rslt_maximum.unit),K.lt_rslt_range={value:P.bignumber(K.lt_rslt_maximum.value).minus(K.lt_rslt_minimum.value).toNumber(),unit:K.lt_rslt_minimum.unit,decimals:K.lt_rslt_minimum.decimals},
K.lt_rslt_sum=L.math_Sum([K.lt_rslt_sum,L.math_Sum(t,K.lt_rslt_sum.unit)],K.lt_rslt_sum.unit),K.lt_rslt_mean.value=P.bignumber(K.lt_rslt_sum.value).dividedBy(K.lt_count).toNumber(),K.lt_rslt_stddev=L.math_Standard_Deviation_Longterm(K.lt_count,K.lt_rslt_sum,K.lt_rslt_square_sum_in_stddev_unit,K.lt_rslt_stddev.unit),K.processes[j.batch_test_id]={time_start:j.time_start,time_end:j.time_end,rslt_mean:j.rslt_mean,rslt_range:j.rslt_range}}applyProcessProductLimits(){j.product_currentUnit.prod_target=L.convertToTargetUnit(K.product.prod_target,L.EnumUnit.GRAM),j.product_currentUnit.prod_min2=L.convertToTargetUnit(K.product.prod_min2,L.EnumUnit.GRAM),j.product_currentUnit.prod_min1=L.convertToTargetUnit(K.product.prod_min1,L.EnumUnit.GRAM),j.product_currentUnit.prod_max1=L.convertToTargetUnit(K.product.prod_max1,L.EnumUnit.GRAM),j.product_currentUnit.prod_max2=L.convertToTargetUnit(K.product.prod_max2,L.EnumUnit.GRAM),
K.product.prod_type===h.EnumProductType.LIQUID&&(j.product_currentUnit.prod_target.value=P.bignumber(j.product_currentUnit.prod_target.value).times(j.density.value).toNumber(),j.product_currentUnit.prod_min2.value=P.bignumber(j.product_currentUnit.prod_min2.value).times(j.density.value).toNumber(),j.product_currentUnit.prod_min1.value=P.bignumber(j.product_currentUnit.prod_min1.value).times(j.density.value).toNumber(),j.product_currentUnit.prod_max1.value=P.bignumber(j.product_currentUnit.prod_max1.value).times(j.density.value).toNumber(),j.product_currentUnit.prod_max2.value=P.bignumber(j.product_currentUnit.prod_max2.value).times(j.density.value).toNumber()),j.product_currentUnit.prod_target=L.convertToTargetUnit(j.product_currentUnit.prod_target,this.Metrology.unit),j.product_currentUnit.prod_min2=L.convertToTargetUnit(j.product_currentUnit.prod_min2,this.Metrology.unit),j.product_currentUnit.prod_min1=L.convertToTargetUnit(j.product_currentUnit.prod_min1,this.Metrology.unit),
j.product_currentUnit.prod_max1=L.convertToTargetUnit(j.product_currentUnit.prod_max1,this.Metrology.unit),j.product_currentUnit.prod_max2=L.convertToTargetUnit(j.product_currentUnit.prod_max2,this.Metrology.unit),j.product_currentUnit.tare_target=L.convertToTargetUnit(K.product.tare_target,this.Metrology.unit),j.product_currentUnit.tare_min2=L.convertToTargetUnit(K.product.tare_min2,this.Metrology.unit),j.product_currentUnit.tare_min1=L.convertToTargetUnit(K.product.tare_min1,this.Metrology.unit),j.product_currentUnit.tare_max1=L.convertToTargetUnit(K.product.tare_max1,this.Metrology.unit),j.product_currentUnit.tare_max2=L.convertToTargetUnit(K.product.tare_max2,this.Metrology.unit),j.product_currentUnit.tare_plausibility=L.convertToTargetUnit(K.product.tare_plausibility,this.Metrology.unit),K.product.proc_tare_method===h.EnumTareMethod.TARE_MEAN&&(j.product_currentUnit.tare_target.value=P.bignumber(j.product_currentUnit.tare_target.value).times(j.samples.length).toNumber(),
j.product_currentUnit.tare_min2.value=P.bignumber(j.product_currentUnit.tare_min2.value).times(j.samples.length).toNumber(),j.product_currentUnit.tare_min1.value=P.bignumber(j.product_currentUnit.tare_min1.value).times(j.samples.length).toNumber(),j.product_currentUnit.tare_max1.value=P.bignumber(j.product_currentUnit.tare_max1.value).times(j.samples.length).toNumber(),j.product_currentUnit.tare_max2.value=P.bignumber(j.product_currentUnit.tare_max2.value).times(j.samples.length).toNumber(),j.product_currentUnit.tare_plausibility.value=P.bignumber(j.product_currentUnit.tare_plausibility.value).times(j.samples.length).toNumber()),j.product_currentUnit.prod_target.decimals=this.Metrology.decimals,j.product_currentUnit.prod_min2.decimals=this.Metrology.decimals,j.product_currentUnit.prod_min1.decimals=this.Metrology.decimals,j.product_currentUnit.prod_max1.decimals=this.Metrology.decimals,j.product_currentUnit.prod_max2.decimals=this.Metrology.decimals,
j.product_currentUnit.tare_target.decimals=this.Metrology.decimals,j.product_currentUnit.tare_min2.decimals=this.Metrology.decimals,j.product_currentUnit.tare_min1.decimals=this.Metrology.decimals,j.product_currentUnit.tare_max1.decimals=this.Metrology.decimals,j.product_currentUnit.tare_max2.decimals=this.Metrology.decimals}getXYbarsChartData(t,e,a,i){return{chartType:"bar",legend:!1,labels:e,datasets:[{data:t,label:""}],options:{responsive:!1,showLines:!1,animation:!1,legend:{display:!1},layout:{padding:{left:30,right:30,top:30,bottom:0}},tooltips:{mode:"nearest",intersect:!0,bodyFontFamily:"Roboto Bold",bodyFontSize:12,footerFontFamily:"Roboto Regular",footerFontSize:12,titleFontFamily:"Roboto Regular",titleFontSize:12,callbacks:{title:function(t){return void 0!==t&&void 0!==t[0]&&void 0!==t[0].index?this._chart.options.qappChartData.tooltipTitles[t[0].index]:""}}},scales:{xAxes:[{gridLines:{display:!1},scaleLabel:{display:!1},ticks:{fontFamily:"Roboto Regular",fontSize:14},
maxBarThickness:15}],yAxes:[{scaleLabel:{display:!1,labelString:i},gridLines:{drawBorder:!1,drawTicks:!1,lineWidth:2,color:"#e6e6e6"},ticks:{padding:10,fontFamily:"Roboto Regular",fontSize:14,min:0,minRotation:0,maxRotation:0,callback:function(t){return t+" "+this.chart.options.qappChartData.yAxisTicksUnit}}}]},qappChartData:{tooltipTitles:a,yAxisTicksUnit:i},qappPluginFunction:{}},colors:[{backgroundColor:I.EnumColors.YELLOW,borderColor:I.EnumColors.YELLOW}]}}reportTestProcess(){this.reportingProxy.clearPrintQueue();let t=A.l("_QAPP006_PRINTLABEL_TEST_REPORT_HEADER",[j.batch_test_id]);!0===this.isQuickTest&&(t=A.l("_QAPP006_PRINTLABEL_QUICKTEST_REPORT_HEADER",!0)),
this.report_enqueuePrintBlock(t,[this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_TIME_START"),M.getDateTime("frmt",this.DATETIME_CONFIGURATION,j.time_start,"iso")),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_TIME_END"),M.getDateTime("frmt",this.DATETIME_CONFIGURATION,j.time_end,"iso")),this.report_getTextParam(""," ")],!1);let e=[];!1===this.isQuickTest&&e.push(...this.getLIDprintParams(),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_TIME_START"),M.getDateTime("frmt",this.DATETIME_CONFIGURATION,K.time_start,"iso"))),
e.push(this.report_getStringParam("",A.l("_QAPP006_PRINTLABEL_PRODUCT_SETTINGS"),A.l("_QAPP006_PRINTLABEL_PRODUCT"),K.product.product_id),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_ARTICLE"),K.product.article_id),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_PRODUCT_TYPE"),A.l(h.EnumMapProductType[K.product.prod_type],!0)),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_PRODUCT_TARE_TYPE"),A.l(h.EnumMapTareType[K.product.proc_tare_type],!0)),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_PRODUCT_TEST_TYPE"),A.l(h.EnumMapProductTestType[K.product.prod_test_type],!0))),K.product.prod_type===h.EnumProductType.LIQUID&&e.push(this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_DENSITY"),j.density)),
e.push(this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TU2"),K.product.prod_min2),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TU1"),K.product.prod_min1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TARGET"),K.product.prod_target),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TO1"),K.product.prod_max1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TO2"),K.product.prod_max2)),K.product.proc_tare_type!==h.EnumTareType.NO_TARE&&(e.push(this.report_getStringParam("",A.l("_QAPP006_PRINTLABEL_TARE_SETTINGS"),A.l("_QAPP006_PRINTLABEL_METHOD"),A.l(h.EnumMapTareMethod[K.product.proc_tare_method],!0))),
K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&e.push(this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TU2"),K.product.tare_min2),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TU1"),K.product.tare_min1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TARGET"),K.product.tare_target),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TO1"),K.product.tare_max1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TO2"),K.product.tare_max2))),e.push(this.report_getTextParam(""," ")),this.report_enqueuePrintBlock(A.l("_QAPP006_PRINTLABEL_PROCESSDATA_HEADER"),e,!1);let a=A.l("_QAPP006_PRINTLABEL_SAMPLE_FILLING_HEADER",!0),i=!1;K.product.prod_print_tare===h.EnumProductPrint.ENABLED&&(a+=" ("+A.l("_QAPP006_PRINTLABEL_SAMPLE_TARE_HEADER",!0),i=!0),K.product.prod_print_wgt===h.EnumProductPrint.ENABLED&&(i?a+=", ":(a+=" (",i=!0),a+=A.l("_QAPP006_PRINTLABEL_SAMPLE_WEIGHT_HEADER",!0)),i&&(a+=")")
;let s=[this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_SAMPLE_COUNTER_HEADER"),a)],n=0;for(let t=0;t<j.samples.length;t++)if((K.product.proc_tare_type===h.EnumTareType.NO_TARE||j.samples[t].tare_properly_processed)&&j.samples[t].rslt_properly_processed){n++;let e="";e=L.formatQuantityParam(j.samples[t].rslt_filling)+A.l(h.EnumMapSampleResultStatus[j.samples[t].rslt_status],!0),i=!1,K.product.prod_print_tare===h.EnumProductPrint.ENABLED&&(e+=" ("+L.formatQuantityParam(j.samples[t].wgt_tare)+A.l(h.EnumMapSampleResultStatus[j.samples[t].tare_status],!0),i=!0),K.product.prod_print_wgt===h.EnumProductPrint.ENABLED&&(i?e+=", ":(e+=" (",i=!0),e+=L.formatQuantityParam(j.samples[t].wgt_filling)),i&&(e+=")"),s.push(this.report_getStringParam("","",(1e3+(t+1)).toFixed(0).substring(1),e))
}else j.samples[t].rslt_status===h.EnumSampleResultStatus.SKIPPED&&s.push(this.report_getStringParam("","",(1e3+(t+1)).toFixed(0).substring(1),A.l(h.EnumMapSampleResultStatus[j.samples[t].rslt_status],!0)));s.push(this.report_getTextParam(""," "));let r=[];if(!0===this.isQuickTest?r.push(this.report_getQuantityParam("",A.l("_QAPP006_PRINTLABEL_STATISTIC_CALCULATIONS"),A.l("_QAPP006_PRINTLABEL_STAT_MEAN"),j.rslt_mean)):r.push(this.report_getQuantityParam("",A.l("_QAPP006_PRINTLABEL_STATISTIC_CALCULATIONS"),A.l("_QAPP006_PRINTLABEL_STAT_MEAN_LT"),K.lt_rslt_mean),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_MEAN"),j.rslt_mean)),
r.push(this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_STDDEV"),j.rslt_stddev),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_MINIMUM"),j.rslt_minimum),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_MAXIMUM"),j.rslt_maximum),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_RANGE"),j.rslt_range),this.report_getQuantityParam("",A.l("_QAPP006_PRINTLABEL_STATISTIC_COUNTER"),A.l("_QAPP006_PRINTLABEL_STAT_COUNT"),n),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_TU2"),j.count_min2),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_TU1"),j.count_min1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_PASSED"),j.count_passed),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_TO1"),j.count_max1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_TO2"),j.count_max2),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_SKIPPED"),j.count_skipped),this.report_getTextParam(""," ")),
this.report_enqueuePrintBlock(A.l("_QAPP006_PRINTLABEL_PRODUCT_STATISTICS_HEADER"),r,!1),K.product.proc_tare_type!==h.EnumTareType.NO_TARE&&K.product.prod_print_tare===h.EnumProductPrint.ENABLED){let t=[this.report_getQuantityParam("",A.l("_QAPP006_PRINTLABEL_STATISTIC_CALCULATIONS"),A.l("_QAPP006_PRINTLABEL_STAT_MEAN"),j.wgt_tare_mean),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_STDDEV"),j.wgt_tare_stddev),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_MINIMUM"),j.wgt_tare_minimum),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_MAXIMUM"),j.wgt_tare_maximum),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_RANGE"),j.wgt_tare_range)]
;K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&t.push(this.report_getQuantityParam("",A.l("_QAPP006_PRINTLABEL_STATISTIC_COUNTER"),A.l("_QAPP006_PRINTLABEL_TARE_STAT_TU2"),j.wgt_tare_count_min2),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_STAT_TU1"),j.wgt_tare_count_min1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_PASSED"),j.wgt_tare_count_passed),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_STAT_TO1"),j.wgt_tare_count_max1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_STAT_TO2"),j.wgt_tare_count_max2)),t.push(this.report_getTextParam(""," ")),this.report_enqueuePrintBlock(A.l("_QAPP006_PRINTLABEL_TARE_STATISTICS_HEADER"),t,!1)}this.report_enqueuePrintBlock(A.l("_QAPP006_PRINTLABEL_SAMPLES_HEADER"),s,!1)}reportBatch(){this.reportingProxy.clearPrintQueue()
;let t=[...this.getLIDprintParams(),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_TIME_START"),M.getDateTime("frmt",this.DATETIME_CONFIGURATION,K.time_start,"iso"))];this.workflowState===H.result_finish_batch&&t.push(this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_TIME_END"),M.getDateTime("frmt",this.DATETIME_CONFIGURATION,K.time_end,"iso"))),
t.push(this.report_getStringParam("",A.l("_QAPP006_PRINTLABEL_PRODUCT_SETTINGS"),A.l("_QAPP006_PRINTLABEL_PRODUCT"),K.product.product_id),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_ARTICLE"),K.product.article_id),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_PRODUCT_TYPE"),A.l(h.EnumMapProductType[K.product.prod_type],!0)),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_PRODUCT_TARE_TYPE"),A.l(h.EnumMapTareType[K.product.proc_tare_type],!0)),this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_PRODUCT_TEST_TYPE"),A.l(h.EnumMapProductTestType[K.product.prod_test_type],!0)),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TU2"),K.product.prod_min2),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TU1"),K.product.prod_min1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TARGET"),K.product.prod_target),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TO1"),K.product.prod_max1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_PROD_TO2"),K.product.prod_max2)),
K.product.proc_tare_type!==h.EnumTareType.NO_TARE&&(t.push(this.report_getStringParam("",A.l("_QAPP006_PRINTLABEL_TARE_SETTINGS"),A.l("_QAPP006_PRINTLABEL_METHOD"),A.l(h.EnumMapTareMethod[K.product.proc_tare_method],!0))),K.product.use_tare_limits===h.EnumProductUseTareLmits.ENABLED&&t.push(this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TU2"),K.product.tare_min2),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TU1"),K.product.tare_min1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TARGET"),K.product.tare_target),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TO1"),K.product.tare_max1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_TARE_TO2"),K.product.tare_max2))),t.push(this.report_getTextParam(""," ")),this.report_enqueuePrintBlock(A.l("_QAPP006_PRINTLABEL_PROCESSDATA_HEADER"),t,!1),
this.report_enqueuePrintBlock(A.l("_QAPP006_PRINTLABEL_PRODUCT_STATISTICS_HEADER"),[this.report_getQuantityParam("",A.l("_QAPP006_PRINTLABEL_STATISTIC_CALCULATIONS"),A.l("_QAPP006_PRINTLABEL_STAT_MEAN"),K.lt_rslt_mean),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_STDDEV"),K.lt_rslt_stddev),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_MINIMUM"),K.lt_rslt_minimum),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_MAXIMUM"),K.lt_rslt_maximum),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_RANGE"),K.lt_rslt_range),this.report_getQuantityParam("",A.l("_QAPP006_PRINTLABEL_STATISTIC_COUNTER"),A.l("_QAPP006_PRINTLABEL_STAT_COUNT"),K.lt_count),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_TU2"),K.lt_count_min2),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_TU1"),K.lt_count_min1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_PASSED"),K.lt_count_passed),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_TO1"),K.lt_count_max1),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_TO2"),K.lt_count_max2),this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_SKIPPED"),K.lt_count_skipped),this.report_getTextParam(""," ")],!1)
;let e=[],a=p.sortKeys(K.processes);for(let t=0;t<a.length;t++)e.push(this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_SINGLE_TEST_HEADER"),a[t])),e.push(this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_TIME_START"),M.getDateTime("frmt",this.DATETIME_CONFIGURATION,K.processes[a[t]].time_start,"iso"))),e.push(this.report_getStringParam("","",A.l("_QAPP006_PRINTLABEL_TIME_END"),M.getDateTime("frmt",this.DATETIME_CONFIGURATION,K.processes[a[t]].time_end,"iso"))),e.push(this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_STAT_MEAN"),K.processes[a[t]].rslt_mean)),e.push(this.report_getQuantityParam("","",A.l("_QAPP006_PRINTLABEL_RANGE"),K.processes[a[t]].rslt_range)),e.push(this.report_getTextParam(""," "));this.report_enqueuePrintBlock(A.l("_QAPP006_PRINTLABEL_SINGLE_TESTS_HEADER"),e,!1)}__________________DB_METHODS__________________(){}DatabaseErrorMsg(t,e){this.hideMsgBox(),C.isObject(t)&&(t=R.inspect(t,!1,3)),
this.showMessageBox(_.EnumMessageboxType.WARNING,A.l("_QAPP006_HEADER_DB_GENERIC_ERROR"),C.isString(t)?t:A.l("_QAPP006_MESSAGE_DB_GENERIC_ERROR"),e),this.hideLoadingScreen()}loadProductList(){void 0!==this.dbConn&&this.dbConn.isConnected?this.dbConn.createQueryBuilder(B.ProductEntity,"alias").select(["alias.id","alias.product_id","alias.article_id","alias.valid_dataset","alias.prod_test_type","alias.proc_tare_type"]).orderBy("alias.product_id").getMany().then(t=>{if(C.isObject(t)){Y={};for(let e=0;e<t.length;e++)C.isString(t[e].product_id)&&""!==t[e].product_id&&(Y[t[e].product_id]=h.createProduct(t[e]));this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_product_list,success:!0,result:!0}))}else this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_product_list,success:!1,result:"Wrong format"}))}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_product_list,success:!1,result:t}))}):this.addToEventQueue(new N.ImmediateEvent({
topic:v,context:Q.load_product_list,success:!1,result:"Database not accessible"}))}storeProduct(t){if(void 0!==this.dbConn&&this.dbConn.isConnected){let e=new B.ProductEntity(t);this.dbConn.createQueryBuilder(B.ProductEntity,"alias").select(["alias.id","alias.product_id"]).where("alias.product_id = '"+t.product_id+"'").getOne().then(t=>{if(C.isObject(t)&&C.isNumber(t.id))e.id=t.id;else if(Object.keys(Y).length>=U)return void this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.store_product,success:!1,result:"Maximum number of products reached."}));this.dbConn.getRepository(B.ProductEntity).save(e).then(()=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.store_product,success:!0,result:!0}))}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.store_product,success:!1,result:t}))})}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.store_product,success:!1,result:t}))})}else this.addToEventQueue(new N.ImmediateEvent({
topic:v,context:Q.store_product,success:!1,result:"Database not accessible"}))}loadProduct(t){void 0!==this.dbConn&&this.dbConn.isConnected?this.dbConn.createQueryBuilder(B.ProductEntity,"alias").select(["alias.id","alias.product_id","alias.content"]).where("alias.product_id = '"+t+"'").getOne().then(t=>{if(C.isObject(t)&&C.isString(t.content)){let e=void 0;try{e=JSON.parse(t.content)}catch(t){return void this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_product,success:!1,result:t}))}return q=h.createProduct(e),h.verifyProduct(q),void this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_product,success:!0,result:!0}))}}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_product,success:!1,result:t}))}):this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_product,success:!1,result:"Database not accessible"}))}loadAllProducts(){
void 0!==this.dbConn&&this.dbConn.isConnected?this.dbConn.createQueryBuilder(B.ProductEntity,"alias").select(["alias.id","alias.product_id","alias.content"]).getMany().then(t=>{if(C.isObject(t)&&Array.isArray(t)){Y={};for(let e=0;e<t.length;e++)if(C.isObject(t[e])&&C.isString(t[e].content)){let a=void 0;try{a=JSON.parse(t[e].content)}catch(t){return void this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_all_products,success:!1,result:t}))}Y[t[e].product_id]=h.createProduct(a),h.verifyProduct(Y[t[e].product_id])}this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_all_products,success:!0,result:!0}))}else;}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_all_products,success:!1,result:t}))}):this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_all_products,success:!1,result:"Database not accessible"}))}removeProduct(t){if(void 0!==this.dbConn&&this.dbConn.isConnected){let e=new B.ProductEntity
;this.dbConn.createQueryBuilder(B.ProductEntity,"alias").select(["alias.id","alias.product_id"]).where("alias.product_id = '"+t+"'").getOne().then(t=>{C.isObject(t)&&C.isNumber(t.id)?(e.id=t.id,this.dbConn.getRepository(B.ProductEntity).remove(e).then(()=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_product,success:!0,result:!0}))}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_product,success:!1,result:t}))})):this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_product,success:!1,result:"Dataset not found in DB"}))}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_product,success:!1,result:t}))})}else this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_product,success:!1,result:"Database not accessible"}))}loadBatchList(){
void 0!==this.dbConn&&this.dbConn.isConnected?this.dbConn.createQueryBuilder(y.BatchEntity,"alias").select(["alias.id","alias.serial","alias.lot_id","alias.product_id","alias.time_start","alias.time_end","alias.valid_dataset"]).where("alias.serial = '"+this.SERIAL_NUMBER+"'").orderBy("alias.lot_id").getMany().then(t=>{if(C.isObject(t)){W={};for(let e=0;e<t.length;e++)C.isString(t[e].lot_id)&&""!==t[e].lot_id&&(W[t[e].lot_id]=h.createBatch(t[e]),W[t[e].lot_id].product.product_id=t[e].product_id);this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_batch_list,success:!0,result:!0}))}else this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_batch_list,success:!1,result:"Wrong format"}))}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_batch_list,success:!1,result:t}))}):this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_batch_list,success:!1,result:"Database not accessible"}))}storeBatch(t){
if(void 0!==this.dbConn&&this.dbConn.isConnected){let e=new y.BatchEntity(t);this.dbConn.createQueryBuilder(y.BatchEntity,"alias").select(["alias.id","alias.lot_id"]).where("alias.lot_id = '"+t.lot_id+"'").getOne().then(t=>{C.isObject(t)&&C.isNumber(t.id)&&(e.id=t.id),this.dbConn.getRepository(y.BatchEntity).save(e).then(()=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.store_batch,success:!0,result:!0}))}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.store_batch,success:!1,result:t}))})}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.store_batch,success:!1,result:t}))})}else this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.store_batch,success:!1,result:"Database not accessible"}))}loadBatch(t){void 0!==this.dbConn&&this.dbConn.isConnected?this.dbConn.createQueryBuilder(y.BatchEntity,"alias").select(["alias.id","alias.lot_id","alias.content"]).where("alias.lot_id = '"+t+"'").getOne().then(t=>{
if(C.isObject(t)&&C.isString(t.content)){let e=void 0;try{e=JSON.parse(t.content)}catch(t){return void this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_batch,success:!1,result:t}))}return K=h.createBatch(e),void this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_batch,success:!0,result:!0}))}}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_batch,success:!1,result:t}))}):this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.load_batch,success:!1,result:"Database not accessible"}))}removeBatch(t){if(void 0!==this.dbConn&&this.dbConn.isConnected){let e=new y.BatchEntity;this.dbConn.createQueryBuilder(y.BatchEntity,"alias").select(["alias.id","alias.lot_id"]).where("alias.lot_id = '"+t+"'").getOne().then(t=>{C.isObject(t)&&C.isNumber(t.id)?(e.id=t.id,this.dbConn.getRepository(y.BatchEntity).remove(e).then(()=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_batch,success:!0,result:!0}))}).catch(t=>{
this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_batch,success:!1,result:t}))})):this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_batch,success:!1,result:"Dataset not found in DB"}))}).catch(t=>{this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_batch,success:!1,result:t}))})}else this.addToEventQueue(new N.ImmediateEvent({topic:v,context:Q.remove_batch,success:!1,result:"Database not accessible"}))}}if(e.QAPP=J,__dirname.endsWith("workflow")){(new J).run()}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(13),s=a(116),n=a(2);e.CheckweighingCounterChart=class extends s.BaseChart{constructor(){super(...arguments),this.minMax={minTol:0,maxTol:8200},this.minMax2=void 0,this.minMax3=void 0,this.plausibility=void 0,this.labels={oop:{id:"_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_OOP_LABEL",args:[]},min3:{id:"_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MIN_3_LABEL",args:[]},min2:{
id:"_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MIN_2_LABEL",args:[]},min:{id:"_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MIN_1_LABEL",args:[]},ok:{id:"_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_OK_LABEL",args:[]},max:{id:"_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MAX_1_LABEL",args:[]},max2:{id:"_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MAX_2_LABEL",args:[]},max3:{id:"_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_MAX_3_LABEL",args:[]}},this.lastDataPointAdded=void 0}init(t,e){if(this.graphTab=t,this.initialized=!0,this.minMax=e.minMax,this.minMax2=e.minMax2,this.minMax3=e.minMax3,this.plausibility=e.plausibility,void 0!==e.labels)for(const t of Object.keys(e.labels))void 0!==e.labels[t]&&(this.labels[t]=e.labels[t]);if(i.assign(this.chartConfiguration,this.baseChartSetup()),void 0===this.minMax2)this.setEmptyDatasets(!1,!1,void 0!==this.plausibility),this.setDatasetColors(!1,!1,void 0!==this.plausibility);else if(void 0!==this.minMax2&&void 0===this.minMax3)this.setEmptyDatasets(!0,!1,void 0!==this.plausibility),
this.setDatasetColors(!0,!1,void 0!==this.plausibility);else{if(void 0===this.minMax2||void 0===this.minMax3)throw new Error("Chart initialization faulty!");this.setEmptyDatasets(!0,!0,void 0!==this.plausibility),this.setDatasetColors(!0,!0,void 0!==this.plausibility)}this.setupQAppChartData(),this.resetGraphTab()}addValue(t){if(!this.initialized)throw new Error("Chart object still not initialized.");{this.chartValues.push(t),this.updateLastDataPointAdded(t),this.canRemoveLastValue=!0,this.chartConfiguration.datasets[this.lastDataPointAdded.dataset].data[this.lastDataPointAdded.field]++;let e=parseFloat(this.chartConfiguration.labels[this.lastDataPointAdded.field]);e++,this.chartConfiguration.labels[this.lastDataPointAdded.field]=e.toString(),this.updateYAxesMax(),this.setLayoutOptionsAndSetTabData()}}updateLastDataPointAdded(t){if(void 0===this.minMax2&&void 0===this.plausibility)t<this.minMax.minTol?this.lastDataPointAdded={dataset:1,field:0
}:this.minMax.minTol<=t&&t<=this.minMax.maxTol?this.lastDataPointAdded={dataset:0,field:1}:this.lastDataPointAdded={dataset:1,field:2};else if(void 0===this.minMax2&&void 0!==this.plausibility){if("number"==typeof this.plausibility){if(t<this.plausibility)return this.lastDataPointAdded={dataset:2,field:0},!1}else if(void 0!==this.plausibility.lower&&t<this.plausibility.lower||void 0!==this.plausibility.upper&&this.plausibility.upper<t)return this.lastDataPointAdded={dataset:2,field:0},!1;t<this.minMax.minTol?this.lastDataPointAdded={dataset:1,field:1}:this.minMax.minTol<=t&&t<=this.minMax.maxTol?this.lastDataPointAdded={dataset:0,field:2}:this.lastDataPointAdded={dataset:1,field:3}}else if(void 0!==this.minMax2&&void 0===this.minMax3&&void 0===this.plausibility)t<this.minMax2.minTol?this.lastDataPointAdded={dataset:2,field:0}:this.minMax2.minTol<=t&&t<this.minMax.minTol?this.lastDataPointAdded={dataset:1,field:1}:this.minMax.minTol<=t&&t<=this.minMax.maxTol?this.lastDataPointAdded={
dataset:0,field:2}:this.minMax.maxTol<t&&t<=this.minMax2.maxTol?this.lastDataPointAdded={dataset:1,field:3}:this.lastDataPointAdded={dataset:2,field:4};else if(void 0!==this.minMax2&&void 0===this.minMax3&&void 0!==this.plausibility){if("number"==typeof this.plausibility){if(t<this.plausibility)return this.lastDataPointAdded={dataset:3,field:0},!1}else if(void 0!==this.plausibility.lower&&t<this.plausibility.lower||void 0!==this.plausibility.upper&&this.plausibility.upper<t)return this.lastDataPointAdded={dataset:3,field:0},!1;t<this.minMax2.minTol?this.lastDataPointAdded={dataset:2,field:1}:this.minMax2.minTol<=t&&t<this.minMax.minTol?this.lastDataPointAdded={dataset:1,field:2}:this.minMax.minTol<=t&&t<=this.minMax.maxTol?this.lastDataPointAdded={dataset:0,field:3}:this.minMax.maxTol<t&&t<=this.minMax2.maxTol?this.lastDataPointAdded={dataset:1,field:4}:this.lastDataPointAdded={dataset:2,field:5}
}else if(void 0!==this.minMax2&&void 0!==this.minMax3&&void 0===this.plausibility)t<this.minMax3.minTol?this.lastDataPointAdded={dataset:3,field:0}:this.minMax3.minTol<=t&&t<this.minMax2.minTol?this.lastDataPointAdded={dataset:2,field:1}:this.minMax2.minTol<=t&&t<this.minMax.minTol?this.lastDataPointAdded={dataset:1,field:2}:this.minMax.minTol<=t&&t<=this.minMax.maxTol?this.lastDataPointAdded={dataset:0,field:3}:this.minMax.maxTol<t&&t<=this.minMax2.maxTol?this.lastDataPointAdded={dataset:1,field:4}:this.minMax2.maxTol<t&&t<=this.minMax3.maxTol?this.lastDataPointAdded={dataset:2,field:5}:this.lastDataPointAdded={dataset:3,field:6};else if(void 0!==this.minMax2&&void 0!==this.minMax3&&void 0!==this.plausibility){if("number"==typeof this.plausibility){if(t<this.plausibility)return this.lastDataPointAdded={dataset:4,field:0},!1}else if(void 0!==this.plausibility.lower&&t<this.plausibility.lower||void 0!==this.plausibility.upper&&this.plausibility.upper<t)return this.lastDataPointAdded={
dataset:4,field:0},!1;t<this.minMax3.minTol?this.lastDataPointAdded={dataset:3,field:1}:this.minMax3.minTol<=t&&t<this.minMax2.minTol?this.lastDataPointAdded={dataset:2,field:2}:this.minMax2.minTol<=t&&t<this.minMax.minTol?this.lastDataPointAdded={dataset:1,field:3}:this.minMax.minTol<=t&&t<=this.minMax.maxTol?this.lastDataPointAdded={dataset:0,field:4}:this.minMax.maxTol<t&&t<=this.minMax2.maxTol?this.lastDataPointAdded={dataset:1,field:5}:this.minMax2.maxTol<t&&t<=this.minMax3.maxTol?this.lastDataPointAdded={dataset:2,field:6}:this.lastDataPointAdded={dataset:3,field:7}}return!0}removeLastValue(){if(!this.initialized)throw new Error("Chart object still not initialized.");if(this.canRemoveLastValue){this.chartValues.pop(),this.canRemoveLastValue=!1;let t=parseFloat(this.chartConfiguration.labels[this.lastDataPointAdded.field]);t--,this.chartConfiguration.labels[this.lastDataPointAdded.field]=t.toString(),
this.chartConfiguration.datasets[this.lastDataPointAdded.dataset].data[this.lastDataPointAdded.field]--,this.updateYAxesMax(),this.setLayoutOptionsAndSetTabData()}}recalculateChartData(){void 0===this.minMax2?(this.setEmptyDatasets(!1,!1,void 0!==this.plausibility),this.setDatasetColors(!1,!1,void 0!==this.plausibility)):void 0!==this.minMax2&&void 0===this.minMax3?(this.setEmptyDatasets(!0,!1,void 0!==this.plausibility),this.setDatasetColors(!0,!1,void 0!==this.plausibility)):void 0!==this.minMax2&&void 0!==this.minMax3&&(this.setEmptyDatasets(!0,!0,void 0!==this.plausibility),this.setDatasetColors(!0,!0,void 0!==this.plausibility)),this.setupQAppChartData(),this.calculateChartData(),this.addQAppPluginFunction(),this.updateYAxesMax(),this.setLayoutOptionsAndSetTabData()}setLayoutOptionsAndSetTabData(){if(i.isArray(this.graphTab)){if(void 0!==this.chartConfiguration.options&&void 0!==this.chartConfiguration.options.layout){let t=0
;void 0!==this.chartConfiguration.datasets&&void 0!==this.chartConfiguration.datasets[0]&&(t=this.chartConfiguration.datasets[0].data.length-3);let e=300-50*t;this.chartConfiguration.options.layout={padding:{left:e,right:e,top:50,bottom:0}}}this.graphTab.forEach(t=>{t.setData(this.chartConfiguration,!1),t.publish()})}else if(this.graphTab.hasOwnProperty("splittScreenTab")&&this.graphTab.hasOwnProperty("tabbedScreenTab")){let t=this.graphTab,e=i.cloneDeep(this.chartConfiguration),a=i.cloneDeep(this.chartConfiguration);if(e.options.layout={padding:{left:0,right:0,top:50,bottom:0}},void 0!==a.options&&void 0!==a.options.layout){let t=0;void 0!==a.datasets&&void 0!==a.datasets[0]&&(t=a.datasets[0].data.length-3);let e=300-50*t;a.options.layout={padding:{left:e,right:e,top:50,bottom:0}}}i.isArray(t.splittScreenTab)?t.splittScreenTab.forEach(t=>{t.setData(e,!1),t.publish()}):(t.splittScreenTab.setData(e,!1),t.splittScreenTab.publish()),
i.isArray(t.tabbedScreenTab)?t.tabbedScreenTab.forEach(t=>{t.setData(a,!1),t.publish()}):(t.tabbedScreenTab.setData(a,!1),t.tabbedScreenTab.publish())}else{if(void 0!==this.chartConfiguration.options&&void 0!==this.chartConfiguration.options.layout){let t=0;void 0!==this.chartConfiguration.datasets&&void 0!==this.chartConfiguration.datasets[0]&&(t=this.chartConfiguration.datasets[0].data.length-3);let e=300-50*t;this.chartConfiguration.options.layout={padding:{left:e,right:e,top:50,bottom:0}}}this.graphTab.setData(this.chartConfiguration,!1),this.graphTab.publish()}}updateYAxesMax(){let t=2;this.chartConfiguration.datasets.forEach(e=>{let a=i.max(e.data);t=(a=void 0!==a?a:0)>t?a:t}),i.has(this.chartConfiguration,"options.scales.yAxes[0].ticks")&&(this.chartConfiguration.options.scales.yAxes[0].ticks.max=t)}updateChartData(t,e=!0){if(!this.initialized)throw new Error("Chart object still not initialized.");{let a=!1
;(void 0===this.minMax2&&void 0!==t.minMax2||void 0!==this.minMax2&&void 0===t.minMax2)&&(a=!0),(void 0===this.minMax3&&void 0!==t.minMax3||void 0!==this.minMax3&&void 0===t.minMax3)&&(a=!0),(void 0===this.plausibility&&void 0!==t.plausibility||void 0!==this.plausibility&&void 0===t.plausibility)&&(a=!0),this.minMax=t.minMax,this.minMax2=t.minMax2,this.minMax3=t.minMax3,this.plausibility=t.plausibility,(e||a)&&(void 0===this.minMax2?(this.setEmptyDatasets(!1,!1,void 0!==this.plausibility),this.setDatasetColors(!1,!1,void 0!==this.plausibility)):void 0!==this.minMax2&&void 0===this.minMax3?(this.setEmptyDatasets(!0,!1,void 0!==this.plausibility),this.setDatasetColors(!0,!1,void 0!==this.plausibility)):void 0!==this.minMax2&&void 0!==this.minMax3&&(this.setEmptyDatasets(!0,!0,void 0!==this.plausibility),this.setDatasetColors(!0,!0,void 0!==this.plausibility)),this.setupQAppChartData(),this.recalculateChartData())}}calculateChartData(){
void 0===this.minMax2&&void 0===this.plausibility?this.fillDatasetsDataWithZeros(3):void 0===this.minMax2&&void 0!==this.plausibility?this.fillDatasetsDataWithZeros(4):void 0!==this.minMax2&&void 0===this.minMax3&&void 0===this.plausibility?this.fillDatasetsDataWithZeros(5):void 0!==this.minMax2&&void 0===this.minMax3&&void 0!==this.plausibility?this.fillDatasetsDataWithZeros(6):void 0!==this.minMax2&&void 0!==this.minMax3&&void 0===this.plausibility?this.fillDatasetsDataWithZeros(7):void 0!==this.minMax2&&void 0!==this.minMax3&&void 0!==this.plausibility&&this.fillDatasetsDataWithZeros(8),this.chartValues.forEach(t=>{this.updateLastDataPointAdded(t),this.chartConfiguration.datasets[this.lastDataPointAdded.dataset].data[this.lastDataPointAdded.field]++;let e=parseFloat(this.chartConfiguration.labels[this.lastDataPointAdded.field]);e++,this.chartConfiguration.labels[this.lastDataPointAdded.field]=e.toString()})}fillDatasetsDataWithZeros(t){this.chartConfiguration.datasets.forEach(e=>{
e.data=new Array(t).fill(0)})}setEmptyDatasets(t,e,a){let i={data:[],label:"_i18n{ id: '_QAPP_LIB_CHART_OCCURENCES_LABEL', args: [] }"};t||a?!t&&a?(this.chartConfiguration.datasets=[n.cloneJSON(i),n.cloneJSON(i),n.cloneJSON(i)],this.chartConfiguration.labels=["0","0","0","0"]):!t||e||a?t&&!e&&a?(this.chartConfiguration.datasets=[n.cloneJSON(i),n.cloneJSON(i),n.cloneJSON(i),n.cloneJSON(i)],this.chartConfiguration.labels=["0","0","0","0","0","0"]):t&&e&&!a?(this.chartConfiguration.datasets=[n.cloneJSON(i),n.cloneJSON(i),n.cloneJSON(i),n.cloneJSON(i)],this.chartConfiguration.labels=["0","0","0","0","0","0","0"]):t&&e&&a&&(this.chartConfiguration.datasets=[n.cloneJSON(i),n.cloneJSON(i),n.cloneJSON(i),n.cloneJSON(i),n.cloneJSON(i)],this.chartConfiguration.labels=["0","0","0","0","0","0","0","0"]):(this.chartConfiguration.datasets=[n.cloneJSON(i),n.cloneJSON(i),n.cloneJSON(i)],
this.chartConfiguration.labels=["0","0","0","0","0"]):(this.chartConfiguration.datasets=[n.cloneJSON(i),n.cloneJSON(i)],this.chartConfiguration.labels=["0","0","0"])}setDatasetColors(t,e,a){let i={backgroundColor:s.EnumColors.GREEN,borderColor:s.EnumColors.GREEN},n={backgroundColor:s.EnumColors.RED,borderColor:s.EnumColors.RED},r={backgroundColor:s.EnumColors.BLUE,borderColor:s.EnumColors.BLUE},o={backgroundColor:s.EnumColors.YELLOW,borderColor:s.EnumColors.YELLOW},_={backgroundColor:s.EnumColors.GREY,borderColor:s.EnumColors.GREY},E=[];t||a?!t&&a?E=[i,n,_]:!t||e||a?t&&!e&&a?E=[i,o,n,_]:t&&e&&!a?E=[i,r,o,n]:t&&e&&a&&(E=[i,r,o,n,_]):E=[i,o,n]:E=[i,n],this.chartConfiguration.colors=E}setupQAppChartData(){let t=[]
;void 0===this.minMax2&&void 0===this.plausibility?t=["_i18n{ id: '_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_LL_LABEL', args: []}",`_i18n{ id: '${this.labels.ok.id}', args: [${[...this.labels.ok.args]}]}`,"_i18n{ id: '_QAPP_LIB_CHART_CHECKWEIGHING_COUNTER_HH_LABEL', args: []}"]:void 0===this.minMax2&&void 0!==this.plausibility?t=[`_i18n{ id: '${this.labels.oop.id}', args: [${[...this.labels.oop.args]}]}`,`_i18n{ id: '${this.labels.min.id}', args: [${[...this.labels.min.args]}]}`,`_i18n{ id: '${this.labels.ok.id}', args: [${[...this.labels.ok.args]}]}`,`_i18n{ id: '${this.labels.max.id}', args: [${[...this.labels.max.args]}]}`]:void 0!==this.minMax2&&void 0===this.minMax3&&void 0===this.plausibility?t=[`_i18n{ id: '${this.labels.min2.id}', args: [${[...this.labels.min2.args]}]}`,`_i18n{ id: '${this.labels.min.id}', args: [${[...this.labels.min.args]}]}`,`_i18n{ id: '${this.labels.ok.id}', args: [${[...this.labels.ok.args]}]}`,`_i18n{ id: '${this.labels.max.id}', args: [${[...this.labels.max.args]}]}`,`_i18n{ id: '${this.labels.max2.id}', args: [${[...this.labels.max2.args]}]}`]:void 0!==this.minMax2&&void 0===this.minMax3&&void 0!==this.plausibility?t=[`_i18n{ id: '${this.labels.oop.id}', args: [${[...this.labels.oop.args]}]}`,`_i18n{ id: '${this.labels.min2.id}', args: [${[...this.labels.min2.args]}]}`,`_i18n{ id: '${this.labels.min.id}', args: [${[...this.labels.min.args]}]}`,`_i18n{ id: '${this.labels.ok.id}', args: [${[...this.labels.ok.args]}]}`,`_i18n{ id: '${this.labels.max.id}', args: [${[...this.labels.max.args]}]}`,`_i18n{ id: '${this.labels.max2.id}', args: [${[...this.labels.max2.args]}]}`]:void 0!==this.minMax2&&void 0!==this.minMax3&&void 0===this.plausibility?t=[`_i18n{ id: '${this.labels.min3.id}', args: [${[...this.labels.min3.args]}]}`,`_i18n{ id: '${this.labels.min2.id}', args: [${[...this.labels.min2.args]}]}`,`_i18n{ id: '${this.labels.min.id}', args: [${[...this.labels.min.args]}]}`,`_i18n{ id: '${this.labels.ok.id}', args: [${[...this.labels.ok.args]}]}`,`_i18n{ id: '${this.labels.max.id}', args: [${[...this.labels.max.args]}]}`,`_i18n{ id: '${this.labels.max2.id}', args: [${[...this.labels.max2.args]}]}`,`_i18n{ id: '${this.labels.max3.id}', args: [${[...this.labels.max3.args]}]}`]:void 0!==this.minMax2&&void 0!==this.minMax3&&void 0!==this.plausibility&&(t=[`_i18n{ id: '${this.labels.oop.id}', args: [${[...this.labels.oop.args]}]}`,`_i18n{ id: '${this.labels.min3.id}', args: [${[...this.labels.min3.args]}]}`,`_i18n{ id: '${this.labels.min2.id}', args: [${[...this.labels.min2.args]}]}`,`_i18n{ id: '${this.labels.min.id}', args: [${[...this.labels.min.args]}]}`,`_i18n{ id: '${this.labels.ok.id}', args: [${[...this.labels.ok.args]}]}`,`_i18n{ id: '${this.labels.max.id}', args: [${[...this.labels.max.args]}]}`,`_i18n{ id: '${this.labels.max2.id}', args: [${[...this.labels.max2.args]}]}`,`_i18n{ id: '${this.labels.max3.id}', args: [${[...this.labels.max3.args]}]}`]),
this.chartConfiguration.options.qappChartData.labels=t}overwriteDataDivision(t){if(!this.initialized)throw new Error("Chart object still not initialized.");{let e=[];void 0===this.minMax2&&void 0===this.minMax3&&void 0===this.plausibility?(e=[t.ltMin1,t.target,t.gtMax1],this.chartConfiguration.datasets[1].data[0]=e[0],this.chartConfiguration.datasets[0].data[1]=e[1],this.chartConfiguration.datasets[1].data[2]=e[2]):void 0===this.minMax2&&void 0===this.minMax3&&void 0!==this.plausibility?(e=void 0!==t.ltPlausible?[t.ltPlausible,t.ltMin1,t.target,t.gtMax1]:[0,t.ltMin1,t.target,t.gtMax1],this.chartConfiguration.datasets[2].data[0]=e[0],this.chartConfiguration.datasets[1].data[1]=e[1],this.chartConfiguration.datasets[0].data[2]=e[2],this.chartConfiguration.datasets[1].data[3]=e[3]):void 0!==this.minMax2&&void 0===this.minMax3&&void 0===this.plausibility?(e=void 0!==t.ltMin2&&void 0!==t.gtMax2?[t.ltMin2,t.ltMin1,t.target,t.gtMax1,t.gtMax2]:[0,t.ltMin1,t.target,t.gtMax1,0],
this.chartConfiguration.datasets[2].data[0]=e[0],this.chartConfiguration.datasets[1].data[1]=e[1],this.chartConfiguration.datasets[0].data[2]=e[2],this.chartConfiguration.datasets[1].data[3]=e[3],this.chartConfiguration.datasets[2].data[4]=e[4]):void 0!==this.minMax2&&void 0===this.minMax3&&void 0!==this.plausibility?(e=void 0!==t.ltMin2&&void 0!==t.gtMax2&&void 0!==t.ltPlausible?[t.ltPlausible,t.ltMin2,t.ltMin1,t.target,t.gtMax1,t.gtMax2]:[0,0,t.ltMin1,t.target,t.gtMax1,0],this.chartConfiguration.datasets[3].data[0]=e[0],this.chartConfiguration.datasets[2].data[1]=e[1],this.chartConfiguration.datasets[1].data[2]=e[2],this.chartConfiguration.datasets[0].data[3]=e[3],this.chartConfiguration.datasets[1].data[4]=e[4],
this.chartConfiguration.datasets[2].data[5]=e[5]):void 0!==this.minMax2&&void 0!==this.minMax3&&void 0===this.plausibility?(e=void 0!==t.ltMin2&&void 0!==t.gtMax2&&void 0!==t.ltMin3&&void 0!==t.gtMax3&&void 0===t.ltPlausible?[t.ltMin3,t.ltMin2,t.ltMin1,t.target,t.gtMax1,t.gtMax2,t.gtMax3]:[0,0,t.ltMin1,t.target,t.gtMax1,0,0],this.chartConfiguration.datasets[3].data[0]=e[0],this.chartConfiguration.datasets[2].data[1]=e[1],this.chartConfiguration.datasets[1].data[2]=e[2],this.chartConfiguration.datasets[0].data[3]=e[3],this.chartConfiguration.datasets[1].data[4]=e[4],this.chartConfiguration.datasets[2].data[5]=e[5],this.chartConfiguration.datasets[3].data[6]=e[6]):void 0!==this.minMax2&&void 0!==this.minMax3&&void 0!==this.plausibility&&(e=void 0!==t.ltMin2&&void 0!==t.gtMax2&&void 0!==t.ltMin3&&void 0!==t.gtMax3&&void 0!==t.ltPlausible?[t.ltPlausible,t.ltMin3,t.ltMin2,t.ltMin1,t.target,t.gtMax1,t.gtMax2,t.gtMax3]:[0,0,0,t.ltMin1,t.target,t.gtMax1,0,0],
this.chartConfiguration.datasets[4].data[0]=e[0],this.chartConfiguration.datasets[3].data[1]=e[1],this.chartConfiguration.datasets[2].data[2]=e[2],this.chartConfiguration.datasets[1].data[3]=e[3],this.chartConfiguration.datasets[0].data[4]=e[4],this.chartConfiguration.datasets[1].data[5]=e[5],this.chartConfiguration.datasets[2].data[6]=e[6],this.chartConfiguration.datasets[3].data[7]=e[7]),this.chartConfiguration.labels=e.map(t=>t.toString()),this.updateYAxesMax(),this.setLayoutOptionsAndSetTabData()}}baseChartSetup(){return{chartType:"bar",datasets:[],labels:[],options:{responsive:!1,showLines:!1,animation:!1,legend:{display:!1},layout:{padding:{left:300,right:300,top:50,bottom:0}},tooltips:{mode:"nearest",intersect:!0,bodyFontFamily:"Roboto Bold",bodyFontSize:12,footerFontFamily:"Roboto Regular",footerFontSize:12,titleFontFamily:"Roboto Regular",titleFontSize:12,callbacks:{title:function(t,e){return""}}},scales:{xAxes:[{stacked:!0,maxBarThickness:50,gridLines:{display:!1,
drawBorder:!1},scaleLabel:{display:!1},ticks:{fontFamily:"Roboto Regular",fontSize:14}}],yAxes:[{scaleLabel:{display:!1},gridLines:{display:!1,drawBorder:!1},ticks:{display:!1,max:0,min:0}}]},qappChartData:{},qappPluginFunction:{}},colors:[]}}addQAppPluginFunction(){this.chartConfiguration.options.qappPluginFunction={beforeDatasetsDraw:function(t){let e=t[0],a=e.chart.ctx,i=e.options.qappChartData,s=e.scales["y-axis-0"],n=e.scales["x-axis-0"],r=n.getPixelForTick(1)-n.getPixelForTick(0)-3,o=e.options.layout.padding.top,_=function(t,e){let i=[];return t.forEach(t=>{i.push(function(t,e){a.save(),a.font=e;let i=a.measureText(t);return a.restore(),i.width}(t,e))}),i.reduce((t,e)=>t>e?t:e)}(i.labels,"14px Roboto Regular");a.save();let E=function(t,e,a){let i,s,n=0,r=t;for(;r>e&&n<90;){let e=l(n);if(i=Math.cos(e),(s=Math.sin(e))*t>a){n--;break}n++,r=i*t}return l(-n)}(_,r,o);function l(t){return t*(Math.PI/180)}i.labels.forEach((t,e)=>{!function(t,e,i,s){a.save(),a.fillStyle="#666666",
a.font="14px Roboto Regular",a.textBaseline="middle",a.textAlign=0===s?"center":"left",a.translate(0===s?e:e-r/2+3,i),a.rotate(s),a.fillText(t.replace(/&#(\d+);/g,function(t,e){return a.font="14px Roboto Bold",String.fromCharCode(e)}),0,0),a.restore()}(t,n.getPixelForTick(e),s.top-15,E)}),a.restore()}}}}},function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const i=a(9),s=a(15),n=a(8),r=a(7),o=a(11),_=a(17),E=a(16),l=a(69),u=a(68),c=a(41);function T(t,e){return i.__awaiter(this,void 0,void 0,function*(){const a=[l.DB_TABLE_NAME_PRODUCTS,u.DB_TABLE_NAME_BATCHES];let n=p();const o=yield function(t,e){return i.__awaiter(this,void 0,void 0,function*(){return new Promise(function(a,i){t.getTables(e).then(t=>{const i=t;let s=[];try{for(let a=0;a<i.length;a++)if(r.isString(i[a].name)){const i=t[a].name.split(".");e.includes(i[i.length-1])&&s.push(i[i.length-1])}}catch(t){}a(s)}).catch(t=>{console.log("Get table list failed"),s.dbg(t),a([])})})})}(e,a)
;if(o.includes(u.DB_TABLE_NAME_BATCHES))console.log("Expected table '"+u.DB_TABLE_NAME_BATCHES+"' already exists!");else{console.log("Expected table '"+u.DB_TABLE_NAME_BATCHES+"' does not exist - create a new table.");const a=E.Table.create(t.getRepository(u.BatchEntity).metadata,t.driver),i=yield d(e,a);console.log(" => table creation successfull? => "+i.toString()),!0===i?(n.BatchEntity.status=c.EMigrationResult.MIGRATION_DONE,n.BatchEntity.message="Successfully created table '"+u.DB_TABLE_NAME_BATCHES+"'"):(n.BatchEntity.status=c.EMigrationResult.MIGRATION_FAILED,n.BatchEntity.message="Failed creating table '"+u.DB_TABLE_NAME_BATCHES+"'")}if(o.includes(l.DB_TABLE_NAME_PRODUCTS))console.log("Expected table '"+l.DB_TABLE_NAME_PRODUCTS+"' already exists!");else{console.log("Expected table '"+l.DB_TABLE_NAME_PRODUCTS+"' does not exist - create a new table.");const a=E.Table.create(t.getRepository(l.ProductEntity).metadata,t.driver),i=yield d(e,a)
;console.log(" => table creation successfull? => "+i.toString()),!0===i?(n.ProductEntity.status=c.EMigrationResult.MIGRATION_DONE,n.ProductEntity.message="Successfully created table '"+l.DB_TABLE_NAME_PRODUCTS+"'"):(n.ProductEntity.status=c.EMigrationResult.MIGRATION_FAILED,n.ProductEntity.message="Failed creating table '"+l.DB_TABLE_NAME_PRODUCTS+"'")}return n})}function d(t,e){return i.__awaiter(this,void 0,void 0,function*(){return new Promise(function(a,i){t.createTable(e,!0,!1,!0).then(t=>{a(!0)}).catch(t=>{console.log("Table creation failed for '"+e+"'"),s.dbg(t),a(!1)})})})}function p(){return{ProductEntity:{tableName:l.DB_TABLE_NAME_PRODUCTS,status:c.EMigrationResult.MIGRATION_NOT_NEEDED,message:""},BatchEntity:{tableName:u.DB_TABLE_NAME_BATCHES,status:c.EMigrationResult.MIGRATION_NOT_NEEDED,message:""}}}e.DATABASE_ACTION_DONE_EVENT="/QAPP/DATABASE_ACTION_DONE",e.TIMEOUT_DATABASE_REQUEST=4e4,e.parseDatabaseEvent=function(t){
if(r.isObject(t)&&r.isString(t.type))if(t.type===n.SIMPLE_EVENT){if(r.isObject(t.payload)&&r.isString(t.payload.topic)&&t.payload.topic==e.DATABASE_ACTION_DONE_EVENT){const e=t.payload;return{isHandled:!0,success:e.success,context:e.context,result:e.result}}}else if(t.type===n.QAPP_TIMER_EVENT&&r.isObject(t.payload)&&r.isString(t.payload.topic)&&t.payload.topic==e.DATABASE_ACTION_DONE_EVENT){const e=t.payload;return{isHandled:!0,success:e.success,context:e.context,result:e.result}}return{isHandled:!1,success:!1,context:"",result:""}},e.DatabaseErrorMsg=function(t,e,a){t.hideMsgBox(),r.isObject(e)&&(e=_.inspect(e,!1,3)),t.showMessageBox(o.EnumMessageboxType.WARNING,t.l("_QAPP006_HEADER_DB_GENERIC_ERROR"),r.isString(e)?e:t.l("_QAPP006_MESSAGE_DB_GENERIC_ERROR"),a),t.hideLoadingScreen()},e.databaseMigration=function(t,a){t.showLoadingScreen({id:t.l("_QAPP006_INFO_DB_QUERY_READ"),args:["Tables (Migration)"]}),
void 0!==t.dbConn&&t.dbConn.isConnected?(t.fsmTimers[e.DATABASE_ACTION_DONE_EVENT+"Migration"]=t.addTimer(e.TIMEOUT_DATABASE_REQUEST,{topic:e.DATABASE_ACTION_DONE_EVENT,context:a,success:!1,result:"Unexpected base timeout triggered after "+e.TIMEOUT_DATABASE_REQUEST.toFixed(0)+"ms."}),T(t.dbConn,t.dbConn.createQueryRunner()).then(i=>{t.cancelTimer(t.fsmTimers[e.DATABASE_ACTION_DONE_EVENT+"Migration"]),t.addToEventQueue(new n.SimpleEvent({topic:e.DATABASE_ACTION_DONE_EVENT,context:a,success:!0,result:i}))}).catch(i=>{t.cancelTimer(t.fsmTimers[e.DATABASE_ACTION_DONE_EVENT+"Migration"]),t.addToEventQueue(new n.SimpleEvent({topic:e.DATABASE_ACTION_DONE_EVENT,context:a,success:!1,result:i}))})):t.addToEventQueue(new n.SimpleEvent({topic:e.DATABASE_ACTION_DONE_EVENT,context:a,success:!1,result:"Database not accessible"}))},e.migrateTables=T,e.createDatabaseMigration=p}]);