            showWarning: function (message) {
                return growl.warning(sanitize(message), config);
            },

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.


            showSuccess: function (message) {
                return growl.success(sanitize(message), config);
            },


        var sanitize = function(message) {
            var sanitized = $sanitize(message);
            return sanitized.split(' ').map(function(part) {
                return encodeURIComponent(part);
            }).join(' ');
        };


            showError : function (message) {
                return growl.error(sanitize(message), config);
            }


            showInfo : function (message) {
                return growl.info(sanitize(message), config);
            },


    const escape = (unsafe) => {
      return unsafe.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", ''');
    }

Improper Control of Generation of Code ('Code Injection')

The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.


success: function (message) {
        input.replaceWith('' + escape(input.val().replace(/\//g, '/')) + '');
        $('span[data-tag-id="' + id + '"]');
        $('#pmf-admin-saving-data-indicator').html(message);
      },


  const escape = (unsafe) => {
    return unsafe.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", ''');
  }


            var updateSerpPreview = function () {

                var metaPanel = this.layout.getComponent("metaDataPanel");
                var title = htmlspecialchars(metaPanel.getComponent("title").getValue());
                var description = htmlspecialchars(metaPanel.getComponent("description").getValue());

                var truncate = function( text, n ){
                    if (text.length <= n) { return text; }
                    var subString = text.substr(0, n-1);
                    return subString.substr(0, subString.lastIndexOf(' ')) + " ...";
                };

                if(!title) {
                    metaPanel.getComponent("serpPreview").hide();
                    return false;
                }

                if(metaPanel.getEl().getWidth() > 1350) {
                    metaPanel.getComponent("serpPreview").show();
                }

                var desktopTitleEl = Ext.get(metaPanel.getComponent("serpPreview").getEl().selectNode(".desktop .title"));
                var stringParts = title.split(" ");
                desktopTitleEl.setHtml(title);
                while(desktopTitleEl.getWidth() >= 600) {
                    stringParts.splice(-1,1);
                    tmpString = stringParts.join(" ") + " ...";
                    desktopTitleEl.setHtml(tmpString);
                }

                var desktopDescrEl = metaPanel.getComponent("serpPreview").getEl().selectNode(".desktop .description");
                Ext.fly(desktopDescrEl).setHtml(truncate(description, 160));

                var mobileTitleEl = metaPanel.getComponent("serpPreview").getEl().selectNode(".mobile .title");
                Ext.fly(mobileTitleEl).setHtml(truncate(title, 78));

                var mobileDescrEl = metaPanel.getComponent("serpPreview").getEl().selectNode(".mobile .description");
                Ext.fly(mobileDescrEl).setHtml(truncate(description, 130));

                return true;
            }.bind(this);


                    handler: function () {
                        pimcore.helpers.uploadDialog(
                            Routing.generate('pimcore_admin_user_uploadcurrentuserimage', {id: this.currentUser.id}),
                            null,
                            function () {
                                Ext.getCmp("pimcore_profile_delete_image_" + this.currentUser.id).setVisible(true);
                                pimcore.helpers.reloadUserImage(this.currentUser.id);
                                this.currentUser.hasImage = true;
                            }.bind(this),
                            function () {
                                Ext.MessageBox.alert(t('error'), t("unsupported_filetype"));
                            }.bind(this)
                        );
                    }.bind(this)

Unrestricted Upload of File with Dangerous Type

The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment.


                    handler: function () {
                        pimcore.helpers.uploadDialog(
                            Routing.generate('pimcore_admin_user_uploadimage', {id: this.currentUser.id}),
                            null,
                            function () {
                                Ext.getCmp("pimcore_user_delete_image_" + this.currentUser.id).setVisible(true);
                                pimcore.helpers.reloadUserImage(this.currentUser.id);
                                this.currentUser.hasImage = true;
                            }.bind(this),
                            function () {
                                Ext.MessageBox.alert(t('error'), t("unsupported_filetype"));
                            }.bind(this)
                        );
                    }.bind(this)


            validator: function(value) {
                if (value) {
                    if (!value.startsWith('/') || value.length < 2) {
                        return false;

                    }
                    value = value.substring(1);
                    value = value.replace(/\/$/, "");

                    var parts = value.split('/');
                    for (let i = 0; i < parts.length; i++) {
                        let part = parts[i];
                        if  (part.length == 0) {
                            return false;
                        }

                        sanitizedPart = part.replace(/[#\?\*\:\\\\<\>\|"%&@=;]/g, '-');
                        if (sanitizedPart != part) {
                            return t('url-slug-invalid-chars');
                        }
                    }
                }

                return true;

            }


                            validator: function (value) {
                                if(value !== value.replace(/[^a-zA-Z0-9_\-@.]/g,'')){
                                    this.setValue(value.replace(/[^a-zA-Z0-9_\-@.]/g,''));
                                }

                                return true;
                            }


pimcore.helpers.sanitizeEmail = function (email) {
    return email.replace(/[^a-zA-Z0-9_\-@.+]/g,'');
};


    onAdd:function (btn, ev) {
        Ext.MessageBox.prompt("", t("email_address"), function (button, value) {
            if(button == "ok") {
                const sanitizedEmail = pimcore.helpers.sanitizeEmail(value);

                var u = {
                    "address": sanitizedEmail
                };

                this.grid.store.insert(0, u);
            }

        }.bind(this));
    }


                        handler:function (grid, rowIndex) {
                            let data = grid.getStore().getAt(rowIndex);
                            const sanitizedEmail = pimcore.helpers.sanitizeEmail(data.data.address);

                            pimcore.helpers.deleteConfirm(
                                t('email_blacklist'),
                                sanitizedEmail,
                                function () {
                                    grid.getStore().removeAt(rowIndex);
                                }.bind(this)
                            );
                        }.bind(this)


                    onChange: function(value) {
                        if(Ext.String.hasHtmlCharacters(value)) {
                            this.reset();
                        }
                    },


                    handler: function (grid, rowIndex) {
                        let data = grid.getStore().getAt(rowIndex);
                        pimcore.helpers.deleteConfirm(t('document_type'),
                            Ext.util.Format.htmlEncode(data.data.name),
                            function () {
                                grid.getStore().removeAt(rowIndex);
                        }.bind(this));
                    }.bind(this)


                {text: t("time"), width: 100, sortable: true, dataIndex: 'time', editor: new Ext.form.TimeField({
                        format: "H:i",
                        listeners: {
                            focus : function(component) {
                                component.setValue(Ext.util.Format.htmlDecode(component.value));
                            },


                            blur: function(component){
                                component.setValue(Ext.util.Format.htmlEncode(component.value));
                            }


                {text: t("time"), width: 100, sortable: true, dataIndex: 'time', editor: new Ext.form.TimeField({
                        format: "H:i",
                        listeners: {
                            focus : function(component) {
                                component.setValue(Ext.util.Format.htmlDecode(component.value));
                            },
                            blur: function(component){
                                component.setValue(Ext.util.Format.htmlEncode(component.value));
                            }
                        }
                    })


                                    "change": function (el) {
                                        const sanitizedValue = pimcore.helpers.sanitizeUrlSlug(el.getValue());
                                        el.setValue(sanitizedValue);
                                    }.bind(this)


                                                path: pimcore.helpers.sanitizeUrlSlug(el.getValue())
                                            },
                                            success: function (res) {
                                                res = Ext.decode(res.responseText);
                                                if(!res.success) {
                                                    el.getEl().addCls("pimcore_error_input");
                                                    if (res.message) {
                                                        Ext.MessageBox.alert(t("info"), res.message);
                                                    }
                                                } else {
                                                    el.getEl().removeCls("pimcore_error_input");
                                                }
                                            }
                                        });


pimcore.helpers.sanitizeUrlSlug = function (slug) {
    return slug.replace(/[^a-z0-9-_+/]/gi, '');
};


            validator: function (value) {
                if(value !== value.replace(/[^a-za-z0-9_\-+]/g,'')){
                    this.setvalue(value.replace(/[^a-za-z0-9_\-+]/g,''));
                }

                return true;
            }


            onNodeDrop : this.onNodeDrop.bind(this)
        });

        var eConfig = {};

        eConfig.toolbarGroups = [
            {name: 'basicstyles', groups: ['undo', 'find', 'basicstyles', 'list']},
            '/',
            {name: 'paragraph', groups: ['align', 'indent']},
            {name: 'blocks'},
            {name: 'links'},
            {name: 'insert'},
            '/',
            {name: 'styles'},
            {name: 'tools', groups: ['colors', 'tools', 'cleanup', 'mode', 'others']}
        ];

        //prevent override important settings!
        eConfig.resize_enabled = false;
        eConfig.enterMode = CKEDITOR.ENTER_BR;
        eConfig.entities = false;
        eConfig.entities_greek = false;
        eConfig.entities_latin = false;
        eConfig.extraAllowedContent = "*[pimcore_type,pimcore_id]";
        eConfig.baseFloatZIndex = 40000;   // prevent that the editor gets displayed behind the grid cell editor window

        if (eConfig.hasOwnProperty('removePlugins')) {
            eConfig.removePlugins += ",tableresize";
        }
        else {
            eConfig.removePlugins = "tableresize";
        }

        try {
            this.ckeditor = CKEDITOR.inline(this.editableDivId, eConfig);
            this.ckeditor.setData(this.field.getValue());

            // disable URL field in image dialog
            this.ckeditor.on("dialogShow", function (e) {
                var urlField = e.data.getElement().findOne("input");
                if (urlField && urlField.getValue()) {
                    if (urlField.getValue().indexOf("/image-thumbnails/") > 1) {
                        urlField.getParent().getParent().getParent().hide();
                    }
                } else if (urlField) {
                    urlField.getParent().getParent().getParent().show();
                }
            });
        } catch (e) {
            console.log(e);
        }
    },


                    handler: function (grid, rowIndex) {
                        let data = grid.getStore().getAt(rowIndex);
                        pimcore.helpers.deleteConfirm(t('predefined_metadata'),
                            Ext.util.Format.htmlEncode(data.data.name),
                            function () {
                            grid.getStore().removeAt(rowIndex);
                        }.bind(this));
                    }.bind(this)


                    handler: function (grid, rowIndex) {
                        let data = grid.getStore().getAt(rowIndex);
                        pimcore.helpers.deleteConfirm(t('predefined_properties'),
                            Ext.util.Format.htmlEncode(data.data.name),
                            function () {
                            grid.getStore().removeAt(rowIndex);
                        }.bind(this));
                    }.bind(this)


    onDelete: function () {
        var selections = this.grid.getSelectionModel().getSelected();
        if (!selections || selections.length < 1) {
            return false;
        }
        var rec = selections.getAt(0);
        this.grid.store.remove(rec);
    },


    sanitizeTextColumn: function (textField) {
        if(textField.getValue()){
            const sanitizedValue = textField.getValue().replace(/[<>"'!?/\\&%$();]/gi, '');
            textField.setValue(sanitizedValue);
        }
    }


                change: function (defaultDateField, newValue, oldValue) {
                    if(typeof this.getValue() != 'object') {
                        this.setValue(null);
                    }
                }


    setDefaultValue:function (defaultValue, datefield, timefield) {
        if(datefield.getValue() && typeof datefield.getValue() === 'object') {
            var dateString = Ext.Date.format(datefield.getValue(), "Y-m-d");

            if (timefield.getValue()) {
                dateString += " " + Ext.Date.format(timefield.getValue(), "H:i");
            } else {
                dateString += " 00:00";
            }

            defaultValue.setValue((Ext.Date.parseDate(dateString, "Y-m-d H:i").getTime()) / 1000);
        } else {
            datefield.setValue(null);
            defaultValue.setValue(null);
        }
    },


getLinkContent: function () {

        let text = "[" + t("not_set") + "]";
        if (this.data.text) {
            text = this.data.text;
        } else if (this.data.path) {
            text = this.data.path;
        }
        if (this.data.path || this.data.anchor || this.data.parameters) {
            let fullpath = this.data.path + (this.data.parameters ? '?' + Ext.util.Format.htmlEncode(this.data.parameters) : '') + (this.data.anchor ? '#' + Ext.util.Format.htmlEncode(this.data.anchor) : '');
            let displayHtml = Ext.util.Format.htmlEncode(text);

            if (this.config.textPrefix !== undefined) {
                displayHtml = this.config.textPrefix + displayHtml;
            }
            if (this.config.textSuffix !== undefined) {
                displayHtml += this.config.textSuffix;
            }

            return '' + displayHtml + '';
        }
        return text;
    },


pimcore.helpers.getStringWithoutControlChars = function (text) {
    return text.replace(/[<>"'`!?/\\%$(){};,:|=]/gi, '');
};


Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.


pimcore.helpers.htmlEncodeTextField = function (textField) {
    if(textField.getValue()) {
        textField.suspendEvent('change');
        const decodedValue = Ext.util.Format.htmlDecode(textField.getValue());
        textField.setValue(
            Ext.util.Format.htmlEncode(decodedValue)
        );
        textField.resumeEvent('change');
    }
};


                    handler: function (grid, rowIndex) {
                        var data = grid.getStore().getAt(rowIndex);
                        if (!data.data.writeable) {
                            return;
                        }

                        const decodedName = Ext.util.Format.htmlDecode(data.data.name);

                        pimcore.helpers.deleteConfirm(
                            t('staticroute'),
                            Ext.util.Format.htmlEncode(decodedName),
                            function () {
                                grid.getStore().removeAt(rowIndex);
                            }.bind(this)
                        );
                    }.bind(this)


                    handler: function (grid, rowIndex) {
                        let data = grid.getStore().getAt(rowIndex);
                        const decodedName = Ext.util.Format.htmlDecode(data.data.name);

                        pimcore.helpers.deleteConfirm(
                            t('predefined_properties'),
                            Ext.util.Format.htmlEncode(decodedName),
                            function () {
                                grid.getStore().removeAt(rowIndex);
                            }.bind(this)
                        );
                    }.bind(this)


                    success: function () {
                        this.refresh(this.tree.getRootNode());
                    }.bind(this)


                    }.bind(this)
                });
        }.bind(this));


                    url: Routing.generate('pimcore_ecommerceframework_pricing_delete'),
                    method: 'DELETE',
                    params: {
                        id: record.id
                    },
                    success: function () {
                        this.refresh(this.tree.getRootNode());
                    }.bind(this)
                });
        }.bind(this));

    },


getNodeLabel: function (configAttributes) {
            var nodeLabel = configAttributes.label ? configAttributes.label : this.getDefaultText();
            if (configAttributes.attribute) {
                var attr = configAttributes.attribute;
                if (configAttributes.param1) {
                    attr += " " + configAttributes.param1;
                }
                nodeLabel += ' (' + Ext.util.Format.htmlEncode(attr) + ')';
            }

            return nodeLabel;
        }


getEditor: function() { return new Ext.form.TextField({ listeners: {'change': pimcore.helpers.htmlEncodeTextField } }); }


                    renderer: function (value) {
                        return Ext.util.Format.htmlEncode(value);
                    }


getLinkContent: function () {

        let text = "[" + t("not_set") + "]";
        if (this.data.text) {
            text = this.data.text;
        } else if (this.data.path) {
            text = this.data.path;
        }
        let displayHtml = Ext.util.Format.htmlEncode(text);
        if (this.data.path || this.data.anchor || this.data.parameters) {
            let fullpath = this.data.path + (this.data.parameters ? '?' + Ext.util.Format.htmlEncode(this.data.parameters) : '') + (this.data.anchor ? '#' + Ext.util.Format.htmlEncode(this.data.anchor) : '');

            if (this.config.textPrefix !== undefined) {
                displayHtml = this.config.textPrefix + displayHtml;
            }
            if (this.config.textSuffix !== undefined) {
                displayHtml += this.config.textSuffix;
            }

            return '' + displayHtml + '';
        }
        return displayHtml;
    },


question: function() { return htmlEncode(this.$element.attr('title')); },


function toggleWriteability(id_of_patient, checked) {
    document.getElementById(id_of_patient).disabled = checked;
}


function test(input) {
    var count = 0;
    var oldInput, newInput;
    testContainer.innerHTML = "<img />";
    testImage().setAttribute("alt", input);
    print("------");
    print("Test input: " + input);
    do {
        oldInput = testImage().getAttribute("alt");
        var intermediate = testContainer.innerHTML;
        print("Render: " + intermediate);
        testContainer.innerHTML = intermediate;
        if (testImage() == null) {
            print("Image disappeared...");
            break;
        }
        newInput = testImage().getAttribute("alt");
        print("New value: " + newInput);
        count++;
    } while (count < 5 && newInput != oldInput);
    if (count == 5) {
        print("Failed to achieve fixpoint");
    }
    testContainer.innerHTML = "";
}


function print(s) {
    out.value += s + "\n";
}


function testImage() {
    return testContainer.firstChild;
}


  getProductReturnDetails: function({product_id, customer_id}, returnData) {

    $.ajax({
      url: full_website_address + "/info/?module=data&page=productDetailsForReturn&product_id=" + product_id+"&customer_id="+customer_id,
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function (data, status) {
        returnData(data);
      }
    });

  },

Inclusion of Functionality from Untrusted Control Sphere

The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.


The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.


    getDateTime: function() {
        var date = new Date();
        return date.getFullYear() + "-" + date.getMonth() + "-" + date.getDay() + "-" + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
    },


    dateRangePicker: function({selector=".dateRangePicker", format="YYYY-MM-DD", timePicker= false}="") {

        $(selector).daterangepicker({
            autoUpdateInput: false,
            showDropdowns: true,
            drops: "auto",
            linkedCalendars: false,
            timePicker: timePicker,
            timePicker24Hour: true,
            parentEl: "div.dynamic-container",
            locale: {
                format: format,
                cancelLabel: 'Clear'
            }
        });

        // Apply the date
        $(selector).on('apply.daterangepicker', function(ev, picker) {

            $(this).val(picker.startDate.format(format) + ' - ' + picker.endDate.format(format));

        });

        // clear the date
        $(selector).on('cancel.daterangepicker', function(ev, picker){

            $(this).val('');

        });

    },


  getProductDetails: function( {product_id, warehouse_id, customer_id="", qnt='', batch='', packet=''}, returnData ) {

    // Parse product list and return
    $.ajax({
        url: full_website_address + `/info/?module=data&page=productDetailsForPos&product_id=${product_id}&warehouse_id=${warehouse_id}&cid=${customer_id}&pqnt=${qnt}&batch=${batch}&packet=${packet}`,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data, status) {
            returnData(data);
        }
    });

  },


                'text/html': new Blob(
                    [
                        element.html()
                    ],
                    {
                        type: 'text/html'
                    }
                )
            })

        ]);


            initComplete: function(settings, json) {

                if(disableOnTypeSearch) {

                    var api = new $.fn.dataTable.Api( settings );

                    $('.dataTables_filter input').unbind();
                    $('.dataTables_filter input').bind('keyup', function(e){
                        var code = e.keyCode || e.which;
                        if (code == 13) {
                            api.search(this.value).draw();
                        }
                    });

                }

            },


            "stateSaveParams": function(settings, data) {

                var api = this.api();

                // Disable search, order and length in stateSave
                data.search.search = "";
                data.length = 15;
                data.order = DtDefaultOrder;

                // Set the select text on filter
                data.columns.forEach( (item, i) => {

                    var footer = api.column(i).footer();

                    var filterObject = $(footer).find("select");

                    if( filterObject.length > 0 ) {

                        // Add option text in the state
                        data.columns[i].search.text = $(filterObject).find(":selected").text();

                    }

                });

            },


  disableEnableWarehouseSelect: function() {

     var productCountInList = $(".productQnt").length;

     if(productCountInList > 0) {
     $("#stockTransferFromWarehouse, #stockTransferToWarehouse").prop("disabled", true);
     } else {
     $("#stockTransferFromWarehouse, #stockTransferToWarehouse").prop("disabled", false);
     }

  },


                                footer : function (data, column, row) {

                                    // If no print class exists then remove the whol html inside th
                                    return ($(row).prop('outerHTML').indexOf("no-print") > 0) ?
                                        data.replace(data, "") :
                                        data;
                                }


    calculateDiscount: function(amount, discount=null) {

        if(discount === "" || discount === null || discount === 'null' || discount === 0) {

            return parseFloat(Number(amount));

        } else if( typeof discount === 'string' && discount.indexOf("%") > 0 ) {

            // For parcantage discount
            return parseFloat(Number(amount) - (Number(discount.replace("%",""))/100) * Number(amount));

        } else {

            // For Fixed Discount
            return parseFloat(Number(amount) - Number(discount));

        }

    },


    isExists: function(product_id, whereToCheck=".productID") {

        return $(whereToCheck).filter(function() { return this.value === product_id; }).length > 0;

    },


    getDetails: function(product_id, returnData) {

        // Parse product list and return
        $.ajax({
            url: full_website_address + `/info/?module=data&page=productDetails&product_id=${product_id}`,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data, status) {
                returnData(data);
            }
        });

    },


function format(data) {

            // Get all column visibility states
            var columnVisibleState = getDataTable.columns().visible();
            var childRowHtml = ''; //'
';

            data.forEach((item) => {

                childRowHtml += '
';

                item.forEach((itemData, index) => {

                    var headerClassName = getDataTable.columns().header()[index].className;

                    // If the column is visible, then append the child column with row
                    childRowHtml += columnVisibleState[index] ? `<td class='${headerClassName}'>${itemData}</td>` : '';

                })

                childRowHtml += '
';

            });

            return $(childRowHtml).toArray();

        }


        return setInterval(function() {

            var distance = new Date().getTime() - startTime;

            var totalSeconds = distance / 1000;

            var seconds = Math.floor( totalSeconds % 60 ).toString().padStart(2,0);

            var minutes = Math.floor( ( totalSeconds % 3600 ) / 60 ).toString().padStart(2,0);

            var hours = Math.floor( totalSeconds / 3600 ).toString().padStart(2,0);

            $(container).html(`${hours}:${minutes}:${seconds}`);

        }, 1000);


showProduct: function({container='#productListContainer', category='', brand='', edition='', generic='', author=''}='' ) {

        this.parseProductList({
            category:category,
            brand:brand,
            edition:edition,
            generic:generic,
            author:author
        }, productData => {

            // if no product found then display the error msg
            if(productData == null) {
                $(container).html("
Sorry! No products found in this criteria.
");
                return;
            }

            var productHtml = "";
            productData.forEach(product => {

                var productPhoto = full_website_address;
                if( product.v && product.v > 0 ) {
                    productPhoto += "/images/?for=products&id="+ product.id +"&q=YTozOntzOjI6Iml3IjtpOjIwMDtzOjI6ImloIjtpOjIyMDtzOjI6ImlxIjtpOjcwO30="+"&v="+ product.v;
                } else {
                    productPhoto += "/assets/images/noimage.png";
                }

                productHtml += "<button type='button' value='"+ product.id +"' title='"+ product.name +"' data-toggle='tooltip' class='productButton btn-product btn-default'> \
                                 \
                                 "+ product.name +"  \
                                </button> \
                                ";
            });

            // Now all the products display in the products container
            $(container).html(productHtml);

        });

    },


  disableEnableWCSelect: function() {
    // WC = warehouse and Customer
    if( $(".productQnt").length > 0) {
      $("#customers, #warehouse").prop("disabled", true);
    } else {
      $("#customers, #warehouse").prop("disabled", false);
    }

  },


            "footerCallback": function(row, data, start, end, display) {

                var api = this.api();

                api.columns('.countTotal, .highlightWithCountTotal', {
                page: 'current'
                }).every(function() {
                    var sum = this
                        .data()
                        .reduce(function(a, b) {
                        var x = parseFloat(a) || 0;
                        var y = parseFloat(b) || 0;
                        return x + y;
                        }, 0);
                    //console.log(BMS.fn._n(sum)); //alert(sum);
                    $(this.footer()).html(sum.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'));
                });

            }


        oHideFrame.onload = function() {

            //**  this onafterprint event not working in iframe currently */

            // this.contentWindow.onbeforeunload = function() {
            //     $(".dynamic-container > iframe").remove();
            //     afterPrintOrCancel(true);
            // };
            // this.contentWindow.onafterprint = function() {
            //     $(".dynamic-container > iframe").remove();
            //     afterPrintOrCancel(true);
            // };

            this.contentWindow.focus(); // Required for IE
            this.contentWindow.print();

            afterPrintOrCancel(true);

        };


            success: function (data, status) {
                returnData(data);
            },


  productDiscountCheck: function(event) {

    // Count Sub total for each product.
    var netSalesPrice = $("#productSaleItemPrice").val();
    var Discount = $("#productSaleItemDiscount").val();

    if( event.key === "Enter" && Discount.indexOf("%") > 1 && Discount.replace("%","") >= 100) {

      // Display the error message
      Swal.fire({
        title: "Error!",
        text: "Discount Must be below of 100%",
        icon: "error"
      });

      $("#productSaleItemDiscount").val("");
      $("#productSaleItemDiscount").select();

      event.preventDefault();

    } else if ( event.key === "Enter" && Number(Discount) >= Number(netSalesPrice) && Discount.indexOf("%") < 1) {

      $("#productSaleItemDiscount").val("");
      $("#productSaleItemDiscount").select();

        // Prevent closing modal if presed enter when have discount problem
        if(event.key === "Enter") {
            event.preventDefault();
        }

      // Display the error message
      Swal.fire({
        title: "Error!",
        text: "Discount Must be below of product sale price",
        icon: "error"
      });

      event.preventDefault();

    }

  },


    parseProductList: function( {category='', brand='', edition='', generic='', author=''}, returnData ) {

        // Parse product list and return
        $.ajax({
            url: full_website_address + `/info/?module=data&page=productList&catId=${category}&brand=${brand}&edition=${edition}&generic=${generic}&author=${author}`,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data, status) {
                returnData(data);
            }
        });

    },


    calculateTarifCharges: function(amount, discount = null) {

        if(discount === "" || discount === null || discount === 'null' || discount === 0) {

            return 0.00;

        } else if (typeof discount === 'string' && discount.indexOf("%") > 0) {

            // For parcantage discount
            return ((Number(discount.replace("%", "")) / 100) * Number(amount)).toFixed(2);

        } else {

            // For Fixed Discount
            return (Number(discount)).toFixed(2);

        }

    },


  editProductItemDetails: function(rowId, product_name) {

    // Display the product name on modal
    $("#productSaleDetails .modal-title").html(product_name);
    $("#productSaleDetails .rowId").val(rowId);

    // select product details row
    var product_row = $(`#${rowId}`);

    $("#productSaleDetails #productSaleItemPrice").val( product_row.find(".netSalesPrice").val() );
    $("#productSaleDetails #productSaleItemDiscount").val( product_row.find(".productDiscount").val() );
    $("#productSaleDetails #productSaleItemPacket").val( product_row.find(".productPacket").val() );
    $("#productSaleDetails #productSaleItemDetails").val( product_row.find(".productItemDetails").val() );

  },


addWastageSaleItem: function() {

    var html = '
\
                 <input type="text" name="wastageSaleItem[]" placeholder="Enter Item name and details" class="wastageSaleItem form-control" required> 	\
                 <input type="number" step="any" name="wastageSaleItemQnt[]" class="wastageSaleItemQnt form-control" required> 	\
                 <input type="number" step="any" name="wastageSaleItemPrice[]" class="wastageSaleItemPrice form-control" required> 	\
                0.00	\
                 \
                     \
                	 \

';

    $("#productTable > tbody").append(html);

    /* Focus the item name input field */
    $(".wastageSaleItem").focus();

    /* Count all totals */
    this.grandTotal();

  }


            success: function(productUnit, status) {
                if (status == "success") {

                    /* Change the product Price */
                    $(selector).closest("tr").find(".productPurchasePrice").val(productUnit.pp);
                    $(selector).closest("tr").find(".productMainPurchasePrice").val(productUnit.pp);

                    /* Calculate all data */
                    self.calculateEachProduct(selector);
                    self.grandTotal();

                }
            }


    isGivenDiscountPermitted: function(selector) {

        var totalAmount = $(".totalAmount").text();
        var orderDiscount = $(selector).val();

        if( get_options("maxDiscount") != "" ) { // If the current biller set a max discount

            var maxDiscountAmount = totalAmount - BMS.FUNCTIONS.calculateDiscount(totalAmount, get_options("maxDiscount"));
            var givenDiscountAmount = totalAmount - BMS.FUNCTIONS.calculateDiscount(totalAmount, orderDiscount);

            // In case of return/ negative value
            // -2 is greater then -4
            // So we are converting all negative value to abs
            return Math.abs(maxDiscountAmount) >= Math.abs(givenDiscountAmount);

        } else {
            return true;
        }

    }


BMS.ORDER.productQntCheck = function(selector, event) {

    // Count Sub total for each product.
    var netSalesPrice = $(selector).closest("tr").find(".netSalesPrice").val();
    var Quantity = $(selector).val();
    var Discount = $(selector).closest("tr").find(".productDiscount").val();
    var SubtotalRow = $(selector).closest("tr").find("td.subtotalCol");

    // If the product quantity less then 1 then throw an error
    if(Quantity == 0) {

        // Display the error message
        Swal.fire({
            title: "Error!",
            text: "Product qunatity can not be zero (0)",
            icon: "error"
        });

        // Set product quantity 1
        $(selector).val(1);
        Quantity = 1;

    }

    // Display Subtotal for each product
    $(SubtotalRow).html((BMS.FUNCTIONS.calculateDiscount(netSalesPrice,Discount) * Quantity).toFixed(2));

    // Call the grand total
    this.grandTotal();

};


    getListByGeneric: function(genericName) {

        /**
         * Get Product list by
         * initializing the select2 with default option
         *
         * Arguments: Selector, option value, Option text
         *
         */
        BMS.fn.select2("#productGenericFilter", genericName, genericName);

    },


            onClose: $("body").css('padding', '0px') // This is because, while close the sweet alert a 15px padding-right is keep.

        });

    },


      unit: $(selector).closest("tr").find(".productItemUnit").val()
    }, product => {

      if(product["error"] !== undefined && product["error"] === true) {

        $(that).val(product.stq); // Set the product quantity with Stock Quantity
        Quantity = product.stq;

        // Display the error message
        Swal.fire({
            title: "Error!",
            text: product["msg"],
            icon: "error"
        });

      }

      // Check if product[0] isset, if not the use direct product
      // Because If there is any error then the product details come with the error
      var product = product[0] ? product[0] : product;

      // change product background color while changing qty and when out of stock
      if(product.so) {

        $(selector).closest("tr").css("background-color", "pink");

      } else {

        $(selector).closest("tr").css("background-color", "white");

      }

      // Display Subtotal for each product
      $(SubtotalRow).html((BMS.FUNCTIONS.calculateDiscount(netSalesPrice,Discount) * Quantity).toFixed(2));

      // Update the packet
      var packet = 0;
      if(Number(product.pq) > 0) {
        packet = (Quantity / Number(product.pq)).toFixed(2);
      }
      packetSelector.val( packet );

      // Call the grand total
      this.grandTotal();

    });

  },


            error: function() {
                returnData("");
            }


                processResults: function (data) {
                    return {
                        results: data
                    };
                },


    multiDatePicker: function({selector=".multiDatePicker", format="yyyy-mm-dd"}="") {

        $(selector).datepicker({
            multidate: true,
            multidateSeparator: ", ",
            format: format,
            todayHighlight: true
        });

    },


printPage: function(sURL, event, afterPrintOrCancel= function(){}) {


                noResults: function() {
                    return noResults;
                }


            notification.onclick = function() {
                window.focus();
                this.close();
            }


                'All'  : [moment(0), moment().subtract('year').endOf('day')],
            }

        });

        // Apply the date
        $(selector).on('apply.daterangepicker', function(ev, picker) {

            $(this).val(picker.startDate.format(format) + ' - ' + picker.endDate.format(format));

        });

        // clear the date
        $(selector).on('cancel.daterangepicker', function(ev, picker){

            $(this).val('');

        });

    },


            didOpen: (toast) => {
                toast.addEventListener('mouseenter', Swal.stopTimer);
                toast.addEventListener('mouseleave', Swal.resumeTimer);
                this.play("beep");
            },


    getCookie: function(name) {

        var cookie = decodeURIComponent(`; ${document.cookie}`).split(`; ${name}=`);
        if(cookie.length > 1) return cookie[1].split("; ")[0];

    },


    send: function(msg, toUserId) {

        wss.send(JSON.stringify({
            "type"   : "message",
            "toUser" : toUserId,
            "msg"    : msg
        }));

    }


    datePicker: function({selector=".datePicker", format="YYYY-MM-DD", timePicker= false}="") {

        $(selector).daterangepicker({
            autoUpdateInput: false,
            singleDatePicker: true,
            showDropdowns: true,
            timePicker: timePicker,
            timePicker24Hour: true,
            autoApply: true,
            parentEl: "div.dynamic-container",
            drops: "auto",
            locale:{
                format: format,
                cancelLabel: 'Clear'
            }
        });

        // Apply the date
        $(selector).on('apply.daterangepicker', function(ev, picker) {

            $(this).val(picker.startDate.format(format));

        });

        // clear the date
        $(selector).on('cancel.daterangepicker', function(ev, picker){

            $(this).val('');

        });

    },


            unit: $(selector).val()
        }, products => {

            // Change the sale price on unit change
            $(selector).closest("tr").find(".productSalePrice").val(products[0]["sp"]);

        });

    }


messageTop: function() {
                            // If the dt exprot message define then append it
                            if($("#DtExportTopMessage").html() !== undefined) {
                                return $("#DtExportTopMessage").html();
                            } else {
                                return "
" + document.title + "

 Printed On:  "+ date +"

";
                            }
                        }


        success: function(data, status) {

            if(status = "success" && data === "1") {

                // Success Altert
                BMS.fn.alertSuccess("SMS successfully sent.", false);

                // Make empty the sms box
                $("#csSmsText").val("");

            } else {
                BMS.fn.alertError("SMS faild to send.");
            }

        }


        peerconnection.onaddstream = function (e) {

            // set remote audio stream (to listen to remote audio)
            // remoteAudio is <audio> element on pag
            remoteAudio.srcObject = e.stream;
            remoteAudio.play();

        };


                duration: Math.floor( (session.end_time.getTime() - session.start_time.getTime()) / 1000),
                status: "Answered"
            });

            // Pause Ring
            BMS.fn.pause();

            // Stop Timer
            BMS.fn.stopTimer(window.timer);

            $("#status").html(`${caller} is disconnected`).show();

            $("#timer").fadeOut(100).fadeIn(100).fadeOut(150).fadeIn(150).fadeOut(200).fadeIn(200).fadeOut(500).fadeIn(500);

            // disable the number search and hangButton
            $("#hangButton").prop("disabled", true);

            // Show the feedback tab
            $('.nav-tabs a[href="#tab_feedback"]').tab('show');

            // Stop the phone
            phone.stop();

        }

        // Complete the session
        completeSession();

    });


                duration: Math.floor( (session.end_time.getTime() - session.start_time.getTime()) / 1000),
                status: "Answered"
            });


    var completeSession = function(){

        session = null;

        // Reset the mute and holde button
        $("#muteCall, #holdCall").show();
        $("#unholdCall, #unmuteCall").hide();

    };


        session.sendDTMF = function(tone){
            dtmfSender.insertDTMF(tone);
        };


            "text": $("#csSmsText").val()
        },
        success: function(data, status) {

            if(status = "success" && data === "1") {

                // Success Altert
                BMS.fn.alertSuccess("SMS successfully sent.", false);

                // Make empty the sms box
                $("#csSmsText").val("");

            } else {
                BMS.fn.alertError("SMS faild to send.");
            }

        }

    });

});


function dial(number) {

    if( phone.isConnected() ) {

        // Disable input filed after dial
        $(".numberSearch").prop("disabled", true);
        $(".number-dialer-div .input-group-addon").addClass("disable-number-dialer-div");

        // BMS.fn.play("outgoing_call", true);
        session = phone.call( number.trim() , callOptions);

        $("#status").html(`Call is being send to ${number}...`).show();

        // hide the call button and show the hang button
        $("#callButton, #hangButton").toggle();

        // Show the caller details
        showCallerDetails(caller);

        // Empty the feedback area and remove previous fired for savings
        $("#callFeedback, #feedbackReviewer").val("");
        $(document).off("change", "#callFeedback, #feedbackReviewer");

        // Hide the  suggestion number if it is shown
        $(".suggestion-numbers").html("").hide();

    } else {

        $("#status").html(`<div style="font-size: 16px;" class='alert alert-danger'>Sorry! The signaling server is disconnected.</div>`).show();

    }

}


                duration: Math.floor( (session.end_time.getTime() - session.start_time.getTime()) / 1000),
                status: "Answered"
            });

            // Show the call dailer after session end
            $("#callDailer").show();

            // Hide call Received
            $("#callReceiver").hide();

            // Pause Ring
            BMS.fn.pause();

            // Show the call button
            $("#callButton").show();

            // Hide the end button
            $("#hangButton").hide();

            // Stop Timer
            BMS.fn.stopTimer(window.timer);

            $("#status").html(`Dail a number!`);

            // clear case search list
            $(".caseList input[type=search]").val('');
            $(".caseList input[type=search]").trigger("keyup");

            $("#timer").fadeOut(100).fadeIn(100).fadeOut(150).fadeIn(150).fadeOut(200).fadeIn(200).fadeOut(500).fadeIn(500, function() {

                // Reset and hide the timer
                $("#timer").html("00:00:00");
                $("#timer").hide();

            });

        }

        // Complete the session
        completeSession();

    });


    var completeSession = function(){
            session = null;

            // Reset the mute and holde button
            $("#muteCall, #holdCall").show();
            $("#unholdCall, #unmuteCall").hide();

    };


success: function (data, status) {
            if (status == "success") {
                //Remove the loading icon from button
                $(submitter).html("Printing...");

                var saleStatus = JSON.parse(data);

                // Redirect to sale invoice print page
                if (saleStatus["saleStatus"] === "success") {

                    BMS.MAIN.printPage(full_website_address + "/invoice-print/?invoiceType=posSale&id=" + saleStatus["salesId"], event, function () {

                        // Hide the payment modal
                        $('#payment').modal('hide');

                        // Clear POS Screen
                        BMS.POS.clearScreen();

                        // enable submit button after ajax request complete
                        $("#payment").find("button").prop("disabled", false);

                    });

                } else {

                    $("#posErrorMsg").html('
' + saleStatus["msg"] + '
');

                    // enable submit button after ajax request complete
                    $("#payment").find("button").prop("disabled", false);

                }

            }
        }


onClose: $("body").css('padding', '0px') // This is because, while close the sweet alert a 15px padding-right is keep.
        });
        return;
    }

    // Add loading icon in the button after click.
    $(submitter).html("Submit    ");

    var formData = new FormData(this);       // Get all form data and store into formData

    // Append the button value with form data
    formData.append(submitter.name, submitter.value);

    // disable submit button untile ajax request complete
    $("#payment").find("button").prop("disabled", true);

    $.ajax({
        url: full_website_address + "/info/?module=pos",
        type: "post",
        data: formData,
        cache: false,
        contentType: false,
        processData: false,
        success: function (data, status) {
            if (status == "success") {
                //Remove the loading icon from button
                $(submitter).html("Printing...");

                var saleStatus = JSON.parse(data);

                // Redirect to sale invoice print page
                if (saleStatus["saleStatus"] === "success") {

                    BMS.MAIN.printPage(full_website_address + "/invoice-print/?invoiceType=posSale&id=" + saleStatus["salesId"], event, function () {

                        // Hide the payment modal
                        $('#payment').modal('hide');

                        // Clear POS Screen
                        BMS.POS.clearScreen();

                        // enable submit button after ajax request complete
                        $("#payment").find("button").prop("disabled", false);

                    });

                } else {

                    $("#posErrorMsg").html('
' + saleStatus["msg"] + '
');

                    // enable submit button after ajax request complete
                    $("#payment").find("button").prop("disabled", false);

                }

            }
        }
    });

});


        reader.onload = function (e) {
            $(that).css("color", "green");
            $(that).closest(".imageContainer").find('.image_preview').css("display", "block");
            $(that).closest(".imageContainer").find('.previewing').attr('src', e.target.result);
            //$(that).closest(".imageContainer").find('.previewing').attr('width', 'auto');
            //$(that).closest(".imageContainer").find('.previewing').attr('height', '100%');
        };


        didOpen: function () {
            BMS.fn.play("warning");
        },


    function dropDownFixPosition(button, dropdown) {
        var dropDownTop = button.offset().top + button.outerHeight();
        dropdown.css('top', dropDownTop + "px");
        dropdown.css('left', button.offset().left - 100 + "px");
        dropdown.css('position', "absolute");

        dropdown.css('width', dropdown.width());
        dropdown.css('heigt', dropdown.height());
        dropdown.css('display', 'block');
        dropdown.appendTo('.dynamic-container');
    }


    beforeSend: function (xhr) {
        xhr.setRequestHeader("X-CSRF-TOKEN", xCsrfToken);
    }


        author: $("#productAuthorFilter").val(),
    });

});


                        onClose: $("body").css('padding', '0px') // This is because, while close the sweet alert a 15px padding-right is keep.
                    });

                    // Remove the deleted elements

                    if(removeParent !== undefined) {

                        $(that).closest(removeParent).hide('fast');
                    }

                    // Reloade the Datatable
                    $('#dataTableWithAjax').DataTable().ajax.reload(null, false);
                    $('#dataTableWithAjaxExtend').DataTable().ajax.reload(null, false);

                }
            );

        }

    })


function format_number(
    number,
    decimalPlaces = null,
    decimalSeparator = "",
	thousandSeparator = ""
    ) {

        var number = Number(number);
        var decimalPlaces = empty(decimalPlaces) ? get_options("decimalPlaces") : decimalPlaces;
        var decimalSeparator = empty(decimalSeparator) ? get_options("decimalSeparator") : decimalSeparator;
        var thousandSeparator = empty(thousandSeparator) ? get_options("thousandSeparator") : thousandSeparator;

        /** Regex taken from VisioN: https://stackoverflow.com/a/14428340 */
        var re = '\\d(?=(\\d{' + (3) + '})+' + (decimalPlaces > 0 ? '\\D' : '$') + ')',
        num = number.toFixed(Math.max(0, ~~decimalPlaces));
        var formatedNumber = (decimalSeparator ? num.replace('.', decimalSeparator) : num).replace(new RegExp(re, 'g'), '$&' + (thousandSeparator || ','));

        return formatedNumber;

}


function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}


function sumInputs(input) {
    var sum = 0;

    $(input).each(function(){
        sum +=  $(this).val() === "" ? 0 : parseFloat( $(this).val() );
    });

    return sum;
}


function backToPurchaseList() {

    /** show the customer purchase list */
    $("#showPurchaseList").show();

    /** Hide the purchase product list */
    $("#showPurchaseProductList").hide();

}


function to_money(
    number,
    decimalPlaces = null,
    decimalSeparator = "",
	thousandSeparator = "",
	currencySymbol = "",
	currencySymbolPosition = ""
    ) {

        var currencySymbol = empty(currencySymbol) ? get_options("currencySymbol") : currencySymbol;
        var currencySymbolPosition = empty(currencySymbolPosition) ? get_options("currencySymbolPosition") : currencySymbolPosition;

        var formatedNumber = format_number(number, decimalPlaces = decimalPlaces, decimalSeparator = decimalSeparator, thousandSeparator = thousandSeparator);

        if( !empty(currencySymbolPosition) && currencySymbolPosition.toLowerCase === "right" ) {
            formatedNumber = formatedNumber + " " +  currencySymbol;
        } else {
            formatedNumber = currencySymbol + " " + formatedNumber;
        }

        return formatedNumber;
}


function isJson(str) {
    try {
        JSON.parse(str);
    } catch (e) {
        return false;
    }
    return true;
}


function sendBulkSMS(url) {

    var table = $('#dataTableWithAjaxExtend').DataTable();

    //var data = table.columns( 0 ).data();
    var rows = table.rows({ selected: true }).indexes();
    var data = table.cells(rows, 0).data();
    var number = [];

    $.each(data, function (key, num) {

        if (num != "" || num != null || num != 'NULL' || num != 0 || num != '0') {
            number.push(num);
        }

    });

    $("#modalDefault").modal('show').find('.modal-content').load(url + encodeURI(number.join()));

}


function get_options(name) {
    return localStorage.getItem(name);
}


function disableInput(selector, status=true) {

    // Add a class called disableInput in which are not disable by default
    $(selector).find("input, select, button, textarea").not('[disabled]').addClass("disableInput");

    // Then desable/ Enable input which are not disable by default
    $(".disableInput").prop("disabled", status);

}


function empty(data) {
    return data === "" || data === null || data === 'null';
}


function combosVariations(options, optionIndex=0, results=[], current={}) {

    var allKeys = Object.keys(options);
    var optionKey = allKeys[optionIndex];

    var list = options[optionKey];

    list.forEach( item => {

        current[optionKey] = item;

        if (optionIndex + 1 < allKeys.length) {
            combosVariations(options, optionIndex + 1, results, current);
        } else {
            // The easiest way to clone an object.
            var res = JSON.parse(JSON.stringify(current));
            results.push(res);
        }

    });

    return results;

}


function tsd(num) {
    return Number(num).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');

}


function setVariationPrice() {

    var purchasePrice = $("#productVariationPurchasePriceSetter").val();
    var salePrice = $("#productVariationSelePriceSetter").val();
    var discount = $("#productVariationDiscountSetter").val();

    // Set prces for specific units
    var getWhereUnit = $("#SetPricesWhereUnit").val();
    if( getWhereUnit !== "" ) {

        $.each($(`input[name='product_variation[Units][]'][value='${getWhereUnit}'], select[name='product_variation[Units][]'] option:selected[value='${getWhereUnit}']`), function(key, val) {

            /** Set purchase price */
            if(purchasePrice !== "") {
                $(this).closest("li").find(".productVariationPurchasePrice").val(purchasePrice)
            }

            /** Set sale Price */
            if(salePrice !== "") {
                $(this).closest("li").find(".productVariationSalePrice").val(salePrice)
            }

            /** Set discount */
            if(discount !== "") {
                $(this).closest("li").find(".productVariationDiscount").val(discount)
            }

        });

    } else {

        /** Set purchase price */
        if(purchasePrice !== "") {
            $(".productVariationPurchasePrice").val(purchasePrice)
        }

        /** Set sale Price */
        if(salePrice !== "") {
            $(".productVariationSalePrice").val(salePrice)
        }

        /** Set discount */
        if(discount !== "") {
            $(".productVariationDiscount").val(discount)
        }

    }

}


function getPurchaseProductList(saleid, saleRef) {

    /** Hide the customer purchase list */
    $("#showPurchaseList").hide();

    /** Show the purchase product list */
    $("#showPurchaseProductList").show();

    BMS.fn.get(`customerPurchaseProductList&saleid=${saleid}`, purchaseList => {

        var purchaseListHtml = "";
        purchaseList.forEach(item=> {

            purchaseListHtml += `<li style="cursor: pointer"
                                    onClick="BMS.POS.addReturnProduct(
                                        '${item.pid}',
                                        '${item.pn}',
                                        '${item.pg}',
                                        '${item.batch}',
                                        '${item.pu}',
                                        '${item.hed}',
                                        '${item.stock_item_discount}',
                                        '${item.stock_item_price}',
                                        '${item.stock_item_qty}',
                                        '${item.stock_item_subtotal}'
                                    )" class="item">
                                    ${item.pn}

                                            ${item.stock_item_qty}${(item.pu === null) ? "" : item.pu} @ ${to_money(item.stock_item_price)}

`;

        });

        $(".saleReferenceShow").html(`<p style="font-size: 14px; font-weight: bold;">Product list for: ${saleRef}</p>`);
        $("#showPurchaseProductList ul").html(purchaseListHtml);

    });

}


function updateCallLog({vm_id="", number="", duration="", status=""}="") {

    $.ajax({
        url: full_website_address + "/xhr/?module=customer-support&page=updateCallLog",
        type: "post",
        data:{
            vm_id: vm_id,
            number: number,
            duration: duration,
            status: status
        },
        success: function(status, data){}

    });

}


            success: function(data, status) {

                data = JSON.parse(data);

                if(status == "success") {

                    $(".voiceMessageTerminal").append(`<li>${data.description} is starting to send...</li>`);

                    // Start sending to first three numbers
                    var totalChanel = 2;
                    var totalContacts = data.contacts.length;
                    var maxDail = totalChanel < totalContacts ? totalChanel : totalContacts;

                    var currentPosition = maxDail;

                    for(var x=0; x<maxDail; x++ ){

                        $(".voiceMessageTerminal").append(`<li class='${data.contacts[x]}'>${data.description} is sending to ${data.contacts[x]}. </li>`);
                        sendVoiceMessage(data.contacts[x], data.record, vm_id);

                    }

                    if(totalContacts < 1) {
                        $(".voiceMessageTerminal").append(`<li style='color: red'>Sorry! ${data.description} has no contacts or already sent.</li>`);
                    }

                    $(document).on("initiateNextCall", function() {

                        // Mark as all contacts have daild
                        if( currentPosition === totalContacts ) {

                            allContactBrodcasted = true;

                            $(".voiceMessageTerminal").append(`<li style='color: green'>${data.description} has been brodcasted to all given contacts.</li>`);

                        } else {

                            $(".voiceMessageTerminal").append(`<li class='${data.contacts[currentPosition]}'>${data.description} is sending to ${data.contacts[currentPosition]}. </li>`);
                            sendVoiceMessage(data.contacts[currentPosition], data.record, vm_id);

                            currentPosition++;

                        }

                    });

                }

            }


                duration: Math.floor( (session.end_time.getTime() - session.start_time.getTime()) / 1000),
                status: "Answered"
            });

            completeSession();

            if( allContactBrodcasted === false ) {

                // Do next call
                $(document).trigger("initiateNextCall");

            }

        });


        var completeSession = function(){
            session = null;
        };


            voiceCall.onended = function() {

                BMS.fn.stopTimer(window['timer'+number]);

                $(`.voiceMessageTerminal > li.${number}`).append("Played.");

                session.terminate();

            };


                duration: Math.floor( (session.end_time.getTime() - session.start_time.getTime()) / 1000),
                status: "Answered"
            });


  function getIdentifierQuote(editor) {
    return getModeConf(editor, "identifierQuote") || "`";
  }

Use of Platform-Dependent Third Party Components

The product relies on third-party components that do
					not provide equivalent functionality across all desirable
					platforms.


  function insertIdentifierQuotes(name) {
    var nameParts = getText(name).split(".");
    for (var i = 0; i < nameParts.length; i++)
      nameParts[i] = identifierQuote +
      // duplicate identifierQuotes
    nameParts[i].replace(new RegExp(identifierQuote,"g"), identifierQuote+identifierQuote) +
      identifierQuote;
    var escaped = nameParts.join(".");
    if (typeof name == "string") return escaped;
    name = shallowClone(name);
    name.text = escaped;
    return name;
  }


  function getModeConf(editor, field) {
    return editor.getModeAt(editor.getCursor()).config[field] || CodeMirror.resolveMode("text/x-sql")[field]
  }


  function getKeywords(editor) {
    return getModeConf(editor, "keywords") || []
  }


  function buildGap(dv) {
    var lock = dv.lockButton = elt("div", null, "CodeMirror-merge-scrolllock");
    lock.setAttribute("role", "button");
    lock.setAttribute("tabindex", "0");
    var lockWrap = elt("div", [lock], "CodeMirror-merge-scrolllock-wrap");
    CodeMirror.on(lock, "click", function() { setScrollLock(dv, !dv.lockScroll); });
    CodeMirror.on(lock, "keyup", function(e) { (e.key === "Enter" || e.code === "Space") && setScrollLock(dv, !dv.lockScroll); });
    var gapElts = [lockWrap];
    if (dv.mv.options.revertButtons !== false) {
      dv.copyButtons = elt("div", null, "CodeMirror-merge-copybuttons-" + dv.type);
      var copyButtons = function(e) {
        var node = e.target || e.srcElement;
        if (!node.chunk) return;
        if (node.className == "CodeMirror-merge-copy-reverse") {
          copyChunk(dv, dv.orig, dv.edit, node.chunk);
          return;
        }
        copyChunk(dv, dv.edit, dv.orig, node.chunk);
      }
      CodeMirror.on(dv.copyButtons, "click", copyButtons);
      CodeMirror.on(dv.copyButtons, "keyup", function(e) { (e.key === "Enter" || e.code === "Space") && copyButtons(e); });
      gapElts.unshift(dv.copyButtons);
    }
    if (dv.mv.options.connect != "align") {
      var svg = document.createElementNS && document.createElementNS(svgNS, "svg");
      if (svg && !svg.createSVGRect) svg = null;
      dv.svg = svg;
      if (svg) gapElts.push(svg);
    }

    return dv.gap = elt("div", gapElts, "CodeMirror-merge-gap");
  }


  function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {
    field.setAttribute("autocorrect", autocorrect ? "on" : "off");
    field.setAttribute("autocapitalize", autocapitalize ? "on" : "off");
    field.setAttribute("spellcheck", !!spellcheck);
  }


        setLastCopied({lineWise: false, text: cm.getSelections()});
        if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
      } else if (!cm.options.lineWiseCopyCut) {
        return
      } else {
        var ranges = copyableRanges(cm);
        setLastCopied({lineWise: true, text: ranges.text});
        if (e.type == "cut") {
          cm.operation(function () {
            cm.setSelections(ranges.ranges, 0, sel_dontScroll);
            cm.replaceSelection("", null, "cut");
          });
        }
      }
      if (e.clipboardData) {
        e.clipboardData.clearData();
        var content = lastCopied.text.join("\n");
        // iOS exposes the clipboard API, but seems to discard content inserted into it
        e.clipboardData.setData("Text", content);
        if (e.clipboardData.getData("Text") == content) {
          e.preventDefault();
          return
        }
      }
      // Old-fashioned briefly-focus-a-textarea hack
      var kludge = hiddenTextarea(), te = kludge.firstChild;
      disableBrowserMagic(te);
      cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
      te.value = lastCopied.text.join("\n");
      var hadFocus = activeElt(div.ownerDocument);
      selectInput(te);
      setTimeout(function () {
        cm.display.lineSpace.removeChild(kludge);
        hadFocus.focus();
        if (hadFocus == div) { input.showPrimarySelection(); }
      }, 50);
    }


  TextareaInput.prototype.createField = function (_display) {
    // Wraps and hides input textarea
    this.wrapper = hiddenTextarea();
    // The semihidden textarea that is focused when the editor is
    // focused, and receives input.
    this.textarea = this.wrapper.firstChild;
    var opts = this.cm.options;
    disableBrowserMagic(this.textarea, opts.spellcheck, opts.autocorrect, opts.autocapitalize);
  };


    function onCopyCut(e) {
      if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return }
      if (cm.somethingSelected()) {
        setLastCopied({lineWise: false, text: cm.getSelections()});
        if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
      } else if (!cm.options.lineWiseCopyCut) {
        return
      } else {
        var ranges = copyableRanges(cm);
        setLastCopied({lineWise: true, text: ranges.text});
        if (e.type == "cut") {
          cm.operation(function () {
            cm.setSelections(ranges.ranges, 0, sel_dontScroll);
            cm.replaceSelection("", null, "cut");
          });
        }
      }
      if (e.clipboardData) {
        e.clipboardData.clearData();
        var content = lastCopied.text.join("\n");
        // iOS exposes the clipboard API, but seems to discard content inserted into it
        e.clipboardData.setData("Text", content);
        if (e.clipboardData.getData("Text") == content) {
          e.preventDefault();
          return
        }
      }
      // Old-fashioned briefly-focus-a-textarea hack
      var kludge = hiddenTextarea(), te = kludge.firstChild;
      disableBrowserMagic(te);
      cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
      te.value = lastCopied.text.join("\n");
      var hadFocus = activeElt(div.ownerDocument);
      selectInput(te);
      setTimeout(function () {
        cm.display.lineSpace.removeChild(kludge);
        hadFocus.focus();
        if (hadFocus == div) { input.showPrimarySelection(); }
      }, 50);
    }
    on(div, "copy", onCopyCut);
    on(div, "cut", onCopyCut);
  };


    support: set("decimallessFloat zerolessFloat hexNumber")
  });
});


    dateSQL: set("date time timestamp zone"),
    // hexNumber is necessary for VARBINARY literals, e.g. X'65683F'
    // but it also enables 0xFF hex numbers, which Trino doesn't support.
    support: set("decimallessFloat zerolessFloat hexNumber")
  });
});


return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.split("")}function _(n){return n.match($t)||[]}function v(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,!1}),e}function g(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){return t===t?Z(n,t,r):g(n,b,r)}function d(n,t,r,e){


writable:!0})}:La,js=uu,As=$l||function(n){return re.clearTimeout(n)},ks=es&&1/P(new es([,-0]))[1]==Sn?function(n){return new es(n)}:Da,Os=os?function(n){return os.get(n)}:Da,Is=Pl?function(n){return null==n?[]:(n=ll(n),i(Pl(n),function(t){return Wl.call(n,t)}))}:Pa,Rs=Pl?function(n){for(var t=[];n;)a(t,Is(n)),n=El(n);return t}:Pa,zs=we;(ns&&zs(new ns(new ArrayBuffer(1)))!=ct||ts&&zs(new ts)!=Gn||rs&&zs(rs.resolve())!=Qn||es&&zs(new es)!=tt||us&&zs(new us)!=it)&&(zs=function(n){var t=we(n),r=t==Yn?n.constructor:X,e=r?to(r):"";


return Nr(Fr(n,an))}function Sa(n){return function(){return n}}function Wa(n,t){return null==n||n!==n?t:n}function La(n){return n}function Ca(n){return De("function"==typeof n?n:Fr(n,an))}function Ua(n){return qe(Fr(n,an))}function Ba(n,t){return Ze(n,Fr(t,an))}function Ta(n,t,e){var u=Pc(t),i=fe(t,u);null!=e||fc(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=fe(t,Pc(t)));var o=!(fc(e)&&"chain"in e&&!e.chain),f=uc(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;


    return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.split("")}function _(n){return n.match($t)||[]}function v(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,!1}),e}function g(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){return t===t?Z(n,t,r):g(n,b,r)}function d(n,t,r,e){
    for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function b(n){return n!==n}function w(n,t){var r=null==n?0:n.length;return r?k(n,t)/r:Cn}function m(n){return function(t){return null==t?X:t[n]}}function x(n){return function(t){return null==n?X:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)}),r}function A(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}function k(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==X&&(r=r===X?i:r+i);


var v=Xh(function(){return cl(f,p+"return "+s).apply(X,c)});if(v.source=s,rc(v))throw v;return v}function ma(n){return Ec(n).toLowerCase()}function xa(n){return Ec(n).toUpperCase()}function ja(n,t,r){if(n=Ec(n),n&&(r||t===X))return R(n);if(!n||!(t=vu(t)))return n;var e=G(n),u=G(t);return Ou(e,W(e,u),L(e,u)+1).join("")}function Aa(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.slice(0,H(n)+1);if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,0,L(e,G(t))+1).join("")}function ka(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.replace(Lt,"");


(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function e(n,t){for(var r=null==n?0:n.length;r--&&t(n[r],r,n)!==!1;);return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;


}function Va(){return!0}function Ga(n,t){if(n=kc(n),n<1||n>Wn)return[];var r=Un,e=Hl(n,Un);t=mi(t),n-=Un;for(var u=O(e,t);++r<n;)t(r);return u}function Ha(n){return bh(n)?c(n,no):bc(n)?[n]:Tu(Cs(Ec(n)))}function Ja(n){var t=++wl;return Ec(n)+t}function Ya(n){return n&&n.length?Yr(n,La,me):X}function Qa(n,t){return n&&n.length?Yr(n,mi(t,2),me):X}function Xa(n){return w(n,La)}function nl(n,t){return w(n,mi(t,2))}function tl(n){return n&&n.length?Yr(n,La,Ne):X}function rl(n,t){return n&&n.length?Yr(n,mi(t,2),Ne):X;


    return Nr(Fr(n,an))}function Sa(n){return function(){return n}}function Wa(n,t){return null==n||n!==n?t:n}function La(n){return n}function Ca(n){return De("function"==typeof n?n:Fr(n,an))}function Ua(n){return qe(Fr(n,an))}function Ba(n,t){return Ze(n,Fr(t,an))}function Ta(n,t,e){var u=Pc(t),i=fe(t,u);null!=e||fc(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=fe(t,Pc(t)));var o=!(fc(e)&&"chain"in e&&!e.chain),f=uc(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;
    if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Tu(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function $a(){return re._===this&&(re._=Al),this}function Da(){}function Ma(n){return n=kc(n),uu(function(t){return Ge(t,n)})}function Fa(n){return Bi(n)?m(no(n)):Qe(n)}function Na(n){return function(t){return null==n?X:_e(n,t)}}function Pa(){return[]}function qa(){return!1}function Za(){return{}}function Ka(){return"";


return e}function U(n){return"\\"+Yr[n]}function B(n,t){return null==n?X:n[t]}function T(n){return Nr.test(n)}function $(n){return Pr.test(n)}function D(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function M(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function F(n,t){return function(r){return n(t(r))}}function N(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==cn||(n[r]=cn,i[u++]=r)}return i}function P(n){var t=-1,r=Array(n.size);


    if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Tu(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function $a(){return re._===this&&(re._=Al),this}function Da(){}function Ma(n){return n=kc(n),uu(function(t){return Ge(t,n)})}function Fa(n){return Bi(n)?m(no(n)):Qe(n)}function Na(n){return function(t){return null==n?X:_e(n,t)}}function Pa(){return[]}function qa(){return!1}function Za(){return{}}function Ka(){return"";
    }function Va(){return!0}function Ga(n,t){if(n=kc(n),n<1||n>Wn)return[];var r=Un,e=Hl(n,Un);t=mi(t),n-=Un;for(var u=O(e,t);++r<n;)t(r);return u}function Ha(n){return bh(n)?c(n,no):bc(n)?[n]:Tu(Cs(Ec(n)))}function Ja(n){var t=++wl;return Ec(n)+t}function Ya(n){return n&&n.length?Yr(n,La,me):X}function Qa(n,t){return n&&n.length?Yr(n,mi(t,2),me):X}function Xa(n){return w(n,La)}function nl(n,t){return w(n,mi(t,2))}function tl(n){return n&&n.length?Yr(n,La,Ne):X}function rl(n,t){return n&&n.length?Yr(n,mi(t,2),Ne):X;


if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Tu(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function $a(){return re._===this&&(re._=Al),this}function Da(){}function Ma(n){return n=kc(n),uu(function(t){return Ge(t,n)})}function Fa(n){return Bi(n)?m(no(n)):Qe(n)}function Na(n){return function(t){return null==n?X:_e(n,t)}}function Pa(){return[]}function qa(){return!1}function Za(){return{}}function Ka(){return"";


    }function Va(){return!0}function Ga(n,t){if(n=kc(n),n<1||n>Wn)return[];var r=Un,e=Hl(n,Un);t=mi(t),n-=Un;for(var u=O(e,t);++r<n;)t(r);return u}function Ha(n){return bh(n)?c(n,no):bc(n)?[n]:Tu(Cs(Ec(n)))}function Ja(n){var t=++wl;return Ec(n)+t}function Ya(n){return n&&n.length?Yr(n,La,me):X}function Qa(n,t){return n&&n.length?Yr(n,mi(t,2),me):X}function Xa(n){return w(n,La)}function nl(n,t){return w(n,mi(t,2))}function tl(n){return n&&n.length?Yr(n,La,Ne):X}function rl(n,t){return n&&n.length?Yr(n,mi(t,2),Ne):X;
    }function el(n){return n&&n.length?k(n,La):0}function ul(n,t){return n&&n.length?k(n,mi(t,2)):0}x=null==x?re:be.defaults(re.Object(),x,be.pick(re,qr));var il=x.Array,ol=x.Date,fl=x.Error,cl=x.Function,al=x.Math,ll=x.Object,sl=x.RegExp,hl=x.String,pl=x.TypeError,_l=il.prototype,vl=cl.prototype,gl=ll.prototype,yl=x["__core-js_shared__"],dl=vl.toString,bl=gl.hasOwnProperty,wl=0,ml=function(){var n=/[^.]+$/.exec(yl&&yl.keys&&yl.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),xl=gl.toString,jl=dl.call(ll),Al=re._,kl=sl("^"+dl.call(bl).replace(St,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ol=ie?x.Buffer:X,Il=x.Symbol,Rl=x.Uint8Array,zl=Ol?Ol.allocUnsafe:X,El=F(ll.getPrototypeOf,ll),Sl=ll.create,Wl=gl.propertyIsEnumerable,Ll=_l.splice,Cl=Il?Il.isConcatSpreadable:X,Ul=Il?Il.iterator:X,Bl=Il?Il.toStringTag:X,Tl=function(){


return n.forEach(function(n){r[++t]=n}),r}function q(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function Z(n,t,r){for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}function V(n){return T(n)?J(n):_e(n)}function G(n){return T(n)?Y(n):p(n)}function H(n){for(var t=n.length;t--&&Ct.test(n.charAt(t)););return t}function J(n){for(var t=Mr.lastIndex=0;Mr.test(n);)++t;return t}function Y(n){return n.match(Mr)||[];


for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function b(n){return n!==n}function w(n,t){var r=null==n?0:n.length;return r?k(n,t)/r:Cn}function m(n){return function(t){return null==t?X:t[n]}}function x(n){return function(t){return null==n?X:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)}),r}function A(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}function k(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==X&&(r=r===X?i:r+i);


}return r}function O(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function I(n,t){return c(t,function(t){return[t,n[t]]})}function R(n){return n?n.slice(0,H(n)+1).replace(Lt,""):n}function z(n){return function(t){return n(t)}}function E(n,t){return c(t,function(t){return n[t]})}function S(n,t){return n.has(t)}function W(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;


    writable:!0})}:La,js=uu,As=$l||function(n){return re.clearTimeout(n)},ks=es&&1/P(new es([,-0]))[1]==Sn?function(n){return new es(n)}:Da,Os=os?function(n){return os.get(n)}:Da,Is=Pl?function(n){return null==n?[]:(n=ll(n),i(Pl(n),function(t){return Wl.call(n,t)}))}:Pa,Rs=Pl?function(n){for(var t=[];n;)a(t,Is(n)),n=El(n);return t}:Pa,zs=we;(ns&&zs(new ns(new ArrayBuffer(1)))!=ct||ts&&zs(new ts)!=Gn||rs&&zs(rs.resolve())!=Qn||es&&zs(new es)!=tt||us&&zs(new us)!=it)&&(zs=function(n){var t=we(n),r=t==Yn?n.constructor:X,e=r?to(r):"";
    if(e)switch(e){case cs:return ct;case as:return Gn;case ls:return Qn;case ss:return tt;case hs:return it}return t});var Es=yl?uc:qa,Ss=Qi(ms),Ws=Ml||function(n,t){return re.setTimeout(n,t)},Ls=Qi(xs),Cs=Pi(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(Et,function(n,r,e,u){t.push(e?u.replace(Mt,"$1"):r||n)}),t}),Us=uu(function(n,t){return Jf(n)?Hr(n,ee(t,1,Jf,!0)):[]}),Bs=uu(function(n,t){var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),mi(r,2)):[]}),Ts=uu(function(n,t){


c=c.slice(0,s===X?f:s)}}else if(n.indexOf(vu(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e}function Ia(n){return n=Ec(n),n&&jt.test(n)?n.replace(mt,ye):n}function Ra(n,t,r){return n=Ec(n),t=r?X:t,t===X?$(n)?Q(n):_(n):n.match(t)||[]}function za(t){var r=null==t?0:t.length,e=mi();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new pl(en);return[e(n[0]),n[1]]}):[],uu(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})}function Ea(n){


return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!!(null==n?0:n.length)&&y(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);


    }return r}function O(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function I(n,t){return c(t,function(t){return[t,n[t]]})}function R(n){return n?n.slice(0,H(n)+1).replace(Lt,""):n}function z(n){return function(t){return n(t)}}function E(n,t){return c(t,function(t){return n[t]})}function S(n,t){return n.has(t)}function W(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;
    return e}function U(n){return"\\"+Yr[n]}function B(n,t){return null==n?X:n[t]}function T(n){return Nr.test(n)}function $(n){return Pr.test(n)}function D(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function M(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function F(n,t){return function(r){return n(t(r))}}function N(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==cn||(n[r]=cn,i[u++]=r)}return i}function P(n){var t=-1,r=Array(n.size);


    return e}function U(n){return"\\"+Yr[n]}function B(n,t){return null==n?X:n[t]}function T(n){return Nr.test(n)}function $(n){return Pr.test(n)}function D(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function M(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function F(n,t){return function(r){return n(t(r))}}function N(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==cn||(n[r]=cn,i[u++]=r)}return i}function P(n){var t=-1,r=Array(n.size);
    return n.forEach(function(n){r[++t]=n}),r}function q(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function Z(n,t,r){for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}function V(n){return T(n)?J(n):_e(n)}function G(n){return T(n)?Y(n):p(n)}function H(n){for(var t=n.length;t--&&Ct.test(n.charAt(t)););return t}function J(n){for(var t=Mr.lastIndex=0;Mr.test(n);)++t;return t}function Y(n){return n.match(Mr)||[];


writable:!0})}:La,js=uu,As=$l||function(n){return re.clearTimeout(n)},ks=es&&1/P(new es([,-0]))[1]==Sn?function(n){return new es(n)}:Da,Os=os?function(n){return os.get(n)}:Da,Is=Pl?function(n){return null==n?[]:(n=ll(n),i(Pl(n),function(t){return Wl.call(n,t)}))}:Pa,Rs=Pl?function(n){for(var t=[];n;)a(t,Is(n)),n=El(n);return t}:Pa,zs=we;(ns&&zs(new ns(new ArrayBuffer(1)))!=ct||ts&&zs(new ts)!=Gn||rs&&zs(rs.resolve())!=Qn||es&&zs(new es)!=tt||us&&zs(new us)!=it)&&(zs=function(n){var t=we(n),r=t==Yn?n.constructor:X,e=r?to(r):"";


(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function e(n,t){for(var r=null==n?0:n.length;r--&&t(n[r],r,n)!==!1;);return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;
    return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!!(null==n?0:n.length)&&y(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);


var v=Xh(function(){return cl(f,p+"return "+s).apply(X,c)});if(v.source=s,rc(v))throw v;return v}function ma(n){return Ec(n).toLowerCase()}function xa(n){return Ec(n).toUpperCase()}function ja(n,t,r){if(n=Ec(n),n&&(r||t===X))return R(n);if(!n||!(t=vu(t)))return n;var e=G(n),u=G(t);return Ou(e,W(e,u),L(e,u)+1).join("")}function Aa(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.slice(0,H(n)+1);if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,0,L(e,G(t))+1).join("")}function ka(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.replace(Lt,"");


}function Va(){return!0}function Ga(n,t){if(n=kc(n),n<1||n>Wn)return[];var r=Un,e=Hl(n,Un);t=mi(t),n-=Un;for(var u=O(e,t);++r<n;)t(r);return u}function Ha(n){return bh(n)?c(n,no):bc(n)?[n]:Tu(Cs(Ec(n)))}function Ja(n){var t=++wl;return Ec(n)+t}function Ya(n){return n&&n.length?Yr(n,La,me):X}function Qa(n,t){return n&&n.length?Yr(n,mi(t,2),me):X}function Xa(n){return w(n,La)}function nl(n,t){return w(n,mi(t,2))}function tl(n){return n&&n.length?Yr(n,La,Ne):X}function rl(n,t){return n&&n.length?Yr(n,mi(t,2),Ne):X;


return Nr(Fr(n,an))}function Sa(n){return function(){return n}}function Wa(n,t){return null==n||n!==n?t:n}function La(n){return n}function Ca(n){return De("function"==typeof n?n:Fr(n,an))}function Ua(n){return qe(Fr(n,an))}function Ba(n,t){return Ze(n,Fr(t,an))}function Ta(n,t,e){var u=Pc(t),i=fe(t,u);null!=e||fc(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=fe(t,Pc(t)));var o=!(fc(e)&&"chain"in e&&!e.chain),f=uc(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;


return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.split("")}function _(n){return n.match($t)||[]}function v(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,!1}),e}function g(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){return t===t?Z(n,t,r):g(n,b,r)}function d(n,t,r,e){


    if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,W(e,G(t))).join("")}function Oa(n,t){var r=An,e=kn;if(fc(t)){var u="separator"in t?t.separator:u;r="length"in t?kc(t.length):r,e="omission"in t?vu(t.omission):e}n=Ec(n);var i=n.length;if(T(n)){var o=G(n);i=o.length}if(r>=i)return n;var f=r-V(e);if(f<1)return e;var c=o?Ou(o,0,f).join(""):n.slice(0,f);if(u===X)return c+e;if(o&&(f+=c.length-f),Ah(u)){if(n.slice(f).search(u)){var a,l=c;for(u.global||(u=sl(u.source,Ec(Nt.exec(u))+"g")),u.lastIndex=0;a=u.exec(l);)var s=a.index;
    c=c.slice(0,s===X?f:s)}}else if(n.indexOf(vu(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e}function Ia(n){return n=Ec(n),n&&jt.test(n)?n.replace(mt,ye):n}function Ra(n,t,r){return n=Ec(n),t=r?X:t,t===X?$(n)?Q(n):_(n):n.match(t)||[]}function za(t){var r=null==t?0:t.length,e=mi();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new pl(en);return[e(n[0]),n[1]]}):[],uu(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})}function Ea(n){


(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function e(n,t){for(var r=null==n?0:n.length;r--&&t(n[r],r,n)!==!1;);return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;


    ir.prototype.get=cr,ir.prototype.has=ar,ir.prototype.set=lr,sr.prototype.clear=hr,sr.prototype.delete=pr,sr.prototype.get=_r,sr.prototype.has=vr,sr.prototype.set=gr,yr.prototype.add=yr.prototype.push=dr,yr.prototype.has=br,wr.prototype.clear=mr,wr.prototype.delete=xr,wr.prototype.get=jr,wr.prototype.has=Ar,wr.prototype.set=kr;var ys=Pu(ue),ds=Pu(oe,!0),bs=qu(),ws=qu(!0),ms=os?function(n,t){return os.set(n,t),n}:La,xs=Tl?function(n,t){return Tl(n,"toString",{configurable:!0,enumerable:!1,value:Sa(t),
    writable:!0})}:La,js=uu,As=$l||function(n){return re.clearTimeout(n)},ks=es&&1/P(new es([,-0]))[1]==Sn?function(n){return new es(n)}:Da,Os=os?function(n){return os.get(n)}:Da,Is=Pl?function(n){return null==n?[]:(n=ll(n),i(Pl(n),function(t){return Wl.call(n,t)}))}:Pa,Rs=Pl?function(n){for(var t=[];n;)a(t,Is(n)),n=El(n);return t}:Pa,zs=we;(ns&&zs(new ns(new ArrayBuffer(1)))!=ct||ts&&zs(new ts)!=Gn||rs&&zs(rs.resolve())!=Qn||es&&zs(new es)!=tt||us&&zs(new us)!=it)&&(zs=function(n){var t=we(n),r=t==Yn?n.constructor:X,e=r?to(r):"";


    return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!!(null==n?0:n.length)&&y(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);
    return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.split("")}function _(n){return n.match($t)||[]}function v(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,!1}),e}function g(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){return t===t?Z(n,t,r):g(n,b,r)}function d(n,t,r,e){


if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Tu(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function $a(){return re._===this&&(re._=Al),this}function Da(){}function Ma(n){return n=kc(n),uu(function(t){return Ge(t,n)})}function Fa(n){return Bi(n)?m(no(n)):Qe(n)}function Na(n){return function(t){return null==n?X:_e(n,t)}}function Pa(){return[]}function qa(){return!1}function Za(){return{}}function Ka(){return"";


}return r}function O(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function I(n,t){return c(t,function(t){return[t,n[t]]})}function R(n){return n?n.slice(0,H(n)+1).replace(Lt,""):n}function z(n){return function(t){return n(t)}}function E(n,t){return c(t,function(t){return n[t]})}function S(n,t){return n.has(t)}function W(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;


return n.forEach(function(n){r[++t]=n}),r}function q(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function Z(n,t,r){for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}function V(n){return T(n)?J(n):_e(n)}function G(n){return T(n)?Y(n):p(n)}function H(n){for(var t=n.length;t--&&Ct.test(n.charAt(t)););return t}function J(n){for(var t=Mr.lastIndex=0;Mr.test(n);)++t;return t}function Y(n){return n.match(Mr)||[];


if(e)switch(e){case cs:return ct;case as:return Gn;case ls:return Qn;case ss:return tt;case hs:return it}return t});var Es=yl?uc:qa,Ss=Qi(ms),Ws=Ml||function(n,t){return re.setTimeout(n,t)},Ls=Qi(xs),Cs=Pi(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(Et,function(n,r,e,u){t.push(e?u.replace(Mt,"$1"):r||n)}),t}),Us=uu(function(n,t){return Jf(n)?Hr(n,ee(t,1,Jf,!0)):[]}),Bs=uu(function(n,t){var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),mi(r,2)):[]}),Ts=uu(function(n,t){


return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!!(null==n?0:n.length)&&y(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);


return e}function U(n){return"\\"+Yr[n]}function B(n,t){return null==n?X:n[t]}function T(n){return Nr.test(n)}function $(n){return Pr.test(n)}function D(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function M(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function F(n,t){return function(r){return n(t(r))}}function N(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==cn||(n[r]=cn,i[u++]=r)}return i}function P(n){var t=-1,r=Array(n.size);


    for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function b(n){return n!==n}function w(n,t){var r=null==n?0:n.length;return r?k(n,t)/r:Cn}function m(n){return function(t){return null==t?X:t[n]}}function x(n){return function(t){return null==n?X:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)}),r}function A(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}function k(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==X&&(r=r===X?i:r+i);
    }return r}function O(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function I(n,t){return c(t,function(t){return[t,n[t]]})}function R(n){return n?n.slice(0,H(n)+1).replace(Lt,""):n}function z(n){return function(t){return n(t)}}function E(n,t){return c(t,function(t){return n[t]})}function S(n,t){return n.has(t)}function W(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;


    var v=Xh(function(){return cl(f,p+"return "+s).apply(X,c)});if(v.source=s,rc(v))throw v;return v}function ma(n){return Ec(n).toLowerCase()}function xa(n){return Ec(n).toUpperCase()}function ja(n,t,r){if(n=Ec(n),n&&(r||t===X))return R(n);if(!n||!(t=vu(t)))return n;var e=G(n),u=G(t);return Ou(e,W(e,u),L(e,u)+1).join("")}function Aa(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.slice(0,H(n)+1);if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,0,L(e,G(t))+1).join("")}function ka(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.replace(Lt,"");
    if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,W(e,G(t))).join("")}function Oa(n,t){var r=An,e=kn;if(fc(t)){var u="separator"in t?t.separator:u;r="length"in t?kc(t.length):r,e="omission"in t?vu(t.omission):e}n=Ec(n);var i=n.length;if(T(n)){var o=G(n);i=o.length}if(r>=i)return n;var f=r-V(e);if(f<1)return e;var c=o?Ou(o,0,f).join(""):n.slice(0,f);if(u===X)return c+e;if(o&&(f+=c.length-f),Ah(u)){if(n.slice(f).search(u)){var a,l=c;for(u.global||(u=sl(u.source,Ec(Nt.exec(u))+"g")),u.lastIndex=0;a=u.exec(l);)var s=a.index;


    c=c.slice(0,s===X?f:s)}}else if(n.indexOf(vu(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e}function Ia(n){return n=Ec(n),n&&jt.test(n)?n.replace(mt,ye):n}function Ra(n,t,r){return n=Ec(n),t=r?X:t,t===X?$(n)?Q(n):_(n):n.match(t)||[]}function za(t){var r=null==t?0:t.length,e=mi();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new pl(en);return[e(n[0]),n[1]]}):[],uu(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})}function Ea(n){
    return Nr(Fr(n,an))}function Sa(n){return function(){return n}}function Wa(n,t){return null==n||n!==n?t:n}function La(n){return n}function Ca(n){return De("function"==typeof n?n:Fr(n,an))}function Ua(n){return qe(Fr(n,an))}function Ba(n,t){return Ze(n,Fr(t,an))}function Ta(n,t,e){var u=Pc(t),i=fe(t,u);null!=e||fc(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=fe(t,Pc(t)));var o=!(fc(e)&&"chain"in e&&!e.chain),f=uc(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;


window.onpageshow=function(event) {
	browserHistoryCacheBuster(event);
};

The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.


function browserHistoryCacheBuster(event) {
	if (location.href.indexOf('Modules.php?') === -1) {
		// Current page is not Modules.php, no login required, skip.
		return;
	}

	// persisted indicates if the document is loading from a cache (not reliable)
	if ((event && event.persisted)
		|| window.performance && (performance.navigation.type == 2
			|| (performance.getEntriesByType
				&& performance.getEntriesByType("navigation")[0]
				&& performance.getEntriesByType("navigation")[0].type === 'back_forward'))) {
		location.reload();
	}
}


function scheduleLivePoll() {
  let ti = parseInt(localStorage.sidekiqTimeInterval) || 5000;
  if (ti < 2000) { ti = 2000 }
  livePollTimer = setTimeout(livePollCallback, ti);
}

Insufficient Verification of Data Authenticity

The product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.