this.primevue = this.primevue || {};
this.primevue.utils = (function (exports, dayjs) {
    'use strict';

    function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

    var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);

    var DomHandler = {
        innerWidth(el) {
            if (el) {
                let width = el.offsetWidth;
                let style = getComputedStyle(el);

                width += parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);

                return width;
            }

            return 0;
        },

        width(el) {
            if (el) {
                let width = el.offsetWidth;
                let style = getComputedStyle(el);

                width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);

                return width;
            }

            return 0;
        },

        getWindowScrollTop() {
            let doc = document.documentElement;

            return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
        },

        getWindowScrollLeft() {
            let doc = document.documentElement;

            return (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
        },

        getOuterWidth(el, margin) {
            if (el) {
                let width = el.offsetWidth;

                if (margin) {
                    let style = getComputedStyle(el);

                    width += parseFloat(style.marginLeft) + parseFloat(style.marginRight);
                }

                return width;
            }

            return 0;
        },

        getOuterHeight(el, margin) {
            if (el) {
                let height = el.offsetHeight;

                if (margin) {
                    let style = getComputedStyle(el);

                    height += parseFloat(style.marginTop) + parseFloat(style.marginBottom);
                }

                return height;
            }

            return 0;
        },

        getClientHeight(el, margin) {
            if (el) {
                let height = el.clientHeight;

                if (margin) {
                    let style = getComputedStyle(el);

                    height += parseFloat(style.marginTop) + parseFloat(style.marginBottom);
                }

                return height;
            }

            return 0;
        },

        getViewport() {
            let win = window,
                d = document,
                e = d.documentElement,
                g = d.getElementsByTagName('body')[0],
                w = win.innerWidth || e.clientWidth || g.clientWidth,
                h = win.innerHeight || e.clientHeight || g.clientHeight;

            return { width: w, height: h };
        },

        getOffset(el) {
            if (el) {
                let rect = el.getBoundingClientRect();

                return {
                    top: rect.top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0),
                    left: rect.left + (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0)
                };
            }

            return {
                top: 'auto',
                left: 'auto'
            };
        },

        index(element) {
            if (element) {
                let children = element.parentNode.childNodes;
                let num = 0;

                for (let i = 0; i < children.length; i++) {
                    if (children[i] === element) return num;
                    if (children[i].nodeType === 1) num++;
                }
            }

            return -1;
        },

        addMultipleClasses(element, className) {
            if (element && className) {
                if (element.classList) {
                    let styles = className.split(' ');

                    for (let i = 0; i < styles.length; i++) {
                        element.classList.add(styles[i]);
                    }
                } else {
                    let styles = className.split(' ');

                    for (let i = 0; i < styles.length; i++) {
                        element.className += ' ' + styles[i];
                    }
                }
            }
        },

        addClass(element, className) {
            if (element && className) {
                if (element.classList) element.classList.add(className);
                else element.className += ' ' + className;
            }
        },

        removeClass(element, className) {
            if (element && className) {
                if (element.classList) element.classList.remove(className);
                else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
            }
        },

        hasClass(element, className) {
            if (element) {
                if (element.classList) return element.classList.contains(className);
                else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
            }

            return false;
        },

        find(element, selector) {
            return this.isElement(element) ? element.querySelectorAll(selector) : [];
        },

        findSingle(element, selector) {
            return this.isElement(element) ? element.querySelector(selector) : null;
        },

        getHeight(el) {
            if (el) {
                let height = el.offsetHeight;
                let style = getComputedStyle(el);

                height -= parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);

                return height;
            }

            return 0;
        },

        getWidth(el) {
            if (el) {
                let width = el.offsetWidth;
                let style = getComputedStyle(el);

                width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth);

                return width;
            }

            return 0;
        },

        absolutePosition(element, target) {

            //增加支持适当调整对接的位置的参数，这样弹出的层跟原来的对象有一定的距离，不会粘在一块
            let offset={x:0  ,y:0 };

             if(arguments.length>2){
                let { x=0, y =0 } = arguments[2];

                offset.x= x;
                offset.y= y;
             }
            
            if (element) {
                let elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element);
                let elementOuterHeight = elementDimensions.height;
                let elementOuterWidth = elementDimensions.width;
                let targetOuterHeight = target.offsetHeight;
                let targetOuterWidth = target.offsetWidth;
                let targetOffset = target.getBoundingClientRect();
                let windowScrollTop = this.getWindowScrollTop();
                let windowScrollLeft = this.getWindowScrollLeft();
                let viewport = this.getViewport();
                let top, left;

                if (targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height ) {
                    top = targetOffset.top + windowScrollTop - elementOuterHeight - offset.y ;
                    element.style.transformOrigin = 'bottom';

                    if (top < 0) {
                        top = windowScrollTop;
                    }
                } else {
                    top = targetOuterHeight + targetOffset.top + windowScrollTop + offset.y ;
                    element.style.transformOrigin = 'top';
                }

                if (targetOffset.left + elementOuterWidth > viewport.width) left = Math.max(0, targetOffset.left + windowScrollLeft + targetOuterWidth - elementOuterWidth - offset.x );
                else left = targetOffset.left + windowScrollLeft + offset.x ;

                element.style.top = top   +'px';
                element.style.left = left + 'px';
            }
        },

        relativePosition(element, target) {
           
            if (element) {
                let elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element);
                const targetHeight = target.offsetHeight;
                const targetOffset = target.getBoundingClientRect();
                const viewport = this.getViewport();
                let top, left;

                if (targetOffset.top + targetHeight + elementDimensions.height > viewport.height) {
                    top = -1 * elementDimensions.height  ;
                    element.style.transformOrigin = 'bottom';

                    if (targetOffset.top + top < 0) {
                        top = -1 * targetOffset.top;
                    }
                } else {
                    top = targetHeight ;
                    element.style.transformOrigin = 'top';
                }

                if (elementDimensions.width > viewport.width) {
                    // element wider then viewport and cannot fit on screen (align at left side of viewport)
                    left = targetOffset.left * -1  ;
                } else if (targetOffset.left + elementDimensions.width > viewport.width) {
                    // element wider then viewport but can be fit on screen (align at right side of viewport)
                    left = (targetOffset.left + elementDimensions.width - viewport.width) * -1;
                } else {
                    // element fits on screen (align with target)
                    left = 0;
                }

                element.style.top = top + 'px';
                element.style.left = left + 'px';
            }
        },

        getParents(element, parents = []) {
            return element['parentNode'] === null ? parents : this.getParents(element.parentNode, parents.concat([element.parentNode]));
        },

        getScrollableParents(element) {
            let scrollableParents = [];

            if (element) {
                let parents = this.getParents(element);
                const overflowRegex = /(auto|scroll)/;

                const overflowCheck = (node) => {
                    let styleDeclaration = window['getComputedStyle'](node, null);

                    return overflowRegex.test(styleDeclaration.getPropertyValue('overflow')) || overflowRegex.test(styleDeclaration.getPropertyValue('overflowX')) || overflowRegex.test(styleDeclaration.getPropertyValue('overflowY'));
                };

                for (let parent of parents) {
                    let scrollSelectors = parent.nodeType === 1 && parent.dataset['scrollselectors'];

                    if (scrollSelectors) {
                        let selectors = scrollSelectors.split(',');

                        for (let selector of selectors) {
                            let el = this.findSingle(parent, selector);

                            if (el && overflowCheck(el)) {
                                scrollableParents.push(el);
                            }
                        }
                    }

                    if (parent.nodeType !== 9 && overflowCheck(parent)) {
                        scrollableParents.push(parent);
                    }
                }
            }

            return scrollableParents;
        },

        getHiddenElementOuterHeight(element) {
            if (element) {
                element.style.visibility = 'hidden';
                element.style.display = 'block';
                let elementHeight = element.offsetHeight;

                element.style.display = 'none';
                element.style.visibility = 'visible';

                return elementHeight;
            }

            return 0;
        },

        getHiddenElementOuterWidth(element) {
            if (element) {
                element.style.visibility = 'hidden';
                element.style.display = 'block';
                let elementWidth = element.offsetWidth;

                element.style.display = 'none';
                element.style.visibility = 'visible';

                return elementWidth;
            }

            return 0;
        },

        getHiddenElementDimensions(element) {
            if (element) {
                let dimensions = {};

                element.style.visibility = 'hidden';
                element.style.display = 'block';
                dimensions.width = element.offsetWidth;
                dimensions.height = element.offsetHeight;
                element.style.display = 'none';
                element.style.visibility = 'visible';

                return dimensions;
            }

            return 0;
        },

        fadeIn(element, duration) {
            if (element) {
                element.style.opacity = 0;

                let last = +new Date();
                let opacity = 0;

                let tick = function () {
                    opacity = +element.style.opacity + (new Date().getTime() - last) / duration;
                    element.style.opacity = opacity;
                    last = +new Date();

                    if (+opacity < 1) {
                        (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);
                    }
                };

                tick();
            }
        },

        fadeOut(element, ms) {
            if (element) {
                let opacity = 1,
                    interval = 50,
                    duration = ms,
                    gap = interval / duration;

                let fading = setInterval(() => {
                    opacity -= gap;

                    if (opacity <= 0) {
                        opacity = 0;
                        clearInterval(fading);
                    }

                    element.style.opacity = opacity;
                }, interval);
            }
        },

        getUserAgent() {
            return navigator.userAgent;
        },

        appendChild(element, target) {
            if (this.isElement(target)) target.appendChild(element);
            else if (target.el && target.elElement) target.elElement.appendChild(element);
            else throw new Error('Cannot append ' + target + ' to ' + element);
        },

        isElement(obj) {
            return typeof HTMLElement === 'object' ? obj instanceof HTMLElement : obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string';
        },

        scrollInView(container, item) {
            let borderTopValue = getComputedStyle(container).getPropertyValue('borderTopWidth');
            let borderTop = borderTopValue ? parseFloat(borderTopValue) : 0;
            let paddingTopValue = getComputedStyle(container).getPropertyValue('paddingTop');
            let paddingTop = paddingTopValue ? parseFloat(paddingTopValue) : 0;
            let containerRect = container.getBoundingClientRect();
            let itemRect = item.getBoundingClientRect();
            let offset = itemRect.top + document.body.scrollTop - (containerRect.top + document.body.scrollTop) - borderTop - paddingTop;
            let scroll = container.scrollTop;
            let elementHeight = container.clientHeight;
            let itemHeight = this.getOuterHeight(item);

            if (offset < 0) {
                container.scrollTop = scroll + offset;
            } else if (offset + itemHeight > elementHeight) {
                container.scrollTop = scroll + offset - elementHeight + itemHeight;
            }
        },

        clearSelection() {
            if (window.getSelection) {
                if (window.getSelection().empty) {
                    window.getSelection().empty();
                } else if (window.getSelection().removeAllRanges && window.getSelection().rangeCount > 0 && window.getSelection().getRangeAt(0).getClientRects().length > 0) {
                    window.getSelection().removeAllRanges();
                }
            } else if (document['selection'] && document['selection'].empty) {
                try {
                    document['selection'].empty();
                } catch (error) {
                    //ignore IE bug
                }
            }
        },

        getSelection() {
            if (window.getSelection) return window.getSelection().toString();
            else if (document.getSelection) return document.getSelection().toString();
            else if (document['selection']) return document['selection'].createRange().text;

            return null;
        },

        calculateScrollbarWidth() {
            if (this.calculatedScrollbarWidth != null) return this.calculatedScrollbarWidth;

            let scrollDiv = document.createElement('div');

            scrollDiv.className = 'p-scrollbar-measure';
            document.body.appendChild(scrollDiv);

            let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;

            document.body.removeChild(scrollDiv);

            this.calculatedScrollbarWidth = scrollbarWidth;

            return scrollbarWidth;
        },

        getBrowser() {
            if (!this.browser) {
                let matched = this.resolveUserAgent();

                this.browser = {};

                if (matched.browser) {
                    this.browser[matched.browser] = true;
                    this.browser['version'] = matched.version;
                }

                if (this.browser['chrome']) {
                    this.browser['webkit'] = true;
                } else if (this.browser['webkit']) {
                    this.browser['safari'] = true;
                }
            }

            return this.browser;
        },

        resolveUserAgent() {
            let ua = navigator.userAgent.toLowerCase();
            let match = /(chrome)[ ]([\w.]+)/.exec(ua) || /(webkit)[ ]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ ]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || (ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)) || [];

            return {
                browser: match[1] || '',
                version: match[2] || '0'
            };
        },

        isVisible(element) {
            return element && element.offsetParent != null;
        },

        invokeElementMethod(element, methodName, args) {
            element[methodName].apply(element, args);
        },

        isExist(element) {
            return !!(element !== null && typeof element !== 'undefined' && element.nodeName && element.parentNode);
        },

        isClient() {
            return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
        },

        focus(el, options) {
            el && document.activeElement !== el && el.focus(options);
        },

        isFocusableElement(element, selector = '') {
            return this.isElement(element)
                ? element.matches(`button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                [href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}`)
                : false;
        },

        getFocusableElements(element, selector = '') {
            let focusableElements = this.find(
                element,
                `button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                [href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector},
                [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${selector}`
            );

            let visibleFocusableElements = [];

            for (let focusableElement of focusableElements) {
                if (getComputedStyle(focusableElement).display != 'none' && getComputedStyle(focusableElement).visibility != 'hidden') visibleFocusableElements.push(focusableElement);
            }

            return visibleFocusableElements;
        },

        getFirstFocusableElement(element, selector) {
            const focusableElements = this.getFocusableElements(element, selector);

            return focusableElements.length > 0 ? focusableElements[0] : null;
        },

        getLastFocusableElement(element, selector) {
            const focusableElements = this.getFocusableElements(element, selector);

            return focusableElements.length > 0 ? focusableElements[focusableElements.length - 1] : null;
        },

        getNextFocusableElement(container, element, selector) {
            const focusableElements = this.getFocusableElements(container, selector);
            const index = focusableElements.length > 0 ? focusableElements.findIndex((el) => el === element) : -1;
            const nextIndex = index > -1 && focusableElements.length >= index + 1 ? index + 1 : -1;

            return nextIndex > -1 ? focusableElements[nextIndex] : null;
        },

        isClickable(element) {
            if (element) {
                const targetNode = element.nodeName;
                const parentNode = element.parentElement && element.parentElement.nodeName;

                return (
                    targetNode === 'INPUT' ||
                    targetNode === 'TEXTAREA' ||
                    targetNode === 'BUTTON' ||
                    targetNode === 'A' ||
                    parentNode === 'INPUT' ||
                    parentNode === 'TEXTAREA' ||
                    parentNode === 'BUTTON' ||
                    parentNode === 'A' ||
                    !!element.closest('.p-button, .p-checkbox, .p-radiobutton')
                );
            }

            return false;
        },

        applyStyle(element, style) {
            if (typeof style === 'string') {
                element.style.cssText = style;
            } else {
                for (let prop in style) {
                    element.style[prop] = style[prop];
                }
            }
        },

        isIOS() {
            return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window['MSStream'];
        },

        isAndroid() {
            return /(android)/i.test(navigator.userAgent);
        },

        isTouchDevice() {
            return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
        },

        exportCSV(csv, filename) {
            let blob = new Blob([csv], {
                type: 'application/csv;charset=utf-8;'
            });

            if (window.navigator.msSaveOrOpenBlob) {
                navigator.msSaveOrOpenBlob(blob, filename + '.csv');
            } else {
                let link = document.createElement('a');

                if (link.download !== undefined) {
                    link.setAttribute('href', URL.createObjectURL(blob));
                    link.setAttribute('download', filename + '.csv');
                    link.style.display = 'none';
                    document.body.appendChild(link);
                    link.click();
                    document.body.removeChild(link);
                } else {
                    csv = 'data:text/csv;charset=utf-8,' + csv;
                    window.open(encodeURI(csv));
                }
            }
        }
    };

    class ConnectedOverlayScrollHandler {
        constructor(element, listener = () => {}) {
            this.element = element;
            this.listener = listener;
        }

        bindScrollListener() {
            this.scrollableParents = DomHandler.getScrollableParents(this.element);

            for (let i = 0; i < this.scrollableParents.length; i++) {
                this.scrollableParents[i].addEventListener('scroll', this.listener);
            }
        }

        unbindScrollListener() {
            if (this.scrollableParents) {
                for (let i = 0; i < this.scrollableParents.length; i++) {
                    this.scrollableParents[i].removeEventListener('scroll', this.listener);
                }
            }
        }

        destroy() {
            this.unbindScrollListener();
            this.element = null;
            this.listener = null;
            this.scrollableParents = null;
        }
    }

    function primebus() {
        const allHandlers = new Map();

        return {
            on(type, handler) {
                let handlers = allHandlers.get(type);

                if (!handlers) handlers = [handler];
                else handlers.push(handler);

                allHandlers.set(type, handlers);
            },

            off(type, handler) {
                let handlers = allHandlers.get(type);

                if (handlers) {
                    handlers.splice(handlers.indexOf(handler) >>> 0, 1);
                }
            },

            emit(type, evt) {
                let handlers = allHandlers.get(type);

                if (handlers) {
                    handlers.slice().map((handler) => {
                        handler(evt);
                    });
                }
            }
        };
    }

    var ObjectUtils = {
        equals(obj1, obj2, field) {
            if (field) return this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field);
            else return this.deepEquals(obj1, obj2);
        },

        deepEquals(a, b) {
            if (a === b) return true;

            if (a && b && typeof a == 'object' && typeof b == 'object') {
                var arrA = Array.isArray(a),
                    arrB = Array.isArray(b),
                    i,
                    length,
                    key;

                if (arrA && arrB) {
                    length = a.length;
                    if (length != b.length) return false;
                    for (i = length; i-- !== 0; ) if (!this.deepEquals(a[i], b[i])) return false;

                    return true;
                }

                if (arrA != arrB) return false;

                var dateA = a instanceof Date,
                    dateB = b instanceof Date;

                if (dateA != dateB) return false;
                if (dateA && dateB) return a.getTime() == b.getTime();

                var regexpA = a instanceof RegExp,
                    regexpB = b instanceof RegExp;

                if (regexpA != regexpB) return false;
                if (regexpA && regexpB) return a.toString() == b.toString();

                var keys = Object.keys(a);

                length = keys.length;

                if (length !== Object.keys(b).length) return false;

                for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;

                for (i = length; i-- !== 0; ) {
                    key = keys[i];
                    if (!this.deepEquals(a[key], b[key])) return false;
                }

                return true;
            }

            return a !== a && b !== b;
        },

        resolveFieldData(data, field) {
            if (data && Object.keys(data).length && field) {
                if (this.isFunction(field)) {
                    return field(data);
                } else if (field.indexOf('.') === -1) {
                    return data[field];
                } else {
                    let fields = field.split('.');
                    let value = data;

                    for (var i = 0, len = fields.length; i < len; ++i) {
                        if (value == null) {
                            return null;
                        }

                        value = value[fields[i]];
                    }

                    return value;
                }
            } else {
                return null;
            }
        },

        isFunction(obj) {
            return !!(obj && obj.constructor && obj.call && obj.apply);
        },

        getItemValue(obj, ...params) {
            return this.isFunction(obj) ? obj(...params) : obj;
        },

        filter(value, fields, filterValue) {
            var filteredItems = [];

            if (value) {
                for (let item of value) {
                    for (let field of fields) {
                        if (String(this.resolveFieldData(item, field)).toLowerCase().indexOf(filterValue.toLowerCase()) > -1) {
                            filteredItems.push(item);
                            break;
                        }
                    }
                }
            }

            return filteredItems;
        },

        reorderArray(value, from, to) {
            if (value && from !== to) {
                if (to >= value.length) {
                    to %= value.length;
                    from %= value.length;
                }

                value.splice(to, 0, value.splice(from, 1)[0]);
            }
        },

        findIndexInList(value, list) {
            let index = -1;

            if (list) {
                for (let i = 0; i < list.length; i++) {
                    if (list[i] === value) {
                        index = i;
                        break;
                    }
                }
            }

            return index;
        },

        contains(value, list) {
            if (value != null && list && list.length) {
                for (let val of list) {
                    if (this.equals(value, val)) return true;
                }
            }

            return false;
        },

        insertIntoOrderedArray(item, index, arr, sourceArr) {
            if (arr.length > 0) {
                let injected = false;

                for (let i = 0; i < arr.length; i++) {
                    let currentItemIndex = this.findIndexInList(arr[i], sourceArr);

                    if (currentItemIndex > index) {
                        arr.splice(i, 0, item);
                        injected = true;
                        break;
                    }
                }

                if (!injected) {
                    arr.push(item);
                }
            } else {
                arr.push(item);
            }
        },

        removeAccents(str) {
            if (str && str.search(/[\xC0-\xFF]/g) > -1) {
                str = str
                    .replace(/[\xC0-\xC5]/g, 'A')
                    .replace(/[\xC6]/g, 'AE')
                    .replace(/[\xC7]/g, 'C')
                    .replace(/[\xC8-\xCB]/g, 'E')
                    .replace(/[\xCC-\xCF]/g, 'I')
                    .replace(/[\xD0]/g, 'D')
                    .replace(/[\xD1]/g, 'N')
                    .replace(/[\xD2-\xD6\xD8]/g, 'O')
                    .replace(/[\xD9-\xDC]/g, 'U')
                    .replace(/[\xDD]/g, 'Y')
                    .replace(/[\xDE]/g, 'P')
                    .replace(/[\xE0-\xE5]/g, 'a')
                    .replace(/[\xE6]/g, 'ae')
                    .replace(/[\xE7]/g, 'c')
                    .replace(/[\xE8-\xEB]/g, 'e')
                    .replace(/[\xEC-\xEF]/g, 'i')
                    .replace(/[\xF1]/g, 'n')
                    .replace(/[\xF2-\xF6\xF8]/g, 'o')
                    .replace(/[\xF9-\xFC]/g, 'u')
                    .replace(/[\xFE]/g, 'p')
                    .replace(/[\xFD\xFF]/g, 'y');
            }

            return str;
        },

        getVNodeProp(vnode, prop) {
            let props = vnode.props;

            if (props) {
                let kebapProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
                let propName = Object.prototype.hasOwnProperty.call(props, kebapProp) ? kebapProp : prop;

                return vnode.type.props[prop].type === Boolean && props[propName] === '' ? true : props[propName];
            }

            return null;
        },

        convertToFlatCase(str) {
            // convert snake, kebab, camel and pascal cases to flat case
            return this.isNotEmpty(str) ? str.replace(/(-|_)/g, '').toLowerCase() : str;
        },

        isEmpty(value) {
            return value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0) || (!(value instanceof Date) && typeof value === 'object' && Object.keys(value).length === 0);
        },

        isNotEmpty(value) {
            return !this.isEmpty(value);
        },

        isPrintableCharacter(char = '') {
            return this.isNotEmpty(char) && char.length === 1 && char.match(/\S| /);
        },

        /**
         * Firefox-v103 does not currently support the "findLast" method. It is stated that this method will be supported with Firefox-v104.
         * https://caniuse.com/mdn-javascript_builtins_array_findlast
         */
        findLast(arr, callback) {
            let item;

            if (this.isNotEmpty(arr)) {
                try {
                    item = arr.findLast(callback);
                } catch {
                    item = [...arr].reverse().find(callback);
                }
            }

            return item;
        },

        /**
         * Firefox-v103 does not currently support the "findLastIndex" method. It is stated that this method will be supported with Firefox-v104.
         * https://caniuse.com/mdn-javascript_builtins_array_findlastindex
         */
        findLastIndex(arr, callback) {
            let index = -1;

            if (this.isNotEmpty(arr)) {
                try {
                    index = arr.findLastIndex(callback);
                } catch {
                    index = arr.lastIndexOf([...arr].reverse().find(callback));
                }
            }

            return index;
        },

        initailValue(initialValue, colType){
           
            colType =(colType)?colType.toLowerCase():'';
            let valueStr =initialValue.toString().toLowerCase();
            let newValue = initialValue;

            if(valueStr==='today'){
               newValue= new Date();
               newValue.setHours(0);
               newValue.setMinutes(0);
               newValue.setSeconds(0);
               newValue.setMilliseconds(0);
            }
            else if(valueStr==="now"){
                newValue=new Date();
            }

            if(colType){
                if(colType==='long'){
                    newValue = Number.parseInt(valueStr);
                }
                else if(colType==='number' || colType.startsWith("dec")){
                    newValue = Number.parseFloat(valueStr);
                }
                else if(colType==='bool' || colType=='boolean'){
                     newValue = Number.parseInt(valueStr)!==0? true:false;    
                }
            }

            return newValue;
        }
    };

    var lastId = 0;

    function UniqueComponentId (prefix = 'pv_id_') {
        lastId++;

        return `${prefix}${lastId}`;
    }

    function handler() {
        let zIndexes = [];

        const generateZIndex = (key, autoZIndex, baseZIndex = 999) => {
            const lastZIndex = getLastZIndex(key, autoZIndex, baseZIndex);
            const newZIndex = lastZIndex.value + (lastZIndex.key === key ? 0 : baseZIndex) + 1;

            zIndexes.push({ key, value: newZIndex });

            return newZIndex;
        };

        const revertZIndex = (zIndex) => {
            zIndexes = zIndexes.filter((obj) => obj.value !== zIndex);
        };

        const getCurrentZIndex = (key, autoZIndex) => {
            return getLastZIndex(key, autoZIndex).value;
        };

        const getLastZIndex = (key, autoZIndex, baseZIndex = 0) => {
            return [...zIndexes].reverse().find((obj) => (autoZIndex ? true : obj.key === key)) || { key, value: baseZIndex };
        };

        const getZIndex = (el) => {
            return el ? parseInt(el.style.zIndex, 10) || 0 : 0;
        };

        return {
            get: getZIndex,
            set: (key, el, baseZIndex) => {
                if (el) {
                    el.style.zIndex = String(generateZIndex(key, true, baseZIndex));
                }
            },
            clear: (el) => {
                if (el) {
                    revertZIndex(getZIndex(el));
                    el.style.zIndex = '';
                }
            },
            getCurrent: (key) => getCurrentZIndex(key, true)
        };
    }

    var ZIndexUtils = handler();

    let _lastRowId=0;

    const _RowStatus = {
      NotModified: 0,
      DataModified: 1,
      New: 2,
      NewModified: 3,
      Deleted:4
    };

    const _DataHandler= {
      
        /*----------对通过WEBAPI返回的数据进行代理处理，以满足Form和表格对数据行ID和状态的处理*/
        Proxy(data,rowId,fnUpdateModified){
            
            //如果传入的数据已经是Proxy对象，则不处理
            if(data['__dataProxy']==='1'){

                if(fnUpdateModified && data.fnUpdateModified===null){
                  data.fnUpdateModified=fnUpdateModified;
                }

                return data;
            }

            return new Proxy(data,
                {
                  _rowId:(rowId>0 )? rowId: ( ++_lastRowId ),
                  _isSelected:false,
                  _fnUpdateModified:fnUpdateModified ,

                  get(target,property){

                    if(property==='__dataProxy'){
                        return '1' ;
                     }

                    // axios和vue框架会读取对象的一些属性，为了避免这些框架读取这些属性时出现失败，所以不再检查属性是否存在
                    //调用 JSON.stringify会有toJSON , Vue里面复制 modelValue数据时，不知道为什么会有then的属性
                    if(property==='toJSON' || property==='then' || property==='append' || (typeof property)==='symbol' || property.startsWith("__")){
                       return target[property];
                    }

                    if(property==='resetUpdate'){
                        return ()=>{
                            target['originalData']=null;
                            if(target['rowStatus']!==_RowStatus.New)
                               target['rowStatus']=_RowStatus.NotModified;
                        };
                    }

                    if(property==='rowId' ){
                        return this._rowId;
                    }
                    else if(property==="isSelected"){
                       return this._isSelected;
                    }
                    else if(property==="fnUpdateModified"){
                      return this._fnUpdateModified || null;
                    }

                    if(!(property in target)){
                        if(property==='rowStatus'){
                           target[property] =  _RowStatus.NotModified;
                        }
                        else if(property==='originalData'){
                           return null;
                        }
                       // else {
                       //     throw new ReferenceError(`属性${property}不存在!`);
                       // }
                    }

                     const retValue= target[property];

                     return (retValue===undefined) ? null : retValue;   //如果属性不存在,返回null，方便代码简单只对值是否为 null 进行判断 
                  },

                  set(target,property,newValue){

                    if( (typeof property)==='symbol'){
                      target[property]= newValue;

                      return true;
                    }
                    else if(property==='__originalData'){
                      target['originalData']= newValue;

                      return true;
                    }
                    else if(property==="isSelected"){
                       this._isSelected=newValue;

                       return true;
                    }
                    else if(property==="fnUpdateModified"){
                      this._fnUpdateModified=newValue;

                      return true;
                   }


                    if( property==='rowId' || property==='originalData' )
                        throw new ReferenceError(`属性${property}是只读的。`);

                    // if(property!=='rowStatus' && !(property in target))
                    //    throw new ReferenceError(`属性${property}不存在!`);

                      if(target[property] === newValue)   //VUE的控件通过　v-ｍodel 绑定了对象属性，即使没有修改数据，也可能会解发更新model的值，导致数据状态被更新
                          return true ;

                      let original= target['originalData'] || null;
                      let rowStatus  = target['rowStatus'] ||  _RowStatus.NotModified ;

                      if(property==='rowStatus' ){
                           rowStatus =newValue;
                           target['rowStatus'] = newValue;
                           
                          if( rowStatus!== _RowStatus.DataModified || original!==null)
                            return true;
                       } 
                       else {
                            let newStatus = (rowStatus === _RowStatus.NotModified) ? _RowStatus.DataModified :
                                       ( rowStatus === _RowStatus.New) ? _RowStatus.NewModified : rowStatus;

                            if(newStatus!==rowStatus){
                              rowStatus=newStatus;
                              target['rowStatus'] = rowStatus;
                            }
                       }

                       //对任何一属性进行修改，都把当前对象的值赋值到orinialData对象，并修改当前对象的rowStatus的状态
                      if(original === null  && rowStatus === _RowStatus.DataModified && (property in target)  ){
                            original= {};
                            
                            for( let key in target){
                              if( (typeof key)!=='symbol'  && key !=='rowId' && key!=='rowStatus' && key!=='originalData'){
                                original[key] =target[key];
                              }
                          }
                          
                          target['originalData'] = original;

                          
                        }

                        target[property]= newValue;

                        //更新数据表格或表单的修改状态
                        if(this._fnUpdateModified &&  (typeof this._fnUpdateModified)==='function'){
                           this._fnUpdateModified(true);
                        }

                        return true;  //set方法需要返加true,否则会出现  trap returned falsish for property 的错误
                  },

                  has(target, property){
                    if(property==='__dataProxy' || property==='rowId' || property==="isSelected" || 
                       property==='rowStatus' || property==='originalData' || (typeof property)==='symbol' )
                        return true;

                      return (property in target);
                  },
                }
            )
        },

        Initialize(srcData,rowId,fnUpdateModified){
            let data={};

            for(let key in srcData){
               if((typeof key)==='symbol'  || key==='rowId' || key==="isSelected" || key==='rowStatus' || key==='originalData'  ) 
                  continue;

                const value = srcData[key];

                if(value==='boolean'){
                    data[key] = false;
                }
                else {
                   data[key]=null;
                }
            }

           let result= _DataHandler.Proxy(data,rowId,fnUpdateModified);

           result['isSelected']= false;
           result['rowStatus'] = _RowStatus.New;

           return result;
        },

        /*----------- 对删除的行，恢复记录原来的数据，并删除 originalData 的数据--------------------*/
        Restore(data){
            let original= data['originalData'] || null;

            data['rowStatus'] = _RowStatus.Deleted;   //先设置状态，后面更新数据的时候才不会去更新 originalData的数据

            for(let key in original){
                if((typeof key)==='symbol' || key==='rowId' || key==="isSelected" ||  key==='rowStatus' || key==='originalData'  ) 
                  continue;
                
                data[key] = original[key];
             }

            data['isSelected']=false;
            data['__originalData']=null;  //originalData的代理对象控制了为只读，所以通过特殊的属性来处理

            return data;
        }
    };

    function NumberFormat(value, format){
         
         const formatType = typeof format;
         let locale='zh-Hans-CN';
         let style='decimal';
         let currency='CNY';
         let currencyDisplay='symbol';
         let useGrouping=true;
         let maximumFractionDigits =2;
         let minimumFractionDigits =2; 
        
         if(format===null || format==='')
            return value;

         if(typeof value==='string'){
            value = Number.parseFloat(value);
            if(Number.isNaN(value))
                return 'NaN';
         }

         if(formatType ==='object'){
           const formater = new Intl.NumberFormat(locale, format );

           return formater.format(value || 0 );
         }

         if(formatType ==='string'){
            //如果是货币格式，在前面加货币代码
            let index= format.indexOf(":");

            if(index>0){
                currency = format.substring(0,index).toUpperCase().trim();
                format = format.substring(index+1);
                style ='currency';
            }
            else if(format.endsWith("%")){
                style="percent";
                format =format.substring(0,format.length -1);
            }
         }

         if(format.indexOf(",")<=0){
            useGrouping=false;
         }

         if(currency ==='RMB' || currency==='￥'){
            currency='CNY';
         }
         else if(currency==='$'){
            currency='USD';
         }

         if(format==='#,##0' || format ==='#,###' ){

            if( format ==='#,###'  && !value )
                return "";

            maximumFractionDigits=0;
            minimumFractionDigits =0;
         }
         
         else if(format==='0'){
            maximumFractionDigits=0;
            minimumFractionDigits =0;
         }
       
        const  formater =new Intl.NumberFormat(locale,{style, currency, currencyDisplay , useGrouping ,  maximumFractionDigits,minimumFractionDigits } ); 

        return formater.format(value || 0 );
    }


    function DateTimeFormat(value, format){
        if(value===null || value===undefined || value==='')
            return "";

        return dayjs__default["default"](value).format(format);
    }

    exports.ConnectedOverlayScrollHandler = ConnectedOverlayScrollHandler;
    exports.DataHandler = _DataHandler;
    exports.DateTimeFormat = DateTimeFormat;
    exports.DomHandler = DomHandler;
    exports.EventBus = primebus;
    exports.NumberFormat = NumberFormat;
    exports.ObjectUtils = ObjectUtils;
    exports.RowStatus = _RowStatus;
    exports.UniqueComponentId = UniqueComponentId;
    exports.ZIndexUtils = ZIndexUtils;

    Object.defineProperty(exports, '__esModule', { value: true });

    return exports;

})({}, dayjs);
