{"version":3,"file":"ej2.min.js","sources":["../node_modules/@syncfusion/ej2-base/dist/src/es5/util.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/dom.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/notify-property-change.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/animation.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/internationalization.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/template.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/template-engine.js","../node_modules/@syncfusion/ej2-buttons/dist/src/es5/common/common.js","../node_modules/@syncfusion/ej2-popups/dist/src/es5/common/position.js","../node_modules/@syncfusion/ej2-popups/dist/src/es5/common/collision.js","../node_modules/@syncfusion/ej2-popups/dist/src/es5/popup/popup.js","../node_modules/@syncfusion/ej2-popups/dist/src/es5/spinner/spinner.js","../node_modules/@syncfusion/ej2-splitbuttons/dist/src/es5/common/common.js","../node_modules/@syncfusion/ej2-inputs/dist/src/es5/maskedtextbox/base/mask-base.js","../node_modules/@syncfusion/ej2-lists/dist/src/es5/common/list-base.js","../node_modules/@syncfusion/ej2-file-utils/dist/src/es5/encoding.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/collections/utils.js","../node_modules/@syncfusion/ej2-svg-base/dist/src/es5/tooltip/interface.js","../node_modules/@syncfusion/ej2-svg-base/dist/src/es5/tooltip/helper.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/model/theme.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/utils/helper.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/model/acc-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/range-navigator/utils/helper.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/range-navigator/utils/theme.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/utils/helper.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/sparkline/utils/helper.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/utils/helper.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/utility/path-util.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/primitives/matrix.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/utility/base-util.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/utility/dom-util.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/dictionary/basic-shapes.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/dictionary/common.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/dictionary/flow-shapes.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/tooltip.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/utility/connector.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/connector.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/utility/constraints-util.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/ruler/ruler.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/utility/diagram-util.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/interaction/actions.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/bpmn.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/layout/symmetrical-layout.js","../node_modules/@syncfusion/ej2-dropdowns/dist/src/es5/common/incremental-search.js","../node_modules/@syncfusion/ej2-dropdowns/dist/src/es5/common/highlight-search.js","../node_modules/@syncfusion/ej2-dropdowns/dist/src/es5/multi-select/float-label.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/base/util.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/aria-service.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/aggregate.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/utils/helper.js","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/utils/helper.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/utils/helper.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/base/util.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/html-attributes.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/base/util.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/recurrence-editor/date-generator.js","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/utils/helper.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/ajax.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/event-handler.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/observer.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/base.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/browser.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/intl/intl-base.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/canvas-renderer.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/module-loader.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/child-property.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/intl/parser-base.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/intl/number-formatter.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/intl/date-formatter.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/component.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/intl/date-parser.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/intl/number-parser.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/draggable.js","../node_modules/@syncfusion/ej2-inputs/dist/src/es5/input/input.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/droppable.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/keyboard.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/l10n.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/svg-renderer.js","../node_modules/@syncfusion/ej2-base/dist/src/es5/touch.js","../node_modules/@syncfusion/ej2-buttons/dist/src/es5/button/button.js","../node_modules/@syncfusion/ej2-buttons/dist/src/es5/check-box/check-box.js","../node_modules/@syncfusion/ej2-buttons/dist/src/es5/radio-button/radio-button.js","../node_modules/@syncfusion/ej2-buttons/dist/src/es5/switch/switch.js","../node_modules/@syncfusion/ej2-popups/dist/src/es5/dialog/dialog.js","../node_modules/@syncfusion/ej2-popups/dist/src/es5/tooltip/tooltip.js","../node_modules/@syncfusion/ej2-splitbuttons/dist/src/es5/drop-down-button/drop-down-button.js","../node_modules/@syncfusion/ej2-splitbuttons/dist/src/es5/split-button/split-button.js","../node_modules/@syncfusion/ej2-inputs/dist/src/es5/numerictextbox/numerictextbox.js","../node_modules/@syncfusion/ej2-inputs/dist/src/es5/form-validator/form-validator.js","../node_modules/@syncfusion/ej2-inputs/dist/src/es5/maskedtextbox/maskedtextbox/maskedtextbox.js","../node_modules/@syncfusion/ej2-inputs/dist/src/es5/slider/slider.js","../node_modules/@syncfusion/ej2-inputs/dist/src/es5/uploader/uploader.js","../node_modules/@syncfusion/ej2-inputs/dist/src/es5/color-picker/color-picker.js","../node_modules/@syncfusion/ej2-data/dist/src/es5/query.js","../node_modules/@syncfusion/ej2-data/dist/src/es5/util.js","../node_modules/@syncfusion/ej2-data/dist/src/es5/adaptors.js","../node_modules/@syncfusion/ej2-data/dist/src/es5/manager.js","../node_modules/@syncfusion/ej2-lists/dist/src/es5/list-view/list-view.js","../node_modules/@syncfusion/ej2-calendars/dist/src/es5/timepicker/timepicker.js","../node_modules/@syncfusion/ej2-lists/dist/src/es5/list-view/virtualization.js","../node_modules/@syncfusion/ej2-calendars/dist/src/es5/calendar/calendar.js","../node_modules/@syncfusion/ej2-calendars/dist/src/es5/datepicker/datepicker.js","../node_modules/@syncfusion/ej2-calendars/dist/src/es5/daterangepicker/daterangepicker.js","../node_modules/@syncfusion/ej2-calendars/dist/src/es5/datetimepicker/datetimepicker.js","../node_modules/@syncfusion/ej2-file-utils/dist/src/es5/save.js","../node_modules/@syncfusion/ej2-file-utils/dist/src/es5/xml-writer.js","../node_modules/@syncfusion/ej2-file-utils/dist/src/es5/stream-writer.js","../node_modules/@syncfusion/ej2-compression/dist/src/es5/compression-writer.js","../node_modules/@syncfusion/ej2-compression/dist/src/es5/zip-archive.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/collections/dictionary.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/primitives/pdf-string.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/primitives/pdf-name.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/input-output/pdf-operators.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/input-output/pdf-dictionary-properties.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/primitives/pdf-dictionary.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/primitives/pdf-number.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/primitives/pdf-array.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/primitives/pdf-stream.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/enum.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/primitives/pdf-reference.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/actions/action.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/actions/uri-action.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/pdf-color.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/enum.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/drawing/pdf-drawing.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/brushes/pdf-brush.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/brushes/pdf-solid-brush.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/pdf-string-format.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/string-layouter.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/string-tokenizer.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/pdf-font.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/input-output/enum.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/input-output/pdf-writer.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/input-output/pdf-main-object-collection.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/input-output/cross-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/pdf-document-base.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/pdf-catalog.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/enum.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/input-output/pdf-cross-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-page-size.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/pdf-margins.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/images/image-decoder.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-page-settings.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/input-output/pdf-stream-writer.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/pdf-pen.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/pdf-transformation-matrix.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/constants.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/collections/object-object-pair/dictionary.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/pdf-transparency.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/automatic-field-info-collection.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/figures/base/graphics-element.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/automatic-field.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/automatic-field-info.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/images/byte-array.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/primitives/pdf-boolean.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/figures/enum.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/unit-convertor.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/images/pdf-image.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/images/pdf-bitmap.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-table-info.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-name-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-name-record.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-head-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-metrics.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-horizontal-header-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-OS2-Table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-post-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-long-hor-metric.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-cmap-sub-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-cmap-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-glyph-info.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-loca-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-apple-cmap-sub-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-microsoft-cmap-sub-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-trimmed-cmap-sub-table.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-glyph-header.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/input-output/big-endian-writer.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/ttf-reader.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/pdf-font-metrics.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/unicode-true-type-font.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/pdf-graphics.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-page-layer.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/general/pdf-collection.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-page-layer-collection.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/figures/pdf-template.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/pdf-resources.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-page-base.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/annotations/annotation-collection.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-page.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/page-added-event-arguments.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-section-page-collection.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/pdf-document-template.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-section-templates.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-section.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-section-collection.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-document-page-collection.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/general/pdf-cache-collection.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/pdf-document.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/pdf-standard-font-metrics-factory.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/pdf-standard-font.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/annotations/annotation.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/annotations/link-annotation.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/annotations/action-link-annotation.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/annotations/document-link-annotation.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/figures/base/element-layouter.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/general/enum.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/figures/layout-element.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/figures/base/text-layouter.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/figures/text-element.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/annotations/uri-annotation.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/annotations/pdf-text-web-link.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/pdf-numbers-convertor.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/pdf-template-value-pair.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/multiple-value-field.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/pdf-page-number-field.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/composite-field.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/single-value-field.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/document/automatic-fields/page-count-field.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/general/pdf-destination.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/structured-elements/tables/light-tables/enum.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/graphics/fonts/pdf-true-type-font.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/pages/pdf-page-template-element.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/structured-elements/grid/styles/pdf-borders.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/structured-elements/grid/styles/style.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/structured-elements/grid/pdf-grid-cell.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/structured-elements/grid/pdf-grid-column.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/structured-elements/grid/pdf-grid-row.js","../node_modules/@syncfusion/ej2-pdf-export/dist/src/es5/implementation/structured-elements/grid/pdf-grid.js","../node_modules/@syncfusion/ej2-svg-base/dist/src/es5/tooltip/tooltip.js","../node_modules/@syncfusion/ej2-navigations/dist/src/es5/common/h-scroll.js","../node_modules/@syncfusion/ej2-navigations/dist/src/es5/toolbar/toolbar.js","../node_modules/@syncfusion/ej2-navigations/dist/src/es5/accordion/accordion.js","../node_modules/@syncfusion/ej2-navigations/dist/src/es5/context-menu/context-menu.js","../node_modules/@syncfusion/ej2-navigations/dist/src/es5/tab/tab.js","../node_modules/@syncfusion/ej2-navigations/dist/src/es5/treeview/treeview.js","../node_modules/@syncfusion/ej2-navigations/dist/src/es5/sidebar/sidebar.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/model/base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/utils/double-range.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/double-axis.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/model/constants.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/model/chart-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/axis.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/cartesian-panel.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/utils/get-data.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/chart-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/model/data.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/marker-explode.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/marker.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/legend/legend.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/technical-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/utils/export.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/chart.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/axis-helper.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/date-time-axis.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/category-axis.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/logarithmic-axis.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/date-time-category-axis.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/strip-line.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/line-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/line-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/column-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/column-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/multi-colored-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/area-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/bar-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/polar-radar-panel.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/polar-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/radar-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/stacking-bar-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/candle-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/stacking-column-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/step-line-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/step-area-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/stacking-area-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/scatter-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/range-column-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/waterfall-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/hilo-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/hilo-open-close-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/range-area-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/bubble-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/spline-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/spline-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/histogram-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/spline-area-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/indicator-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/sma-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/ema-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/tma-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/ad-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/atr-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/momentum-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/rsi-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/stochastic-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/bollinger-bands.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/technical-indicators/macd-indicator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/trend-lines/trend-line.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/user-interaction/crosshair.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/user-interaction/tooltip.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/user-interaction/tooltip.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/user-interaction/zooming-toolkit.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/user-interaction/zooming.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/user-interaction/selection.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/user-interaction/selection.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/data-label.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/error-bar.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/legend/legend.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/annotation/annotation.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/annotation/annotation.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/box-and-whisker-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/multi-colored-area-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/series/multi-colored-line-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/chart/axis/multi-level-labels.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/scrollbar/scrollbar-elements.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/common/scrollbar/scrollbar.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/renderer/accumulation-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/renderer/pie-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/renderer/pie-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/accumulation.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/renderer/triangular-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/renderer/funnel-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/renderer/pyramid-series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/renderer/legend.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/renderer/dataLabel.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/user-interaction/tooltip.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/user-interaction/selection.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/accumulation-chart/annotation/annotation.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/range-navigator/renderer/chart-render.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/range-navigator/renderer/range-axis.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/range-navigator/model/range-base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/model/theme.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/range-navigator/renderer/slider.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/range-navigator/range-navigator.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/range-navigator/renderer/period-selector.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/range-navigator/user-interaction/tooltip.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/utils/utils.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/legend/legend.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/axis/axis.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/title/title.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/series/series.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/utils/area.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/axis/axisrender.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/series/marker.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/series/datalabel.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/series/seriesrender.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/model/constant.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/utils/export.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/utils/enum.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/smithchart.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/series/tooltip.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/smithchart/legend/legendrender.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/sparkline/model/base.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/sparkline/rendering/sparkline-renderer.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/sparkline/sparkline.js","../node_modules/@syncfusion/ej2-charts/dist/src/es5/sparkline/rendering/sparkline-tooltip.js","../charts.ts","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/model/theme.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/model/base.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/axes/axis.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/annotations/annotations.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/model/constants.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/user-interaction/tooltip.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/axes/axis-renderer.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/axes/pointer-renderer.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/axes/axis-panel.js","../node_modules/@syncfusion/ej2-circulargauge/dist/src/es5/circular-gauge/circular-gauge.js","../circulargauge.ts","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/primitives/size.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/primitives/point.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/primitives/rect.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/enum/enum.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/rendering/canvas-renderer.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/rendering/svg-renderer.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/elements/diagram-element.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/elements/path-element.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/elements/image-element.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/elements/text-element.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/appearance.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/containers/container.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/elements/native-element.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/containers/canvas.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/port.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/annotation.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/icon.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/node-base.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/interaction/selector.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/elements/html-element.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/node.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/ruler/ruler.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/rendering/renderer.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/diagram/page-settings.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/service.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/diagram/grid-lines.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/diagram/ruler-settings.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/diagram/data-source.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/layout/layout-base.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/interaction/tool.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/interaction/connector-editing.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/interaction/event-handlers.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/diagram/layer.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/interaction/command-manager.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/interaction/scroller.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/interaction/spatial-search/quad.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/interaction/spatial-search/spatial-search.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/diagram/keyboard-commands.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/diagram.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/print-settings.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/core/containers/stack-panel.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/data-binding/data-binding.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/context-menu.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/connector-bridging.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/snapping.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/undo-redo.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/objects/layout-animation.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/layout/hierarchical-tree.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/layout/mind-map.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/layout/radial-tree.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/diagram/layout/complex-hierarchical-tree.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/symbol-palette/symbol-palette.js","../node_modules/@syncfusion/ej2-diagrams/dist/src/es5/overview/overview.js","../diagrams.ts","../node_modules/@syncfusion/ej2-dropdowns/dist/src/es5/drop-down-base/drop-down-base.js","../node_modules/@syncfusion/ej2-dropdowns/dist/src/es5/drop-down-list/drop-down-list.js","../node_modules/@syncfusion/ej2-dropdowns/dist/src/es5/combo-box/combo-box.js","../node_modules/@syncfusion/ej2-dropdowns/dist/src/es5/auto-complete/auto-complete.js","../node_modules/@syncfusion/ej2-dropdowns/dist/src/es5/multi-select/multi-select.js","../node_modules/@syncfusion/ej2-dropdowns/dist/src/es5/multi-select/checkbox-selection.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/base/dictionary.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/base/unique-format.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/base/unique-formats.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/document-editor.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/print.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/section-format.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/list/level-override.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/list/list.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/list-format.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/paragraph-format.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/character-format.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/editor/editor-helper.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/style.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/border.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/borders.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/shading.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/table-format.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/row-format.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/format/cell-format.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/viewer/page.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/context-menu.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/list/abstract-list.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/list/list-level.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/viewer/layout.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/viewer/render.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/viewer/text-helper.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/viewer/zooming.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/viewer/viewer.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/viewer/sfdt-reader.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/selection/selection-format.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/writer/html-export.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/selection/selection-helper.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/selection/selection.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/search/text-search-result.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/search/text-search-results.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/search/text-search.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/search/search.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/search/options-pane.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/editor/table-resizer.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/editor/editor.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/editor-history/history-helper.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/editor-history/base-history-info.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/editor/image-resizer.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/editor-history/history-info.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/editor-history/editor-history.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/writer/word-export.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/writer/text-export.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/writer/sfdt-export.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/hyperlink-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/table-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/bookmark-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/table-of-contents-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/page-setup-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/paragraph-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/list-view-model.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/list-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/style-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/bullets-and-numbering-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/font-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/table-properties-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/borders-and-shading-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/table-options-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/cell-options-dialog.js","../node_modules/@syncfusion/ej2-documenteditor/dist/src/es5/document-editor/implementation/dialogs/styles-dialog.js","../documenteditor.ts","../dropdowns.ts","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/base/enum.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/cell-style.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/cell.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/column.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/row.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/worksheets.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/worksheet.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/value-formatter.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/csv-helper.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/blob-helper.js","../node_modules/@syncfusion/ej2-excel-export/dist/src/es5/workbook.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/value-formatter.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/models/column.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/base/constant.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/checkbox-filter.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/data.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/models/row.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/models/cell.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/cell-merge-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/row-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/row-model-generator.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/summary-model-generator.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/group-model-generator.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/content-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/header-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/cell-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/header-cell-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/stacked-cell-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/indent-cell-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/caption-cell-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/expand-cell-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/header-indent-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/detail-header-indent-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/detail-expand-cell-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/render.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/cell-render-factory.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/service-locator.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/renderer-factory.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/width-controller.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/focus-strategy.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/models/page-settings.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/selection.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/search.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/show-hide.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/scroll.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/print.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/models/aggregate.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/clipboard.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/base/grid.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/sort.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/pager/numeric-container.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/pager/pager-message.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/pager/pager.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/pager/pager-dropdown.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/pager/external-message.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/page.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/edit.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/filter-cell-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/filter-menu-operator.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/string-filter-ui.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/number-filter-ui.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/boolean-filter-ui.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/date-filter-ui.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/filter-menu-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/excel-filter.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/filter.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/resize.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/reorder.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/row-reorder.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/group.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/detail-row.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/toolbar.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/footer-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/summary-cell-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/intersection-observer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/virtual-row-model-generator.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/virtual-content-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/virtual-scroll.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/inline-edit-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/batch-edit-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/dialog-edit-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/edit-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/boolean-edit-cell.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/dropdown-edit-cell.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/numeric-edit-cell.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/default-edit-cell.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/normal-edit.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/inline-edit.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/batch-edit.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/dialog-edit.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/datepicker-edit-cell.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/column-chooser.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/export-helper.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/excel-export.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/pdf-export.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/command-column-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/command-column.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/context-menu.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/services/freeze-row-model-generator.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/renderer/freeze-renderer.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/freeze.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/column-menu.js","../node_modules/@syncfusion/ej2-grids/dist/src/es5/grid/actions/foreign-key.js","../grids.ts","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/model/theme.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/model/base.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/utils/colorMapping.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/axis/axis.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/axis/axis-helpers.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/series/series.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/datasource/twodimensional.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/legend/legend.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/heatmap.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/datasource/adaptor.js","../node_modules/@syncfusion/ej2-heatmap/dist/src/es5/heatmap/utils/tooltip.js","../heatmap.ts","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/model/base.js","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/axes/axis.js","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/axes/axis-panel.js","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/model/constant.js","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/axes/animation.js","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/axes/axis-renderer.js","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/annotations/annotations.js","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/user-interaction/tooltip.js","../node_modules/@syncfusion/ej2-lineargauge/dist/src/es5/linear-gauge/linear-gauge.js","../lineargauge.ts","../lists.ts","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/model/theme.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/model/base.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/model/constants.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/layers/bing-map.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/layers/color-mapping.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/layers/layer-panel.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/user-interaction/annotation.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/utils/export.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/maps.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/layers/bubble.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/layers/marker.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/layers/data-label.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/layers/navigation-selected-line.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/layers/legend.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/user-interaction/highlight.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/user-interaction/selection.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/user-interaction/tooltip.js","../node_modules/@syncfusion/ej2-maps/dist/src/es5/maps/user-interaction/zoom.js","../maps.ts","../node_modules/@syncfusion/ej2-notifications/dist/src/es5/toast/toast.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/base/util.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/base/engine.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/base/constant.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/base/css-constant.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/pivotview/renderer/render.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/pivotview/model/dataSource.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/pivotview/model/gridsettings.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/pivotview/actions/keyboard.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/popups/context-menu.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/pivotview/base/pivotview.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/pivotview/actions/excel-export.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/pivotview/actions/pdf-export.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/actions/keyboard.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/actions/event-base.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/actions/node-state-modified.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/actions/dataSource-update.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/popups/error-dialog.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/popups/filter-dialog.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/base/pivot-common.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/field-list/renderer/dialog-renderer.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/field-list/renderer/tree-renderer.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/field-list/renderer/axis-table-renderer.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/actions/pivot-button.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/field-list/renderer/axis-field-renderer.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/field-list/renderer/renderer.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/field-list/base/field-list.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/calculatedfield/calculated-field.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/actions/field-list.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/actions/common.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/grouping-bar/axis-field-renderer.js","../node_modules/@syncfusion/ej2-pivotview/dist/src/es5/common/grouping-bar/grouping-bar.js","../pivotview.ts","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/base/enum.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/base/constant.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/base/classes.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/models/items.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/models/default-locale.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/renderer/toolbar-renderer.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/base-toolbar.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/dropdown-buttons.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/services/service-locator.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/services/renderer-factory.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/toolbar-action.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/toolbar.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/keyboard.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/base-quick-toolbar.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/renderer/popup-renderer.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/quick-toolbar.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/count.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/color-picker.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/markdown-parser/plugin/markdown-selection.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/markdown-toolbar-status.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/execute-command-callback.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/common/constant.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/formatter/formatter.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/markdown-parser/base/constant.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/markdown-parser/plugin/lists.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/markdown-parser/plugin/formats.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/markdown-parser/plugin/md-selection-formats.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/common/config.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/markdown-parser/plugin/undo.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/markdown-parser/plugin/link.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/markdown-parser/plugin/clearformat.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/markdown-parser/base/markdown-parser.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/formatter/markdown-formatter.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/renderer/markdown-renderer.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/markdown-editor.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/base/constant.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/selection/selection.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/dom-node.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/lists.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/formats.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/insert-methods.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/nodecutter.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/inserthtml.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/link.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/alignments.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/indents.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/image.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/isformatted.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/selection-commands.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/selection-exec.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/inserthtml-exec.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/clearformat.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/clearformat-exec.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/undo.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/base/editor-manager.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/formatter/html-formatter.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/editor-manager/plugin/toolbar-status.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/html-toolbar-status.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/renderer/content-renderer.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/renderer/iframe-content-renderer.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/html-editor.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/renderer/render.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/renderer/link-module.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/renderer/image-module.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/renderer/view-source.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/base/interface.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/models/toolbar-settings.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/models/iframe-settings.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/models/inline-mode.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/actions/full-screen.js","../node_modules/@syncfusion/ej2-richtexteditor/dist/src/es5/rich-text-editor/base/rich-text-editor.js","../richtexteditor.ts","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/base/constant.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/base/css-constant.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/header-renderer.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/actions/scroll.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/actions/touch.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/actions/keyboard.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/actions/data.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/timezone/timezone.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/event-renderer/event-base.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/actions/crud.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/popups/form-validator.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/popups/quick-popups.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/popups/event-tooltip.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/recurrence-editor/recurrence-editor.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/popups/event-window.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/renderer.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/models/work-hours.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/models/time-scale.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/models/fields.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/models/event-settings.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/models/group.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/models/resources.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/base/resource.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/base/schedule.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/view-base.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/actions/work-cells.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/event-renderer/vertical-view.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/event-renderer/month.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/vertical-view.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/day.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/week.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/work-week.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/month.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/event-renderer/agenda-base.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/agenda.js","../node_modules/@syncfusion/ej2-schedule/dist/src/es5/schedule/renderer/month-agenda.js","../schedule.ts","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/model/theme.js","../node_modules/@syncfusion/ej2-splitbuttons/dist/src/es5/button-group/button-group.js","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/model/constants.js","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/model/base.js","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/layout/render-panel.js","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/utils/export.js","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/treemap.js","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/layout/legend.js","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/user-interaction/highlight-selection.js","../node_modules/@syncfusion/ej2-treemap/dist/src/es5/treemap/user-interaction/tooltip.js","../treemap.ts"],"sourcesContent":["var instances = 'ej2_instances';\nvar uid = 0;\n/**\n * Create Instance from constructor function with desired parameters.\n * @param {Function} classFunction - Class function to which need to create instance\n * @param {any[]} params - Parameters need to passed while creating instance\n * @return {any}\n * @private\n */\nexport function createInstance(classFunction, params) {\n var arrayParam = params;\n arrayParam.unshift(undefined);\n return new (Function.prototype.bind.apply(classFunction, arrayParam));\n}\n/**\n * To run a callback function immediately after the browser has completed other operations.\n * @param {Function} handler - callback function to be triggered.\n * @return {Function}\n * @private\n */\nexport function setImmediate(handler) {\n var unbind;\n var num = new Uint16Array(5);\n var intCrypto = window.msCrypto || window.crypto;\n intCrypto.getRandomValues(num);\n var secret = 'ej2' + combineArray(num);\n var messageHandler = function (event) {\n if (event.source === window && typeof event.data === 'string' && event.data.length <= 32 && event.data === secret) {\n handler();\n unbind();\n }\n };\n window.addEventListener('message', messageHandler, false);\n window.postMessage(secret, '*');\n return unbind = function () {\n window.removeEventListener('message', messageHandler);\n handler = messageHandler = secret = undefined;\n };\n}\n/**\n * To get nameSpace value from the desired object.\n * @param {string} nameSpace - String value to the get the inner object\n * @param {any} obj - Object to get the inner object value.\n * @return {any}\n * @private\n */\nexport function getValue(nameSpace, obj) {\n /* tslint:disable no-any */\n var value = obj;\n var splits = nameSpace.split('.');\n for (var i = 0; i < splits.length && !isUndefined(value); i++) {\n value = value[splits[i]];\n }\n return value;\n}\n/**\n * To set value for the nameSpace in desired object.\n * @param {string} nameSpace - String value to the get the inner object\n * @param {any} value - Value that you need to set.\n * @param {any} obj - Object to get the inner object value.\n * @return {void}\n * @private\n */\nexport function setValue(nameSpace, value, obj) {\n var keys = nameSpace.split('.');\n var start = obj || {};\n var fromObj = start;\n var i;\n var length = keys.length;\n var key;\n for (i = 0; i < length; i++) {\n key = keys[i];\n if (i + 1 === length) {\n fromObj[key] = value === undefined ? {} : value;\n }\n else if (isNullOrUndefined(fromObj[key])) {\n fromObj[key] = {};\n }\n fromObj = fromObj[key];\n }\n return start;\n}\n/**\n * Delete an item from Object\n * @param {any} obj - Object in which we need to delete an item.\n * @param {string} params - String value to the get the inner object\n * @return {void}\n * @private\n */\nexport function deleteObject(obj, key) {\n delete obj[key];\n}\n/**\n * Check weather the given argument is only object.\n * @param {any} obj - Object which is need to check.\n * @return {boolean}\n * @private\n */\nexport function isObject(obj) {\n var objCon = {};\n return (!isNullOrUndefined(obj) && obj.constructor === objCon.constructor);\n}\n/**\n * To get enum value by giving the string.\n * @param {any} enumObject - Enum object.\n * @param {string} enumValue - Enum value to be searched\n * @return {any}\n * @private\n */\nexport function getEnumValue(enumObject, enumValue) {\n return enumObject[enumValue];\n}\n/**\n * Merge the source object into destination object.\n * @param {any} source - source object which is going to merge with destination object\n * @param {any} destination - object need to be merged\n * @return {void}\n * @private\n */\nexport function merge(source, destination) {\n if (!isNullOrUndefined(destination)) {\n var temrObj = source;\n var tempProp = destination;\n var keys = Object.keys(destination);\n var deepmerge = 'deepMerge';\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n if (!isNullOrUndefined(temrObj[deepmerge]) && (temrObj[deepmerge].indexOf(key) !== -1) &&\n (isObject(tempProp[key]) || Array.isArray(tempProp[key]))) {\n extend(temrObj[key], temrObj[key], tempProp[key], true);\n }\n else {\n temrObj[key] = tempProp[key];\n }\n }\n }\n}\n/**\n * Extend the two object with newer one.\n * @param {any} copied - Resultant object after merged\n * @param {Object} first - First object need to merge\n * @param {Object} second - Second object need to merge\n * @return {Object}\n * @private\n */\nexport function extend(copied, first, second, deep) {\n var result = copied || {};\n var length = arguments.length;\n if (deep) {\n length = length - 1;\n }\n var _loop_1 = function (i) {\n if (!arguments_1[i]) {\n return \"continue\";\n }\n var obj1 = arguments_1[i];\n Object.keys(obj1).forEach(function (key) {\n var src = result[key];\n var copy = obj1[key];\n var clone;\n if (deep && (isObject(copy) || Array.isArray(copy))) {\n if (isObject(copy)) {\n clone = src ? src : {};\n result[key] = extend({}, clone, copy, deep);\n }\n else {\n clone = src ? src : [];\n result[key] = extend([], clone, copy, deep);\n }\n }\n else {\n result[key] = copy;\n }\n });\n };\n var arguments_1 = arguments;\n for (var i = 1; i < length; i++) {\n _loop_1(i);\n }\n return result;\n}\n/**\n * To check whether the object is null or undefined.\n * @param {Object} value - To check the object is null or undefined\n * @return {boolean}\n * @private\n */\nexport function isNullOrUndefined(value) {\n return value === undefined || value === null;\n}\n/**\n * To check whether the object is undefined.\n * @param {Object} value - To check the object is undefined\n * @return {boolean}\n * @private\n */\nexport function isUndefined(value) {\n return ('undefined' === typeof value);\n}\n/**\n * To return the generated unique name\n * @param {string} definedName - To concatenate the unique id to provided name\n * @return {string}\n * @private\n */\nexport function getUniqueID(definedName) {\n return definedName + '_' + uid++;\n}\n/**\n * It limits the rate at which a function can fire. The function will fire only once every provided second instead of as quickly.\n * @param {Function} eventFunction - Specifies the function to run when the event occurs\n * @param {number} delay - A number that specifies the milliseconds for function delay call option\n * @return {Function}\n * @private\n */\nexport function debounce(eventFunction, delay) {\n var out;\n // tslint:disable-next-line\n return function () {\n var _this = this;\n var args = arguments;\n var later = function () {\n out = null;\n return eventFunction.apply(_this, args);\n };\n clearTimeout(out);\n out = setTimeout(later, delay);\n };\n}\n// Added since lint ignored after added '//tslint:disable-next-line' \n/* tslint:disable:no-any */\n/**\n * To convert the object to string for query url\n * @param {Object} data\n * @returns string\n * @private\n */\nexport function queryParams(data) {\n var array = [];\n var keys = Object.keys(data);\n for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {\n var key = keys_2[_i];\n array.push(encodeURIComponent(key) + '=' + encodeURIComponent('' + data[key]));\n }\n return array.join('&');\n}\n/**\n * To check whether the given array contains object.\n * @param {T[]} value- Specifies the T type array to be checked.\n * @private\n */\nexport function isObjectArray(value) {\n var parser = Object.prototype.toString;\n if (parser.call(value) === '[object Array]') {\n if (parser.call(value[0]) === '[object Object]') {\n return true;\n }\n }\n return false;\n}\n/**\n * To check whether the child element is descendant to parent element or parent and child are same element.\n * @param{Element} - Specifies the child element to compare with parent.\n * @param{Element} - Specifies the parent element.\n * @return boolean\n * @private\n */\nexport function compareElementParent(child, parent) {\n var node = child;\n if (node === parent) {\n return true;\n }\n else if (node === document || !node) {\n return false;\n }\n else {\n return compareElementParent(node.parentNode, parent);\n }\n}\n/**\n * To throw custom error message.\n * @param{string} - Specifies the error message to be thrown.\n * @private\n */\nexport function throwError(message) {\n try {\n throw new Error(message);\n }\n catch (e) {\n throw e.message + '\\n' + e.stack;\n }\n}\n/**\n * This function is used to print given element\n * @param{Element} element - Specifies the print content element.\n * @param{Window} printWindow - Specifies the print window.\n * @private\n */\nexport function print(element, printWindow) {\n var div = document.createElement('div');\n var links = [].slice.call(document.getElementsByTagName('head')[0].querySelectorAll('link, style'));\n var reference = '';\n if (isNullOrUndefined(printWindow)) {\n printWindow = window.open('', 'print', 'height=452,width=1024,tabbar=no');\n }\n div.appendChild(element.cloneNode(true));\n for (var i = 0, len = links.length; i < len; i++) {\n reference += links[i].outerHTML;\n }\n printWindow.document.write('
' + reference + '' + div.innerHTML +\n '' + '');\n printWindow.document.close();\n printWindow.focus();\n // tslint:disable-next-line\n var interval = setInterval(function () {\n if (printWindow.ready) {\n printWindow.print();\n printWindow.close();\n clearInterval(interval);\n }\n }, 500);\n return printWindow;\n}\n/**\n * Function to normalize the units applied to the element.\n * @param {number|string} value\n * @return {string} result\n * @private\n */\nexport function formatUnit(value) {\n var result = value + '';\n if (result === 'auto' || result.indexOf('%') !== -1 || result.indexOf('px') !== -1) {\n return result;\n }\n return result + 'px';\n}\n/**\n * Function to fetch the Instances of a HTML element for the given component.\n * @param {string | HTMLElement} element\n * @param {any} component\n * @return {Object} inst\n * @private\n */\n// tslint:disable-next-line\nexport function getInstance(element, component) {\n // tslint:disable-next-line:no-any\n var elem = (typeof (element) === 'string') ? document.querySelector(element) : element;\n if (elem[instances]) {\n for (var _i = 0, _a = elem[instances]; _i < _a.length; _i++) {\n var inst = _a[_i];\n if (inst instanceof component) {\n return inst;\n }\n }\n }\n return null;\n}\n/**\n * Function to add instances for the given element.\n * @param {string | HTMLElement} element\n * @param {Object} instance\n * @return {void}\n * @private\n */\nexport function addInstance(element, instance) {\n // tslint:disable-next-line:no-any\n var elem = (typeof (element) === 'string') ? document.querySelector(element) : element;\n if (elem[instances]) {\n elem[instances].push(instance);\n }\n else {\n elem[instances] = [instance];\n }\n}\n/**\n * Function to generate the unique id.\n * @return {any}\n * @private\n */\n// tslint:disable-next-line:no-any\nexport function uniqueID() {\n // tslint:disable-next-line:no-any\n if ((typeof window) === 'undefined') {\n return;\n }\n // tslint:disable-next-line:no-any\n var num = new Uint16Array(5);\n var intCrypto = window.msCrypto || window.crypto;\n return intCrypto.getRandomValues(num);\n}\nfunction combineArray(num) {\n var ret = '';\n for (var i = 0; i < 5; i++) {\n ret += (i ? ',' : '') + num[i];\n }\n return ret;\n}\n","/**\n * Functions related to dom operations.\n */\nimport { EventHandler } from './event-handler';\nimport { isNullOrUndefined } from './util';\nvar SVG_REG = /^svg|^path|^g/;\n/**\n * Function to create Html element.\n * @param tagName - Name of the tag, id and class names.\n * @param properties - Object to set properties in the element.\n * @param properties.id - To set the id to the created element.\n * @param properties.className - To add classes to the element.\n * @param properties.innerHTML - To set the innerHTML to element.\n * @param properties.styles - To set the some custom styles to element.\n * @param properties.attrs - To set the attributes to element.\n * @private\n */\nexport function createElement(tagName, properties) {\n //tslint:disable-next-line\n var element = (SVG_REG.test(tagName) ? document.createElementNS('http://www.w3.org/2000/svg', tagName) : document.createElement(tagName));\n if (typeof (properties) === 'undefined') {\n return element;\n }\n element.innerHTML = (properties.innerHTML ? properties.innerHTML : '');\n if (properties.className !== undefined) {\n element.className = properties.className;\n }\n if (properties.id !== undefined) {\n element.id = properties.id;\n }\n if (properties.styles !== undefined) {\n element.setAttribute('style', properties.styles);\n }\n if (properties.attrs !== undefined) {\n attributes(element, properties.attrs);\n }\n return element;\n}\n/**\n * The function used to add the classes to array of elements\n * @param {Element[]|NodeList} elements - An array of elements that need to add a list of classes\n * @param {string|string[]} classes - String or array of string that need to add an individual element as a class\n * @private\n */\nexport function addClass(elements, classes) {\n var classList = getClassList(classes);\n for (var _i = 0, _a = elements; _i < _a.length; _i++) {\n var ele = _a[_i];\n for (var _b = 0, classList_1 = classList; _b < classList_1.length; _b++) {\n var className = classList_1[_b];\n if (!ele.classList.contains(className)) {\n ele.classList.add(className);\n }\n }\n }\n return elements;\n}\n/**\n * The function used to add the classes to array of elements\n * @param {Element[]|NodeList} elements - An array of elements that need to remove a list of classes\n * @param {string|string[]} classes - String or array of string that need to add an individual element as a class\n * @private\n */\nexport function removeClass(elements, classes) {\n var classList = getClassList(classes);\n for (var _i = 0, _a = elements; _i < _a.length; _i++) {\n var ele = _a[_i];\n if (ele.className !== '') {\n for (var _b = 0, classList_2 = classList; _b < classList_2.length; _b++) {\n var className = classList_2[_b];\n ele.classList.remove(className);\n }\n }\n }\n return elements;\n}\nfunction getClassList(classes) {\n var classList = [];\n if (typeof classes === 'string') {\n classList.push(classes);\n }\n else {\n classList = classes;\n }\n return classList;\n}\n/**\n * The function used to check element is visible or not.\n * @param {Element|Node} element - An element the need to check visibility\n * @private\n */\nexport function isVisible(element) {\n var ele = element;\n return (ele.style.visibility === '' && ele.offsetWidth > 0);\n}\n/**\n * The function used to insert an array of elements into a first of the element.\n * @param {Element[]|NodeList} fromElements - An array of elements that need to prepend.\n * @param {Element} toElement - An element that is going to prepend.\n * @private\n */\nexport function prepend(fromElements, toElement) {\n var docFrag = document.createDocumentFragment();\n for (var _i = 0, _a = fromElements; _i < _a.length; _i++) {\n var ele = _a[_i];\n docFrag.appendChild(ele);\n }\n toElement.insertBefore(docFrag, toElement.firstElementChild);\n return fromElements;\n}\n/**\n * The function used to insert an array of elements into last of the element.\n * @param {Element[]|NodeList} fromElements - An array of elements that need to append.\n * @param {Element} toElement - An element that is going to prepend.\n * @private\n */\nexport function append(fromElements, toElement) {\n var docFrag = document.createDocumentFragment();\n for (var _i = 0, _a = fromElements; _i < _a.length; _i++) {\n var ele = _a[_i];\n docFrag.appendChild(ele);\n }\n toElement.appendChild(docFrag);\n return fromElements;\n}\n/**\n * The function used to remove the element from the\n * @param {Element|Node|HTMLElement} element - An element that is going to detach from the Dom\n * @private\n */\nexport function detach(element) {\n var parentNode = element.parentNode;\n return parentNode.removeChild(element);\n}\n/**\n * The function used to remove the element from Dom also clear the bounded events\n * @param {Element|Node|HTMLElement} element - An element remove from the Dom\n * @private\n */\nexport function remove(element) {\n var parentNode = element.parentNode;\n EventHandler.clearEvents(element);\n parentNode.removeChild(element);\n}\n/**\n * The function helps to set multiple attributes to an element\n * @param {Element|Node} element - An element that need to set attributes.\n * @param {{[key:string]:string}} attributes - JSON Object that is going to as attributes.\n * @private\n */\nexport function attributes(element, attributes) {\n var keys = Object.keys(attributes);\n var ele = element;\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n ele.setAttribute(key, attributes[key]);\n }\n return ele;\n}\n/**\n * The function selects the element from giving context.\n * @param {string} selector - Selector string need fetch element from the\n * @param {Document|Element=document} context - It is an optional type, That specifies a Dom context.\n * @private\n */\nexport function select(selector, context) {\n if (context === void 0) { context = document; }\n return context.querySelector(selector);\n}\n/**\n * The function selects an array of element from the given context.\n * @param {string} selector - Selector string need fetch element from the\n * @param {Document|Element=document} context - It is an optional type, That specifies a Dom context.\n * @private\n */\nexport function selectAll(selector, context) {\n if (context === void 0) { context = document; }\n var nodeList = context.querySelectorAll(selector);\n return nodeList;\n}\n/**\n * Returns single closest parent element based on class selector.\n * @param {Element} element - An element that need to find the closest element.\n * @param {string} selector - A classSelector of closest element.\n * @private\n */\nexport function closest(element, selector) {\n var el = element;\n if (typeof el.closest === 'function') {\n return el.closest(selector);\n }\n while (el && el.nodeType === 1) {\n if (matches(el, selector)) {\n return el;\n }\n el = el.parentNode;\n }\n return null;\n}\n/**\n * Returns all sibling elements of the given element.\n * @param {Element|Node} element - An element that need to get siblings.\n * @private\n */\nexport function siblings(element) {\n var siblings = [];\n var childNodes = Array.prototype.slice.call(element.parentNode.childNodes);\n for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) {\n var curNode = childNodes_1[_i];\n if (curNode.nodeType === Node.ELEMENT_NODE && element !== curNode) {\n siblings.push(curNode);\n }\n }\n return siblings;\n}\n/**\n * set the value if not exist. Otherwise set the existing value\n * @param {HTMLElement} element - An element to which we need to set value.\n * @param {string} property - Property need to get or set.\n * @param {string} value - value need to set.\n * @private\n */\nexport function getAttributeOrDefault(element, property, value) {\n var attrVal = element.getAttribute(property);\n if (isNullOrUndefined(attrVal)) {\n element.setAttribute(property, value.toString());\n attrVal = value;\n }\n return attrVal;\n}\n/**\n * Set the style attributes to Html element.\n * @param {HTMLElement} element - Element which we want to set attributes\n * @param {any} attrs - Set the given attributes to element\n * @return {void}\n * @private\n */\nexport function setStyleAttribute(element, attrs) {\n if (attrs !== undefined) {\n Object.keys(attrs).forEach(function (key) {\n // tslint:disable-next-line:no-any\n element.style[key] = attrs[key];\n });\n }\n}\n/**\n * Method for add and remove classes to a dom element.\n * @param {Element} element - Element for add and remove classes\n * @param {string[]} addClasses - List of classes need to be add to the element\n * @param {string[]} removeClasses - List of classes need to be remove from the element\n * @return {void}\n * @private\n */\nexport function classList(element, addClasses, removeClasses) {\n addClass([element], addClasses);\n removeClass([element], removeClasses);\n}\n/**\n * Method to check whether the element matches the given selector.\n * @param {Element} element - Element to compare with the selector.\n * @param {string} selector - String selector which element will satisfy.\n * @return {void}\n * @private\n */\nexport function matches(element, selector) {\n var matches = element.matches || element.msMatchesSelector || element.webkitMatchesSelector;\n if (matches) {\n return matches.call(element, selector);\n }\n else {\n return [].indexOf.call(document.querySelectorAll(selector), element) !== -1;\n }\n}\n","import { createInstance, isUndefined, merge, extend, getValue } from './util';\n/**\n * Returns the Class Object\n * @param {ClassObject} instance - instance of ClassObject\n * @param {string} curKey - key of the current instance\n * @param {Object} defaultValue - default Value\n * @param {Object[]} type\n */\nfunction getObject(instance, curKey, defaultValue, type) {\n if (!instance.properties.hasOwnProperty(curKey) || !(instance.properties[curKey] instanceof type)) {\n instance.properties[curKey] = createInstance(type, [instance, curKey, defaultValue]);\n }\n return instance.properties[curKey];\n}\n/**\n * Returns object array\n * @param {ClassObject} instance\n * @param {string} curKey\n * @param {Object[]} defaultValue\n * @param type\n * @param {boolean} isSetter\n * @returns {Object[]}\n */\nfunction getObjectArray(instance, curKey, defaultValue, type, isSetter, isFactory) {\n var result = [];\n var len = defaultValue.length;\n for (var i = 0; i < len; i++) {\n var curType = type;\n if (isFactory) {\n curType = type(defaultValue[i], instance);\n }\n if (isSetter) {\n var inst = createInstance(curType, [instance, curKey, {}, true]);\n inst.setProperties(defaultValue[i], true);\n result.push(inst);\n }\n else {\n result.push(createInstance(curType, [instance, curKey, defaultValue[i], true]));\n }\n }\n return result;\n}\n/**\n * Returns the properties of the object\n * @param {Object} defaultValue\n * @param {string} curKey\n */\nfunction propertyGetter(defaultValue, curKey) {\n return function () {\n if (!this.properties.hasOwnProperty(curKey)) {\n this.properties[curKey] = defaultValue;\n }\n return this.properties[curKey];\n };\n}\n/**\n * Set the properties for the object\n * @param {Object} defaultValue\n * @param {string} curKey\n */\nfunction propertySetter(defaultValue, curKey) {\n return function (newValue) {\n if (this.properties[curKey] !== newValue) {\n var oldVal = this.properties.hasOwnProperty(curKey) ? this.properties[curKey] : defaultValue;\n this.saveChanges(curKey, newValue, oldVal);\n this.properties[curKey] = newValue;\n }\n };\n}\n/**\n * Returns complex objects\n */\nfunction complexGetter(defaultValue, curKey, type) {\n return function () {\n return getObject(this, curKey, defaultValue, type);\n };\n}\n/**\n * Sets complex objects\n */\nfunction complexSetter(defaultValue, curKey, type) {\n return function (newValue) {\n getObject(this, curKey, defaultValue, type).setProperties(newValue);\n };\n}\nfunction complexFactoryGetter(defaultValue, curKey, type) {\n return function () {\n var curType = type({});\n if (this.properties.hasOwnProperty(curKey)) {\n return this.properties[curKey];\n }\n else {\n return getObject(this, curKey, defaultValue, curType);\n }\n };\n}\nfunction complexFactorySetter(defaultValue, curKey, type) {\n return function (newValue) {\n var curType = type(newValue, this);\n getObject(this, curKey, defaultValue, curType).setProperties(newValue);\n };\n}\nfunction complexArrayGetter(defaultValue, curKey, type) {\n return function () {\n if (!this.properties.hasOwnProperty(curKey)) {\n var defCollection = getObjectArray(this, curKey, defaultValue, type, false);\n this.properties[curKey] = defCollection;\n }\n return this.properties[curKey];\n };\n}\nfunction complexArraySetter(defaultValue, curKey, type) {\n return function (newValue) {\n var oldValueCollection = getObjectArray(this, curKey, defaultValue, type, false);\n var newValCollection = getObjectArray(this, curKey, newValue, type, true);\n this.saveChanges(curKey, newValCollection, oldValueCollection);\n this.properties[curKey] = newValCollection;\n };\n}\nfunction complexArrayFactorySetter(defaultValue, curKey, type) {\n return function (newValue) {\n var oldValueCollection = this.properties.hasOwnProperty(curKey) ? this.properties[curKey] : defaultValue;\n var newValCollection = getObjectArray(this, curKey, newValue, type, true, true);\n this.saveChanges(curKey, newValCollection, oldValueCollection);\n this.properties[curKey] = newValCollection;\n };\n}\nfunction complexArrayFactoryGetter(defaultValue, curKey, type) {\n return function () {\n var curType = type({});\n if (!this.properties.hasOwnProperty(curKey)) {\n var defCollection = getObjectArray(this, curKey, defaultValue, curType, false);\n this.properties[curKey] = defCollection;\n }\n return this.properties[curKey];\n };\n}\n/**\n * Method used to create property. General syntax below.\n * @param {T} defaultValue? - Specifies the default value of property.\n * ```\n * @Property('TypeScript')\n * propertyName: Type;\n * ```\n * @private\n */\nexport function Property(defaultValue) {\n return function (target, key) {\n var propertyDescriptor = {\n set: propertySetter(defaultValue, key),\n get: propertyGetter(defaultValue, key),\n enumerable: true,\n configurable: true\n };\n //new property creation\n Object.defineProperty(target, key, propertyDescriptor);\n addPropertyCollection(target, key, 'prop', defaultValue);\n };\n}\n/**\n * Method used to create complex property. General syntax below.\n * @param {T} defaultValue - Specifies the default value of property.\n * @param {Function} type - Specifies the class type of complex object.\n * ```\n * @Complex({},Type)\n * propertyName: Type;\n * ```\n * @private\n */\nexport function Complex(defaultValue, type) {\n return function (target, key) {\n var propertyDescriptor = {\n set: complexSetter(defaultValue, key, type),\n get: complexGetter(defaultValue, key, type),\n enumerable: true,\n configurable: true\n };\n //new property creation\n Object.defineProperty(target, key, propertyDescriptor);\n addPropertyCollection(target, key, 'complexProp', defaultValue, type);\n };\n}\n/**\n * Method used to create complex Factory property. General syntax below.\n * @param {Function} defaultType - Specifies the default value of property.\n * @param {Function} type - Specifies the class factory type of complex object.\n * ```\n * @ComplexFactory(defaultType, factoryFunction)\n * propertyName: Type1 | Type2;\n * ```\n * @private\n */\nexport function ComplexFactory(type) {\n return function (target, key) {\n var propertyDescriptor = {\n set: complexFactorySetter({}, key, type),\n get: complexFactoryGetter({}, key, type),\n enumerable: true,\n configurable: true\n };\n //new property creation\n Object.defineProperty(target, key, propertyDescriptor);\n addPropertyCollection(target, key, 'complexProp', {}, type);\n };\n}\n/**\n * Method used to create complex array property. General syntax below.\n * @param {T[]} defaultValue - Specifies the default value of property.\n * @param {Function} type - Specifies the class type of complex object.\n * ```\n * @Collection([], Type);\n * propertyName: Type;\n * ```\n * @private\n */\nexport function Collection(defaultValue, type) {\n return function (target, key) {\n var propertyDescriptor = {\n set: complexArraySetter(defaultValue, key, type),\n get: complexArrayGetter(defaultValue, key, type),\n enumerable: true,\n configurable: true\n };\n //new property creation\n Object.defineProperty(target, key, propertyDescriptor);\n addPropertyCollection(target, key, 'colProp', defaultValue, type);\n };\n}\n/**\n * Method used to create complex factory array property. General syntax below.\n * @param {T[]} defaultType - Specifies the default type of property.\n * @param {Function} type - Specifies the class type of complex object.\n * ```\n * @Collection([], Type);\n * propertyName: Type;\n * ```\n * @private\n */\nexport function CollectionFactory(type) {\n return function (target, key) {\n var propertyDescriptor = {\n set: complexArrayFactorySetter([], key, type),\n get: complexArrayFactoryGetter([], key, type),\n enumerable: true,\n configurable: true\n };\n //new property creation\n Object.defineProperty(target, key, propertyDescriptor);\n addPropertyCollection(target, key, 'colProp', {}, type);\n };\n}\n/**\n * Method used to create event property. General syntax below.\n * @param {Function} defaultValue? - Specifies the default value of property.\n * @param {boolean} isComplex? - Specifies the whether it is complex object.\n * ```\n * @Event(()=>{return true;})\n * ```\n * @private\n */\nexport function Event() {\n return function (target, key) {\n var eventDescriptor = {\n set: function (newValue) {\n var oldValue = this.properties[key];\n if (oldValue !== newValue) {\n var finalContext = getParentContext(this, key);\n if (isUndefined(oldValue) === false) {\n finalContext.context.removeEventListener(finalContext.prefix, oldValue);\n }\n finalContext.context.addEventListener(finalContext.prefix, newValue);\n this.properties[key] = newValue;\n }\n },\n get: propertyGetter(undefined, key),\n enumerable: true,\n configurable: true\n };\n Object.defineProperty(target, key, eventDescriptor);\n addPropertyCollection(target, key, 'event');\n };\n}\n/**\n * NotifyPropertyChanges is triggers the call back when the property has been changed.\n *\n * ```\n * @NotifyPropertyChanges\n * class DemoClass implements INotifyPropertyChanged {\n *\n * @Property()\n * property1: string;\n *\n * dataBind: () => void;\n *\n * constructor() { }\n *\n * onPropertyChanged(newProp: any, oldProp: any) {\n * // Called when property changed\n * }\n * }\n * ```\n * @private\n */\nexport function NotifyPropertyChanges(classConstructor) {\n /** Need to code */\n}\n/**\n * Method used to create the builderObject for the target component.\n * @private\n */\nfunction addPropertyCollection(target, key, propertyType, defaultValue, type) {\n if (isUndefined(target.propList)) {\n target.propList = {\n props: [],\n complexProps: [],\n colProps: [],\n events: [],\n propNames: [],\n complexPropNames: [],\n colPropNames: [],\n eventNames: []\n };\n }\n /* tslint:disable no-any */\n target.propList[propertyType + 's'].push({\n propertyName: key,\n defaultValue: defaultValue,\n type: type\n });\n target.propList[propertyType + 'Names'].push(key);\n /* tslint:enable no-any */\n}\n/**\n * Returns an object containing the builder properties\n * @param {Function} component\n * @private\n */\nfunction getBuilderProperties(component) {\n if (isUndefined(component.prototype.builderObject)) {\n component.prototype.builderObject = {\n properties: {}, propCollections: [], add: function () {\n this.isPropertyArray = true;\n this.propCollections.push(extend({}, this.properties, {}));\n }\n };\n var rex = /complex/;\n for (var _i = 0, _a = Object.keys(component.prototype.propList); _i < _a.length; _i++) {\n var key = _a[_i];\n var _loop_1 = function (prop) {\n if (rex.test(key)) {\n component.prototype.builderObject[prop.propertyName] = function (value) {\n var childType = {};\n merge(childType, getBuilderProperties(prop.type));\n value(childType);\n var tempValue;\n if (!childType.isPropertyArray) {\n tempValue = extend({}, childType.properties, {});\n }\n else {\n tempValue = childType.propCollections;\n }\n this.properties[prop.propertyName] = tempValue;\n childType.properties = {};\n childType.propCollections = [];\n childType.isPropertyArray = false;\n return this;\n };\n }\n else {\n component.prototype.builderObject[prop.propertyName] = function (value) {\n this.properties[prop.propertyName] = value;\n return this;\n };\n }\n };\n for (var _b = 0, _c = component.prototype.propList[key]; _b < _c.length; _b++) {\n var prop = _c[_b];\n _loop_1(prop);\n }\n }\n }\n return component.prototype.builderObject;\n}\n/**\n * Method used to create builder for the components\n * @param {any} component -specifies the target component for which builder to be created.\n * @private\n */\nexport function CreateBuilder(component) {\n var builderFunction = function (element) {\n this.element = element;\n return this;\n };\n var instanceFunction = function (element) {\n if (!builderFunction.prototype.hasOwnProperty('create')) {\n builderFunction.prototype = getBuilderProperties(component);\n builderFunction.prototype.create = function () {\n var temp = extend({}, {}, this.properties);\n this.properties = {};\n return new component(temp, this.element);\n };\n }\n return new builderFunction(element);\n };\n return instanceFunction;\n}\n/**\n * Returns parent options for the object\n * @param {Object} context\n * @param {string} prefix\n * @private\n */\nfunction getParentContext(context, prefix) {\n if (context.hasOwnProperty('parentObj') === false) {\n return { context: context, prefix: prefix };\n }\n else {\n var curText = getValue('propName', context);\n if (curText) {\n prefix = curText + '-' + prefix;\n }\n return getParentContext(getValue('parentObj', context), prefix);\n }\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { createElement, selectAll, closest } from './dom';\nimport { Base } from './base';\nimport { Browser } from './browser';\nimport { EventHandler } from './event-handler';\nimport { Property, NotifyPropertyChanges, Event } from './notify-property-change';\n/**\n * The Animation framework provide options to animate the html DOM elements\n * ```typescript\n * let animeObject = new Animation({\n * name: 'SlideLeftIn',\n * duration: 1000\n * });\n * animeObject.animate('#anime1');\n * animeObject.animate('#anime2', { duration: 500 });\n * ```\n */\nvar Animation = /** @class */ (function (_super) {\n __extends(Animation, _super);\n function Animation(options) {\n var _this = _super.call(this, options, undefined) || this;\n /**\n * @private\n */\n _this.easing = {\n ease: 'cubic-bezier(0.250, 0.100, 0.250, 1.000)',\n linear: 'cubic-bezier(0.250, 0.250, 0.750, 0.750)',\n easeIn: 'cubic-bezier(0.420, 0.000, 1.000, 1.000)',\n easeOut: 'cubic-bezier(0.000, 0.000, 0.580, 1.000)',\n easeInOut: 'cubic-bezier(0.420, 0.000, 0.580, 1.000)',\n elasticInOut: 'cubic-bezier(0.5,-0.58,0.38,1.81)',\n elasticIn: 'cubic-bezier(0.17,0.67,0.59,1.81)',\n elasticOut: 'cubic-bezier(0.7,-0.75,0.99,1.01)'\n };\n return _this;\n }\n Animation_1 = Animation;\n /**\n * Applies animation to the current element.\n * @param {string | HTMLElement} element - Element which needs to be animated.\n * @param {AnimationModel} options - Overriding default animation settings.\n * @return {void}\n */\n Animation.prototype.animate = function (element, options) {\n options = !options ? {} : options;\n var model = this.getModel(options);\n if (typeof element === 'string') {\n var elements = Array.prototype.slice.call(selectAll(element, document));\n for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n var element_1 = elements_1[_i];\n model.element = element_1;\n Animation_1.delayAnimation(model);\n }\n }\n else {\n model.element = element;\n Animation_1.delayAnimation(model);\n }\n };\n /**\n * Stop the animation effect on animated element.\n * @param {HTMLElement} element - Element which needs to be stop the animation.\n * @param {AnimationOptions} model - Handling the animation model at stop function.\n * @return {void}\n */\n Animation.stop = function (element, model) {\n element.style.animation = '';\n element.removeAttribute('e-animate');\n var animationId = element.getAttribute('e-animation-id');\n if (animationId) {\n var frameId = parseInt(animationId, 10);\n cancelAnimationFrame(frameId);\n element.removeAttribute('e-animation-id');\n }\n if (model && model.end) {\n model.end.call(this, model);\n }\n };\n /**\n * Set delay to animation element\n * @param {AnimationModel} model\n * @returns {void}\n */\n Animation.delayAnimation = function (model) {\n if (model.delay) {\n setTimeout(function () { Animation_1.applyAnimation(model); }, model.delay);\n }\n else {\n Animation_1.applyAnimation(model);\n }\n };\n /**\n * Triggers animation\n * @param {AnimationModel} model\n * @returns {void}\n */\n Animation.applyAnimation = function (model) {\n var _this = this;\n model.timeStamp = 0;\n var step = 0;\n var timerId = 0;\n var startTime = 0;\n var prevTimeStamp = 0;\n var duration = model.duration;\n model.element.setAttribute('e-animate', 'true');\n var startAnimation = function (timeStamp) {\n try {\n if (timeStamp) {\n // let step: number = model.timeStamp = timeStamp - startTime;\n /** phantomjs workaround for timestamp fix */\n prevTimeStamp = prevTimeStamp === 0 ? timeStamp : prevTimeStamp;\n model.timeStamp = (timeStamp + model.timeStamp) - prevTimeStamp;\n prevTimeStamp = timeStamp;\n /** phantomjs workaround end */\n // trigger animation begin event\n if (!step && model.begin) {\n model.begin.call(_this, model);\n }\n step = step + 1;\n var avg = model.timeStamp / step;\n if (model.timeStamp < duration && model.timeStamp + avg < duration && model.element.getAttribute('e-animate')) {\n // apply animation effect to the current element \n model.element.style.animation = model.name + ' ' + model.duration + 'ms ' + model.timingFunction;\n if (model.progress) {\n model.progress.call(_this, model);\n }\n // repeat requestAnimationFrame \n requestAnimationFrame(startAnimation);\n }\n else {\n // clear requestAnimationFrame\n cancelAnimationFrame(timerId);\n model.element.removeAttribute('e-animation-id');\n model.element.removeAttribute('e-animate');\n model.element.style.animation = '';\n if (model.end) {\n model.end.call(_this, model);\n }\n }\n }\n else {\n startTime = performance.now();\n // set initial requestAnimationFrame\n timerId = requestAnimationFrame(startAnimation);\n model.element.setAttribute('e-animation-id', timerId.toString());\n }\n }\n catch (e) {\n cancelAnimationFrame(timerId);\n model.element.removeAttribute('e-animation-id');\n if (model.fail) {\n model.fail.call(_this, e);\n }\n }\n };\n startAnimation();\n };\n /**\n * Returns Animation Model\n * @param {AnimationModel} options\n * @returns {AnimationModel}\n */\n Animation.prototype.getModel = function (options) {\n return {\n name: options.name || this.name,\n delay: options.delay || this.delay,\n duration: (options.duration !== undefined ? options.duration : this.duration),\n begin: options.begin || this.begin,\n end: options.end || this.end,\n fail: options.fail || this.fail,\n progress: options.progress || this.progress,\n timingFunction: this.easing[options.timingFunction] ? this.easing[options.timingFunction] :\n (options.timingFunction || this.easing[this.timingFunction])\n };\n };\n /**\n * @private\n */\n Animation.prototype.onPropertyChanged = function (newProp, oldProp) {\n // no code needed\n };\n /**\n * Returns module name as animation\n * @private\n */\n Animation.prototype.getModuleName = function () {\n return 'animation';\n };\n /**\n * @private\n */\n Animation.prototype.destroy = function () {\n //Override base destroy;\n };\n __decorate([\n Property('FadeIn')\n ], Animation.prototype, \"name\", void 0);\n __decorate([\n Property(400)\n ], Animation.prototype, \"duration\", void 0);\n __decorate([\n Property('ease')\n ], Animation.prototype, \"timingFunction\", void 0);\n __decorate([\n Property(0)\n ], Animation.prototype, \"delay\", void 0);\n __decorate([\n Event()\n ], Animation.prototype, \"progress\", void 0);\n __decorate([\n Event()\n ], Animation.prototype, \"begin\", void 0);\n __decorate([\n Event()\n ], Animation.prototype, \"end\", void 0);\n __decorate([\n Event()\n ], Animation.prototype, \"fail\", void 0);\n Animation = Animation_1 = __decorate([\n NotifyPropertyChanges\n ], Animation);\n return Animation;\n var Animation_1;\n}(Base));\nexport { Animation };\n/**\n * Ripple provides material theme's wave effect when an element is clicked\n * ```html\n * \n * \n * ```\n * @private\n * @param HTMLElement element - Target element\n * @param RippleOptions rippleOptions - Ripple options .\n */\nexport function rippleEffect(element, rippleOptions, done) {\n var rippleModel = getRippleModel(rippleOptions);\n if (rippleModel.rippleFlag === false || (rippleModel.rippleFlag === undefined && !isRippleEnabled)) {\n return Function;\n }\n element.setAttribute('data-ripple', 'true');\n EventHandler.add(element, 'mousedown', rippleHandler, { parent: element, rippleOptions: rippleModel });\n EventHandler.add(element, 'mouseup', rippleUpHandler, { parent: element, rippleOptions: rippleModel, done: done });\n EventHandler.add(element, 'mouseleave', rippleLeaveHandler, { parent: element, rippleOptions: rippleModel });\n if (Browser.isPointer) {\n EventHandler.add(element, 'transitionend', rippleLeaveHandler, { parent: element, rippleOptions: rippleModel });\n }\n return (function () {\n element.removeAttribute('data-ripple');\n EventHandler.remove(element, 'mousedown', rippleHandler);\n EventHandler.remove(element, 'mouseup', rippleUpHandler);\n EventHandler.remove(element, 'mouseleave', rippleLeaveHandler);\n EventHandler.remove(element, 'transitionend', rippleLeaveHandler);\n });\n}\nfunction getRippleModel(rippleOptions) {\n var rippleModel = {\n selector: rippleOptions && rippleOptions.selector ? rippleOptions.selector : null,\n ignore: rippleOptions && rippleOptions.ignore ? rippleOptions.ignore : null,\n rippleFlag: rippleOptions && rippleOptions.rippleFlag,\n isCenterRipple: rippleOptions && rippleOptions.isCenterRipple,\n duration: rippleOptions && rippleOptions.duration ? rippleOptions.duration : 350\n };\n return rippleModel;\n}\n/**\n * Handler for ripple event\n * @param {MouseEvent} e\n * @returns {void}\n * @private\n */\nfunction rippleHandler(e) {\n var target = (e.target);\n var selector = this.rippleOptions.selector;\n var element = selector ? closest(target, selector) : target;\n if (!element || (this.rippleOptions && closest(target, this.rippleOptions.ignore))) {\n return;\n }\n var offset = element.getBoundingClientRect();\n var offsetX = e.pageX - document.body.scrollLeft;\n var offsetY = e.pageY - ((!document.body.scrollTop && document.documentElement) ?\n document.documentElement.scrollTop : document.body.scrollTop);\n var pageX = Math.max(Math.abs(offsetX - offset.left), Math.abs(offsetX - offset.right));\n var pageY = Math.max(Math.abs(offsetY - offset.top), Math.abs(offsetY - offset.bottom));\n var radius = Math.sqrt(pageX * pageX + pageY * pageY);\n var diameter = radius * 2 + 'px';\n var x = offsetX - offset.left - radius;\n var y = offsetY - offset.top - radius;\n if (this.rippleOptions && this.rippleOptions.isCenterRipple) {\n x = 0;\n y = 0;\n diameter = '100%';\n }\n element.classList.add('e-ripple');\n var duration = this.rippleOptions.duration.toString();\n var styles = 'width: ' + diameter + ';height: ' + diameter + ';left: ' + x + 'px;top: ' + y + 'px;' +\n 'transition-duration: ' + duration + 'ms;';\n var rippleElement = createElement('div', { className: 'e-ripple-element', styles: styles });\n element.appendChild(rippleElement);\n window.getComputedStyle(rippleElement).getPropertyValue('opacity');\n rippleElement.style.transform = 'scale(1)';\n if (element !== this.parent) {\n EventHandler.add(element, 'mouseleave', rippleLeaveHandler, { parent: this.parent, rippleOptions: this.rippleOptions });\n }\n}\n/**\n * Handler for ripple element mouse up event\n * @param {MouseEvent} e\n * @returns {void}\n * @private\n */\nfunction rippleUpHandler(e) {\n removeRipple(e, this);\n}\n/**\n * Handler for ripple element mouse move event\n * @param {MouseEvent} e\n * @returns {void}\n * @private\n */\nfunction rippleLeaveHandler(e) {\n removeRipple(e, this);\n}\n/**\n * Handler for removing ripple element\n * @param {MouseEvent} e\n * @param {rippleArgs} eventArgs\n * @returns {void}\n * @private\n */\nfunction removeRipple(e, eventArgs) {\n var duration = eventArgs.rippleOptions.duration;\n var target = (e.target);\n var selector = eventArgs.rippleOptions.selector;\n var element = selector ? closest(target, selector) : target;\n if (!element || (element && element.className.indexOf('e-ripple') === -1)) {\n return;\n }\n var rippleElements = selectAll('.e-ripple-element', element);\n var rippleElement = rippleElements[rippleElements.length - 1];\n if (rippleElement) {\n rippleElement.style.opacity = '0.5';\n }\n if (eventArgs.parent !== element) {\n EventHandler.remove(element, 'mouseleave', rippleLeaveHandler);\n }\n /* tslint:disable:align */\n setTimeout(function () {\n if (rippleElement && rippleElement.parentNode) {\n rippleElement.parentNode.removeChild(rippleElement);\n }\n if (!element.getElementsByClassName('e-ripple-element').length) {\n element.classList.remove('e-ripple');\n }\n if (eventArgs.done) {\n eventArgs.done(e);\n }\n }, duration);\n}\nexport var isRippleEnabled = false;\n/**\n * Animation Module provides support to enable ripple effect functionality to Essential JS 2 components.\n * @param {boolean} isRipple Specifies the boolean value to enable or disable ripple effect.\n * @returns {boolean}\n */\nexport function enableRipple(isRipple) {\n isRippleEnabled = isRipple;\n return isRippleEnabled;\n}\n","import { DateFormat } from './intl/date-formatter';\nimport { NumberFormat } from './intl/number-formatter';\nimport { DateParser } from './intl/date-parser';\nimport { NumberParser } from './intl/number-parser';\nimport { IntlBase } from './intl/intl-base';\nimport { extend, getValue } from './util';\nimport { Observer } from './observer';\n/**\n * Specifies the observer used for external change detection.\n */\nexport var onIntlChange = new Observer();\n/**\n * Specifies the default rtl status for EJ2 components.\n */\nexport var rightToLeft = false;\n/**\n * Specifies the CLDR data loaded for internationalization functionalities.\n * @private\n */\nexport var cldrData = {};\n/**\n * Specifies the default culture value to be considered.\n * @private\n */\nexport var defaultCulture = 'en-US';\n/**\n * Specifies default currency code to be considered\n * @private\n */\nexport var defaultCurrencyCode = 'USD';\nvar mapper = ['numericObject', 'dateObject'];\n/**\n * Internationalization class provides support to parse and format the number and date object to the desired format.\n * ```typescript\n * // To set the culture globally\n * setCulture('en-GB');\n *\n * // To set currency code globally\n * setCurrencyCode('EUR');\n *\n * //Load cldr data\n * loadCldr(gregorainData);\n * loadCldr(timeZoneData);\n * loadCldr(numbersData);\n * loadCldr(numberSystemData);\n *\n * // To use formatter in component side\n * let Intl:Internationalization = new Internationalization();\n *\n * // Date formatting\n * let dateFormatter: Function = Intl.getDateFormat({skeleton:'long',type:'dateTime'});\n * dateFormatter(new Date('11/2/2016'));\n * dateFormatter(new Date('25/2/2030'));\n * Intl.formatDate(new Date(),{skeleton:'E'});\n *\n * //Number formatting\n * let numberFormatter: Function = Intl.getNumberFormat({skeleton:'C5'})\n * numberFormatter(24563334);\n * Intl.formatNumber(123123,{skeleton:'p2'});\n *\n * // Date parser\n * let dateParser: Function = Intl.getDateParser({skeleton:'short',type:'time'});\n * dateParser('10:30 PM');\n * Intl.parseDate('10',{skeleton:'H'});\n * ```\n */\nvar Internationalization = /** @class */ (function () {\n function Internationalization(cultureName) {\n if (cultureName) {\n this.culture = cultureName;\n }\n }\n /**\n * Returns the format function for given options.\n * @param {DateFormatOptions} options - Specifies the format options in which the format function will return.\n * @returns {Function}\n */\n Internationalization.prototype.getDateFormat = function (options) {\n return DateFormat.dateFormat(this.getCulture(), options || { type: 'date', skeleton: 'short' }, cldrData);\n };\n /**\n * Returns the format function for given options.\n * @param {NumberFormatOptions} options - Specifies the format options in which the format function will return.\n * @returns {Function}\n */\n Internationalization.prototype.getNumberFormat = function (options) {\n if (options && !options.currency) {\n options.currency = defaultCurrencyCode;\n }\n return NumberFormat.numberFormatter(this.getCulture(), options || {}, cldrData);\n };\n /**\n * Returns the parser function for given options.\n * @param {DateFormatOptions} options - Specifies the format options in which the parser function will return.\n * @returns {Function}\n * @private\n */\n Internationalization.prototype.getDateParser = function (options) {\n return DateParser.dateParser(this.getCulture(), options || { skeleton: 'short', type: 'date' }, cldrData);\n };\n /**\n * Returns the parser function for given options.\n * @param {NumberFormatOptions} options - Specifies the format options in which the parser function will return.\n * @returns {Function}\n */\n Internationalization.prototype.getNumberParser = function (options) {\n return NumberParser.numberParser(this.getCulture(), options || { format: 'N' }, cldrData);\n };\n /**\n * Returns the formatted string based on format options.\n * @param {Number} value - Specifies the number to format.\n * @param {NumberFormatOptions} option - Specifies the format options in which the number will be formatted.\n * @returns {string}\n */\n Internationalization.prototype.formatNumber = function (value, option) {\n return this.getNumberFormat(option)(value);\n };\n /**\n * Returns the formatted date string based on format options.\n * @param {Number} value - Specifies the number to format.\n * @param {DateFormatOptions} option - Specifies the format options in which the number will be formatted.\n * @returns {string}\n */\n Internationalization.prototype.formatDate = function (value, option) {\n return this.getDateFormat(option)(value);\n };\n /**\n * Returns the date object for given date string and options.\n * @param {string} value - Specifies the string to parse.\n * @param {DateFormatOptions} option - Specifies the parse options in which the date string will be parsed.\n * @returns {Date}\n */\n Internationalization.prototype.parseDate = function (value, option) {\n return this.getDateParser(option)(value);\n };\n /**\n * Returns the number object from the given string value and options.\n * @param {string} value - Specifies the string to parse.\n * @param {NumberFormatOptions} option - Specifies the parse options in which the string number will be parsed.\n * @returns {number}\n */\n Internationalization.prototype.parseNumber = function (value, option) {\n return this.getNumberParser(option)(value);\n };\n /**\n * Returns Native Date Time Pattern\n * @param {DateFormatOptions} option - Specifies the parse options for resultant date time pattern.\n * @param {boolean} isExcelFormat - Specifies format value to be converted to excel pattern.\n * @returns {string}\n * @private\n */\n Internationalization.prototype.getDatePattern = function (option, isExcelFormat) {\n return IntlBase.getActualDateTimeFormat(this.getCulture(), option, cldrData, isExcelFormat);\n };\n /**\n * Returns Native Number Pattern\n * @param {NumberFormatOptions} option - Specifies the parse options for resultant number pattern.\n * @returns {string}\n * @private\n */\n Internationalization.prototype.getNumberPattern = function (option) {\n return IntlBase.getActualNumberFormat(this.getCulture(), option, cldrData);\n };\n Internationalization.prototype.getCulture = function () {\n return this.culture || defaultCulture;\n };\n return Internationalization;\n}());\nexport { Internationalization };\n/**\n * Set the default culture to all EJ2 components\n * @param {string} cultureName - Specifies the culture name to be set as default culture.\n */\nexport function setCulture(cultureName) {\n defaultCulture = cultureName;\n onIntlChange.notify('notifyExternalChange', { 'locale': defaultCulture });\n}\n/**\n * Set the default currency code to all EJ2 components\n * @param {string} currencyCode Specifies the culture name to be set as default culture.\n * @returns {void}\n */\nexport function setCurrencyCode(currencyCode) {\n defaultCurrencyCode = currencyCode;\n onIntlChange.notify('notifyExternalChange', { 'currencyCode': defaultCurrencyCode });\n}\n/**\n * Load the CLDR data into context\n * @param {Object[]} obj Specifies the CLDR data's to be used for formatting and parser.\n * @returns {void}\n */\nexport function loadCldr() {\n var data = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n data[_i] = arguments[_i];\n }\n for (var _a = 0, data_1 = data; _a < data_1.length; _a++) {\n var obj = data_1[_a];\n extend(cldrData, obj, {}, true);\n }\n}\n/**\n * To enable or disable RTL functionality for all components globally.\n * @param {boolean} status - Optional argument Specifies the status value to enable or disable rtl option.\n * @returns {void}\n */\nexport function enableRtl(status) {\n if (status === void 0) { status = true; }\n rightToLeft = status;\n onIntlChange.notify('notifyExternalChange', { enableRtl: rightToLeft });\n}\n/**\n * To get the numeric CLDR object for given culture\n * @param {string} locale - Specifies the locale for which numericObject to be returned.\n * @ignore\n * @private\n */\nexport function getNumericObject(locale, type) {\n /* tslint:disable no-any */\n var numObject = IntlBase.getDependables(cldrData, locale, true)[mapper[0]];\n var dateObject = IntlBase.getDependables(cldrData, locale)[mapper[1]];\n var numSystem = getValue('defaultNumberingSystem', numObject);\n var symbPattern = getValue('symbols-numberSystem-' + numSystem, numObject);\n var pattern = IntlBase.getSymbolPattern(type || 'decimal', numSystem, numObject, false);\n return extend(symbPattern, IntlBase.getFormatData(pattern, true, '', true), { 'dateSeparator': IntlBase.getDateSeparator(dateObject) });\n}\n/**\n * To get the default date CLDR object.\n * @ignore\n * @private\n */\nexport function getDefaultDateObject() {\n return IntlBase.getDependables(cldrData, '', false)[mapper[1]];\n}\n","/**\n * Template Engine\n */\nvar LINES = new RegExp('\\\\n|\\\\r|\\\\s\\\\s+', 'g');\nvar QUOTES = new RegExp(/'|\"/g);\nvar IF_STMT = new RegExp('if ?\\\\(');\nvar ELSEIF_STMT = new RegExp('else if ?\\\\(');\nvar ELSE_STMT = new RegExp('else');\nvar FOR_STMT = new RegExp('for ?\\\\(');\nvar IF_OR_FOR = new RegExp('(\\/if|\\/for)');\nvar CALL_FUNCTION = new RegExp('\\\\((.*)\\\\)', '');\nvar NOT_NUMBER = new RegExp('^[0-9]+$', 'g');\nvar WORD = new RegExp('[\\\\w\"\\'.\\\\s+]+', 'g');\nvar DBL_QUOTED_STR = new RegExp('\"(.*?)\"', 'g');\nvar exp = new RegExp('\\\\${([^}]*)}', 'g');\n// let cachedTemplate: Object = {};\n/**\n * The function to set regular expression for template expression string.\n * @param {RegExp} value - Value expression.\n * @private\n */\nexport function expression(value) {\n if (value) {\n exp = value;\n }\n return exp;\n}\n// /**\n// * To render the template string from the given data.\n// * @param {string} template - String Template.\n// * @param {Object[]|JSON} data - DataSource for the template.\n// * @param {Object} helper? - custom helper object.\n// */\n// export function template(template: string, data: JSON, helper?: Object): string {\n// let hash: string = hashCode(template);\n// let tmpl: Function;\n// if (!cachedTemplate[hash]) {\n// tmpl = cachedTemplate[hash] = compile(template, helper);\n// } else {\n// tmpl = cachedTemplate[hash];\n// }\n// return tmpl(data);\n// }\n/**\n * Compile the template string into template function.\n * @param {string} template - The template string which is going to convert.\n * @param {Object} helper? - Helper functions as an object.\n * @private\n */\nexport function compile(template, helper) {\n var argName = 'data';\n var evalExpResult = evalExp(template, argName, helper);\n var fnCode = \"var str=\\\"\" + evalExpResult + \"\\\"; return str;\";\n // tslint:disable-next-line:no-function-constructor-with-string-args\n var fn = new Function(argName, fnCode);\n return fn.bind(helper);\n}\n// function used to evaluate the function expression\nfunction evalExp(str, nameSpace, helper) {\n var varCOunt = 0;\n /**\n * Variable containing Local Keys\n */\n var localKeys = [];\n return str.replace(LINES, '').replace(DBL_QUOTED_STR, '\\'$1\\'').replace(exp, function (match, cnt, offset, matchStr) {\n var matches = cnt.match(CALL_FUNCTION);\n // matches to detect any function calls\n if (matches) {\n var rlStr = matches[1];\n if (ELSEIF_STMT.test(cnt)) {\n //handling else-if condition\n cnt = '\";} ' + cnt.replace(matches[1], rlStr.replace(WORD, function (str) {\n str = str.trim();\n return addNameSpace(str, !(QUOTES.test(str)) && (localKeys.indexOf(str) === -1), nameSpace, localKeys);\n })) + '{ \\n str = str + \"';\n }\n else if (IF_STMT.test(cnt)) {\n //handling if condition\n cnt = '\"; ' + cnt.replace(matches[1], rlStr.replace(WORD, function (strs) {\n strs = strs.trim();\n return addNameSpace(strs, !(QUOTES.test(strs)) && (localKeys.indexOf(strs) === -1), nameSpace, localKeys);\n })) + '{ \\n str = str + \"';\n }\n else if (FOR_STMT.test(cnt)) {\n //handling for condition\n var rlStr_1 = matches[1].split(' of ');\n // replace for each into actual JavaScript\n cnt = '\"; ' + cnt.replace(matches[1], function (mtc) {\n localKeys.push(rlStr_1[0]);\n localKeys.push(rlStr_1[0] + 'Index');\n varCOunt = varCOunt + 1;\n // tslint:disable-next-line\n return 'var i' + varCOunt + '=0; i' + varCOunt + ' < ' + addNameSpace(rlStr_1[1], true, nameSpace, localKeys) + '.length; i' + varCOunt + '++';\n }) + '{ \\n ' + rlStr_1[0] + '= ' + addNameSpace(rlStr_1[1], true, nameSpace, localKeys)\n + '[i' + varCOunt + ']; \\n var ' + rlStr_1[0] + 'Index=i' + varCOunt + '; \\n str = str + \"';\n }\n else {\n //helper function handling\n var fnStr = cnt.split('(');\n var fNameSpace = (helper && helper.hasOwnProperty(fnStr[0]) ? 'this.' : 'global');\n fNameSpace = (/\\./.test(fnStr[0]) ? '' : fNameSpace);\n cnt = '\" + ' + (fNameSpace === 'global' ? '' : fNameSpace) +\n cnt.replace(rlStr, addNameSpace(matches[1].replace(',', nameSpace + '.'), (fNameSpace === 'global' ? false : true), nameSpace, localKeys)) +\n '+\"';\n }\n }\n else if (ELSE_STMT.test(cnt)) {\n //handling else condition\n cnt = '\"; ' + cnt.replace(ELSE_STMT, '} else { \\n str = str + \"');\n }\n else if (!!cnt.match(IF_OR_FOR)) {\n // close condition \n cnt = cnt.replace(IF_OR_FOR, '\"; \\n } \\n str = str + \"');\n }\n else {\n // evaluate normal expression\n cnt = '\"+' + addNameSpace(cnt, (localKeys.indexOf(cnt) === -1), nameSpace, localKeys) + '+\"';\n }\n return cnt;\n });\n}\nfunction addNameSpace(str, addNS, nameSpace, ignoreList) {\n return ((addNS && !(NOT_NUMBER.test(str)) && ignoreList.indexOf(str.split('.')[0]) === -1) ? nameSpace + '.' + str : str);\n}\n// // Create hashCode for template string to storeCached function\n// function hashCode(str: string): string {\n// return str.split('').reduce((a: number, b: string) => { a = ((a << 5) - a) + b.charCodeAt(0); return a & a; }, 0).toString();\n// }\n","/**\n * Template Engine Bridge\n */\nimport { compile as render } from './template';\nimport { createElement } from './dom';\nvar HAS_ROW = /^[\\n\\r.]+\\
containerWidth) {\n if (overLeft > 0 && overRight <= 0) {\n position.left = containerRight - elemData.width;\n }\n else if (overRight > 0 && overLeft <= 0) {\n position.left = containerLeft;\n }\n else {\n position.left = overLeft > overRight ? (containerRight - elemData.width) : containerLeft;\n }\n }\n else if (overLeft > 0) {\n position.left += overLeft;\n }\n else if (overRight > 0) {\n position.left -= overRight;\n }\n }\n if (axis.Y) {\n var containerHeight = targetContainer ? getTargetContainerHeight() : getViewPortHeight();\n var containerTop = ContainerTop();\n var containerBottom = ContainerBottom();\n var overTop = containerTop - position.top;\n var overBottom = position.top + elemData.height - containerBottom;\n if (elemData.height > containerHeight) {\n if (overTop > 0 && overBottom <= 0) {\n position.top = containerBottom - elemData.height;\n }\n else if (overBottom > 0 && overTop <= 0) {\n position.top = containerTop;\n }\n else {\n position.top = overTop > overBottom ? (containerBottom - elemData.height) : containerTop;\n }\n }\n else if (overTop > 0) {\n position.top += overTop;\n }\n else if (overBottom > 0) {\n position.top -= overBottom;\n }\n }\n return position;\n}\nexport function isCollide(element, viewPortElement, x, y) {\n if (viewPortElement === void 0) { viewPortElement = null; }\n var elemOffset = calculatePosition(element, 'left', 'top');\n if (x) {\n elemOffset.left = x;\n }\n if (y) {\n elemOffset.top = y;\n }\n var data = [];\n targetContainer = viewPortElement;\n parentDocument = element.ownerDocument;\n var elementRect = element.getBoundingClientRect();\n var top = elemOffset.top;\n var left = elemOffset.left;\n var right = elemOffset.left + elementRect.width;\n var bottom = elemOffset.top + elementRect.height;\n var topData = '';\n var leftData = '';\n var yAxis = topCollideCheck(top, bottom);\n var xAxis = leftCollideCheck(left, right);\n if (yAxis.topSide) {\n data.push('top');\n }\n if (xAxis.rightSide) {\n data.push('right');\n }\n if (xAxis.leftSide) {\n data.push('left');\n }\n if (yAxis.bottomSide) {\n data.push('bottom');\n }\n return data;\n}\nexport function flip(element, target, offsetX, offsetY, positionX, positionY, viewPortElement, axis, fixedParent) {\n if (viewPortElement === void 0) { viewPortElement = null; }\n if (axis === void 0) { axis = { X: true, Y: true }; }\n if (!target || !element || !positionX || !positionY || (!axis.X && !axis.Y)) {\n return;\n }\n var tEdge = { TL: null,\n TR: null,\n BL: null,\n BR: null };\n var eEdge = {\n TL: null,\n TR: null,\n BL: null,\n BR: null\n };\n var elementRect = element.getBoundingClientRect();\n var pos = {\n posX: positionX, posY: positionY, offsetX: offsetX, offsetY: offsetY, position: { left: 0, top: 0 }\n };\n targetContainer = viewPortElement;\n parentDocument = target.ownerDocument;\n updateElementData(target, tEdge, pos, fixedParent, elementRect);\n setPosition(eEdge, pos, elementRect);\n if (axis.X) {\n leftFlip(target, eEdge, tEdge, pos, elementRect, true);\n }\n if (axis.Y && tEdge.TL.top > -1) {\n topFlip(target, eEdge, tEdge, pos, elementRect, true);\n }\n setPopup(element, pos, elementRect);\n}\nfunction setPopup(element, pos, elementRect) {\n var left = 0;\n var top = 0;\n if (element.offsetParent != null\n && (getComputedStyle(element.offsetParent).position === 'absolute' ||\n getComputedStyle(element.offsetParent).position === 'relative')) {\n var data = calculatePosition(element.offsetParent, 'left', 'top', false, elementRect);\n left = data.left;\n top = data.top;\n }\n element.style.top = (pos.position.top + pos.offsetY - (top)) + 'px';\n element.style.left = (pos.position.left + pos.offsetX - (left)) + 'px';\n}\nfunction updateElementData(target, edge, pos, fixedParent, elementRect) {\n pos.position = calculatePosition(target, pos.posX, pos.posY, fixedParent, elementRect);\n edge.TL = calculatePosition(target, 'left', 'top', fixedParent, elementRect);\n edge.TR = calculatePosition(target, 'right', 'top', fixedParent, elementRect);\n edge.BR = calculatePosition(target, 'left', 'bottom', fixedParent, elementRect);\n edge.BL = calculatePosition(target, 'right', 'bottom', fixedParent, elementRect);\n}\nfunction setPosition(eStatus, pos, elementRect) {\n eStatus.TL = { top: pos.position.top + pos.offsetY, left: pos.position.left + pos.offsetX };\n eStatus.TR = { top: eStatus.TL.top, left: eStatus.TL.left + elementRect.width };\n eStatus.BL = { top: eStatus.TL.top + elementRect.height,\n left: eStatus.TL.left };\n eStatus.BR = { top: eStatus.TL.top + elementRect.height,\n left: eStatus.TL.left + elementRect.width };\n}\nfunction leftCollideCheck(left, right) {\n var leftSide = false;\n var rightSide = false;\n if (((left - getBodyScrollLeft()) < ContainerLeft())) {\n leftSide = true;\n }\n if (right > ContainerRight()) {\n rightSide = true;\n }\n return { leftSide: leftSide, rightSide: rightSide };\n}\nfunction leftFlip(target, edge, tEdge, pos, elementRect, deepCheck) {\n var collideSide = leftCollideCheck(edge.TL.left, edge.TR.left);\n if ((tEdge.TL.left - getBodyScrollLeft()) <= ContainerLeft()) {\n collideSide.leftSide = false;\n }\n if (tEdge.TR.left >= ContainerRight()) {\n collideSide.rightSide = false;\n }\n if ((collideSide.leftSide && !collideSide.rightSide) || (!collideSide.leftSide && collideSide.rightSide)) {\n if (pos.posX === 'right') {\n pos.posX = 'left';\n }\n else {\n pos.posX = 'right';\n }\n pos.offsetX = pos.offsetX + elementRect.width;\n pos.offsetX = -1 * pos.offsetX;\n pos.position = calculatePosition(target, pos.posX, pos.posY, false);\n setPosition(edge, pos, elementRect);\n if (deepCheck) {\n leftFlip(target, edge, tEdge, pos, elementRect, false);\n }\n }\n}\nfunction topFlip(target, edge, tEdge, pos, elementRect, deepCheck) {\n var collideSide = topCollideCheck(edge.TL.top, edge.BL.top);\n if ((tEdge.TL.top - getBodyScrollTop()) <= ContainerTop()) {\n collideSide.topSide = false;\n }\n if (tEdge.BL.top >= ContainerBottom()) {\n collideSide.bottomSide = false;\n }\n if ((collideSide.topSide && !collideSide.bottomSide) || (!collideSide.topSide && collideSide.bottomSide)) {\n if (pos.posY === 'top') {\n pos.posY = 'bottom';\n }\n else {\n pos.posY = 'top';\n }\n pos.offsetY = pos.offsetY + elementRect.height;\n pos.offsetY = -1 * pos.offsetY;\n pos.position = calculatePosition(target, pos.posX, pos.posY, false, elementRect);\n setPosition(edge, pos, elementRect);\n if (deepCheck) {\n topFlip(target, edge, tEdge, pos, elementRect, false);\n }\n }\n}\nfunction topCollideCheck(top, bottom) {\n var topSide = false;\n var bottomSide = false;\n if ((top - getBodyScrollTop()) < ContainerTop()) {\n topSide = true;\n }\n if (bottom > ContainerBottom()) {\n bottomSide = true;\n }\n return { topSide: topSide, bottomSide: bottomSide };\n}\nfunction getTargetContainerWidth() {\n return targetContainer.getBoundingClientRect().width;\n}\nfunction getTargetContainerHeight() {\n return targetContainer.getBoundingClientRect().height;\n}\nfunction getTargetContainerLeft() {\n return targetContainer.getBoundingClientRect().left;\n}\nfunction getTargetContainerTop() {\n return targetContainer.getBoundingClientRect().top;\n}\nfunction ContainerTop() {\n if (targetContainer) {\n return getTargetContainerTop();\n }\n return 0;\n}\nfunction ContainerLeft() {\n if (targetContainer) {\n return getTargetContainerLeft();\n }\n return 0;\n}\nfunction ContainerRight() {\n if (targetContainer) {\n return (getBodyScrollLeft() + getTargetContainerLeft() + getTargetContainerWidth());\n }\n return (getBodyScrollLeft() + getViewPortWidth());\n}\nfunction ContainerBottom() {\n if (targetContainer) {\n return (getBodyScrollTop() + getTargetContainerTop() + getTargetContainerHeight());\n }\n return (getBodyScrollTop() + getViewPortHeight());\n}\nfunction getBodyScrollTop() {\n // if(targetContainer)\n // return targetContainer.scrollTop;\n return parentDocument.documentElement.scrollTop || parentDocument.body.scrollTop;\n}\nfunction getBodyScrollLeft() {\n // if(targetContainer)\n // return targetContainer.scrollLeft;\n return parentDocument.documentElement.scrollLeft || parentDocument.body.scrollLeft;\n}\nfunction getViewPortHeight() {\n return window.innerHeight;\n}\nfunction getViewPortWidth() {\n return window.innerWidth;\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { setStyleAttribute, addClass, removeClass, ChildProperty, Complex } from '@syncfusion/ej2-base';\nimport { isNullOrUndefined, formatUnit } from '@syncfusion/ej2-base';\nimport { Browser } from '@syncfusion/ej2-base';\nimport { calculatePosition, calculateRelativeBasedPosition } from '../common/position';\nimport { Animation, Property, Event, Component } from '@syncfusion/ej2-base';\nimport { NotifyPropertyChanges } from '@syncfusion/ej2-base';\nimport { EventHandler } from '@syncfusion/ej2-base';\nimport { flip, fit, isCollide } from '../common/collision';\n/**\n * Specifies the offset position values.\n */\nvar PositionData = /** @class */ (function (_super) {\n __extends(PositionData, _super);\n function PositionData() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('left')\n ], PositionData.prototype, \"X\", void 0);\n __decorate([\n Property('top')\n ], PositionData.prototype, \"Y\", void 0);\n return PositionData;\n}(ChildProperty));\nexport { PositionData };\n// don't use space in classNames\nvar CLASSNAMES = {\n ROOT: 'e-popup',\n RTL: 'e-rtl',\n OPEN: 'e-popup-open',\n CLOSE: 'e-popup-close'\n};\n/**\n * Represents the Popup Component\n * ```html\n *
\n *
Popup Content
\n * ```\n * ```typescript\n * \n * ```\n */\nvar Popup = /** @class */ (function (_super) {\n __extends(Popup, _super);\n function Popup(element, options) {\n var _this = _super.call(this, options, element) || this;\n _this.fixedParent = false;\n return _this;\n }\n /**\n * Called internally if any of the property value changed.\n * @private\n */\n Popup.prototype.onPropertyChanged = function (newProp, oldProp) {\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'width':\n setStyleAttribute(this.element, { 'width': formatUnit(newProp.width) });\n break;\n case 'height':\n setStyleAttribute(this.element, { 'height': formatUnit(newProp.height) });\n break;\n case 'zIndex':\n setStyleAttribute(this.element, { 'zIndex': newProp.zIndex });\n break;\n case 'enableRtl':\n this.setEnableRtl();\n break;\n case 'position':\n case 'relateTo':\n this.refreshPosition();\n break;\n case 'offsetX':\n var x = newProp.offsetX - oldProp.offsetX;\n this.element.style.left = (parseInt(this.element.style.left, 10) + (x)).toString() + 'px';\n break;\n case 'offsetY':\n var y = newProp.offsetY - oldProp.offsetY;\n this.element.style.top = (parseInt(this.element.style.top, 10) + (y)).toString() + 'px';\n break;\n case 'content':\n this.setContent();\n break;\n case 'actionOnScroll':\n if (newProp.actionOnScroll !== 'none') {\n this.wireScrollEvents();\n }\n else {\n this.unwireScrollEvents();\n }\n break;\n }\n }\n };\n /**\n * gets the Component module name.\n * @private\n */\n Popup.prototype.getModuleName = function () {\n return 'popup';\n };\n /**\n * gets the persisted state properties of the Component.\n */\n Popup.prototype.getPersistData = function () {\n return this.addOnPersist([]);\n };\n /**\n * To destroy the control.\n */\n Popup.prototype.destroy = function () {\n this.element.classList.remove(CLASSNAMES.ROOT, CLASSNAMES.RTL);\n this.unwireEvents();\n _super.prototype.destroy.call(this);\n };\n /**\n * To Initialize the control rendering\n * @private\n */\n Popup.prototype.render = function () {\n this.element.classList.add(CLASSNAMES.ROOT);\n var styles = {};\n if (this.zIndex !== 1000) {\n styles.zIndex = this.zIndex;\n }\n if (this.width !== 'auto') {\n styles.width = formatUnit(this.width);\n }\n if (this.height !== 'auto') {\n styles.height = formatUnit(this.height);\n }\n setStyleAttribute(this.element, styles);\n this.setEnableRtl();\n this.setContent();\n this.wireEvents();\n };\n Popup.prototype.wireEvents = function () {\n if (Browser.isDevice) {\n EventHandler.add(window, 'orientationchange', this.orientationOnChange, this);\n }\n if (this.actionOnScroll !== 'none') {\n this.wireScrollEvents();\n }\n };\n Popup.prototype.wireScrollEvents = function () {\n if (this.getRelateToElement()) {\n for (var _i = 0, _a = this.getScrollableParent(this.getRelateToElement()); _i < _a.length; _i++) {\n var parent_1 = _a[_i];\n EventHandler.add(parent_1, 'scroll', this.scrollRefresh, this);\n }\n }\n };\n Popup.prototype.unwireEvents = function () {\n if (Browser.isDevice) {\n EventHandler.remove(window, 'orientationchange', this.orientationOnChange);\n }\n if (this.actionOnScroll !== 'none') {\n this.unwireScrollEvents();\n }\n };\n Popup.prototype.unwireScrollEvents = function () {\n if (this.getRelateToElement()) {\n for (var _i = 0, _a = this.getScrollableParent(this.getRelateToElement()); _i < _a.length; _i++) {\n var parent_2 = _a[_i];\n EventHandler.remove(parent_2, 'scroll', this.scrollRefresh);\n }\n }\n };\n Popup.prototype.getRelateToElement = function () {\n var relateToElement = this.relateTo === '' || isNullOrUndefined(this.relateTo) ?\n document.body : this.relateTo;\n this.setProperties({ relateTo: relateToElement }, true);\n return ((typeof this.relateTo) === 'string') ?\n document.querySelector(this.relateTo) : this.relateTo;\n };\n Popup.prototype.scrollRefresh = function (e) {\n if (this.actionOnScroll === 'reposition') {\n if (!(this.element.offsetParent === e.target ||\n (this.element.offsetParent && this.element.offsetParent.tagName === 'BODY' &&\n e.target.parentElement == null))) {\n this.refreshPosition();\n }\n }\n else if (this.actionOnScroll === 'hide') {\n this.hide();\n }\n if (this.actionOnScroll !== 'none') {\n if (this.getRelateToElement()) {\n var targetVisible = this.isElementOnViewport(this.getRelateToElement(), e.target);\n if (!targetVisible && !this.targetInvisibleStatus) {\n this.trigger('targetExitViewport');\n this.targetInvisibleStatus = true;\n }\n else if (targetVisible) {\n this.targetInvisibleStatus = false;\n }\n }\n }\n };\n /**\n * This method is to get the element visibility on viewport when scroll\n * the page. This method will returns true even though 1 px of element\n * part is in visible.\n */\n Popup.prototype.isElementOnViewport = function (relateToElement, scrollElement) {\n var scrollParents = this.getScrollableParent(relateToElement);\n for (var parent_3 = 0; parent_3 < scrollParents.length; parent_3++) {\n if (this.isElementVisible(relateToElement, scrollParents[parent_3])) {\n continue;\n }\n else {\n return false;\n }\n }\n return true;\n };\n Popup.prototype.isElementVisible = function (relateToElement, scrollElement) {\n var rect = relateToElement.getBoundingClientRect();\n if (!rect.height || !rect.width) {\n return false;\n }\n if (scrollElement.getBoundingClientRect) {\n var parent_4 = scrollElement.getBoundingClientRect();\n return !(rect.bottom < parent_4.top) &&\n (!(rect.bottom > parent_4.bottom) &&\n (!(rect.right > parent_4.right) &&\n !(rect.left < parent_4.left)));\n }\n else {\n var win = window;\n var windowView = {\n top: win.scrollY,\n left: win.scrollX,\n right: win.scrollX + win.outerWidth,\n bottom: win.scrollY + win.outerHeight\n };\n var off = calculatePosition(relateToElement);\n var ele = {\n top: off.top,\n left: off.left,\n right: off.left + rect.width,\n bottom: off.top + rect.height\n };\n var elementView = {\n top: windowView.bottom - ele.top,\n left: windowView.right - ele.left,\n bottom: ele.bottom - windowView.top,\n right: ele.right - windowView.left\n };\n return elementView.top > 0\n && elementView.left > 0\n && elementView.right > 0\n && elementView.bottom > 0;\n }\n };\n /**\n * Initialize the event handler\n * @private\n */\n Popup.prototype.preRender = function () {\n //There is no event handler\n };\n Popup.prototype.setEnableRtl = function () {\n this.reposition();\n this.enableRtl ? this.element.classList.add(CLASSNAMES.RTL) : this.element.classList.remove(CLASSNAMES.RTL);\n };\n Popup.prototype.setContent = function () {\n if (!isNullOrUndefined(this.content)) {\n this.element.innerHTML = '';\n if (typeof (this.content) === 'string') {\n this.element.textContent = this.content;\n }\n else {\n this.element.appendChild(this.content);\n }\n }\n };\n Popup.prototype.orientationOnChange = function () {\n var _this = this;\n setTimeout(function () {\n _this.refreshPosition();\n }, 200);\n };\n /**\n * Based on the `relative` element and `offset` values, `Popup` element position will refreshed.\n */\n Popup.prototype.refreshPosition = function (target) {\n if (!isNullOrUndefined(target)) {\n this.checkFixedParent(target);\n }\n this.reposition();\n this.checkCollision();\n };\n Popup.prototype.reposition = function () {\n var pos;\n var relateToElement = this.getRelateToElement();\n if (typeof this.position.X === 'number' && typeof this.position.Y === 'number') {\n pos = { left: this.position.X, top: this.position.Y };\n }\n else if (relateToElement) {\n var display = this.element.style.display;\n this.element.style.display = 'block';\n pos = this.getAnchorPosition(relateToElement, this.element, this.position, this.offsetX, this.offsetY);\n this.element.style.display = display;\n }\n else {\n pos = { left: 0, top: 0 };\n }\n this.element.style.left = pos.left + 'px';\n this.element.style.top = pos.top + 'px';\n };\n Popup.prototype.getAnchorPosition = function (anchorEle, ele, position, offsetX, offsetY) {\n var eleRect = ele.getBoundingClientRect();\n var anchorRect = anchorEle.getBoundingClientRect();\n var anchor = anchorEle;\n var anchorPos = { left: 0, top: 0 };\n if (ele.offsetParent && ele.offsetParent.tagName === 'BODY' && anchorEle.tagName === 'BODY') {\n anchorPos = calculatePosition(anchorEle);\n }\n else {\n anchorPos = calculateRelativeBasedPosition(anchor, ele);\n }\n switch (position.X) {\n default:\n case 'left':\n break;\n case 'center':\n if (this.targetType === 'container') {\n anchorPos.left += (anchorRect.width / 2 - eleRect.width / 2);\n }\n else {\n anchorPos.left += (anchorRect.width / 2);\n }\n break;\n case 'right':\n if (this.targetType === 'container') {\n anchorPos.left += (anchorRect.width - eleRect.width);\n }\n else {\n anchorPos.left += (anchorRect.width);\n }\n break;\n }\n switch (position.Y) {\n default:\n case 'top':\n break;\n case 'center':\n if (this.targetType === 'container') {\n anchorPos.top += (anchorRect.height / 2 - eleRect.height / 2);\n }\n else {\n anchorPos.top += (anchorRect.height / 2);\n }\n break;\n case 'bottom':\n if (this.targetType === 'container') {\n anchorPos.top += (anchorRect.height - eleRect.height);\n }\n else {\n anchorPos.top += (anchorRect.height);\n }\n break;\n }\n anchorPos.left += offsetX;\n anchorPos.top += offsetY;\n return anchorPos;\n };\n Popup.prototype.callFlip = function (param) {\n var relateToElement = this.getRelateToElement();\n flip(this.element, relateToElement, this.offsetX, this.offsetY, this.position.X, this.position.Y, this.viewPortElement, param, this.fixedParent);\n };\n Popup.prototype.callFit = function (param) {\n if (isCollide(this.element, this.viewPortElement).length !== 0) {\n if (isNullOrUndefined(this.viewPortElement)) {\n var data = fit(this.element, this.viewPortElement, param);\n this.element.style.left = data.left + 'px';\n this.element.style.top = data.top + 'px';\n }\n else {\n var elementRect = this.element.getBoundingClientRect();\n var viewPortRect = this.viewPortElement.getBoundingClientRect();\n if (param && param.Y === true) {\n if (viewPortRect.top > elementRect.top) {\n this.element.style.top = '0px';\n }\n else if (viewPortRect.bottom < elementRect.bottom) {\n this.element.style.top = parseInt(this.element.style.top, 10) - (elementRect.bottom - viewPortRect.bottom) + 'px';\n }\n }\n if (param && param.X === true) {\n if (viewPortRect.right < elementRect.right) {\n this.element.style.left = parseInt(this.element.style.left, 10) - (elementRect.right - viewPortRect.right) + 'px';\n }\n else if (viewPortRect.left > elementRect.left) {\n this.element.style.left = parseInt(this.element.style.left, 10) + (viewPortRect.left - elementRect.left) + 'px';\n }\n }\n }\n }\n };\n Popup.prototype.checkCollision = function () {\n var horz = this.collision.X;\n var vert = this.collision.Y;\n if (horz === 'none' && vert === 'none') {\n return;\n }\n if (horz === 'flip' && vert === 'flip') {\n this.callFlip({ X: true, Y: true });\n }\n else if (horz === 'fit' && vert === 'fit') {\n this.callFit({ X: true, Y: true });\n }\n else {\n if (horz === 'flip') {\n this.callFlip({ X: true, Y: false });\n }\n else if (vert === 'flip') {\n this.callFlip({ Y: true, X: false });\n }\n if (horz === 'fit') {\n this.callFit({ X: true, Y: false });\n }\n else if (vert === 'fit') {\n this.callFit({ X: false, Y: true });\n }\n }\n };\n /**\n * Shows the popup element from screen.\n * @param { AnimationModel | Function } collisionOrAnimationOptions? - To pass animation options or collision function.\n * @param { Function } collision? - To pass the collision function.\n */\n Popup.prototype.show = function (animationOptions) {\n var _this = this;\n if (this.zIndex === 1000) {\n this.zIndex = getZindexPartial(this.element);\n setStyleAttribute(this.element, { 'zIndex': this.zIndex });\n }\n animationOptions = (!isNullOrUndefined(animationOptions) && typeof animationOptions === 'object') ?\n animationOptions : this.showAnimation;\n if (this.collision.X !== 'none' || this.collision.Y !== 'none') {\n removeClass([this.element], CLASSNAMES.CLOSE);\n addClass([this.element], CLASSNAMES.OPEN);\n this.checkCollision();\n removeClass([this.element], CLASSNAMES.OPEN);\n addClass([this.element], CLASSNAMES.CLOSE);\n }\n if (!isNullOrUndefined(animationOptions)) {\n animationOptions.begin = function () {\n if (!_this.isDestroyed) {\n removeClass([_this.element], CLASSNAMES.CLOSE);\n addClass([_this.element], CLASSNAMES.OPEN);\n }\n };\n animationOptions.end = function () {\n if (!_this.isDestroyed) {\n _this.trigger('open');\n }\n };\n new Animation(animationOptions).animate(this.element);\n }\n else {\n removeClass([this.element], CLASSNAMES.CLOSE);\n addClass([this.element], CLASSNAMES.OPEN);\n this.trigger('open');\n }\n };\n /**\n * Hides the popup element from screen.\n * @param { AnimationModel } animationOptions? - To give the animation options.\n */\n Popup.prototype.hide = function (animationOptions) {\n var _this = this;\n animationOptions = (!isNullOrUndefined(animationOptions) && typeof animationOptions === 'object') ?\n animationOptions : this.hideAnimation;\n if (!isNullOrUndefined(animationOptions)) {\n animationOptions.end = function () {\n if (!_this.isDestroyed) {\n removeClass([_this.element], CLASSNAMES.OPEN);\n addClass([_this.element], CLASSNAMES.CLOSE);\n _this.trigger('close');\n }\n };\n new Animation(animationOptions).animate(this.element);\n }\n else {\n removeClass([this.element], CLASSNAMES.OPEN);\n addClass([this.element], CLASSNAMES.CLOSE);\n this.trigger('close');\n }\n };\n /**\n * Gets scrollable parent elements for the given element.\n * @param { HTMLElement } element - Specify the element to get the scrollable parents of it.\n */\n Popup.prototype.getScrollableParent = function (element) {\n this.checkFixedParent(element);\n return getScrollableParent(element, this.fixedParent);\n };\n Popup.prototype.checkFixedParent = function (element) {\n var parent = element.parentElement;\n while (parent && parent.tagName !== 'HTML') {\n var parentStyle = getComputedStyle(parent);\n if (parentStyle.position === 'fixed' && this.element.offsetParent && this.element.offsetParent.tagName === 'BODY') {\n this.element.style.position = 'fixed';\n this.fixedParent = true;\n }\n parent = parent.parentElement;\n if (isNullOrUndefined(this.element.offsetParent) && parentStyle.position === 'fixed'\n && this.element.style.position === 'fixed') {\n this.fixedParent = true;\n }\n }\n };\n __decorate([\n Property('auto')\n ], Popup.prototype, \"height\", void 0);\n __decorate([\n Property('auto')\n ], Popup.prototype, \"width\", void 0);\n __decorate([\n Property(null)\n ], Popup.prototype, \"content\", void 0);\n __decorate([\n Property('container')\n ], Popup.prototype, \"targetType\", void 0);\n __decorate([\n Property(null)\n ], Popup.prototype, \"viewPortElement\", void 0);\n __decorate([\n Property({ X: 'none', Y: 'none' })\n ], Popup.prototype, \"collision\", void 0);\n __decorate([\n Property('')\n ], Popup.prototype, \"relateTo\", void 0);\n __decorate([\n Complex({}, PositionData)\n ], Popup.prototype, \"position\", void 0);\n __decorate([\n Property(0)\n ], Popup.prototype, \"offsetX\", void 0);\n __decorate([\n Property(0)\n ], Popup.prototype, \"offsetY\", void 0);\n __decorate([\n Property(1000)\n ], Popup.prototype, \"zIndex\", void 0);\n __decorate([\n Property(false)\n ], Popup.prototype, \"enableRtl\", void 0);\n __decorate([\n Property('reposition')\n ], Popup.prototype, \"actionOnScroll\", void 0);\n __decorate([\n Property(null)\n ], Popup.prototype, \"showAnimation\", void 0);\n __decorate([\n Property(null)\n ], Popup.prototype, \"hideAnimation\", void 0);\n __decorate([\n Event()\n ], Popup.prototype, \"open\", void 0);\n __decorate([\n Event()\n ], Popup.prototype, \"close\", void 0);\n __decorate([\n Event()\n ], Popup.prototype, \"targetExitViewport\", void 0);\n Popup = __decorate([\n NotifyPropertyChanges\n ], Popup);\n return Popup;\n}(Component));\nexport { Popup };\n/**\n * Gets scrollable parent elements for the given element.\n * @param { HTMLElement } element - Specify the element to get the scrollable parents of it.\n * @private\n */\nexport function getScrollableParent(element, fixedParent) {\n var eleStyle = getComputedStyle(element);\n var scrollParents = [];\n var overflowRegex = /(auto|scroll)/;\n var parent = element.parentElement;\n while (parent && parent.tagName !== 'HTML') {\n var parentStyle = getComputedStyle(parent);\n if (!(eleStyle.position === 'absolute' && parentStyle.position === 'static')\n && overflowRegex.test(parentStyle.overflow + parentStyle.overflowY + parentStyle.overflowX)) {\n scrollParents.push(parent);\n }\n parent = parent.parentElement;\n }\n if (!fixedParent) {\n scrollParents.push(document);\n }\n return scrollParents;\n}\n/**\n * Gets the maximum z-index of the given element.\n * @param { HTMLElement } element - Specify the element to get the maximum z-index of it.\n * @private\n */\nexport function getZindexPartial(element) {\n // upto body traversal\n var parent = element.parentElement;\n var parentZindex = [];\n while (parent) {\n if (parent.tagName !== 'BODY') {\n var index = document.defaultView.getComputedStyle(parent, null).getPropertyValue('z-index');\n var position = document.defaultView.getComputedStyle(parent, null).getPropertyValue('position');\n if (index !== 'auto' && position !== 'static') {\n parentZindex.push(index);\n }\n parent = parent.parentElement;\n }\n else {\n break;\n }\n }\n //Body direct children element traversal\n var childrenZindex = [];\n for (var i = 0; i < document.body.children.length; i++) {\n if (!element.isEqualNode(document.body.children[i])) {\n var index = document.defaultView.getComputedStyle(document.body.children[i], null).getPropertyValue('z-index');\n var position = document.defaultView.getComputedStyle(document.body.children[i], null).getPropertyValue('position');\n if (index !== 'auto' && position !== 'static') {\n childrenZindex.push(index);\n }\n }\n }\n childrenZindex.push('999');\n var finalValue = parentZindex.concat(childrenZindex);\n return Math.max.apply(Math, finalValue) + 1;\n}\n","import { isNullOrUndefined, classList } from '@syncfusion/ej2-base';\nvar globalTimeOut = {};\nvar spinTemplate = null;\nvar spinCSSClass = null;\nvar DEFT_MAT_WIDTH = 30;\nvar DEFT_FAB_WIDTH = 30;\nvar DEFT_BOOT_WIDTH = 30;\nvar CLS_SHOWSPIN = 'e-spin-show';\nvar CLS_HIDESPIN = 'e-spin-hide';\nvar CLS_MATERIALSPIN = 'e-spin-material';\nvar CLS_FABRICSPIN = 'e-spin-fabric';\nvar CLS_BOOTSPIN = 'e-spin-bootstrap';\nvar CLS_HIGHCONTRASTSPIN = 'e-spin-high-contrast';\nvar CLS_SPINWRAP = 'e-spinner-pane';\nvar CLS_SPININWRAP = 'e-spinner-inner';\nvar CLS_SPINCIRCLE = 'e-path-circle';\nvar CLS_SPINARC = 'e-path-arc';\nvar CLS_SPINLABEL = 'e-spin-label';\nvar CLS_SPINTEMPLATE = 'e-spin-template';\n/**\n * Create a spinner for the specified target element.\n * ```\n * E.g : createSpinner({ target: targetElement, width: '34px', label: 'Loading..' });\n * ```\n * @param args\n * @private\n */\nexport function createSpinner(args) {\n var radius;\n var container = create_spinner_container(args.target);\n if (!isNullOrUndefined(args.cssClass)) {\n container.wrap.classList.add(args.cssClass);\n }\n if (!isNullOrUndefined(args.template) || !isNullOrUndefined(spinTemplate)) {\n var template = !isNullOrUndefined(args.template) ? args.template : spinTemplate;\n container.wrap.classList.add(CLS_SPINTEMPLATE);\n replaceContent(container.wrap, template, spinCSSClass);\n }\n else {\n var theme = !isNullOrUndefined(args.type) ? args.type : getTheme(container.wrap);\n var width = !isNullOrUndefined(args.width) ? args.width : undefined;\n radius = calculateRadius(width, theme);\n setTheme(theme, container.wrap, radius);\n if (!isNullOrUndefined(args.label)) {\n createLabel(container.inner_wrap, args.label);\n }\n }\n container.wrap.classList.add(CLS_HIDESPIN);\n container = null;\n}\nfunction createLabel(container, label) {\n var labelEle = document.createElement('div');\n labelEle.classList.add(CLS_SPINLABEL);\n labelEle.textContent = label;\n container.appendChild(labelEle);\n return labelEle;\n}\nfunction createMaterialSpinner(container, radius) {\n var uniqueID = random_generator();\n globalTimeOut[uniqueID] = { timeOut: 0, type: 'Material', radius: radius };\n create_material_element(container, uniqueID);\n mat_calculate_attributes(radius, container);\n}\nfunction startMatAnimate(container, uniqueID, radius) {\n var globalObject = {};\n var timeOutVar = 0;\n globalTimeOut[uniqueID].timeOut = 0;\n globalObject[uniqueID] = globalVariables(uniqueID, radius, 0, 0);\n var spinnerInfo = { uniqueID: uniqueID, container: container, globalInfo: globalObject, timeOutVar: timeOutVar };\n animateMaterial(spinnerInfo);\n}\nfunction createFabricSpinner(container, radius) {\n var uniqueID = random_generator();\n globalTimeOut[uniqueID] = { timeOut: 0, type: 'Fabric', radius: radius };\n create_fabric_element(container, uniqueID, CLS_FABRICSPIN);\n fb_calculate_attributes(radius, container, CLS_FABRICSPIN);\n}\nfunction createHighContrastSpinner(container, radius) {\n var uniqueID = random_generator();\n globalTimeOut[uniqueID] = { timeOut: 0, type: 'HighContrast', radius: radius };\n create_fabric_element(container, uniqueID, CLS_HIGHCONTRASTSPIN);\n fb_calculate_attributes(radius, container, CLS_HIGHCONTRASTSPIN);\n}\nfunction getTheme(container) {\n var theme = window.getComputedStyle(container, ':after').getPropertyValue('content');\n return theme.replace(/['\"]+/g, '');\n}\nfunction setTheme(theme, container, radius) {\n var innerContainer = container.querySelector('.' + CLS_SPININWRAP);\n var svg = innerContainer.querySelector('svg');\n if (!isNullOrUndefined(svg)) {\n innerContainer.removeChild(svg);\n }\n switch (theme) {\n case 'Material':\n createMaterialSpinner(innerContainer, radius);\n break;\n case 'Fabric':\n createFabricSpinner(innerContainer, radius);\n break;\n case 'Bootstrap':\n createBootstrapSpinner(innerContainer, radius);\n break;\n case 'HighContrast':\n createHighContrastSpinner(innerContainer, radius);\n break;\n }\n}\nfunction createBootstrapSpinner(innerContainer, radius) {\n var uniqueID = random_generator();\n globalTimeOut[uniqueID] = { timeOut: 0, type: 'Bootstrap', radius: radius };\n create_bootstrap_element(innerContainer, uniqueID);\n boot_calculate_attributes(innerContainer, radius);\n}\nfunction create_bootstrap_element(innerContainer, uniqueID) {\n var svgBoot = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n var viewBoxValue = 64;\n var trans = 32;\n var defaultRadius = 2;\n svgBoot.setAttribute('id', uniqueID);\n svgBoot.setAttribute('class', CLS_BOOTSPIN);\n svgBoot.setAttribute('viewBox', '0 0 ' + viewBoxValue + ' ' + viewBoxValue);\n innerContainer.insertBefore(svgBoot, innerContainer.firstChild);\n for (var item = 0; item <= 7; item++) {\n var bootCircle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n bootCircle.setAttribute('class', CLS_SPINCIRCLE + '_' + item);\n bootCircle.setAttribute('r', defaultRadius + '');\n bootCircle.setAttribute('transform', 'translate(' + trans + ',' + trans + ')');\n svgBoot.appendChild(bootCircle);\n }\n}\nfunction boot_calculate_attributes(innerContainer, radius) {\n var svg = innerContainer.querySelector('svg.e-spin-bootstrap');\n svg.style.width = svg.style.height = radius + 'px';\n var x = 0;\n var y = 0;\n var rad = 24;\n var startArc = 90;\n for (var item = 0; item <= 7; item++) {\n var start = defineArcPoints(x, y, rad, startArc);\n var circleEle = svg.querySelector('.' + CLS_SPINCIRCLE + '_' + item);\n circleEle.setAttribute('cx', start.x + '');\n circleEle.setAttribute('cy', start.y + '');\n startArc = startArc >= 360 ? 0 : startArc;\n startArc = startArc + 45;\n }\n}\nfunction generateSeries(begin, stop) {\n var series = [];\n var start = begin;\n var end = stop;\n var increment = false;\n var count = 1;\n formSeries(start);\n function formSeries(i) {\n series.push(i);\n if (i !== end || count === 1) {\n if (i <= start && i > 1 && !increment) {\n i = parseFloat((i - 0.2).toFixed(2));\n }\n else if (i === 1) {\n i = 7;\n i = parseFloat((i + 0.2).toFixed(2));\n increment = true;\n }\n else if (i < 8 && increment) {\n i = parseFloat((i + 0.2).toFixed(2));\n if (i === 8) {\n increment = false;\n }\n }\n else if (i <= 8 && !increment) {\n i = parseFloat((i - 0.2).toFixed(2));\n }\n ++count;\n formSeries(i);\n }\n }\n return series;\n}\nfunction animateBootstrap(innerContainer) {\n var svg = innerContainer.querySelector('svg.e-spin-bootstrap');\n var id = svg.getAttribute('id');\n for (var i = 1; i <= 8; i++) {\n var circleEle = (innerContainer.getElementsByClassName('e-path-circle_' +\n (i === 8 ? 0 : i))[0]);\n rotation(circleEle, i, i, generateSeries(i, i), id);\n }\n function rotation(circle, start, end, series, id) {\n var count = 0;\n boot_animate(start);\n function boot_animate(radius) {\n if (globalTimeOut[id].isAnimate) {\n ++count;\n circle.setAttribute('r', radius + '');\n if (count >= series.length) {\n count = 0;\n }\n globalTimeOut[id].timeOut = setTimeout(boot_animate.bind(null, series[count]), 18);\n }\n }\n }\n}\nfunction replaceContent(container, template, cssClass) {\n if (!isNullOrUndefined(cssClass)) {\n container.classList.add(cssClass);\n }\n var inner = container.querySelector('.e-spinner-inner');\n inner.innerHTML = template;\n}\nfunction calculateRadius(width, theme) {\n var defaultSize = theme === 'Material' ? DEFT_MAT_WIDTH : theme === 'Fabric' ? DEFT_FAB_WIDTH : DEFT_BOOT_WIDTH;\n width = width ? parseFloat(width + '') : defaultSize;\n return theme === 'Bootstrap' ? width : width / 2;\n}\nfunction globalVariables(id, radius, count, previousId) {\n return {\n radius: radius,\n count: count,\n previousId: previousId\n };\n}\nfunction random_generator() {\n var random = '';\n var combine = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n for (var i = 0; i < 5; i++) {\n random += combine.charAt(Math.floor(Math.random() * combine.length));\n }\n return random;\n}\nfunction create_fabric_element(innerContainer, uniqueID, themeClass) {\n var svgFabric = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svgFabric.setAttribute('id', uniqueID);\n svgFabric.setAttribute('class', themeClass);\n var fabricCirclePath = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n fabricCirclePath.setAttribute('class', CLS_SPINCIRCLE);\n var fabricCircleArc = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n fabricCircleArc.setAttribute('class', CLS_SPINARC);\n innerContainer.insertBefore(svgFabric, innerContainer.firstChild);\n svgFabric.appendChild(fabricCirclePath);\n svgFabric.appendChild(fabricCircleArc);\n}\nfunction create_material_element(innerContainer, uniqueID) {\n var svgMaterial = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svgMaterial.setAttribute('class', CLS_MATERIALSPIN);\n svgMaterial.setAttribute('id', uniqueID);\n var matCirclePath = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n matCirclePath.setAttribute('class', CLS_SPINCIRCLE);\n innerContainer.insertBefore(svgMaterial, innerContainer.firstChild);\n svgMaterial.appendChild(matCirclePath);\n}\nfunction create_spinner_container(target) {\n var spinnerContainer = document.createElement('div');\n spinnerContainer.classList.add(CLS_SPINWRAP);\n var spinnerInnerContainer = document.createElement('div');\n spinnerInnerContainer.classList.add(CLS_SPININWRAP);\n target.appendChild(spinnerContainer);\n spinnerContainer.appendChild(spinnerInnerContainer);\n return { wrap: spinnerContainer, inner_wrap: spinnerInnerContainer };\n}\nfunction animateMaterial(spinnerInfo) {\n var start = 1;\n var end = 149;\n var duration = 1333;\n var max = 75;\n createCircle(start, end, easeAnimation, duration, spinnerInfo.globalInfo[spinnerInfo.uniqueID].count, max, spinnerInfo);\n spinnerInfo.globalInfo[spinnerInfo.uniqueID].count = ++spinnerInfo.globalInfo[spinnerInfo.uniqueID].count % 4;\n}\nfunction createCircle(start, end, easing, duration, count, max, spinnerInfo) {\n var id = ++spinnerInfo.globalInfo[spinnerInfo.uniqueID].previousId;\n var startTime = new Date().getTime();\n var change = end - start;\n var diameter = getSize((spinnerInfo.globalInfo[spinnerInfo.uniqueID].radius * 2) + '');\n var strokeSize = getStrokeSize(diameter);\n var rotate = -90 * (spinnerInfo.globalInfo[spinnerInfo.uniqueID].count || 0);\n mat_animation(spinnerInfo);\n function mat_animation(spinnerInfo) {\n var currentTime = Math.max(0, Math.min(new Date().getTime() - startTime, duration));\n updatePath(easing(currentTime, start, change, duration), spinnerInfo.container);\n if (id === spinnerInfo.globalInfo[spinnerInfo.uniqueID].previousId && currentTime < duration) {\n globalTimeOut[spinnerInfo.uniqueID].timeOut = setTimeout(mat_animation.bind(null, spinnerInfo), 1);\n }\n else {\n animateMaterial(spinnerInfo);\n }\n }\n function updatePath(value, container) {\n if ((!isNullOrUndefined(container.querySelector('svg.e-spin-material')))\n && (!isNullOrUndefined(container.querySelector('svg.e-spin-material').querySelector('path.e-path-circle')))) {\n var svg = container.querySelector('svg.e-spin-material');\n var path = svg.querySelector('path.e-path-circle');\n path.setAttribute('stroke-dashoffset', getDashOffset(diameter, strokeSize, value, max) + '');\n path.setAttribute('transform', 'rotate(' + (rotate) + ' ' + diameter / 2 + ' ' + diameter / 2 + ')');\n }\n }\n}\nfunction mat_calculate_attributes(radius, container) {\n var diameter = radius * 2;\n var svg = container.querySelector('svg.e-spin-material');\n var path = svg.querySelector('path.e-path-circle');\n var strokeSize = getStrokeSize(diameter);\n var transformOrigin = (diameter / 2) + 'px';\n svg.setAttribute('viewBox', '0 0 ' + diameter + ' ' + diameter);\n svg.style.width = svg.style.height = diameter + 'px';\n svg.style.transformOrigin = transformOrigin + ' ' + transformOrigin + ' ' + transformOrigin;\n path.setAttribute('stroke-width', strokeSize + '');\n path.setAttribute('d', drawArc(diameter, strokeSize));\n path.setAttribute('stroke-dasharray', ((diameter - strokeSize) * Math.PI * 0.75) + '');\n path.setAttribute('stroke-dashoffset', getDashOffset(diameter, strokeSize, 1, 75) + '');\n}\nfunction getSize(value) {\n var parsed = parseFloat(value);\n return parsed;\n}\nfunction drawArc(diameter, strokeSize) {\n var radius = diameter / 2;\n var offset = strokeSize / 2;\n return 'M' + radius + ',' + offset\n + 'A' + (radius - offset) + ',' + (radius - offset) + ' 0 1 1 ' + offset + ',' + radius;\n}\nfunction getStrokeSize(diameter) {\n return 10 / 100 * diameter;\n}\nfunction getDashOffset(diameter, strokeSize, value, max) {\n return (diameter - strokeSize) * Math.PI * ((3 * (max) / 100) - (value / 100));\n}\nfunction easeAnimation(current, start, change, duration) {\n var timestamp = (current /= duration) * current;\n var timecount = timestamp * current;\n return start + change * (6 * timecount * timestamp + -15 * timestamp * timestamp + 10 * timecount);\n}\nfunction fb_calculate_attributes(radius, innerConainer, trgClass) {\n var centerX = radius;\n var centerY = radius;\n var diameter = radius * 2;\n var startArc = 315;\n var endArc = 45;\n var svg = innerConainer.querySelector('.' + trgClass);\n var circle = svg.querySelector('.e-path-circle');\n var path = svg.querySelector('.e-path-arc');\n var transformOrigin = (diameter / 2) + 'px';\n circle.setAttribute('d', defineCircle(centerX, centerY, radius));\n path.setAttribute('d', defineArc(centerX, centerY, radius, startArc, endArc));\n svg.setAttribute('viewBox', '0 0 ' + diameter + ' ' + diameter);\n svg.style.transformOrigin = transformOrigin + ' ' + transformOrigin + ' ' + transformOrigin;\n svg.style.width = svg.style.height = diameter + 'px';\n}\nfunction defineArcPoints(centerX, centerY, radius, angle) {\n var radians = (angle - 90) * Math.PI / 180.0;\n return {\n x: centerX + (radius * Math.cos(radians)),\n y: centerY + (radius * Math.sin(radians))\n };\n}\nfunction defineArc(x, y, radius, startArc, endArc) {\n var start = defineArcPoints(x, y, radius, endArc);\n var end = defineArcPoints(x, y, radius, startArc);\n var d = [\n 'M', start.x, start.y,\n 'A', radius, radius, 0, 0, 0, end.x, end.y\n ].join(' ');\n return d;\n}\nfunction defineCircle(x, y, radius) {\n var d = [\n 'M', x, y,\n 'm', -radius, 0,\n 'a', radius, radius, 0, 1, 0, radius * 2, 0,\n 'a', radius, radius, 0, 1, 0, -radius * 2, 0,\n ].join(' ');\n return d;\n}\n/**\n * Function to show the Spinner.\n * @param container - Specify the target of the Spinner.\n * @private\n */\nexport function showSpinner(container) {\n showHideSpinner(container, false);\n container = null;\n}\nfunction showHideSpinner(container, isHide) {\n var spinnerWrap = container.classList.contains(CLS_SPINWRAP) ? container :\n container.querySelector('.' + CLS_SPINWRAP);\n var inner = spinnerWrap.querySelector('.' + CLS_SPININWRAP);\n var spinCheck;\n spinCheck = isHide ? !spinnerWrap.classList.contains(CLS_SPINTEMPLATE) && !spinnerWrap.classList.contains(CLS_HIDESPIN) :\n !spinnerWrap.classList.contains(CLS_SPINTEMPLATE) && !spinnerWrap.classList.contains(CLS_SHOWSPIN);\n if (spinCheck) {\n var svgEle = spinnerWrap.querySelector('svg');\n if (isNullOrUndefined(svgEle)) {\n return;\n }\n var id = svgEle.getAttribute('id');\n globalTimeOut[id].isAnimate = !isHide;\n switch (globalTimeOut[id].type) {\n case 'Material':\n isHide ? clearTimeout(globalTimeOut[id].timeOut) : startMatAnimate(inner, id, globalTimeOut[id].radius);\n break;\n case 'Bootstrap':\n isHide ? clearTimeout(globalTimeOut[id].timeOut) : animateBootstrap(inner);\n break;\n }\n }\n isHide ? classList(spinnerWrap, [CLS_HIDESPIN], [CLS_SHOWSPIN]) : classList(spinnerWrap, [CLS_SHOWSPIN], [CLS_HIDESPIN]);\n container = null;\n}\n/**\n * Function to hide the Spinner.\n * @param container - Specify the target of the Spinner.\n * @private\n */\nexport function hideSpinner(container) {\n showHideSpinner(container, true);\n container = null;\n}\n/**\n * Function to change the Spinners in a page globally from application end.\n * ```\n * E.g : setSpinner({ cssClass: 'custom-css'; type: 'Material' });\n * ```\n * @param args\n * @private\n */\nexport function setSpinner(args) {\n if (args.template !== undefined) {\n spinTemplate = args.template;\n if (args.template !== undefined) {\n spinCSSClass = args.cssClass;\n }\n }\n var container = document.querySelectorAll('.' + CLS_SPINWRAP);\n for (var index = 0; index < container.length; index++) {\n ensureTemplate(args.template, container[index], args.type, args.cssClass);\n }\n}\nfunction ensureTemplate(template, container, theme, cssClass) {\n if (isNullOrUndefined(template) && !container.classList.contains(CLS_SPINTEMPLATE)) {\n replaceTheme(container, theme, cssClass);\n if (container.classList.contains(CLS_SHOWSPIN)) {\n container.classList.remove(CLS_SHOWSPIN);\n showSpinner(container);\n }\n else {\n container.classList.remove(CLS_HIDESPIN);\n hideSpinner(container);\n }\n }\n else {\n spinTemplate = template;\n if (!isNullOrUndefined(cssClass)) {\n spinCSSClass = cssClass;\n }\n }\n}\nfunction replaceTheme(container, theme, cssClass) {\n if (!isNullOrUndefined(cssClass)) {\n container.classList.add(cssClass);\n }\n var svgElement = container.querySelector('svg');\n var radius = theme === 'Bootstrap' ? parseFloat(svgElement.style.height) : parseFloat(svgElement.style.height) / 2;\n var classNames = svgElement.getAttribute('class');\n var svgClassList = classNames.split(/\\s/);\n if (svgClassList.indexOf('e-spin-material') >= 0) {\n var id = svgElement.getAttribute('id');\n clearTimeout(globalTimeOut[id].timeOut);\n }\n setTheme(theme, container, radius);\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { ChildProperty, extend, deleteObject, Property } from '@syncfusion/ej2-base';\n/**\n * @param props\n * @param model\n */\nexport function getModel(props, model) {\n var obj = extend({}, props);\n for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) {\n var prop = _a[_i];\n if ((model).indexOf(prop) < 0) {\n deleteObject(obj, prop);\n }\n }\n return obj;\n}\nvar Item = /** @class */ (function (_super) {\n __extends(Item, _super);\n function Item() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('')\n ], Item.prototype, \"iconCss\", void 0);\n __decorate([\n Property('')\n ], Item.prototype, \"id\", void 0);\n __decorate([\n Property(false)\n ], Item.prototype, \"separator\", void 0);\n __decorate([\n Property('')\n ], Item.prototype, \"text\", void 0);\n __decorate([\n Property('')\n ], Item.prototype, \"url\", void 0);\n return Item;\n}(ChildProperty));\nexport { Item };\n","/**\n * MaskedTextBox base module\n */\nimport { EventHandler, isNullOrUndefined, merge, attributes, addClass, removeClass, Browser, extend } from '@syncfusion/ej2-base';\nimport { Input } from '../../input/input';\nvar ERROR = 'e-error';\nvar INPUTGROUP = 'e-input-group';\nvar FLOATINPUT = 'e-float-input';\nvar UTILMASK = 'e-utility-mask';\nvar TOPLABEL = 'e-label-top';\nvar BOTTOMLABEL = 'e-label-bottom';\n/**\n * @hidden\n * Built-in masking elements collection.\n */\nexport var regularExpressions = {\n '0': '[0-9]',\n '9': '[0-9 ]',\n '#': '[0-9 +-]',\n 'L': '[A-Za-z]',\n '?': '[A-Za-z ]',\n '&': '[^\\x7f ]+',\n 'C': '[^\\x7f]+',\n 'A': '[A-Za-z0-9]',\n 'a': '[A-Za-z0-9 ]',\n};\n/**\n * @hidden\n * Generate required masking elements to the MaskedTextBox from user mask input.\n */\nexport function createMask() {\n attributes(this.element, {\n 'role': 'textbox', 'autocomplete': 'off', 'autocorrect': 'off', 'autocapitalize': 'off',\n 'spellcheck': 'false', 'aria-live': 'assertive', 'aria-valuenow': ''\n });\n if (this.mask) {\n var splitMask = this.mask.split(']');\n for (var i = 0; i < splitMask.length; i++) {\n if (splitMask[i][splitMask[i].length - 1] === '\\\\') {\n splitMask[i] = splitMask[i] + ']';\n var splitInnerMask = splitMask[i].split('[');\n for (var j = 0; j < splitInnerMask.length; j++) {\n if (splitInnerMask[j][splitInnerMask[j].length - 1] === '\\\\') {\n splitInnerMask[j] = splitInnerMask[j] + '[';\n }\n pushIntoRegExpCollec.call(this, splitInnerMask[j]);\n }\n }\n else {\n var splitInnerMask = splitMask[i].split('[');\n if (splitInnerMask.length > 1) {\n var chkSpace = false;\n for (var j = 0; j < splitInnerMask.length; j++) {\n if (splitInnerMask[j] === '\\\\') {\n this.customRegExpCollec.push('[');\n this.hiddenMask += splitInnerMask[j] + '[';\n }\n else if (splitInnerMask[j] === '') {\n chkSpace = true;\n }\n else if ((splitInnerMask[j] !== '' && chkSpace) || j === splitInnerMask.length - 1) {\n this.customRegExpCollec.push('[' + splitInnerMask[j] + ']');\n this.hiddenMask += this.promptChar;\n chkSpace = false;\n }\n else {\n pushIntoRegExpCollec.call(this, splitInnerMask[j]);\n }\n }\n }\n else {\n pushIntoRegExpCollec.call(this, splitInnerMask[0]);\n }\n }\n }\n this.escapeMaskValue = this.hiddenMask;\n this.promptMask = this.hiddenMask.replace(/[09?LCAa#&]/g, this.promptChar);\n if (!isNullOrUndefined(this.customCharacters)) {\n for (var i = 0; i < this.promptMask.length; i++) {\n if (!isNullOrUndefined(this.customCharacters[this.promptMask[i]])) {\n this.promptMask = this.promptMask.replace(new RegExp(this.promptMask[i], 'g'), this.promptChar);\n }\n }\n }\n var escapeNumber = 0;\n if (this.hiddenMask.match(new RegExp(/\\\\/))) {\n for (var i = 0; i < this.hiddenMask.length; i++) {\n var j = 0;\n if (i >= 2) {\n j = i;\n }\n escapeNumber = this.hiddenMask.length - this.promptMask.length;\n j = j - escapeNumber;\n if ((i > 0 && this.hiddenMask[i - 1] !== '\\\\') && (this.hiddenMask[i] === '>' ||\n this.hiddenMask[i] === '<' || this.hiddenMask[i] === '|')) {\n this.promptMask = this.promptMask.substring(0, j) +\n this.promptMask.substring((i + 1) - escapeNumber, this.promptMask.length);\n this.escapeMaskValue = this.escapeMaskValue.substring(0, j) +\n this.escapeMaskValue.substring((i + 1) - escapeNumber, this.escapeMaskValue.length);\n }\n if (this.hiddenMask[i] === '\\\\') {\n this.promptMask = this.promptMask.substring(0, j) + this.hiddenMask[i + 1] +\n this.promptMask.substring((i + 2) - escapeNumber, this.promptMask.length);\n this.escapeMaskValue = this.escapeMaskValue.substring(0, j) + this.escapeMaskValue[i + 1] +\n this.escapeMaskValue.substring((i + 2) - escapeNumber, this.escapeMaskValue.length);\n }\n }\n }\n else {\n this.promptMask = this.promptMask.replace(/[>|<]/g, '');\n this.escapeMaskValue = this.hiddenMask.replace(/[>|<]/g, '');\n }\n attributes(this.element, { 'aria-invalid': 'false' });\n }\n}\n/**\n * @hidden\n * Apply mask ability with masking elements to the MaskedTextBox.\n */\nexport function applyMask() {\n setElementValue.call(this, this.promptMask);\n setMaskValue.call(this, this.value);\n}\n/**\n * @hidden\n * To wire required events to the MaskedTextBox.\n */\nexport function wireEvents() {\n EventHandler.add(this.element, 'keydown', maskInputKeyDownHandler, this);\n EventHandler.add(this.element, 'keypress', maskInputKeyPressHandler, this);\n EventHandler.add(this.element, 'keyup', maskInputKeyUpHandler, this);\n EventHandler.add(this.element, 'input', maskInputHandler, this);\n EventHandler.add(this.element, 'focus', maskInputFocusHandler, this);\n EventHandler.add(this.element, 'blur', maskInputBlurHandler, this);\n EventHandler.add(this.element, 'paste', maskInputPasteHandler, this);\n EventHandler.add(this.element, 'cut', maskInputCutHandler, this);\n EventHandler.add(this.element, 'drop', maskInputDropHandler, this);\n if (this.enabled) {\n bindClearEvent.call(this);\n }\n}\n/**\n * @hidden\n * To unwire events attached to the MaskedTextBox.\n */\nexport function unwireEvents() {\n EventHandler.remove(this.element, 'keydown', maskInputKeyDownHandler);\n EventHandler.remove(this.element, 'keypress', maskInputKeyPressHandler);\n EventHandler.remove(this.element, 'keyup', maskInputKeyUpHandler);\n EventHandler.remove(this.element, 'input', maskInputHandler);\n EventHandler.remove(this.element, 'focus', maskInputFocusHandler);\n EventHandler.remove(this.element, 'blur', maskInputBlurHandler);\n EventHandler.remove(this.element, 'paste', maskInputPasteHandler);\n EventHandler.remove(this.element, 'cut', maskInputCutHandler);\n}\n/**\n * @hidden\n * To bind required events to the MaskedTextBox clearButton.\n */\nexport function bindClearEvent() {\n if (this.showClearButton) {\n EventHandler.add(this.inputObj.clearButton, 'mousedown touchstart', resetHandler, this);\n }\n}\nfunction resetHandler(e) {\n e.preventDefault();\n if (!this.inputObj.clearButton.classList.contains('e-clear-icon-hide')) {\n clear.call(this, e);\n }\n}\nfunction clear(event) {\n var value = this.element.value;\n setElementValue.call(this, this.promptMask);\n this.redoCollec.unshift({\n value: this.promptMask, startIndex: this.element.selectionStart, endIndex: this.element.selectionEnd\n });\n triggerMaskChangeEvent.call(this, event, value);\n this.element.setSelectionRange(0, 0);\n}\n/**\n * @hidden\n * To get masked value from the MaskedTextBox.\n */\nexport function unstrippedValue(element) {\n return element.value;\n}\n/**\n * @hidden\n * To extract raw value from the MaskedTextBox.\n */\nexport function strippedValue(element, maskValues) {\n var value = '';\n var k = 0;\n var checkMask = false;\n var maskValue = (!isNullOrUndefined(maskValues)) ? maskValues : (!isNullOrUndefined(element) &&\n !isNullOrUndefined(this)) ? element.value : maskValues;\n if (maskValue !== this.promptMask) {\n for (var i = 0; i < this.customRegExpCollec.length; i++) {\n if (checkMask) {\n checkMask = false;\n }\n if (this.customRegExpCollec[k] === '>' || this.customRegExpCollec[k] === '<' ||\n this.customRegExpCollec[k] === '|' || this.customRegExpCollec[k] === '\\\\') {\n --i;\n checkMask = true;\n }\n if (!checkMask) {\n if ((maskValue[i] !== this.promptChar) && (!isNullOrUndefined(this.customRegExpCollec[k]) &&\n ((!isNullOrUndefined(this.regExpCollec[this.customRegExpCollec[k]])) ||\n (this.customRegExpCollec[k].length > 2 && this.customRegExpCollec[k][0] === '[' &&\n this.customRegExpCollec[k][this.customRegExpCollec[k].length - 1] === ']') ||\n (!isNullOrUndefined(this.customCharacters) &&\n (!isNullOrUndefined(this.customCharacters[this.customRegExpCollec[k]]))))) && (maskValue !== '')) {\n value += maskValue[i];\n }\n }\n ++k;\n }\n }\n if (this.mask === null || this.mask === '' && this.value !== undefined) {\n value = maskValue;\n }\n return value;\n}\nfunction pushIntoRegExpCollec(value) {\n for (var k = 0; k < value.length; k++) {\n this.hiddenMask += value[k];\n if (value[k] !== '\\\\') {\n this.customRegExpCollec.push(value[k]);\n }\n }\n}\nexport function maskInputFocusHandler(event) {\n var _this = this;\n if (this.promptMask.length > 0) {\n this.focusEventArgs = { selectionStart: 0, selectionEnd: this.promptMask.length };\n }\n else {\n this.focusEventArgs = { selectionStart: 0, selectionEnd: this.element.value.length };\n }\n var eventArgs = {};\n merge(eventArgs, this.focusEventArgs);\n this.trigger('focus', eventArgs);\n this.focusEventArgs = eventArgs;\n if (this.mask) {\n this.isFocus = true;\n if (this.element.value === '') {\n setElementValue.call(this, this.promptMask);\n }\n else {\n setElementValue.call(this, this.element.value);\n }\n if (!Browser.isDevice && Browser.info.version === '11.0') {\n this.element.setSelectionRange(this.focusEventArgs.selectionStart, this.focusEventArgs.selectionEnd);\n }\n else {\n var delay = (Browser.isDevice && Browser.isIos) ? 450 : 0;\n setTimeout(function () {\n _this.element.setSelectionRange(_this.focusEventArgs.selectionStart, _this.focusEventArgs.selectionEnd);\n }, delay);\n }\n }\n}\nexport function maskInputBlurHandler(event) {\n if (this.mask) {\n this.isFocus = false;\n if (this.placeholder && this.element.value === this.promptMask && this.floatLabelType !== 'Always') {\n setElementValue.call(this, '');\n var labelElement = this.element.parentNode.querySelector('.e-float-text');\n if (this.floatLabelType === 'Auto' && !isNullOrUndefined(labelElement) && labelElement.classList.contains(TOPLABEL)) {\n removeClass([labelElement], TOPLABEL);\n }\n }\n }\n}\nfunction maskInputPasteHandler(event) {\n var _this = this;\n if (this.mask) {\n var sIndex_1 = this.element.selectionStart;\n var eIndex_1 = this.element.selectionEnd;\n var oldValue_1 = this.element.value;\n setElementValue.call(this, '');\n this._callPasteHandler = true;\n setTimeout(function () {\n var value = _this.element.value.replace(/ /g, '');\n if (_this.redoCollec.length > 0 && _this.redoCollec[0].value === _this.element.value) {\n value = strippedValue.call(_this, _this.element);\n }\n setElementValue.call(_this, oldValue_1);\n _this.element.selectionStart = sIndex_1;\n _this.element.selectionEnd = eIndex_1;\n var i = 0;\n _this.maskKeyPress = true;\n do {\n validateValue.call(_this, value[i], false, null);\n ++i;\n } while (i < value.length);\n _this.maskKeyPress = false;\n _this._callPasteHandler = false;\n if (_this.element.value === oldValue_1) {\n var i_1 = 0;\n _this.maskKeyPress = true;\n do {\n validateValue.call(_this, value[i_1], false, null);\n ++i_1;\n } while (i_1 < value.length);\n _this.maskKeyPress = false;\n }\n }, 1);\n }\n}\nfunction maskInputCutHandler(event) {\n var _this = this;\n if (this.mask) {\n var sIndex_2 = this.element.selectionStart;\n var eIndex = this.element.selectionEnd;\n this.undoCollec.push({ value: this.element.value, startIndex: this.element.selectionStart, endIndex: this.element.selectionEnd });\n var value_1 = this.element.value.substring(0, sIndex_2) + this.promptMask.substring(sIndex_2, eIndex) +\n this.element.value.substring(eIndex);\n setTimeout(function () {\n setElementValue.call(_this, value_1);\n _this.element.selectionStart = _this.element.selectionEnd = sIndex_2;\n }, 0);\n }\n}\nexport function maskInputDropHandler(event) {\n event.preventDefault();\n}\nfunction maskInputHandler(event) {\n var eventArgs = { ctrlKey: false, keyCode: 229 };\n // tslint:disable-next-line\n extend(event, eventArgs);\n if (this.mask) {\n if (this.element.value === '') {\n this.redoCollec.unshift({\n value: this.promptMask, startIndex: this.element.selectionStart, endIndex: this.element.selectionEnd\n });\n }\n if (this.element.value.length === 1) {\n this.element.value = this.element.value + this.promptMask;\n this.element.setSelectionRange(1, 1);\n }\n if (!this._callPasteHandler) {\n removeMaskInputValues.call(this, event);\n }\n if (this.element.value.length > this.promptMask.length) {\n var startIndex = this.element.selectionStart;\n var addedValues = this.element.value.length - this.promptMask.length;\n var value = this.element.value.substring(startIndex - addedValues, startIndex);\n this.maskKeyPress = false;\n var i = 0;\n do {\n validateValue.call(this, value[i], event.ctrlKey, event);\n ++i;\n } while (i < value.length);\n }\n var val = strippedValue.call(this, this.element);\n this.prevValue = val;\n this.value = val;\n if (val === '') {\n setElementValue.call(this, this.promptMask);\n this.element.setSelectionRange(0, 0);\n }\n }\n}\nfunction maskInputKeyDownHandler(event) {\n if (this.mask) {\n var value = this;\n if (event.keyCode !== 229) {\n if (event.ctrlKey && (event.keyCode === 89 || event.keyCode === 90)) {\n event.preventDefault();\n }\n removeMaskInputValues.call(this, event);\n }\n var startValue = this.element.value;\n if (event.ctrlKey && (event.keyCode === 89 || event.keyCode === 90)) {\n var collec = void 0;\n if (event.keyCode === 90 && this.undoCollec.length > 0 && startValue !== this.undoCollec[this.undoCollec.length - 1].value) {\n collec = this.undoCollec[this.undoCollec.length - 1];\n this.redoCollec.unshift({\n value: this.element.value, startIndex: this.element.selectionStart,\n endIndex: this.element.selectionEnd\n });\n setElementValue.call(this, collec.value);\n this.element.selectionStart = collec.startIndex;\n this.element.selectionEnd = collec.endIndex;\n this.undoCollec.splice(this.undoCollec.length - 1, 1);\n }\n else if (event.keyCode === 89 && this.redoCollec.length > 0 && startValue !== this.redoCollec[0].value) {\n collec = this.redoCollec[0];\n this.undoCollec.push({\n value: this.element.value, startIndex: this.element.selectionStart,\n endIndex: this.element.selectionEnd\n });\n setElementValue.call(this, collec.value);\n this.element.selectionStart = collec.startIndex;\n this.element.selectionEnd = collec.endIndex;\n this.redoCollec.splice(0, 1);\n }\n }\n }\n}\nexport function mobileRemoveFunction() {\n var collec;\n var sIndex = this.element.selectionStart;\n var eIndex = this.element.selectionEnd;\n if (this.redoCollec.length > 0) {\n collec = this.redoCollec[0];\n setElementValue.call(this, collec.value);\n if ((collec.startIndex - sIndex) === 1) {\n this.element.selectionStart = collec.startIndex;\n this.element.selectionEnd = collec.endIndex;\n }\n else {\n this.element.selectionStart = sIndex + 1;\n this.element.selectionEnd = eIndex + 1;\n }\n }\n else {\n setElementValue.call(this, this.promptMask);\n this.element.selectionStart = this.element.selectionEnd = sIndex;\n }\n}\nfunction removeMaskInputValues(event) {\n var isRemove = false;\n var oldEventVal;\n var isDeleted = false;\n if (this.element.value.length < this.promptMask.length) {\n isRemove = true;\n mobileRemoveFunction.call(this);\n oldEventVal = this.element.value;\n }\n var initStartIndex = this.element.selectionStart;\n var initEndIndex = this.element.selectionEnd;\n var startIndex = this.element.selectionStart;\n var endIndex = this.element.selectionEnd;\n var maskValue = this.hiddenMask.replace(/[>|\\\\<]/g, '');\n var curMask = maskValue[startIndex - 1];\n var parentElement = this.element.parentNode;\n if (isRemove || event.keyCode === 8 || event.keyCode === 46) {\n this.undoCollec.push({ value: this.element.value, startIndex: this.element.selectionStart, endIndex: endIndex });\n var multipleDel = false;\n if (startIndex > 0 || ((event.keyCode === 8 || event.keyCode === 46) && startIndex < this.element.value.length\n && ((this.element.selectionEnd - startIndex) !== this.element.value.length))) {\n var index = startIndex;\n if (startIndex !== endIndex) {\n startIndex = endIndex;\n if (event.keyCode === 46) {\n multipleDel = true;\n }\n }\n else if (event.keyCode === 46) {\n ++index;\n }\n else {\n --index;\n }\n for (var k = startIndex; (event.keyCode === 8 || isRemove || multipleDel) ? k > index : k < index; (event.keyCode === 8 || isRemove || multipleDel) ? k-- : k++) {\n for (var i = startIndex; (event.keyCode === 8 || isRemove || multipleDel) ? i > 0 : i < this.element.value.length; (event.keyCode === 8 || isRemove || multipleDel) ? i-- : i++) {\n var sIndex = void 0;\n if (((event.keyCode === 8 || multipleDel) && ((initStartIndex !== initEndIndex && initStartIndex !== startIndex) ||\n (initStartIndex === initEndIndex))) || isRemove) {\n curMask = maskValue[i - 1];\n sIndex = startIndex - 1;\n }\n else {\n curMask = maskValue[i];\n sIndex = startIndex;\n ++startIndex;\n }\n var oldValue = this.element.value[sIndex];\n if ((isNullOrUndefined(this.regExpCollec[curMask]) && (!isNullOrUndefined(this.customCharacters)\n && isNullOrUndefined(this.customCharacters[curMask]))\n && ((this.hiddenMask[sIndex] !== this.promptChar && this.customRegExpCollec[sIndex][0] !== '['\n && this.customRegExpCollec[sIndex][this.customRegExpCollec[sIndex].length - 1] !== ']')))\n || (this.promptMask[sIndex] !== this.promptChar && isNullOrUndefined(this.customCharacters))) {\n this.element.selectionStart = this.element.selectionEnd = sIndex;\n event.preventDefault();\n if (event.keyCode === 46 && !multipleDel) {\n ++this.element.selectionStart;\n }\n }\n else {\n var value = this.element.value;\n var prompt_1 = this.promptChar;\n var elementValue = value.substring(0, sIndex) + prompt_1 + value.substring(startIndex, value.length);\n setElementValue.call(this, elementValue);\n event.preventDefault();\n this.element.selectionStart = this.element.selectionEnd = sIndex;\n isDeleted = true;\n }\n startIndex = this.element.selectionStart;\n if ((!isDeleted && event.keyCode === 8) || multipleDel || (!isDeleted && !(event.keyCode === 46))) {\n sIndex = startIndex - 1;\n }\n else {\n sIndex = startIndex;\n isDeleted = false;\n }\n oldValue = this.element.value[sIndex];\n if (((initStartIndex !== initEndIndex) && (this.element.selectionStart === initStartIndex))\n || (this.promptMask[sIndex] === this.promptChar) || ((oldValue !== this.promptMask[sIndex]) &&\n (this.promptMask[sIndex] !== this.promptChar) && !isNullOrUndefined(this.customCharacters))) {\n break;\n }\n }\n }\n }\n if (this.element.selectionStart === 0 && (this.element.selectionEnd === this.element.value.length)) {\n setElementValue.call(this, this.promptMask);\n event.preventDefault();\n this.element.selectionStart = this.element.selectionEnd = startIndex;\n }\n this.redoCollec.unshift({\n value: this.element.value, startIndex: this.element.selectionStart,\n endIndex: this.element.selectionEnd\n });\n triggerMaskChangeEvent.call(this, event, oldEventVal);\n }\n}\nfunction maskInputKeyPressHandler(event) {\n if (this.mask) {\n var oldValue = this.element.value;\n if ((!event.ctrlKey) || (event.ctrlKey && event.code !== 'KeyA' && event.code !== 'KeyY'\n && event.code !== 'KeyZ' && event.code !== 'KeyX' && event.code !== 'KeyC' && event.code !== 'KeyV')) {\n this.maskKeyPress = true;\n var key = event.key;\n if (key === 'Spacebar') {\n key = String.fromCharCode(event.keyCode);\n }\n if (!key) {\n this.isIosInvalid = true;\n validateValue.call(this, String.fromCharCode(event.keyCode), event.ctrlKey, event);\n event.preventDefault();\n this.isIosInvalid = false;\n }\n else if (key && key.length === 1) {\n validateValue.call(this, key, event.ctrlKey, event);\n event.preventDefault();\n }\n }\n triggerMaskChangeEvent.call(this, event, oldValue);\n }\n}\nfunction triggerMaskChangeEvent(event, oldValue) {\n if (!isNullOrUndefined(this.changeEventArgs)) {\n var eventArgs = {};\n this.changeEventArgs = { value: this.element.value, maskedValue: this.element.value, isInteraction: false };\n if (this.mask) {\n this.changeEventArgs.value = strippedValue.call(this, this.element);\n }\n if (!isNullOrUndefined(event)) {\n this.changeEventArgs.isInteraction = true;\n this.changeEventArgs.event = event;\n }\n merge(eventArgs, this.changeEventArgs);\n this.trigger('change', eventArgs);\n }\n attributes(this.element, { 'aria-valuenow': this.element.value });\n}\nfunction maskInputKeyUpHandler(event) {\n if (this.mask) {\n var collec = void 0;\n if (!this.maskKeyPress && event.keyCode === 229) {\n var oldEventVal = void 0;\n if (this.element.value.length === 1) {\n this.element.value = this.element.value + this.promptMask;\n this.element.setSelectionRange(1, 1);\n }\n if (this.element.value.length > this.promptMask.length) {\n var startIndex = this.element.selectionStart;\n var addedValues = this.element.value.length - this.promptMask.length;\n var val_1 = this.element.value.substring(startIndex - addedValues, startIndex);\n if (this.undoCollec.length > 0) {\n collec = this.undoCollec[this.undoCollec.length - 1];\n var startIndex_1 = this.element.selectionStart;\n oldEventVal = collec.value;\n var oldVal = collec.value.substring(startIndex_1 - addedValues, startIndex_1);\n collec = this.redoCollec[0];\n val_1 = val_1.trim();\n var isSpace = Browser.isAndroid && val_1 === '';\n if (!isSpace && oldVal !== val_1 && collec.value.substring(startIndex_1 - addedValues, startIndex_1) !== val_1) {\n validateValue.call(this, val_1, event.ctrlKey, event);\n }\n else if (isSpace) {\n preventUnsupportedValues.call(this, event, startIndex_1 - 1, this.element.selectionEnd - 1, val_1, event.ctrlKey, false);\n }\n }\n else {\n oldEventVal = this.promptMask;\n validateValue.call(this, val_1, event.ctrlKey, event);\n }\n this.maskKeyPress = false;\n triggerMaskChangeEvent.call(this, event, oldEventVal);\n }\n }\n else {\n removeMaskError.call(this);\n }\n var val = strippedValue.call(this, this.element);\n if (!((this.element.selectionStart === 0) && (this.promptMask === this.element.value) && val === '')\n || (val === '' && this.value !== val)) {\n this.prevValue = val;\n this.value = val;\n }\n }\n else {\n triggerMaskChangeEvent.call(this, event);\n this.value = this.element.value;\n }\n if (this.element.selectionStart === 0 && this.element.selectionEnd === 0) {\n // tslint:disable-next-line\n var temp_1 = this.element;\n setTimeout(function () {\n temp_1.setSelectionRange(0, 0);\n }, 0);\n }\n}\nfunction mobileSwipeCheck(key) {\n if (key.length > 1 && ((this.promptMask.length + key.length) < this.element.value.length)) {\n var elementValue = this.redoCollec[0].value.substring(0, this.redoCollec[0].startIndex) + key +\n this.redoCollec[0].value.substring(this.redoCollec[0].startIndex, this.redoCollec[0].value.length);\n setElementValue.call(this, elementValue);\n this.element.selectionStart = this.element.selectionEnd = this.redoCollec[0].startIndex + key.length;\n }\n this.element.selectionStart = this.element.selectionStart - key.length;\n this.element.selectionEnd = this.element.selectionEnd - key.length;\n}\nfunction mobileValidation(key) {\n if (!this.maskKeyPress) {\n mobileSwipeCheck.call(this, key);\n }\n}\nfunction validateValue(key, isCtrlKey, event) {\n mobileValidation.call(this, key);\n if (isNullOrUndefined(this) || isNullOrUndefined(key)) {\n return;\n }\n var startIndex = this.element.selectionStart;\n var initStartIndex = startIndex;\n var endIndex = this.element.selectionEnd;\n var curMask;\n var allowText = false;\n var value = this.element.value;\n var eventOldVal;\n var prevSupport = false;\n var isEqualVal = false;\n for (var k = 0; k < key.length; k++) {\n var keyValue = key[k];\n startIndex = this.element.selectionStart;\n endIndex = this.element.selectionEnd;\n if (!this.maskKeyPress && initStartIndex === startIndex) {\n startIndex = startIndex + k;\n }\n if ((!this.maskKeyPress || startIndex < this.promptMask.length)) {\n for (var i = startIndex; i < this.promptMask.length; i++) {\n var maskValue = this.escapeMaskValue;\n curMask = maskValue[startIndex];\n if (this.hiddenMask[startIndex] === '\\\\' && this.hiddenMask[startIndex + 1] === key) {\n isEqualVal = true;\n }\n if ((isNullOrUndefined(this.regExpCollec[curMask]) && (isNullOrUndefined(this.customCharacters)\n || (!isNullOrUndefined(this.customCharacters) && isNullOrUndefined(this.customCharacters[curMask])))\n && ((this.hiddenMask[startIndex] !== this.promptChar && this.customRegExpCollec[startIndex][0] !== '['\n && this.customRegExpCollec[startIndex][this.customRegExpCollec[startIndex].length - 1] !== ']')))\n || ((this.promptMask[startIndex] !== this.promptChar) && isNullOrUndefined(this.customCharacters))\n || (this.promptChar === curMask && this.escapeMaskValue === this.mask)) {\n this.element.selectionStart = this.element.selectionEnd = startIndex + 1;\n startIndex = this.element.selectionStart;\n curMask = this.hiddenMask[startIndex];\n }\n }\n if (!isNullOrUndefined(this.customCharacters) && !isNullOrUndefined(this.customCharacters[curMask])) {\n var customValStr = this.customCharacters[curMask];\n var customValArr = customValStr.split(',');\n for (var i = 0; i < customValArr.length; i++) {\n if (keyValue.match(new RegExp('[' + customValArr[i] + ']'))) {\n allowText = true;\n break;\n }\n }\n }\n else if (!isNullOrUndefined(this.regExpCollec[curMask]) && keyValue.match(new RegExp(this.regExpCollec[curMask]))\n && this.promptMask[startIndex] === this.promptChar) {\n allowText = true;\n }\n else if (this.promptMask[startIndex] === this.promptChar && this.customRegExpCollec[startIndex][0] === '['\n && this.customRegExpCollec[startIndex][this.customRegExpCollec[startIndex].length - 1] === ']'\n && keyValue.match(new RegExp(this.customRegExpCollec[startIndex]))) {\n allowText = true;\n }\n if ((!this.maskKeyPress || startIndex < this.hiddenMask.length) && allowText) {\n if (k === 0) {\n if (this.maskKeyPress) {\n this.undoCollec.push({ value: value, startIndex: startIndex, endIndex: startIndex });\n }\n else {\n var sIndex = this.element.selectionStart;\n var eIndex = this.element.selectionEnd;\n if (this.redoCollec.length > 0) {\n eventOldVal = this.redoCollec[0].value;\n setElementValue.call(this, eventOldVal);\n this.undoCollec.push(this.redoCollec[0]);\n }\n else {\n this.undoCollec.push({ value: this.promptMask, startIndex: startIndex, endIndex: startIndex });\n eventOldVal = this.promptMask;\n setElementValue.call(this, eventOldVal);\n }\n this.element.selectionStart = sIndex;\n this.element.selectionEnd = eIndex;\n }\n }\n startIndex = this.element.selectionStart;\n applySupportedValues.call(this, event, startIndex, keyValue, eventOldVal, isEqualVal);\n prevSupport = true;\n if (k === key.length - 1) {\n this.redoCollec.unshift({\n value: this.element.value, startIndex: this.element.selectionStart, endIndex: this.element.selectionEnd\n });\n }\n allowText = false;\n }\n else {\n startIndex = this.element.selectionStart;\n preventUnsupportedValues.call(this, event, startIndex, initStartIndex, key, isCtrlKey, prevSupport);\n }\n if (k === key.length - 1 && !allowText) {\n if (!Browser.isAndroid || (Browser.isAndroid && startIndex < this.promptMask.length)) {\n this.redoCollec.unshift({\n value: this.element.value, startIndex: this.element.selectionStart, endIndex: this.element.selectionEnd\n });\n }\n }\n }\n else {\n if (key.length === 1 && !isCtrlKey && !isNullOrUndefined(event)) {\n addMaskErrorClass.call(this);\n }\n }\n }\n}\nfunction applySupportedValues(event, startIndex, keyValue, eventOldVal, isEqualVal) {\n if (this.hiddenMask.length > this.promptMask.length) {\n keyValue = changeToLowerUpperCase.call(this, keyValue, this.element.value);\n }\n if (!isEqualVal) {\n var value = this.element.value;\n var elementValue = value.substring(0, startIndex) + keyValue + value.substring(startIndex + 1, value.length);\n setElementValue.call(this, elementValue);\n this.element.selectionStart = this.element.selectionEnd = startIndex + 1;\n }\n triggerMaskChangeEvent.call(this, event, eventOldVal);\n}\nfunction preventUnsupportedValues(event, sIdx, idx, key, ctrl, chkSupport) {\n if (!this.maskKeyPress) {\n var eventOldVal = void 0;\n var value = this.element.value;\n if (sIdx >= this.promptMask.length) {\n setElementValue.call(this, value.substring(0, sIdx));\n }\n else {\n if (idx === sIdx) {\n setElementValue.call(this, value.substring(0, sIdx) + value.substring(sIdx + 1, value.length));\n }\n else {\n if (this.promptMask.length === this.element.value.length) {\n setElementValue.call(this, value.substring(0, sIdx) + value.substring(sIdx, value.length));\n }\n else {\n setElementValue.call(this, value.substring(0, idx) + value.substring(idx + 1, value.length));\n }\n }\n this.element.selectionStart = this.element.selectionEnd = (chkSupport ||\n this.element.value[idx] !== this.promptChar) ? sIdx : idx;\n }\n eventOldVal = this.element.value;\n triggerMaskChangeEvent.call(this, event, eventOldVal);\n addMaskErrorClass.call(this);\n }\n if (key.length === 1 && !ctrl && !isNullOrUndefined(event)) {\n addMaskErrorClass.call(this);\n }\n}\nfunction addMaskErrorClass() {\n var _this = this;\n var parentElement = this.element.parentNode;\n var timer = 200;\n if (parentElement.classList.contains(INPUTGROUP) || parentElement.classList.contains(FLOATINPUT)) {\n addClass([parentElement], ERROR);\n }\n else {\n addClass([this.element], ERROR);\n }\n if (this.isIosInvalid === true) {\n timer = 400;\n }\n attributes(this.element, { 'aria-invalid': 'true' });\n setTimeout(function () {\n if (!_this.maskKeyPress) {\n removeMaskError.call(_this);\n }\n }, timer);\n}\nfunction removeMaskError() {\n var parentElement = this.element.parentNode;\n removeClass([parentElement], ERROR);\n removeClass([this.element], ERROR);\n attributes(this.element, { 'aria-invalid': 'false' });\n}\n/**\n * @hidden\n * Validates user input using masking elements '<' , '>' and '|'.\n */\nfunction changeToLowerUpperCase(key, value) {\n var promptMask;\n var i;\n var j = 0;\n var curVal = value;\n var caseCount = 0;\n for (i = 0; i < this.hiddenMask.length; i++) {\n if (this.hiddenMask[i] === '\\\\') {\n promptMask = curVal.substring(0, i) + '\\\\' + curVal.substring(i, curVal.length);\n }\n if (this.hiddenMask[i] === '>' || this.hiddenMask[i] === '<' || this.hiddenMask[i] === '|') {\n if (this.hiddenMask[i] !== curVal[i]) {\n promptMask = curVal.substring(0, i) + this.hiddenMask[i] + curVal.substring(i, curVal.length);\n }\n ++caseCount;\n }\n if (promptMask) {\n if (((promptMask[i] === this.promptChar) && (i > this.element.selectionStart)) ||\n (this.element.value.indexOf(this.promptChar) < 0 && (this.element.selectionStart + caseCount) === i)) {\n caseCount = 0;\n break;\n }\n curVal = promptMask;\n }\n }\n while (i >= 0 && promptMask) {\n if (i === 0 || promptMask[i - 1] !== '\\\\') {\n var val = this.element.value;\n if (promptMask[i] === '>') {\n key = key.toUpperCase();\n break;\n }\n else if (promptMask[i] === '<') {\n key = key.toLowerCase();\n break;\n }\n else if (promptMask[i] === '|') {\n break;\n }\n }\n --i;\n }\n return key;\n}\n/**\n * @hidden\n * To set updated values in the MaskedTextBox.\n */\nexport function setMaskValue(val) {\n if (this.mask && val !== undefined && (val === '' || this.prevValue !== val)) {\n this.maskKeyPress = true;\n setElementValue.call(this, this.promptMask);\n if (val !== '') {\n this.element.selectionStart = 0;\n this.element.selectionEnd = 0;\n }\n if (val !== null) {\n for (var i = 0; i < val.length; i++) {\n validateValue.call(this, val[i], false, null);\n }\n }\n this.value = strippedValue.call(this, this.element);\n this.maskKeyPress = false;\n var labelElement = this.element.parentNode.querySelector('.e-float-text');\n if (this.element.value === this.promptMask && this.floatLabelType === 'Auto' && this.placeholder &&\n !isNullOrUndefined(labelElement) && labelElement.classList.contains(TOPLABEL) && !this.isFocus) {\n removeClass([labelElement], TOPLABEL);\n addClass([labelElement], BOTTOMLABEL);\n setElementValue.call(this, '');\n }\n }\n if (this.mask === null || this.mask === '' && this.value !== undefined) {\n setElementValue.call(this, this.value);\n }\n}\n/**\n * @hidden\n * To set updated values in the input element.\n */\nexport function setElementValue(val, element) {\n if (!this.isFocus && this.floatLabelType === 'Auto' && this.placeholder && isNullOrUndefined(this.value)) {\n val = '';\n }\n var value = strippedValue.call(this, (element ? element : this.element), val);\n if (value === null || value === '') {\n Input.setValue(val, (element ? element : this.element), this.floatLabelType, false);\n if (this.showClearButton) {\n this.inputObj.clearButton.classList.add('e-clear-icon-hide');\n }\n }\n else {\n Input.setValue(val, (element ? element : this.element), this.floatLabelType, this.showClearButton);\n }\n}\n/**\n * @hidden\n * Provide mask support to input textbox through utility method.\n */\nexport function maskInput(args) {\n var inputEle = getMaskInput(args);\n applyMask.call(inputEle);\n var val = strippedValue.call(this, this.element);\n this.prevValue = val;\n this.value = val;\n if (args.mask) {\n unwireEvents.call(inputEle);\n wireEvents.call(inputEle);\n }\n}\nfunction getMaskInput(args) {\n addClass([args.element], UTILMASK);\n var inputEle = {\n element: args.element,\n mask: args.mask,\n promptMask: '',\n hiddenMask: '',\n escapeMaskValue: '',\n promptChar: args.promptChar ? (args.promptChar.length > 1) ? args.promptChar = args.promptChar[0]\n : args.promptChar : '_',\n value: args.value ? args.value : null,\n regExpCollec: regularExpressions,\n customRegExpCollec: [],\n customCharacters: args.customCharacters,\n undoCollec: [],\n redoCollec: [],\n maskKeyPress: false,\n prevValue: ''\n };\n createMask.call(inputEle);\n return inputEle;\n}\n/**\n * @hidden\n * Gets raw value of the textbox which has been masked through utility method.\n */\nexport function getVal(args) {\n return strippedValue.call(getUtilMaskEle(args), args.element);\n}\n/**\n * @hidden\n * Gets masked value of the textbox which has been masked through utility method.\n */\nexport function getMaskedVal(args) {\n return unstrippedValue.call(getUtilMaskEle(args), args.element);\n}\nfunction getUtilMaskEle(args) {\n var value = '';\n var inputEle;\n if (!isNullOrUndefined(args) && args.element.classList.contains(UTILMASK)) {\n inputEle = getMaskInput(args);\n }\n return inputEle;\n}\n/**\n * @hidden\n * Arguments to perform undo and redo functionalities.\n */\nvar MaskUndo = /** @class */ (function () {\n function MaskUndo() {\n }\n return MaskUndo;\n}());\nexport { MaskUndo };\nvar maskUndo = new MaskUndo();\n","import { extend, merge, isNullOrUndefined, getValue } from '@syncfusion/ej2-base';\nimport { createElement, attributes, prepend, isVisible, append, addClass } from '@syncfusion/ej2-base';\nimport { compile } from '@syncfusion/ej2-base';\nimport { DataManager, Query } from '@syncfusion/ej2-data';\nexport var cssClass = {\n li: 'e-list-item',\n ul: 'e-list-parent e-ul',\n group: 'e-list-group-item',\n icon: 'e-list-icon',\n text: 'e-list-text',\n check: 'e-list-check',\n checked: 'e-checked',\n selected: 'e-selected',\n expanded: 'e-expanded',\n textContent: 'e-text-content',\n hasChild: 'e-has-child',\n level: 'e-level',\n url: 'e-list-url',\n collapsible: 'e-icon-collapsible',\n disabled: 'e-disabled',\n image: 'e-list-img',\n iconWrapper: 'e-icon-wrapper'\n};\n/**\n * Base List Generator\n */\nexport var ListBase;\n(function (ListBase) {\n /**\n * Default mapped fields.\n */\n ListBase.defaultMappedFields = {\n id: 'id',\n text: 'text',\n url: 'url',\n value: 'value',\n isChecked: 'isChecked',\n enabled: 'enabled',\n expanded: 'expanded',\n selected: 'selected',\n iconCss: 'iconCss',\n child: 'child',\n isVisible: 'isVisible',\n hasChildren: 'hasChildren',\n tooltip: 'tooltip',\n htmlAttributes: 'htmlAttributes',\n urlAttributes: 'urlAttributes',\n imageAttributes: 'imageAttributes',\n imageUrl: 'imageUrl',\n groupBy: null\n };\n var defaultAriaAttributes = {\n level: 1,\n listRole: 'presentation',\n itemRole: 'presentation',\n groupItemRole: 'group',\n itemText: 'list-item',\n wrapperRole: 'presentation'\n };\n var defaultListBaseOptions = {\n showCheckBox: false,\n showIcon: false,\n expandCollapse: false,\n fields: ListBase.defaultMappedFields,\n ariaAttributes: defaultAriaAttributes,\n listClass: '',\n itemClass: '',\n processSubChild: false,\n sortOrder: 'None',\n template: null,\n groupTemplate: null,\n headerTemplate: null,\n expandIconClass: 'e-icon-collapsible',\n moduleName: 'list',\n expandIconPosition: 'Right'\n };\n /**\n * Function helps to created and return the UL Li element based on your data.\n * @param {{[key:string]:Object}[]|string[]} dataSource - Specifies an array of JSON or String data.\n * @param {ListBaseOptions} options? - Specifies the list options that need to provide.\n */\n function createList(dataSource, options, isSingleLevel) {\n var curOpt = extend({}, defaultListBaseOptions, options);\n var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes);\n var type = typeofData(dataSource).typeof;\n if (type === 'string' || type === 'number') {\n return createListFromArray(dataSource, isSingleLevel, options);\n }\n else {\n return createListFromJson(dataSource, options, ariaAttributes.level, isSingleLevel);\n }\n }\n ListBase.createList = createList;\n /**\n * Function helps to created an element list based on string array input .\n * @param {string[]} dataSource - Specifies an array of string data\n */\n function createListFromArray(dataSource, isSingleLevel, options) {\n var subChild = createListItemFromArray(dataSource, isSingleLevel, options);\n return generateUL(subChild, null, options);\n }\n ListBase.createListFromArray = createListFromArray;\n /**\n * Function helps to created an element list based on string array input .\n * @param {string[]} dataSource - Specifies an array of string data\n */\n function createListItemFromArray(dataSource, isSingleLevel, options) {\n var subChild = [];\n var curOpt = extend({}, defaultListBaseOptions, options);\n cssClass = getModuleClass(curOpt.moduleName);\n var id = generateId(); // generate id for drop-down-list option.\n for (var i = 0; i < dataSource.length; i++) {\n if (isNullOrUndefined(dataSource[i])) {\n continue;\n }\n var li = void 0;\n if (curOpt.itemCreating && typeof curOpt.itemCreating === 'function') {\n var curData = {\n dataSource: dataSource,\n curData: dataSource[i],\n text: dataSource[i],\n options: curOpt\n };\n curOpt.itemCreating(curData);\n }\n if (isSingleLevel) {\n li = generateSingleLevelLI(dataSource[i], null, null, [], null, id, i, options);\n }\n else {\n li = generateLI(dataSource[i], null, null, options);\n }\n if (curOpt.itemCreated && typeof curOpt.itemCreated === 'function') {\n var curData = {\n dataSource: dataSource,\n curData: dataSource[i],\n text: dataSource[i],\n item: li,\n options: curOpt\n };\n curOpt.itemCreated(curData);\n }\n subChild.push(li);\n }\n return subChild;\n }\n ListBase.createListItemFromArray = createListItemFromArray;\n /**\n * Function helps to created an element list based on array of JSON input .\n * @param {{[key:string]:Object}[]} dataSource - Specifies an array of JSON data.\n * @param {ListBaseOptions} options? - Specifies the list options that need to provide.\n */\n // tslint:disable-next-line:max-func-body-length\n function createListItemFromJson(dataSource, options, level, isSingleLevel) {\n var curOpt = extend({}, defaultListBaseOptions, options);\n cssClass = getModuleClass(curOpt.moduleName);\n var fields = extend({}, ListBase.defaultMappedFields, curOpt.fields);\n var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes);\n var id;\n if (level) {\n ariaAttributes.level = level;\n }\n var child = [];\n var li;\n if (Object.keys(dataSource).length && !typeofData(dataSource).item.hasOwnProperty(fields.id)) {\n id = generateId(); // generate id for drop-down-list option.\n }\n for (var i = 0; i < dataSource.length; i++) {\n var fieldData = getFieldValues(dataSource[i], fields);\n if (isNullOrUndefined(dataSource[i])) {\n continue;\n }\n if (curOpt.itemCreating && typeof curOpt.itemCreating === 'function') {\n var curData = {\n dataSource: dataSource,\n curData: dataSource[i],\n text: fieldData[fields.text],\n options: curOpt,\n fields: fields\n };\n curOpt.itemCreating(curData);\n }\n var curItem = dataSource[i];\n if (curOpt.itemCreating && typeof curOpt.itemCreating === 'function') {\n fieldData = getFieldValues(dataSource[i], fields);\n }\n if (Object.keys(dataSource).length && fieldData.hasOwnProperty(fields.id)\n && !isNullOrUndefined(fieldData[fields.id])) {\n id = fieldData.id;\n }\n var innerEle = [];\n if (curOpt.showCheckBox) {\n innerEle.push(createElement('input', { className: cssClass.check, attrs: { type: 'checkbox' } }));\n }\n if (isSingleLevel === true) {\n if (curOpt.showIcon && fieldData.hasOwnProperty(fields.iconCss)) {\n if (!isNullOrUndefined(fieldData[fields.iconCss])) {\n innerEle.push(createElement('span', { className: cssClass.icon + ' ' + fieldData[fields.iconCss] }));\n }\n }\n li = generateSingleLevelLI(curItem, fields, curOpt.itemClass, innerEle, (curItem.hasOwnProperty('isHeader') &&\n curItem.isHeader) ? true : false, id, i, options);\n }\n else {\n li = generateLI(curItem, fields, curOpt.itemClass, options);\n li.classList.add(cssClass.level + '-' + ariaAttributes.level);\n li.setAttribute('aria-level', ariaAttributes.level.toString());\n if (fieldData.hasOwnProperty(fields.tooltip)) {\n li.setAttribute('title', fieldData[fields.tooltip]);\n }\n if (fieldData.hasOwnProperty(fields.htmlAttributes) && fieldData[fields.htmlAttributes]) {\n setAttribute(li, fieldData[fields.htmlAttributes]);\n }\n if (fieldData.hasOwnProperty(fields.enabled) && fieldData[fields.enabled] === false) {\n li.classList.add(cssClass.disabled);\n }\n if (fieldData.hasOwnProperty(fields.isVisible) && fieldData[fields.isVisible] === false) {\n li.style.display = 'none';\n }\n if (fieldData.hasOwnProperty(fields.imageUrl) && !isNullOrUndefined(fieldData[fields.imageUrl])) {\n var attr = { src: fieldData[fields.imageUrl] };\n if (fieldData.hasOwnProperty(fields.imageUrl)) {\n merge(attr, fieldData[fields.imageAttributes]);\n }\n prepend([createElement('img', { className: cssClass.image, attrs: attr })], li.firstElementChild);\n }\n if (curOpt.showIcon && fieldData.hasOwnProperty(fields.iconCss) && !curOpt.template) {\n if (!isNullOrUndefined(fieldData[fields.iconCss])) {\n prepend([createElement('div', { className: cssClass.icon + ' ' + fieldData[fields.iconCss] })], li.firstElementChild);\n }\n }\n if (innerEle.length) {\n prepend(innerEle, li.firstElementChild);\n }\n processSubChild(curItem, fields, dataSource, curOpt, li, ariaAttributes.level);\n }\n if (curOpt.itemCreated && typeof curOpt.itemCreated === 'function') {\n var curData = {\n dataSource: dataSource,\n curData: dataSource[i],\n text: fieldData[fields.text],\n item: li,\n options: curOpt,\n fields: fields\n };\n curOpt.itemCreated(curData);\n }\n child.push(li);\n }\n return child;\n }\n ListBase.createListItemFromJson = createListItemFromJson;\n /**\n * Function helps to created an element list based on array of JSON input .\n * @param {{[key:string]:Object}[]} dataSource - Specifies an array of JSON data.\n * @param {ListBaseOptions} options? - Specifies the list options that need to provide.\n */\n function createListFromJson(dataSource, options, level, isSingleLevel) {\n var curOpt = extend({}, defaultListBaseOptions, options);\n var li = createListItemFromJson(dataSource, options, level, isSingleLevel);\n return generateUL(li, curOpt.listClass, options);\n }\n ListBase.createListFromJson = createListFromJson;\n /**\n * Return the next or previous visible element.\n * @param {Element[]|NodeList} elementArray - An element array to find next or previous element.\n * @param {Element} li - An element to find next or previous after this element.\n * @param {boolean} isPrevious? - Specify when the need get previous element from array.\n */\n function getSiblingLI(elementArray, element, isPrevious) {\n cssClass = getModuleClass(defaultListBaseOptions.moduleName);\n if (!elementArray || !elementArray.length) {\n return void 0;\n }\n var siblingLI;\n var liIndex;\n var liCollections = Array.prototype.slice.call(elementArray);\n if (element) {\n liIndex = indexOf(element, liCollections);\n }\n else {\n liIndex = (isPrevious === true ? liCollections.length : -1);\n }\n siblingLI = liCollections[liIndex + (isPrevious === true ? -1 : 1)];\n while (siblingLI && (!isVisible(siblingLI) || siblingLI.classList.contains(cssClass.disabled))) {\n liIndex = liIndex + (isPrevious === true ? -1 : 1);\n siblingLI = liCollections[liIndex];\n }\n return siblingLI;\n }\n ListBase.getSiblingLI = getSiblingLI;\n /**\n * Return the index of the li element\n * @param {Element} item - An element to find next or previous after this element.\n * @param {Element[]|NodeList} elementArray - An element array to find index of given li.\n */\n function indexOf(item, elementArray) {\n if (!elementArray || !item) {\n return void 0;\n }\n else {\n var liCollections = elementArray;\n liCollections = Array.prototype.slice.call(elementArray);\n return liCollections.indexOf(item);\n }\n }\n ListBase.indexOf = indexOf;\n /**\n * Returns the grouped data from given dataSource.\n * @param {{[key:string]:Object}[]} dataSource - The JSON data which is necessary to process.\n * @param {FieldsMapping} fields - Fields that are mapped from the data source.\n * @param {SortOrder='None'} sortOrder- Specifies final result sort order.\n */\n function groupDataSource(dataSource, fields, sortOrder) {\n if (sortOrder === void 0) { sortOrder = 'None'; }\n var cusQuery = new Query().group(fields.groupBy);\n // need to remove once sorting issues fixed in DataManager\n cusQuery = addSorting(sortOrder, 'key', cusQuery);\n var ds = getDataSource(dataSource, cusQuery);\n dataSource = [];\n for (var j = 0; j < ds.length; j++) {\n var itemObj = ds[j].items;\n var grpItem = {};\n var hdr = 'isHeader';\n grpItem[fields.text] = ds[j].key;\n grpItem[hdr] = true;\n grpItem.id = 'group-list-item-' + (ds[j].key ?\n ds[j].key.toString().trim() : 'undefined');\n grpItem.items = itemObj;\n dataSource.push(grpItem);\n for (var k = 0; k < itemObj.length; k++) {\n dataSource.push(itemObj[k]);\n }\n }\n return dataSource;\n }\n ListBase.groupDataSource = groupDataSource;\n /**\n * Returns a sorted query object.\n * @param {SortOrder} sortOrder - Specifies that sort order.\n * @param {string} sortBy - Specifies sortBy fields.\n * @param {Query=new Query()} query - Pass if any existing query.\n */\n function addSorting(sortOrder, sortBy, query) {\n if (query === void 0) { query = new Query(); }\n if (sortOrder === 'Ascending') {\n query.sortBy(sortBy, 'ascending', true);\n }\n else if (sortOrder === 'Descending') {\n query.sortBy(sortBy, 'descending', true);\n }\n else {\n for (var i = 0; i < query.queries.length; i++) {\n if (query.queries[i].fn === 'onSortBy') {\n query.queries.splice(i, 1);\n }\n }\n }\n return query;\n }\n ListBase.addSorting = addSorting;\n /**\n * Return an array of JSON Data that processed based on queries.\n * @param {{[key:string]:Object}[]} dataSource - Specifies local JSON data source.\n * @param {Query} query - Specifies query that need to process.\n */\n function getDataSource(dataSource, query) {\n // tslint:disable-next-line\n return new DataManager(dataSource)\n .executeLocal(query);\n }\n ListBase.getDataSource = getDataSource;\n /**\n * Created JSON data based the UL and LI element\n * @param {HTMLElement|Element} element - UL element that need to convert as a JSON\n * @param {ListBaseOptions} options? - Specifies listbase option for fields.\n */\n function createJsonFromElement(element, options) {\n var curOpt = extend({}, defaultListBaseOptions, options);\n var fields = extend({}, ListBase.defaultMappedFields, curOpt.fields);\n var curEle = element.cloneNode(true);\n var jsonAr = [];\n curEle.classList.add('json-parent');\n var childs = curEle.querySelectorAll('.json-parent>li');\n curEle.classList.remove('json-parent');\n for (var i = 0; i < childs.length; i++) {\n var li = childs[i];\n var anchor = li.querySelector('a');\n var ul = li.querySelector('ul');\n var json = {};\n var childNodes = anchor ? anchor.childNodes : li.childNodes;\n var keys = Object.keys(childNodes);\n for (var i_1 = 0; i_1 < childNodes.length; i_1++) {\n if (!(childNodes[Number(keys[i_1])]).hasChildNodes()) {\n json[fields.text] = childNodes[Number(keys[i_1])].textContent;\n }\n }\n json[fields.id] = generateId();\n var attributes_1 = getAllAttributes(li);\n if (Object.keys(attributes_1).length) {\n json[fields.htmlAttributes] = attributes_1;\n }\n if (anchor) {\n attributes_1 = getAllAttributes(anchor);\n if (Object.keys(attributes_1).length) {\n json[fields.urlAttributes] = attributes_1;\n }\n }\n if (ul) {\n json[fields.child] = createJsonFromElement(ul, options);\n }\n jsonAr.push(json);\n }\n return jsonAr;\n }\n ListBase.createJsonFromElement = createJsonFromElement;\n function typeofData(data) {\n var match = { typeof: null, item: null };\n for (var i = 0; i < data.length; i++) {\n if (!isNullOrUndefined(data[i])) {\n return match = { typeof: typeof data[i], item: data[i] };\n }\n }\n return match;\n }\n function setAttribute(element, elementAttributes) {\n var attr = {};\n merge(attr, elementAttributes);\n if (attr.class) {\n addClass([element], attr.class.split(' '));\n delete attr.class;\n }\n attributes(element, attr);\n }\n function getAllAttributes(element) {\n var attributes = {};\n var attr = element.attributes;\n for (var index = 0; index < attr.length; index++) {\n attributes[attr[index].nodeName] = attr[index].nodeValue;\n }\n return attributes;\n }\n /**\n * Created UL element from content template.\n * @param {string} template - that need to convert and generate li element.\n * @param {{[key:string]:Object}[]} dataSource - Specifies local JSON data source.\n * @param {ListBaseOptions} options? - Specifies listbase option for fields.\n */\n function renderContentTemplate(template, dataSource, fields, options) {\n cssClass = getModuleClass(defaultListBaseOptions.moduleName);\n var ulElement = createElement('ul', { className: cssClass.ul, attrs: { role: 'presentation' } });\n var curOpt = extend({}, defaultListBaseOptions, options);\n var compiledString = compile(template);\n var liCollection = [];\n var id = generateId(); // generate id for drop-down-list option.\n for (var i = 0; i < dataSource.length; i++) {\n var fieldData = getFieldValues(dataSource[i], fields);\n var curItem = dataSource[i];\n var isHeader = curItem.isHeader;\n var value = (typeof curItem === 'string' || typeof curItem === 'number') ? curItem : fieldData[fields.value];\n if (curOpt.itemCreating && typeof curOpt.itemCreating === 'function') {\n var curData = {\n dataSource: dataSource,\n curData: curItem,\n text: value,\n options: curOpt,\n fields: fields\n };\n curOpt.itemCreating(curData);\n }\n if (curOpt.itemCreating && typeof curOpt.itemCreating === 'function') {\n fieldData = getFieldValues(dataSource[i], fields);\n value = fieldData[fields.value];\n }\n var li = createElement('li', {\n id: id + '-' + i,\n className: isHeader ? cssClass.group : cssClass.li, attrs: { role: 'presentation' }\n });\n if (isHeader) {\n li.innerText = fieldData[fields.text];\n }\n else {\n append(compiledString(curItem), li);\n li.setAttribute('data-value', value);\n li.setAttribute('role', 'option');\n }\n if (curOpt.itemCreated && typeof curOpt.itemCreated === 'function') {\n var curData = {\n dataSource: dataSource,\n curData: curItem,\n text: value,\n item: li,\n options: curOpt,\n fields: fields\n };\n curOpt.itemCreated(curData);\n }\n liCollection.push(li);\n }\n append(liCollection, ulElement);\n return ulElement;\n }\n ListBase.renderContentTemplate = renderContentTemplate;\n /**\n * Created header items from group template.\n * @param {string} template - that need to convert and generate li element.\n * @param {{[key:string]:Object}[]} dataSource - Specifies local JSON data source.\n * @param {FieldsMapping} fields - Specifies fields for mapping the dataSource.\n * @param {Element[]} headerItems? - Specifies listbase header items.\n */\n function renderGroupTemplate(groupTemplate, groupDataSource, fields, headerItems) {\n var compiledString = compile(groupTemplate);\n var category = fields.groupBy;\n for (var _i = 0, headerItems_1 = headerItems; _i < headerItems_1.length; _i++) {\n var header = headerItems_1[_i];\n var headerData = {};\n headerData[category] = header.textContent;\n header.innerHTML = '';\n append(compiledString(headerData), header);\n }\n return headerItems;\n }\n ListBase.renderGroupTemplate = renderGroupTemplate;\n function generateId() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n ListBase.generateId = generateId;\n function processSubChild(curItem, fields, ds, options, element, level) {\n var fieldData = getFieldValues(curItem, fields);\n // Get SubList \n var subDS = fieldData[fields.child] || [];\n var hasChildren = fieldData[fields.hasChildren];\n //Create Sub child\n if (subDS.length) {\n hasChildren = true;\n element.classList.add(cssClass.hasChild);\n if (options.processSubChild) {\n var subLi = createListFromJson(subDS, options, ++level);\n element.appendChild(subLi);\n }\n }\n // Create expand and collapse node\n if (!!options.expandCollapse && hasChildren && !options.template) {\n if (element.firstElementChild.classList.contains(cssClass.textContent)) {\n element.firstElementChild.classList.add(cssClass.iconWrapper);\n }\n var expandElement = options.expandIconPosition === 'Left' ? prepend : append;\n expandElement([createElement('div', { className: 'e-icons ' + options.expandIconClass })], element.querySelector('.' + cssClass.textContent));\n }\n }\n function generateSingleLevelLI(item, fields, className, innerElements, grpLI, id, index, options) {\n var curOpt = extend({}, defaultListBaseOptions, options);\n var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes);\n var text = item;\n var value = item;\n var dataSource;\n var fieldData = getFieldValues(item, fields);\n if (typeof item !== 'string' && typeof item !== 'number' && typeof item !== 'boolean') {\n dataSource = item;\n text = (typeof fieldData[fields.text] === 'boolean' || typeof fieldData[fields.text] === 'number') ?\n fieldData[fields.text] : (fieldData[fields.text] || '');\n value = fieldData[fields.value];\n }\n var elementID;\n if (!isNullOrUndefined(dataSource) && !isNullOrUndefined(fieldData[fields.id])\n && fieldData[fields.id] !== '') {\n elementID = id;\n }\n else {\n elementID = id + '-' + index;\n }\n var li = createElement('li', {\n className: (grpLI === true ? cssClass.group : cssClass.li) + ' ' + (isNullOrUndefined(className) ? '' : className),\n id: elementID, attrs: (ariaAttributes.groupItemRole !== '' && ariaAttributes.itemRole !== '' ?\n { role: (grpLI === true ? ariaAttributes.groupItemRole : ariaAttributes.itemRole) } : {})\n });\n if (dataSource && fieldData.hasOwnProperty(fields.enabled) && fieldData[fields.enabled].toString() === 'false') {\n li.classList.add(cssClass.disabled);\n }\n if (grpLI) {\n li.innerText = text;\n }\n else {\n if (!isNullOrUndefined(value)) {\n li.setAttribute('data-value', value);\n }\n li.setAttribute('role', 'option');\n if (dataSource && fieldData.hasOwnProperty(fields.htmlAttributes) && fieldData[fields.htmlAttributes]) {\n setAttribute(li, fieldData[fields.htmlAttributes]);\n }\n if (innerElements.length) {\n append(innerElements, li);\n }\n if (dataSource && fieldData.hasOwnProperty(fields.url) && fieldData[fields.url]) {\n li.appendChild(anchorTag(dataSource, fields, text));\n }\n else {\n li.appendChild(document.createTextNode(text));\n }\n }\n return li;\n }\n function getModuleClass(moduleName) {\n var moduleClass;\n return moduleClass = {\n li: \"e-\" + moduleName + \"-item\",\n ul: \"e-\" + moduleName + \"-parent e-ul\",\n group: \"e-\" + moduleName + \"-group-item\",\n icon: \"e-\" + moduleName + \"-icon\",\n text: \"e-\" + moduleName + \"-text\",\n check: \"e-\" + moduleName + \"-check\",\n checked: 'e-checked',\n selected: 'e-selected',\n expanded: 'e-expanded',\n textContent: 'e-text-content',\n hasChild: 'e-has-child',\n level: 'e-level',\n url: \"e-\" + moduleName + \"-url\",\n collapsible: 'e-icon-collapsible',\n disabled: 'e-disabled',\n image: \"e-\" + moduleName + \"-img\",\n iconWrapper: 'e-icon-wrapper'\n };\n }\n function anchorTag(dataSource, fields, text) {\n var fieldData = getFieldValues(dataSource, fields);\n var attr = { href: fieldData[fields.url] };\n if (fieldData.hasOwnProperty(fields.urlAttributes) && fieldData[fields.urlAttributes]) {\n merge(attr, fieldData[fields.urlAttributes]);\n }\n var anchorTag = createElement('a', { className: cssClass.text + ' ' + cssClass.url, innerHTML: text });\n setAttribute(anchorTag, attr);\n return anchorTag;\n }\n /* tslint:disable:align */\n function generateLI(item, fields, className, options) {\n var curOpt = extend({}, defaultListBaseOptions, options);\n var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes);\n var text = item;\n var uID;\n var grpLI;\n var dataSource;\n var fieldData;\n if (typeof item !== 'string' && typeof item !== 'number') {\n fieldData = getFieldValues(item, fields);\n dataSource = item;\n text = fieldData[fields.text] || '';\n uID = fieldData[fields.id];\n grpLI = (item.hasOwnProperty('isHeader') && item.isHeader)\n ? true : false;\n }\n var li = createElement('li', {\n className: (grpLI === true ? cssClass.group : cssClass.li) + ' ' + (isNullOrUndefined(className) ? '' : className),\n attrs: (ariaAttributes.groupItemRole !== '' && ariaAttributes.itemRole !== '' ?\n { role: (grpLI === true ? ariaAttributes.groupItemRole : ariaAttributes.itemRole) } : {})\n });\n !isNullOrUndefined(uID) ? li.setAttribute('data-uid', uID) : li.setAttribute('data-uid', generateId());\n if (grpLI && options && options.groupTemplate) {\n var compiledString = compile(options.groupTemplate);\n append(compiledString(item), li);\n }\n else if (!grpLI && options && options.template) {\n var compiledString = compile(options.template);\n append(compiledString(item), li);\n }\n else {\n var innerDiv = createElement('div', { className: cssClass.textContent,\n attrs: (ariaAttributes.wrapperRole !== '' ? { role: ariaAttributes.wrapperRole } : {}) });\n if (dataSource && fieldData.hasOwnProperty(fields.url) && fieldData[fields.url]) {\n innerDiv.appendChild(anchorTag(dataSource, fields, text));\n }\n else {\n innerDiv.appendChild(createElement('span', { className: cssClass.text, innerHTML: text,\n attrs: (ariaAttributes.itemText !== '' ? { role: ariaAttributes.itemText } : {}) }));\n }\n li.appendChild(innerDiv);\n }\n return li;\n }\n /**\n * Returns UL element based on the given LI element.\n * @param {HTMLElement[]} liElement - Specifies array of LI element.\n * @param {string} className? - Specifies class name that need to be added in UL element.\n * @param {ListBaseOptions} options? - Specifies ListBase options.\n */\n function generateUL(liElement, className, options) {\n var curOpt = extend({}, defaultListBaseOptions, options);\n var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes);\n cssClass = getModuleClass(curOpt.moduleName);\n var ulElement = createElement('ul', {\n className: cssClass.ul + ' ' + (isNullOrUndefined(className) ? '' : className),\n attrs: (ariaAttributes.listRole !== '' ? { role: ariaAttributes.listRole } : {})\n });\n append(liElement, ulElement);\n return ulElement;\n }\n ListBase.generateUL = generateUL;\n /**\n * Returns LI element with additional DIV tag based on the given LI element.\n * @param {liElement} liElement - Specifies LI element.\n * @param {string} className? - Specifies class name that need to be added in created DIV element.\n * @param {ListBaseOptions} options? - Specifies ListBase options.\n */\n function generateIcon(liElement, className, options) {\n var curOpt = extend({}, defaultListBaseOptions, options);\n var ariaAttributes = extend({}, defaultAriaAttributes, curOpt.ariaAttributes);\n cssClass = getModuleClass(curOpt.moduleName);\n var expandElement = curOpt.expandIconPosition === 'Left' ? prepend : append;\n expandElement([createElement('div', { className: 'e-icons ' + curOpt.expandIconClass + ' ' +\n (isNullOrUndefined(className) ? '' : className) })], liElement.querySelector('.' + cssClass.textContent));\n return liElement;\n }\n ListBase.generateIcon = generateIcon;\n})(ListBase || (ListBase = {}));\n/**\n * Used to get dataSource item from complex data using fields.\n * @param {{[key:string]:Object}|string[]|string} dataSource - Specifies an JSON or String data.\n * @param {FieldsMapping} fields - Fields that are mapped from the dataSource.\n */\nexport function getFieldValues(dataItem, fields) {\n var fieldData = {};\n var value;\n if (isNullOrUndefined(dataItem)) {\n return dataItem;\n }\n else if (typeof (dataItem) === 'string' || typeof (dataItem) === 'number') {\n return dataItem;\n }\n else if (isNullOrUndefined(dataItem.isHeader)) {\n for (var _i = 0, _a = Object.keys(fields); _i < _a.length; _i++) {\n var field = _a[_i];\n if (!isNullOrUndefined(fields[field]) &&\n typeof (fields[field]) === 'string') {\n var property = fields[field].split('.');\n var dataField = property.length > 1 ? property[0] : fields[field];\n if (!isNullOrUndefined(dataItem[dataField])) {\n value = getValue(fields[field], dataItem);\n if (!isNullOrUndefined(value)) {\n fieldData[fields[field]] = value;\n }\n }\n }\n }\n }\n else if (!isNullOrUndefined(dataItem.isHeader) && dataItem.isHeader) {\n fieldData = dataItem;\n }\n return fieldData;\n}\n","/**\n * Encoding class: Contains the details about encoding type, whether to write a Unicode byte order mark (BOM).\n * ```typescript\n * let encoding : Encoding = new Encoding();\n * encoding.type = 'Utf8';\n * encoding.getBytes('Encoding', 0, 5);\n * ```\n */\nvar Encoding = /** @class */ (function () {\n /**\n * Initializes a new instance of the Encoding class. A parameter specifies whether to write a Unicode byte order mark\n * @param {boolean} includeBom?-true to specify that a Unicode byte order mark is written; otherwise, false.\n */\n function Encoding(includeBom) {\n this.emitBOM = true;\n this.encodingType = 'Ansi';\n this.initBOM(includeBom);\n }\n Object.defineProperty(Encoding.prototype, \"includeBom\", {\n /**\n * Gets a value indicating whether to write a Unicode byte order mark\n * @returns boolean- true to specify that a Unicode byte order mark is written; otherwise, false\n */\n get: function () {\n return this.emitBOM;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Encoding.prototype, \"type\", {\n /**\n * Gets the encoding type.\n * @returns EncodingType\n */\n get: function () {\n return this.encodingType;\n },\n /**\n * Sets the encoding type.\n * @param {EncodingType} value\n */\n set: function (value) {\n this.encodingType = value;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Initialize the includeBom to emit BOM or Not\n * @param {boolean} includeBom\n */\n Encoding.prototype.initBOM = function (includeBom) {\n if (includeBom === undefined || includeBom === null) {\n this.emitBOM = true;\n }\n else {\n this.emitBOM = includeBom;\n }\n };\n /**\n * Calculates the number of bytes produced by encoding the characters in the specified string\n * @param {string} chars - The string containing the set of characters to encode\n * @returns {number} - The number of bytes produced by encoding the specified characters\n */\n Encoding.prototype.getByteCount = function (chars) {\n var byteCount = 0;\n validateNullOrUndefined(chars, 'string');\n if (chars === '') {\n var byte = this.utf8Len(chars.charCodeAt(0));\n return byte;\n }\n if (this.type === null || this.type === undefined) {\n this.type = 'Ansi';\n }\n return this.getByteCountInternal(chars, 0, chars.length);\n };\n /**\n * Return the Byte of character\n * @param {number} codePoint\n * @returns {number}\n */\n Encoding.prototype.utf8Len = function (codePoint) {\n var bytes = codePoint <= 0x7F ? 1 :\n codePoint <= 0x7FF ? 2 :\n codePoint <= 0xFFFF ? 3 :\n codePoint <= 0x1FFFFF ? 4 : 0;\n return bytes;\n };\n /**\n * for 4 byte character return surrogate pair true, otherwise false\n * @param {number} codeUnit\n * @returns {boolean}\n */\n Encoding.prototype.isHighSurrogate = function (codeUnit) {\n return codeUnit >= 0xD800 && codeUnit <= 0xDBFF;\n };\n /**\n * for 4byte character generate the surrogate pair\n * @param {number} highCodeUnit\n * @param {number} lowCodeUnit\n */\n Encoding.prototype.toCodepoint = function (highCodeUnit, lowCodeUnit) {\n highCodeUnit = (0x3FF & highCodeUnit) << 10;\n var u = highCodeUnit | (0x3FF & lowCodeUnit);\n return u + 0x10000;\n };\n /**\n * private method to get the byte count for specific charindex and count\n * @param {string} chars\n * @param {number} charIndex\n * @param {number} charCount\n */\n Encoding.prototype.getByteCountInternal = function (chars, charIndex, charCount) {\n var byteCount = 0;\n if (this.encodingType === 'Utf8' || this.encodingType === 'Unicode') {\n var isUtf8 = this.encodingType === 'Utf8';\n for (var i = 0; i < charCount; i++) {\n var charCode = chars.charCodeAt(isUtf8 ? charIndex : charIndex++);\n if (this.isHighSurrogate(charCode)) {\n if (isUtf8) {\n var high = charCode;\n var low = chars.charCodeAt(++charIndex);\n byteCount += this.utf8Len(this.toCodepoint(high, low));\n }\n else {\n byteCount += 4;\n ++i;\n }\n }\n else {\n if (isUtf8) {\n byteCount += this.utf8Len(charCode);\n }\n else {\n byteCount += 2;\n }\n }\n if (isUtf8) {\n charIndex++;\n }\n }\n return byteCount;\n }\n else {\n byteCount = charCount;\n return byteCount;\n }\n };\n /**\n * Encodes a set of characters from the specified string into the ArrayBuffer.\n * @param {string} s- The string containing the set of characters to encode\n * @param {number} charIndex-The index of the first character to encode.\n * @param {number} charCount- The number of characters to encode.\n * @returns {ArrayBuffer} - The ArrayBuffer that contains the resulting sequence of bytes.\n */\n Encoding.prototype.getBytes = function (s, charIndex, charCount) {\n validateNullOrUndefined(s, 'string');\n validateNullOrUndefined(charIndex, 'charIndex');\n validateNullOrUndefined(charCount, 'charCount');\n if (charIndex < 0 || charCount < 0) {\n throw new RangeError('Argument Out Of Range Exception: charIndex or charCount is less than zero');\n }\n if (s.length - charIndex < charCount) {\n throw new RangeError('Argument Out Of Range Exception: charIndex and charCount do not denote a valid range in string');\n }\n var bytes;\n if (s === '') {\n bytes = new ArrayBuffer(0);\n return bytes;\n }\n if (this.type === null || this.type === undefined) {\n this.type = 'Ansi';\n }\n var byteCount = this.getByteCountInternal(s, charIndex, charCount);\n switch (this.type) {\n case 'Utf8':\n bytes = this.getBytesOfUtf8Encoding(byteCount, s, charIndex, charCount);\n return bytes;\n case 'Unicode':\n bytes = this.getBytesOfUnicodeEncoding(byteCount, s, charIndex, charCount);\n return bytes;\n default:\n bytes = this.getBytesOfAnsiEncoding(byteCount, s, charIndex, charCount);\n return bytes;\n }\n };\n /**\n * Decodes a sequence of bytes from the specified ArrayBuffer into the string.\n * @param {ArrayBuffer} bytes- The ArrayBuffer containing the sequence of bytes to decode.\n * @param {number} index- The index of the first byte to decode.\n * @param {number} count- The number of bytes to decode.\n * @returns {string} - The string that contains the resulting set of characters.\n */\n Encoding.prototype.getString = function (bytes, index, count) {\n validateNullOrUndefined(bytes, 'bytes');\n validateNullOrUndefined(index, 'index');\n validateNullOrUndefined(count, 'count');\n if (index < 0 || count < 0) {\n throw new RangeError('Argument Out Of Range Exception: index or count is less than zero');\n }\n if (bytes.byteLength - index < count) {\n throw new RangeError('Argument Out Of Range Exception: index and count do not denote a valid range in bytes');\n }\n if (bytes.byteLength === 0 || count === 0) {\n return '';\n }\n if (this.type === null || this.type === undefined) {\n this.type = 'Ansi';\n }\n var out = '';\n var byteCal = new Uint8Array(bytes);\n switch (this.type) {\n case 'Utf8':\n var s = this.getStringOfUtf8Encoding(byteCal, index, count);\n return s;\n case 'Unicode':\n var byteUnicode = new Uint16Array(bytes);\n out = this.getStringofUnicodeEncoding(byteUnicode, index, count);\n return out;\n default:\n var j = index;\n for (var i = 0; i < count; i++) {\n var c = byteCal[j];\n out += String.fromCharCode(c); // 1 byte(ASCII) character \n j++;\n }\n return out;\n }\n };\n Encoding.prototype.getBytesOfAnsiEncoding = function (byteCount, s, charIndex, charCount) {\n var bytes = new ArrayBuffer(byteCount);\n var bufview = new Uint8Array(bytes);\n var k = 0;\n for (var i = 0; i < charCount; i++) {\n var charcode = s.charCodeAt(charIndex++);\n if (charcode < 0x800) {\n bufview[k] = charcode;\n }\n else {\n bufview[k] = 63; //replacement character '?'\n }\n k++;\n }\n return bytes;\n };\n Encoding.prototype.getBytesOfUtf8Encoding = function (byteCount, s, charIndex, charCount) {\n var bytes = new ArrayBuffer(byteCount);\n var uint = new Uint8Array(bytes);\n var index = charIndex;\n var j = 0;\n for (var i = 0; i < charCount; i++) {\n var charcode = s.charCodeAt(index);\n if (charcode <= 0x7F) {\n uint[j] = charcode;\n }\n else if (charcode < 0x800) {\n uint[j] = 0xc0 | (charcode >> 6);\n uint[++j] = 0x80 | (charcode & 0x3f);\n }\n else if ((charcode < 0xd800 || charcode >= 0xe000)) {\n uint[j] = 0xe0 | (charcode >> 12);\n uint[++j] = 0x80 | ((charcode >> 6) & 0x3f);\n uint[++j] = 0x80 | (charcode & 0x3f);\n }\n else {\n uint[j] = 0xef;\n uint[++j] = 0xbf;\n uint[++j] = 0xbd; // U+FFFE \"replacement character\"\n }\n ++j;\n ++index;\n }\n return bytes;\n };\n Encoding.prototype.getBytesOfUnicodeEncoding = function (byteCount, s, charIndex, charCount) {\n var bytes = new ArrayBuffer(byteCount);\n var uint16 = new Uint16Array(bytes);\n for (var i = 0; i < charCount; i++) {\n var charcode = s.charCodeAt(i);\n uint16[i] = charcode;\n }\n return bytes;\n };\n Encoding.prototype.getStringOfUtf8Encoding = function (byteCal, index, count) {\n var j = 0;\n var i = index;\n var s = '';\n for (j; j < count; j++) {\n var c = byteCal[i++];\n while (i > byteCal.length) {\n return s;\n }\n if (c > 127) {\n if (c > 191 && c < 224 && i < count) {\n c = (c & 31) << 6 | byteCal[i] & 63;\n }\n else if (c > 223 && c < 240 && i < byteCal.byteLength) {\n c = (c & 15) << 12 | (byteCal[i] & 63) << 6 | byteCal[++i] & 63;\n }\n else if (c > 239 && c < 248 && i < byteCal.byteLength) {\n c = (c & 7) << 18 | (byteCal[i] & 63) << 12 | (byteCal[++i] & 63) << 6 | byteCal[++i] & 63;\n }\n ++i;\n }\n s += String.fromCharCode(c); // 1 byte(ASCII) character \n }\n return s;\n };\n Encoding.prototype.getStringofUnicodeEncoding = function (byteUni, index, count) {\n if (count > byteUni.length) {\n throw new RangeError('ArgumentOutOfRange_Count');\n }\n var byte16 = new Uint16Array(count);\n var out = '';\n for (var i = 0; i < count && i < byteUni.length; i++) {\n byte16[i] = byteUni[index++];\n }\n out = String.fromCharCode.apply(null, byte16);\n return out;\n };\n /**\n * To clear the encoding instance\n * @return {void}\n */\n Encoding.prototype.destroy = function () {\n this.emitBOM = undefined;\n this.encodingType = undefined;\n };\n return Encoding;\n}());\nexport { Encoding };\n/**\n * To check the object is null or undefined and throw error if it is null or undefined\n * @param {Object} value - object to check is null or undefined\n * @return {boolean}\n * @throws {ArgumentException} - if the value is null or undefined\n * @private\n */\nexport function validateNullOrUndefined(value, message) {\n if (value === null || value === undefined) {\n throw new Error('ArgumentException: ' + message + ' cannot be null or undefined');\n }\n}\n","/**\n * @private\n * @hidden\n */\nexport function defaultToString(item) {\n // if (item === null) {\n // return 'COLLECTION_NULL';\n // } else if (typeof item === 'undefined') {\n // return 'COLLECTION_UNDEFINED';\n // } else if (Object.prototype.toString.call(item) === '[object String]') {\n if (Object.prototype.toString.call(item) === '[object String]') {\n return '$s' + item;\n }\n else {\n return '$o' + item.toString();\n }\n}\n","/** @private */\nexport function getTooltipThemeColor(theme) {\n var style;\n switch (theme) {\n case 'Highcontrast':\n style = {\n tooltipFill: '#ffffff',\n tooltipBoldLabel: '#000000',\n tooltipLightLabel: '#000000',\n tooltipHeaderLine: '#969696'\n };\n break;\n default:\n style = {\n tooltipFill: 'rgba(0, 8, 22, 0.75)',\n tooltipBoldLabel: '#ffffff',\n tooltipLightLabel: '#dbdbdb',\n tooltipHeaderLine: '#ffffff'\n };\n break;\n }\n return style;\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { createElement, remove, SvgRenderer, merge } from '@syncfusion/ej2-base';\n/**\n * Function to measure the height and width of the text.\n * @param {string} text\n * @param {FontModel} font\n * @param {string} id\n * @returns no\n * @private\n */\nexport function measureText(text, font) {\n var htmlObject = document.getElementById('chartmeasuretext');\n if (htmlObject === null) {\n htmlObject = createElement('text', { id: 'chartmeasuretext' });\n document.body.appendChild(htmlObject);\n }\n htmlObject.innerHTML = text;\n htmlObject.style.position = 'absolute';\n htmlObject.style.fontSize = font.size;\n htmlObject.style.fontWeight = font.fontWeight;\n htmlObject.style.fontStyle = font.fontStyle;\n htmlObject.style.fontFamily = font.fontFamily;\n htmlObject.style.visibility = 'hidden';\n htmlObject.style.top = '-100';\n htmlObject.style.left = '0';\n htmlObject.style.whiteSpace = 'nowrap';\n // For bootstrap line height issue\n htmlObject.style.lineHeight = 'normal';\n return new Size(htmlObject.clientWidth, htmlObject.clientHeight);\n}\n/** @private */\nexport function findDirection(rX, rY, rect, arrowLocation, arrowPadding, top, bottom, left, tipX, tipY, tipRadius) {\n var direction = '';\n var startX = rect.x;\n var startY = rect.y;\n var width = rect.x + rect.width;\n var height = rect.y + rect.height;\n tipRadius = tipRadius ? tipRadius : 0;\n if (top) {\n direction = direction.concat('M' + ' ' + (startX) + ' ' + (startY + rY) + ' Q ' + startX + ' '\n + startY + ' ' + (startX + rX) + ' ' + startY + ' ' +\n ' L' + ' ' + (width - rX) + ' ' + (startY) + ' Q ' + width + ' '\n + startY + ' ' + (width) + ' ' + (startY + rY));\n direction = direction.concat(' L' + ' ' + (width) + ' ' + (height - rY) + ' Q ' + width + ' '\n + (height) + ' ' + (width - rX) + ' ' + (height));\n if (arrowPadding !== 0) {\n direction = direction.concat(' L' + ' ' + (arrowLocation.x + arrowPadding / 2) + ' ' + (height));\n direction = direction.concat(' L' + ' ' + (tipX + tipRadius) + ' ' + (height + arrowPadding - tipRadius));\n direction += ' Q' + ' ' + (tipX) + ' ' + (height + arrowPadding) + ' ' + (tipX - tipRadius) +\n ' ' + (height + arrowPadding - tipRadius);\n }\n if ((arrowLocation.x - arrowPadding / 2) > startX) {\n direction = direction.concat(' L' + ' ' + (arrowLocation.x - arrowPadding / 2) + ' ' + height +\n ' L' + ' ' + (startX + rX) + ' ' + height + ' Q ' + startX + ' '\n + height + ' ' + (startX) + ' ' + (height - rY) + ' z');\n }\n else {\n if (arrowPadding === 0) {\n direction = direction.concat(' L' + ' ' + (startX + rX) + ' ' + height + ' Q ' + startX + ' '\n + height + ' ' + (startX) + ' ' + (height - rY) + ' z');\n }\n else {\n direction = direction.concat(' L' + ' ' + (startX) + ' ' + (height + rY) + ' z');\n }\n }\n }\n else if (bottom) {\n direction = direction.concat('M' + ' ' + (startX) + ' ' + (startY + rY) + ' Q ' + startX + ' '\n + (startY) + ' ' + (startX + rX) + ' ' + (startY) + ' L' + ' ' + (arrowLocation.x - arrowPadding / 2) + ' ' + (startY));\n direction = direction.concat(' L' + ' ' + (tipX - tipRadius) + ' ' + (arrowLocation.y + tipRadius));\n direction += ' Q' + ' ' + (tipX) + ' ' + (arrowLocation.y) + ' ' + (tipX + tipRadius) + ' ' + (arrowLocation.y + tipRadius);\n direction = direction.concat(' L' + ' ' + (arrowLocation.x + arrowPadding / 2) + ' ' + (startY) + ' L' + ' '\n + (width - rX) + ' ' + (startY) + ' Q ' + (width) + ' ' + (startY) + ' ' + (width) + ' ' + (startY + rY));\n direction = direction.concat(' L' + ' ' + (width) + ' ' + (height - rY) + ' Q ' + (width) + ' '\n + (height) + ' ' + (width - rX) + ' ' + (height) +\n ' L' + ' ' + (startX + rX) + ' ' + (height) + ' Q ' + (startX) + ' '\n + (height) + ' ' + (startX) + ' ' + (height - rY) + ' z');\n }\n else if (left) {\n direction = direction.concat('M' + ' ' + (startX) + ' ' + (startY + rY) + ' Q ' + startX + ' '\n + (startY) + ' ' + (startX + rX) + ' ' + (startY));\n direction = direction.concat(' L' + ' ' + (width - rX) + ' ' + (startY) + ' Q ' + (width) + ' '\n + (startY) + ' ' + (width) + ' ' + (startY + rY) + ' L' + ' ' + (width) + ' ' + (arrowLocation.y - arrowPadding / 2));\n direction = direction.concat(' L' + ' ' + (width + arrowPadding - tipRadius) + ' ' + (tipY - tipRadius));\n direction += ' Q ' + (width + arrowPadding) + ' ' + (tipY) + ' ' + (width + arrowPadding - tipRadius) + ' ' + (tipY + tipRadius);\n direction = direction.concat(' L' + ' ' + (width) + ' ' + (arrowLocation.y + arrowPadding / 2) +\n ' L' + ' ' + (width) + ' ' + (height - rY) + ' Q ' + width + ' ' + (height) + ' ' + (width - rX) + ' ' + (height));\n direction = direction.concat(' L' + ' ' + (startX + rX) + ' ' + (height) + ' Q ' + startX + ' '\n + (height) + ' ' + (startX) + ' ' + (height - rY) + ' z');\n }\n else {\n direction = direction.concat('M' + ' ' + (startX + rX) + ' ' + (startY) + ' Q ' + (startX) + ' '\n + (startY) + ' ' + (startX) + ' ' + (startY + rY) + ' L' + ' ' + (startX) + ' ' + (arrowLocation.y - arrowPadding / 2));\n direction = direction.concat(' L' + ' ' + (startX - arrowPadding + tipRadius) + ' ' + (tipY - tipRadius));\n direction += ' Q ' + (startX - arrowPadding) + ' ' + (tipY) + ' ' + (startX - arrowPadding + tipRadius) + ' ' + (tipY + tipRadius);\n direction = direction.concat(' L' + ' ' + (startX) + ' ' + (arrowLocation.y + arrowPadding / 2) +\n ' L' + ' ' + (startX) + ' ' + (height - rY) + ' Q ' + startX + ' '\n + (height) + ' ' + (startX + rX) + ' ' + (height));\n direction = direction.concat(' L' + ' ' + (width - rX) + ' ' + (height) + ' Q ' + width + ' '\n + (height) + ' ' + (width) + ' ' + (height - rY) +\n ' L' + ' ' + (width) + ' ' + (startY + rY) + ' Q ' + width + ' '\n + (startY) + ' ' + (width - rX) + ' ' + (startY) + ' z');\n }\n return direction;\n}\n/** @private */\nvar Size = /** @class */ (function () {\n function Size(width, height) {\n this.width = width;\n this.height = height;\n }\n return Size;\n}());\nexport { Size };\n/** @private */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n return Rect;\n}());\nexport { Rect };\nvar Side = /** @class */ (function () {\n function Side(bottom, right) {\n this.isRight = right;\n this.isBottom = bottom;\n }\n return Side;\n}());\nexport { Side };\n/** @private */\nvar CustomizeOption = /** @class */ (function () {\n function CustomizeOption(id) {\n this.id = id;\n }\n return CustomizeOption;\n}());\nexport { CustomizeOption };\n/** @private */\nvar TextOption = /** @class */ (function (_super) {\n __extends(TextOption, _super);\n function TextOption(id, x, y, anchor, text, transform, baseLine) {\n if (transform === void 0) { transform = ''; }\n var _this = _super.call(this, id) || this;\n _this.transform = '';\n _this.baseLine = 'auto';\n _this.x = x;\n _this.y = y;\n _this.anchor = anchor;\n _this.text = text;\n _this.transform = transform;\n _this.baseLine = baseLine;\n return _this;\n }\n return TextOption;\n}(CustomizeOption));\nexport { TextOption };\n/** @private */\nexport function getElement(id) {\n return document.getElementById(id);\n}\n/** @private */\nexport function removeElement(id) {\n var element = getElement(id);\n if (element) {\n remove(element);\n }\n}\n/** @private */\nexport function drawSymbol(location, shape, size, url, options, label) {\n var functionName = 'Path';\n var renderer = new SvgRenderer('');\n var temp = calculateShapes(location, size, shape, options, url);\n var htmlObject = renderer['draw' + temp.functionName](temp.renderOption);\n htmlObject.setAttribute('aria-label', label);\n return htmlObject;\n}\n/** @private */\nexport function calculateShapes(location, size, shape, options, url) {\n var path;\n var functionName = 'Path';\n var width = size.width;\n var height = size.height;\n var locX = location.x;\n var locY = location.y;\n var x = location.x + (-width / 2);\n var y = location.y + (-height / 2);\n switch (shape) {\n case 'Circle':\n case 'Bubble':\n functionName = 'Ellipse';\n merge(options, { 'rx': width / 2, 'ry': height / 2, 'cx': locX, 'cy': locY });\n break;\n case 'Cross':\n path = 'M' + ' ' + x + ' ' + locY + ' ' + 'L' + ' ' + (locX + (width / 2)) + ' ' + locY + ' ' +\n 'M' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + locX + ' ' +\n (locY + (-height / 2));\n merge(options, { 'd': path });\n break;\n case 'HorizontalLine':\n path = 'M' + ' ' + x + ' ' + locY + ' ' + 'L' + ' ' + (locX + (width / 2)) + ' ' + locY;\n merge(options, { 'd': path });\n break;\n case 'VerticalLine':\n path = 'M' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + locX + ' ' + (locY + (-height / 2));\n merge(options, { 'd': path });\n break;\n case 'Diamond':\n path = 'M' + ' ' + x + ' ' + locY + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + locY + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + locY + ' z';\n merge(options, { 'd': path });\n break;\n case 'Rectangle':\n path = 'M' + ' ' + x + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (-height / 2)) + ' z';\n merge(options, { 'd': path });\n break;\n case 'Triangle':\n path = 'M' + ' ' + x + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (height / 2)) + ' z';\n merge(options, { 'd': path });\n break;\n case 'InvertedTriangle':\n path = 'M' + ' ' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + (locX - (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' z';\n merge(options, { 'd': path });\n break;\n case 'Pentagon':\n var eq = 72;\n var xValue = void 0;\n var yValue = void 0;\n for (var i = 0; i <= 5; i++) {\n xValue = (width / 2) * Math.cos((Math.PI / 180) * (i * eq));\n yValue = (height / 2) * Math.sin((Math.PI / 180) * (i * eq));\n if (i === 0) {\n path = 'M' + ' ' + (locX + xValue) + ' ' + (locY + yValue) + ' ';\n }\n else {\n path = path.concat('L' + ' ' + (locX + xValue) + ' ' + (locY + yValue) + ' ');\n }\n }\n path = path.concat('Z');\n merge(options, { 'd': path });\n break;\n case 'Image':\n functionName = 'Image';\n merge(options, { 'href': url, 'height': height, 'width': width, x: x, y: y });\n break;\n }\n return { renderOption: options, functionName: functionName };\n}\n/** @private */\nvar PathOption = /** @class */ (function (_super) {\n __extends(PathOption, _super);\n function PathOption(id, fill, width, color, opacity, dashArray, d) {\n var _this = _super.call(this, id) || this;\n _this.opacity = opacity;\n _this.fill = fill;\n _this.stroke = color;\n _this['stroke-width'] = width;\n _this['stroke-dasharray'] = dashArray;\n _this.d = d;\n return _this;\n }\n return PathOption;\n}(CustomizeOption));\nexport { PathOption };\n/** @private */\nexport function textElement(options, font, color, parent) {\n var renderOptions = {};\n var htmlObject;\n var tspanElement;\n var renderer = new SvgRenderer('');\n var text;\n var height;\n renderOptions = {\n 'id': options.id,\n 'x': options.x,\n 'y': options.y,\n 'fill': color,\n 'font-size': font.size,\n 'font-style': font.fontStyle,\n 'font-family': font.fontFamily,\n 'font-weight': font.fontWeight,\n 'text-anchor': options.anchor,\n 'transform': options.transform,\n 'opacity': font.opacity,\n 'dominant-baseline': options.baseLine\n };\n text = typeof options.text === 'string' ? options.text : options.text[0];\n htmlObject = renderer.createText(renderOptions, text);\n parent.appendChild(htmlObject);\n return htmlObject;\n}\nvar TooltipLocation = /** @class */ (function () {\n function TooltipLocation(x, y) {\n this.x = x;\n this.y = y;\n }\n return TooltipLocation;\n}());\nexport { TooltipLocation };\n","/**\n * Specifies Chart Themes\n */\nexport var Theme;\n(function (Theme) {\n /** @private */\n Theme.axisLabelFont = {\n size: '12px',\n fontWeight: 'Normal',\n color: null,\n fontStyle: 'Normal',\n fontFamily: 'Segoe UI'\n };\n /** @private */\n Theme.axisTitleFont = {\n size: '14px',\n fontWeight: 'Normal',\n color: null,\n fontStyle: 'Normal',\n fontFamily: 'Segoe UI'\n };\n /** @private */\n Theme.chartTitleFont = {\n size: '15px',\n fontWeight: '500',\n color: null,\n fontStyle: 'Normal',\n fontFamily: 'Segoe UI'\n };\n /** @private */\n Theme.crosshairLabelFont = {\n size: '13px',\n fontWeight: 'Normal',\n color: null,\n fontStyle: 'Normal',\n fontFamily: 'Segoe UI'\n };\n /** @private */\n Theme.tooltipLabelFont = {\n size: '13px',\n fontWeight: 'Normal',\n color: null,\n fontStyle: 'Normal',\n fontFamily: 'Segoe UI'\n };\n /** @private */\n Theme.legendLabelFont = {\n size: '13px',\n fontWeight: 'Normal',\n color: null,\n fontStyle: 'Normal',\n fontFamily: 'Segoe UI'\n };\n /** @private */\n Theme.stripLineLabelFont = {\n size: '12px',\n fontWeight: 'Regular',\n color: '#353535',\n fontStyle: 'Normal',\n fontFamily: 'Segoe UI'\n };\n})(Theme || (Theme = {}));\n/** @private */\nexport function getSeriesColor(theme) {\n var palette;\n switch (theme) {\n case 'Fabric':\n palette = ['#4472c4', '#ed7d31', '#ffc000', '#70ad47', '#5b9bd5',\n '#c1c1c1', '#6f6fe2', '#e269ae', '#9e480e', '#997300'];\n break;\n case 'Bootstrap':\n palette = ['#a16ee5', '#f7ce69', '#55a5c2', '#7ddf1e', '#ff6ea6',\n '#7953ac', '#b99b4f', '#407c92', '#5ea716', '#b91c52'];\n break;\n case 'Highcontrast':\n palette = ['#79ECE4', '#E98272', '#DFE6B6', '#C6E773', '#BA98FF',\n '#FA83C3', '#00C27A', '#43ACEF', '#D681EF', '#D8BC6E'];\n break;\n default:\n palette = ['#00bdae', '#404041', '#357cd2', '#e56590', '#f8b883',\n '#70ad47', '#dd8abd', '#7f84e8', '#7bb4eb', '#ea7a57'];\n break;\n }\n return palette;\n}\n/** @private */\nexport function getThemeColor(theme) {\n var style;\n switch (theme) {\n case 'Highcontrast':\n style = {\n axisLabel: '#ffffff',\n axisTitle: '#ffffff',\n axisLine: '#ffffff',\n majorGridLine: '#BFBFBF',\n minorGridLine: '#969696',\n majorTickLine: '#BFBFBF',\n minorTickLine: '#969696',\n chartTitle: '#ffffff',\n legendLabel: '#ffffff',\n background: '#000000',\n areaBorder: '#ffffff',\n errorBar: '#ffffff',\n crosshairLine: '#ffffff',\n crosshairFill: '#ffffff',\n crosshairLabel: '#000000',\n tooltipFill: '#ffffff',\n tooltipBoldLabel: '#000000',\n tooltipLightLabel: '#000000',\n tooltipHeaderLine: '#969696',\n markerShadow: '#BFBFBF',\n selectionRectFill: 'rgba(255, 217, 57, 0.3)',\n selectionRectStroke: '#ffffff',\n selectionCircleStroke: '#FFD939'\n };\n break;\n default:\n style = {\n axisLabel: '#686868',\n axisTitle: '#424242',\n axisLine: '#b5b5b5',\n majorGridLine: '#dbdbdb',\n minorGridLine: '#eaeaea',\n majorTickLine: '#b5b5b5',\n minorTickLine: '#d6d6d6',\n chartTitle: '#424242',\n legendLabel: '#353535',\n background: '#FFFFFF',\n areaBorder: 'Gray',\n errorBar: '#000000',\n crosshairLine: '#4f4f4f',\n crosshairFill: '#4f4f4f',\n crosshairLabel: '#e5e5e5',\n tooltipFill: 'rgba(0, 8, 22, 0.75)',\n tooltipBoldLabel: '#ffffff',\n tooltipLightLabel: '#dbdbdb',\n tooltipHeaderLine: '#ffffff',\n markerShadow: null,\n selectionRectFill: 'rgba(41, 171, 226, 0.1)',\n selectionRectStroke: '#29abe2',\n selectionCircleStroke: '#29abe2'\n };\n break;\n }\n return style;\n}\n/** @private */\nexport function getScrollbarThemeColor(theme) {\n var scrollStyle;\n switch (theme) {\n case 'Highcontrast':\n scrollStyle = {\n backRect: '#333',\n thumb: '#bfbfbf',\n circle: '#fff',\n circleHover: '#685708',\n arrow: '#333',\n grip: '#333',\n arrowHover: '#fff',\n backRectBorder: '#969696',\n };\n break;\n case 'Bootstrap':\n scrollStyle = {\n backRect: '#f5f5f5',\n thumb: '#e6e6e6',\n circle: '#fff',\n circleHover: '#eee',\n arrow: '#8c8c8c',\n grip: '#8c8c8c'\n };\n break;\n case 'Fabric':\n scrollStyle = {\n backRect: '#f8f8f8',\n thumb: '#eaeaea',\n circle: '#fff',\n circleHover: '#eaeaea',\n arrow: '#a6a6a6',\n grip: '#a6a6a6'\n };\n break;\n default:\n scrollStyle = {\n backRect: '#f5f5f5',\n thumb: '#e0e0e0',\n circle: '#fff',\n circleHover: '#eee',\n arrow: '#9e9e9e',\n grip: '#9e9e9e'\n };\n break;\n }\n return scrollStyle;\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { SvgRenderer, Animation, compile as templateComplier, Browser } from '@syncfusion/ej2-base';\nimport { merge, extend, isNullOrUndefined } from '@syncfusion/ej2-base';\nimport { createElement, remove } from '@syncfusion/ej2-base';\nimport { Index } from '../../common/model/base';\nimport { VisibleLabels } from '../../chart/axis/axis';\nimport { axisLabelRender } from '../model/constants';\n/**\n * Methods for calculating the text size.\n */\n/**\n * Function to measure the height and width of the text.\n * @param {string} text\n * @param {FontModel} font\n * @param {string} id\n * @returns no\n * @private\n */\nexport function measureText(text, font) {\n var htmlObject = document.getElementById('chartmeasuretext');\n if (htmlObject === null) {\n htmlObject = createElement('text', { id: 'chartmeasuretext' });\n document.body.appendChild(htmlObject);\n }\n htmlObject.innerHTML = text;\n htmlObject.style.position = 'absolute';\n htmlObject.style.fontSize = font.size;\n htmlObject.style.fontWeight = font.fontWeight;\n htmlObject.style.fontStyle = font.fontStyle;\n htmlObject.style.fontFamily = font.fontFamily;\n htmlObject.style.visibility = 'hidden';\n htmlObject.style.top = '-100';\n htmlObject.style.left = '0';\n htmlObject.style.whiteSpace = 'nowrap';\n // For bootstrap line height issue\n htmlObject.style.lineHeight = 'normal';\n return new Size(htmlObject.clientWidth, htmlObject.clientHeight);\n}\n/**\n * Function to sort the dataSource, by default it sort the data in ascending order.\n * @param {Object} data\n * @param {string} fields\n * @param {boolean} isDescending\n * @returns Object\n */\nexport function sort(data, fields, isDescending) {\n var sortData = extend([], data, null);\n sortData.sort(function (a, b) {\n var first = 0;\n var second = 0;\n for (var i = 0; i < fields.length; i++) {\n first += a[fields[i]];\n second += b[fields[i]];\n }\n if ((!isDescending && first < second) || (isDescending && first > second)) {\n return -1;\n }\n else if (first === second) {\n return 0;\n }\n return 1;\n });\n return sortData;\n}\n/** @private */\nexport function rotateTextSize(font, text, angle, chart) {\n var renderer = new SvgRenderer(chart.element.id);\n var box;\n var options;\n var htmlObject;\n options = {\n 'font-size': font.size,\n 'font-style': font.fontStyle,\n 'font-family': font.fontFamily,\n 'font-weight': font.fontWeight,\n 'transform': 'rotate(' + angle + ', 0, 0)',\n 'text-anchor': 'middle'\n };\n htmlObject = renderer.createText(options, text);\n if (!chart.delayRedraw) {\n chart.element.appendChild(chart.svgObject);\n }\n chart.svgObject.appendChild(htmlObject);\n box = htmlObject.getBoundingClientRect();\n remove(htmlObject);\n if (!chart.delayRedraw) {\n remove(chart.svgObject);\n }\n return new Size((box.right - box.left), (box.bottom - box.top));\n}\n/** @private */\nexport function removeElement(id) {\n var element = getElement(id);\n if (element) {\n remove(element);\n }\n}\n/** @private */\nexport function logBase(value, base) {\n return Math.log(value) / Math.log(base);\n}\n/** @private */\nexport function showTooltip(text, x, y, areaWidth, id, element, isTouch) {\n //let id1: string = 'EJ2_legend_tooltip';\n var tooltip = document.getElementById(id);\n var width = measureText(text, {\n fontFamily: 'Segoe UI', size: '12px',\n fontStyle: 'Normal', fontWeight: 'Regular'\n }).width + 5;\n x = (x + width > areaWidth) ? x - width : x;\n if (!tooltip) {\n tooltip = createElement('div', {\n innerHTML: text,\n id: id,\n styles: 'top:' + (y + 15).toString() + 'px;left:' + (x + 15).toString() +\n 'px;background-color: rgb(255, 255, 255) !important; color:black !important; ' +\n 'position:absolute;border:1px solid rgb(112, 112, 112); padding-left : 3px; padding-right : 2px;' +\n 'padding-bottom : 2px; padding-top : 2px; font-size:12px; font-family: \"Segoe UI\"'\n });\n element.appendChild(tooltip);\n }\n else {\n tooltip.innerHTML = text;\n tooltip.style.top = (y + 15).toString() + 'px';\n tooltip.style.left = (x + 15).toString() + 'px';\n }\n if (isTouch) {\n setTimeout(function () { removeElement(id); }, 1500);\n }\n}\n/** @private */\nexport function inside(value, range) {\n return (value < range.max) && (value > range.min);\n}\n/** @private */\nexport function withIn(value, range) {\n return (value <= range.max) && (value >= range.min);\n}\n/** @private */\nexport function logWithIn(value, axis) {\n if (axis.valueType === 'Logarithmic') {\n value = logBase(value, axis.logBase);\n }\n else {\n value = value;\n }\n return value;\n}\n/** @private */\nexport function withInRange(previousPoint, currentPoint, nextPoint, series) {\n var mX2 = logWithIn(currentPoint.xValue, series.xAxis);\n var mX1 = previousPoint ? logWithIn(previousPoint.xValue, series.xAxis) : mX2;\n var mX3 = nextPoint ? logWithIn(nextPoint.xValue, series.xAxis) : mX2;\n var xStart = Math.floor(series.xAxis.visibleRange.min);\n var xEnd = Math.ceil(series.xAxis.visibleRange.max);\n return ((mX1 >= xStart && mX1 <= xEnd) || (mX2 >= xStart && mX2 <= xEnd) ||\n (mX3 >= xStart && mX3 <= xEnd) || (xStart >= mX1 && xStart <= mX3));\n}\n/** @private */\nexport function sum(values) {\n var sum = 0;\n for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {\n var value = values_1[_i];\n sum += value;\n }\n return sum;\n}\n/** @private */\nexport function subArraySum(values, first, last, index, series) {\n var sum = 0;\n if (index !== null) {\n for (var i = (first + 1); i < last; i++) {\n if (index.indexOf(i) === -1) {\n sum += values[i][series.yName];\n }\n }\n }\n else {\n for (var i = (first + 1); i < last; i++) {\n if (!isNullOrUndefined(values[i][series.yName])) {\n sum += values[i][series.yName];\n }\n }\n }\n return sum;\n}\n/** @private */\nexport function subtractThickness(rect, thickness) {\n rect.x += thickness.left;\n rect.y += thickness.top;\n rect.width -= thickness.left + thickness.right;\n rect.height -= thickness.top + thickness.bottom;\n return rect;\n}\n/** @private */\nexport function subtractRect(rect, thickness) {\n rect.x += thickness.x;\n rect.y += thickness.y;\n rect.width -= thickness.x + thickness.width;\n rect.height -= thickness.y + thickness.height;\n return rect;\n}\n/** @private */\nexport function degreeToLocation(degree, radius, center) {\n var radian = (degree * Math.PI) / 180;\n return new ChartLocation(Math.cos(radian) * radius + center.x, Math.sin(radian) * radius + center.y);\n}\nfunction getAccumulationLegend(locX, locY, r, height, width, mode) {\n var cartesianlarge = degreeToLocation(270, r, new ChartLocation(locX, locY));\n var cartesiansmall = degreeToLocation(270, r, new ChartLocation(locX + (width / 10), locY));\n return 'M' + ' ' + locX + ' ' + locY + ' ' + 'L' + ' ' + (locX + r) + ' ' + (locY) + ' ' + 'A' + ' ' + (r) + ' ' + (r) +\n ' ' + 0 + ' ' + 1 + ' ' + 1 + ' ' + cartesianlarge.x + ' ' + cartesianlarge.y + ' ' + 'Z' + ' ' + 'M' + ' ' + (locX +\n (width / 10)) + ' ' + (locY - (height / 10)) + ' ' + 'L' + (locX + (r)) + ' ' + (locY - height / 10) + ' ' + 'A' + ' '\n + (r) + ' ' + (r) + ' ' + 0 + ' ' + 0 + ' ' + 0 + ' ' + cartesiansmall.x + ' ' + cartesiansmall.y + ' ' + 'Z';\n}\n/** @private */\nexport function getAngle(center, point) {\n var angle = Math.atan2((point.y - center.y), (point.x - center.x));\n angle = angle < 0 ? (6.283 + angle) : angle;\n return angle * (180 / Math.PI);\n}\n/** @private */\nexport function subArray(values, index) {\n var subArray = [];\n for (var i = 0; i <= index - 1; i++) {\n subArray.push(values[i]);\n }\n return subArray;\n}\n/** @private */\nexport function valueToCoefficient(value, axis) {\n var range = axis.visibleRange;\n var result = (value - range.min) / (range.delta);\n return axis.isInversed ? (1 - result) : result;\n}\n/** @private */\nexport function TransformToVisible(x, y, xAxis, yAxis, isInverted, series) {\n x = (xAxis.valueType === 'Logarithmic' ? logBase(x > 1 ? x : 1, xAxis.logBase) : x);\n y = (yAxis.valueType === 'Logarithmic' ?\n logBase(y > 1 ? y : 1, yAxis.logBase) : y);\n x += xAxis.valueType === 'Category' && xAxis.labelPlacement === 'BetweenTicks' && series.type !== 'Radar' ? 0.5 : 0;\n var radius = series.chart.radius * valueToCoefficient(y, yAxis);\n var point = CoefficientToVector(valueToPolarCoefficient(x, xAxis), series.chart.primaryXAxis.startAngle);\n return {\n x: (series.clipRect.width / 2 + series.clipRect.x) + radius * point.x,\n y: (series.clipRect.height / 2 + series.clipRect.y) + radius * point.y\n };\n}\n/**\n * method to find series, point index by element id\n * @private\n */\nexport function indexFinder(id, isPoint) {\n if (isPoint === void 0) { isPoint = false; }\n var ids = ['NaN', 'NaN'];\n if (id.indexOf('_Point_') > -1) {\n ids = id.split('_Series_')[1].split('_Point_');\n }\n else if (id.indexOf('_shape_') > -1 && (!isPoint || (isPoint && id.indexOf('_legend_') === -1))) {\n ids = id.split('_shape_');\n ids[0] = '0';\n }\n else if (id.indexOf('_text_') > -1 && (!isPoint || (isPoint && id.indexOf('_legend_') === -1))) {\n ids = id.split('_text_');\n ids[0] = '0';\n }\n return new Index(parseInt(ids[0], 10), parseInt(ids[1], 10));\n}\n/** @private */\nexport function CoefficientToVector(coefficient, startAngle) {\n startAngle = startAngle < 0 ? startAngle + 360 : startAngle;\n var angle = Math.PI * (1.5 - 2 * coefficient);\n angle = angle + (startAngle * Math.PI) / 180;\n return { x: Math.cos(angle), y: Math.sin(angle) };\n}\n/** @private */\nexport function valueToPolarCoefficient(value, axis) {\n var range = axis.visibleRange;\n var delta;\n var length;\n if (axis.valueType !== 'Category') {\n delta = (range.max - (axis.valueType === 'DateTime' ? axis.dateTimeInterval : range.interval)) - range.min;\n length = axis.visibleLabels.length - 1;\n delta = delta === 0 ? 1 : delta;\n }\n else {\n delta = range.delta;\n length = axis.visibleLabels.length;\n }\n return axis.isInversed ? ((value - range.min) / delta) * (1 - 1 / (length)) :\n 1 - ((value - range.min) / delta) * (1 - 1 / (length));\n}\n/** @private */\nvar Mean = /** @class */ (function () {\n function Mean(verticalStandardMean, verticalSquareRoot, horizontalStandardMean, horizontalSquareRoot, verticalMean, horizontalMean) {\n this.verticalStandardMean = verticalStandardMean;\n this.horizontalStandardMean = horizontalStandardMean;\n this.verticalSquareRoot = verticalSquareRoot;\n this.horizontalSquareRoot = horizontalSquareRoot;\n this.verticalMean = verticalMean;\n this.horizontalMean = horizontalMean;\n }\n return Mean;\n}());\nexport { Mean };\n/** @private */\nvar PolarArc = /** @class */ (function () {\n function PolarArc(startAngle, endAngle, innerRadius, radius, currentXPosition) {\n this.startAngle = startAngle;\n this.endAngle = endAngle;\n this.innerRadius = innerRadius;\n this.radius = radius;\n this.currentXPosition = currentXPosition;\n }\n return PolarArc;\n}());\nexport { PolarArc };\n/** @private */\nexport function createTooltip(id, text, top, left, fontSize) {\n var tooltip = getElement(id);\n var style = 'top:' + top.toString() + 'px;' +\n 'left:' + left.toString() + 'px;' +\n 'color:black !important; ' +\n 'background:#FFFFFF !important; ' +\n 'position:absolute;border:1px solid #707070;font-size:' + fontSize + ';border-radius:2px;';\n if (!tooltip) {\n tooltip = createElement('div', {\n id: id, innerHTML: ' ' + text + ' ', styles: style\n });\n document.body.appendChild(tooltip);\n }\n else {\n tooltip.setAttribute('innerHTML', ' ' + text + ' ');\n tooltip.setAttribute('styles', style);\n }\n}\n/** @private */\nexport function createZoomingLabels(chart, axis, parent, index, isVertical, rect) {\n var margin = 5;\n var opposedPosition = axis.opposedPosition;\n var anchor = isVertical ? 'start' : 'auto';\n var size;\n var chartRect = chart.availableSize.width;\n var x;\n var y;\n var rx = 3;\n var arrowLocation;\n var direction;\n var scrollBarHeight = axis.zoomingScrollBar && axis.zoomingScrollBar.svgObject ? axis.scrollBarHeight : 0;\n for (var i = 0; i < 2; i++) {\n size = measureText(i ? axis.endLabel : axis.startLabel, axis.labelStyle);\n if (isVertical) {\n arrowLocation = i ? new ChartLocation(rect.x - scrollBarHeight, rect.y + rx) :\n new ChartLocation(axis.rect.x - scrollBarHeight, (rect.y + rect.height - rx));\n x = (rect.x + (opposedPosition ? (rect.width + margin + scrollBarHeight) : -(size.width + margin + margin + scrollBarHeight)));\n y = (rect.y + (i ? 0 : rect.height - size.height - margin));\n x += (x < 0 || ((chartRect) < (x + size.width + margin))) ? (opposedPosition ? -(size.width / 2) : size.width / 2) : 0;\n direction = findDirection(rx, rx, new Rect(x, y, size.width + margin, size.height + margin), arrowLocation, margin, false, false, !opposedPosition, arrowLocation.x, arrowLocation.y + (i ? -rx : rx));\n }\n else {\n arrowLocation = i ? new ChartLocation((rect.x + rect.width - rx), (rect.y + rect.height + scrollBarHeight)) :\n new ChartLocation(rect.x + rx, (rect.y + rect.height + scrollBarHeight));\n x = (rect.x + (i ? (rect.width - size.width - margin) : 0));\n y = (opposedPosition ? (rect.y - size.height - 10 - scrollBarHeight) : (rect.y + rect.height + margin + scrollBarHeight));\n direction = findDirection(rx, rx, new Rect(x, y, size.width + margin, size.height + margin), arrowLocation, margin, opposedPosition, !opposedPosition, false, arrowLocation.x + (i ? rx : -rx), arrowLocation.y);\n }\n x = x + (margin / 2);\n y = y + (3 * (size.height / 4)) + (margin / 2);\n parent.appendChild(chart.renderer.drawPath(new PathOption(chart.element.id + '_Zoom_' + index + '_AxisLabel_Shape_' + i, chart.themeStyle.crosshairFill, 2, chart.themeStyle.crosshairFill, 1, null, direction)));\n textElement(new TextOption(chart.element.id + '_Zoom_' + index + '_AxisLabel_' + i, x, y, anchor, i ? axis.endLabel : axis.startLabel), { color: chart.themeStyle.crosshairLabel, fontFamily: 'Segoe UI', fontWeight: 'Regular', size: '11px' }, chart.themeStyle.crosshairLabel, parent);\n }\n return parent;\n}\n//Within bounds\n/** @private */\nexport function withInBounds(x, y, bounds, width, height) {\n if (width === void 0) { width = 0; }\n if (height === void 0) { height = 0; }\n return (x >= bounds.x - width && x <= bounds.x + bounds.width + width && y >= bounds.y - height\n && y <= bounds.y + bounds.height + height);\n}\n/** @private */\nexport function getValueXByPoint(value, size, axis) {\n var actualValue = !axis.isInversed ? value / size : (1 - (value / size));\n return actualValue * (axis.visibleRange.delta) + axis.visibleRange.min;\n}\n/** @private */\nexport function getValueYByPoint(value, size, axis) {\n var actualValue = axis.isInversed ? value / size : (1 - (value / size));\n return actualValue * (axis.visibleRange.delta) + axis.visibleRange.min;\n}\n/** @private */\nexport function findClipRect(series) {\n var rect = series.clipRect;\n if (series.chart.requireInvertedAxis) {\n rect.x = series.yAxis.rect.x;\n rect.y = series.xAxis.rect.y;\n rect.width = series.yAxis.rect.width;\n rect.height = series.xAxis.rect.height;\n }\n else {\n rect.x = series.xAxis.rect.x;\n rect.y = series.yAxis.rect.y;\n rect.width = series.xAxis.rect.width;\n rect.height = series.yAxis.rect.height;\n }\n}\n/** @private */\nexport function firstToLowerCase(str) {\n return str.substr(0, 1).toLowerCase() + str.substr(1);\n}\n/** @private */\nexport function getMinPointsDelta(axis, seriesCollection) {\n var minDelta = Number.MAX_VALUE;\n var xValues;\n var minVal;\n seriesCollection.forEach(function (series, index) {\n xValues = [];\n if (series.visible &&\n (axis.name === series.xAxisName || (axis.name === 'primaryXAxis' && series.xAxisName === null)\n || (axis.name === series.chart.primaryXAxis.name && !series.xAxisName))) {\n xValues = series.points.map(function (point, index) {\n return point.xValue;\n });\n xValues.sort(function (first, second) { return first - second; });\n if (xValues.length === 1) {\n minVal = xValues[0] - ((!isNullOrUndefined(series.xMin) && series.xAxis.valueType !== 'DateTime') ?\n series.xMin : axis.visibleRange.min);\n if (minVal !== 0) {\n minDelta = Math.min(minDelta, minVal);\n }\n }\n else {\n xValues.forEach(function (value, index, xValues) {\n if (index > 0 && value) {\n minVal = value - xValues[index - 1];\n if (minVal !== 0) {\n minDelta = Math.min(minDelta, minVal);\n }\n }\n });\n }\n }\n });\n if (minDelta === Number.MAX_VALUE) {\n minDelta = 1;\n }\n return minDelta;\n}\n/** @private */\nexport function getAnimationFunction(effect) {\n var functionName;\n switch (effect) {\n case 'Linear':\n functionName = linear;\n break;\n }\n return functionName;\n}\n/**\n * Animation Effect Calculation Started Here\n * @param currentTime\n * @param startValue\n * @param endValue\n * @param duration\n * @private\n */\nexport function linear(currentTime, startValue, endValue, duration) {\n return -endValue * Math.cos(currentTime / duration * (Math.PI / 2)) + endValue + startValue;\n}\n/**\n * Animation Effect Calculation End\n * @private\n */\nexport function markerAnimate(element, delay, duration, series, pointIndex, point, isLabel) {\n var centerX = point.x;\n var centerY = point.y;\n var height = 0;\n element.style.visibility = 'hidden';\n new Animation({}).animate(element, {\n duration: duration,\n delay: delay,\n progress: function (args) {\n if (args.timeStamp > args.delay) {\n args.element.style.visibility = 'visible';\n height = ((args.timeStamp - args.delay) / args.duration);\n element.setAttribute('transform', 'translate(' + centerX\n + ' ' + centerY + ') scale(' + height + ') translate(' + (-centerX) + ' ' + (-centerY) + ')');\n }\n },\n end: function (model) {\n element.style.visibility = '';\n element.removeAttribute('transform');\n if ((series.type === 'Scatter' || series.type === 'Bubble') && !isLabel && (pointIndex === series.points.length - 1)) {\n series.chart.trigger('animationComplete', { series: series });\n }\n }\n });\n}\n/**\n * Triggers the event.\n * @return {void}\n * @private\n */\nexport function triggerLabelRender(chart, tempInterval, text, labelStyle, axis) {\n var argsData;\n argsData = {\n cancel: false, name: axisLabelRender, axis: axis,\n text: text, value: tempInterval, labelStyle: labelStyle\n };\n chart.trigger(axisLabelRender, argsData);\n if (!argsData.cancel) {\n axis.visibleLabels.push(new VisibleLabels(argsData.text, argsData.value, argsData.labelStyle));\n }\n}\n/**\n * The function used to find whether the range is set.\n * @return {boolean}\n * @private\n */\nexport function setRange(axis) {\n return (axis.minimum != null && axis.maximum != null);\n}\n/**\n * Calculate desired interval for the axis.\n * @return {void}\n * @private\n */\nexport function getActualDesiredIntervalsCount(availableSize, axis) {\n var size = axis.orientation === 'Horizontal' ? availableSize.width : availableSize.height;\n if (isNullOrUndefined(axis.desiredIntervals)) {\n var desiredIntervalsCount = (axis.orientation === 'Horizontal' ? 0.533 : 1) * axis.maximumLabels;\n desiredIntervalsCount = Math.max((size * (desiredIntervalsCount / 100)), 1);\n return desiredIntervalsCount;\n }\n else {\n return axis.desiredIntervals;\n }\n}\n/**\n * Animation for template\n * @private\n */\nexport function templateAnimate(element, delay, duration, name, isRemove) {\n new Animation({}).animate(element, {\n duration: duration,\n delay: delay,\n name: name,\n progress: function (args) {\n args.element.style.visibility = 'visible';\n },\n end: function (args) {\n if (isRemove) {\n remove(args.element);\n }\n else {\n args.element.style.visibility = 'visible';\n }\n },\n });\n}\n/** @private */\nexport function drawSymbol(location, shape, size, url, options, label) {\n var functionName = 'Path';\n var renderer = new SvgRenderer('');\n var temp = calculateShapes(location, size, shape, options, url);\n var htmlObject = renderer['draw' + temp.functionName](temp.renderOption);\n htmlObject.setAttribute('aria-label', label);\n return htmlObject;\n}\n/** @private */\nexport function calculateShapes(location, size, shape, options, url) {\n var path;\n var functionName = 'Path';\n var width = size.width;\n var height = size.height;\n var locX = location.x;\n var locY = location.y;\n var x = location.x + (-width / 2);\n var y = location.y + (-height / 2);\n switch (shape) {\n case 'Circle':\n case 'Bubble':\n functionName = 'Ellipse';\n merge(options, { 'rx': width / 2, 'ry': height / 2, 'cx': locX, 'cy': locY });\n break;\n case 'Cross':\n path = 'M' + ' ' + x + ' ' + locY + ' ' + 'L' + ' ' + (locX + (width / 2)) + ' ' + locY + ' ' +\n 'M' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + locX + ' ' +\n (locY + (-height / 2));\n merge(options, { 'd': path });\n break;\n case 'HorizontalLine':\n path = 'M' + ' ' + x + ' ' + locY + ' ' + 'L' + ' ' + (locX + (width / 2)) + ' ' + locY;\n merge(options, { 'd': path });\n break;\n case 'VerticalLine':\n path = 'M' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + locX + ' ' + (locY + (-height / 2));\n merge(options, { 'd': path });\n break;\n case 'Diamond':\n path = 'M' + ' ' + x + ' ' + locY + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + locY + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + locY + ' z';\n merge(options, { 'd': path });\n break;\n case 'Rectangle':\n case 'Hilo':\n case 'HiloOpenClose':\n case 'Candle':\n case 'Waterfall':\n case 'BoxAndWhisker':\n case 'StepArea':\n path = 'M' + ' ' + x + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (-height / 2)) + ' z';\n merge(options, { 'd': path });\n break;\n case 'Pyramid':\n case 'Triangle':\n path = 'M' + ' ' + x + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (height / 2)) + ' z';\n merge(options, { 'd': path });\n break;\n case 'Funnel':\n case 'InvertedTriangle':\n path = 'M' + ' ' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + (locX - (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' z';\n merge(options, { 'd': path });\n break;\n case 'Pentagon':\n var eq = 72;\n var xValue = void 0;\n var yValue = void 0;\n for (var i = 0; i <= 5; i++) {\n xValue = (width / 2) * Math.cos((Math.PI / 180) * (i * eq));\n yValue = (height / 2) * Math.sin((Math.PI / 180) * (i * eq));\n if (i === 0) {\n path = 'M' + ' ' + (locX + xValue) + ' ' + (locY + yValue) + ' ';\n }\n else {\n path = path.concat('L' + ' ' + (locX + xValue) + ' ' + (locY + yValue) + ' ');\n }\n }\n path = path.concat('Z');\n merge(options, { 'd': path });\n break;\n case 'Image':\n functionName = 'Image';\n merge(options, { 'href': url, 'height': height, 'width': width, x: x, y: y });\n break;\n }\n options = calculateLegendShapes(location, new Size(width, height), shape, options).renderOption;\n return { renderOption: options, functionName: functionName };\n}\n/** @private */\nexport function getRectLocation(startLocation, endLocation, outerRect) {\n var x;\n var y;\n x = (endLocation.x < outerRect.x) ? outerRect.x :\n (endLocation.x > (outerRect.x + outerRect.width)) ? outerRect.x + outerRect.width : endLocation.x;\n y = (endLocation.y < outerRect.y) ? outerRect.y :\n (endLocation.y > (outerRect.y + outerRect.height)) ? outerRect.y + outerRect.height : endLocation.y;\n return new Rect((x > startLocation.x ? startLocation.x : x), (y > startLocation.y ? startLocation.y : y), Math.abs(x - startLocation.x), Math.abs(y - startLocation.y));\n}\n/** @private */\nexport function minMax(value, min, max) {\n return value > max ? max : (value < min ? min : value);\n}\n/** @private */\nexport function getElement(id) {\n return document.getElementById(id);\n}\n/** @private */\nexport function getTemplateFunction(template) {\n var templateFn = null;\n var e;\n try {\n if (document.querySelectorAll(template).length) {\n templateFn = templateComplier(document.querySelector(template).innerHTML.trim());\n }\n }\n catch (e) {\n templateFn = templateComplier(template);\n }\n return templateFn;\n}\n/** @private */\nexport function createTemplate(childElement, pointIndex, content, chart, point, series) {\n var templateFn;\n var templateElement;\n templateFn = getTemplateFunction(content);\n try {\n if (templateFn && templateFn({ chart: chart, series: series, point: point }).length) {\n templateElement = templateFn({ chart: chart, series: series, point: point });\n var len = templateElement.length;\n for (var i = 0; i < len; i++) {\n childElement.appendChild(templateElement[0]);\n }\n }\n }\n catch (e) {\n return childElement;\n }\n return childElement;\n}\n/** @private */\nexport function getFontStyle(font) {\n var style = '';\n style = 'font-size:' + font.size +\n '; font-style:' + font.fontStyle + '; font-weight:' + font.fontWeight +\n '; font-family:' + font.fontFamily + ';opacity:' + font.opacity +\n '; color:' + font.color + ';';\n return style;\n}\n/** @private */\nexport function measureElementRect(element) {\n var bounds;\n document.body.appendChild(element);\n bounds = element.getBoundingClientRect();\n removeElement(element.id);\n return bounds;\n}\n/** @private */\nexport function findlElement(elements, id) {\n var element;\n for (var i = 0, length_1 = elements.length; i < length_1; i++) {\n if (elements[i].id.indexOf(id) > -1) {\n element = elements[i];\n continue;\n }\n }\n return element;\n}\n/** @private */\nexport function getPoint(x, y, xAxis, yAxis, isInverted, series) {\n x = ((xAxis.valueType === 'Logarithmic') ? logBase(((x > 1) ? x : 1), xAxis.logBase) : x);\n y = ((yAxis.valueType === 'Logarithmic') ? logBase(((y > 1) ? y : 1), yAxis.logBase) : y);\n x = valueToCoefficient(x, xAxis);\n y = valueToCoefficient(y, yAxis);\n var xLength = (isInverted ? xAxis.rect.height : xAxis.rect.width);\n var yLength = (isInverted ? yAxis.rect.width : yAxis.rect.height);\n var locationX = isInverted ? y * (yLength) : x * (xLength);\n var locationY = isInverted ? (1 - x) * (xLength) : (1 - y) * (yLength);\n return new ChartLocation(locationX, locationY);\n}\n/** @private */\nexport function appendElement(child, parent) {\n if (child && child.hasChildNodes() && parent) {\n parent.appendChild(child);\n }\n else {\n return null;\n }\n}\n/** @private */\nexport function getDraggedRectLocation(x1, y1, x2, y2, outerRect) {\n var width = Math.abs(x1 - x2);\n var height = Math.abs(y1 - y2);\n var x = Math.max(checkBounds(Math.min(x1, x2), width, outerRect.x, outerRect.width), outerRect.x);\n var y = Math.max(checkBounds(Math.min(y1, y2), height, outerRect.y, outerRect.height), outerRect.y);\n return new Rect(x, y, Math.min(width, outerRect.width), Math.min(height, outerRect.height));\n}\n/** @private */\nexport function checkBounds(start, size, min, max) {\n if (start < min) {\n start = min;\n }\n else if ((start + size) > (max + min)) {\n start = (max + min) - size;\n }\n return start;\n}\n/** @private */\nexport function getLabelText(currentPoint, series, chart) {\n var labelFormat = series.yAxis.labelFormat;\n var text = [];\n var customLabelFormat = labelFormat.match('{value}') !== null;\n switch (series.seriesType) {\n case 'XY':\n text.push(currentPoint.text || currentPoint.yValue.toString());\n break;\n case 'HighLow':\n text.push(currentPoint.text || Math.max(currentPoint.high, currentPoint.low).toString());\n text.push(currentPoint.text || Math.min(currentPoint.high, currentPoint.low).toString());\n break;\n case 'HighLowOpenClose':\n text.push(currentPoint.text || Math.max(currentPoint.high, currentPoint.low).toString());\n text.push(currentPoint.text || Math.min(currentPoint.high, currentPoint.low).toString());\n text.push(currentPoint.text || Math.max(currentPoint.open, currentPoint.close).toString());\n text.push(currentPoint.text || Math.min(currentPoint.open, currentPoint.close).toString());\n break;\n case 'BoxPlot':\n text.push(currentPoint.text || currentPoint.median.toString());\n text.push(currentPoint.text || currentPoint.maximum.toString());\n text.push(currentPoint.text || currentPoint.minimum.toString());\n text.push(currentPoint.text || currentPoint.upperQuartile.toString());\n text.push(currentPoint.text || currentPoint.lowerQuartile.toString());\n for (var _i = 0, _a = currentPoint.outliers; _i < _a.length; _i++) {\n var liers = _a[_i];\n text.push(currentPoint.text || liers.toString());\n }\n break;\n }\n if (labelFormat && !currentPoint.text) {\n for (var i = 0; i < text.length; i++) {\n text[i] = customLabelFormat ? labelFormat.replace('{value}', series.yAxis.format(parseFloat(text[i]))) :\n series.yAxis.format(parseFloat(text[i]));\n }\n }\n return text;\n}\n/** @private */\nexport function stopTimer(timer) {\n window.clearInterval(timer);\n}\n/** @private */\nexport function isCollide(rect, collections, clipRect) {\n var isCollide;\n var currentRect = new Rect(rect.x + clipRect.x, rect.y + clipRect.y, rect.width, rect.height);\n isCollide = collections.some(function (rect) {\n return (currentRect.x < rect.x + rect.width && currentRect.x + currentRect.width > rect.x &&\n currentRect.y < rect.y + rect.height && currentRect.height + currentRect.y > rect.y);\n });\n return isCollide;\n}\n/** @private */\nexport function isOverlap(currentRect, rect) {\n return (currentRect.x < rect.x + rect.width && currentRect.x + currentRect.width > rect.x &&\n currentRect.y < rect.y + rect.height && currentRect.height + currentRect.y > rect.y);\n}\n/** @private */\nexport function containsRect(currentRect, rect) {\n return (currentRect.x <= rect.x && currentRect.x + currentRect.width >= rect.x + rect.width &&\n currentRect.y <= rect.y && currentRect.height + currentRect.y >= rect.y + rect.height);\n}\n/** @private */\nexport function calculateRect(location, textSize, margin) {\n return new Rect((location.x - (textSize.width / 2) - margin.left), (location.y - (textSize.height / 2) - margin.top), textSize.width + margin.left + margin.right, textSize.height + margin.top + margin.bottom);\n}\n/** @private */\nexport function convertToHexCode(value) {\n return '#' + componentToHex(value.r) + componentToHex(value.g) + componentToHex(value.b);\n}\n/** @private */\nexport function componentToHex(value) {\n var hex = value.toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n}\n/** @private */\nexport function convertHexToColor(hex) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result ? new ColorValue(parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)) :\n new ColorValue(255, 255, 255);\n}\n/** @private */\nexport function colorNameToHex(color) {\n var element;\n color = color === 'transparent' ? 'white' : color;\n element = document.getElementById('chartmeasuretext');\n element.style.color = color;\n color = window.getComputedStyle(element).color;\n var exp = /^(rgb|hsl)(a?)[(]\\s*([\\d.]+\\s*%?)\\s*,\\s*([\\d.]+\\s*%?)\\s*,\\s*([\\d.]+\\s*%?)\\s*(?:,\\s*([\\d.]+)\\s*)?[)]$/;\n var isRGBValue = exp.exec(color);\n return convertToHexCode(new ColorValue(parseInt(isRGBValue[3], 10), parseInt(isRGBValue[4], 10), parseInt(isRGBValue[5], 10)));\n}\n/** @private */\nexport function getSaturationColor(color, factor) {\n color = colorNameToHex(color);\n color = color.replace(/[^0-9a-f]/gi, '');\n if (color.length < 6) {\n color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\n }\n factor = factor || 0;\n // convert to decimal and change luminosity\n var rgb = '#';\n var colorCode;\n for (var i = 0; i < 3; i++) {\n colorCode = parseInt(color.substr(i * 2, 2), 16);\n colorCode = Math.round(Math.min(Math.max(0, colorCode + (colorCode * factor)), 255));\n rgb += ('00' + colorCode.toString(16)).substr(colorCode.toString(16).length);\n }\n return rgb;\n}\n/** @private */\nexport function getMedian(values) {\n var half = Math.floor(values.length / 2);\n return values.length % 2 ? values[half] : ((values[half - 1] + values[half]) / 2.0);\n}\n/** @private */\n// tslint:disable-next-line:max-func-body-length\nexport function calculateLegendShapes(location, size, shape, options) {\n var padding = 10;\n var path = '';\n var height = size.height;\n var width = size.width;\n var locX = location.x;\n var locY = location.y;\n switch (shape) {\n case 'MultiColoredLine':\n case 'Line':\n path = 'M' + ' ' + (locX + (-width / 2)) + ' ' + (locY) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY);\n merge(options, { 'd': path });\n break;\n case 'StepLine':\n options.fill = 'transparent';\n path = 'M' + ' ' + (locX + (-width / 2) - (padding / 4)) + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + (locX +\n (-width / 2) + (width / 10)) + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + (locX + (-width / 2) + (width / 10))\n + ' ' + (locY) + ' ' + 'L' + ' ' + (locX + (-width / 10)) + ' ' + (locY) + ' ' + 'L' + ' ' + (locX + (-width / 10))\n + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + (locX + (width / 5)) + ' ' + (locY + (height / 2)) + ' ' + 'L' +\n ' ' + (locX + (width / 5)) + ' ' + (locY + (-height / 2)) + ' ' + 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY +\n (-height / 2)) + 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' + 'L' + '' + (locX + (width / 2)\n + (padding / 4)) + ' ' + (locY + (height / 2));\n merge(options, { 'd': path });\n break;\n case 'RightArrow':\n var space = 2;\n path = 'M' + ' ' + (locX + (-width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY) + ' ' + 'L' + ' ' +\n (locX + (-width / 2)) + ' ' + (locY + (height / 2)) + ' L' + ' ' + (locX + (-width / 2)) + ' ' +\n (locY + (height / 2) - space) + ' ' + 'L' + ' ' + (locX + (width / 2) - (2 * space)) + ' ' + (locY) +\n ' L' + (locX + (-width / 2)) + ' ' + (locY - (height / 2) + space) + ' Z';\n merge(options, { 'd': path });\n break;\n case 'LeftArrow':\n options.fill = options.stroke;\n options.stroke = 'transparent';\n space = 2;\n path = 'M' + ' ' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + (locX + (-width / 2)) + ' ' + (locY) + ' ' + 'L' + ' ' +\n (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' +\n (locX + (width / 2)) + ' ' + (locY + (height / 2) - space) + ' L' + ' ' + (locX + (-width / 2) + (2 * space))\n + ' ' + (locY) + ' L' + (locX + (width / 2)) + ' ' + (locY - (height / 2) + space) + ' Z';\n merge(options, { 'd': path });\n break;\n case 'Column':\n case 'StackingColumn':\n case 'StackingColumn100':\n case 'RangeColumn':\n case 'Histogram':\n path = 'M' + ' ' + (locX - 3 * (width / 5)) + ' ' + (locY - (height / 5)) + ' ' + 'L' + ' ' +\n (locX + 3 * (-width / 10)) + ' ' + (locY - (height / 5)) + ' ' + 'L' + ' ' +\n (locX + 3 * (-width / 10)) + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + (locX - 3 *\n (width / 5)) + ' ' + (locY + (height / 2)) + ' ' + 'Z' + ' ' + 'M' + ' ' +\n (locX + (-width / 10) - (width / 20)) + ' ' + (locY - (height / 4) - (padding / 2))\n + ' ' + 'L' + ' ' + (locX + (width / 10) + (width / 20)) + ' ' + (locY - (height / 4) -\n (padding / 2)) + ' ' + 'L' + ' ' + (locX + (width / 10) + (width / 20)) + ' ' + (locY\n + (height / 2)) + ' ' + 'L' + ' ' + (locX + (-width / 10) - (width / 20)) + ' ' + (locY +\n (height / 2)) + ' ' + 'Z' + ' ' + 'M' + ' ' + (locX + 3 * (width / 10)) + ' ' + (locY) + ' ' +\n 'L' + ' ' + (locX + 3 * (width / 5)) + ' ' + (locY) + ' ' + 'L' + ' '\n + (locX + 3 * (width / 5)) + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' '\n + (locX + 3 * (width / 10)) + ' ' + (locY + (height / 2)) + ' ' + 'Z';\n merge(options, { 'd': path });\n break;\n case 'Bar':\n case 'StackingBar':\n case 'StackingBar100':\n path = 'M' + ' ' + (locX + (-width / 2) + (-padding / 4)) + ' ' + (locY - 3 * (height / 5)) + ' '\n + 'L' + ' ' + (locX + 3 * (width / 10)) + ' ' + (locY - 3 * (height / 5)) + ' ' + 'L' + ' ' +\n (locX + 3 * (width / 10)) + ' ' + (locY - 3 * (height / 10)) + ' ' + 'L' + ' ' +\n (locX - (width / 2) + (-padding / 4)) + ' ' + (locY - 3 * (height / 10)) + ' ' + 'Z' + ' '\n + 'M' + ' ' + (locX + (-width / 2) + (-padding / 4)) + ' ' + (locY - (height / 5)\n + (padding / 20)) + ' ' + 'L' + ' ' + (locX + (width / 2) + (padding / 4)) + ' ' + (locY\n - (height / 5) + (padding / 20)) + ' ' + 'L' + ' ' + (locX + (width / 2) + (padding / 4))\n + ' ' + (locY + (height / 10) + (padding / 20)) + ' ' + 'L' + ' ' + (locX - (width / 2)\n + (-padding / 4)) + ' ' + (locY + (height / 10) + (padding / 20)) + ' ' + 'Z' + ' ' + 'M'\n + ' ' + (locX - (width / 2) + (-padding / 4)) + ' ' + (locY + (height / 5)\n + (padding / 10)) + ' ' + 'L' + ' ' + (locX + (-width / 4)) + ' ' + (locY + (height / 5)\n + (padding / 10)) + ' ' + 'L' + ' ' + (locX + (-width / 4)) + ' ' + (locY + (height / 2)\n + (padding / 10)) + ' ' + 'L' + ' ' + (locX - (width / 2) + (-padding / 4))\n + ' ' + (locY + (height / 2) + (padding / 10)) + ' ' + 'Z';\n merge(options, { 'd': path });\n break;\n case 'Spline':\n options.fill = 'transparent';\n path = 'M' + ' ' + (locX - (width / 2)) + ' ' + (locY + (height / 5)) + ' ' + 'Q' + ' '\n + locX + ' ' + (locY - height) + ' ' + locX + ' ' + (locY + (height / 5))\n + ' ' + 'M' + ' ' + locX + ' ' + (locY + (height / 5)) + ' ' + 'Q' + ' ' + (locX\n + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' + (locX + (width / 2)) + ' '\n + (locY - (height / 2));\n merge(options, { 'd': path });\n break;\n case 'Area':\n case 'MultiColoredArea':\n case 'RangeArea':\n case 'StackingArea':\n case 'StackingArea100':\n path = 'M' + ' ' + (locX - (width / 2) - (padding / 4)) + ' ' + (locY + (height / 2))\n + ' ' + 'L' + ' ' + (locX + (-width / 4) + (-padding / 8)) + ' ' + (locY - (height / 2))\n + ' ' + 'L' + ' ' + (locX) + ' ' + (locY + (height / 4)) + ' ' + 'L' + ' ' + (locX\n + (width / 4) + (padding / 8)) + ' ' + (locY + (-height / 2) + (height / 4)) + ' '\n + 'L' + ' ' + (locX + (height / 2) + (padding / 4)) + ' ' + (locY + (height / 2)) + ' ' + 'Z';\n merge(options, { 'd': path });\n break;\n case 'SplineArea':\n path = 'M' + ' ' + (locX - (width / 2)) + ' ' + (locY + (height / 5)) + ' ' + 'Q' + ' ' + locX\n + ' ' + (locY - height) + ' ' + locX + ' ' + (locY + (height / 5)) + ' ' + 'Z' + ' ' + 'M'\n + ' ' + locX + ' ' + (locY + (height / 5)) + ' ' + 'Q' + ' ' + (locX + (width / 2)) + ' '\n + (locY + (height / 2)) + ' ' + (locX + (width / 2)) + ' '\n + (locY - (height / 2)) + ' ' + ' Z';\n merge(options, { 'd': path });\n break;\n case 'Pie':\n case 'Doughnut':\n options.stroke = 'transparent';\n var r = Math.min(height, width) / 2;\n path = getAccumulationLegend(locX, locY, r, height, width, shape);\n merge(options, { 'd': path });\n break;\n }\n return { renderOption: options };\n}\n/** @private */\nexport function textTrim(maxWidth, text, font) {\n var label = text;\n var size = measureText(text, font).width;\n if (size > maxWidth) {\n var textLength = text.length;\n for (var i = textLength - 1; i >= 0; --i) {\n label = text.substring(0, i) + '...';\n size = measureText(label, font).width;\n if (size <= maxWidth) {\n return label;\n }\n }\n }\n return label;\n}\n/** @private */\nexport function stringToNumber(value, containerSize) {\n if (value !== null && value !== undefined) {\n return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);\n }\n return null;\n}\n/** @private */\nexport function findDirection(rX, rY, rect, arrowLocation, arrowPadding, top, bottom, left, tipX, tipY, tipRadius) {\n var direction = '';\n var startX = rect.x;\n var startY = rect.y;\n var width = rect.x + rect.width;\n var height = rect.y + rect.height;\n tipRadius = tipRadius ? tipRadius : 0;\n if (top) {\n direction = direction.concat('M' + ' ' + (startX) + ' ' + (startY + rY) + ' Q ' + startX + ' '\n + startY + ' ' + (startX + rX) + ' ' + startY + ' ' +\n ' L' + ' ' + (width - rX) + ' ' + (startY) + ' Q ' + width + ' '\n + startY + ' ' + (width) + ' ' + (startY + rY));\n direction = direction.concat(' L' + ' ' + (width) + ' ' + (height - rY) + ' Q ' + width + ' '\n + (height) + ' ' + (width - rX) + ' ' + (height));\n if (arrowPadding !== 0) {\n direction = direction.concat(' L' + ' ' + (arrowLocation.x + arrowPadding / 2) + ' ' + (height));\n direction = direction.concat(' L' + ' ' + (tipX + tipRadius) + ' ' + (height + arrowPadding - tipRadius));\n direction += ' Q' + ' ' + (tipX) + ' ' + (height + arrowPadding) + ' ' + (tipX - tipRadius) +\n ' ' + (height + arrowPadding - tipRadius);\n }\n if ((arrowLocation.x - arrowPadding / 2) > startX) {\n direction = direction.concat(' L' + ' ' + (arrowLocation.x - arrowPadding / 2) + ' ' + height +\n ' L' + ' ' + (startX + rX) + ' ' + height + ' Q ' + startX + ' '\n + height + ' ' + (startX) + ' ' + (height - rY) + ' z');\n }\n else {\n if (arrowPadding === 0) {\n direction = direction.concat(' L' + ' ' + (startX + rX) + ' ' + height + ' Q ' + startX + ' '\n + height + ' ' + (startX) + ' ' + (height - rY) + ' z');\n }\n else {\n direction = direction.concat(' L' + ' ' + (startX) + ' ' + (height + rY) + ' z');\n }\n }\n }\n else if (bottom) {\n direction = direction.concat('M' + ' ' + (startX) + ' ' + (startY + rY) + ' Q ' + startX + ' '\n + (startY) + ' ' + (startX + rX) + ' ' + (startY) + ' L' + ' ' + (arrowLocation.x - arrowPadding / 2) + ' ' + (startY));\n direction = direction.concat(' L' + ' ' + (tipX - tipRadius) + ' ' + (arrowLocation.y + tipRadius));\n direction += ' Q' + ' ' + (tipX) + ' ' + (arrowLocation.y) + ' ' + (tipX + tipRadius) + ' ' + (arrowLocation.y + tipRadius);\n direction = direction.concat(' L' + ' ' + (arrowLocation.x + arrowPadding / 2) + ' ' + (startY) + ' L' + ' '\n + (width - rX) + ' ' + (startY) + ' Q ' + (width) + ' ' + (startY) + ' ' + (width) + ' ' + (startY + rY));\n direction = direction.concat(' L' + ' ' + (width) + ' ' + (height - rY) + ' Q ' + (width) + ' '\n + (height) + ' ' + (width - rX) + ' ' + (height) +\n ' L' + ' ' + (startX + rX) + ' ' + (height) + ' Q ' + (startX) + ' '\n + (height) + ' ' + (startX) + ' ' + (height - rY) + ' z');\n }\n else if (left) {\n direction = direction.concat('M' + ' ' + (startX) + ' ' + (startY + rY) + ' Q ' + startX + ' '\n + (startY) + ' ' + (startX + rX) + ' ' + (startY));\n direction = direction.concat(' L' + ' ' + (width - rX) + ' ' + (startY) + ' Q ' + (width) + ' '\n + (startY) + ' ' + (width) + ' ' + (startY + rY) + ' L' + ' ' + (width) + ' ' + (arrowLocation.y - arrowPadding / 2));\n direction = direction.concat(' L' + ' ' + (width + arrowPadding - tipRadius) + ' ' + (tipY - tipRadius));\n direction += ' Q ' + (width + arrowPadding) + ' ' + (tipY) + ' ' + (width + arrowPadding - tipRadius) + ' ' + (tipY + tipRadius);\n direction = direction.concat(' L' + ' ' + (width) + ' ' + (arrowLocation.y + arrowPadding / 2) +\n ' L' + ' ' + (width) + ' ' + (height - rY) + ' Q ' + width + ' ' + (height) + ' ' + (width - rX) + ' ' + (height));\n direction = direction.concat(' L' + ' ' + (startX + rX) + ' ' + (height) + ' Q ' + startX + ' '\n + (height) + ' ' + (startX) + ' ' + (height - rY) + ' z');\n }\n else {\n direction = direction.concat('M' + ' ' + (startX + rX) + ' ' + (startY) + ' Q ' + (startX) + ' '\n + (startY) + ' ' + (startX) + ' ' + (startY + rY) + ' L' + ' ' + (startX) + ' ' + (arrowLocation.y - arrowPadding / 2));\n direction = direction.concat(' L' + ' ' + (startX - arrowPadding + tipRadius) + ' ' + (tipY - tipRadius));\n direction += ' Q ' + (startX - arrowPadding) + ' ' + (tipY) + ' ' + (startX - arrowPadding + tipRadius) + ' ' + (tipY + tipRadius);\n direction = direction.concat(' L' + ' ' + (startX) + ' ' + (arrowLocation.y + arrowPadding / 2) +\n ' L' + ' ' + (startX) + ' ' + (height - rY) + ' Q ' + startX + ' '\n + (height) + ' ' + (startX + rX) + ' ' + (height));\n direction = direction.concat(' L' + ' ' + (width - rX) + ' ' + (height) + ' Q ' + width + ' '\n + (height) + ' ' + (width) + ' ' + (height - rY) +\n ' L' + ' ' + (width) + ' ' + (startY + rY) + ' Q ' + width + ' '\n + (startY) + ' ' + (width - rX) + ' ' + (startY) + ' z');\n }\n return direction;\n}\n/** @private */\nexport function textElement(options, font, color, parent, isMinus) {\n if (isMinus === void 0) { isMinus = false; }\n var renderOptions = {};\n var htmlObject;\n var tspanElement;\n var renderer = new SvgRenderer('');\n var text;\n var height;\n renderOptions = {\n 'id': options.id,\n 'x': options.x,\n 'y': options.y,\n 'fill': color,\n 'font-size': font.size,\n 'font-style': font.fontStyle,\n 'font-family': font.fontFamily,\n 'font-weight': font.fontWeight,\n 'text-anchor': options.anchor,\n 'transform': options.transform,\n 'opacity': font.opacity,\n 'dominant-baseline': options.baseLine\n };\n text = typeof options.text === 'string' ? options.text : isMinus ? options.text[options.text.length - 1] : options.text[0];\n htmlObject = renderer.createText(renderOptions, text);\n if (typeof options.text !== 'string' && options.text.length > 1) {\n for (var i = 1, len = options.text.length; i < len; i++) {\n height = (measureText(options.text[i], font).height);\n tspanElement = renderer.createTSpan({\n 'x': options.x, 'id': options.id,\n 'y': (options.y) + ((isMinus) ? -(i * height) : (i * height))\n }, isMinus ? options.text[options.text.length - (i + 1)] : options.text[i]);\n htmlObject.appendChild(tspanElement);\n }\n }\n parent.appendChild(htmlObject);\n return htmlObject;\n}\n/**\n * Method to calculate the width and height of the chart\n */\nexport function calculateSize(chart) {\n var containerWidth = chart.element.clientWidth;\n var containerHeight = chart.element.clientHeight;\n var height = 450;\n var marginHeight;\n if (chart.getModuleName() === 'rangeNavigator') {\n var range = chart;\n var tooltipSpace = range.tooltip.enable ? 35 : 0;\n var periodHeight = range.periodSelectorSettings.periods.length ?\n range.periodSelectorSettings.height : 0;\n marginHeight = range.margin.top + range.margin.bottom + tooltipSpace;\n var labelSize = measureText('tempString', range.labelStyle).height;\n var labelPadding = 15;\n height = (chart.series.length ? (Browser.isDevice ? 80 : 120) : ((range.enableGrouping ? (40 + labelPadding + labelSize) : 40)\n + marginHeight)) + periodHeight;\n if (range.disableRangeSelector) {\n height = periodHeight;\n }\n }\n chart.availableSize = new Size(stringToNumber(chart.width, containerWidth) || containerWidth || 600, stringToNumber(chart.height, containerHeight) || containerHeight || height);\n}\nexport function createSvg(chart) {\n chart.renderer = new SvgRenderer(chart.element.id);\n calculateSize(chart);\n chart.svgObject = chart.renderer.createSvg({\n id: chart.element.id + '_svg',\n width: chart.availableSize.width,\n height: chart.availableSize.height\n });\n}\n/**\n * To calculate chart title and height\n * @param title\n * @param style\n * @param width\n */\nexport function getTitle(title, style, width) {\n var titleCollection = [];\n switch (style.textOverflow) {\n case 'Wrap':\n titleCollection = textWrap(title, width, style);\n break;\n case 'Trim':\n titleCollection.push(textTrim(width, title, style));\n break;\n default:\n titleCollection.push(title);\n break;\n }\n return titleCollection;\n}\n/**\n * Method to calculate x position of title\n */\nexport function titlePositionX(chartSize, leftPadding, rightPadding, titleStyle) {\n var positionX;\n if (titleStyle.textAlignment === 'Near') {\n positionX = leftPadding;\n }\n else if (titleStyle.textAlignment === 'Center') {\n positionX = chartSize.width / 2;\n }\n else {\n positionX = chartSize.width - rightPadding;\n }\n return positionX;\n}\n/**\n * Method to find new text and element size based on textOverflow\n */\nexport function textWrap(currentLabel, maximumWidth, font) {\n var textCollection = currentLabel.split(' ');\n var label = '';\n var labelCollection = [];\n var text;\n for (var i = 0, len = textCollection.length; i < len; i++) {\n text = textCollection[i];\n if (measureText(label.concat(text), font).width < maximumWidth) {\n label = label.concat((label === '' ? '' : ' ') + text);\n }\n else {\n if (label !== '') {\n labelCollection.push(textTrim(maximumWidth, label, font));\n label = text;\n }\n else {\n labelCollection.push(textTrim(maximumWidth, text, font));\n text = '';\n }\n }\n if (label && i === len - 1) {\n labelCollection.push(textTrim(maximumWidth, label, font));\n }\n }\n return labelCollection;\n}\n/** @private */\nvar CustomizeOption = /** @class */ (function () {\n function CustomizeOption(id) {\n this.id = id;\n }\n return CustomizeOption;\n}());\nexport { CustomizeOption };\n/** @private */\nvar StackValues = /** @class */ (function () {\n function StackValues(startValue, endValue) {\n this.startValues = startValue;\n this.endValues = endValue;\n }\n return StackValues;\n}());\nexport { StackValues };\n/** @private */\nvar TextOption = /** @class */ (function (_super) {\n __extends(TextOption, _super);\n function TextOption(id, x, y, anchor, text, transform, baseLine) {\n if (transform === void 0) { transform = ''; }\n var _this = _super.call(this, id) || this;\n _this.transform = '';\n _this.baseLine = 'auto';\n _this.x = x;\n _this.y = y;\n _this.anchor = anchor;\n _this.text = text;\n _this.transform = transform;\n _this.baseLine = baseLine;\n return _this;\n }\n return TextOption;\n}(CustomizeOption));\nexport { TextOption };\n/** @private */\nvar PathOption = /** @class */ (function (_super) {\n __extends(PathOption, _super);\n function PathOption(id, fill, width, color, opacity, dashArray, d) {\n var _this = _super.call(this, id) || this;\n _this.opacity = opacity;\n _this.fill = fill;\n _this.stroke = color;\n _this['stroke-width'] = width;\n _this['stroke-dasharray'] = dashArray;\n _this.d = d;\n return _this;\n }\n return PathOption;\n}(CustomizeOption));\nexport { PathOption };\n/** @private */\nvar RectOption = /** @class */ (function (_super) {\n __extends(RectOption, _super);\n function RectOption(id, fill, border, opacity, rect, rx, ry, transform, dashArray) {\n var _this = _super.call(this, id, fill, border.width, border.color, opacity, dashArray) || this;\n _this.y = rect.y;\n _this.x = rect.x;\n _this.height = rect.height;\n _this.width = rect.width;\n _this.rx = rx ? rx : 0;\n _this.ry = ry ? ry : 0;\n _this.transform = transform ? transform : '';\n return _this;\n }\n return RectOption;\n}(PathOption));\nexport { RectOption };\n/** @private */\nvar CircleOption = /** @class */ (function (_super) {\n __extends(CircleOption, _super);\n function CircleOption(id, fill, border, opacity, cx, cy, r) {\n var _this = _super.call(this, id, fill, border.width, border.color, opacity) || this;\n _this.cy = cy;\n _this.cx = cx;\n _this.r = r;\n return _this;\n }\n return CircleOption;\n}(PathOption));\nexport { CircleOption };\n/** @private */\nvar PolygonOption = /** @class */ (function () {\n function PolygonOption(id, points, fill) {\n this.id = id;\n this.points = points;\n this.fill = fill;\n }\n return PolygonOption;\n}());\nexport { PolygonOption };\n/** @private */\nvar Size = /** @class */ (function () {\n function Size(width, height) {\n this.width = width;\n this.height = height;\n }\n return Size;\n}());\nexport { Size };\n/** @private */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n return Rect;\n}());\nexport { Rect };\n/** @private */\nvar ChartLocation = /** @class */ (function () {\n function ChartLocation(x, y) {\n this.x = x;\n this.y = y;\n }\n return ChartLocation;\n}());\nexport { ChartLocation };\n/** @private */\nvar Thickness = /** @class */ (function () {\n function Thickness(left, right, top, bottom) {\n this.left = left;\n this.right = right;\n this.top = top;\n this.bottom = bottom;\n }\n return Thickness;\n}());\nexport { Thickness };\n/** @private */\nvar ColorValue = /** @class */ (function () {\n function ColorValue(r, g, b) {\n this.r = r;\n this.g = g;\n this.b = b;\n }\n return ColorValue;\n}());\nexport { ColorValue };\n/** @private */\nvar PointData = /** @class */ (function () {\n function PointData(point, series, index) {\n if (index === void 0) { index = 0; }\n this.point = point;\n this.series = series;\n this.lierIndex = index;\n }\n return PointData;\n}());\nexport { PointData };\n/** @private */\nvar AccPointData = /** @class */ (function () {\n function AccPointData(point, series, index) {\n if (index === void 0) { index = 0; }\n this.point = point;\n this.series = series;\n }\n return AccPointData;\n}());\nexport { AccPointData };\n/** @private */\nvar ControlPoints = /** @class */ (function () {\n function ControlPoints(controlPoint1, controlPoint2) {\n this.controlPoint1 = controlPoint1;\n this.controlPoint2 = controlPoint2;\n }\n return ControlPoints;\n}());\nexport { ControlPoints };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n/**\n * AccumulationChart base file\n */\nimport { Property, ChildProperty, Complex, createElement } from '@syncfusion/ej2-base';\nimport { isNullOrUndefined, getValue } from '@syncfusion/ej2-base';\nimport { Border, Font, Animation, EmptyPointSettings, Connector } from '../../common/model/base';\nimport { Rect, stringToNumber, PathOption } from '../../common/utils/helper';\nimport { seriesRender, pointRender } from '../../common/model/constants';\nimport { getSeriesColor } from '../../common/model/theme';\nimport { getElement, firstToLowerCase } from '../../common/utils/helper';\n/**\n * Annotation for accumulation series\n */\nvar AccumulationAnnotationSettings = /** @class */ (function (_super) {\n __extends(AccumulationAnnotationSettings, _super);\n function AccumulationAnnotationSettings() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property(null)\n ], AccumulationAnnotationSettings.prototype, \"content\", void 0);\n __decorate([\n Property('0')\n ], AccumulationAnnotationSettings.prototype, \"x\", void 0);\n __decorate([\n Property('0')\n ], AccumulationAnnotationSettings.prototype, \"y\", void 0);\n __decorate([\n Property('Pixel')\n ], AccumulationAnnotationSettings.prototype, \"coordinateUnits\", void 0);\n __decorate([\n Property('Chart')\n ], AccumulationAnnotationSettings.prototype, \"region\", void 0);\n __decorate([\n Property('Middle')\n ], AccumulationAnnotationSettings.prototype, \"verticalAlignment\", void 0);\n __decorate([\n Property('Center')\n ], AccumulationAnnotationSettings.prototype, \"horizontalAlignment\", void 0);\n __decorate([\n Property(null)\n ], AccumulationAnnotationSettings.prototype, \"description\", void 0);\n return AccumulationAnnotationSettings;\n}(ChildProperty));\nexport { AccumulationAnnotationSettings };\n/**\n * Configures the dataLabel in accumulation chart.\n */\nvar AccumulationDataLabelSettings = /** @class */ (function (_super) {\n __extends(AccumulationDataLabelSettings, _super);\n function AccumulationDataLabelSettings() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property(false)\n ], AccumulationDataLabelSettings.prototype, \"visible\", void 0);\n __decorate([\n Property(null)\n ], AccumulationDataLabelSettings.prototype, \"name\", void 0);\n __decorate([\n Property('transparent')\n ], AccumulationDataLabelSettings.prototype, \"fill\", void 0);\n __decorate([\n Property('Inside')\n ], AccumulationDataLabelSettings.prototype, \"position\", void 0);\n __decorate([\n Property(5)\n ], AccumulationDataLabelSettings.prototype, \"rx\", void 0);\n __decorate([\n Property(5)\n ], AccumulationDataLabelSettings.prototype, \"ry\", void 0);\n __decorate([\n Complex({ width: null, color: null }, Border)\n ], AccumulationDataLabelSettings.prototype, \"border\", void 0);\n __decorate([\n Complex({ size: '11px', color: null }, Font)\n ], AccumulationDataLabelSettings.prototype, \"font\", void 0);\n __decorate([\n Complex({}, Connector)\n ], AccumulationDataLabelSettings.prototype, \"connectorStyle\", void 0);\n __decorate([\n Property(null)\n ], AccumulationDataLabelSettings.prototype, \"template\", void 0);\n return AccumulationDataLabelSettings;\n}(ChildProperty));\nexport { AccumulationDataLabelSettings };\n/**\n * Points model for the series.\n */\nvar AccPoints = /** @class */ (function () {\n function AccPoints() {\n this.visible = true;\n this.symbolLocation = null;\n /** @private */\n this.region = null;\n /** @private */\n this.labelRegion = null;\n /** @private */\n this.labelVisible = true;\n this.regions = null;\n }\n return AccPoints;\n}());\nexport { AccPoints };\n/**\n * Configures the series in accumulation chart.\n */\nvar AccumulationSeries = /** @class */ (function (_super) {\n __extends(AccumulationSeries, _super);\n function AccumulationSeries() {\n /**\n * Specifies the dataSource for the series. It can be an array of JSON objects or an instance of DataManager.\n * ```html\n * \n * ```\n * ```typescript\n * let dataManager: DataManager = new DataManager({\n * url: 'http://mvc.syncfusion.com/Services/Northwnd.svc/Tasks/'\n * });\n * let query: Query = new Query().take(50).where('Estimate', 'greaterThan', 0, false);\n * let pie: AccumulationChart = new AccumulationChart({\n * ...\n * series: [{\n * dataSource: dataManager,\n * xName: 'Id',\n * yName: 'Estimate',\n * query: query\n * }],\n * ...\n * });\n * pie.appendTo('#Pie');\n * ```\n * @default ''\n */\n var _this = _super !== null && _super.apply(this, arguments) || this;\n /** @private */\n _this.points = [];\n /** @private */\n _this.sumOfPoints = 0;\n /** @private */\n _this.isRectSeries = true;\n /** @private */\n _this.clipRect = new Rect(0, 0, 0, 0);\n /** @private */\n _this.category = 'Series';\n return _this;\n }\n /** @private To refresh the Datamanager for series */\n AccumulationSeries.prototype.refreshDataManager = function (accumulation, render) {\n var _this = this;\n if (isNullOrUndefined(this.query)) {\n this.dataManagerSuccess({ result: this.dataSource, count: this.dataSource.length }, accumulation, render);\n return;\n }\n var dataManager = this.dataModule.getData(this.dataModule.generateQuery().requiresCount());\n dataManager.then(function (e) { return _this.dataManagerSuccess(e, accumulation, render); });\n };\n /**\n * To get points on dataManager is success\n * @private\n */\n AccumulationSeries.prototype.dataManagerSuccess = function (e, accumulation, render) {\n var argsData = {\n name: seriesRender, series: this, data: e.result,\n };\n accumulation.trigger(seriesRender, argsData);\n this.resultData = e.result !== '' ? e.result : [];\n this.getPoints(this.resultData, accumulation);\n if (++accumulation.seriesCounts === accumulation.visibleSeries.length && render) {\n accumulation.refreshChart();\n }\n };\n /** @private To find points from result data */\n AccumulationSeries.prototype.getPoints = function (result, accumulation) {\n var length = Object.keys(result).length;\n this.sumOfPoints = 0;\n if (length === 0) {\n return null;\n }\n this.findSumOfPoints(result);\n this.points = [];\n this.sumOfClub = 0;\n var point;\n var colors = this.palettes.length ? this.palettes : getSeriesColor(accumulation.theme);\n var clubValue = stringToNumber(this.groupTo, this.sumOfPoints);\n for (var i = 0; i < length; i++) {\n point = this.setPoints(result, i, colors);\n var currentY = point.y;\n if (!this.isClub(point, clubValue, i)) {\n if (isNullOrUndefined(point.y)) {\n point.visible = false;\n }\n this.pushPoints(point, colors);\n }\n }\n this.lastGroupTo = this.groupTo;\n if (this.sumOfClub > 0) {\n var clubPoint = new AccPoints();\n clubPoint.x = 'Others';\n clubPoint.y = this.sumOfClub;\n clubPoint.text = clubPoint.originalText = clubPoint.x + ': ' + this.sumOfClub;\n this.pushPoints(clubPoint, colors);\n }\n };\n /**\n * Method to set point index and color\n */\n AccumulationSeries.prototype.pushPoints = function (point, colors) {\n point.index = this.points.length;\n point.color = point.color || colors[point.index % colors.length];\n this.points.push(point);\n };\n /**\n * Method to find club point\n */\n AccumulationSeries.prototype.isClub = function (point, clubValue, index) {\n if (!isNullOrUndefined(clubValue)) {\n if (this.groupMode === 'Value' && Math.abs(point.y) <= clubValue) {\n this.sumOfClub += Math.abs(point.y);\n return true;\n }\n else if (this.groupMode === 'Point' && index >= clubValue) {\n this.sumOfClub += Math.abs(point.y);\n return true;\n }\n }\n return false;\n };\n /**\n * Method to find sum of points in the series\n */\n AccumulationSeries.prototype.findSumOfPoints = function (result) {\n var length = Object.keys(result).length;\n for (var i = 0; i < length; i++) {\n if (!isNullOrUndefined(result[i][this.yName])) {\n this.sumOfPoints += Math.abs(result[i][this.yName]);\n }\n }\n };\n /**\n * Method to set points x, y and text from data source\n */\n AccumulationSeries.prototype.setPoints = function (data, i, colors) {\n var point = new AccPoints();\n point.x = getValue(this.xName, data[i]);\n point.y = getValue(this.yName, data[i]);\n point.color = getValue(this.pointColorMapping, data[i]);\n point.text = point.originalText = getValue(this.dataLabel.name || '', data[i]);\n this.setAccEmptyPoint(point, i, data, colors);\n return point;\n };\n /**\n * Method render the series elements for accumulation chart\n * @private\n */\n AccumulationSeries.prototype.renderSeries = function (accumulation) {\n var seriesGroup = accumulation.renderer.createGroup({ id: accumulation.element.id + '_Series_' + this.index });\n this.renderPoints(accumulation, seriesGroup);\n var datalabelGroup;\n if (accumulation.accumulationDataLabelModule && this.dataLabel.visible) {\n datalabelGroup = accumulation.renderer.createGroup({ id: accumulation.element.id + '_datalabel_Series_' + this.index });\n datalabelGroup.style.visibility =\n (this.animation.enable && accumulation.animateSeries && this.type === 'Pie') ? 'hidden' : 'visible';\n this.renderDataLabel(accumulation, datalabelGroup);\n }\n if (this.type === 'Pie') {\n this.findMaxBounds(this.labelBound, this.accumulationBound);\n accumulation.pieSeriesModule.animateSeries(accumulation, this.animation, this, seriesGroup);\n }\n if (accumulation.accumulationLegendModule) {\n this.labelBound.x -= accumulation.explodeDistance;\n this.labelBound.y -= accumulation.explodeDistance;\n this.labelBound.height += (accumulation.explodeDistance - this.labelBound.y);\n this.labelBound.width += (accumulation.explodeDistance - this.labelBound.x);\n }\n };\n /**\n * Method render the points elements for accumulation chart series.\n */\n AccumulationSeries.prototype.renderPoints = function (accumulation, seriesGroup) {\n var pointId = accumulation.element.id + '_Series_' + this.index + '_Point_';\n var option;\n for (var _i = 0, _a = this.points; _i < _a.length; _i++) {\n var point = _a[_i];\n var argsData = {\n cancel: false, name: pointRender, series: this, point: point, fill: point.color,\n border: this.isEmpty(point) ? { width: this.emptyPointSettings.border.width, color: this.emptyPointSettings.border.color } :\n { width: this.border.width, color: this.border.color }\n };\n accumulation.trigger(pointRender, argsData);\n point.color = argsData.fill;\n if (point.visible) {\n option = new PathOption(pointId + point.index, point.color, argsData.border.width || 1, argsData.border.color || point.color, 1, '', '');\n accumulation[(firstToLowerCase(this.type) + 'SeriesModule')].\n renderPoint(point, this, accumulation, option);\n seriesGroup.appendChild(accumulation.renderer.drawPath(option));\n }\n }\n accumulation.getSeriesElement().appendChild(seriesGroup);\n };\n /**\n * Method render the datalabel elements for accumulation chart.\n */\n AccumulationSeries.prototype.renderDataLabel = function (accumulation, datalabelGroup) {\n accumulation.accumulationDataLabelModule.findAreaRect();\n var element = createElement('div', {\n id: accumulation.element.id + '_Series_0' + '_DataLabelCollections'\n });\n for (var _i = 0, _a = this.points; _i < _a.length; _i++) {\n var point = _a[_i];\n if (point.visible) {\n accumulation.accumulationDataLabelModule.renderDataLabel(point, this.dataLabel, datalabelGroup, this.points, this.index, element);\n }\n }\n if (this.dataLabel.template !== null && element.childElementCount) {\n getElement(accumulation.element.id + '_Secondary_Element').appendChild(element);\n }\n accumulation.getSeriesElement().appendChild(datalabelGroup);\n };\n /**\n * To find maximum bounds for smart legend placing\n * @private\n */\n AccumulationSeries.prototype.findMaxBounds = function (totalbound, bound) {\n totalbound.x = bound.x < totalbound.x ? bound.x : totalbound.x;\n totalbound.y = bound.y < totalbound.y ? bound.y : totalbound.y;\n totalbound.height = (bound.y + bound.height) > totalbound.height ? (bound.y + bound.height) : totalbound.height;\n totalbound.width = (bound.x + bound.width) > totalbound.width ? (bound.x + bound.width) : totalbound.width;\n };\n /**\n * To set empty point value for null points\n * @private\n */\n AccumulationSeries.prototype.setAccEmptyPoint = function (point, i, data, colors) {\n if (!isNullOrUndefined(point.y)) {\n return null;\n }\n point.color = this.emptyPointSettings.fill || point.color;\n switch (this.emptyPointSettings.mode) {\n case 'Zero':\n point.y = 0;\n point.visible = true;\n break;\n case 'Average':\n var previous = data[i - 1] ? (data[i - 1][this.yName] || 0) : 0;\n var next = data[i + 1] ? (data[i + 1][this.yName] || 0) : 0;\n point.y = (Math.abs(previous) + Math.abs(next)) / 2;\n this.sumOfPoints += point.y;\n point.visible = true;\n break;\n default:\n point.visible = false;\n break;\n }\n };\n /**\n * To find point is empty\n */\n AccumulationSeries.prototype.isEmpty = function (point) {\n return point.color === this.emptyPointSettings.fill;\n };\n __decorate([\n Property('')\n ], AccumulationSeries.prototype, \"dataSource\", void 0);\n __decorate([\n Property()\n ], AccumulationSeries.prototype, \"query\", void 0);\n __decorate([\n Property('')\n ], AccumulationSeries.prototype, \"xName\", void 0);\n __decorate([\n Property('')\n ], AccumulationSeries.prototype, \"name\", void 0);\n __decorate([\n Property('')\n ], AccumulationSeries.prototype, \"yName\", void 0);\n __decorate([\n Property(true)\n ], AccumulationSeries.prototype, \"visible\", void 0);\n __decorate([\n Complex({ color: null, width: 0 }, Border)\n ], AccumulationSeries.prototype, \"border\", void 0);\n __decorate([\n Complex(null, Animation)\n ], AccumulationSeries.prototype, \"animation\", void 0);\n __decorate([\n Property('SeriesType')\n ], AccumulationSeries.prototype, \"legendShape\", void 0);\n __decorate([\n Property('')\n ], AccumulationSeries.prototype, \"pointColorMapping\", void 0);\n __decorate([\n Property(null)\n ], AccumulationSeries.prototype, \"selectionStyle\", void 0);\n __decorate([\n Property(null)\n ], AccumulationSeries.prototype, \"groupTo\", void 0);\n __decorate([\n Property('Value')\n ], AccumulationSeries.prototype, \"groupMode\", void 0);\n __decorate([\n Complex({}, AccumulationDataLabelSettings)\n ], AccumulationSeries.prototype, \"dataLabel\", void 0);\n __decorate([\n Property([])\n ], AccumulationSeries.prototype, \"palettes\", void 0);\n __decorate([\n Property(0)\n ], AccumulationSeries.prototype, \"startAngle\", void 0);\n __decorate([\n Property(360)\n ], AccumulationSeries.prototype, \"endAngle\", void 0);\n __decorate([\n Property('80%')\n ], AccumulationSeries.prototype, \"radius\", void 0);\n __decorate([\n Property('0')\n ], AccumulationSeries.prototype, \"innerRadius\", void 0);\n __decorate([\n Property('Pie')\n ], AccumulationSeries.prototype, \"type\", void 0);\n __decorate([\n Property(true)\n ], AccumulationSeries.prototype, \"enableTooltip\", void 0);\n __decorate([\n Property(false)\n ], AccumulationSeries.prototype, \"explode\", void 0);\n __decorate([\n Property('30%')\n ], AccumulationSeries.prototype, \"explodeOffset\", void 0);\n __decorate([\n Property(false)\n ], AccumulationSeries.prototype, \"explodeAll\", void 0);\n __decorate([\n Property(null)\n ], AccumulationSeries.prototype, \"explodeIndex\", void 0);\n __decorate([\n Complex({ mode: 'Drop' }, EmptyPointSettings)\n ], AccumulationSeries.prototype, \"emptyPointSettings\", void 0);\n __decorate([\n Property(0)\n ], AccumulationSeries.prototype, \"gapRatio\", void 0);\n __decorate([\n Property('80%')\n ], AccumulationSeries.prototype, \"width\", void 0);\n __decorate([\n Property('80%')\n ], AccumulationSeries.prototype, \"height\", void 0);\n __decorate([\n Property('20%')\n ], AccumulationSeries.prototype, \"neckWidth\", void 0);\n __decorate([\n Property('20%')\n ], AccumulationSeries.prototype, \"neckHeight\", void 0);\n __decorate([\n Property('Linear')\n ], AccumulationSeries.prototype, \"pyramidMode\", void 0);\n __decorate([\n Property(1)\n ], AccumulationSeries.prototype, \"opacity\", void 0);\n return AccumulationSeries;\n}(ChildProperty));\nexport { AccumulationSeries };\n/**\n * method to get series from index\n * @private\n */\nexport function getSeriesFromIndex(index, visibleSeries) {\n for (var _i = 0, visibleSeries_1 = visibleSeries; _i < visibleSeries_1.length; _i++) {\n var series = visibleSeries_1[_i];\n if (index === series.index) {\n return series;\n }\n }\n return visibleSeries[0];\n}\n/**\n * method to get point from index\n * @private\n */\nexport function pointByIndex(index, points) {\n for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {\n var point = points_1[_i];\n if (point.index === index) {\n return point;\n }\n }\n return null;\n}\n","/**\n * Methods for calculating coefficient.\n */\n/** @private */\nexport function rangeValueToCoefficient(value, range, inversed) {\n var result = (value - range.min) / (range.delta);\n return inversed ? (1 - result) : result;\n}\n/** @private */\nexport function getXLocation(x, range, size, inversed) {\n x = rangeValueToCoefficient(x, range, inversed);\n return x * size;\n}\n/** @private */\nexport function getRangeValueXByPoint(value, size, range, inversed) {\n var actualValue = !inversed ? value / size : (1 - (value / size));\n return actualValue * (range.delta) + range.min;\n}\n/** @private */\nexport function getExactData(points, start, end) {\n var selectedData = [];\n points.map(function (point) {\n if (point.xValue >= start && point.xValue <= end) {\n selectedData.push({\n 'x': point.x,\n 'y': point.y\n });\n }\n });\n return selectedData;\n}\n/** @private */\nexport function getNearestValue(values, point) {\n return values.reduce(function (prev, curr) {\n return (Math.abs(curr - point) < Math.abs(prev - point) ? curr : prev);\n });\n}\n/** @private */\nvar DataPoint = /** @class */ (function () {\n function DataPoint(x, y, xValue, yValue, visible) {\n if (visible === void 0) { visible = true; }\n this.x = x;\n this.y = y;\n this.xValue = xValue;\n this.visible = visible;\n }\n return DataPoint;\n}());\nexport { DataPoint };\n","import { Browser, isNullOrUndefined } from '@syncfusion/ej2-base';\n/**\n *\n */\nexport var RangeNavigatorTheme;\n(function (RangeNavigatorTheme) {\n /** @private */\n RangeNavigatorTheme.axisLabelFont = {\n size: '12px',\n fontWeight: 'Normal',\n color: null,\n fontStyle: 'Normal',\n fontFamily: 'Segoe UI'\n };\n /** @private */\n RangeNavigatorTheme.tooltipLabelFont = {\n size: '12px',\n fontWeight: 'Normal',\n color: null,\n fontStyle: 'Normal',\n fontFamily: 'Segoe UI'\n };\n})(RangeNavigatorTheme || (RangeNavigatorTheme = {}));\n/** @private */\nexport function getRangeThemeColor(theme, range) {\n var thumbSize = range.navigatorStyleSettings.thumb;\n var thumbWidth = isNullOrUndefined(thumbSize.width) ? (Browser.isDevice ? 15 : 20) : thumbSize.width;\n var thumbHeight = isNullOrUndefined(thumbSize.height) ? (Browser.isDevice ? 15 : 20) : thumbSize.height;\n var style = {\n gridLineColor: '#E0E0E0',\n axisLineColor: '#000000',\n labelFontColor: '#686868',\n unselectedRectColor: range.series.length ? 'rgba(255, 255, 255, 0.6)' : '#EEEEEE',\n thumpLineColor: 'rgba(189, 189, 189, 1)',\n thumbBackground: 'rgba(250, 250, 250, 1)',\n gripColor: '#757575',\n background: '#FFFFFF',\n thumbHoverColor: '#EEEEEE',\n selectedRegionColor: range.series.length ? 'transparent' : '#FF4081',\n tooltipBackground: 'rgb(0, 8, 22)',\n tooltipFontColor: '#dbdbdb',\n thumbWidth: thumbWidth,\n thumbHeight: thumbHeight\n };\n switch (theme) {\n case 'Fabric':\n style.selectedRegionColor = range.series.length ? 'transparent' : '#007897';\n break;\n case 'Bootstrap':\n style.selectedRegionColor = range.series.length ? 'transparent' : '#428BCA';\n break;\n case 'Highcontrast':\n style = {\n gridLineColor: '#bdbdbd',\n axisLineColor: '#969696',\n labelFontColor: '#ffffff',\n unselectedRectColor: range.series.length ? 'rgba(255, 255, 255, 0.3)' : '#EEEEEE',\n thumpLineColor: '#ffffff',\n thumbBackground: '#262626',\n gripColor: '#ffffff',\n background: '#000000',\n thumbHoverColor: '#BFBFBF',\n selectedRegionColor: range.series.length ? 'transparent' : '#FFD939',\n tooltipBackground: '#ffffff',\n tooltipFontColor: '#000000',\n thumbWidth: thumbWidth,\n thumbHeight: thumbHeight\n };\n break;\n default:\n style.selectedRegionColor = range.series.length ? 'transparent' : '#FF4081';\n break;\n }\n return style;\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { createElement, SvgRenderer, compile as templateComplier, remove } from '@syncfusion/ej2-base';\nimport { Animation } from '@syncfusion/ej2-base';\nimport { SmithchartSize } from '../../smithchart/utils/utils';\nexport function createSvg(smithchart) {\n smithchart.renderer = new SvgRenderer(smithchart.element.id);\n calculateSize(smithchart);\n smithchart.svgObject = smithchart.renderer.createSvg({\n id: smithchart.element.id + '_svg',\n width: smithchart.availableSize.width,\n height: smithchart.availableSize.height\n });\n}\nexport function getElement(id) {\n return document.getElementById(id);\n}\n/**\n * @private\n * Trim the title text\n */\nexport function textTrim(maxwidth, text, font) {\n var label = text;\n var size = measureText(text, font).width;\n if (size > maxwidth) {\n var textLength = text.length;\n for (var i = textLength - 1; i >= 0; --i) {\n label = text.substring(0, i) + '...';\n size = measureText(label, font).width;\n if (size <= maxwidth || label.length < 4) {\n if (label.length < 4) {\n label = ' ';\n }\n return label;\n }\n }\n }\n return label;\n}\n/**\n * Function to compile the template function for maps.\n * @returns Function\n * @private\n */\nexport function getTemplateFunction(templateString) {\n var templateFn = null;\n var e;\n try {\n if (document.querySelectorAll(templateString).length) {\n templateFn = templateComplier(document.querySelector(templateString).innerHTML.trim());\n }\n }\n catch (e) {\n templateFn = templateComplier(templateString);\n }\n return templateFn;\n}\nexport function convertElementFromLabel(element, labelId, data, index, smithchart) {\n var labelEle = element[0];\n var templateHtml = labelEle.outerHTML;\n var properties = Object.keys(data);\n for (var i = 0; i < properties.length; i++) {\n templateHtml = templateHtml.replace(new RegExp('{{:' + properties[i] + '}}', 'g'), data[properties[i].toString()]);\n }\n return createElement('div', {\n id: labelId,\n innerHTML: templateHtml,\n styles: 'position: absolute'\n });\n}\nexport function _getEpsilonValue() {\n var e = 1.0;\n while ((1.0 + 0.5 * e) !== 1.0) {\n e *= 0.5;\n }\n return e;\n}\n/**\n * Method to calculate the width and height of the smithchart\n */\nexport function calculateSize(smithchart) {\n var containerWidth = smithchart.element.clientWidth;\n var containerHeight = smithchart.element.clientHeight;\n smithchart.availableSize = new SmithchartSize(stringToNumber(smithchart.width, containerWidth) || containerWidth || 600, stringToNumber(smithchart.height, containerHeight) || containerHeight || 450);\n}\n/**\n * Animation for template\n * @private\n */\nexport function templateAnimate(smithchart, element, delay, duration, name) {\n var opacity = 0;\n var delta;\n var value;\n new Animation({}).animate(element, {\n duration: duration,\n delay: delay,\n name: name,\n progress: function (args) {\n delta = ((args.timeStamp - args.delay) / args.duration);\n value = opacity + (delta * 1);\n args.element.style.opacity = value.toString();\n },\n end: function (args) {\n var opacity = 1;\n args.element.style.opacity = opacity.toString();\n smithchart.trigger('animationComplete', event);\n },\n });\n}\n/** @private */\nexport function stringToNumber(value, containerSize) {\n if (value !== null && value !== undefined) {\n return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);\n }\n return null;\n}\n/**\n * Internal use of path options\n * @private\n */\nvar PathOption = /** @class */ (function () {\n function PathOption(id, fill, width, color, opacity, dashArray, d) {\n this.id = id;\n this.opacity = opacity;\n this.fill = fill;\n this.stroke = color;\n this['stroke-width'] = width;\n this['stroke-dasharray'] = dashArray;\n this.d = d;\n }\n return PathOption;\n}());\nexport { PathOption };\n/**\n * Internal use of rectangle options\n * @private\n */\nvar RectOption = /** @class */ (function (_super) {\n __extends(RectOption, _super);\n function RectOption(id, fill, border, opacity, rect) {\n var _this = _super.call(this, id, fill, border.width, border.color, opacity) || this;\n _this.y = rect.y;\n _this.x = rect.x;\n _this.height = rect.height;\n _this.width = rect.width;\n return _this;\n }\n return RectOption;\n}(PathOption));\nexport { RectOption };\n/**\n * Internal use of circle options\n * @private\n */\nvar CircleOption = /** @class */ (function (_super) {\n __extends(CircleOption, _super);\n function CircleOption(id, fill, border, opacity, cx, cy, r, dashArray) {\n var _this = _super.call(this, id, fill, border.width, border.color, opacity) || this;\n _this.cy = cy;\n _this.cx = cx;\n _this.r = r;\n _this['stroke-dasharray'] = dashArray;\n return _this;\n }\n return CircleOption;\n}(PathOption));\nexport { CircleOption };\nexport function measureText(text, font) {\n var htmlObject = document.getElementById('smithchartmeasuretext');\n if (htmlObject === null) {\n htmlObject = createElement('text', { id: 'smithchartmeasuretext' });\n document.body.appendChild(htmlObject);\n }\n htmlObject.innerHTML = text;\n htmlObject.style.position = 'absolute';\n htmlObject.style.visibility = 'hidden';\n htmlObject.style.left = '0';\n htmlObject.style.top = '-100';\n htmlObject.style.whiteSpace = 'nowrap';\n htmlObject.style.fontSize = font.size;\n htmlObject.style.fontWeight = font.fontWeight;\n htmlObject.style.fontStyle = font.fontStyle;\n htmlObject.style.fontFamily = font.fontFamily;\n // For bootstrap line height issue\n htmlObject.style.lineHeight = 'normal';\n return new SmithchartSize(htmlObject.clientWidth, htmlObject.clientHeight);\n}\n/**\n * Internal use of text options\n * @private\n */\nvar TextOption = /** @class */ (function () {\n function TextOption(id, x, y, anchor, text) {\n this.id = id;\n this.x = x;\n this.y = y;\n this.anchor = anchor;\n this.text = text;\n }\n return TextOption;\n}());\nexport { TextOption };\n/**\n * To remove element by id\n */\nexport function removeElement(id) {\n var element = document.getElementById(id);\n return element ? remove(element) : null;\n}\n/**\n * Animation Effect Calculation Started Here\n * @param currentTime\n * @param startValue\n * @param endValue\n * @param duration\n * @private\n */\nexport function linear(currentTime, startValue, endValue, duration) {\n return -endValue * Math.cos(currentTime / duration * (Math.PI / 2)) + endValue + startValue;\n}\nexport function reverselinear(currentTime, startValue, endValue, duration) {\n return -startValue * Math.sin(currentTime / duration * (Math.PI / 2)) + endValue + startValue;\n}\n/** @private */\nexport function getAnimationFunction(effect) {\n var functionName;\n switch (effect) {\n case 'Linear':\n functionName = linear;\n break;\n case 'Reverse':\n functionName = reverselinear;\n break;\n }\n return functionName;\n}\n/**\n * Internal rendering of text\n * @private\n */\nexport function renderTextElement(options, font, color, parent) {\n var renderOptions = {\n 'id': options.id,\n 'x': options.x,\n 'y': options.y,\n 'fill': color,\n 'font-size': font.size,\n 'font-style': font.fontStyle,\n 'font-family': font.fontFamily,\n 'font-weight': font.fontWeight,\n 'text-anchor': options.anchor,\n 'opacity': font.opacity\n };\n var text = options.text;\n var renderer = new SvgRenderer('');\n var height;\n var htmlObject = renderer.createText(renderOptions, text);\n parent.appendChild(htmlObject);\n return htmlObject;\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { SvgRenderer, createElement, remove } from '@syncfusion/ej2-base';\n/**\n * Sparkline control helper file\n */\n/**\n * sparkline internal use of `Size` type\n * @private\n */\nvar Size = /** @class */ (function () {\n function Size(width, height) {\n this.width = width;\n this.height = height;\n }\n return Size;\n}());\nexport { Size };\n/**\n * To find number from string\n * @private\n */\nexport function stringToNumber(value, containerSize) {\n if (value !== null && value !== undefined) {\n return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);\n }\n return null;\n}\n/**\n * Method to calculate the width and height of the sparkline\n */\nexport function calculateSize(sparkline) {\n var containerWidth = sparkline.element.clientWidth;\n var containerHeight = sparkline.element.clientHeight;\n sparkline.availableSize = new Size(stringToNumber(sparkline.width, containerWidth) || containerWidth || 100, stringToNumber(sparkline.height, containerHeight) || containerHeight || (sparkline.isDevice ?\n Math.min(window.innerWidth, window.innerHeight) : 50));\n}\n/**\n * Method to create svg for sparkline.\n */\nexport function createSvg(sparkline) {\n sparkline.renderer = new SvgRenderer(sparkline.element.id);\n calculateSize(sparkline);\n sparkline.svgObject = sparkline.renderer.createSvg({\n id: sparkline.element.id + '_svg',\n width: sparkline.availableSize.width,\n height: sparkline.availableSize.height\n });\n}\n/**\n * Internal use of type rect\n * @private\n */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n return Rect;\n}());\nexport { Rect };\n/**\n * Internal use of path options\n * @private\n */\nvar PathOption = /** @class */ (function () {\n function PathOption(id, fill, width, color, opacity, dashArray, d) {\n this.id = id;\n this.fill = fill;\n this.opacity = opacity;\n this['stroke-width'] = width;\n this.stroke = color;\n this.d = d;\n this['stroke-dasharray'] = dashArray;\n }\n return PathOption;\n}());\nexport { PathOption };\n/**\n * Internal use of rectangle options\n * @private\n */\nvar RectOption = /** @class */ (function (_super) {\n __extends(RectOption, _super);\n function RectOption(id, fill, border, opacity, rect, tl, tr, bl, br) {\n if (tl === void 0) { tl = 0; }\n if (tr === void 0) { tr = 0; }\n if (bl === void 0) { bl = 0; }\n if (br === void 0) { br = 0; }\n var _this = _super.call(this, id, fill, border.width, border.color, opacity) || this;\n _this.rect = rect;\n _this.topLeft = tl;\n _this.topRight = tr;\n _this.bottomLeft = bl;\n _this.bottomRight = br;\n return _this;\n }\n return RectOption;\n}(PathOption));\nexport { RectOption };\n/**\n * Internal use of circle options\n * @private\n */\nvar CircleOption = /** @class */ (function (_super) {\n __extends(CircleOption, _super);\n function CircleOption(id, fill, border, opacity, cx, cy, r, dashArray) {\n var _this = _super.call(this, id, fill, border.width, border.color, opacity) || this;\n _this.cy = cy;\n _this.cx = cx;\n _this.r = r;\n _this['stroke-dasharray'] = dashArray;\n return _this;\n }\n return CircleOption;\n}(PathOption));\nexport { CircleOption };\n/**\n * Internal use of append shape element\n * @private\n */\nexport function appendShape(shape, element) {\n if (element) {\n element.appendChild(shape);\n }\n return shape;\n}\n/**\n * Internal rendering of Circle\n * @private\n */\nexport function drawCircle(sparkline, options, element) {\n return appendShape(sparkline.renderer.drawCircle(options), element);\n}\n/**\n * To get rounded rect path direction\n */\nexport function calculateRoundedRectPath(r, topLeft, topRight, bottomLeft, bottomRight) {\n return 'M' + ' ' + r.x + ' ' + (topLeft + r.y) +\n ' Q ' + r.x + ' ' + r.y + ' ' + (r.x + topLeft) + ' ' +\n r.y + ' ' + 'L' + ' ' + (r.x + r.width - topRight) + ' ' + r.y +\n ' Q ' + (r.x + r.width) + ' ' + r.y + ' ' +\n (r.x + r.width) + ' ' + (r.y + topRight) + ' ' + 'L ' +\n (r.x + r.width) + ' ' + (r.y + r.height - bottomRight)\n + ' Q ' + (r.x + r.width) + ' ' + (r.y + r.height) + ' ' + (r.x + r.width - bottomRight) + ' ' +\n (r.y + r.height) + ' ' + 'L ' + (r.x + bottomLeft) + ' ' + (r.y + r.height) + ' Q ' + r.x + ' ' +\n (r.y + r.height) + ' ' + r.x + ' ' + (r.y + r.height - bottomLeft) + ' ' + 'L' + ' ' + r.x + ' ' +\n (topLeft + r.y) + ' ' + 'Z';\n}\n/**\n * Internal rendering of Rectangle\n * @private\n */\nexport function drawRectangle(sparkline, options, element) {\n options.d = calculateRoundedRectPath(options.rect, options.topLeft, options.topRight, options.bottomLeft, options.bottomRight);\n return appendShape(sparkline.renderer.drawPath(options), element);\n}\n/**\n * Internal rendering of Path\n * @private\n */\nexport function drawPath(sparkline, options, element) {\n return appendShape(sparkline.renderer.drawPath(options), element);\n}\n/**\n * Function to measure the height and width of the text.\n * @param {string} text\n * @param {SparklineFontModel} font\n * @param {string} id\n * @returns no\n * @private\n */\nexport function measureText(text, font) {\n var htmlObject = document.getElementById('sparklinesmeasuretext');\n if (htmlObject === null) {\n htmlObject = createElement('text', { id: 'sparklinesmeasuretext' });\n document.body.appendChild(htmlObject);\n }\n htmlObject.innerHTML = text;\n htmlObject.style.fontStyle = font.fontStyle;\n htmlObject.style.fontFamily = font.fontFamily;\n htmlObject.style.visibility = 'hidden';\n htmlObject.style.top = '-100';\n htmlObject.style.left = '0';\n htmlObject.style.position = 'absolute';\n htmlObject.style.fontSize = font.size;\n htmlObject.style.fontWeight = font.fontWeight;\n htmlObject.style.whiteSpace = 'nowrap';\n // For bootstrap line height issue\n htmlObject.style.lineHeight = 'normal';\n return new Size(htmlObject.clientWidth, htmlObject.clientHeight);\n}\n/**\n * Internal use of text options\n * @private\n */\nvar TextOption = /** @class */ (function () {\n function TextOption(id, x, y, anchor, text, baseLine, transform) {\n if (transform === void 0) { transform = ''; }\n this.transform = '';\n this.baseLine = 'auto';\n this.id = id;\n this.x = x;\n this.y = y;\n this.anchor = anchor;\n this.text = text;\n this.transform = transform;\n this.baseLine = baseLine;\n }\n return TextOption;\n}());\nexport { TextOption };\n/**\n * Internal rendering of text\n * @private\n */\nexport function renderTextElement(options, font, color, parent) {\n var textOptions = {\n 'id': options.id,\n 'x': options.x,\n 'y': options.y,\n 'transform': options.transform,\n 'opacity': font.opacity,\n 'fill': color,\n 'font-family': font.fontFamily,\n 'font-weight': font.fontWeight,\n 'font-size': font.size,\n 'font-style': font.fontStyle,\n 'text-anchor': options.anchor,\n 'dominant-baseline': options.baseLine\n };\n var renderer = new SvgRenderer('');\n var htmlObject = renderer.createText(textOptions, options.text);\n htmlObject.style['user-select'] = 'none';\n htmlObject.style['-moz-user-select'] = 'none';\n htmlObject.style['-webkit-touch-callout'] = 'none';\n htmlObject.style['-webkit-user-select'] = 'none';\n htmlObject.style['-khtml-user-select'] = 'none';\n htmlObject.style['-ms-user-select'] = 'none';\n htmlObject.style['-o-user-select'] = 'none';\n parent.appendChild(htmlObject);\n return htmlObject;\n}\n/**\n * To remove element by id\n */\nexport function removeElement(id) {\n var element = document.getElementById(id);\n return element ? remove(element) : null;\n}\n/**\n * To find the element by id\n */\nexport function getIdElement(id) {\n return document.getElementById(id);\n}\n/**\n * To find point within the bounds.\n */\nexport function withInBounds(x, y, bounds) {\n return (x >= bounds.x && x <= bounds.x + bounds.width && y >= bounds.y && y <= bounds.y + bounds.height);\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * Specifies Circular-Gauge Helper methods\n */\nimport { SvgRenderer, compile as templateComplier } from '@syncfusion/ej2-base';\nimport { merge } from '@syncfusion/ej2-base';\nimport { createElement, remove, setStyleAttribute } from '@syncfusion/ej2-base';\n/**\n * Function to measure the height and width of the text.\n * @param {string} text\n * @param {FontModel} font\n * @param {string} id\n * @returns Size\n * @private\n */\nexport function measureText(text, font) {\n var htmlObject = document.getElementById('gauge-measuretext');\n if (htmlObject === null) {\n htmlObject = createElement('text', { id: 'gauge-measuretext' });\n document.body.appendChild(htmlObject);\n }\n var style = 'position: absolute; visibility: hidden;' +\n ';left: 0; top: -100; white-space: nowrap;' + getFontStyle(font);\n htmlObject.innerHTML = text;\n htmlObject.setAttribute('style', style);\n return new Size(htmlObject.clientWidth, htmlObject.clientHeight);\n}\n/**\n * Function to find number from string\n * * @returns number\n * @private\n */\nexport function toPixel(value, maxDimension) {\n if (value !== null && value !== undefined) {\n return value.indexOf('%') !== -1 ? (maxDimension / 100) * parseInt(value, 10) : parseInt(value, 10);\n }\n return null;\n}\n/**\n * Function to get the style from FontModel.\n * @returns string\n * @private\n */\nexport function getFontStyle(font) {\n var style = '';\n style = 'font-size:' + font.size +\n '; font-style:' + font.fontStyle + '; font-weight:' + font.fontWeight +\n '; font-family:' + font.fontFamily + ';opacity:' + font.opacity +\n '; color:' + font.color + ';';\n return style;\n}\n/**\n * Function to set style to the element.\n * @private\n */\nexport function setStyles(element, fill, border) {\n setStyleAttribute(element, {\n 'stroke': border.color, 'stroke-width': border.width,\n 'fill': fill\n });\n}\n/**\n * Function to measure the element rect.\n * @returns ClientRect\n * @private\n */\nexport function measureElementRect(element) {\n var bounds;\n document.body.appendChild(element);\n bounds = element.getBoundingClientRect();\n removeElement(element.id);\n return bounds;\n}\n/**\n * Function to convert the number from string.\n * @returns number\n * @private\n */\nexport function stringToNumber(value, containerSize) {\n if (value !== null && value !== undefined) {\n return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);\n }\n return null;\n}\n/**\n * Function to create the text element.\n * @returns Element\n * @private\n */\nexport function textElement(options, font, color, parent, styles) {\n var renderOptions = {};\n var htmlObject;\n var renderer = new SvgRenderer('');\n var style = styles + ' font-size:' + font.size + '; font-style:' + font.fontStyle +\n ' ; font-weight:' + font.fontWeight + '; font-family:' + font.fontFamily + ';';\n renderOptions = {\n 'id': options.id,\n 'x': options.x,\n 'y': options.y,\n 'fill': color,\n 'text-anchor': options.anchor,\n 'transform': options.transform,\n 'opacity': font.opacity,\n 'dominant-baseline': options.baseLine,\n 'style': style\n };\n htmlObject = renderer.createText(renderOptions, options.text);\n parent.appendChild(htmlObject);\n return htmlObject;\n}\n/**\n * Function to append the path to the element.\n * @returns Element\n * @private\n */\nexport function appendPath(options, element, gauge, functionName) {\n functionName = functionName ? functionName : 'Path';\n var htmlObject = gauge.renderer['draw' + functionName](options);\n htmlObject.setAttribute('transform', options.transform);\n htmlObject.setAttribute('style', options.style);\n element.appendChild(htmlObject);\n return htmlObject;\n}\n/**\n * Function to calculate the sum of array values.\n * @returns number\n * @private\n */\nexport function calculateSum(from, to, values) {\n var sum = 0;\n var length = values.length;\n for (; from < length; from++) {\n sum += values[from];\n }\n return sum;\n}\n/**\n * Function to calculate the value for linear animation effect\n * @param currentTime\n * @param startValue\n * @param endValue\n * @param duration\n * @private\n */\nexport function linear(currentTime, startValue, endValue, duration) {\n return -endValue * Math.cos(currentTime / duration * (Math.PI / 2)) + endValue + startValue;\n}\n/**\n * Function to get the angle from value for circular gauge.\n * @returns number\n * @private\n */\nexport function getAngleFromValue(value, maximumValue, minimumValue, startAngle, endAngle, isClockWise) {\n var angle;\n endAngle -= isCompleteAngle(startAngle, endAngle) ? 0.0001 : 0;\n startAngle -= 90;\n endAngle -= 90;\n if (isClockWise) {\n angle = ((value - minimumValue) * (getDegree(startAngle, endAngle) / (maximumValue - minimumValue))) + startAngle;\n }\n else {\n angle = endAngle - ((value - minimumValue) * (getDegree(startAngle, endAngle) / (maximumValue - minimumValue)));\n angle = angle < 0 ? 360 + angle : angle;\n }\n angle = Math.round(angle) >= 360 ? (angle - 360) : Math.round(angle) < 0 ? (360 + angle) : angle;\n return angle;\n}\n/**\n * Function to get the degree for circular gauge.\n * @returns number\n * @private\n */\nexport function getDegree(startAngle, endAngle) {\n var degree = endAngle - startAngle;\n return degree < 0 ? (degree + 360) : degree;\n}\n/**\n * Function to get the value from angle for circular gauge.\n * @returns number\n * @private\n */\nexport function getValueFromAngle(angle, maximumValue, minimumValue, startAngle, endAngle, isClockWise) {\n endAngle -= isCompleteAngle(startAngle, endAngle) ? 0.0001 : 0;\n angle = angle < startAngle ? (angle + 360) : angle;\n if (isClockWise) {\n return (((angle - startAngle) / getDegree(startAngle, endAngle)) * (maximumValue - minimumValue)) + minimumValue;\n }\n else {\n return maximumValue - ((((angle - startAngle) / getDegree(startAngle, endAngle)) * (maximumValue - minimumValue)) + minimumValue);\n }\n}\n/**\n * Function to check whether it's a complete circle for circular gauge.\n * @returns boolean\n * @private\n */\nexport function isCompleteAngle(startAngle, endAngle) {\n var totalAngle = endAngle - startAngle;\n totalAngle = totalAngle <= 0 ? (totalAngle + 360) : totalAngle;\n return Math.floor(totalAngle / 360) !== 0;\n}\n/**\n * Function to get angle from location for circular gauge.\n * @returns number\n * @private\n */\nexport function getAngleFromLocation(center, point) {\n var angle = Math.atan2((point.y - center.y), (point.x - center.x));\n angle = Math.round((angle < 0 ? (6.283 + angle) : angle) * (180 / Math.PI)) - 270;\n angle += angle < 0 ? 360 : 0;\n return angle;\n}\n/**\n * Function to get the location from angle for circular gauge.\n * @returns GaugeLocation\n * @private\n */\nexport function getLocationFromAngle(degree, radius, center) {\n var radian = (degree * Math.PI) / 180;\n return new GaugeLocation(Math.cos(radian) * radius + center.x, Math.sin(radian) * radius + center.y);\n}\n/**\n * Function to get the path direction of the circular gauge.\n * @returns string\n * @private\n */\nexport function getPathArc(center, start, end, radius, startWidth, endWidth) {\n end -= isCompleteAngle(start, end) ? 0.0001 : 0;\n var degree = getDegree(start, end);\n var startRadius = radius - startWidth;\n var endRadius = radius - endWidth;\n var arcRadius = radius - ((startWidth + endWidth) / 2);\n if (startWidth !== undefined && endWidth !== undefined) {\n return getRangePath(getLocationFromAngle(start, radius, center), getLocationFromAngle(end, radius, center), getLocationFromAngle(start, startRadius, center), getLocationFromAngle(end, endRadius, center), radius, arcRadius, arcRadius, (degree < 180) ? 0 : 1);\n }\n else {\n return getCirclePath(getLocationFromAngle(start, radius, center), getLocationFromAngle(end, radius, center), radius, (degree < 180) ? 0 : 1);\n }\n}\n/**\n * Function to get the range path direction of the circular gauge.\n * @returns string\n * @private\n */\nexport function getRangePath(start, end, innerStart, innerEnd, radius, startRadius, endRadius, clockWise) {\n return 'M ' + start.x + ' ' + start.y +\n ' A ' + radius + ' ' + radius + ' 0 ' +\n clockWise + ' 1 ' + end.x + ' ' + end.y +\n ' L ' + innerEnd.x + ' ' + innerEnd.y +\n ' A ' + endRadius + ' ' + startRadius + ' 0 ' +\n clockWise + ' 0 ' + innerStart.x + ' ' + innerStart.y + ' Z';\n}\n/**\n * Function to calculate the complete path arc of the circular gauge.\n * @returns string\n * @private\n */\nexport function getCompleteArc(center, start, end, radius, innerRadius) {\n end -= isCompleteAngle(start, end) ? 0.0001 : 0;\n var degree = getDegree(start, end);\n return getCompletePath(center, getLocationFromAngle(start, radius, center), getLocationFromAngle(end, radius, center), radius, getLocationFromAngle(start, innerRadius, center), getLocationFromAngle(end, innerRadius, center), innerRadius, (degree < 180) ? 0 : 1);\n}\n/**\n * Function to get the circular path direction of the circular gauge.\n * @returns string\n * @private\n */\nexport function getCirclePath(start, end, radius, clockWise) {\n return 'M ' + start.x + ' ' + start.y + ' A ' + radius + ' ' +\n radius + ' 0 ' + clockWise + ' 1 ' + end.x + ' ' + end.y;\n}\n/**\n * Function to get the complete path direction of the circular gauge.\n * @returns string\n * @private\n */\nexport function getCompletePath(center, start, end, radius, innerStart, innerEnd, innerRadius, clockWise) {\n return 'M ' + start.x + ' ' + start.y + ' A ' + radius + ' ' + radius + ' 0 ' + clockWise +\n ' 1 ' + end.x + ' ' + end.y + ' L ' + innerEnd.x + ' ' + innerEnd.y + ' A ' + innerRadius +\n ' ' + innerRadius + ' 0 ' + clockWise + ',0 ' + innerStart.x + ' ' + innerStart.y + ' Z';\n}\n/**\n * Function to get element from id.\n * @returns Element\n * @private\n */\nexport function getElement(id) {\n return document.getElementById(id);\n}\n/**\n * Function to compile the template function for circular gauge.\n * @returns Function\n * @private\n */\nexport function getTemplateFunction(template) {\n var templateFn = null;\n var e;\n try {\n if (document.querySelectorAll(template).length) {\n templateFn = templateComplier(document.querySelector(template).innerHTML.trim());\n }\n }\n catch (e) {\n templateFn = templateComplier(template);\n }\n return templateFn;\n}\n/**\n * Function to remove the element from id.\n * @private\n */\nexport function removeElement(id) {\n var element = getElement(id);\n if (element) {\n remove(element);\n }\n}\n/**\n * Function to get current point for circular gauge using element id.\n * @returns IVisiblePointer\n * @private\n */\nexport function getPointer(targetId, gauge) {\n var tempString;\n tempString = targetId.split(gauge.element.id + '_Axis_')[1];\n return {\n axisIndex: +tempString[0],\n pointerIndex: +tempString[tempString.length - 1]\n };\n}\n/**\n * Function to convert the label using formar for cirular gauge.\n * @returns string\n * @private\n */\nexport function getLabelFormat(format) {\n var customLabelFormat = format && format.match('{value}') !== null;\n var skeleton = customLabelFormat ? '' : format;\n return skeleton;\n}\n/**\n * Function to calculate the marker shape for circular gauge.\n * @returns PathOption\n * @private\n */\nexport function calculateShapes(location, shape, size, url, options) {\n var path;\n var width = size.width;\n var height = size.height;\n var locX = location.x;\n var locY = location.y;\n var x = location.x + (-width / 2);\n var y = location.y + (-height / 2);\n switch (shape) {\n case 'Circle':\n merge(options, { 'rx': width / 2, 'ry': height / 2, 'cx': locX, 'cy': locY });\n break;\n case 'Diamond':\n path = 'M' + ' ' + x + ' ' + locY + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + locY + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + locY + ' Z';\n merge(options, { 'd': path });\n break;\n case 'Rectangle':\n path = 'M' + ' ' + x + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (-height / 2)) + ' Z';\n merge(options, { 'd': path });\n break;\n case 'Triangle':\n path = 'M' + ' ' + locX + ' ' + locY + ' ' +\n 'L' + ' ' + (locX - height) + ' ' + (locY - (width / 2)) +\n 'L' + ' ' + (locX - height) + ' ' + (locY + (width / 2)) + ' Z';\n merge(options, { 'd': path });\n break;\n case 'InvertedTriangle':\n path = 'M' + ' ' + locX + ' ' + locY + ' ' +\n 'L' + ' ' + (locX + height) + ' ' + (locY - (width / 2)) +\n 'L' + ' ' + (locX + height) + ' ' + (locY + (width / 2)) + ' Z';\n merge(options, { 'd': path });\n break;\n case 'Image':\n merge(options, { 'href': url, 'height': height, 'width': width, x: x, y: y });\n break;\n }\n return options;\n}\n/**\n * Function to get range color from value for circular gauge.\n * @returns string\n * @private\n */\nexport function getRangeColor(value, ranges, color) {\n var min = 0;\n var max = 0;\n var currentRange = ranges.filter(function (range) {\n min = Math.min(range.start, range.end);\n max = Math.max(range.start, range.end);\n return (value >= min && max >= value);\n });\n return currentRange.length ? currentRange[0].rangeColor : color;\n}\n/** @private */\nvar CustomizeOption = /** @class */ (function () {\n function CustomizeOption(id) {\n this.id = id;\n }\n return CustomizeOption;\n}());\nexport { CustomizeOption };\n/** @private */\nvar PathOption = /** @class */ (function (_super) {\n __extends(PathOption, _super);\n function PathOption(id, fill, width, color, opacity, dashArray, d, transform, style) {\n if (transform === void 0) { transform = ''; }\n if (style === void 0) { style = ''; }\n var _this = _super.call(this, id) || this;\n _this.opacity = opacity;\n _this.fill = fill;\n _this.stroke = color;\n _this['stroke-width'] = width;\n _this['stroke-dasharray'] = dashArray;\n _this.d = d;\n _this.transform = transform;\n _this.style = style;\n return _this;\n }\n return PathOption;\n}(CustomizeOption));\nexport { PathOption };\n/** @private */\nvar RectOption = /** @class */ (function (_super) {\n __extends(RectOption, _super);\n function RectOption(id, fill, border, opacity, rect) {\n var _this = _super.call(this, id) || this;\n _this.y = rect.y;\n _this.x = rect.x;\n _this.height = rect.height;\n _this.width = rect.width;\n _this.opacity = opacity;\n _this.fill = fill;\n _this.stroke = border.color;\n _this['stroke-width'] = border.width;\n return _this;\n }\n return RectOption;\n}(CustomizeOption));\nexport { RectOption };\n/**\n * Internal class size\n */\nvar Size = /** @class */ (function () {\n function Size(width, height) {\n this.width = width;\n this.height = height;\n }\n return Size;\n}());\nexport { Size };\n/** @private */\nvar GaugeLocation = /** @class */ (function () {\n function GaugeLocation(x, y) {\n this.x = x;\n this.y = y;\n }\n return GaugeLocation;\n}());\nexport { GaugeLocation };\n/** @private */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n return Rect;\n}());\nexport { Rect };\n/** @private */\nvar TextOption = /** @class */ (function (_super) {\n __extends(TextOption, _super);\n function TextOption(id, x, y, anchor, text, transform, baseLine) {\n if (transform === void 0) { transform = ''; }\n var _this = _super.call(this, id) || this;\n _this.transform = '';\n _this.baseLine = 'auto';\n _this.x = x;\n _this.y = y;\n _this.anchor = anchor;\n _this.text = text;\n _this.transform = transform;\n _this.baseLine = baseLine;\n return _this;\n }\n return TextOption;\n}(CustomizeOption));\nexport { TextOption };\n/** @private */\nvar VisibleLabels = /** @class */ (function () {\n function VisibleLabels(text, value, size) {\n this.text = text;\n this.value = value;\n this.size = size;\n }\n return VisibleLabels;\n}());\nexport { VisibleLabels };\n","/**\n * These utility methods help to process the data and to convert it to desired dimensions\n */\n/** @private */\nexport function processPathData(data) {\n var collection = [];\n var arrayCollection = parsePathData(data);\n if (arrayCollection.length > 0) {\n for (var i = 0; i < arrayCollection.length; i++) {\n var ob = arrayCollection[i];\n var char = '';\n char = ob[0];\n switch (char.toLowerCase()) {\n case 'm':\n collection.push({ command: char, x: ob[1], y: ob[2] });\n break;\n case 'l':\n case 't':\n collection.push({ command: char, x: ob[1], y: ob[2] });\n break;\n case 'h':\n collection.push({ command: char, x: ob[1] });\n break;\n case 'v':\n collection.push({ command: char, y: ob[1] });\n break;\n case 'z':\n collection.push({ command: char });\n break;\n case 'c':\n collection.push({ command: char, x1: ob[1], y1: ob[2], x2: ob[3], y2: ob[4], x: ob[5], y: ob[6] });\n break;\n case 's':\n collection.push({ command: char, x2: ob[1], y2: ob[2], x: ob[3], y: ob[4] });\n break;\n case 'q':\n collection.push({ command: char, x1: ob[1], y1: ob[2], x: ob[3], y: ob[4] });\n break;\n case 'a':\n var l = ob[4];\n var s = ob[5];\n collection.push({ command: char, r1: ob[1], r2: ob[2], angle: ob[3], largeArc: l, sweep: s, x: ob[6], y: ob[7] });\n break;\n }\n }\n }\n return collection;\n}\n/** @private */\nexport function parsePathData(data) {\n var tokenizer = /([a-z]+)|([+-]?(?:\\d+\\.?\\d*|\\.\\d+))/gi;\n var current = [];\n var commands = [];\n var match = {};\n tokenizer.lastIndex = 0;\n var isExponential = false;\n match = tokenizer.exec(data);\n while (match) {\n if (match[1] === 'e') {\n var s1 = '';\n isExponential = true;\n }\n else if (match[1]) {\n if (match[1].toLowerCase() === 'zm') {\n if (current.length) {\n commands.push(current);\n }\n commands.push(['Z']);\n current = [match[1].substring(1, 2)];\n }\n else {\n if (current.length) {\n commands.push(current);\n }\n current = [match[1]];\n }\n isExponential = false;\n }\n else {\n if (!current.length) {\n current = [];\n }\n if (!isExponential) {\n current.push(Number(match[2]));\n }\n isExponential = false;\n }\n match = tokenizer.exec(data);\n }\n if (current.length) {\n commands.push(current);\n }\n return commands;\n}\n/**\n * Used to find the path for rounded rect\n */\nexport function getRectanglePath(cornerRadius, height, width) {\n var x = 0;\n var y = 0;\n var path = '';\n var points = [{ x: x + cornerRadius, y: y }, { x: x + width - cornerRadius, y: y },\n { x: x + width, y: y + cornerRadius }, { x: x + width, y: y + height - cornerRadius },\n { x: x + width - cornerRadius, y: y + height }, { x: x + cornerRadius, y: y + height },\n { x: x, y: y + height - cornerRadius }, { x: x, y: y + cornerRadius }\n ];\n var corners = [{ x: x + width, y: y }, { x: x + width, y: y + height }, { x: x, y: y + height }, { x: x, y: y }];\n var corner = 0;\n var point2;\n var next;\n path = 'M' + points[0].x + ' ' + points[0].y;\n var i;\n for (i = 0; i < points.length; i = i + 2) {\n point2 = points[i + 1];\n path += 'L' + point2.x + ' ' + point2.y;\n next = points[i + 2] || points[0];\n path += 'Q' + corners[corner].x + ' ' + corners[corner].y + ' ' + next.x + ' ' + next.y;\n corner++;\n }\n return path;\n}\n/**\n * Used to find the path for polygon shapes\n */\nexport function getPolygonPath(collection) {\n var path = '';\n var seg;\n path = 'M' + collection[0].x + ' ' + collection[0].y;\n var i;\n for (i = 1; i < collection.length; i++) {\n seg = collection[i];\n path += 'L' + seg.x + ' ' + seg.y;\n }\n path += 'Z';\n return path;\n}\n/** @private */\nexport function pathSegmentCollection(collection) {\n var x0;\n var y0;\n var x1;\n var y1;\n var x2;\n var y2;\n var x;\n var y;\n var length;\n var i;\n var initx;\n var inity;\n var segments = [];\n for (x = 0, y = 0, i = 0, length = collection.length; i < length; ++i) {\n var obj = collection[i];\n var seg = obj;\n var char = '';\n char = seg.command;\n if ('y1' in seg) {\n y1 = seg.y1;\n }\n if ('y2' in seg) {\n y2 = seg.y2;\n }\n if ('x1' in seg) {\n x1 = seg.x1;\n }\n if ('x2' in seg) {\n x2 = seg.x2;\n }\n if ('x' in seg) {\n x = seg.x;\n }\n if ('y' in seg) {\n y = seg.y;\n }\n var prev = segments[segments.length - 1];\n switch (char) {\n case 'M':\n segments.push({ command: 'M', x: x, y: y });\n break;\n case 'L':\n segments.push({ command: 'L', x0: x0, y0: y0, x: x, y: y });\n break;\n case 'H':\n segments.push({ command: 'L', x0: x0, y0: y0, x: x, y: y0 });\n break;\n case 'V':\n segments.push({ command: 'L', x0: x0, y0: y0, x: x0, y: y });\n break;\n case 'C':\n segments.push({ command: 'C', x0: x0, y0: y0, x1: x1, y1: y1, x2: x2, y2: y2, x: x, y: y });\n break;\n case 'S':\n if (prev) {\n var ctrl = void 0;\n if (prev.command === 'C' || prev.command === 'S') {\n ctrl = { x: prev.x2, y: prev.y2 };\n }\n else {\n ctrl = { x: x0, y: y0 };\n }\n var cpt2 = { x: 2 * x0 - ctrl.x, y: 2 * y0 - ctrl.y };\n segments.push({ command: 'C', x0: x0, y0: y0, x1: cpt2.x, y1: cpt2.y, x2: x2, y2: y2, x: x, y: y });\n }\n break;\n case 'Q':\n //ctx.quadraticCurveTo(x1, y1, x, y);\n segments.push({ command: 'Q', x0: x0, y0: y0, x1: x1, y1: y1, x: x, y: y });\n break;\n case 'T':\n if (prev) {\n var ctrl = void 0;\n if (prev.command === 'Q') {\n ctrl = { x: prev.x1, y: prev.y1 };\n }\n else {\n ctrl = { x: x0, y: y0 };\n }\n var cpt2 = { x: 2 * x0 - ctrl.x, y: 2 * y0 - ctrl.y };\n segments.push({ command: 'Q', x0: x0, y0: y0, x1: cpt2.x, y1: cpt2.y, x: x, y: y });\n }\n break;\n case 'A':\n var newSeg = seg;\n newSeg.command = 'A';\n segments.push(newSeg);\n break;\n case 'Z':\n case 'z':\n segments.push({ command: 'Z' });\n x = x0;\n y = y0;\n break;\n }\n if (char === 'M' || char === 'm') {\n initx = x;\n inity = y;\n }\n x0 = x;\n y0 = y;\n }\n return segments;\n}\n/** @private */\nexport function transformPath(arr, sX, sY, s, bX, bY, iX, iY) {\n var x0;\n var y0;\n var x1;\n var y1;\n var x2;\n var y2;\n var x;\n var y;\n var length;\n var i;\n var newSeg;\n for (x = 0, y = 0, i = 0, length = arr.length; i < length; ++i) {\n var obj = arr[i];\n var seg = obj;\n var char = seg.command;\n if ('x' in seg) {\n x = seg.x;\n }\n if ('y' in seg) {\n y = seg.y;\n }\n if ('y1' in seg) {\n y1 = seg.y1;\n }\n if ('y2' in seg) {\n y2 = seg.y2;\n }\n if ('x1' in seg) {\n x1 = seg.x1;\n }\n if ('x2' in seg) {\n x2 = seg.x2;\n }\n if (s) {\n if (x !== undefined) {\n x = scalePathData(x, sX, bX, iX);\n }\n if (y !== undefined) {\n y = scalePathData(y, sY, bY, iY);\n }\n if (x1 !== undefined) {\n x1 = scalePathData(x1, sX, bX, iX);\n }\n if (y1 !== undefined) {\n y1 = scalePathData(y1, sY, bY, iY);\n }\n if (x2 !== undefined) {\n x2 = scalePathData(x2, sX, bX, iX);\n }\n if (y2 !== undefined) {\n y2 = scalePathData(y2, sY, bY, iY);\n }\n }\n else {\n if (x !== undefined) {\n x = Number((x + sX).toFixed(2));\n }\n if (y !== undefined) {\n y = Number((y + sY).toFixed(2));\n }\n if (x1 !== undefined) {\n x1 = Number((x1 + sX).toFixed(2));\n }\n if (y1 !== undefined) {\n y1 = Number((y1 + sY).toFixed(2));\n }\n if (x2 !== undefined) {\n x2 = Number((x2 + sX).toFixed(2));\n }\n if (y2 !== undefined) {\n y2 = Number((y2 + sY).toFixed(2));\n }\n }\n var scaledPath = { x: x, y: y, x1: x1, y1: y1, x2: x2, y2: y2, r1: seg.r1, r2: seg.r2 };\n newSeg = updatedSegment(seg, char, scaledPath, s, sX, sY);\n if (newSeg) {\n arr[i] = newSeg;\n }\n // Record the start of a subpath\n if (char === 'M' || char === 'm') {\n x0 = x;\n y0 = y;\n }\n }\n var pathData = getPathString(arr);\n return pathData;\n}\n/** @private */\nexport function updatedSegment(segment, char, obj, isScale, sX, sY) {\n switch (char) {\n case 'M':\n segment.x = obj.x;\n segment.y = obj.y;\n break;\n case 'L':\n segment.x = obj.x;\n segment.y = obj.y;\n break;\n case 'H':\n segment.x = obj.x;\n break;\n case 'V':\n segment.y = obj.y;\n break;\n case 'C':\n segment.x = obj.x;\n segment.y = obj.y;\n segment.x1 = obj.x1;\n segment.y1 = obj.y1;\n segment.x2 = obj.x2;\n segment.y2 = obj.y2;\n break;\n case 'S':\n segment.x = obj.x;\n segment.y = obj.y;\n segment.x2 = obj.x2;\n segment.y2 = obj.y2;\n break;\n case 'Q':\n segment.x = obj.x;\n segment.y = obj.y;\n segment.x1 = obj.x1;\n segment.y1 = obj.y1;\n break;\n case 'T':\n segment.x = obj.x;\n segment.y = obj.y;\n break;\n case 'A':\n var r1 = obj.r1;\n var r2 = obj.r2;\n if (isScale) {\n obj.r1 = r1 = (r1 * sX);\n obj.r2 = r2 = (r2 * sY);\n }\n segment.x = obj.x;\n segment.y = obj.y;\n segment.r1 = obj.r1;\n segment.r2 = obj.r2;\n break;\n case 'z':\n case 'Z':\n segment = { command: 'Z' };\n break;\n }\n return segment;\n}\n/** @private */\nexport function scalePathData(val, scaleFactor, oldOffset, newOffset) {\n if (val !== oldOffset) {\n if (newOffset !== oldOffset) {\n val = (((val * scaleFactor) - (Number(oldOffset) * scaleFactor - Number(oldOffset)))\n + (newOffset - Number(oldOffset)));\n }\n else {\n val = ((Number(val) * scaleFactor) - (Number(oldOffset) * scaleFactor - Number(oldOffset)));\n }\n }\n else {\n if (newOffset !== oldOffset) {\n val = newOffset;\n }\n }\n return Number(val.toFixed(2));\n}\n/** @private */\nexport function splitArrayCollection(arrayCollection) {\n var x0;\n var y0;\n var x1;\n var y1;\n var x2;\n var y2;\n var x;\n var y;\n var length;\n var i;\n for (x = 0, y = 0, i = 0, length = arrayCollection.length; i < length; ++i) {\n var path = arrayCollection[i];\n var seg = path;\n var char = seg.command;\n if (/[MLHVCSQTA]/.test(char)) {\n if ('x' in seg) {\n seg.x = x = seg.x;\n }\n if ('y' in seg) {\n seg.y = y = seg.y;\n }\n }\n else {\n if ('x1' in seg) {\n seg.x1 = x1 = x + seg.x1;\n }\n if ('x2' in seg) {\n seg.x2 = x2 = x + seg.x2;\n }\n if ('y1' in seg) {\n seg.y1 = y1 = y + seg.y1;\n }\n if ('y2' in seg) {\n seg.y2 = y2 = y + seg.y2;\n }\n if ('x' in seg) {\n seg.x = x += seg.x;\n }\n if ('y' in seg) {\n seg.y = y += seg.y;\n }\n var newSeg = void 0;\n switch (char) {\n case 'm':\n case 'M':\n newSeg = { command: 'M', x: x, y: y };\n break;\n case 'l':\n case 'L':\n newSeg = { command: 'L', x: x, y: y };\n break;\n case 'h':\n case 'H':\n newSeg = { command: 'H', x: x };\n break;\n case 'v':\n case 'V':\n newSeg = { command: 'V', y: y };\n break;\n case 'c':\n case 'C':\n newSeg = { command: 'C', x: x, y: y, x1: x1, y1: y1, x2: x2, y2: y2 };\n break;\n case 's':\n case 'S':\n newSeg = { command: 'S', x: x, y: y, x2: x2, y2: y2 };\n break;\n case 'q':\n case 'Q':\n newSeg = { command: 'Q', x: x, y: y, x1: x1, y1: y1 };\n break;\n case 't':\n case 'T':\n newSeg = { command: 'T', x: x, y: y };\n break;\n case 'a':\n case 'A':\n newSeg = { command: 'A', x: x, y: y };\n newSeg.r1 = seg.r1;\n newSeg.r2 = seg.r2;\n newSeg.angle = seg.angle;\n newSeg.largeArc = seg.largeArc;\n newSeg.sweep = seg.sweep;\n break;\n case 'z':\n case 'Z':\n newSeg = { command: 'Z' };\n x = x0;\n y = y0;\n newSeg = arrayCollection[i];\n break;\n }\n if (newSeg) {\n arrayCollection[i] = newSeg;\n }\n }\n if (char === 'M' || char === 'm') {\n x0 = x;\n y0 = y;\n }\n }\n return arrayCollection;\n}\n/** @private */\nexport function getPathString(arrayCollection) {\n var getNewString = '';\n var i;\n for (i = 0; i < arrayCollection.length; i++) {\n if (i === 0) {\n getNewString += getString(arrayCollection[i]);\n }\n else {\n getNewString += ' ' + getString(arrayCollection[i]);\n }\n }\n return getNewString;\n}\n/** @private */\nexport function getString(obj) {\n var string = '';\n switch (obj.command) {\n case 'Z':\n case 'z':\n string = obj.command;\n break;\n case 'M':\n case 'm':\n case 'L':\n case 'l':\n string = obj.command + ' ' + obj.x + ' ' + obj.y;\n break;\n case 'C':\n case 'c':\n string = obj.command + ' ' + obj.x1 + ' ' + obj.y1 + ' ' + obj.x2 + ' ' + obj.y2 + ' ' + obj.x + ' ' + obj.y;\n break;\n case 'Q':\n case 'q':\n string = obj.command + ' ' + obj.x1 + ' ' + obj.y1 + ' ' + obj.x + ' ' + obj.y;\n break;\n case 'A':\n case 'a':\n var cmd = obj.command;\n var ang = obj.angle;\n var l = (obj.largeArc ? '1' : '0');\n var s = (obj.sweep ? '1' : '0');\n string = cmd + ' ' + obj.r1 + ' ' + obj.r2 + ' ' + ang + ' ' + l + ' ' + s + ' ' + obj.x + ' ' + obj.y;\n break;\n case 'H':\n case 'h':\n string = obj.command + ' ' + obj.x;\n break;\n case 'V':\n case 'v':\n string = obj.command + ' ' + obj.y;\n break;\n case 'S':\n case 's':\n string = obj.command + ' ' + obj.x2 + ' ' + obj.y2 + ' ' + obj.x + ' ' + obj.y;\n break;\n case 'T':\n case 't':\n string = obj.command + ' ' + obj.x + ' ' + obj.y;\n }\n return string;\n}\n","/**\n * Matrix module is used to transform points based on offsets, angle\n */\n/** @private */\nexport var MatrixTypes;\n(function (MatrixTypes) {\n MatrixTypes[MatrixTypes[\"Identity\"] = 0] = \"Identity\";\n MatrixTypes[MatrixTypes[\"Translation\"] = 1] = \"Translation\";\n MatrixTypes[MatrixTypes[\"Scaling\"] = 2] = \"Scaling\";\n MatrixTypes[MatrixTypes[\"Unknown\"] = 4] = \"Unknown\";\n})(MatrixTypes || (MatrixTypes = {}));\n/** @private */\nvar Matrix = /** @class */ (function () {\n function Matrix(m11, m12, m21, m22, offsetX, offsetY, type) {\n this.m11 = m11;\n this.m12 = m12;\n this.m21 = m21;\n this.m22 = m22;\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n // if (type === undefined) {\n // this.type = MatrixTypes.Unknown;\n // } else {\n // this.type = type;\n // }\n this.type = type;\n }\n return Matrix;\n}());\nexport { Matrix };\n/** @private */\nexport function identityMatrix() {\n return new Matrix(1, 0, 0, 1, 0, 0, MatrixTypes.Identity);\n}\n/** @private */\nexport function transformPointByMatrix(matrix, point) {\n var pt = multiplyPoint(matrix, point.x, point.y);\n return { x: Math.round(pt.x * 100) / 100, y: Math.round(pt.y * 100) / 100 };\n}\n/** @private */\nexport function transformPointsByMatrix(matrix, points) {\n var transformedPoints = [];\n for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {\n var point = points_1[_i];\n transformedPoints.push(transformPointByMatrix(matrix, point));\n }\n return transformedPoints;\n}\n/** @private */\nexport function rotateMatrix(matrix, angle, centerX, centerY) {\n angle %= 360.0;\n multiplyMatrix(matrix, createRotationRadians(angle * 0.017453292519943295, centerX ? centerX : 0, centerY ? centerY : 0));\n}\n/** @private */\nexport function scaleMatrix(matrix, scaleX, scaleY, centerX, centerY) {\n if (centerX === void 0) { centerX = 0; }\n if (centerY === void 0) { centerY = 0; }\n multiplyMatrix(matrix, createScaling(scaleX, scaleY, centerX, centerY));\n}\n/** @private */\nexport function translateMatrix(matrix, offsetX, offsetY) {\n if (matrix.type & MatrixTypes.Identity) {\n matrix.type = MatrixTypes.Translation;\n setMatrix(matrix, 1.0, 0.0, 0.0, 1.0, offsetX, offsetY);\n return;\n }\n if (matrix.type & MatrixTypes.Unknown) {\n matrix.offsetX += offsetX;\n matrix.offsetY += offsetY;\n return;\n }\n matrix.offsetX += offsetX;\n matrix.offsetY += offsetY;\n matrix.type |= MatrixTypes.Translation;\n}\n/** @private */\nfunction createScaling(scaleX, scaleY, centerX, centerY) {\n var result = identityMatrix();\n result.type = !(centerX || centerY) ? MatrixTypes.Scaling : MatrixTypes.Scaling | MatrixTypes.Translation;\n setMatrix(result, scaleX, 0.0, 0.0, scaleY, centerX - scaleX * centerX, centerY - scaleY * centerY);\n return result;\n}\n/** @private */\nfunction createRotationRadians(angle, centerX, centerY) {\n var result = identityMatrix();\n var num = Math.sin(angle);\n var num2 = Math.cos(angle);\n var offsetX = centerX * (1.0 - num2) + centerY * num;\n var offsetY = centerY * (1.0 - num2) - centerX * num;\n result.type = MatrixTypes.Unknown;\n setMatrix(result, num2, num, -num, num2, offsetX, offsetY);\n return result;\n}\n/** @private */\nfunction multiplyPoint(matrix, x, y) {\n switch (matrix.type) {\n case MatrixTypes.Identity: break;\n case MatrixTypes.Translation:\n x += matrix.offsetX;\n y += matrix.offsetY;\n break;\n case MatrixTypes.Scaling:\n x *= matrix.m11;\n y *= matrix.m22;\n break;\n case MatrixTypes.Translation | MatrixTypes.Scaling:\n x *= matrix.m11;\n x += matrix.offsetX;\n y *= matrix.m22;\n y += matrix.offsetY;\n break;\n default:\n var num = y * matrix.m21 + matrix.offsetX;\n var num2 = x * matrix.m12 + matrix.offsetY;\n x *= matrix.m11;\n x += num;\n y *= matrix.m22;\n y += num2;\n break;\n }\n return { x: x, y: y };\n}\n/** @private */\nexport function multiplyMatrix(matrix1, matrix2) {\n var type = matrix1.type;\n var type2 = matrix2.type;\n if (type2 === MatrixTypes.Identity) {\n return;\n }\n if (type === MatrixTypes.Identity) {\n assignMatrix(matrix1, matrix2);\n matrix1.type = matrix2.type;\n return;\n }\n if (type2 === MatrixTypes.Translation) {\n matrix1.offsetX += matrix2.offsetX;\n matrix1.offsetY += matrix2.offsetY;\n if (type !== MatrixTypes.Unknown) {\n matrix1.type |= MatrixTypes.Translation;\n }\n return;\n }\n if (type !== MatrixTypes.Translation) {\n var num = type << 4 | type2;\n switch (num) {\n case 34:\n matrix1.m11 *= matrix2.m11;\n matrix1.m22 *= matrix2.m22;\n return;\n case 35:\n matrix1.m11 *= matrix2.m11;\n matrix1.m22 *= matrix2.m22;\n matrix1.offsetX = matrix2.offsetX;\n matrix1.offsetY = matrix2.offsetY;\n matrix1.type = (MatrixTypes.Translation | MatrixTypes.Scaling);\n return;\n case 36: break;\n default:\n {\n switch (num) {\n case 50:\n matrix1.m11 *= matrix2.m11;\n matrix1.m22 *= matrix2.m22;\n matrix1.offsetX *= matrix2.m11;\n matrix1.offsetY *= matrix2.m22;\n return;\n case 51:\n matrix1.m11 *= matrix2.m11;\n matrix1.m22 *= matrix2.m22;\n matrix1.offsetX = matrix2.m11 * matrix1.offsetX + matrix2.offsetX;\n matrix1.offsetY = matrix2.m22 * matrix1.offsetY + matrix2.offsetY;\n return;\n case 52: break;\n default:\n switch (num) {\n case 66:\n case 67:\n case 68: break;\n default: return;\n }\n break;\n }\n break;\n }\n }\n var result = identityMatrix();\n var m11New = matrix1.m11 * matrix2.m11 + matrix1.m12 * matrix2.m21;\n var m12New = matrix1.m11 * matrix2.m12 + matrix1.m12 * matrix2.m22;\n var m21New = matrix1.m21 * matrix2.m11 + matrix1.m22 * matrix2.m21;\n var m22New = matrix1.m21 * matrix2.m12 + matrix1.m22 * matrix2.m22;\n var offsetX_1 = matrix1.offsetX * matrix2.m11 + matrix1.offsetY * matrix2.m21 + matrix2.offsetX;\n var offsetY_1 = matrix1.offsetX * matrix2.m12 + matrix1.offsetY * matrix2.m22 + matrix2.offsetY;\n setMatrix(result, m11New, m12New, m21New, m22New, offsetX_1, offsetY_1);\n if (result.m21 || result.m12) {\n result.type = MatrixTypes.Unknown;\n }\n else {\n if (result.m11 && result.m11 !== 1.0 || result.m22 && result.m22 !== 1.0) {\n result.type = MatrixTypes.Scaling;\n }\n if (result.offsetX || result.offsetY) {\n result.type |= MatrixTypes.Translation;\n }\n if ((result.type & (MatrixTypes.Translation | MatrixTypes.Scaling)) === MatrixTypes.Identity) {\n result.type = MatrixTypes.Identity;\n }\n result.type = MatrixTypes.Scaling | MatrixTypes.Translation;\n }\n assignMatrix(matrix1, result);\n matrix1.type = result.type;\n return;\n }\n var offsetX = matrix1.offsetX;\n var offsetY = matrix1.offsetY;\n matrix1.offsetX = offsetX * matrix2.m11 + offsetY * matrix2.m21 + matrix2.offsetX;\n matrix1.offsetY = offsetX * matrix2.m12 + offsetY * matrix2.m22 + matrix2.offsetY;\n if (type2 === MatrixTypes.Unknown) {\n matrix1.type = MatrixTypes.Unknown;\n return;\n }\n matrix1.type = (MatrixTypes.Translation | MatrixTypes.Scaling);\n}\n/** @private */\nfunction setMatrix(mat, m11, m12, m21, m22, x, y) {\n mat.m11 = m11;\n mat.m12 = m12;\n mat.m21 = m21;\n mat.m22 = m22;\n mat.offsetX = x;\n mat.offsetY = y;\n}\n/** @private */\nfunction assignMatrix(matrix1, matrix2) {\n matrix1.m11 = matrix2.m11;\n matrix1.m12 = matrix2.m12;\n matrix1.m21 = matrix2.m21;\n matrix1.m22 = matrix2.m22;\n matrix1.offsetX = matrix2.offsetX;\n matrix1.offsetY = matrix2.offsetY;\n matrix1.type = matrix2.type;\n}\n","import { Rect } from '../primitives/rect';\nimport { Size } from '../primitives/size';\nimport { identityMatrix, transformPointByMatrix, rotateMatrix } from '../primitives/matrix';\nimport { getValue } from '@syncfusion/ej2-base';\n/**\n * Implements the basic functionalities\n */\n/** @private */\nexport function randomId() {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var id = '';\n var num;\n for (var i = 0; i < 5; i++) {\n if ('crypto' in window && 'getRandomValues' in crypto) {\n var count = new Uint16Array(1);\n // tslint:disable-next-line:no-any\n var intCrypto = window.msCrypto || window.crypto;\n num = intCrypto.getRandomValues(count)[0] % (chars.length - 1);\n }\n else {\n Math.floor(Math.random() * chars.length);\n }\n id += chars.substring(num, num + 1);\n }\n return id;\n}\n/** @private */\nexport function getBounds(element) {\n var bounds = new Rect();\n var corners = new Rect();\n var top = element.offsetY - element.actualSize.height * element.pivot.y;\n var bottom = element.offsetY + element.actualSize.height * (1 - element.pivot.y);\n var left = element.offsetX - element.actualSize.width * element.pivot.x;\n var right = element.offsetX + element.actualSize.width * (1 - element.pivot.x);\n var middleLeft = { x: left, y: (top + bottom) / 2 };\n var topCenter = { x: (left + right) / 2, y: top };\n var bottomCenter = { x: (left + right) / 2, y: bottom };\n var middleRight = { x: right, y: (top + bottom) / 2 };\n var topLeft = { x: left, y: top };\n var topRight = { x: right, y: top };\n var bottomLeft = { x: left, y: bottom };\n var bottomRight = { x: right, y: bottom };\n corners = Rect.toBounds([topLeft, topRight, bottomLeft, bottomRight]);\n element.corners = corners;\n if (element.rotateAngle !== 0 || element.parentTransform !== 0) {\n var matrix = identityMatrix();\n rotateMatrix(matrix, element.rotateAngle + element.parentTransform, element.offsetX, element.offsetY);\n topLeft = transformPointByMatrix(matrix, topLeft);\n topRight = transformPointByMatrix(matrix, topRight);\n bottomLeft = transformPointByMatrix(matrix, bottomLeft);\n bottomRight = transformPointByMatrix(matrix, bottomRight);\n //Set corners based on rotate angle\n }\n bounds = Rect.toBounds([topLeft, topRight, bottomLeft, bottomRight]);\n return bounds;\n}\n/** @private */\nexport function cloneObject(obj, additionalProp, key) {\n var newObject = {};\n var keys = 'properties';\n var prop = 'propName';\n if (obj) {\n key = obj[prop];\n var sourceObject = obj[keys] || obj;\n var properties = [];\n properties = properties.concat(Object.keys(sourceObject));\n var customProperties = [];\n if (key) {\n var propAdditional = getFunction(additionalProp);\n if (propAdditional) {\n customProperties = propAdditional(key);\n }\n else {\n customProperties = [];\n }\n properties = properties.concat(customProperties);\n }\n var internalProp = getInternalProperties(key);\n properties = properties.concat(internalProp);\n for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {\n var property = properties_1[_i];\n if (property !== 'wrapper') {\n var constructorId = 'constructor';\n var name_1 = 'name';\n var isEventEmmitter = obj[property] &&\n obj[property][constructorId] &&\n obj[property][constructorId][name_1] &&\n obj[property][constructorId][name_1] === 'EventEmitter'\n ? true : false;\n if (!isEventEmmitter) {\n if (obj[property] instanceof Array) {\n newObject[property] = cloneArray((internalProp.indexOf(property) === -1 && obj[keys]) ? obj[keys][property] : obj[property], additionalProp, property);\n }\n else if (obj[property] instanceof Array === false && obj[property] instanceof HTMLElement) {\n newObject[property] = obj[property].cloneNode(true).innerHtml;\n }\n else if (obj[property] instanceof Array === false && obj[property] instanceof Object) {\n newObject[property] = cloneObject((internalProp.indexOf(property) === -1 && obj[keys]) ? obj[keys][property] : obj[property]);\n }\n else {\n newObject[property] = obj[property];\n }\n }\n }\n else {\n if (obj[property]) {\n newObject[property] = {\n actualSize: {\n width: obj[property].actualSize.width, height: obj[property].actualSize.height\n }, offsetX: obj[property].offsetX, offsetY: obj[property].offsetY\n };\n }\n }\n }\n }\n return newObject;\n}\n/** @private */\nexport function getInternalProperties(propName) {\n switch (propName) {\n case 'nodes':\n return ['inEdges', 'outEdges', 'parentId', 'processId'];\n case 'connectors':\n return ['parentId'];\n }\n return [];\n}\n/** @private */\nexport function cloneArray(sourceArray, additionalProp, key) {\n var clonedArray;\n if (sourceArray) {\n clonedArray = [];\n for (var i = 0; i < sourceArray.length; i++) {\n if (sourceArray[i] instanceof Array) {\n clonedArray.push(sourceArray[i]);\n }\n else if (sourceArray[i] instanceof Object) {\n clonedArray.push(cloneObject(sourceArray[i], additionalProp, key));\n }\n else {\n clonedArray.push(sourceArray[i]);\n }\n }\n }\n return clonedArray;\n}\n/** @private */\nexport function extendObject(options, childObject) {\n var properties = 'properties';\n if (options) {\n if (!childObject) {\n childObject = { properties: {} };\n }\n var target = childObject;\n for (var _i = 0, _a = Object.keys(options); _i < _a.length; _i++) {\n var property = _a[_i];\n if (options[property] instanceof Array) {\n var extendeArray = extendArray(options[property], childObject[properties][property]);\n if (!childObject[properties][property] || !childObject[properties][property].length) {\n childObject[property] = extendeArray;\n }\n }\n else if (options[property] instanceof Array === false && options[property] instanceof HTMLElement) {\n childObject[property] = options[property].cloneNode(true).innerHtml;\n }\n else if (options[property] instanceof Array === false && options[property] instanceof Object) {\n var extendedObject = extendObject(options[property], childObject[properties][property]);\n if (extendedObject[properties] && !Object.keys(extendedObject[properties]).length) {\n delete extendedObject[properties];\n }\n childObject[property] = extendedObject;\n }\n else {\n childObject[property] = childObject[properties][property] !== undefined ?\n childObject[property] : options[property];\n }\n }\n }\n return childObject;\n}\n/** @private */\nexport function extendArray(sourceArray, childArray) {\n var clonedArray = [];\n var reset = false;\n if (!childArray) {\n childArray = [];\n }\n if (!childArray.length) {\n reset = true;\n }\n for (var i = 0; i < sourceArray.length; i++) {\n if (sourceArray[i] instanceof Array) {\n var extendedArray = extendArray(sourceArray[i], childArray[i]);\n if (reset) {\n clonedArray.push(extendArray);\n }\n }\n else if (sourceArray[i] instanceof Object) {\n var extendedObject = extendObject(sourceArray[i], childArray[i]);\n if (reset) {\n clonedArray.push(extendedObject);\n }\n }\n else {\n clonedArray.push(sourceArray[i]);\n }\n }\n return clonedArray;\n}\n/** @private */\nexport function textAlignToString(value) {\n var state = '';\n switch (value) {\n case 'Center':\n state = 'center';\n break;\n case 'Left':\n state = 'left';\n break;\n case 'Right':\n state = 'right';\n break;\n }\n return state;\n}\n/** @private */\nexport function wordBreakToString(value) {\n var state = '';\n switch (value) {\n case 'Wrap':\n state = 'breakall';\n break;\n case 'NoWrap':\n state = 'keepall';\n break;\n case 'WrapWithOverflow':\n state = 'normal';\n break;\n case 'LineThrough':\n state = 'line-through';\n break;\n }\n return state;\n}\nexport function bBoxText(textContent, options) {\n var measureElement = 'measureElement';\n window[measureElement].style.visibility = 'visible';\n var svg = window[measureElement].children[2];\n var text = svg.children[1];\n text.textContent = textContent;\n text.setAttribute('style', 'font-size:' + options.fontSize + 'px; font-family:'\n + options.fontFamily + ';font-weight:' + (options.bold ? 'bold' : 'normal'));\n var bBox = text.getBBox().width;\n window[measureElement].style.visibility = 'hidden';\n return bBox;\n}\n/** @private */\nexport function middleElement(i, j) {\n var m = 0;\n m = (i + j) / 2;\n return m;\n}\n/** @private */\nexport function overFlow(text, options) {\n var i = 0;\n var j = 0;\n var middle = 0;\n var bounds = 0;\n var temp = '';\n j = text.length;\n var t = 0;\n do {\n if (bounds > 0) {\n i = middle;\n }\n middle = Math.floor(middleElement(i, j));\n temp += text.substr(i, middle);\n bounds = bBoxText(temp, options);\n } while (bounds <= options.width);\n temp = temp.substr(0, i);\n for (t = i; t < j; t++) {\n temp += text[t];\n bounds = bBoxText(temp, options);\n if (bounds >= options.width) {\n text = text.substr(0, temp.length - 1);\n break;\n }\n }\n if (options.textOverflow === 'Ellipsis') {\n text = text.substr(0, text.length - 3);\n text += '...';\n }\n else {\n text = text.substr(0, text.length);\n }\n return text;\n}\n/** @private */\nexport function whiteSpaceToString(value, wrap) {\n if (wrap === 'NoWrap' && value === 'PreserveAll') {\n return 'pre';\n }\n var state = '';\n switch (value) {\n case 'CollapseAll':\n state = 'nowrap';\n break;\n case 'CollapseSpace':\n state = 'pre-line';\n break;\n case 'PreserveAll':\n state = 'pre-wrap';\n break;\n }\n return state;\n}\n/** @private */\nexport function rotateSize(size, angle) {\n var matrix = identityMatrix();\n rotateMatrix(matrix, angle, 0, 0);\n var topLeft = transformPointByMatrix(matrix, { x: 0, y: 0 });\n var topRight = transformPointByMatrix(matrix, { x: size.width, y: 0 });\n var bottomLeft = transformPointByMatrix(matrix, { x: 0, y: size.height });\n var bottomRight = transformPointByMatrix(matrix, { x: size.width, y: size.height });\n var minX = Math.min(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x);\n var minY = Math.min(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y);\n var maxX = Math.max(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x);\n var maxY = Math.max(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y);\n return new Size(maxX - minX, maxY - minY);\n}\n/** @private */\nexport function rotatePoint(angle, pivotX, pivotY, point) {\n if (angle !== 0) {\n var matrix = identityMatrix();\n rotateMatrix(matrix, angle, pivotX, pivotY);\n return transformPointByMatrix(matrix, point);\n }\n return point;\n}\n/** @private */\nexport function getOffset(topLeft, obj) {\n var offX = topLeft.x + obj.desiredSize.width * obj.pivot.x;\n var offY = topLeft.y + obj.desiredSize.height * obj.pivot.y;\n return {\n x: offX, y: offY\n };\n}\n/**\n * Get function\n */\nexport function getFunction(value) {\n if (value !== undefined) {\n if (typeof value === 'string') {\n value = getValue(value, window);\n }\n }\n return value;\n}\n","import { Rect } from '../primitives/rect';\nimport { Size } from '../primitives/size';\nimport { processPathData, splitArrayCollection, transformPath } from './path-util';\nimport { whiteSpaceToString, wordBreakToString, textAlignToString, bBoxText } from './base-util';\nimport { identityMatrix, transformPointByMatrix, rotateMatrix } from '../primitives/matrix';\nimport { compile, createElement } from '@syncfusion/ej2-base';\n/**\n * Defines the functionalities that need to access DOM\n */\n/** @private */\nexport function findSegmentPoints(element) {\n var pts = [];\n var sample;\n var sampleLength;\n var measureElement = 'measureElement';\n window[measureElement].style.visibility = 'visible';\n var svg = window[measureElement].children[2];\n var pathNode = svg.children[0];\n pathNode.setAttributeNS(null, 'd', element.data);\n var pathBounds = element.absoluteBounds; // || pathNode.getBBox();\n var pathData = updatePath(element, pathBounds, element);\n pathNode.setAttributeNS(null, 'd', pathData);\n var pathLength = pathNode.getTotalLength();\n for (sampleLength = 0; sampleLength <= pathLength; sampleLength += 10) {\n sample = pathNode.getPointAtLength(sampleLength);\n pts.push({ x: sample.x, y: sample.y });\n }\n window[measureElement].style.visibility = 'hidden';\n return pts;\n}\nexport function translatePoints(element, points) {\n var translatedPts = [];\n for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {\n var point = points_1[_i];\n var pt1 = {\n x: element.offsetX - element.actualSize.width * element.pivot.x + point.x,\n y: element.offsetY - element.actualSize.height * element.pivot.y + point.y\n };\n var matrix = void 0;\n var angle = element.rotateAngle + element.parentTransform;\n if (angle) {\n matrix = identityMatrix();\n rotateMatrix(matrix, angle, element.offsetX, element.offsetY);\n }\n if (matrix) {\n pt1 = transformPointByMatrix(matrix, pt1);\n }\n translatedPts.push(pt1);\n }\n return translatedPts;\n}\n/** @private */\nexport function measurePath(data) {\n if (data) {\n var measureElement = 'measureElement';\n window[measureElement].style.visibility = 'visible';\n var svg = window[measureElement].children[2];\n var element = svg.children[0];\n element.setAttribute('d', data);\n var bounds = element.getBBox();\n var svgBounds = new Rect(bounds.x, bounds.y, bounds.width, bounds.height);\n window[measureElement].style.visibility = 'hidden';\n return svgBounds;\n }\n return new Rect(0, 0, 0, 0);\n}\nfunction getTextOptions(element, maxWidth) {\n var options = {\n fill: element.style.fill, stroke: element.style.strokeColor, angle: element.rotateAngle + element.parentTransform,\n pivotX: element.pivot.x, pivotY: element.pivot.y, strokeWidth: element.style.strokeWidth,\n dashArray: element.style.strokeDashArray, opacity: element.style.opacity, shadow: element.shadow,\n gradient: element.style.gradient, visible: element.visible, id: element.id, description: element.description,\n width: maxWidth || element.actualSize.width, height: element.actualSize.height,\n x: element.offsetX - element.actualSize.width * element.pivot.x + 0.5,\n y: element.offsetY - element.actualSize.height * element.pivot.y + 0.5\n };\n options.fontSize = element.style.fontSize;\n options.fontFamily = element.style.fontFamily;\n options.textOverflow = element.style.textOverflow;\n options.textDecoration = element.style.textDecoration;\n options.doWrap = element.doWrap;\n options.whiteSpace = whiteSpaceToString(element.style.whiteSpace, element.style.textWrapping);\n options.content = element.content;\n options.breakWord = wordBreakToString(element.style.textWrapping);\n options.textAlign = textAlignToString(element.style.textAlign);\n options.color = element.style.color;\n options.italic = element.style.italic;\n options.bold = element.style.bold;\n options.dashArray = '';\n options.strokeWidth = 0;\n options.fill = '';\n return options;\n}\nfunction wrapSvgText(text, textValue) {\n var childNodes = [];\n var k = 0;\n var txtValue;\n var bounds1;\n var content = textValue || text.content;\n if (text.whiteSpace !== 'nowrap' && text.whiteSpace !== 'pre') {\n if (text.breakWord === 'breakall') {\n txtValue = '';\n txtValue += content[0];\n for (k = 0; k < content.length; k++) {\n bounds1 = bBoxText(txtValue, text);\n if (bounds1 >= text.width && txtValue.length > 0) {\n childNodes[childNodes.length] = { text: txtValue, x: 0, dy: 0, width: bounds1 };\n txtValue = '';\n }\n else {\n txtValue = txtValue + (content[k + 1] || '');\n if (txtValue.indexOf('\\n') > -1) {\n txtValue = txtValue.replace('\\n', '');\n }\n var width = bBoxText(txtValue, text);\n if (Math.ceil(width) + 2 >= text.width && txtValue.length > 0) {\n childNodes[childNodes.length] = { text: txtValue, x: 0, dy: 0, width: width };\n txtValue = '';\n }\n if (k === content.length - 1 && txtValue.length > 0) {\n childNodes[childNodes.length] = { text: txtValue, x: 0, dy: 0, width: width };\n txtValue = '';\n }\n }\n }\n }\n else {\n childNodes = wordWrapping(text, textValue);\n }\n }\n else {\n childNodes[childNodes.length] = { text: content, x: 0, dy: 0, width: bBoxText(content, text) };\n }\n return childNodes;\n}\nfunction wordWrapping(text, textValue) {\n var childNodes = [];\n var txtValue = '';\n var j = 0;\n var i = 0;\n var wrap = text.whiteSpace !== 'nowrap' ? true : false;\n var content = textValue || text.content;\n var eachLine = content.split('\\n');\n var txt;\n var words;\n var newText;\n var existingWidth;\n var existingText;\n for (j = 0; j < eachLine.length; j++) {\n txt = '';\n words = eachLine[j].split(' ');\n for (i = 0; i < words.length; i++) {\n txtValue += (((i !== 0 || words.length === 1) && wrap && txtValue.length > 0) ? ' ' : '') + words[i];\n newText = txtValue + (words[i + 1] || '');\n var width = bBoxText(newText, text);\n if (Math.floor(width) > text.width - 2 && txtValue.length > 0) {\n childNodes[childNodes.length] = {\n text: txtValue, x: 0, dy: 0,\n width: newText === txtValue ? width : (txtValue === existingText) ? existingWidth : bBoxText(txtValue, text)\n };\n txtValue = '';\n }\n else {\n if (i === words.length - 1) {\n childNodes[childNodes.length] = { text: txtValue, x: 0, dy: 0, width: width };\n txtValue = '';\n }\n }\n existingText = newText;\n existingWidth = width;\n }\n }\n return childNodes;\n}\nfunction wrapSvgTextAlign(text, childNodes) {\n var wrapBounds = { x: 0, width: 0 };\n var k = 0;\n var txtWidth;\n var width;\n for (k = 0; k < childNodes.length; k++) {\n txtWidth = childNodes[k].width;\n width = txtWidth;\n if (text.textAlign === 'left') {\n txtWidth = 0;\n }\n else if (text.textAlign === 'center') {\n if (txtWidth > text.width && (text.textOverflow === 'Ellipsis' || text.textOverflow === 'Clip')) {\n txtWidth = 0;\n }\n else {\n txtWidth = -txtWidth / 2;\n }\n }\n else if (text.textAlign === 'right') {\n txtWidth = -txtWidth;\n }\n else {\n txtWidth = childNodes.length > 1 ? 0 : -txtWidth / 2;\n }\n childNodes[k].dy = text.fontSize;\n childNodes[k].x = txtWidth;\n if (!wrapBounds) {\n wrapBounds = {\n x: txtWidth,\n width: width\n };\n }\n else {\n wrapBounds.x = Math.min(wrapBounds.x, txtWidth);\n wrapBounds.width = Math.max(wrapBounds.width, width);\n }\n }\n return wrapBounds;\n}\nexport function measureHtmlText(style, content, width, height, maxWidth) {\n var bounds = new Size();\n var text = document.createElement('Span');\n text.setAttribute('style', 'display:inline-block ; line-height: normal');\n if (style.bold) {\n text.style.fontWeight = 'bold';\n }\n if (style.italic) {\n text.style.fontStyle = 'italic';\n }\n if (width !== undefined) {\n text.style.width = width.toString() + 'px';\n }\n if (height !== undefined) {\n text.style.height = height.toString() + 'px';\n }\n if (maxWidth !== undefined) {\n text.style.maxWidth = maxWidth.toString() + 'px';\n }\n text.style.fontFamily = style.fontFamily;\n text.style.fontSize = style.fontSize + 'px';\n text.style.color = style.color;\n text.textContent = content;\n text.style.whiteSpace = whiteSpaceToString(style.whiteSpace, style.textWrapping);\n if (maxWidth !== undefined) {\n text.style.wordBreak = 'break-word';\n }\n else {\n text.style.wordBreak = wordBreakToString(style.textWrapping);\n }\n document.body.appendChild(text);\n bounds.width = text.offsetWidth;\n bounds.height = text.offsetHeight;\n document.body.removeChild(text);\n return bounds;\n}\n/** @private */\nexport function measureText(text, style, content, maxWidth, textValue) {\n var bounds = new Size(0, 0);\n var childNodes;\n var wrapBounds;\n var options = getTextOptions(text, maxWidth);\n text.childNodes = childNodes = wrapSvgText(options, textValue);\n text.wrapBounds = wrapBounds = wrapSvgTextAlign(options, childNodes);\n bounds.width = wrapBounds.width;\n bounds.height = childNodes.length * text.style.fontSize;\n return bounds;\n}\n/** @private */\nexport function measureImage(source, contentSize) {\n var measureElement = 'measureElement';\n window[measureElement].style.visibility = 'visible';\n var imageElement = window[measureElement].children[1];\n imageElement.setAttribute('src', source);\n var bounds = imageElement.getBoundingClientRect();\n var width = bounds.width;\n var height = bounds.height;\n contentSize = new Size(width, height);\n window[measureElement].style.visibility = 'hidden';\n return contentSize;\n}\n/** @private */\nexport function measureNativeContent(nativeContent) {\n var measureElement = 'measureElement';\n window[measureElement].style.visibility = 'visible';\n var nativeSVG = window[measureElement].children[2];\n nativeSVG.appendChild(nativeContent);\n var bounds = nativeContent.getBoundingClientRect();\n var svgBounds = nativeSVG.getBoundingClientRect();\n var rect = bounds;\n rect.x = bounds.left - svgBounds.left;\n rect.y = bounds.top - svgBounds.top;\n nativeSVG.removeChild(nativeContent);\n window[measureElement].style.visibility = 'hidden';\n return rect;\n}\n/**\n * @private\n */\nexport function measureNativeSvg(nativeContent) {\n var measureElement = 'measureElement';\n window[measureElement].style.visibility = 'visible';\n var nativeSVG = window[measureElement].children[2];\n nativeSVG.appendChild(nativeContent);\n var svgBounds = nativeSVG.getBoundingClientRect();\n nativeSVG.removeChild(nativeContent);\n window[measureElement].style.visibility = 'hidden';\n return svgBounds;\n}\n/** @private */\nexport function updatePath(element, bounds, child) {\n var initX = 0;\n var initY = 0;\n var scaleX = 0;\n var scaleY = 0;\n var isScale = false;\n var bBox;\n var isInit;\n var isResizing = true;\n var newPathString = '';\n var arrayCollection = [];\n bBox = bounds;\n if (initX !== bBox.x || initY !== bBox.y) {\n scaleX = initX - Number(bBox.x);\n scaleY = initY - Number(bBox.y);\n }\n if (element.actualSize.width !== bBox.width || element.actualSize.height !== bBox.height) {\n scaleX = element.actualSize.width / Number(bBox.width ? bBox.width : 1);\n scaleY = element.actualSize.height / Number(bBox.height ? bBox.height : 1);\n isScale = true;\n }\n arrayCollection = processPathData(element.data);\n arrayCollection = splitArrayCollection(arrayCollection);\n newPathString = transformPath(arrayCollection, scaleX, scaleY, isScale, bBox.x, bBox.y, initX, initY);\n isScale = false;\n return newPathString;\n}\n/** @private */\nexport function getDiagramLayerSvg(diagramId) {\n var diagramLayerSvg;\n var diagramElement = getDiagramElement(diagramId);\n var elementcoll;\n elementcoll = diagramElement.getElementsByClassName('e-diagram-layer');\n diagramLayerSvg = elementcoll[0];\n return diagramLayerSvg;\n}\n/** @private */\nexport function getDiagramElement(diagramId) {\n var diagramElement = document.getElementById(diagramId);\n return diagramElement;\n}\n/**\n * @private\n */\nexport function getAdornerLayerSvg(diagramId) {\n var adornerLayerSvg = null;\n var diagramElement = getDiagramElement(diagramId);\n var elementcoll;\n elementcoll = diagramElement.getElementsByClassName('e-adorner-layer');\n adornerLayerSvg = elementcoll[0];\n return adornerLayerSvg;\n}\n/** @private */\nexport function getSelectorElement(diagramId) {\n var adornerLayer = null;\n var adornerSvg = getAdornerLayerSvg(diagramId);\n adornerLayer = adornerSvg.getElementById(diagramId + '_SelectorElement');\n return adornerLayer;\n}\n/**\n * @private\n */\nexport function getAdornerLayer(diagramId) {\n var adornerLayer = null;\n var diagramAdornerSvg = getAdornerLayerSvg(diagramId);\n adornerLayer = diagramAdornerSvg.getElementById(diagramId + '_diagramAdorner');\n return adornerLayer;\n}\n/** @private */\nexport function getDiagramLayer(diagramId) {\n var diagramLayer;\n var diagramLayerSvg = getDiagramLayerSvg(diagramId);\n diagramLayer = diagramLayerSvg.getElementById(diagramId + '_diagramLayer');\n return diagramLayer;\n}\n/** @private */\nexport function getPortLayerSvg(diagramId) {\n var adornerLayerSvg = null;\n var diagramElement = getDiagramElement(diagramId);\n var elementcoll;\n elementcoll = diagramElement.getElementsByClassName('e-ports-expand-layer');\n adornerLayerSvg = elementcoll[0];\n return adornerLayerSvg;\n}\n/** @private */\nexport function getNativeLayerSvg(diagramId) {\n var nativeLayerSvg;\n var diagramElement = getDiagramElement(diagramId);\n var elementcoll;\n elementcoll = diagramElement.getElementsByClassName('e-native-layer');\n nativeLayerSvg = elementcoll[0];\n return nativeLayerSvg;\n}\n/** @private */\nexport function getGridLayerSvg(diagramId) {\n var gridLayerSvg = null;\n var diagramElement = getDiagramElement(diagramId);\n var elementcoll;\n elementcoll = diagramElement.getElementsByClassName('e-grid-layer');\n gridLayerSvg = elementcoll[0];\n return gridLayerSvg;\n}\n/** @private */\nexport function getBackgroundLayerSvg(diagramId) {\n var gridLayerSvg = null;\n var diagramElement = getDiagramElement(diagramId);\n var elementcoll = diagramElement.getElementsByClassName('e-background-layer');\n return elementcoll[0].parentNode;\n}\n/** @private */\nexport function getBackgroundImageLayer(diagramId) {\n var imageLayer = null;\n var diagramElement = getDiagramElement(diagramId);\n var elementcoll;\n elementcoll = diagramElement.getElementsByClassName('e-background-image-layer');\n imageLayer = elementcoll[0];\n return imageLayer;\n}\n/** @private */\nexport function getBackgroundLayer(diagramId) {\n var imageLayer = null;\n var diagramElement = getDiagramElement(diagramId);\n var elementcoll;\n elementcoll = diagramElement.getElementsByClassName('e-background-layer');\n imageLayer = elementcoll[0];\n return imageLayer;\n}\n/** @private */\nexport function getGridLayer(diagramId) {\n var expandCollapse = null;\n var diagramGridSvg = getGridLayerSvg(diagramId);\n expandCollapse = diagramGridSvg.getElementById(diagramId + '_gridline');\n return expandCollapse;\n}\n/** @private */\nexport function getExpandCollapseLayer(diagramId) {\n var expandCollapse = null;\n var diagramPortSvg = getPortLayerSvg(diagramId);\n expandCollapse = diagramPortSvg.getElementById(diagramId + '_diagramExpander');\n return expandCollapse;\n}\n/** @private */\nexport function getPortsLayer(diagramId) {\n var expandCollapse = null;\n var diagramPortSvg = getPortLayerSvg(diagramId);\n expandCollapse = diagramPortSvg.getElementById(diagramId + '_diagramPorts');\n return expandCollapse;\n}\n/** @private */\nexport function getNativeLayer(diagramId) {\n var nativeLayer = null;\n var nativeLayerSvg = getNativeLayerSvg(diagramId);\n nativeLayer = nativeLayerSvg.getElementById(diagramId + '_nativeLayer');\n return nativeLayer;\n}\n/** @private */\nexport function getHTMLLayer(diagramId) {\n var htmlLayer = null;\n var element = getDiagramElement(diagramId);\n var elementcoll;\n elementcoll = element.getElementsByClassName('e-html-layer');\n htmlLayer = elementcoll[0];\n return htmlLayer;\n}\n/** @private */\nexport function createHtmlElement(elementType, attribute) {\n var element = document.createElement(elementType);\n setAttributeHtml(element, attribute);\n return element;\n}\n/** @private */\nexport function createSvgElement(elementType, attribute) {\n var element = document.createElementNS('http://www.w3.org/2000/svg', elementType);\n setAttributeSvg(element, attribute);\n return element;\n}\n/** @hidden */\nexport function parentsUntil(elem, selector, isID) {\n var parent = elem;\n while (parent) {\n if (isID ? parent.id === selector : hasClass(parent, selector)) {\n break;\n }\n parent = parent.parentNode;\n }\n return parent;\n}\nexport function hasClass(element, className) {\n var eClassName = (typeof element.className === 'object') ? element.className.animVal : element.className;\n return ((' ' + eClassName + ' ').indexOf(' ' + className + ' ') > -1) ? true : false;\n}\n/** @hidden */\nexport function getScrollerWidth() {\n var outer = document.createElement('div');\n outer.style.visibility = 'hidden';\n outer.style.width = '100px';\n document.body.appendChild(outer);\n var widthNoScroll = outer.getBoundingClientRect().width;\n // force scrollbars\n outer.style.overflow = 'scroll';\n // add innerdiv\n var inner = document.createElement('div');\n inner.style.width = '100%';\n outer.appendChild(inner);\n var widthWithScroll = inner.getBoundingClientRect().width;\n // remove divs\n outer.parentNode.removeChild(outer);\n return widthNoScroll - widthWithScroll;\n}\n/**\n * Handles the touch pointer.\n * @return {boolean}\n * @private\n */\nexport function addTouchPointer(touchList, e, touches) {\n touchList = [];\n for (var i = 0, length_1 = touches.length; i < length_1; i++) {\n touchList.push({ pageX: touches[i].clientX, pageY: touches[i].clientY, pointerId: null });\n }\n return touchList;\n}\n/**\n * removes the element from dom\n * @param elementId\n */\nexport function removeElement(elementId, contentId) {\n var element = document.getElementById(contentId);\n var div = (contentId && element) ? document.getElementById(contentId).querySelector('#' + elementId) :\n document.getElementById(elementId);\n if (div) {\n div.parentNode.removeChild(div);\n }\n}\nexport function getContent(element, isHtml) {\n var div;\n if (isHtml) {\n var attr = { 'style': 'height: 100%; width: 100%' };\n div = createHtmlElement('div', attr);\n }\n else {\n div = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n }\n var item;\n if (typeof element.content === 'string') {\n var compiledString = void 0;\n compiledString = compile(element.content);\n for (var _i = 0, _a = compiledString({}); _i < _a.length; _i++) {\n item = _a[_i];\n div.appendChild(item);\n }\n }\n else {\n div.appendChild(element.content);\n }\n return isHtml ? div.cloneNode(true) : div.cloneNode(true);\n}\n/** @private */\nexport function setAttributeSvg(svg, attributes) {\n var keys = Object.keys(attributes);\n for (var i = 0; i < keys.length; i++) {\n svg.setAttribute(keys[i], attributes[keys[i]]);\n }\n}\n/** @private */\nexport function setAttributeHtml(element, attributes) {\n var keys = Object.keys(attributes);\n for (var i = 0; i < keys.length; i++) {\n element.setAttribute(keys[i], attributes[keys[i]]);\n }\n}\n/** @private */\nexport function createMeasureElements() {\n var measureElement = 'measureElement';\n if (!window[measureElement]) {\n var divElement = createElement('div', { id: 'measureElement', styles: 'visibility:hidden' });\n var text = document.createElement('Span');\n text.setAttribute('style', 'display:inline-block ; line-height: normal');\n divElement.appendChild(text);\n var imageElement = void 0;\n imageElement = document.createElement('img');\n divElement.appendChild(imageElement);\n var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svg.setAttribute('xlink', 'http://www.w3.org/1999/xlink');\n divElement.appendChild(svg);\n var element = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n svg.appendChild(element);\n var data = document.createTextNode('');\n var tSpan = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\n svg.appendChild(tSpan);\n window[measureElement] = divElement;\n window[measureElement].usageCount = 1;\n document.body.appendChild(divElement);\n }\n else {\n window[measureElement].usageCount += 1;\n }\n}\n","/**\n * BasicShapeDictionary defines the shape of the built-in basic shapes\n */\n/** @private */\nexport function getBasicShape(shape) {\n return basicShapes[shape.toString()];\n}\nvar basicShapes = {\n //Rectangle,\n 'Rectangle': 'M0,0 L50,0 L50,50 L0,50 z',\n //Ellipse,\n 'Ellipse': 'M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5' +\n 'C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z',\n //Hexagon,\n 'Hexagon': 'M30,0 L60,0 L90,30 L60,60 L30,60 L0,30 L30,0 z',\n //Parallelogram,\n 'Parallelogram': 'M30,0 L60,0 L45,30 L15,30 z',\n //Triangle,\n 'Triangle': 'M45,0 L90,45 L0,45 L45,0 z',\n //Plus,\n 'Plus': 'M696.6084,158.2656 L674.8074,158.2656 L674.8074,136.4656 L658.4084,136.4656 L658.4084,158.2656 L636.6084,158.2656' +\n 'L636.6084,174.6646 L658.4084,174.6646 L658.4084,196.4656 L674.8074,196.4656 L674.8074,174.6646 L696.6084,174.6646' +\n 'L696.6084,158.2656 z',\n //Star,\n 'Star': 'M540.3643,137.9336 L546.7973,159.7016 L570.3633,159.7296 L550.7723,171.9366 L558.9053,194.9966 L540.3643,179.4996' +\n 'L521.8223,194.9966 L529.9553,171.9366 L510.3633,159.7296 L533.9313,159.7016 L540.3643,137.9336 z',\n //Pentagon,\n 'Pentagon': 'M30,0 L60,30 L50,70 L10,70 L0,30 L30,0 z',\n //Heptagon,\n 'Heptagon': 'M223.7783,195.7134 L207.1303,174.8364 L213.0713,148.8034 L237.1303,137.2174 L261.1883,148.8034 L267.1303,174.8364' +\n 'L250.4813,195.7134 L223.7783,195.7134 z',\n //Octagon,\n 'Octagon': 'M98.7319,196.4653 L81.1579,178.8923 L81.1579,154.0393 L98.7319,136.4653 L123.5849,136.4653' +\n 'L141.1579,154.0393 L141.1579,178.8923 L123.5849,196.4653 L98.7319,196.4653 z',\n //Trapezoid,\n 'Trapezoid': 'M127.2842,291.4492 L95.0322,291.4492 L81.1582,256.3152 L141.1582,256.3152 L127.2842,291.4492 z',\n //Decagon,\n 'Decagon': 'M657.3379,302.4141 L642.3369,291.5161 L636.6089,273.8821 L642.3369,256.2481 L657.3379,245.3511 L675.8789,245.3511' +\n 'L690.8789,256.2481 L696.6089,273.8821' +\n 'L690.8789,291.5161 L675.8789,302.4141 L657.3379,302.4141 z',\n //RightTriangle,\n 'RightTriangle': 'M836.293,292.9238 L776.293,292.9238 L776.293,254.8408 L836.293,292.9238 z',\n //Cylinder,\n 'Cylinder': 'M 542.802,362.009C 542.802,368.452 525.341,373.676 503.802,373.676C 482.263,373.676 464.802,368.452 464.802,362.009' +\n 'L 464.802,466.484C 464.802,472.928 482.263,478.151 503.802,478.151' +\n 'C 525.341,478.151 542.802,472.928 542.802,466.484L 542.802,362.016C 542.802,368.459 525.341,373.534 503.802,373.534' +\n 'C 482.263,373.534 464.802,368.31 464.802,361.867' +\n 'L 464.802,362.016C 464.802,355.572 482.263,350.349 503.802,350.349C 525.341,350.349 542.802,355.572 542.802,362.016',\n //Diamond,\n 'Diamond': 'M397.784,287.875 L369.5,316.159 L341.216,287.875 L369.5,259.591 L397.784,287.875 z'\n};\n","/**\n * ShapeDictionary defines the shape of the default nodes and ports\n */\n/** @private */\nexport function getPortShape(shape) {\n return portShapes[shape.toString()];\n}\n/** @private */\nexport function getDecoratorShape(shape, decorator) {\n if (shape === 'Custom') {\n return decorator.pathData;\n }\n return decoratorShapes[shape];\n}\n/**\n * @private\n * @param icon\n * sets the path data for different icon shapes\n */\nexport function getIconShape(icon) {\n var data;\n switch (icon.shape) {\n case 'Minus':\n data = 'M0,50 L100,50';\n break;\n case 'Plus':\n data = 'M0,-50 L0,50 M-50,0 L50,0';\n break;\n case 'ArrowUp':\n data = 'M0,100 L50,0 L100,100 Z';\n break;\n case 'ArrowDown':\n data = 'M0,0 L50,100 L100,0 Z';\n break;\n case 'Path':\n data = icon.pathData;\n break;\n }\n return data;\n}\nvar portShapes = {\n 'X': 'M14,14 L106,106 M106,14 L14,106',\n 'Circle': 'M0,50 A50,50,0 1 1 100,50 A50,50,0 1 1 0,50 Z',\n 'Square': 'M0,0 L10,0 L10,10 L0,10 z',\n};\nvar decoratorShapes = {\n 'OpenArrow': 'M15.9,23 L5,16 L15.9,9 L17,10.7 L8.7,16 L17,21.3Z',\n 'Square': 'M0,0 L10,0 L10,10 L0,10 z',\n 'Fletch': 'M14.8,10c0,0-3.5,6,0.2,12c0,0-2.5-6-10.9-6C4.1,16,11.3,16,14.8,10z',\n 'OpenFetch': 'M6,17c-0.6,0-1-0.4-1-1s0.4-1,1-1c10.9,0,11-5,11-5' +\n 'c0-0.6,0.4-1,1-1s1,0.4,1,1C19,10.3,18.9,17,6,17C6,17,6,17,6,17z ' +\n 'M18,23c-0.5,0-1-0.4-1-1c0-0.2-0.3-5-11-5c-0.6,0-1-0.5-1-1s0.4-1,1-1c0,0,0,0,0,0' +\n 'c12.9,0,13,6.7,13,7 C19,22.6,18.6,23,18,23z',\n 'IndentedArrow': 'M17,10c0,0-4.5,5.5,0,12L5,16L17,10z',\n 'OutdentedArrow': 'M14.6,10c0,0,5.4,6,0,12L5,16L14.6,10z',\n 'DoubleArrow': 'M19,10 L19,22 L13,16Z M12,10 L12,22 L6,16Z',\n 'Arrow': 'M15,10 L15,22 L5,16Z',\n 'Diamond': 'M12,23l-7-7l7-7l6.9,7L12,23z',\n 'Circle': 'M0,50 A50,50,0 1 1 100,50 A50,50,0 1 1 0,50 Z'\n};\n","/**\n * FlowShapeDictionary defines the shape of the built-in flow shapes\n */\n/** @private */\nexport function getFlowShape(shape) {\n return flowShapes[shape.toString()];\n}\nvar flowShapes = {\n // Process,\n 'Process': 'M419.511,76.687L359.511,76.687L359.511,43.086L419.511,43.086z',\n // Decision,\n 'Decision': 'M 253.005,115.687L 200.567,146.071L 148.097,115.687L 200.534,85.304L 253.005,115.687 Z',\n // Document,\n 'Document': 'M 60 31.9 c 0 0 -11 -7.7 -30 0 s -30 0 -30 0 V 0 h 60 V 31.9 Z',\n // PreDefinedProcess,\n 'PreDefinedProcess': 'M 0,0 L 50,0 L 50,50 L 0,50 Z M 8.334,0 L 8.334,50 M 41.667,0 L 41.667,50',\n // Terminator,\n 'Terminator': 'M 269.711,29.33C 269.71,44.061 257.77,56 243.04,56L 158.058,56C 143.33,56 131.39,44.061 131.39,29.33L 131.39,29.33' +\n 'C 131.391,14.6057 143.33,2.669 158.058,2.669L 243.044,2.669C 257.772,2.669 269.711,14.6057 269.711,29.333 Z',\n // PaperTap,\n 'PaperTap': 'M0.0009,17.2042 L0.0009,47.165 C0.001,47.165 14.403,53.5455 25.00,47.165 C35.599,40.7852 44.403,43.5087 50.00,47.165' +\n 'L50.001,17.2042 M50.001,32.7987 L50.001,2.8405 C50.001,2.8405 35.599,-3.5427 25.001,2.8405' +\n 'C14.403,9.2237 5.599,6.494 0.0009,2.8405 L0.0009,32.7987',\n // DirectData,\n 'DirectData': 'M 132.62 0 L 17.38 0 C 7.78 0 0 13.43 0 30 C 0 46.57 7.78 60 17.38 60 L 132.62 60 M 132.62 0' +\n 'C 123.02 0 115.24 13.43 115.24 30 C 115.24 46.57 123.02 60 132.62 60 C 142.22 60 150 46.57 150 30 C 150 13.43 142.22 0 132.62 0 z ',\n // SequentialData,\n 'SequentialData': 'M0.0029,24.999 C0.0029,11.1922 10.433,0.0021 23.295,0.0021 C36.159,0.00216 46.585,11.1922 46.585,24.999' +\n 'C46.585,38.8057 36.159,49.9979 23.295,49.9979 C10.433,49.9979 0.0029,38.8057 0.0029,24.999 z M23.294,49.999 L50.002,49.999',\n // Sort,\n 'Sort': 'M50.001,24.9971 L25.001,49.9971 L0.00097,24.9971 L25.001,-0.00286865 L50.001,24.9971 z' +\n ' M0.000976562,24.9971 L50.001,24.9971',\n // MultiDocument,\n 'MultiDocument': 'M43.6826,40 C44.8746,40.6183 45.8586,41.3502 46.8366,42.1122 L46.8366,4.74487 L3.09857,4.74487 L3.09857,10.9544' +\n ' M46.837,35.143 C48.027,35.765 49.025,36.604 50.003,37.369 L50.003,0.002 L6.264,0.002 L6.264,4.744 M43.682,47.113 L43.682,10.765' +\n ' L0.0025,10.7652 L0.0025,47.1132 C0.0025,47.1132 12.5846,53.6101 21.8426,47.1132 C31.1006,40.6163 38.792,43.393 43.6826,47.1132 z',\n // Collate,\n 'Collate': 'M50.001,0.0028 L25.001,25.0029 L0.00097,0.0028 L50.001,0.002 z M0.0009,50.002 L25.001,25.002' +\n 'L50.001,50.002 L0.0009,50.0029 z',\n // SummingJunction,\n 'SummingJunction': 'M7.3252,42.6768 L42.6772,7.3247 M42.6768,42.6768 L7.3248,7.3247 M0.0009,25.001 ' +\n 'C0.0009,11.193 11.197,0.0009 25.001,0.0009' +\n ' C38.809,0.0009 50.001,11.193 50.001,25.001 C50.001,38.809 38.809,50.001 25.001,50.001 C11.197,50.00 0.0009,38.809 0.0009,25.00 z',\n // Or,\n 'Or': 'M 0 50 L 100 50 M 50 100 L 50 0.0 M 0 50 C 0 22.384 22.392 0 50 0 C 77.616 0 100 22.384 100 50' +\n ' C 100 77.616 77.616 100 50 100 C 22.392 100 0 77.616 0 50 Z',\n // InternalStorage,\n 'InternalStorage': 'M 0 3.81946A 2.5,3.81946 0 0,1 2.5,0L 47.5 0A 2.5,3.81946 0 0,1 50,3.81946' +\n 'L 50 45.836A 2.5,3.819446 0 0,1 47.5,49.652778' +\n 'L 2.5 49.652778A 2.5,3.819446 0 0,1 0,45.8336L 0 3.819446ZM 0 11.45834L 50 11.4583334M 12.5 0L 12.5 49.652778',\n // Extract,\n 'Extract': 'M0,35 L30,0 L60,35 Z',\n // ManualOperation,\n 'ManualOperation': 'M46.4,28.8 L14.8,28.8 L0,0 L60,0 Z',\n // Merge,\n 'Merge': 'M60,0 L30,35 L0,0 Z',\n // OffPageReference,\n 'OffPageReference': 'M60,33.3 L30.1,39 L0,33.3 L0,0 L60,0 Z',\n // SequentialAccessStorage,\n 'SequentialAccessStorage': 'M 60 30 C 60 13.4 46.6 0 30 0 S 0 13.4 0 30 s 13.4 30 30 30 h 28.6 v -6.5 h -9.9' +\n 'C 55.5 48 60 39.5 60 30 Z',\n // Annotation,\n 'Annotation': 'M49.9984,50.0029 L-0.00271199,50.0029 L-0.00271199,0.00286865 L49.9984,0.00286865',\n // Annotation2,\n 'Annotation2': 'M49.9977,50.0029 L25.416,50.0029 L25.416,0.00286865 L49.9977,0.00286865 M25.4166,25.0029 L-0.00227869,25.0029',\n // Data,\n 'Data': 'M 10 0 L 40 0 L 30 40 L 0 40 Z',\n // Card,\n 'Card': 'M275,60 L400,60 L400,110 L260,110 L260,75 Z',\n // Delay,\n 'Delay': 'M0,0 L12.029,0 C14.212999,0 16,1.7869979 16,3.9709952 C16,6.1549926 14.212999,7.9409904 12.029,7.9409904 L0,7.9409904 z',\n // Preparation,\n 'Preparation': 'M 1048.17 572 C 1051.06 568.86 1055.17 567.05 1059.5 567 L 1094.51 567'\n + ' C 1098.84 567.05 1102.95 568.86 1105.84 572' +\n ' L 1126.43 595 C 1127.01 596.28 1127.01 597.72 1126.43 599 L 1105.84 622 C 1102.95 625.14 1098.84 626.95 1094.51 627' +\n ' L 1059.5 627 C 1055.17 626.95 1051.06 625.14 1048.17 622 L 1027.58 599 C 1027 597.72 1027 596.28 1027.58 595 L 1048.17 572 Z',\n // Display,\n 'Display': 'M47.8809,19.2914 L32.7968,-0.00594145 L11.3902,-0.00594145 C7.93166,-0.00594145 0.00124586,11.187 0.00124586,24.9968' +\n 'C0.00124586,38.8032 7.93166,49.9962 11.3902,49.9962 L32.7968,49.99 L47.615,31.038 C47.615,31.0388 52.798,24.9968 47.880,19.2914 z',\n // ManualInput,\n 'ManualInput': 'M 912 732 L 1006.85 707 C 1008.2 707 1009.5 707.53 1010.46 708.46 C 1011.41 709.4 1011.95 710.67 1011.95 712' +\n ' L 1011.95 762C 1012 764.41 1010.28 766.52 1007.87 767 L 917.1 767 C 915.75 767 914.45 766.47 913.49 765.54' +\n ' C 912.54 764.6 912 763.33 912 762 L 912 732 Z',\n // LoopLimit,\n 'LoopLimit': 'M 8 9 L 27 9 L 33 15 L 33 26 C 33 27 33 27 32 27 L 4 27 C 3 27 2 27 2 26 L 2 15 L 8 9 Z',\n // StoredData\n 'StoredData': 'M 5.55 0L 50 0A 1.5,30 0 0,1 50,0A 5.555,25 0 0,0 50,50A 1.5,30 0 0,1 50,50L 5.555 50A 5.55,25 0 0,1 5.555,0Z',\n};\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Property, ChildProperty } from '@syncfusion/ej2-base';\nimport { Tooltip } from '@syncfusion/ej2-popups';\n/**\n * Defines the behavior of Tooltip\n */\nvar DiagramTooltip = /** @class */ (function (_super) {\n __extends(DiagramTooltip, _super);\n function DiagramTooltip() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('')\n ], DiagramTooltip.prototype, \"content\", void 0);\n __decorate([\n Property('TopLeft')\n ], DiagramTooltip.prototype, \"position\", void 0);\n __decorate([\n Property('Mouse')\n ], DiagramTooltip.prototype, \"relativeMode\", void 0);\n __decorate([\n Property(true)\n ], DiagramTooltip.prototype, \"showTipPointer\", void 0);\n __decorate([\n Property('auto')\n ], DiagramTooltip.prototype, \"width\", void 0);\n __decorate([\n Property('auto')\n ], DiagramTooltip.prototype, \"height\", void 0);\n __decorate([\n Property()\n ], DiagramTooltip.prototype, \"animation\", void 0);\n return DiagramTooltip;\n}(ChildProperty));\nexport { DiagramTooltip };\n/**\n * @private\n * defines the Tooltip.\n * @param diagram\n */\nexport function initTooltip(diagram) {\n var tooltipOption = new Tooltip;\n tooltipOption = updateTooltipContent(diagram.tooltip, tooltipOption);\n var tooltip = new Tooltip(tooltipOption);\n tooltip.beforeCollision = beforeCollision;\n tooltip.beforeOpen = beforeOpen;\n tooltip.cssClass = 'e-diagram-tooltip';\n tooltip.opensOn = 'custom';\n tooltip.appendTo('#' + diagram.element.id);\n tooltip.close();\n return tooltip;\n}\nfunction beforeOpen(args) {\n if ((this.content === '' || this.content === undefined)) {\n args.element.style.display = 'none';\n }\n}\nfunction beforeCollision(args) {\n if ((args.collidedPosition && args.collidedPosition !== this.position)) {\n args.element.style.display = 'none';\n }\n}\n/**\n * @private\n * updates the contents of the tooltip.\n * @param diagram\n * @param node\n */\nexport function updateTooltip(diagram, node) {\n var tooltip;\n var tooltipObject = diagram.tooltipObject;\n tooltip = node ? node.tooltip : diagram.tooltip;\n updateTooltipContent(tooltip, tooltipObject);\n return tooltipObject;\n}\nfunction updateTooltipContent(tooltip, tooltipObject) {\n if (tooltip.content) {\n tooltipObject.content = tooltip.content;\n tooltipObject.position = tooltip.position;\n tooltipObject.showTipPointer = tooltip.showTipPointer;\n tooltipObject.width = tooltip.width;\n tooltipObject.height = tooltip.height;\n if (!tooltip.animation) {\n tooltipObject.animation = { close: { effect: 'None' } };\n }\n else {\n tooltipObject.animation = tooltip.animation;\n }\n }\n else {\n tooltipObject.close();\n }\n return tooltipObject;\n}\n","import { Point } from './../primitives/point';\nimport { getPoints, intersect3 } from './diagram-util';\nimport { NoOfSegments } from '../enum/enum';\nimport { StraightSegment, BezierSegment, OrthogonalSegment } from './../objects/connector';\nimport { PathElement } from './../core/elements/path-element';\n/**\n * Connector modules are used to dock and update the connectors\n */\n/** @private */\nexport function findConnectorPoints(element, layoutOrientation) {\n var intermeditatePoints;\n var sourcePoint;\n if (element.type === 'Straight' || !element.sourceWrapper) {\n sourcePoint = getSourcePoint(element);\n }\n else {\n sourcePoint = element.sourceWrapper.corners.center;\n }\n intermeditatePoints = terminateConnection(element, sourcePoint, element.targetPoint, layoutOrientation);\n setLineEndPoint(element, intermeditatePoints[0], false);\n setLineEndPoint(element, intermeditatePoints[intermeditatePoints.length - 1], true);\n return intermeditatePoints;\n}\nfunction getSourcePoint(element) {\n var srcPoint;\n if (element.sourcePortWrapper) {\n var srcPort = element.sourcePortWrapper;\n var srcNode = element.sourceWrapper;\n var pt = { x: srcPort.offsetX, y: srcPort.offsetY };\n var direction = getPortDirection(pt, srcNode.corners, srcNode.bounds, false);\n srcPoint = pt;\n }\n else if (element.sourceID && element.sourceWrapper) {\n if (element.targetWrapper) {\n var sPoint = element.sourceWrapper.corners.center;\n var tPoint = element.targetWrapper.corners.center;\n srcPoint = getIntersection(element, element.sourceWrapper, sPoint, tPoint, false);\n }\n else {\n srcPoint = element.sourcePoint;\n }\n }\n else {\n srcPoint = element.sourcePoint;\n }\n return srcPoint;\n}\nfunction getDirection(source, target, layoutOrientation) {\n if (layoutOrientation === 'LeftToRight') {\n source.direction = source.direction ? source.direction : 'Right';\n target.direction = target.direction ? target.direction : 'Left';\n }\n else if (layoutOrientation === 'RightToLeft') {\n source.direction = source.direction ? source.direction : 'Left';\n target.direction = target.direction ? target.direction : 'Right';\n }\n else if (layoutOrientation === 'TopToBottom') {\n source.direction = source.direction ? source.direction : 'Bottom';\n target.direction = target.direction ? target.direction : 'Top';\n }\n else if (layoutOrientation === 'BottomToTop') {\n source.direction = source.direction ? source.direction : 'Top';\n target.direction = target.direction ? target.direction : 'Bottom';\n }\n}\nfunction terminateConnection(element, srcPoint, tarPoint, layoutOrientation) {\n var sourceNode = element.sourceWrapper;\n var targetNode = element.targetWrapper;\n var sourcePort = element.sourcePortWrapper;\n var targetPort = element.targetPortWrapper;\n var srcCorner;\n var tarCorner;\n var intermeditatePoints = [];\n var segPoint;\n var srcDir;\n var tarDir;\n var sourceMargin = { left: 5, right: 5, bottom: 5, top: 5 };\n var targetMargin = { left: 5, right: 5, bottom: 5, top: 5 };\n var source = { corners: srcCorner, point: srcPoint, direction: srcDir, margin: sourceMargin };\n var target = { corners: tarCorner, point: tarPoint, direction: tarDir, margin: targetMargin };\n if (sourceNode !== undefined && targetNode !== undefined) {\n source.corners = sourceNode.corners;\n target.corners = targetNode.corners;\n }\n if (sourcePort !== undefined) {\n var port = { x: sourcePort.offsetX, y: sourcePort.offsetY };\n source.direction = getPortDirection(port, source.corners, sourceNode.bounds, false);\n }\n if (targetPort !== undefined) {\n var tarPortPt = { x: targetPort.offsetX, y: targetPort.offsetY };\n target.direction = getPortDirection(tarPortPt, target.corners, targetNode.bounds, false);\n }\n if (sourceNode !== undefined && targetNode !== undefined) {\n if (source.direction === undefined || target.direction === undefined) {\n if (layoutOrientation) {\n getDirection(source, target, layoutOrientation);\n }\n else {\n if (source.corners.topCenter.y > target.corners.bottomCenter.y &&\n Math.abs(source.corners.topCenter.y - target.corners.bottomCenter.y) >\n (source.margin.top + source.margin.bottom)) {\n source.direction = source.direction ? source.direction : 'Top';\n target.direction = target.direction ? target.direction : 'Bottom';\n }\n else if (source.corners.bottomCenter.y < target.corners.topCenter.y &&\n Math.abs(source.corners.bottomCenter.y - target.corners.topCenter.y) >\n (source.margin.bottom + source.margin.top)) {\n source.direction = source.direction ? source.direction : 'Bottom';\n target.direction = target.direction ? target.direction : 'Top';\n }\n else if (source.corners.middleRight.x < target.corners.middleLeft.x &&\n Math.abs(source.corners.middleRight.x - target.corners.middleLeft.x) >\n (source.margin.right + source.margin.left)) {\n source.direction = source.direction ? source.direction : 'Right';\n target.direction = target.direction ? target.direction : 'Left';\n }\n else if (source.corners.middleLeft.x > target.corners.middleRight.x &&\n Math.abs(source.corners.middleLeft.x - target.corners.middleRight.x) >\n (source.margin.left + source.margin.right)) {\n source.direction = source.direction ? source.direction : 'Left';\n target.direction = target.direction ? target.direction : 'Right';\n }\n else {\n if (sourceNode.id !== targetNode.id && (!source.corners.equals(source.corners, target.corners)) &&\n target.corners.containsPoint(source.corners.topCenter, source.margin.top)) {\n source.direction = source.direction ? source.direction : 'Bottom';\n target.direction = target.direction ? target.direction : 'Top';\n }\n else {\n source.direction = source.direction ? source.direction : 'Top';\n target.direction = target.direction ? target.direction : 'Bottom';\n }\n }\n }\n }\n return defaultOrthoConnection(element, source.direction, target.direction, source.point, target.point);\n }\n //It will be called only when there is only one end node\n checkLastSegmentasTerminal(element);\n if (element.sourceWrapper || element.targetWrapper) {\n connectToOneEnd(element, source, target);\n }\n if (element.type === 'Straight' || element.type === 'Bezier') {\n intermeditatePoints = intermeditatePointsForStraight(element, source, target);\n }\n else {\n if (element.type === 'Orthogonal' && element.segments && element.segments.length > 0 &&\n element.segments[0].length !== null &&\n element.segments[0].direction !== null) {\n intermeditatePoints = findPointToPointOrtho(element, source, target, sourceNode, targetNode, sourcePort, targetPort);\n }\n else {\n if (!source.direction) {\n source.direction = (target.direction) ? ((element.targetPortWrapper !== undefined) ? target.direction : getOppositeDirection(target.direction)) :\n Point.direction(source.point, target.point);\n }\n element.segments[0].points = intermeditatePoints = orthoConnection3Segment(element, source, target);\n }\n }\n return intermeditatePoints;\n}\nfunction updateSegmentPoints(source, segment) {\n var segPoint;\n var angle;\n var extra;\n source.direction = segment.direction;\n segment.points = [];\n segment.points.push(source.point);\n extra = (segment.direction === 'Left' || segment.direction === 'Top') ? -(segment.length) : segment.length;\n angle = (segment.direction === 'Left' || segment.direction === 'Right') ? 0 : 90;\n segPoint = addLineSegment(source.point, extra, angle);\n segment.points.push(segPoint);\n return segPoint;\n}\nfunction pointToPoint(element, source, target) {\n var point;\n var direction;\n var portdirection;\n source.corners = (element.sourceWrapper) ? element.sourceWrapper.corners : undefined;\n if (element.sourcePortWrapper) {\n var port = { x: element.sourcePortWrapper.offsetX, y: element.sourcePortWrapper.offsetY };\n portdirection = getPortDirection(port, source.corners, element.sourceWrapper.bounds, false);\n if (source.corners && (source.direction === 'Bottom' || source.direction === 'Top')) {\n if (target.point.x > source.corners.middleLeft.x && target.point.x < source.corners.middleRight.x) {\n direction = (source.point.y > target.point.y) ? 'Top' : 'Bottom';\n }\n }\n else if (source.corners && (source.direction === 'Left' || source.direction === 'Right')) {\n if (target.point.y > source.corners.topCenter.y && target.point.y < source.corners.bottomCenter.y) {\n direction = (source.point.x > target.point.x) ? 'Left' : 'Right';\n }\n }\n }\n if (element.sourcePortWrapper && portdirection === getOppositeDirection(direction)) {\n var length_1;\n if ((portdirection === 'Left' || portdirection === 'Right') && (source.point.y >= source.corners.topCenter.y\n && source.point.y <= source.corners.center.y) &&\n (target.point.y >= source.corners.topCenter.y && target.point.y <= source.corners.center.y)) {\n source.direction = 'Top';\n length_1 = source.point.y - source.corners.topCenter.y + 20;\n }\n else if ((portdirection === 'Left' || portdirection === 'Right') && (source.point.y > source.corners.center.y\n && source.point.y <= source.corners.bottomCenter.y) &&\n (target.point.y > source.corners.center.y && target.point.y <= source.corners.bottomCenter.y)) {\n source.direction = 'Bottom';\n length_1 = source.corners.bottomCenter.y - source.point.y + 20;\n }\n else if ((portdirection === 'Top' || portdirection === 'Bottom') && (source.point.x >= source.corners.middleLeft.x\n && source.point.x <= source.corners.center.x) &&\n (target.point.x >= source.corners.middleLeft.x && target.point.x <= source.corners.center.x)) {\n source.direction = 'Left';\n length_1 = source.point.x - source.corners.middleLeft.x + 20;\n }\n else if ((portdirection === 'Top' || portdirection === 'Bottom') && (source.point.x <= source.corners.middleRight.x\n && source.point.x > source.corners.center.x) &&\n (target.point.x <= source.corners.middleRight.x && target.point.x < source.corners.center.x)) {\n source.direction = 'Right';\n length_1 = source.corners.middleRight.x - source.point.x + 20;\n }\n if (source.direction && length_1) {\n point = orthoConnection3Segment(element, source, target, length_1, true);\n }\n }\n else {\n source.direction = (direction) ? direction : findSourceDirection(source.direction, source.point, target.point);\n point = orthoConnection2Segment(source, target);\n }\n return point;\n}\nfunction pointToNode(element, source, target) {\n var point;\n target.corners = element.targetWrapper.corners;\n findDirection(element.targetWrapper, source, target, element);\n var direction = findSourceDirection(target.direction, source.point, target.point);\n if (source.direction === target.direction && (source.direction === 'Left' || source.direction === 'Right')) {\n source.direction = direction;\n point = orthoConnection3Segment(element, source, target, element.targetWrapper.width / 2 + 20);\n var source1 = source;\n source1.point = point[1];\n findDirection(element.targetWrapper, source, target, element);\n point = orthoConnection3Segment(element, source, target);\n }\n else {\n source.direction = direction;\n point = orthoConnection2Segment(source, target);\n }\n return point;\n}\nfunction addPoints(element, source, target) {\n var refPoint;\n target.corners = element.targetWrapper.corners;\n var direction;\n var length;\n if (source.direction !== 'Left' && source.direction !== 'Right') {\n if (target.corners.center.y === source.point.y &&\n (!(target.corners.middleLeft.x <= source.point.x && source.point.x <= target.corners.middleRight.x))) {\n direction = 'Top';\n length = target.corners.height / 2 + 20;\n }\n else if ((target.corners.center.y === source.point.y &&\n element.segments[element.segments.length - 2].direction === 'Bottom') ||\n (target.corners.center.y > source.point.y && source.point.y >= target.corners.topCenter.y)) {\n direction = 'Top';\n length = (source.point.y - target.corners.topCenter.y) + 20;\n }\n else if ((target.corners.center.y === source.point.y &&\n element.segments[element.segments.length - 2].direction === 'Top') ||\n (target.corners.center.y < source.point.y && source.point.y <= target.corners.bottomCenter.y)) {\n direction = 'Bottom';\n length = (target.corners.bottomCenter.y - source.point.y) + 20;\n }\n else if (element.sourcePortWrapper !== undefined && element.targetPortWrapper !== undefined &&\n source.corners.topCenter.y <= source.point.y && source.point.y <= source.corners.bottomCenter.y) {\n direction = source.direction;\n length = (source.point.y > target.point.y) ? (source.point.y - source.corners.topCenter.y + 20) :\n (source.corners.bottomCenter.y - source.point.y + 20);\n }\n }\n else {\n if (target.corners.center.x === source.point.x &&\n (!(target.corners.topCenter.y < source.point.y && source.point.y <= target.corners.bottomCenter.y))) {\n direction = 'Left';\n length = target.corners.width / 2 + 20;\n }\n else if ((target.corners.center.x === source.point.x &&\n element.segments[element.segments.length - 2].direction === 'Right')\n || (target.corners.center.x > source.point.x && source.point.x >= target.corners.middleLeft.x)) {\n direction = 'Left';\n length = (source.point.x - target.corners.middleLeft.x) + 20;\n }\n else if ((target.corners.center.x === source.point.x &&\n element.segments[element.segments.length - 2].direction === 'Left') ||\n (target.corners.center.x <= source.point.x && source.point.x <= target.corners.middleRight.x)) {\n direction = 'Right';\n length = (target.corners.middleRight.x - source.point.x) + 20;\n }\n else if (element.sourcePortWrapper !== undefined && element.targetPortWrapper !== undefined &&\n source.corners.middleLeft.x <= source.point.x && source.point.x <= source.corners.middleRight.x) {\n direction = source.direction;\n length = (source.point.x > target.point.x) ? (source.point.x - source.corners.middleLeft.x + 20) :\n (source.corners.middleRight.x - source.point.x + 20);\n }\n }\n var extra = (direction === 'Left' || direction === 'Top') ? -(length) : length;\n var angle = (direction === 'Left' || direction === 'Right') ? 0 : 90;\n refPoint = source.point;\n source.point = addLineSegment(source.point, extra, angle);\n source.direction = Point.direction(source.point, target.point);\n if (element.sourcePortWrapper !== undefined && element.targetPortWrapper !== undefined &&\n (source.corners.center.x === target.corners.center.x || source.corners.center.y === target.corners.center.y)) {\n source.direction = target.direction;\n }\n var point = orthoConnection3Segment(element, source, target);\n point.splice(0, 0, refPoint);\n return point;\n}\nfunction findSegmentDirection(element, source, target, portDir) {\n var update = false;\n switch (target.direction) {\n case 'Left':\n if (element.sourcePortWrapper !== undefined && element.targetPortWrapper !== undefined && (portDir === 'Right' &&\n source.point.x > target.point.x && source.point.y >= source.corners.topCenter.y &&\n source.point.y <= source.corners.bottomCenter.y)\n || (((portDir === 'Bottom' && source.point.y > target.point.y) ||\n (portDir === 'Top' && source.point.y < target.point.y)) &&\n source.point.x >= source.corners.middleLeft.x && source.point.x <= source.corners.middleRight.x)) {\n source.direction = (portDir === 'Right') ? ((source.point.y > target.point.y) ? 'Top' : 'Bottom') :\n (source.point.x < target.point.x ? 'Right' : 'Left');\n update = true;\n }\n else if (source.point.x > target.point.x && (source.point.y > target.point.y || source.point.y < target.point.y)\n && (!(target.corners.topCenter.y > source.point.y && target.corners.bottomCenter.y < source.point.y))) {\n source.direction = 'Left';\n }\n else if ((source.point.x < target.point.x && source.point.y > target.point.y) ||\n (source.point.x > target.point.x && (source.point.y <= target.point.y)\n && ((target.corners.topCenter.y < source.point.y && target.corners.center.y >= source.point.y)))) {\n source.direction = 'Top';\n }\n else if ((source.point.x < target.point.x && source.point.y < target.point.y) ||\n (source.point.x > target.point.x && (source.point.y > target.point.y)\n && ((target.corners.bottomCenter.y < source.point.y && target.corners.center.y > source.point.y)))) {\n source.direction = 'Bottom';\n }\n else if (source.point.y === target.point.y && source.point.x < target.point.x) {\n source.direction = 'Right';\n }\n break;\n case 'Right':\n if (element.sourcePortWrapper !== undefined && element.targetPortWrapper !== undefined &&\n ((portDir === 'Bottom' && source.point.y > target.point.y) ||\n (portDir === 'Top' && source.point.y < target.point.y)) && source.point.x > target.point.x &&\n (source.point.x >= source.corners.middleLeft.x && source.point.x <= source.corners.middleRight.x)) {\n source.direction = (source.point.x > target.point.x) ? 'Left' : 'Right';\n update = true;\n }\n else if (element.sourcePortWrapper !== undefined && element.targetPortWrapper !== undefined &&\n portDir === 'Left' && source.point.x < target.point.x && (source.point.y >= source.corners.topCenter.y &&\n source.point.y <= source.corners.bottomCenter.y)) {\n source.direction = (source.point.y > target.point.y) ? 'Top' : 'Bottom';\n update = true;\n }\n else if (source.point.x < target.point.x && target.corners.topCenter.y <= source.point.y\n && target.corners.bottomCenter.y >= source.point.y && source.point.y === target.point.y) {\n source.direction = 'Top';\n }\n else if (source.point.y > target.point.y && source.point.x > target.point.x) {\n source.direction = 'Top';\n }\n else if (source.point.y < target.point.y && source.point.x > target.point.x) {\n source.direction = 'Bottom';\n }\n else if (source.point.x < target.point.x && (source.point.y > target.point.y ||\n source.point.y < target.point.y)) {\n source.direction = 'Right';\n }\n else if (source.point.y === target.point.y && source.point.x > target.point.x) {\n source.direction = 'Left';\n }\n break;\n case 'Top':\n if (element.sourcePortWrapper !== undefined && element.targetPortWrapper !== undefined && (portDir === 'Bottom' &&\n source.point.y > target.point.y && source.point.x >= source.corners.middleLeft.x &&\n source.point.x <= source.corners.middleRight.x) || (((portDir === 'Right' && source.point.x > target.point.x) ||\n (portDir === 'Left' && target.point.y > source.point.y && target.point.x > source.point.x)) &&\n (source.point.y >= source.corners.topCenter.y && source.point.y <= source.corners.bottomCenter.y))) {\n source.direction = (portDir === 'Bottom') ? ((source.point.x > target.point.x) ? 'Left' : 'Right') :\n (source.point.y < target.point.y) ? 'Bottom' : 'Top';\n update = true;\n }\n else if (source.point.x === target.point.x && source.point.y < target.point.y) {\n source.direction = 'Bottom';\n }\n else if (source.point.y > target.point.y && source.point.x > target.corners.middleLeft.x &&\n source.point.x < target.corners.middleRight.x) {\n source.direction = 'Left';\n }\n else if (source.point.y >= target.point.y) {\n source.direction = 'Top';\n }\n else if (source.point.y < target.point.y && source.point.x > target.point.x) {\n source.direction = 'Left';\n }\n else if (source.point.y < target.point.y && source.point.x < target.point.x) {\n source.direction = 'Right';\n }\n break;\n case 'Bottom':\n if (element.sourcePortWrapper !== undefined && element.targetPortWrapper !== undefined && ((((portDir === 'Right') ||\n (portDir === 'Left' && target.point.x > source.point.x)) && (source.point.y > target.point.y) &&\n source.point.y >= source.corners.topCenter.y && source.point.y <= source.corners.bottomCenter.y) ||\n (((portDir === 'Top' && source.point.y < target.point.y)) &&\n (source.point.x >= source.corners.middleLeft.x && source.point.x <= source.corners.middleRight.x)))) {\n if (portDir === 'Right' || portDir === 'Left') {\n source.direction = (source.point.y > target.point.y) ? 'Top' : 'Bottom';\n }\n else {\n source.direction = (source.point.x > target.point.x) ? 'Left' : 'Right';\n }\n update = true;\n }\n else if (source.point.y < target.point.y && source.point.x > target.corners.middleLeft.x &&\n target.corners.middleRight.x > source.point.x) {\n if (source.point.y < target.point.y && source.point.x > target.corners.middleLeft.x &&\n target.corners.center.x >= source.point.x) {\n source.direction = 'Left';\n }\n else if (source.point.y < target.point.y && source.point.x < target.corners.middleRight.x &&\n target.corners.center.x < source.point.x) {\n source.direction = 'Right';\n }\n }\n else if (source.point.y > target.point.y && source.point.x > target.point.x) {\n source.direction = 'Left';\n }\n else if (source.point.y > target.point.y && source.point.x < target.point.x) {\n source.direction = 'Right';\n }\n else if (source.point.y <= target.point.y && (source.point.x > target.point.x || target.point.x > source.point.x)) {\n source.direction = 'Bottom';\n }\n break;\n }\n return update;\n}\nfunction pointToPort(element, source, target) {\n var point;\n target.corners = element.targetWrapper.corners;\n var portdirection;\n var length;\n if (element.sourcePortWrapper !== undefined) {\n var port = { x: element.sourcePortWrapper.offsetX, y: element.sourcePortWrapper.offsetY };\n portdirection = getPortDirection(port, source.corners, element.sourceWrapper.bounds, false);\n }\n var update = findSegmentDirection(element, source, target, portdirection);\n if (element.sourcePortWrapper !== undefined && element.targetPortWrapper !== undefined &&\n target.direction === getOppositeDirection(portdirection) &&\n ((((target.direction === 'Left' && source.point.x > target.point.x) || (target.direction === 'Right' &&\n source.point.x < target.point.x)) && source.point.y >= source.corners.topCenter.y &&\n source.point.y <= source.corners.bottomCenter.y) || (target.direction === 'Bottom' && source.point.y < target.point.y &&\n (source.point.x >= source.corners.middleLeft.x && source.point.x <= source.corners.middleRight.x)))) {\n point = addPoints(element, source, target);\n }\n else if (source.direction === target.direction) {\n point = orthoConnection3Segment(element, source, target);\n }\n else if ((((target.direction === 'Left' && source.point.x > target.point.x) ||\n (target.direction === 'Right' && source.point.x < target.point.x)) && (source.direction === 'Top' || source.direction === 'Bottom')\n && ((source.point.y <= target.point.y) &&\n ((target.corners.topCenter.y <= source.point.y && target.corners.bottomCenter.y >= source.point.y)))) ||\n ((target.direction === 'Top' && source.point.y > target.point.y) ||\n (target.direction === 'Bottom' && source.point.y < target.point.y) &&\n ((target.corners.middleLeft.x <= source.point.x && target.corners.middleRight.x >= source.point.x)))) {\n point = addPoints(element, source, target);\n }\n else {\n if (element.sourceWrapper !== undefined && element.targetWrapper !== undefined && element.targetPortWrapper !== undefined &&\n ((source.direction === 'Left' || source.direction === 'Right') &&\n (source.point.y >= source.corners.topCenter.y && source.point.y <= source.corners.bottomCenter.y)\n && (target.direction === 'Top' || target.direction === 'Bottom') &&\n (target.corners.center.x === source.corners.center.x))) {\n source.direction = (target.direction === 'Top') ? 'Bottom' : 'Top';\n length = (target.direction === 'Top') ? (source.corners.bottomCenter.y - source.point.y + 20) :\n (source.point.y - source.corners.topCenter.y + 20);\n point = orthoConnection3Segment(element, source, target, length);\n }\n else if (element.sourceWrapper !== undefined && element.targetWrapper !== undefined && element.targetPortWrapper !== undefined &&\n ((source.direction === 'Top' || source.direction === 'Bottom') &&\n (source.point.x >= source.corners.middleLeft.x && source.point.x <= source.corners.middleRight.x) &&\n (target.direction === 'Left' || target.direction === 'Right') && (target.corners.center.y === source.corners.center.y))) {\n source.direction = (target.direction === 'Left') ? 'Right' : 'Left';\n length = (target.direction === 'Left') ? (source.corners.middleRight.x - source.point.x + 20) :\n (source.point.x - source.corners.middleLeft.x + 20);\n point = orthoConnection3Segment(element, source, target, length);\n }\n else if (update) {\n if (source.direction === 'Left' || source.direction === 'Right') {\n length = (source.direction === 'Left') ? (source.point.x - source.corners.middleLeft.x + 20) :\n (source.corners.middleRight.x - source.point.x + 20);\n }\n else {\n length = (source.direction === 'Top') ? (source.point.y - source.corners.topCenter.y + 20) :\n (source.corners.bottomCenter.y - source.point.y + 20);\n }\n point = orthoConnection3Segment(element, source, target, length);\n }\n else {\n point = orthoConnection2Segment(source, target);\n }\n }\n return point;\n}\nfunction findPointToPointOrtho(element, source, target, sourceNode, targetNode, sourcePort, targetPort) {\n var j;\n var point;\n var intermeditatePoints = [];\n var direction;\n var port;\n var seg;\n checkLastSegmentasTerminal(element);\n var removeSegment;\n if (element.segments.length > 0) {\n for (var i = 0; i < element.segments.length; i++) {\n var seg_1 = element.segments[i];\n if (i === 0 && element.sourcePortWrapper !== undefined) {\n port = { x: sourcePort.offsetX, y: sourcePort.offsetY };\n direction = getPortDirection(port, sourceNode.corners, sourceNode.bounds, false);\n if (seg_1.direction === getOppositeDirection(direction)) {\n seg_1.direction = direction;\n }\n }\n if (i > 0 && element.segments[i - 1].direction === seg_1.direction) {\n i = checkConsectiveSegmentAsSame(element, i, source);\n }\n else {\n var lastSegment = element.segments[i - 1];\n source.point = (seg_1.direction) ? updateSegmentPoints(source, seg_1) :\n lastSegment.points[lastSegment.points.length - 1];\n }\n if (i === element.segments.length - 1) {\n if (!targetPort && !targetNode) {\n point = pointToPoint(element, source, target);\n }\n else if (element.targetWrapper && element.targetPortWrapper === undefined) {\n checkSourcePointInTarget(element, source);\n point = pointToNode(element, source, target);\n }\n else {\n point = pointToPort(element, source, target);\n }\n checkPreviousSegment(point, element, source);\n seg_1.points = [];\n if (point.length >= 2) {\n for (j = 0; j < point.length; j++) {\n seg_1.points.push(point[j]);\n }\n }\n else {\n removeSegment = i;\n }\n }\n if (sourcePort && i === 0) {\n var sourcePoint = checkPortdirection(element, sourcePort, sourceNode);\n if (sourcePoint) {\n source.point = sourcePoint;\n }\n }\n }\n if (removeSegment !== undefined) {\n if (removeSegment === element.segments.length - 1) {\n element.segments[removeSegment - 1].direction = null;\n element.segments[removeSegment - 1].length = null;\n }\n element.segments.splice(removeSegment, 1);\n }\n intermeditatePoints = returnIntermeditatePoints(element, intermeditatePoints);\n }\n return intermeditatePoints;\n}\nfunction checkPortdirection(element, sourcePort, sourceNode) {\n var port = { x: sourcePort.offsetX, y: sourcePort.offsetY };\n var point;\n var direction = getPortDirection(port, sourceNode.corners, sourceNode.bounds, false);\n var seg = element.segments[0];\n if (seg.direction !== direction) {\n pointsFromNodeToPoint(seg, direction, sourceNode.corners, seg.points[0], seg.points[seg.points.length - 1], false);\n point = seg.points[seg.points.length - 1];\n seg.direction = Point.direction(seg.points[seg.points.length - 2], seg.points[seg.points.length - 1]);\n }\n return point;\n}\nfunction checkPreviousSegment(tPoints, connector, source) {\n var actualSegment = connector.segments[connector.segments.length - 2];\n var actualLastPoint = actualSegment.points[actualSegment.points.length - 1];\n var direction;\n if (((actualSegment.direction === 'Top' || actualSegment.direction === 'Bottom') && (actualLastPoint.x === tPoints[1].x)) ||\n ((actualSegment.direction === 'Left' || actualSegment.direction === 'Right') && (actualLastPoint.y === tPoints[1].y))) {\n actualSegment.points[actualSegment.points.length - 1] = tPoints[1];\n direction = Point.direction(actualSegment.points[0], actualSegment.points[actualSegment.points.length - 1]);\n if (connector.sourceWrapper !== undefined && connector.sourcePortWrapper === undefined &&\n direction === getOppositeDirection(actualSegment.direction)) {\n if (actualSegment.direction === 'Left' || actualSegment.direction === 'Right') {\n actualSegment.points[0].x = (actualSegment.direction === 'Right') ?\n actualSegment.points[0].x - connector.sourceWrapper.corners.width :\n actualSegment.points[0].x + connector.sourceWrapper.corners.width;\n }\n else {\n actualSegment.points[0].y = (actualSegment.direction === 'Bottom') ?\n actualSegment.points[0].y - connector.sourceWrapper.corners.height :\n actualSegment.points[0].y + connector.sourceWrapper.corners.height;\n }\n }\n actualSegment.direction = direction;\n actualSegment.length = Point.distancePoints(actualSegment.points[0], actualSegment.points[actualSegment.points.length - 1]);\n tPoints.splice(0, 1);\n }\n}\nfunction connectToOneEnd(element, source, target) {\n var sourcePort = element.sourcePortWrapper;\n var targetPort = element.targetPortWrapper;\n var node = element.sourceWrapper;\n var fixedPoint = source.point;\n var nodeMargin = { left: 0, right: 0, top: 0, bottom: 0 };\n var nodeConnectingPoint = { x: 0, y: 0 };\n var refPoint;\n var nodeDirection = 'Top';\n if (!node) {\n node = element.targetWrapper;\n nodeMargin = target.margin;\n }\n else {\n fixedPoint = target.point;\n nodeMargin = source.margin;\n }\n if (element.type === 'Orthogonal') {\n if ((element.segments && element.segments.length > 0) && element.sourceWrapper &&\n element.segments[0].direction) {\n source.direction = element.segments[0].direction;\n nodeConnectingPoint = findPoint(node.corners, source.direction);\n refPoint = findEndPoint(source.direction, nodeConnectingPoint, node);\n nodeConnectingPoint = getIntersection(element, node, nodeConnectingPoint, refPoint, false);\n }\n else {\n var source_1 = { corners: null, direction: null, point: fixedPoint, margin: nodeMargin };\n var target_1 = { corners: null, direction: null, point: null, margin: null };\n findDirection(node, source_1, target_1, element);\n nodeConnectingPoint = target_1.point;\n nodeDirection = target_1.direction;\n }\n }\n else {\n var segmentPoint = void 0;\n if (element.segments && element.segments.length > 1) {\n if (node === element.sourceWrapper) {\n segmentPoint = element.segments[0].point;\n }\n else {\n segmentPoint = element.segments[element.segments.length - 2].point;\n }\n }\n nodeConnectingPoint = getIntersection(element, node, node.bounds.center, (element.segments && element.segments.length > 1) ? segmentPoint : fixedPoint, node === element.targetWrapper);\n }\n if (node === element.sourceWrapper) {\n source.direction = source.direction || nodeDirection;\n source.point = nodeConnectingPoint;\n if (element.sourcePortWrapper) {\n source.point = { x: sourcePort.offsetX, y: sourcePort.offsetY };\n }\n }\n else {\n target.direction = target.direction || nodeDirection;\n target.point = nodeConnectingPoint;\n if (element.targetPortWrapper) {\n target.point = { x: targetPort.offsetX, y: targetPort.offsetY };\n }\n }\n}\nfunction checkSourceAndTargetIntersect(sourceWrapper, targetWrapper) {\n var sourceSegment = createSegmentsCollection(sourceWrapper);\n var targetSegment = createSegmentsCollection(targetWrapper);\n for (var i = 0; i < sourceSegment.length - 1; i++) {\n var srcSegment = sourceSegment[i];\n for (var j = 0; j < targetSegment.length - 1; j++) {\n var tarSegmet = targetSegment[j];\n if (intersect3(srcSegment, tarSegmet).enabled) {\n return true;\n }\n }\n }\n return false;\n}\nfunction createSegmentsCollection(sourceWrapper) {\n var segments = [];\n var points = getPoints(sourceWrapper, sourceWrapper.corners);\n points.push(points[0]);\n for (var i = 0; i < points.length - 1; i++) {\n segments.push(createLineSegment(points[i], points[i + 1]));\n }\n return segments;\n}\nfunction createLineSegment(sPt, tPt) {\n var line = { X1: sPt.x, Y1: sPt.y, X2: tPt.x, Y2: tPt.y };\n return line;\n}\n/* tslint:disable */\nfunction defaultOrthoConnection(ele, srcDir, tarDir, sPt, tPt) {\n var sourceEle = ele.sourceWrapper;\n var targetEle = ele.targetWrapper;\n var srcPort = ele.sourcePortWrapper;\n var tarPort = ele.targetPortWrapper;\n var intermeditatePoints = [];\n var refPoint;\n var seg;\n var srcCor = sourceEle.corners;\n var tarCor = targetEle.corners;\n var point = tarCor.center;\n var i;\n var sourceMargin = { left: 5, right: 5, bottom: 5, top: 5 };\n var targetMargin = { left: 5, right: 5, bottom: 5, top: 5 };\n var source = { corners: srcCor, point: sPt, direction: srcDir, margin: sourceMargin };\n var target = { corners: tarCor, point: tPt, direction: tarDir, margin: targetMargin };\n var isInterSect = false;\n if (ele.sourceWrapper && ele.targetWrapper) {\n isInterSect = checkSourceAndTargetIntersect(ele.sourceWrapper, ele.targetWrapper);\n }\n if (srcPort !== undefined) {\n source.point = { x: srcPort.offsetX, y: srcPort.offsetY };\n switch (source.direction) {\n case 'Bottom':\n case 'Top':\n source.point.y = source.point.y;\n break;\n case 'Left':\n case 'Right':\n source.point.x = source.point.x;\n break;\n }\n }\n else {\n if (ele.type === 'Orthogonal') {\n if (ele.segments && ele.segments.length > 0 && ele.segments[0].direction) {\n source.direction = ele.segments[0].direction;\n }\n source.point = findPoint(source.corners, source.direction);\n refPoint = findEndPoint(source.direction, source.point, sourceEle);\n source.point = getIntersection(ele, sourceEle, source.point, refPoint, false);\n }\n else {\n source.point = sourceEle.corners.center;\n }\n }\n if (tarPort !== undefined) {\n target.point = {\n x: tarPort.offsetX,\n y: tarPort.offsetY\n };\n switch (target.direction) {\n case 'Bottom':\n case 'Top':\n target.point.y = target.point.y;\n break;\n case 'Left':\n case 'Right':\n target.point.x = target.point.x;\n break;\n }\n }\n else {\n if (ele.type === 'Orthogonal') {\n target.point = findPoint(target.corners, target.direction);\n refPoint = findEndPoint(target.direction, target.point, targetEle);\n target.point = getIntersection(ele, targetEle, target.point, refPoint, true);\n }\n else {\n target.point = targetEle.corners.center;\n }\n }\n if (ele.type !== 'Orthogonal') {\n var segment = void 0;\n var first = void 0;\n checkLastSegmentasTerminal(ele);\n if (ele.sourcePortWrapper === undefined) {\n source.point = source.corners.center;\n if (ele.segments && ele.segments.length > 0) {\n first = ele.segments[0];\n segment = (!Point.isEmptyPoint(first.point)) ? first : undefined;\n }\n var tarPoint = (segment !== undefined) ? segment.point : target.point;\n if (ele.type === 'Bezier' && ele.segments.length > 0 &&\n ele.segments[0].vector1.angle && ele.segments[0].vector1.distance) {\n var value = Math.max(source.corners.width, source.corners.height);\n tarPoint = Point.transform(source.point, ele.segments[0].vector1.angle, value / 2);\n }\n source.point = isInterSect ? ele.sourceWrapper.bounds.center : getIntersection(ele, sourceEle, source.point, tarPoint, false);\n }\n if (ele.targetPortWrapper === undefined) {\n target.point = target.corners.center;\n if (ele.segments && ele.segments.length > 1) {\n first = ele.segments[ele.segments.length - 2];\n segment = (!Point.isEmptyPoint(first.point)) ? first : undefined;\n }\n var srcPoint = (segment) ? segment.point : source.point;\n if (ele.type === 'Bezier' && ele.segments.length > 0 &&\n ele.segments[ele.segments.length - 1].vector2.angle &&\n ele.segments[ele.segments.length - 1].vector2.distance) {\n var value = Math.max(source.corners.width, source.corners.height);\n srcPoint = Point.transform(target.point, ele.segments[0].vector2.angle, value / 2);\n }\n target.point = isInterSect ? ele.targetWrapper.bounds.center : getIntersection(ele, targetEle, srcPoint, target.point, true);\n }\n intermeditatePoints = intermeditatePointsForStraight(ele, source, target);\n }\n else {\n if (ele.type === 'Orthogonal' && (ele.segments && ele.segments.length > 0) &&\n ele.segments[0].direction !== null) {\n intermeditatePoints = findIntermeditatePoints(ele, source, target, srcPort, tarPort, sourceEle, targetEle);\n }\n else {\n if (!ele.segments[0]) {\n var segment = new OrthogonalSegment(ele, 'segments', { type: 'Orthogonal' }, true);\n ele.segments.push(segment);\n }\n ele.segments[0].points = intermeditatePoints = findOrthoSegments(ele, source, target);\n }\n }\n return intermeditatePoints;\n}\n/* tslint:enable */\nfunction intermeditatePointsForStraight(element, source, target) {\n var intermeditatePoints = [];\n if (element.segments && element.segments.length > 0) {\n var i = void 0;\n var segPoint = [];\n var srcPoint = source.point;\n for (i = 0; i < element.segments.length; i++) {\n var seg = element.segments[i];\n segPoint = [];\n segPoint.push(srcPoint);\n if (i !== element.segments.length - 1) {\n segPoint.push(seg.point);\n srcPoint = seg.point;\n }\n else {\n segPoint.push(target.point);\n }\n element.segments[i].points = segPoint;\n if (element.segments.length > 1 && Point.equals(seg.points[0], seg.points[1])) {\n (element.segments).splice(i, 1);\n }\n if (seg) {\n for (var j = 0; j < seg.points.length; j++) {\n if (j > 0 || i === 0) {\n intermeditatePoints.push(seg.points[j]);\n }\n }\n }\n }\n }\n return intermeditatePoints;\n}\nfunction findSourceDirection(dir, srcPoint, tarPoint) {\n var direction = (dir === 'Top' || dir === 'Bottom') ?\n ((tarPoint.x > srcPoint.x) ? 'Right' : 'Left') :\n ((tarPoint.y > srcPoint.y) ? 'Bottom' : 'Top');\n return direction;\n}\nfunction checkLastSegmentasTerminal(ele) {\n if (ele.type === 'Straight' || ele.type === 'Bezier') {\n if ((ele.segments.length === 0 || (ele.segments.length > 0 &&\n (!Point.isEmptyPoint(ele.segments[ele.segments.length - 1].point))))) {\n var segment = void 0;\n segment = (ele.type === 'Bezier') ? new BezierSegment(ele, 'segments', { type: 'Bezier' }, true) :\n new StraightSegment(ele, 'segments', { type: 'Straight' }, true);\n (ele.segments).push(segment);\n }\n }\n else {\n if (ele.segments.length === 0 || ele.segments[ele.segments.length - 1].direction) {\n var segment = new OrthogonalSegment(ele, 'segments', { type: 'Orthogonal' }, true);\n ele.segments.push(segment);\n }\n }\n}\nfunction checkConsectiveSegmentAsSame(ele, i, source) {\n var seg = ele.segments[i];\n var extra = (seg.direction === 'Left' || seg.direction === 'Top') ? -(seg.length) : seg.length;\n var angle = (seg.direction === 'Left' || seg.direction === 'Right') ? 0 : 90;\n var segPoint = addLineSegment(source.point, extra, angle);\n ele.segments[i - 1].length += seg.length;\n ele.segments[i - 1].points[1] = source.point = segPoint;\n ele.segments.splice(i, 1);\n i--;\n return i;\n}\nfunction nodeOrPortToNode(ele, source, target) {\n var point;\n var portdirection;\n if (ele.sourcePortWrapper) {\n var port = { x: ele.sourcePortWrapper.offsetX, y: ele.sourcePortWrapper.offsetY };\n portdirection = getPortDirection(port, source.corners, ele.sourceWrapper.bounds, false);\n }\n findDirection(ele.targetWrapper, source, target, ele);\n var direction = findSourceDirection(target.direction, source.point, target.point);\n if (ele.sourcePortWrapper !== undefined && source.direction === target.direction &&\n ((source.direction === 'Top' || source.direction === 'Bottom') && (source.corners.center.x === target.corners.center.x)\n || (source.direction === 'Left' || source.direction === 'Right') && (source.corners.center.y === target.corners.center.y))) {\n source.direction = direction;\n point = (direction === 'Top' || direction === 'Bottom') ?\n orthoConnection3Segment(ele, source, target, ele.sourceWrapper.height / 2 + 20) :\n orthoConnection3Segment(ele, source, target, ele.sourceWrapper.width / 2 + 20);\n var source1 = source;\n source1.point = point[1];\n if (direction === 'Left' || direction === 'Right') {\n target.direction = direction;\n target.point = (direction === 'Left') ? target.corners.middleLeft : target.corners.middleRight;\n }\n else {\n findDirection(ele.targetWrapper, source, target, ele);\n }\n point = orthoConnection3Segment(ele, source, target);\n }\n else if (target.point.x >= source.corners.middleLeft.x && target.point.x <= source.corners.middleRight.x &&\n source.point.y >= source.corners.topCenter.y && source.point.y <= source.corners.bottomCenter.y) {\n source.direction = (target.point.y > source.point.y) ? 'Bottom' : 'Top';\n var length_2 = (source.direction === 'Top') ? (source.point.y - source.corners.topCenter.y + 20) :\n (source.corners.bottomCenter.y - source.point.y + 20);\n point = orthoConnection3Segment(ele, source, target, length_2);\n }\n else if (ele.sourcePortWrapper && portdirection === getOppositeDirection(direction)) {\n var length_3;\n if ((portdirection === 'Left' || portdirection === 'Right') && (source.point.y >= source.corners.topCenter.y\n && source.point.y <= source.corners.bottomCenter.y)) {\n source.direction = (target.point.y > source.point.y) ? 'Bottom' : 'Top';\n length_3 = source.corners.height / 2 + 20;\n }\n else if ((portdirection === 'Top' || portdirection === 'Bottom') && (source.point.x >= source.corners.middleLeft.x\n && source.point.x <= source.corners.middleRight.x)) {\n source.direction = (target.point.x > source.point.x) ? 'Right' : 'Left';\n length_3 = source.corners.width / 2 + 20;\n }\n if (source.direction && length_3) {\n point = orthoConnection3Segment(ele, source, target, length_3, true);\n }\n else {\n source.direction = direction;\n point = orthoConnection2Segment(source, target);\n }\n }\n else if (ele.sourcePortWrapper && portdirection === target.direction && (portdirection === 'Top' || portdirection === 'Bottom') &&\n (source.corners.center.x === target.corners.center.x)) {\n source.direction = (target.point.y > source.point.y) ? 'Bottom' : 'Top';\n var len = (source.direction === 'Bottom') ? (source.corners.bottomCenter.y - source.point.y + 20) :\n (source.point.y - source.corners.topCenter.y + 20);\n point = orthoConnection3Segment(ele, source, target, len);\n }\n else {\n source.direction = direction;\n point = orthoConnection2Segment(source, target);\n }\n return point;\n}\nfunction checkSourcePointInTarget(ele, source) {\n if (ele.targetWrapper !== undefined && ele.targetPortWrapper === undefined) {\n if (ele.targetWrapper.corners.containsPoint(source.point)) {\n var target = ele.targetWrapper;\n var segment = ele.segments[ele.segments.length - 2];\n var lastPoint = segment.points[segment.points.length - 1];\n var direction = getOppositeDirection(segment.direction);\n if (direction === 'Bottom') {\n if (lastPoint.y < target.corners.bottomCenter.y) {\n segment.points[segment.points.length - 1].y = target.corners.bottomCenter.y + 20;\n segment.length = Point.distancePoints(segment.points[0], segment.points[segment.points.length - 1]);\n }\n }\n else if (direction === 'Top') {\n if (lastPoint.y > target.corners.topCenter.y) {\n segment.points[segment.points.length - 1].y = target.corners.topCenter.y - 20;\n segment.length = Point.distancePoints(segment.points[0], segment.points[segment.points.length - 1]);\n }\n }\n else if (direction === 'Left') {\n if (lastPoint.x > target.corners.middleLeft.x) {\n segment.points[segment.points.length - 1].x = target.corners.middleLeft.x - 20;\n segment.length = Point.distancePoints(segment.points[0], segment.points[segment.points.length - 1]);\n }\n }\n else if (direction === 'Right') {\n if (lastPoint.x < target.corners.middleRight.x) {\n segment.points[segment.points.length - 1].x = target.corners.middleRight.x + 20;\n segment.length = Point.distancePoints(segment.points[0], segment.points[segment.points.length - 1]);\n }\n }\n source.point = segment.points[segment.points.length - 1];\n }\n }\n}\nfunction findIntermeditatePoints(ele, source, target, srcPort, tarPort, sourceEle, targetEle) {\n var point;\n var intermeditatePoints = [];\n var seg;\n var j;\n var removeSegment;\n checkLastSegmentasTerminal(ele);\n for (var i = 0; i < ele.segments.length; i++) {\n seg = ele.segments[i];\n if (srcPort && source.direction === getOppositeDirection(seg.direction)) {\n seg.direction = source.direction;\n }\n if (i > 0 && ele.segments[i - 1].direction === seg.direction) {\n i = checkConsectiveSegmentAsSame(ele, i, source);\n }\n else {\n if (seg.direction) {\n source.point = updateSegmentPoints(source, ele.segments[i]);\n }\n else {\n var segment = ele.segments[i - 1];\n source.point = segment.points[segment.points.length - 1];\n }\n }\n if (i === ele.segments.length - 1) {\n checkSourcePointInTarget(ele, source);\n if (tarPort === undefined) {\n point = nodeOrPortToNode(ele, source, target);\n }\n else {\n point = pointToPort(ele, source, target);\n }\n checkPreviousSegment(point, ele, source);\n seg.points = [];\n if (point.length >= 2) {\n for (j = 0; j < point.length; j++) {\n seg.points.push(point[j]);\n }\n }\n else {\n removeSegment = i;\n }\n }\n if (removeSegment !== undefined) {\n if (removeSegment === ele.segments.length - 1) {\n ele.segments[removeSegment - 1].direction = null;\n ele.segments[removeSegment - 1].length = null;\n }\n ele.segments.splice(removeSegment, 1);\n }\n if (srcPort && i === 0) {\n var sourcePoint = checkPortdirection(ele, srcPort, sourceEle);\n if (sourcePoint) {\n source.point = sourcePoint;\n }\n }\n }\n return returnIntermeditatePoints(ele, intermeditatePoints);\n}\nfunction returnIntermeditatePoints(element, intermeditatePoints) {\n for (var i = 0; i < element.segments.length; i++) {\n var seg = element.segments[i];\n for (var j = 0; j < seg.points.length; j++) {\n if (j > 0 || i === 0) {\n intermeditatePoints.push(seg.points[j]);\n }\n }\n }\n return intermeditatePoints;\n}\nfunction findDirection(node, source, target, ele) {\n var nodeDirection;\n var nodeConnectingPoint = { x: 0, y: 0 };\n var nodeCorners = node.corners;\n var nodeMargin = source.margin;\n var fixedPoint = source.point;\n if (nodeCorners.bottomCenter.y + nodeMargin.bottom < fixedPoint.y) {\n nodeDirection = 'Bottom';\n nodeConnectingPoint = nodeCorners.bottomCenter;\n }\n else if (nodeCorners.topCenter.y - nodeMargin.top > fixedPoint.y) {\n nodeDirection = 'Top';\n nodeConnectingPoint = nodeCorners.topCenter;\n }\n else if (nodeCorners.middleLeft.x - nodeMargin.left > fixedPoint.x) {\n nodeDirection = 'Left';\n nodeConnectingPoint = nodeCorners.middleLeft;\n }\n else if (nodeCorners.middleRight.x + nodeMargin.right < fixedPoint.x) {\n nodeDirection = 'Right';\n nodeConnectingPoint = nodeCorners.middleRight;\n }\n else {\n var top_1 = Math.abs(fixedPoint.y - nodeCorners.topCenter.y);\n var right = Math.abs(fixedPoint.x - nodeCorners.middleRight.x);\n var bottom = Math.abs(fixedPoint.y - nodeCorners.bottomCenter.y);\n var left = Math.abs(fixedPoint.x - nodeCorners.middleLeft.x);\n var shortes = Number.MAX_VALUE;\n shortes = top_1;\n nodeDirection = 'Top';\n nodeConnectingPoint = nodeCorners.topCenter;\n if (shortes > right) {\n shortes = right;\n nodeDirection = 'Right';\n nodeConnectingPoint = nodeCorners.middleRight;\n }\n if (shortes > bottom) {\n shortes = bottom;\n nodeDirection = 'Bottom';\n nodeConnectingPoint = nodeCorners.bottomCenter;\n }\n if (shortes > left) {\n //shortes = left;\n nodeDirection = 'Left';\n nodeConnectingPoint = nodeCorners.middleLeft;\n }\n }\n target.point = nodeConnectingPoint;\n target.direction = nodeDirection;\n var refPoint = findEndPoint(target.direction, target.point, node);\n target.point = getIntersection(ele, node, target.point, refPoint, node === ele.targetWrapper);\n}\nfunction findOrthoSegments(ele, source, target, extra) {\n var swap = false;\n var intermeditatePoints = [];\n var seg;\n swap = getSwapping(source.direction, target.direction);\n if (swap) {\n swapPoints(source, target);\n }\n if (source.direction === 'Right' && target.direction === 'Left') {\n seg = getRightToLeftSegmentCount(ele, source, target, swap);\n }\n else if (source.direction === 'Right' && target.direction === 'Right') {\n seg = getRightToRightSegmentCount(ele, source, target);\n }\n else if (source.direction === 'Right' && target.direction === 'Top') {\n seg = getRightToTopSegmentCount(ele, source, target, swap);\n }\n else if (source.direction === 'Right' && target.direction === 'Bottom') {\n seg = getRightToBottomSegmentCount(ele, source, target, swap);\n }\n else if (source.direction === 'Bottom' && target.direction === 'Top') {\n seg = getBottomToTopSegmentCount(source, target);\n }\n else if (source.direction === 'Bottom' && target.direction === 'Bottom') {\n source.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n target.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n seg = getBottomToBottomSegmentCount(ele, source, target);\n }\n else if (source.direction === 'Bottom' && target.direction === 'Left') {\n seg = getBottomToLeftSegmentCount(ele, source, target, swap);\n }\n else if (source.direction === 'Left' && target.direction === 'Left') {\n seg = getLeftToLeftSegmentCount(ele, source, target);\n }\n else if (source.direction === 'Left' && target.direction === 'Top') {\n seg = getLeftToTopSegmentCount(ele, source, target, swap);\n }\n else if (source.direction === 'Top' && target.direction === 'Top') {\n seg = getTopToTopSegmentCount(ele, source, target);\n }\n if (swap) {\n swapPoints(source, target);\n }\n intermeditatePoints = addOrthoSegments(ele, seg, source, target, extra);\n return intermeditatePoints;\n}\n/** @private */\nexport function findAngle(s, e) {\n var r = { x: e.x, y: s.y };\n var sr = Point.findLength(s, r);\n var re = Point.findLength(r, e);\n var es = Point.findLength(e, s);\n var ang = Math.asin(re / es);\n ang = ang * 180 / Math.PI;\n if (s.x < e.x) {\n if (s.y > e.y) {\n ang = 360 - ang;\n }\n }\n else {\n if (s.y < e.y) {\n ang = 180 - ang;\n }\n else {\n ang = 180 + ang;\n }\n }\n return ang;\n}\nfunction findPoint(cor, direction) {\n var point;\n switch (direction) {\n case 'Left':\n point = cor.middleLeft;\n break;\n case 'Top':\n point = cor.topCenter;\n break;\n case 'Right':\n point = cor.middleRight;\n break;\n case 'Bottom':\n point = cor.bottomCenter;\n break;\n }\n return point;\n}\nfunction pointsFromNodeToPoint(seg, direction, bounds, point, endPoint, isTarget) {\n var minSpace = 13;\n var x;\n var points = [];\n var y;\n points.push(point);\n var straight;\n straight = (point.y === endPoint.y && (direction === 'Left' && endPoint.x < point.x ||\n direction === 'Right' && endPoint.x > point.x)) ||\n (point.x === endPoint.x && (direction === 'Top' && endPoint.y < point.y ||\n direction === 'Bottom' && endPoint.y > point.y));\n if (!straight) {\n if (direction === 'Top' || direction === 'Bottom') {\n if (direction === 'Top' && endPoint.y < point.y && endPoint.y > point.y - minSpace ||\n direction === 'Bottom' && endPoint.y > point.y && endPoint.y < point.y + minSpace) {\n y = direction === 'Top' ? bounds.top - minSpace : bounds.bottom + minSpace;\n points.push({ x: point.x, y: y });\n points.push({ x: point.x + (endPoint.x - point.x) / 2, y: y });\n points.push({ x: point.x + (endPoint.x - point.x) / 2, y: endPoint.y });\n }\n else if (Math.abs(point.x - endPoint.x) > minSpace &&\n (direction === 'Top' && endPoint.y < point.y || direction === 'Bottom' && endPoint.y > point.y)) {\n //twosegments\n points.push({ x: point.x, y: endPoint.y });\n }\n else {\n y = direction === 'Top' ? bounds.top - minSpace : bounds.bottom + minSpace;\n x = (endPoint.x < point.x) ? bounds.left - minSpace : bounds.right + minSpace;\n points.push({ x: point.x, y: y });\n points.push({ x: endPoint.x, y: y });\n }\n }\n else {\n if (direction === 'Left' && endPoint.x < point.x && endPoint.x > point.x - minSpace || direction === 'right' &&\n endPoint.x > point.x && endPoint.x < point.x + minSpace) {\n x = direction === 'Left' ? bounds.left - minSpace : bounds.right + minSpace;\n points.push({ x: x, y: point.y });\n points.push({ x: x, y: point.y + (endPoint.y - point.y) / 2 });\n points.push({ x: endPoint.x, y: point.y + (endPoint.y - point.y) / 2 });\n }\n else if (Math.abs(point.y - endPoint.y) > minSpace &&\n (direction === 'Left' && endPoint.x < point.x || direction === 'Right' && endPoint.x > point.x)) {\n points.push({ x: endPoint.x, y: point.y });\n //twosegments\n }\n else {\n x = direction === 'Left' ? bounds.left - minSpace : bounds.right + minSpace;\n points.push({ x: x, y: point.y });\n points.push({ x: x, y: endPoint.y });\n }\n }\n if (isTarget) {\n points.push(seg.points[0]);\n points.reverse();\n }\n seg.points = points;\n }\n}\nfunction addLineSegment(point, extra, angle) {\n var segEnd = Point.transform(point, angle, extra);\n return segEnd;\n}\nfunction getIntersection(ele, bounds, sPt, tPt, isTar) {\n sPt = { x: sPt.x, y: sPt.y };\n tPt = { x: tPt.x, y: tPt.y };\n var angle = Point.findAngle(tPt, sPt);\n var child;\n var intersection;\n var wrapper = isTar ? ele.targetWrapper : ele.sourceWrapper;\n var segmentPoints;\n var point = isTar || ele.type === 'Orthogonal' ? sPt : tPt;\n var sourcePoint = Point.transform(sPt, angle, Math.max(wrapper.actualSize.height / 2, wrapper.actualSize.width / 2));\n child = wrapper;\n if (ele.type === 'Orthogonal') {\n var constValue = Math.abs(child.bounds.height - child.actualSize.height) / 2 + 5;\n if (sPt.x === tPt.x) {\n if (sPt.y < tPt.y) {\n sPt.y -= constValue;\n }\n else {\n sPt.y += constValue;\n }\n }\n constValue = Math.abs(child.bounds.width - child.actualSize.width) / 2 + 5;\n if (sPt.y === tPt.y) {\n if (sPt.x < tPt.x) {\n sPt.x -= constValue;\n }\n else {\n sPt.x += constValue;\n }\n }\n }\n else {\n var angle_1 = isTar ? Point.findAngle(sPt, tPt) : Point.findAngle(tPt, sPt);\n if (isTar) {\n var angle_2 = Point.findAngle(sPt, tPt);\n tPt = Point.transform({ x: tPt.x, y: tPt.y }, angle_2, Math.max(wrapper.actualSize.width, wrapper.actualSize.height));\n }\n else {\n var angle_3 = Point.findAngle(tPt, sPt);\n sPt = Point.transform({ x: sPt.x, y: sPt.y }, angle_3, Math.max(wrapper.actualSize.width, wrapper.actualSize.height));\n }\n }\n if (wrapper instanceof PathElement && wrapper.data) {\n segmentPoints = child.getPoints();\n if (((child.data.split('m').length - 1) + (child.data.split('M').length - 1)) === 1) {\n segmentPoints[segmentPoints.length] = segmentPoints[0];\n }\n }\n else {\n segmentPoints = getPoints(wrapper, wrapper.corners);\n segmentPoints[segmentPoints.length] = segmentPoints[0];\n }\n var length = segmentPoints.length;\n var thisSegment = { X1: sPt.x, Y1: sPt.y, X2: tPt.x, Y2: tPt.y };\n return getIntersectionPoints(thisSegment, segmentPoints, true, point) || ((isTar) ? tPt : sPt);\n}\nfunction setLineEndPoint(element, point, isTarget) {\n point.x = Math.round(point.x * 100) / 100;\n point.y = Math.round(point.y * 100) / 100;\n if (isTarget) {\n element.targetPoint = point;\n }\n else {\n element.sourcePoint = point;\n }\n return point;\n}\n/** @private */\nexport function getIntersectionPoints(thisSegment, pts, minimal, point) {\n var length = pts.length;\n var min;\n var segment = {\n X1: pts[0].x, Y1: pts[0].y, X2: pts[1].x,\n Y2: pts[1].y\n };\n var intersection = intersectSegment(thisSegment, segment);\n if (intersection) {\n // if (!minimal) { return intersection; } //commented because minimal is always true\n min = Point.distancePoints(intersection, point);\n }\n if (isNaN(min) || min > 0) {\n for (var i = 1; i < length - 1; i++) {\n segment = {\n X1: pts[i].x, Y1: pts[i].y,\n X2: pts[i + 1].x, Y2: pts[i + 1].y\n };\n var intersect = intersectSegment(thisSegment, segment);\n if (intersect) {\n // if (!minimal) { return intersect; }//commented because minimal is always true\n var dist = Point.distancePoints(intersect, point);\n if (isNaN(min) || min > dist) {\n min = dist;\n intersection = intersect;\n }\n if (min >= 0 && min <= 1) {\n break;\n }\n }\n }\n }\n return intersection;\n}\nfunction intersectSegment(segment1, segment2) {\n var x1 = segment1.X1;\n var y1 = segment1.Y1;\n var x2 = segment1.X2;\n var y2 = segment1.Y2;\n var x3 = segment2.X1;\n var y3 = segment2.Y1;\n var x4 = segment2.X2;\n var y4 = segment2.Y2;\n var a1;\n var a2;\n var b1;\n var b2;\n var c1;\n var c2;\n var x;\n var y;\n var r1;\n var r2;\n var r3;\n var r4;\n var denom;\n var offset;\n var num;\n a1 = y2 - y1;\n b1 = x1 - x2;\n c1 = (x2 * y1) - (x1 * y2);\n r3 = ((a1 * x3) + (b1 * y3) + c1);\n r4 = ((a1 * x4) + (b1 * y4) + c1);\n if ((r3 !== 0) && (r4 !== 0) && sameSign(r3, r4)) {\n return null;\n }\n a2 = y4 - y3;\n b2 = x3 - x4;\n c2 = (x4 * y3) - (x3 * y4);\n r1 = (a2 * x1) + (b2 * y1) + c2;\n r2 = (a2 * x2) + (b2 * y2) + c2;\n if ((r1 !== 0) && (r2 !== 0) && (sameSign(r1, r2))) {\n return null;\n }\n denom = (a1 * b2) - (a2 * b1);\n if (denom === 0) {\n return null;\n }\n if (denom < 0) {\n offset = -denom / 2;\n }\n else {\n offset = denom / 2;\n }\n offset = 0;\n num = (b1 * c2) - (b2 * c1);\n if (num < 0) {\n x = (num - offset) / denom;\n }\n else {\n x = (num + offset) / denom;\n }\n num = (a2 * c1) - (a1 * c2);\n if (num < 0) {\n y = (num - offset) / denom;\n }\n else {\n y = (num + offset) / denom;\n }\n return { x: x, y: y };\n}\nfunction sameSign(a, b) {\n return ((a * b) >= 0);\n}\nfunction findEndPoint(direction, point, node) {\n var targetPoint;\n switch (direction) {\n case 'Bottom':\n targetPoint = { x: point.x, y: point.y - Math.max(node.actualSize.width, node.actualSize.height) };\n break;\n case 'Top':\n targetPoint = { x: point.x, y: point.y + Math.max(node.actualSize.width, node.actualSize.height) };\n break;\n case 'Right':\n targetPoint = { y: point.y, x: point.x - Math.max(node.actualSize.width, node.actualSize.height) };\n break;\n case 'Left':\n targetPoint = { y: point.y, x: point.x + Math.max(node.actualSize.width, node.actualSize.height) };\n break;\n }\n return targetPoint;\n}\nfunction getRightToLeftSegmentCount(element, source, target, swap) {\n var srcPort = element.sourcePortWrapper;\n var targetPort = element.targetPortWrapper;\n var pts;\n var diffY = Math.round(Math.abs(source.point.y - target.point.y));\n var diffX = Math.round(Math.abs(source.point.x - target.point.x));\n var right = { x: Math.max(source.point.x, source.corners.right), y: source.point.y };\n var left = { x: Math.min(target.point.x, target.corners.left), y: target.point.y };\n var margin = 10;\n if (swap) {\n var point = void 0;\n point = left;\n left = right;\n right = point;\n }\n if (!(source.corners.bottomCenter.y + margin < target.corners.topCenter.y - margin ||\n source.corners.topCenter.y - margin > target.corners.bottomCenter.y + margin)) {\n margin = 0;\n }\n source.margin = { left: margin, right: margin, top: margin, bottom: margin };\n target.margin = { left: margin, right: margin, top: margin, bottom: margin };\n if (diffY === 0 && (source.corners.middleRight.x < target.corners.middleLeft.x\n || (swap && source.corners.middleRight.x < target.corners.middleLeft.x))) {\n pts = NoOfSegments.One;\n }\n else if (source.corners.middleRight.x + source.margin.right < target.corners.middleLeft.x - target.margin.left) {\n pts = NoOfSegments.Three;\n }\n else if (element.sourceWrapper !== element.targetWrapper &&\n (source.corners.containsPoint(left) || target.corners.containsPoint(right))) {\n pts = NoOfSegments.Three;\n }\n else if (source.corners.bottomCenter.y <= target.corners.topCenter.y) {\n pts = NoOfSegments.Five;\n }\n else if (source.corners.topCenter.y >= target.corners.topCenter.y) {\n pts = NoOfSegments.Five;\n }\n else if ((srcPort !== undefined && srcPort.offsetY <= target.corners.topCenter.y) ||\n (srcPort === undefined && source.corners.middleRight.y <= target.corners.topCenter.y)) {\n pts = NoOfSegments.Five;\n }\n else if ((srcPort !== undefined && srcPort.offsetY >= target.corners.bottomCenter.y) ||\n (srcPort === undefined && source.corners.middleRight.y >= target.corners.bottomCenter.y)) {\n pts = NoOfSegments.Five;\n }\n else {\n pts = NoOfSegments.Five;\n }\n return pts;\n}\nfunction getRightToRightSegmentCount(element, sourceObj, targetObj) {\n var sourcePort = element.sourcePortWrapper;\n var tarPort = element.targetPortWrapper;\n var pts;\n var diffX = sourceObj.point.x - targetObj.point.x;\n var diffY = sourceObj.point.y - targetObj.point.y;\n targetObj.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n sourceObj.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n if (sourceObj.corners.middleRight.x >= targetObj.corners.middleRight.x) {\n if ((sourcePort !== undefined && (sourcePort.offsetY < targetObj.corners.topCenter.y ||\n sourcePort.offsetY > targetObj.corners.bottomCenter.y)) ||\n (sourcePort === undefined && sourceObj.corners.middleRight.y < targetObj.corners.topCenter.y)) {\n pts = NoOfSegments.Three;\n }\n else if ((sourcePort !== undefined && sourcePort.offsetY > targetObj.corners.bottomCenter.y + targetObj.margin.bottom\n && sourceObj.corners.topCenter.y > targetObj.corners.bottomCenter.y) ||\n (sourcePort === undefined && sourceObj.corners.middleRight.y > targetObj.corners.bottomCenter.y)) {\n pts = NoOfSegments.Three;\n }\n else if ((sourcePort !== undefined && sourcePort.offsetY < targetObj.corners.topCenter.y\n && sourceObj.corners.bottomCenter.y > targetObj.corners.topCenter.y) ||\n (sourcePort === undefined && sourceObj.corners.middleRight.y > targetObj.corners.bottomCenter.y)) {\n pts = NoOfSegments.Three;\n }\n else if (sourceObj.corners.middleRight.x < targetObj.corners.middleLeft.x ||\n targetObj.corners.middleRight.x < sourceObj.corners.middleLeft.x) {\n pts = NoOfSegments.Five;\n }\n else if (diffX === 0 || diffY === 0) {\n pts = NoOfSegments.One;\n }\n else {\n pts = NoOfSegments.Three;\n }\n }\n else if ((tarPort !== undefined && sourceObj.corners.bottomCenter.y < tarPort.offsetY) ||\n (tarPort === undefined && sourceObj.corners.bottomCenter.y < targetObj.corners.middleRight.y)) {\n pts = NoOfSegments.Three;\n }\n else if ((tarPort !== undefined && sourceObj.corners.topCenter.y > tarPort.offsetY) ||\n (tarPort === undefined && sourceObj.corners.topCenter.y > targetObj.corners.middleRight.y)) {\n pts = NoOfSegments.Three;\n }\n else if ((tarPort !== undefined && ((sourcePort !== undefined && sourcePort.offsetX < targetObj.corners.middleLeft.x &&\n sourcePort.offsetX !== tarPort.offsetX && sourcePort.offsetY !== tarPort.offsetY &&\n (Math.abs(sourceObj.corners.middleRight.x - targetObj.corners.middleLeft.x) <= 20)) ||\n (sourcePort === undefined && sourceObj.corners.middleRight.x < targetObj.corners.middleLeft.x &&\n sourceObj.corners.center.x !== targetObj.corners.center.x && sourceObj.corners.center.y !== targetObj.corners.center.y)))) {\n pts = NoOfSegments.Three;\n }\n else if (sourceObj.corners.middleRight.x < targetObj.corners.middleLeft.x) {\n pts = NoOfSegments.Five;\n }\n else if (diffX === 0 || diffY === 0) {\n pts = NoOfSegments.One;\n }\n else {\n pts = NoOfSegments.Three;\n }\n return pts;\n}\nfunction getRightToTopSegmentCount(element, source, target, swap) {\n var tarPort = element.targetPortWrapper;\n var srcPort = element.sourcePortWrapper;\n var right = { x: Math.max(source.point.x, source.corners.right), y: source.point.y };\n var top = { x: target.point.x, y: Math.min(target.point.y, target.corners.top) };\n var pts;\n target.margin = { left: 5, right: 5, top: 5, bottom: 5 };\n source.margin = { top: 5, bottom: 5, left: 5, right: 5 };\n if (swap) {\n var port = void 0;\n port = srcPort;\n srcPort = tarPort;\n tarPort = port;\n }\n if ((srcPort !== undefined && srcPort.offsetY < target.corners.topCenter.y - target.margin.top) ||\n (srcPort === undefined && source.corners.bottomCenter.y < target.corners.topCenter.y - target.margin.top)) {\n if (source.corners.bottomCenter.y < target.corners.topCenter.y) {\n if ((tarPort !== undefined && source.corners.middleRight.x + source.margin.right < tarPort.offsetX) ||\n (tarPort === undefined && source.corners.middleRight.x + source.margin.right < target.corners.topCenter.x)) {\n pts = NoOfSegments.Two;\n }\n else {\n pts = NoOfSegments.Four;\n }\n }\n else if ((tarPort !== undefined && source.corners.middleLeft.x > tarPort.offsetX) ||\n (tarPort === undefined && source.corners.middleLeft.x > target.corners.topCenter.x)) {\n pts = NoOfSegments.Four;\n }\n else {\n pts = NoOfSegments.Two;\n }\n }\n else if (srcPort !== undefined && Math.abs(source.corners.middleRight.x - target.corners.middleLeft.x) <= 25 &&\n Math.abs(srcPort.offsetY - target.corners.topCenter.y) <= 25) {\n pts = NoOfSegments.Two;\n }\n else if (tarPort !== undefined && Math.abs(tarPort.offsetX - source.corners.topCenter.x) >= 25 &&\n source.corners.middleRight.y < tarPort.offsetY) {\n pts = NoOfSegments.Two;\n }\n else if (source.corners.middleRight.x < target.corners.middleLeft.x) {\n pts = NoOfSegments.Four;\n }\n else if (element.sourceWrapper !== element.targetWrapper &&\n (source.corners.containsPoint(top) || target.corners.containsPoint(right))) {\n pts = NoOfSegments.Two;\n }\n else {\n pts = NoOfSegments.Four;\n }\n return pts;\n}\nfunction getRightToBottomSegmentCount(element, source, target, swap) {\n source.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n target.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n var pts;\n var srcPort = element.sourcePortWrapper;\n var tarPort = element.targetPortWrapper;\n var right = { x: Math.max(source.point.x, source.corners.right), y: source.point.y };\n var bottom = { x: target.point.x, y: Math.max(target.point.y, target.corners.bottom) };\n if (swap) {\n var port = void 0;\n port = srcPort;\n srcPort = tarPort;\n tarPort = port;\n }\n if ((srcPort !== undefined && srcPort.offsetY > target.corners.bottomCenter.y + target.margin.bottom) ||\n (srcPort === undefined && source.corners.middleRight.y > target.corners.bottomCenter.y + target.margin.bottom)) {\n if (source.corners.topCenter.y > target.corners.bottomCenter.y) {\n if ((tarPort !== undefined && source.corners.middleRight.x + source.margin.right < tarPort.offsetX) ||\n (tarPort === undefined && source.corners.middleRight.x + source.margin.right < target.corners.bottomCenter.x)) {\n pts = NoOfSegments.Two;\n }\n else {\n pts = NoOfSegments.Four;\n }\n }\n else if ((tarPort !== undefined && source.corners.middleLeft.x > tarPort.offsetX) ||\n (tarPort === undefined && source.corners.middleLeft.x > target.corners.bottomCenter.x)) {\n pts = NoOfSegments.Four;\n }\n else {\n pts = NoOfSegments.Two;\n }\n }\n else if (srcPort !== undefined &&\n Math.abs(source.corners.middleRight.x - target.corners.middleLeft.x) <= 25 &&\n Math.abs(srcPort.offsetY - target.corners.bottomCenter.y) <= 25) {\n pts = NoOfSegments.Two;\n }\n else if (source.corners.middleRight.x < target.corners.middleLeft.x) {\n pts = NoOfSegments.Four;\n }\n else {\n pts = NoOfSegments.Four;\n }\n return pts;\n}\nfunction getBottomToTopSegmentCount(source, target) {\n var pts;\n var diffX = source.point.x - target.point.x;\n var diffY = source.point.y - target.point.y;\n var bottom = { x: source.point.x, y: Math.max(source.point.y, source.corners.bottom) };\n var top = { x: target.point.x, y: Math.min(target.point.y, target.corners.top) };\n var margin = 10;\n if (!(source.corners.middleRight.x + margin < target.corners.middleLeft.x - margin ||\n source.corners.middleLeft.x - margin > target.corners.middleRight.x + margin)) {\n margin = 0;\n }\n source.margin = { left: margin, right: margin, top: margin, bottom: margin };\n target.margin = { left: margin, right: margin, top: margin, bottom: margin };\n if (diffX === 0 && source.corners.bottomCenter.y < target.corners.topCenter.y) {\n pts = NoOfSegments.One;\n }\n else if (source.corners.bottomCenter.y + source.margin.bottom < target.corners.topCenter.y - target.margin.top) {\n pts = NoOfSegments.Three;\n }\n else if (source.corners.middleRight.x + source.margin.right < target.corners.middleLeft.x - target.margin.left) {\n pts = NoOfSegments.Five;\n }\n else if (source.corners.middleLeft.x - source.margin.left > target.corners.middleRight.x + target.margin.right) {\n pts = NoOfSegments.Five;\n }\n else {\n pts = NoOfSegments.Five;\n }\n return pts;\n}\nfunction getBottomToLeftSegmentCount(element, source, target, swap) {\n var srcPort = element.sourcePortWrapper;\n var tarPort = element.targetPortWrapper;\n var bottom = { x: source.point.x, y: Math.max(source.point.y, source.corners.bottom) };\n var left = { x: Math.min(target.point.x, target.corners.left), y: target.point.y };\n var pts;\n if (swap) {\n var port = void 0;\n port = srcPort;\n srcPort = tarPort;\n tarPort = port;\n }\n if ((srcPort !== undefined && srcPort.offsetX < target.corners.middleLeft.x - target.margin.left) ||\n (srcPort === undefined && source.corners.bottomCenter.x < target.corners.bottomLeft.x - target.margin.left)) {\n if (source.corners.middleRight.x < target.corners.middleLeft.x) {\n if ((tarPort !== undefined && source.corners.bottomCenter.y + source.margin.bottom < tarPort.offsetY) ||\n (tarPort === undefined && source.corners.bottomCenter.y + source.margin.bottom < target.corners.middleLeft.y)) {\n pts = NoOfSegments.Two;\n }\n else {\n pts = NoOfSegments.Four;\n }\n }\n else if ((tarPort !== undefined && source.corners.topCenter.y > tarPort.offsetY) ||\n (tarPort === undefined && source.corners.topCenter.y > target.corners.middleLeft.y)) {\n pts = NoOfSegments.Four;\n }\n else {\n pts = NoOfSegments.Two;\n }\n }\n else if (tarPort !== undefined &&\n Math.abs(source.corners.middleRight.x - target.corners.middleLeft.x) <= 25 &&\n Math.abs(tarPort.offsetY - source.corners.bottomCenter.y) <= 25) {\n pts = NoOfSegments.Two;\n }\n else {\n pts = NoOfSegments.Four;\n }\n return pts;\n}\nfunction getBottomToBottomSegmentCount(element, source, target) {\n var srcPort = element.sourcePortWrapper;\n var tarPort = element.targetPortWrapper;\n var difX = Math.round(Math.abs(source.point.x - target.point.x));\n var diffY = Math.round(Math.abs(target.point.y - target.point.y));\n var pts;\n if (source.corners.bottomCenter.y < target.corners.bottomCenter.y) {\n if ((srcPort !== undefined && srcPort.offsetX < target.corners.middleLeft.x - target.margin.left) ||\n (srcPort === undefined && source.corners.bottomCenter.x < target.corners.middleLeft.x - target.margin.left)) {\n pts = NoOfSegments.Three;\n }\n else if ((srcPort !== undefined && srcPort.offsetX > target.corners.middleRight.x + target.margin.right) ||\n (srcPort === undefined && source.corners.bottomCenter.x > target.corners.middleRight.x + target.margin.right)) {\n pts = NoOfSegments.Three;\n }\n else if (source.corners.bottomCenter.y < target.corners.topCenter.y) {\n pts = NoOfSegments.Five;\n }\n else if (difX === 0 || diffY === 0) {\n pts = NoOfSegments.One;\n }\n else {\n pts = NoOfSegments.Three;\n }\n }\n else if ((tarPort !== undefined && source.corners.middleLeft.x > tarPort.offsetX) ||\n (tarPort === undefined && source.corners.middleLeft.x > target.corners.middleLeft.x)) {\n pts = NoOfSegments.Three;\n }\n else if ((tarPort !== undefined && source.corners.middleRight.x < tarPort.offsetX) ||\n (tarPort === undefined &&\n source.corners.middleRight.x < target.corners.middleRight.x)) {\n pts = NoOfSegments.Three;\n }\n else if (source.corners.topCenter.y > target.corners.bottomCenter.y) {\n pts = NoOfSegments.Five;\n }\n else if (difX === 0 || diffY === 0) {\n pts = NoOfSegments.One;\n }\n else {\n pts = NoOfSegments.Three;\n }\n return pts;\n}\nfunction getLeftToTopSegmentCount(element, source, target, swap) {\n var pts;\n var sourcePort = element.sourcePortWrapper;\n var tarPort = element.targetPortWrapper;\n var left = { x: Math.min(source.point.x, source.corners.left), y: source.point.y };\n var top = { x: target.point.x, y: Math.min(target.point.y, target.corners.top) };\n if (swap) {\n var port = void 0;\n port = sourcePort;\n sourcePort = tarPort;\n tarPort = port;\n }\n if ((sourcePort !== undefined && sourcePort.offsetY < target.corners.topCenter.y - target.margin.top) ||\n (sourcePort === undefined && (source.corners.bottomCenter.y < target.corners.topCenter.y - target.margin.top ||\n source.corners.middleLeft.y < target.corners.topCenter.y - target.margin.top))) {\n if (source.corners.bottomCenter.y < target.corners.topCenter.y) {\n if ((tarPort !== undefined && source.corners.middleLeft.x - source.margin.left > tarPort.offsetX) ||\n (tarPort === undefined && source.corners.middleLeft.x - source.margin.left > target.corners.topCenter.x)) {\n pts = NoOfSegments.Two;\n }\n else {\n pts = NoOfSegments.Four;\n }\n }\n else if ((tarPort !== undefined && source.corners.middleRight.x < tarPort.offsetX) ||\n (tarPort === undefined && source.corners.middleRight.x < target.corners.topCenter.x)) {\n pts = NoOfSegments.Four;\n }\n else {\n pts = NoOfSegments.Two;\n }\n }\n else if (sourcePort !== undefined &&\n Math.abs(source.corners.middleLeft.x - target.corners.middleRight.x) <= 25 &&\n Math.abs(sourcePort.offsetY - target.corners.topCenter.y) <= 25) {\n pts = NoOfSegments.Two;\n }\n else if (element.sourceWrapper !== element.targetWrapper &&\n (source.corners.containsPoint(top) || target.corners.containsPoint(left))) {\n pts = NoOfSegments.Two;\n }\n else if (source.corners.middleLeft.x > target.corners.middleRight.x) {\n pts = NoOfSegments.Four;\n }\n else {\n pts = NoOfSegments.Four;\n }\n return pts;\n}\nfunction getLeftToLeftSegmentCount(element, source, target) {\n var srcPort = element.sourcePortWrapper;\n var targetPort = element.targetPortWrapper;\n source.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n target.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n var diffX = Math.round(Math.abs(source.point.x - target.point.x));\n var diffY = Math.round(Math.abs(source.point.y - target.point.y));\n var pts;\n if (source.corners.middleLeft.x < target.corners.middleLeft.x) {\n if ((targetPort !== undefined && source.corners.bottomCenter.y + source.margin.bottom < targetPort.offsetY) ||\n (targetPort === undefined && source.corners.bottomCenter.y + source.margin.bottom < target.corners.middleLeft.y)) {\n pts = NoOfSegments.Three;\n }\n else if ((targetPort !== undefined && source.corners.topCenter.y - source.margin.top > targetPort.offsetY) ||\n (targetPort === undefined && source.corners.topCenter.y - source.margin.top > target.corners.middleLeft.y)) {\n pts = NoOfSegments.Three;\n }\n else if (source.corners.middleRight.x < target.corners.middleLeft.x ||\n target.corners.middleRight.x < source.corners.middleLeft.x) {\n pts = NoOfSegments.Five;\n }\n else if (diffX === 0 || diffY === 0) {\n pts = NoOfSegments.One;\n }\n else {\n pts = NoOfSegments.Three;\n }\n }\n else if ((srcPort !== undefined && srcPort.offsetY < target.corners.topCenter.y - target.margin.top) ||\n (srcPort === undefined && source.corners.middleLeft.y < target.corners.topCenter.y)) {\n pts = NoOfSegments.Three;\n }\n else if ((srcPort !== undefined && srcPort.offsetY > target.corners.bottomCenter.y + target.margin.bottom) ||\n (srcPort === undefined && source.corners.middleLeft.y > target.corners.bottomCenter.y + target.margin.bottom)) {\n pts = NoOfSegments.Three;\n }\n else if (source.corners.middleLeft.x > target.corners.middleRight.x) {\n pts = NoOfSegments.Five;\n }\n else if (diffX === 0 || diffY === 0) {\n pts = NoOfSegments.One;\n }\n else {\n pts = NoOfSegments.Three;\n }\n return pts;\n}\nfunction getTopToTopSegmentCount(element, source, target) {\n var srcPort = element.sourcePortWrapper;\n var targetPort = element.targetPortWrapper;\n var diffX = Math.round(Math.abs(source.point.x - target.point.x));\n var diffY = Math.round(Math.abs(source.point.y - target.point.y));\n source.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n var pts;\n target.margin = { left: 10, right: 10, top: 10, bottom: 10 };\n if (source.corners.topCenter.y < target.corners.topCenter.y) {\n if ((targetPort !== undefined && source.corners.middleLeft.x > targetPort.offsetX) ||\n (targetPort === undefined && source.corners.middleLeft.x > target.corners.middleLeft.x)) {\n pts = NoOfSegments.Three;\n }\n else if ((targetPort !== undefined && source.corners.middleRight.x < targetPort.offsetX) ||\n (targetPort === undefined && source.corners.middleRight.x < target.corners.middleRight.x)) {\n pts = NoOfSegments.Three;\n }\n else if (source.corners.bottomCenter.y < target.corners.topCenter.y) {\n pts = NoOfSegments.Five;\n }\n else if (diffX === 0 || diffY === 0) {\n pts = NoOfSegments.One;\n }\n else {\n pts = NoOfSegments.Three;\n }\n }\n else if ((srcPort !== undefined && srcPort.offsetX > target.corners.middleRight.x) ||\n (srcPort === undefined && source.corners.middleLeft.x > target.corners.middleRight.x)) {\n pts = NoOfSegments.Three;\n }\n else if ((srcPort !== undefined && srcPort.offsetX < target.corners.middleLeft.x) ||\n (srcPort === undefined && source.corners.bottomRight.x < target.corners.middleLeft.x)) {\n pts = NoOfSegments.Three;\n }\n else if (source.corners.topCenter.y > target.corners.bottomCenter.y) {\n pts = NoOfSegments.Five;\n }\n else if (diffX === 0 || diffY === 0) {\n pts = NoOfSegments.One;\n }\n else {\n pts = NoOfSegments.Three;\n }\n return pts;\n}\nfunction addOrthoSegments(element, seg, source, target, segLength) {\n var src = element.sourceWrapper;\n var tar = element.targetWrapper;\n var tarPort = element.targetPortWrapper;\n var intermeditatePoints;\n var srcCorner = src.corners;\n var tarCorner = tar.corners;\n if (tar !== undefined) {\n if (tarPort === undefined) {\n var refPoint = findEndPoint(target.direction, target.point, tar);\n target.point = getIntersection(element, tar, target.point, refPoint, true);\n }\n }\n var extra = 20;\n if (source.direction !== target.direction || seg === NoOfSegments.Five) {\n if (source.direction === getOppositeDirection(target.direction) || seg === NoOfSegments.Three) {\n switch (source.direction) {\n case 'Left':\n if (srcCorner.middleLeft.x > tarCorner.middleRight.x) {\n extra = Math.min(extra, (srcCorner.middleLeft.x - tarCorner.middleRight.x) / 2);\n }\n break;\n case 'Right':\n if (srcCorner.middleRight.x < tarCorner.middleLeft.x) {\n extra = Math.min(extra, (tarCorner.middleLeft.x - srcCorner.middleRight.x) / 2);\n }\n break;\n case 'Top':\n if (srcCorner.topCenter.y > tarCorner.bottomCenter.y) {\n extra = Math.min(extra, (srcCorner.topCenter.y - tarCorner.bottomCenter.y) / 2);\n }\n break;\n case 'Bottom':\n if (srcCorner.bottomCenter.y < tarCorner.topCenter.y) {\n extra = Math.min(extra, (tarCorner.topCenter.y - srcCorner.bottomCenter.y) / 2);\n }\n break;\n }\n }\n }\n switch (source.direction) {\n case 'Left':\n if (source.point.x > srcCorner.middleLeft.x) {\n extra = (source.point.x - srcCorner.middleLeft.x) > extra ? ((source.point.x - srcCorner.middleLeft.x) + extra) : extra;\n }\n break;\n case 'Right':\n if (source.point.x < srcCorner.middleRight.x) {\n extra = (srcCorner.middleRight.x - source.point.x) > extra ? ((srcCorner.middleRight.x - source.point.x) + extra) : extra;\n }\n break;\n case 'Top':\n if (source.point.y > srcCorner.topCenter.y) {\n extra = (source.point.y - srcCorner.topCenter.y) > extra ? ((source.point.y - srcCorner.topCenter.y) + extra) : extra;\n }\n break;\n case 'Bottom':\n if (source.point.y < srcCorner.bottomCenter.y) {\n extra = (srcCorner.bottomCenter.y - source.point.y) > extra ? ((srcCorner.bottomCenter.y - source.point.y) + extra) : extra;\n }\n break;\n }\n if (segLength) {\n extra = Math.max(extra, segLength);\n }\n if (seg === NoOfSegments.One) {\n intermeditatePoints = [source.point, target.point];\n }\n if (seg === NoOfSegments.Two) {\n intermeditatePoints = orthoConnection2Segment(source, target);\n }\n if (seg === NoOfSegments.Three) {\n intermeditatePoints = orthoConnection3Segment(element, source, target, extra);\n }\n if (seg === NoOfSegments.Four) {\n var prevDir = undefined;\n intermeditatePoints = orthoConnection4Segment(source, target, prevDir, intermeditatePoints, extra);\n }\n if (seg === NoOfSegments.Five) {\n intermeditatePoints = orthoConnection5Segment(source, target, extra);\n }\n return intermeditatePoints;\n}\nfunction orthoConnection2Segment(source, target) {\n var intermeditatePoints;\n switch (source.direction) {\n case 'Left':\n case 'Right':\n var point1 = { x: target.point.x, y: source.point.y };\n intermeditatePoints = (Point.equals(source.point, point1) || Point.equals(target.point, point1)) ?\n [source.point, target.point] : [source.point, point1, target.point];\n break;\n case 'Top':\n case 'Bottom':\n var point2 = { x: source.point.x, y: target.point.y };\n intermeditatePoints = (Point.equals(source.point, point2) || Point.equals(target.point, point2)) ?\n [source.point, target.point] : [source.point, point2, target.point];\n break;\n }\n return intermeditatePoints;\n}\nfunction orthoConnection3Segment(element, source, target, extra, allow) {\n if (!extra) {\n extra = 20;\n }\n var srcPort = element.sourcePortWrapper;\n var intermeditatePoints;\n var segmentValue;\n var next;\n var diffx = target.point.x - source.point.x;\n var diffy = target.point.y - source.point.y;\n var temp;\n if (!allow && (Math.abs(diffx) < 0.001 || Math.abs(diffy) < 0.001)) {\n if (target.direction === undefined) {\n intermeditatePoints = [source.point, target.point];\n return intermeditatePoints;\n }\n }\n if (element.targetWrapper === undefined && Math.abs(diffx) <= 31 && Math.abs(diffy) <= 31) {\n if ((source.direction === 'Left' || source.direction === 'Right')) {\n if (Math.abs(diffy) < 12) {\n source.direction = (source.point.y > target.point.y) ? 'Top' : 'Bottom';\n }\n }\n else {\n if (Math.abs(diffx) < 12) {\n source.direction = (source.point.x > target.point.x) ? 'Left' : 'Right';\n }\n }\n if (Math.abs(diffx) > 12 || Math.abs(diffy) > 12) {\n return orthoConnection2Segment(source, target);\n }\n else {\n extra += 5;\n }\n }\n if (source.direction === 'Left' || source.direction === 'Right') {\n if (source.direction === 'Right') {\n if (target.direction !== undefined && target.direction === 'Right') {\n extra = Math.max(source.point.x, target.point.x) - source.point.x + extra;\n }\n if (source.point.x > target.point.x && srcPort === undefined) {\n extra = -extra;\n }\n }\n else {\n if (target.direction !== undefined && target.direction === 'Left') {\n extra = source.point.x - Math.min(source.point.x, target.point.x) + extra;\n }\n if (source.point.x > target.point.x || srcPort !== undefined || source.direction === 'Left') {\n extra = -extra;\n }\n }\n temp = target.point.y - source.point.y;\n segmentValue = addLineSegment(source.point, extra, 0);\n temp = target.point.y - segmentValue.y;\n if (temp !== 0) {\n next = addLineSegment(segmentValue, target.point.y - segmentValue.y, 90);\n }\n }\n else if (source.direction === 'Top' || source.direction === 'Bottom') {\n if (source.direction === 'Bottom') {\n if (target.direction !== undefined && target.direction === 'Bottom') {\n extra = Math.max(source.point.y, target.point.y) - source.point.y + extra;\n }\n }\n else {\n if (target.direction !== undefined && target.direction === 'Top') {\n extra = source.point.y - Math.min(source.point.y, target.point.y) + extra;\n }\n if (source.point.y > target.point.y || (srcPort !== undefined) || source.direction === 'Top') {\n extra = -extra;\n }\n }\n temp = target.point.x - source.point.x;\n if (source.direction === 'Top') {\n segmentValue = addLineSegment(source.point, extra, 90);\n }\n else {\n segmentValue = addLineSegment(source.point, extra, 90);\n }\n temp = target.point.x - segmentValue.x;\n if (temp !== 0) {\n next = addLineSegment(segmentValue, target.point.x - segmentValue.x, 0);\n }\n }\n if (temp === 0) {\n return intermeditatePoints = [\n source.point,\n target.point\n ];\n }\n intermeditatePoints = [\n source.point,\n segmentValue,\n next,\n target.point\n ];\n return intermeditatePoints;\n}\nfunction orthoConnection5Segment(source, target, extra) {\n if (extra === void 0) { extra = 20; }\n var intermeditatePoints;\n var length = extra;\n var sLeft = source.corners.middleLeft.x - source.margin.left;\n var sRight = source.corners.middleRight.x + source.margin.right;\n var sBottom = source.corners.bottomCenter.y + source.margin.bottom;\n var sTop = source.corners.topCenter.y - source.margin.top;\n var tLeft = target.corners.middleLeft.x - target.margin.left;\n var tRight = target.corners.middleRight.x + target.margin.right;\n var tBottom = target.corners.bottomCenter.y + target.margin.bottom;\n var tTop = target.corners.topCenter.y - target.margin.top;\n var segmentValue;\n switch (source.direction) {\n case 'Left':\n if ((sTop > tTop && sTop < tBottom || sBottom < tBottom && sBottom > tTop) &&\n sLeft > tLeft && sLeft <= tRight && extra >= 20) {\n length = source.point.x - target.corners.middleLeft.x + length;\n }\n segmentValue = addLineSegment(source.point, length, 180);\n break;\n case 'Top':\n if ((sLeft > tLeft && sLeft < tRight || sRight < tRight && sRight > tLeft) &&\n sTop > tTop && sTop <= tBottom && extra >= 20) {\n length = source.point.y - target.corners.topCenter.y + length;\n }\n segmentValue = addLineSegment(source.point, length, 270);\n break;\n case 'Right':\n if ((sTop > tTop && sTop < tBottom || sBottom < tBottom && sBottom > tTop) &&\n sRight < tRight && sRight >= tLeft && extra >= 20) {\n length = target.corners.middleRight.x - source.point.x + length;\n }\n segmentValue = addLineSegment(source.point, length, 0);\n break;\n case 'Bottom':\n if ((sLeft > tLeft && sLeft < tRight || sRight < tRight && sRight > tLeft) &&\n sBottom < tBottom && sBottom >= tTop && extra >= 20) {\n length = target.corners.bottomCenter.y - source.point.y + length;\n }\n segmentValue = addLineSegment(source.point, length, 90);\n break;\n }\n intermeditatePoints = [\n source.point,\n segmentValue\n ];\n if (source.direction === 'Top' || source.direction === 'Bottom') {\n var prevDir = source.direction;\n source.direction = segmentValue.x > target.point.x ? 'Left' : 'Right';\n source.point = segmentValue;\n intermeditatePoints = orthoConnection4Segment(source, target, prevDir, intermeditatePoints);\n }\n else {\n var prevDir = source.direction;\n source.direction = segmentValue.y > target.point.y ? 'Top' : 'Bottom';\n source.point = segmentValue;\n intermeditatePoints = orthoConnection4Segment(source, target, prevDir, intermeditatePoints);\n }\n return intermeditatePoints;\n}\nfunction orthoConnection4Segment(source, target, prevDir, interPt, e) {\n if (e === void 0) { e = 20; }\n var segmentValue;\n if (prevDir === undefined) {\n source.margin = { left: 2, right: 2, top: 2, bottom: 2 };\n target.margin = { left: 0, right: 5, top: 0, bottom: 5 };\n }\n else {\n if (source.direction === 'Bottom') {\n if (target.corners.top > source.corners.bottom && target.corners.top - source.corners.bottom < 20) {\n e = (target.corners.top - source.corners.bottom) / 2;\n }\n }\n else if (source.direction === 'Top') {\n if (target.corners.bottom < source.corners.top && source.corners.top - target.corners.bottom < 20) {\n e = (source.corners.top - target.corners.bottom) / 2;\n }\n }\n else if (source.direction === 'Right') {\n if (target.corners.left > source.corners.right && target.corners.left - source.corners.right < 20) {\n e = (target.corners.left - source.corners.right) / 2;\n }\n }\n else if (source.direction === 'Left') {\n if (target.corners.right < source.corners.left && source.corners.left - target.corners.right < 20) {\n e = (source.corners.left - target.corners.right) / 2;\n }\n }\n }\n switch (source.direction) {\n case 'Left':\n e = getLeftLength(source, target, prevDir, e);\n segmentValue = addLineSegment(source.point, e, 180);\n break;\n case 'Right':\n e = getRightLength(source, target, e, prevDir);\n segmentValue = addLineSegment(source.point, e, 0);\n break;\n case 'Top':\n e = getTopLength(source, target, prevDir, e);\n segmentValue = addLineSegment(source.point, e, 270);\n break;\n case 'Bottom':\n e = getBottomLength(source, target, e, prevDir);\n segmentValue = addLineSegment(source.point, e, 90);\n }\n if (interPt !== undefined) {\n interPt.push(segmentValue);\n }\n else {\n interPt = [\n source.point,\n segmentValue\n ];\n }\n if (source.direction === 'Top' || source.direction === 'Bottom') {\n getOrtho3Seg(segmentValue, 'horizontal', source, target, interPt);\n }\n else if (source.direction === 'Right' || source.direction === 'Left') {\n getOrtho3Seg(segmentValue, 'vertical', source, target, interPt);\n }\n return interPt;\n}\nfunction getOrtho3Seg(sPt, orientation, src, tar, points) {\n var point1;\n var point2;\n var point3;\n if (orientation === 'horizontal') {\n src.margin = { left: 0, right: 10, top: 0, bottom: 10 };\n tar.margin = { left: 0, right: 10, top: 0, bottom: 10 };\n }\n else if (orientation === 'vertical') {\n src.margin = { left: 10, right: 0, top: 10, bottom: 0 };\n tar.margin = { left: 10, right: 0, top: 10, bottom: 0 };\n }\n var extra = 20;\n if (orientation === 'horizontal') {\n switch (tar.direction) {\n case 'Left':\n if (src.corners.right + src.margin.right < tar.corners.left - tar.margin.left &&\n (tar.corners.left - src.corners.right > extra || (src.corners.top - src.margin.top <= tar.point.y &&\n src.corners.bottom + src.margin.bottom >= tar.point.y))) {\n var gap = Math.min(Math.abs(tar.corners.left - src.corners.right) / 2, 20);\n extra = src.corners.right - sPt.x + gap;\n }\n else {\n if ((src.direction === 'Top' && sPt.y > tar.point.y) || (src.direction === 'Bottom' && sPt.y < tar.point.y)) {\n extra = Math.min(tar.corners.left, sPt.x) - sPt.x - 20;\n }\n else if (sPt.x >= src.corners.left - src.margin.left && sPt.x <= src.corners.right + src.margin.right) {\n extra = Math.min(tar.corners.left, src.corners.left) - sPt.x - 20;\n }\n else {\n extra = tar.corners.left - sPt.x - 20;\n }\n }\n break;\n case 'Right':\n if (src.corners.left - src.margin.left > tar.corners.right + tar.margin.right &&\n (src.corners.left - tar.corners.right > extra || (src.corners.top - src.margin.top <= tar.point.y &&\n src.corners.bottom + src.margin.bottom >= tar.point.y))) {\n var gap = Math.min(Math.abs(src.corners.left - tar.corners.right) / 2, 20);\n extra = src.corners.left - sPt.x - gap;\n }\n else {\n if ((src.direction === 'Top' && sPt.y > tar.point.y) || (src.direction === 'Bottom' && sPt.y < tar.point.y)) {\n extra = Math.max(tar.corners.right, sPt.x) - sPt.x + 20;\n }\n else if (sPt.x >= src.corners.left - src.margin.left && sPt.x <= src.corners.right + src.margin.right) {\n extra = Math.max(tar.corners.right, src.corners.right) - sPt.x + 20;\n }\n else {\n extra = tar.corners.right - sPt.x + 20;\n }\n }\n break;\n }\n point1 = addLineSegment(sPt, extra, 0);\n point2 = addLineSegment(point1, tar.point.y - sPt.y, 90);\n point3 = tar.point;\n }\n else if (orientation === 'vertical') {\n switch (tar.direction) {\n case 'Top':\n if (src.corners.bottom + src.margin.bottom < tar.corners.top - tar.margin.top &&\n (tar.corners.top - src.corners.bottom > extra || (src.corners.left - src.margin.left <= tar.point.x &&\n src.corners.right + src.margin.right >= tar.point.x))) {\n var gap = Math.min(Math.abs(tar.corners.top - src.corners.bottom) / 2, 20);\n extra = src.corners.bottom - sPt.y + gap;\n }\n else {\n if ((src.direction === 'Left' && sPt.x > tar.point.x) || (src.direction === 'Right' && sPt.x < tar.point.x)) {\n extra = Math.min(tar.corners.top, sPt.y) - sPt.y - 20;\n }\n else if (sPt.y >= src.corners.top - src.margin.top && sPt.y <= src.corners.bottom + src.margin.bottom) {\n extra = Math.min(tar.corners.top, src.corners.top) - sPt.y - 20;\n }\n else {\n extra = tar.corners.top - sPt.y - 20;\n }\n }\n break;\n case 'Bottom':\n if (src.corners.top - src.margin.top > tar.corners.bottom + tar.margin.bottom &&\n (src.corners.top - tar.corners.bottom > extra || (src.corners.left - src.margin.left <= tar.point.x &&\n src.corners.right + src.margin.right >= tar.point.x))) {\n var gap = Math.min(Math.abs(src.corners.top - tar.corners.bottom) / 2, 20);\n extra = src.corners.top - sPt.y - gap;\n }\n else {\n if ((src.direction === 'Left' && sPt.x > tar.point.x) || (src.direction === 'Right' && sPt.x < tar.point.x)) {\n extra = Math.max(tar.corners.bottom, sPt.y) - sPt.y + 20;\n }\n else if (sPt.y >= src.corners.top - src.margin.top && sPt.y <= src.corners.bottom + src.margin.bottom) {\n extra = Math.max(tar.corners.bottom, src.corners.bottom) - sPt.y + 20;\n }\n else {\n extra = tar.corners.bottom - sPt.y + 20;\n }\n }\n break;\n }\n point1 = addLineSegment(sPt, extra, 90);\n point2 = addLineSegment(point1, tar.point.x - sPt.x, 0);\n point3 = tar.point;\n }\n points.push(point1);\n points.push(point2);\n points.push(point3);\n}\nfunction getTopLength(source, target, preDir, length) {\n if (source.corners.top - source.margin.top > target.corners.top + target.margin.top &&\n source.corners.top - source.margin.top <= target.corners.bottom + target.margin.bottom) {\n if (target.direction === 'Right' && source.point.x < target.point.x) {\n length += source.corners.top - target.corners.top;\n }\n else if (target.direction === 'Left' && source.point.x > target.point.x) {\n length += source.corners.top - target.corners.top;\n }\n length += source.point.y - source.corners.top;\n }\n else {\n if ((preDir !== undefined && preDir !== 'Left') && target.direction === 'Right' && source.point.x < target.point.x) {\n length += Math.abs(source.point.y - target.corners.bottom);\n }\n else if ((preDir !== undefined && preDir !== 'Right') && target.direction === 'Left'\n && target.point.x < source.point.x) {\n length += Math.abs(source.point.y - target.corners.bottom);\n }\n else {\n length += source.point.y - source.corners.top;\n }\n }\n return length;\n}\nfunction getLeftLength(source, target, prevDir, segLength) {\n if (source.corners.left - source.margin.left > target.corners.left - target.margin.left &&\n source.corners.left - source.margin.left <= target.corners.right + target.margin.right) {\n if (target.direction === 'Bottom' && source.point.y < target.point.y) {\n segLength += source.corners.left - target.corners.left;\n }\n else if (target.direction === 'Top' && source.point.y > target.point.y) {\n segLength += source.corners.left - target.corners.left;\n }\n segLength += source.point.x - source.corners.left;\n }\n else {\n if ((prevDir !== undefined && prevDir !== 'Top') && target.direction === 'Bottom' && source.point.y < target.point.y) {\n segLength += Math.abs(source.point.x - target.corners.right);\n }\n else if ((prevDir !== undefined && prevDir !== 'Bottom') &&\n target.direction === 'Top' && target.point.y < source.point.y) {\n segLength += Math.abs(source.point.x - target.corners.right);\n }\n else {\n segLength += source.point.x - source.corners.left;\n }\n }\n return segLength;\n}\nfunction getRightLength(source, target, length, prevDir) {\n if (source.corners.right + source.margin.right < target.corners.right + target.margin.right &&\n source.corners.right + source.margin.right >= target.corners.left - target.margin.left) {\n if (target.direction === 'Bottom' && source.point.y < target.point.y) {\n length += target.corners.right - source.corners.right;\n }\n else if (target.direction === 'Top' && source.point.y > target.point.y) {\n length += target.corners.right - source.corners.right;\n }\n length += source.corners.right - source.point.x;\n }\n else {\n if ((prevDir !== undefined && prevDir !== 'Top') && target.direction === 'Bottom' && source.point.y < target.point.y) {\n length += Math.abs(source.point.x - target.corners.right);\n }\n else if ((prevDir !== undefined && prevDir !== 'Bottom') && target.direction === 'Top' && target.point.y < source.point.y) {\n length += Math.abs(source.point.x - target.corners.right);\n }\n else {\n length += source.corners.right - source.point.x;\n }\n }\n return length;\n}\nfunction getBottomLength(source, target, segLength, prevDir) {\n if (source.corners.bottom + source.margin.bottom < target.corners.bottom + target.margin.bottom &&\n source.corners.bottom + source.margin.bottom >= target.corners.top - target.margin.top) {\n if (target.direction === 'Right' && source.point.x < target.point.x) {\n segLength += target.corners.bottom - source.corners.bottom;\n }\n else if (target.direction === 'Left' && source.point.x > target.point.x) {\n segLength += target.corners.bottom - source.corners.bottom;\n }\n segLength += source.corners.bottom - source.point.y;\n }\n else {\n if ((prevDir !== undefined && prevDir !== 'Left') &&\n target.direction === 'Right' && source.point.x < target.point.x) {\n segLength += Math.abs(source.point.y - target.corners.bottom);\n }\n else if ((prevDir !== undefined && prevDir !== 'Right') &&\n target.direction === 'Left' && target.point.x < source.point.x) {\n segLength += Math.abs(source.point.y - target.corners.bottom);\n }\n else {\n segLength += source.corners.bottom - source.point.y;\n }\n }\n return segLength;\n}\nfunction getSwapping(srcDir, tarDir) {\n var swap = false;\n switch (srcDir) {\n case 'Left':\n switch (tarDir) {\n case 'Right':\n case 'Bottom':\n swap = true;\n break;\n }\n break;\n case 'Top':\n switch (tarDir) {\n case 'Left':\n case 'Right':\n case 'Bottom':\n swap = true;\n break;\n }\n break;\n case 'Bottom':\n switch (tarDir) {\n case 'Right':\n swap = true;\n break;\n }\n break;\n }\n return swap;\n}\nfunction swapPoints(source, target) {\n var direction = source.direction;\n source.direction = target.direction;\n target.direction = direction;\n var point = source.point;\n source.point = target.point;\n target.point = point;\n var corner = source.corners;\n source.corners = target.corners;\n target.corners = corner;\n}\nexport function getPortDirection(point, corner, bounds, closeEdge) {\n var direction;\n var boundsValue = corner === undefined ? bounds : corner;\n var one = boundsValue.topLeft;\n var two = boundsValue.topRight;\n var three = boundsValue.bottomRight;\n var four = boundsValue.bottomLeft;\n var center = boundsValue.center;\n var angle = findAngle(center, point);\n var fourty5 = findAngle(center, three);\n var one35 = findAngle(center, four);\n var two25 = findAngle(center, one);\n var three15 = findAngle(center, two);\n if (angle > two25 && angle < three15) {\n direction = 'Top';\n // if (bounds.width < bounds.height && closeEdge) {\n // let height: number = (bounds.height - bounds.width) / 2;\n // let width: number = bounds.width;\n // if (Math.abs(point.x - one.x) < Math.abs(point.x - two.x)) {\n // direction = checkCloseEdge(direction, new Rect(one.x, one.y, width, height), point, 'Left');\n // } else {\n // direction = checkCloseEdge(direction, new Rect(two.x - bounds.width, two.y, width, height), point, 'Right');\n // }\n // }\n }\n else if (angle >= fourty5 && angle < one35) {\n direction = 'Bottom';\n // if (bounds.width < bounds.height && closeEdge) {\n // let height: number = (bounds.height - bounds.width) / 2;\n // let width: number = bounds.width;\n // if (Math.abs(point.x - four.x) < Math.abs(point.x - three.x)) {\n // direction = checkCloseEdge(direction, new Rect(four.x, four.y - height, width, height), point, 'Left');\n // } else {\n // let value: Rect = new Rect(three.x - bounds.width, three.y - bounds.height / 4, bounds.width, bounds.height / 4);\n // direction = checkCloseEdge(direction, value, point, 'Right');\n // }\n // }\n }\n else if (angle >= one35 && angle <= two25) {\n direction = 'Left';\n // if (bounds.width > bounds.height && closeEdge) {\n // let width: number = (bounds.width - bounds.height) / 2;\n // let height: number = bounds.height;\n // if (Math.abs(point.y - one.y) < Math.abs(point.y - four.y)) {\n // direction = checkCloseEdge(direction, new Rect(one.x, one.y, width, height), point, 'Top');\n // } else {\n // direction = checkCloseEdge(direction, new Rect(four.x, four.y - height, width, height), point, 'Bottom');\n // }\n // }\n }\n else if (angle >= three15 || angle < fourty5) {\n direction = 'Right';\n // if (bounds.width > bounds.height && closeEdge) {\n // let width: number = (bounds.width - bounds.height) / 2;\n // let height: number = bounds.height;\n // if (Math.abs(point.y - two.y) < Math.abs(point.y - three.y)) {\n // direction = checkCloseEdge(direction, new Rect(two.x - width, two.y, width, height), point, 'Top');\n // } else {\n // direction = checkCloseEdge(direction, \n //new Rect(three.x - width, three.y - height, width, height), point, 'Bottom');\n // }\n // }\n }\n else {\n direction = 'Right';\n }\n return direction;\n}\n// function checkCloseEdge(direction: string, threshold: Rect, port: PointModel, nearest: string): string {\n// if (threshold) {\n// switch (direction) {\n// case 'Bottom':\n// case 'Top':\n// let left: number = Math.abs(threshold.left - port.x);\n// let right: number = Math.abs(threshold.right - port.x);\n// let ver: number = direction === 'Top' ? Math.abs(threshold.top - port.y) : Math.abs(threshold.bottom - port.y);\n// if (left < right) {\n// if (left < ver) {\n// return 'Left';\n// }\n// } else {\n// if (right < ver) {\n// return 'Right';\n// }\n// }\n// break;\n// case 'Left':\n// case 'Right':\n// let top: number = Math.abs(threshold.top - port.y);\n// let bottom: number = Math.abs(threshold.bottom - port.y);\n// let hor: number = direction === 'Left' ? Math.abs(threshold.left - port.x) : Math.abs(threshold.right - port.x);\n// if (top < bottom) {\n// if (top < hor) {\n// return 'Top';\n// }\n// } else {\n// if (bottom < hor) {\n// return 'Bottom';\n// }\n// }\n// break;\n// }\n// }\n//Meant for dock port\n// return direction;\n// }\n/** @private */\nexport function getOuterBounds(obj) {\n var outerBounds;\n outerBounds = obj.wrapper.children[0].bounds;\n if (obj.sourceDecorator.shape !== 'None') {\n outerBounds.uniteRect(obj.wrapper.children[1].bounds);\n }\n if (obj.targetDecorator.shape !== 'None') {\n outerBounds.uniteRect(obj.wrapper.children[2].bounds);\n }\n return outerBounds;\n}\nexport function getOppositeDirection(direction) {\n switch (direction) {\n case 'Top':\n return 'Bottom';\n case 'Bottom':\n return 'Top';\n case 'Left':\n return 'Right';\n case 'Right':\n return 'Left';\n }\n return 'auto';\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n/// \nimport { Property, Complex, Collection, ChildProperty, ComplexFactory, CollectionFactory } from '@syncfusion/ej2-base';\nimport { ShapeStyle, StrokeStyle } from '../core/appearance';\nimport { Point } from '../primitives/point';\nimport { TextElement } from '../core/elements/text-element';\nimport { Transform, ConnectorConstraints } from '../enum/enum';\nimport { Rect } from '../primitives/rect';\nimport { Size } from '../primitives/size';\nimport { findAngle, findConnectorPoints, getOuterBounds } from '../utility/connector';\nimport { getAnnotationPosition, alignLabelOnSegments, updateConnector } from '../utility/diagram-util';\nimport { randomId, getFunction } from './../utility/base-util';\nimport { PathElement } from '../core/elements/path-element';\nimport { PathAnnotation } from './annotation';\nimport { Canvas } from '../core/containers/canvas';\nimport { getDecoratorShape } from './dictionary/common';\nimport { NodeBase } from './node-base';\nimport { DiagramTooltip } from './tooltip';\nimport { identityMatrix, rotateMatrix, scaleMatrix, transformPointsByMatrix } from '../primitives/matrix';\nvar getConnectorType = function (obj) {\n switch (obj.type) {\n case 'Bpmn':\n return BpmnFlow;\n default:\n return ConnectorShape;\n }\n};\nvar getSegmentType = function (obj) {\n switch (obj.type) {\n case 'Straight':\n return StraightSegment;\n case 'Bezier':\n return BezierSegment;\n case 'Orthogonal':\n return OrthogonalSegment;\n default:\n return StraightSegment;\n }\n};\n/**\n * Decorators are used to decorate the end points of the connector with some predefined path geometry\n */\nvar Decorator = /** @class */ (function (_super) {\n __extends(Decorator, _super);\n function Decorator() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property(10)\n ], Decorator.prototype, \"width\", void 0);\n __decorate([\n Property(10)\n ], Decorator.prototype, \"height\", void 0);\n __decorate([\n Property('Arrow')\n ], Decorator.prototype, \"shape\", void 0);\n __decorate([\n Complex({ fill: 'black', strokeColor: 'black', strokeWidth: 1 }, ShapeStyle)\n ], Decorator.prototype, \"style\", void 0);\n __decorate([\n Complex({ x: 0, y: 0.5 }, Point)\n ], Decorator.prototype, \"pivot\", void 0);\n __decorate([\n Property('')\n ], Decorator.prototype, \"pathData\", void 0);\n return Decorator;\n}(ChildProperty));\nexport { Decorator };\nvar Vector = /** @class */ (function (_super) {\n __extends(Vector, _super);\n function Vector() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property(0)\n ], Vector.prototype, \"angle\", void 0);\n __decorate([\n Property(0)\n ], Vector.prototype, \"distance\", void 0);\n return Vector;\n}(ChildProperty));\nexport { Vector };\n/**\n * Sets the type of the connector\n */\nvar ConnectorShape = /** @class */ (function (_super) {\n __extends(ConnectorShape, _super);\n function ConnectorShape() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('None')\n ], ConnectorShape.prototype, \"type\", void 0);\n return ConnectorShape;\n}(ChildProperty));\nexport { ConnectorShape };\n/**\n * Sets the type of the Bpmn flows\n */\nvar BpmnFlow = /** @class */ (function (_super) {\n __extends(BpmnFlow, _super);\n function BpmnFlow() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('Sequence')\n ], BpmnFlow.prototype, \"flow\", void 0);\n __decorate([\n Property('Normal')\n ], BpmnFlow.prototype, \"sequence\", void 0);\n __decorate([\n Property('Default')\n ], BpmnFlow.prototype, \"message\", void 0);\n __decorate([\n Property('Default')\n ], BpmnFlow.prototype, \"association\", void 0);\n return BpmnFlow;\n}(ConnectorShape));\nexport { BpmnFlow };\nvar ConnectorSegment = /** @class */ (function (_super) {\n __extends(ConnectorSegment, _super);\n // tslint:disable-next-line:no-any\n function ConnectorSegment(parent, propName, defaultValue, isArray) {\n var _this = _super.call(this, parent, propName, defaultValue, isArray) || this;\n _this.points = [];\n return _this;\n }\n __decorate([\n Property('Straight')\n ], ConnectorSegment.prototype, \"type\", void 0);\n return ConnectorSegment;\n}(ChildProperty));\nexport { ConnectorSegment };\nvar StraightSegment = /** @class */ (function (_super) {\n __extends(StraightSegment, _super);\n function StraightSegment() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Complex({ x: 0, y: 0 }, Point)\n ], StraightSegment.prototype, \"point\", void 0);\n return StraightSegment;\n}(ConnectorSegment));\nexport { StraightSegment };\nvar BezierSegment = /** @class */ (function (_super) {\n __extends(BezierSegment, _super);\n function BezierSegment() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Complex({ x: 0, y: 0 }, Point)\n ], BezierSegment.prototype, \"point1\", void 0);\n __decorate([\n Complex({ x: 0, y: 0 }, Point)\n ], BezierSegment.prototype, \"point2\", void 0);\n __decorate([\n Complex({ angle: 0, distance: 0 }, Vector)\n ], BezierSegment.prototype, \"vector1\", void 0);\n __decorate([\n Complex({ angle: 0, distance: 0 }, Vector)\n ], BezierSegment.prototype, \"vector2\", void 0);\n return BezierSegment;\n}(StraightSegment));\nexport { BezierSegment };\nvar OrthogonalSegment = /** @class */ (function (_super) {\n __extends(OrthogonalSegment, _super);\n function OrthogonalSegment() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property(null)\n ], OrthogonalSegment.prototype, \"length\", void 0);\n __decorate([\n Property(null)\n ], OrthogonalSegment.prototype, \"direction\", void 0);\n return OrthogonalSegment;\n}(ConnectorSegment));\nexport { OrthogonalSegment };\n/**\n * Get the direction of the control points while the bezier is connected to the node\n */\nexport function getDirection(bounds, points, excludeBounds) {\n var center = bounds.center;\n var direction;\n var part = excludeBounds ? 45 : (180 / (2 + 2 / (bounds.height / bounds.width)));\n var fourty5 = part;\n var one35 = (180 - part);\n var two25 = one35 + (2 * part);\n var three15 = 360 - part;\n var angle = findAngle(points, center);\n if (angle > fourty5 && angle < one35) {\n return direction = 'top';\n }\n else if (angle > one35 && angle < two25) {\n return direction = 'right';\n }\n else if (angle > two25 && angle < three15) {\n return direction = 'bottom';\n }\n else {\n return direction = 'left';\n }\n}\nexport function isEmptyVector(element) {\n if (!element.distance && !element.angle) {\n return true;\n }\n return false;\n}\n/**\n * Get the bezier points if control points are not given.\n */\nexport function getBezierPoints(sourcePoint, targetPoint, direction) {\n var distance = 60;\n var value = { x: 0, y: 0 };\n if (!direction) {\n if (Math.abs(targetPoint.x - sourcePoint.x) > Math.abs(targetPoint.y - sourcePoint.y)) {\n direction = sourcePoint.x < targetPoint.x ? 'right' : 'left';\n }\n else {\n direction = sourcePoint.y < targetPoint.y ? 'bottom' : 'top';\n }\n }\n switch (direction) {\n case 'bottom':\n case 'top':\n distance = Math.min(Math.abs(sourcePoint.y - targetPoint.y) * 0.45, distance);\n value = { x: sourcePoint.x, y: sourcePoint.y + (direction === 'bottom' ? distance : -distance) };\n break;\n case 'right':\n case 'left':\n distance = Math.min(Math.abs(sourcePoint.x - targetPoint.x) * 0.45, distance);\n value = { x: sourcePoint.x + (direction === 'right' ? distance : -distance), y: sourcePoint.y };\n break;\n }\n return value;\n}\n/**\n * Get the bezier curve bounds.\n */\nexport function getBezierBounds(startPoint, controlPoint1, controlPoint2, endPoint, connector) {\n var minx = 0;\n var miny = 0;\n var maxx = 0;\n var maxy = 0;\n var tolerancevalue = 3;\n var max = Number((connector.distance(controlPoint1, startPoint) +\n connector.distance(controlPoint2, controlPoint1) +\n connector.distance(endPoint, controlPoint2)) / tolerancevalue);\n if (max !== 0) {\n for (var i = 0; i <= max; i++) {\n var t = i / max;\n var x = (1 - t) * (1 - t) * (1 - t) * startPoint.x +\n 3 * t * (1 - t) * (1 - t) * controlPoint1.x +\n 3 * t * t * (1 - t) * controlPoint2.x +\n t * t * t * endPoint.x;\n var y = (1 - t) * (1 - t) * (1 - t) * startPoint.y +\n 3 * t * (1 - t) * (1 - t) * controlPoint1.y +\n 3 * t * t * (1 - t) * controlPoint2.y +\n t * t * t * endPoint.y;\n if (i === 0) {\n minx = maxx = x;\n miny = maxy = y;\n }\n else {\n minx = Math.min(x, minx);\n miny = Math.min(y, miny);\n maxx = Math.max(x, maxx);\n maxy = Math.max(y, maxy);\n }\n }\n }\n return {\n x: minx, y: miny, width: maxx - minx, height: maxy - miny,\n left: minx, top: miny, right: (minx + (maxx - minx)), bottom: (miny + (maxy - miny)),\n center: { x: (minx + (maxx - minx)) / 2, y: (miny + (maxy - miny)) / 2 },\n };\n}\n/**\n * Get the intermediate bezier curve for point over connector\n */\nexport function bezierPoints(connector, startPoint, point1, point2, endPoint, i, max) {\n var pt = { x: 0, y: 0 };\n var t = i / max;\n var x = (1 - t) * (1 - t) * (1 - t) * startPoint.x +\n 3 * t * (1 - t) * (1 - t) * point1.x +\n 3 * t * t * (1 - t) * point2.x +\n t * t * t * endPoint.x;\n pt.x = x;\n var y = (1 - t) * (1 - t) * (1 - t) * startPoint.y +\n 3 * t * (1 - t) * (1 - t) * point1.y +\n 3 * t * t * (1 - t) * point2.y +\n t * t * t * endPoint.y;\n pt.y = y;\n return pt;\n}\n/**\n * Connectors are used to create links between nodes\n */\nvar Connector = /** @class */ (function (_super) {\n __extends(Connector, _super);\n // tslint:disable-next-line:no-any\n function Connector(parent, propName, defaultValue, isArray) {\n var _this = _super.call(this, parent, propName, defaultValue, isArray) || this;\n /** @private */\n _this.parentId = '';\n /** @private */\n _this.bridges = [];\n return _this;\n }\n /** @private */\n // tslint:disable-next-line:no-any\n Connector.prototype.init = function (diagram) {\n if (!this.id) {\n this.id = randomId();\n }\n var bpmnElement;\n var container = new Canvas();\n var segment = new PathElement();\n segment.id = this.id + '_path';\n var srcDecorator = new PathElement();\n var targetDecorator = new PathElement();\n segment = this.getSegmentElement(this, segment);\n var bounds;\n var points = [];\n points = this.getConnectorPoints(this.type);\n points = this.clipDecorators(this, points);\n bounds = Rect.toBounds(points);\n container.width = bounds.width;\n container.height = bounds.height;\n container.offsetX = bounds.x + container.pivot.x * bounds.width;\n container.offsetY = bounds.y + container.pivot.y * bounds.height;\n switch (this.shape.type) {\n case 'Bpmn':\n switch (this.shape.flow) {\n case 'Sequence':\n bpmnElement = this.getBpmnSequenceFlow();\n break;\n case 'Association':\n bpmnElement = new PathElement();\n bpmnElement.visible = false;\n this.getBpmnAssociationFlow();\n break;\n case 'Message':\n bpmnElement = this.getBpmnMessageFlow();\n segment = this.getSegmentElement(this, segment);\n this.updateShapePosition(this, bpmnElement);\n break;\n }\n break;\n }\n var anglePoints = this.intermediatePoints;\n if (this.type === 'Bezier') {\n var firstSegment = this.segments[0];\n var lastSegment = this.segments[this.segments.length - 1];\n anglePoints = [!Point.isEmptyPoint(lastSegment.point2) ? lastSegment.point2 : lastSegment.bezierPoint2,\n !Point.isEmptyPoint(firstSegment.point1) ? firstSegment.point1 : firstSegment.bezierPoint1];\n }\n var accessContent = 'getDescription';\n var getDescription = diagram[accessContent];\n var strokeWidth = this.sourceWrapper ? this.sourceWrapper.style.strokeWidth / 2 / 2 : 0;\n srcDecorator = this.getDecoratorElement(points[0], anglePoints[1], this.sourceDecorator, true, getDescription);\n targetDecorator = this.getDecoratorElement(points[points.length - 1], anglePoints[anglePoints.length - 2], this.targetDecorator, false, getDescription);\n srcDecorator.id = this.id + '_srcDec';\n targetDecorator.id = this.id + '_tarDec';\n segment.style = this.style;\n /* tslint:disable:no-string-literal */\n segment.style['fill'] = 'transparent';\n if (getDescription !== undefined) {\n // tslint:disable-next-line:no-any\n var wrapperContent = getDescription(this, diagram);\n segment.description = wrapperContent ? wrapperContent : this.id;\n }\n container.style.strokeColor = 'transparent';\n container.style.fill = 'transparent';\n container.style.strokeWidth = 0;\n container.children = [segment, srcDecorator, targetDecorator];\n container.id = this.id;\n if (bpmnElement !== undefined) {\n container.children.push(bpmnElement);\n }\n container.offsetX = segment.offsetX;\n container.offsetY = segment.offsetY;\n container.width = segment.width;\n container.height = segment.height;\n for (var i = 0; this.annotations !== undefined, i < this.annotations.length; i++) {\n container.children.push(this.getAnnotationElement(this.annotations[i], this.intermediatePoints, bounds, getDescription));\n }\n this.wrapper = container;\n return container;\n };\n Connector.prototype.getBpmnSequenceFlow = function () {\n var segment = new PathElement();\n var pathseq = new PathElement();\n var pathseqData;\n if ((this.shape.sequence) === 'Normal' && this.type !== 'Bezier') {\n this.targetDecorator.shape = 'Arrow';\n this.targetDecorator.style.fill = 'black';\n }\n if ((this.shape.sequence) === 'Default') {\n segment = this.getSegmentElement(this, segment);\n var anglePoints = this.intermediatePoints;\n for (var j = 0; j < anglePoints.length - 1; j++) {\n length = length + this.distance(anglePoints[j], anglePoints[j + 1]);\n pathseqData = this.findPath(anglePoints[j], anglePoints[j + 1]);\n pathseq.data = pathseqData[0];\n pathseq.id = this.id + '_' + (this.shape.sequence);\n pathseq.offsetX = pathseqData[1].x;\n pathseq.offsetY = pathseqData[1].y;\n pathseq.rotateAngle = 45;\n pathseq.transform = Transform.Self;\n }\n this.targetDecorator.shape = 'Arrow';\n this.targetDecorator.style.fill = 'black';\n }\n if ((this.shape.sequence) === 'Conditional') {\n this.targetDecorator.shape = 'Arrow';\n this.sourceDecorator.shape = 'Diamond';\n this.sourceDecorator.style.fill = 'white';\n this.targetDecorator.style.fill = 'black';\n this.sourceDecorator.width = 20;\n this.sourceDecorator.height = 10;\n }\n return pathseq;\n };\n Connector.prototype.getBpmnAssociationFlow = function () {\n if ((this.shape.association) === 'Default') {\n this.targetDecorator.shape = 'Arrow';\n this.targetDecorator.style.fill = 'black';\n }\n if ((this.shape.association) === 'Directional') {\n this.style.strokeDashArray = '2 2';\n this.targetDecorator.style.fill = 'black';\n this.targetDecorator.shape = 'Arrow';\n }\n if ((this.shape.association) === 'BiDirectional') {\n this.style.strokeDashArray = '2 2';\n this.targetDecorator.shape = 'Arrow';\n this.targetDecorator.style.fill = 'black';\n this.sourceDecorator.shape = 'Arrow';\n this.sourceDecorator.style.fill = 'white';\n this.sourceDecorator.width = 5;\n this.sourceDecorator.height = 10;\n }\n };\n Connector.prototype.getBpmnMessageFlow = function () {\n var segmentMessage = new PathElement();\n this.style.strokeDashArray = '4 4';\n this.targetDecorator.shape = 'Arrow';\n this.targetDecorator.width = 5;\n this.targetDecorator.height = 10;\n this.sourceDecorator.shape = 'Circle';\n if (((this.shape.message) === 'InitiatingMessage') ||\n ((this.shape.message) === 'NonInitiatingMessage')) {\n segmentMessage.id = this.id + '_' + (this.shape.message);\n segmentMessage.width = 25;\n segmentMessage.height = 15;\n segmentMessage.data = 'M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0';\n segmentMessage.horizontalAlignment = 'Center';\n segmentMessage.verticalAlignment = 'Center';\n segmentMessage.transform = Transform.Self;\n segmentMessage.style.fill = (this.shape.message) === 'NonInitiatingMessage' ? 'lightgrey' : 'white';\n }\n return segmentMessage;\n };\n /** @private */\n Connector.prototype.distance = function (pt1, pt2) {\n return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));\n };\n Connector.prototype.findPath = function (sourcePt, targetPt) {\n var beginningpoint = { x: sourcePt.x, y: sourcePt.y };\n var distance = this.distance(sourcePt, targetPt);\n distance = Math.min(30, distance / 2);\n var angle = findAngle(sourcePt, targetPt);\n var transferpoint = Point.transform({ x: beginningpoint.x, y: beginningpoint.y }, angle, distance);\n var startpoint1 = Point.transform({ x: transferpoint.x, y: transferpoint.y }, angle, -12);\n var endpoint1 = Point.transform({ x: startpoint1.x, y: startpoint1.y }, angle, 12 * 2);\n var path = 'M' + startpoint1.x + ' ' + startpoint1.y + ' L' + endpoint1.x + ' ' + endpoint1.y;\n return [path, transferpoint];\n };\n /** @private */\n Connector.prototype.getAnnotationElement = function (annotation, points, bounds, getDescription) {\n annotation.id = annotation.id || randomId();\n var textele = new TextElement();\n textele.constraints = annotation.constraints;\n textele.visible = annotation.visibility;\n textele.horizontalAlignment = annotation.horizontalAlignment;\n textele.verticalAlignment = annotation.verticalAlignment;\n if (bounds.width !== undefined) {\n textele.width = (annotation.width || bounds.width) - annotation.margin.left - annotation.margin.right;\n }\n textele.margin = annotation.margin;\n textele.id = this.id + '_' + annotation.id;\n if (bounds.width === 0) {\n bounds.width = this.style.strokeWidth;\n }\n if (bounds.height === 0) {\n bounds.height = this.style.strokeWidth;\n }\n textele.content = annotation.content;\n textele.style = annotation.style;\n // tslint:disable-next-line:no-any\n var wrapperContent;\n var description = getFunction(getDescription);\n if (description) {\n wrapperContent = description(annotation, this);\n }\n textele.description = wrapperContent ? wrapperContent : textele.id;\n this.updateAnnotation(annotation, points, bounds, textele);\n textele.style.textOverflow = 'Wrap';\n return textele;\n };\n /** @private */\n Connector.prototype.updateAnnotation = function (annotation, points, bounds, textElement) {\n var getPointloop;\n var newPoint;\n var align;\n var hAlign;\n var vAlign;\n var offsetPoint;\n var pivotPoint = { x: 0, y: 0 };\n annotation.margin = { left: 0, right: 0, top: 0, bottom: 0 };\n textElement.refreshTextElement();\n textElement.width = (annotation.width || bounds.width) - textElement.margin.left - textElement.margin.right;\n getPointloop = getAnnotationPosition(points, annotation, bounds);\n newPoint = getPointloop.point;\n if (bounds.width === 0) {\n bounds.width = this.style.strokeWidth;\n }\n if (bounds.height === 0) {\n bounds.height = this.style.strokeWidth;\n }\n offsetPoint = { x: ((newPoint.x - bounds.x) / bounds.width), y: ((newPoint.y - bounds.y) / bounds.height) };\n pivotPoint.x = bounds.width * offsetPoint.x;\n pivotPoint.y = bounds.height * offsetPoint.y;\n align = alignLabelOnSegments(annotation, getPointloop.angle, points);\n hAlign = align.hAlign;\n vAlign = align.vAlign;\n var horizor;\n var verzor;\n if (hAlign === 'left') {\n horizor = 'Left';\n pivotPoint.x += annotation.displacement.x;\n }\n else if (hAlign === 'right') {\n horizor = 'Right';\n pivotPoint.x -= annotation.displacement.x;\n }\n else if (hAlign === 'center') {\n horizor = 'Center';\n }\n if (vAlign === 'top') {\n verzor = 'Top';\n pivotPoint.y += annotation.displacement.y;\n }\n else if (vAlign === 'bottom') {\n verzor = 'Bottom';\n pivotPoint.y -= annotation.displacement.y;\n }\n else if (vAlign === 'center') {\n verzor = 'Center';\n }\n textElement.horizontalAlignment = horizor;\n textElement.verticalAlignment = verzor;\n textElement.setOffsetWithRespectToBounds(pivotPoint.x, pivotPoint.y, 'Absolute');\n textElement.relativeMode = 'Point';\n };\n /** @private */\n Connector.prototype.getConnectorPoints = function (type, points, layoutOrientation) {\n var width = Math.abs(this.sourcePoint.x - this.targetPoint.x);\n var height = Math.abs(this.sourcePoint.y - this.targetPoint.y);\n points = findConnectorPoints(this, layoutOrientation);\n var newPoints = points.slice(0);\n if (newPoints && newPoints.length > 0) {\n this.sourcePoint = newPoints[0];\n this.targetPoint = newPoints[newPoints.length - 1];\n }\n return newPoints;\n };\n /** @private */\n Connector.prototype.clipDecorator = function (connector, points, isSource) {\n var point = { x: 0, y: 0 };\n var start = { x: 0, y: 0 };\n var end = { x: 0, y: 0 };\n var length = points.length;\n start = !isSource ? points[length - 1] : points[0];\n end = !isSource ? points[length - 2] : points[1];\n var len = Point.distancePoints(start, end);\n len = (len === 0) ? 1 : len;\n var width = connector.style.strokeWidth - 1;\n point.x = (Math.round(start.x + width * (end.x - start.x) / len));\n point.y = (Math.round(start.y + width * (end.y - start.y) / len));\n var strokeWidth = 1;\n var node = isSource ? connector.sourceWrapper : connector.targetWrapper;\n if (node) {\n strokeWidth = node.style.strokeWidth;\n }\n if ((isSource && connector.sourceDecorator.shape !== 'None') ||\n (!isSource && connector.targetDecorator.shape !== 'None')) {\n point = Point.adjustPoint(point, end, true, (strokeWidth / 2));\n }\n return point;\n };\n /** @private */\n Connector.prototype.clipDecorators = function (connector, pts) {\n if (connector.sourceDecorator.shape !== 'None') {\n pts[0] = this.clipDecorator(connector, pts, true);\n }\n if (connector.targetDecorator.shape !== 'None') {\n pts[pts.length - 1] = this.clipDecorator(connector, pts, false);\n }\n return pts;\n };\n /** @private */\n Connector.prototype.updateSegmentElement = function (connector, points, element) {\n var segmentPath;\n var bounds = new Rect();\n var point;\n segmentPath = this.getSegmentPath(connector, points);\n if (connector.type === 'Bezier') {\n if (this.segments.length > 0) {\n for (var i = 0; i < this.segments.length; i++) {\n var segment = this.segments[i];\n var connectorSegment = connector.segments[i];\n var point1 = !Point.isEmptyPoint(segment.point1) ? connectorSegment.point1 : connectorSegment.bezierPoint1;\n var point2 = !Point.isEmptyPoint(segment.point2) ? connectorSegment.point2 : connectorSegment.bezierPoint2;\n bounds.uniteRect(getBezierBounds(segment.points[0], point1, point2, segment.points[1], connector));\n }\n }\n }\n else {\n bounds = Rect.toBounds(points);\n }\n element.width = bounds.width;\n element.height = bounds.height;\n element.offsetX = bounds.x + element.width / 2;\n element.offsetY = bounds.y + element.height / 2;\n element.data = segmentPath;\n if (connector.wrapper) {\n connector.wrapper.offsetX = element.offsetX;\n connector.wrapper.offsetY = element.offsetY;\n connector.wrapper.width = bounds.width;\n connector.wrapper.height = bounds.height;\n }\n return element;\n };\n /** @private */\n Connector.prototype.getSegmentElement = function (connector, segmentElement) {\n var bounds;\n var segmentPath;\n var points = [];\n points = this.getConnectorPoints(connector.type);\n this.intermediatePoints = points;\n segmentElement.staticSize = true;\n segmentElement = this.updateSegmentElement(connector, points, segmentElement);\n return segmentElement;\n };\n /** @private */\n Connector.prototype.getDecoratorElement = function (offsetPoint, adjacentPoint, decorator, isSource, getDescription) {\n var decEle = new PathElement();\n var getPath;\n var angle;\n decEle.transform = Transform.Self;\n this.updateDecoratorElement(decEle, offsetPoint, adjacentPoint, decorator);\n if (getDescription !== undefined) {\n // tslint:disable-next-line:no-any\n var wrapperContent = getDescription(decorator, this);\n decEle.description = wrapperContent ? wrapperContent :\n ('Specifies the ' + isSource ? 'source' : 'target' + 'port element of the connector');\n }\n return decEle;\n };\n Connector.prototype.bridgePath = function (connector, path, pointIndex) {\n var pathData = path;\n if (connector.bridges.length > 0) {\n if (connector.type === 'Straight') {\n for (var n = 0; n < connector.bridges.length; n++) {\n var bridge = connector.bridges[n];\n if (!bridge.rendered) {\n pathData += ' L' + bridge.startPoint.x + ' ' + bridge.startPoint.y;\n pathData += bridge.path;\n bridge.rendered = true;\n }\n }\n }\n else if (connector.type === 'Orthogonal') {\n for (var n = 0; n < connector.bridges.length; n++) {\n var bridge = connector.bridges[n];\n if (bridge.segmentPointIndex === pointIndex) {\n if (!bridge.rendered) {\n if (bridge.segmentPointIndex === pointIndex) {\n pathData += ' L' + bridge.startPoint.x + ' ' + bridge.startPoint.y;\n pathData += bridge.path;\n bridge.rendered = true;\n }\n }\n }\n }\n }\n }\n return pathData;\n };\n /** @private */\n Connector.prototype.updateDecoratorElement = function (element, pt, adjacentPoint, decorator) {\n var getPath;\n var angle;\n element.offsetX = pt.x;\n element.offsetY = pt.y;\n angle = Point.findAngle(pt, adjacentPoint);\n getPath = getDecoratorShape(decorator.shape, decorator);\n var size = new Size(decorator.width, decorator.height);\n element.pivot.x = decorator.pivot.x;\n element.pivot.y = decorator.pivot.y;\n element.style = decorator.style;\n element.rotateAngle = angle;\n element.data = getPath;\n element.width = size.width;\n element.height = size.height;\n };\n /** @private */\n Connector.prototype.getSegmentPath = function (connector, points) {\n var path = '';\n var getPt;\n var end;\n var st;\n var pts = [];\n var j = 0;\n while (j < points.length) {\n pts.push({ x: points[j].x, y: points[j].y });\n j++;\n }\n for (var m = 0; m < connector.bridges.length; m++) {\n var bridge = connector.bridges[m];\n bridge.rendered = false;\n }\n pts = this.clipDecorators(connector, pts);\n if (this.cornerRadius > 0 && this.type !== 'Bezier') {\n for (var j_1 = 0; j_1 < pts.length - 1; j_1++) {\n getPt = pts[j_1];\n if (j_1 === 0) {\n path = 'M' + getPt.x + ' ' + getPt.y;\n }\n var segLength = Point.distancePoints(pts[j_1], pts[j_1 + 1]);\n if (segLength > 0) {\n if (j_1 < pts.length - 2) {\n if (segLength < this.cornerRadius * 2) {\n end = Point.adjustPoint(pts[j_1], pts[j_1 + 1], false, segLength / 2);\n }\n else {\n end = Point.adjustPoint(pts[j_1], pts[j_1 + 1], false, this.cornerRadius);\n }\n }\n else {\n end = pts[j_1 + 1];\n }\n if (j_1 > 0) {\n if (segLength < this.cornerRadius * 2) {\n st = Point.adjustPoint(pts[j_1], pts[j_1 + 1], true, segLength / 2);\n if (j_1 < pts.length - 2) {\n end = null;\n }\n }\n else {\n st = Point.adjustPoint(pts[j_1], pts[j_1 + 1], true, this.cornerRadius);\n }\n }\n if (st) {\n path += 'Q' + getPt.x + ' ' + getPt.y + ' ' + st.x + ' ' + st.y;\n }\n if (end) {\n if (connector.bridges.length > 0) {\n path = this.bridgePath(connector, path, j_1);\n if (connector.type === 'Orthogonal') {\n path = this.bridgePath(connector, path, j_1 + 1);\n }\n }\n path += ' L' + end.x + ' ' + end.y;\n }\n }\n }\n }\n else {\n if (this.type === 'Bezier') {\n var direction = void 0;\n var segments = this.segments;\n for (var j_2 = 0; j_2 < segments.length; j_2++) {\n if (pts.length > 2) {\n segments[j_2].bezierPoint1 = { x: 0, y: 0 };\n segments[j_2].bezierPoint2 = { x: 0, y: 0 };\n }\n if (Point.isEmptyPoint(segments[j_2].point1) && !segments[j_2].vector1.angle && !segments[j_2].vector1.distance) {\n if ((connector.sourceID || this.sourcePortID) && this.sourceWrapper) {\n direction = getDirection(this.sourceWrapper.bounds, pts[j_2], true);\n }\n segments[j_2].bezierPoint1 = getBezierPoints(pts[j_2], pts[j_2 + 1], direction);\n }\n else if (segments[j_2].vector1.angle || segments[j_2].vector1.distance) {\n segments[j_2].bezierPoint1 = Point.transform(pts[j_2], segments[j_2].vector1.angle, segments[j_2].vector1.distance);\n }\n else {\n segments[j_2].bezierPoint1 = {\n x: segments[j_2].point1.x || segments[j_2].bezierPoint1.x,\n y: segments[j_2].point1.y || segments[j_2].bezierPoint1.y\n };\n }\n if (Point.isEmptyPoint(segments[j_2].point2) && !segments[j_2].vector2.angle && !segments[j_2].vector2.distance) {\n if ((connector.targetID || this.targetPortID) && this.targetWrapper) {\n direction = getDirection(this.targetWrapper.bounds, pts[j_2 + 1], true);\n }\n segments[j_2].bezierPoint2 = getBezierPoints(pts[j_2 + 1], pts[j_2], direction);\n }\n else if (segments[j_2].vector2.angle || segments[j_2].vector2.distance) {\n segments[j_2].bezierPoint2 = Point.transform(pts[j_2 + 1], segments[j_2].vector2.angle, segments[j_2].vector2.distance);\n }\n else {\n segments[j_2].bezierPoint2 = {\n x: segments[j_2].point2.x || segments[j_2].bezierPoint2.x,\n y: segments[j_2].point2.y || segments[j_2].bezierPoint2.y\n };\n }\n }\n pts.splice(1, 0, { x: segments[0].bezierPoint1.x, y: segments[0].bezierPoint1.y });\n pts.splice(pts.length - 1, 0, {\n x: segments[segments.length - 1].bezierPoint2.x, y: segments[segments.length - 1].bezierPoint2.y\n });\n pts = this.clipDecorators(connector, pts);\n for (var j_3 = 0; j_3 < segments.length; j_3++) {\n if (j_3 === 0) {\n path = 'M' + pts[0].x + ' ' + pts[0].y;\n }\n var lastPoint = (j_3 === segments.length - 1) ? pts[pts.length - 1].x + ' ' + pts[pts.length - 1].y :\n segments[j_3].points[segments[j_3].points.length - 1].x + ' ' + segments[j_3].points[segments[j_3].points.length - 1].y;\n path += 'C' +\n segments[j_3].bezierPoint1.x + ' ' + segments[j_3].bezierPoint1.y + ' ' + segments[j_3].bezierPoint2.x + ' '\n + segments[j_3].bezierPoint2.y + ' ' + lastPoint;\n }\n }\n else {\n for (var k = 0; k < pts.length; k++) {\n getPt = pts[k];\n if (k === 0) {\n path = 'M' + getPt.x + ' ' + getPt.y;\n }\n if (k > 0) {\n path = this.bridgePath(connector, path, k);\n path += ' ' + 'L' + getPt.x + ' ' + getPt.y;\n }\n }\n }\n }\n return path;\n };\n /** @private */\n Connector.prototype.updateShapeElement = function (connector) {\n var element;\n switch (connector.shape.type) {\n case 'Bpmn':\n if (connector.wrapper.children[3] instanceof PathElement) {\n element = connector.wrapper.children[3];\n }\n if (connector.shape.flow === 'Message') {\n this.updateShapePosition(connector, element);\n }\n break;\n }\n };\n /** @private */\n Connector.prototype.updateShapePosition = function (connector, element) {\n var segmentOffset = 0.5;\n var angle;\n var pt;\n var length = 0;\n var anglePoints = this.intermediatePoints;\n for (var i = 0; i < anglePoints.length - 1; i++) {\n length = length + this.distance(anglePoints[i], anglePoints[i + 1]);\n var offsetLength = length * segmentOffset;\n if (length >= offsetLength) {\n angle = findAngle(anglePoints[i], anglePoints[i + 1]);\n pt = Point.transform(anglePoints[i], angle, offsetLength);\n }\n }\n element.offsetX = pt.x;\n element.offsetY = pt.y;\n };\n /** @hidden */\n Connector.prototype.scale = function (sw, sh, width, height, refObject) {\n var tx = 0;\n var ty = 0;\n if (this.wrapper && this.wrapper.outerBounds) {\n var outerBounds = getOuterBounds(this);\n var connWidth = (this.wrapper.bounds.width || this.style.strokeWidth || 1) - 2;\n var connHeight = (this.wrapper.bounds.height || this.style.strokeWidth || 1) - 2;\n tx = (outerBounds.width - connWidth);\n ty = (outerBounds.height - connHeight);\n sw = (width - (Math.max(tx, ty))) / connWidth;\n sh = (height - (Math.max(tx, ty))) / connHeight;\n tx = ty = Math.min(tx, ty);\n }\n sw = sh = Math.min(sw, sh);\n var matrix = identityMatrix();\n refObject = refObject || this.wrapper;\n rotateMatrix(matrix, -refObject.rotateAngle, refObject.offsetX, refObject.offsetY);\n scaleMatrix(matrix, sw, sh, refObject.offsetX, refObject.offsetY);\n rotateMatrix(matrix, refObject.rotateAngle, refObject.offsetX, refObject.offsetY);\n var points = transformPointsByMatrix(matrix, this.intermediatePoints);\n this.sourcePoint = points[0];\n this.targetPoint = points[points.length - 1];\n points = this.intermediatePoints = findConnectorPoints(this);\n updateConnector(this, points);\n return { x: tx, y: ty };\n };\n __decorate([\n ComplexFactory(getConnectorType)\n ], Connector.prototype, \"shape\", void 0);\n __decorate([\n Property(ConnectorConstraints.Default)\n ], Connector.prototype, \"constraints\", void 0);\n __decorate([\n Property(10)\n ], Connector.prototype, \"bridgeSpace\", void 0);\n __decorate([\n Collection([], PathAnnotation)\n ], Connector.prototype, \"annotations\", void 0);\n __decorate([\n Complex({}, Point)\n ], Connector.prototype, \"sourcePoint\", void 0);\n __decorate([\n Complex({}, Point)\n ], Connector.prototype, \"targetPoint\", void 0);\n __decorate([\n CollectionFactory(getSegmentType)\n ], Connector.prototype, \"segments\", void 0);\n __decorate([\n Property('')\n ], Connector.prototype, \"sourceID\", void 0);\n __decorate([\n Property('')\n ], Connector.prototype, \"targetID\", void 0);\n __decorate([\n Property(10)\n ], Connector.prototype, \"hitPadding\", void 0);\n __decorate([\n Property('Straight')\n ], Connector.prototype, \"type\", void 0);\n __decorate([\n Property(0)\n ], Connector.prototype, \"cornerRadius\", void 0);\n __decorate([\n Complex({ shape: 'None' }, Decorator)\n ], Connector.prototype, \"sourceDecorator\", void 0);\n __decorate([\n Complex({ shape: 'Arrow' }, Decorator)\n ], Connector.prototype, \"targetDecorator\", void 0);\n __decorate([\n Complex({}, DiagramTooltip)\n ], Connector.prototype, \"tooltip\", void 0);\n __decorate([\n Property('')\n ], Connector.prototype, \"sourcePortID\", void 0);\n __decorate([\n Property('')\n ], Connector.prototype, \"targetPortID\", void 0);\n __decorate([\n Complex({ strokeWidth: 1, strokeColor: 'black' }, StrokeStyle)\n ], Connector.prototype, \"style\", void 0);\n __decorate([\n Property(null)\n ], Connector.prototype, \"wrapper\", void 0);\n return Connector;\n}(NodeBase));\nexport { Connector };\n","import { Node } from './../objects/node';\nimport { NodeConstraints, ConnectorConstraints, DiagramConstraints, DiagramTools, DiagramAction } from '../enum/enum';\nimport { AnnotationConstraints, PortConstraints } from '../enum/enum';\nimport { Connector } from './../objects/connector';\nimport { Selector } from './../interaction/selector';\n/**\n * constraints-util module contains the common constraints\n */\n/** @private */\nexport function canSelect(node) {\n if (node) {\n var state = 0;\n if (node instanceof Connector) {\n state = node.constraints & ConnectorConstraints.Select;\n }\n else {\n state = node.constraints & NodeConstraints.Select;\n }\n return state;\n }\n return 1;\n}\n/** @private */\nexport function canMove(node) {\n if (node) {\n var state = 0;\n if (node instanceof Connector) {\n state = node.constraints & ConnectorConstraints.Drag;\n }\n else if (node instanceof Selector) {\n state = 1;\n }\n else {\n state = node.constraints & NodeConstraints.Drag;\n }\n return state;\n }\n return 1;\n}\n/** @private */\nexport function canEnablePointerEvents(node, diagram) {\n var state = 0;\n if (node instanceof Connector) {\n state = node.constraints & ConnectorConstraints.PointerEvents;\n }\n else {\n state = node.constraints & NodeConstraints.PointerEvents;\n }\n return state;\n}\n/** @private */\nexport function canDelete(node) {\n var state = 0;\n if (node instanceof Connector) {\n state = node.constraints & ConnectorConstraints.Delete;\n }\n else {\n state = node.constraints & NodeConstraints.Delete;\n }\n return state;\n}\n/** @private */\nexport function canBridge(connector, diagram) {\n var state = 0;\n if (connector.constraints & ConnectorConstraints.Bridging) {\n state = connector.constraints & ConnectorConstraints.Bridging;\n }\n else if (connector.constraints & ConnectorConstraints.InheritBridging) {\n state = diagram.constraints & DiagramConstraints.Bridging;\n }\n else {\n state = 0;\n }\n return state;\n}\n/** @private */\nexport function canDragSourceEnd(connector) {\n return connector.constraints & ConnectorConstraints.DragSourceEnd;\n}\n/** @private */\nexport function canDragTargetEnd(connector) {\n return connector.constraints & ConnectorConstraints.DragTargetEnd;\n}\n/** @private */\nexport function canDragSegmentThumb(connector) {\n return connector.constraints & ConnectorConstraints.DragSegmentThumb;\n}\n/** @private */\nexport function canRotate(node) {\n return node.constraints & NodeConstraints.Rotate;\n}\n/** @private */\nexport function canShadow(node) {\n return node.constraints & NodeConstraints.Shadow;\n}\n/** @private */\nexport function canInConnect(node) {\n if ((node instanceof Node) && (node.constraints & NodeConstraints.InConnect)) {\n return node.constraints & NodeConstraints.InConnect;\n }\n return 0;\n}\n/** @private */\nexport function canOutConnect(node) {\n if ((node instanceof Node) && (node.constraints & NodeConstraints.OutConnect)) {\n return node.constraints & NodeConstraints.OutConnect;\n }\n return 0;\n}\n/** @private */\nexport function canResize(node, direction) {\n var returnValue = 0;\n if (node) {\n if (direction === 'SouthEast') {\n returnValue = node.constraints & NodeConstraints.ResizeSouthEast;\n }\n else if (direction === 'East') {\n returnValue = node.constraints & NodeConstraints.ResizeEast;\n }\n else if (direction === 'NorthEast') {\n returnValue = node.constraints & NodeConstraints.ResizeNorthEast;\n }\n else if (direction === 'South') {\n returnValue = node.constraints & NodeConstraints.ResizeSouth;\n }\n else if (direction === 'North') {\n returnValue = node.constraints & NodeConstraints.ResizeNorth;\n }\n else if (direction === 'SouthWest') {\n returnValue = node.constraints & NodeConstraints.ResizeSouthWest;\n }\n else if (direction === 'West') {\n returnValue = node.constraints & NodeConstraints.ResizeWest;\n }\n else if (direction === 'NorthWest') {\n returnValue = node.constraints & NodeConstraints.ResizeNorthWest;\n }\n }\n return returnValue;\n}\n/** @private */\nexport function canAllowDrop(node) {\n var state = 0;\n if (node instanceof Connector) {\n state = node.constraints & ConnectorConstraints.AllowDrop;\n }\n else {\n state = node.constraints & NodeConstraints.AllowDrop;\n }\n return state;\n}\n/** @private */\nexport function canEnableToolTip(node, diagram) {\n var state = 0;\n if (node instanceof Connector) {\n if (node.constraints & ConnectorConstraints.Tooltip) {\n state = node.constraints & ConnectorConstraints.Tooltip;\n }\n else if (node.constraints & ConnectorConstraints.InheritTooltip) {\n state = diagram.constraints & DiagramConstraints.Tooltip;\n }\n }\n else {\n if (node.constraints & NodeConstraints.Tooltip) {\n state = node.constraints & NodeConstraints.Tooltip;\n }\n else if (node.constraints & NodeConstraints.InheritTooltip) {\n state = diagram.constraints & DiagramConstraints.Tooltip;\n }\n }\n return state;\n}\n/** @private */\nexport function canSingleSelect(model) {\n return model.tool & DiagramTools.SingleSelect;\n}\n/** @private */\nexport function canMultiSelect(model) {\n return model.tool & DiagramTools.MultipleSelect;\n}\n/** @private */\nexport function canZoomPan(model) {\n return model.tool & DiagramTools.ZoomPan;\n}\n/** @private */\nexport function canContinuousDraw(model) {\n return model.tool & DiagramTools.ContinuousDraw;\n}\n/** @private */\nexport function canDrawOnce(model) {\n return model.tool & DiagramTools.DrawOnce;\n}\n/** @private */\nexport function defaultTool(model) {\n return (model.tool & DiagramTools.SingleSelect) || (model.tool & DiagramTools.MultipleSelect);\n}\n/** @private */\nexport function canZoom(model) {\n return model.constraints & DiagramConstraints.Zoom;\n}\n/** @private */\nexport function canPan(model) {\n return model.constraints & DiagramConstraints.Pan;\n}\n/** @private */\nexport function canUserInteract(model) {\n return model.constraints & DiagramConstraints.UserInteraction;\n}\n/** @private */\nexport function canApiInteract(model) {\n return model.constraints & DiagramConstraints.ApiUpdate;\n}\n/** @private */\nexport function canPanX(model) {\n return ((model.constraints & DiagramConstraints.PanX));\n}\n/** @private */\nexport function canPanY(model) {\n return ((model.constraints & DiagramConstraints.PanY));\n}\n/** @private */\nexport function canPageEditable(model) {\n return canApiInteract(model) || (model.diagramActions & DiagramAction.ToolAction);\n}\n/** @private */\nexport function enableReadOnly(annotation, node) {\n var enumValue = 0;\n enumValue = (node instanceof Connector) ? ConnectorConstraints.ReadOnly : NodeConstraints.ReadOnly;\n if (node.shape.type === 'Text') {\n return node.constraints & NodeConstraints.ReadOnly;\n }\n else if (node.constraints & enumValue) {\n if (annotation.constraints & AnnotationConstraints.InheritReadOnly) {\n return 1;\n }\n else {\n return 0;\n }\n }\n else if (annotation.constraints & AnnotationConstraints.ReadOnly) {\n return 1;\n }\n return 0;\n}\n/** @private */\nexport function canDraw(port, diagram) {\n return port.constraints & PortConstraints.Draw;\n}\n/** @private */\nexport function canDrag(port, diagram) {\n return port.constraints & PortConstraints.Drag;\n}\n","import { createHtmlElement, removeElement } from '../utility/dom-util';\nimport { Ruler } from '../../ruler/index';\nimport { Size } from '../primitives/size';\nimport { getFunction } from '../utility/base-util';\n/**\n * defines the helper methods for the ruler\n */\n/**\n * @private\n */\nexport function renderOverlapElement(diagram) {\n var rulerSize = getRulerSize(diagram);\n var attributes = {\n 'id': diagram.element.id + '_overlapRuler',\n style: 'height:' + rulerSize.height + 'px;width:' + rulerSize.width + 'px;position:absolute;left:0;top:0',\n class: 'e-ruler-overlap'\n };\n var overlap = createHtmlElement('div', attributes);\n diagram.element.insertBefore(overlap, diagram.element.firstChild);\n}\n/**\n * @private\n */\nexport function renderRuler(diagram, isHorizontal) {\n var div = document.getElementById(diagram.element.id + (isHorizontal ? '_hRuler' : '_vRuler'));\n var rulerSize = getRulerSize(diagram);\n var rulerGeometry = getRulerGeometry(diagram);\n var margin = isHorizontal ? ('margin-left:' + rulerSize.width + 'px;') : ('margin-top:' + rulerSize.height + 'px;');\n if (!div) {\n var style = 'height:' + (isHorizontal ? rulerSize.height : (rulerGeometry.height + 100)) + 'px;overflow:hidden;width:' +\n (isHorizontal ? (rulerGeometry.width + 100) : rulerSize.width) + 'px;position:absolute;font-size:11px;' + margin;\n var attributes = {\n 'id': diagram.element.id + (isHorizontal ? '_hRuler' : '_vRuler'),\n style: style\n };\n div = createHtmlElement('div', attributes);\n }\n diagram.element.insertBefore(div, diagram.element.firstChild);\n var diagramRuler = isHorizontal ? diagram.rulerSettings.horizontalRuler : diagram.rulerSettings.verticalRuler;\n var ruler = new Ruler(diagramRuler);\n ruler.orientation = isHorizontal ? 'Horizontal' : 'Vertical';\n ruler.length = (isHorizontal ? rulerGeometry.width : rulerGeometry.height) + diagramRuler.segmentWidth;\n ruler.appendTo('#' + diagram.element.id + (isHorizontal ? '_hRuler' : '_vRuler'));\n isHorizontal ? diagram.hRuler = ruler : diagram.vRuler = ruler;\n var rulerObj = document.getElementById(diagram.element.id + (isHorizontal ? '_hRuler' : '_vRuler'));\n isHorizontal ? diagram.hRuler.element = rulerObj : diagram.vRuler.element = rulerObj;\n}\n/**\n * @private\n */\nexport function updateRuler(diagram) {\n var hOffset = -diagram.scroller.horizontalOffset;\n var vOffset = -diagram.scroller.verticalOffset;\n if (diagram && diagram.rulerSettings.showRulers) {\n diagram.hRuler.length = 0;\n diagram.vRuler.length = 0;\n if (hOffset !== undefined && diagram.hRuler.element) {\n updateRulerDimension(diagram, diagram.hRuler, hOffset, true);\n }\n if (vOffset !== undefined && diagram.vRuler.element) {\n updateRulerDimension(diagram, diagram.vRuler, vOffset, false);\n }\n }\n else {\n removeRulerElements(diagram);\n }\n}\n/**\n * @private\n */\nexport function removeRulerElements(diagram) {\n removeElement(diagram.element.id + '_hRuler');\n removeElement(diagram.element.id + '_vRuler');\n removeElement(diagram.element.id + '_overlapRuler');\n}\n/** @private */\nexport function getRulerSize(diagram) {\n var top = 0;\n var left = 0;\n if (diagram.rulerSettings.showRulers) {\n top = diagram.rulerSettings.horizontalRuler.thickness;\n left = diagram.rulerSettings.verticalRuler.thickness;\n }\n return new Size(left, top);\n}\n/** @private */\nexport function getRulerGeometry(diagram) {\n var rulerSize = getRulerSize(diagram);\n var height = diagram.scroller.viewPortHeight;\n var width = diagram.scroller.viewPortWidth;\n if (width < diagram.element.clientWidth - rulerSize.width) {\n width = diagram.element.clientWidth - rulerSize.width;\n }\n if (height < diagram.element.clientHeight - rulerSize.height) {\n height = diagram.element.clientHeight - rulerSize.height;\n }\n if (diagram.hRuler && diagram.hRuler.length) {\n width = diagram.hRuler.length;\n }\n if (diagram.vRuler && diagram.vRuler.length) {\n height = diagram.vRuler.length;\n }\n return new Size(width, height);\n}\n/**\n * @private\n */\nexport function removeRulerMarkers() {\n var markers = document.getElementsByClassName('e-d-ruler-marker');\n var marker;\n var i;\n if (markers && markers.length > 0) {\n for (i = markers.length - 1; i >= 0; i--) {\n marker = markers[i];\n if (marker) {\n marker.parentNode.removeChild(marker);\n }\n }\n }\n}\nexport function drawRulerMarkers(diagram, currentPoint) {\n if (diagram.rulerSettings.showRulers) {\n diagram.hRuler.drawRulerMarker(diagram.hRuler.element, currentPoint, diagram.scroller.horizontalOffset);\n diagram.vRuler.drawRulerMarker(diagram.vRuler.element, currentPoint, diagram.scroller.verticalOffset);\n }\n}\nfunction updateRulerDimension(diagram, ruler, offset, isHorizontal) {\n var rulerSize = getRulerSize(diagram);\n var rulerGeometry = getRulerGeometry(diagram);\n var diagramRuler = isHorizontal ? diagram.rulerSettings.horizontalRuler : diagram.rulerSettings.verticalRuler;\n updateRulerDiv(diagram, rulerGeometry, isHorizontal);\n updateRulerSpace(diagram, rulerGeometry, isHorizontal);\n ruler.offset = offset;\n ruler.scale = diagram.scroller.currentZoom;\n ruler.length = rulerGeometry.width + 100;\n ruler.arrangeTick = getFunction(diagramRuler.arrangeTick);\n ruler.dataBind();\n var rulerObj = isHorizontal ? diagram.hRuler.element : diagram.vRuler.element;\n if (isHorizontal) {\n rulerObj.style.marginLeft = (rulerSize.width - ruler.hRulerOffset) + 'px';\n }\n else {\n rulerObj.style.marginTop = (rulerSize.height - ruler.vRulerOffset) + 'px';\n }\n}\nfunction updateRulerSpace(diagram, rulerGeometry, isHorizontal) {\n var div = document.getElementById(diagram.element.id + (isHorizontal ? '_hRuler_ruler_space' : '_vRuler_ruler_space'));\n var ruler = isHorizontal ? diagram.hRuler : diagram.vRuler;\n if (div && diagram && rulerGeometry) {\n div.style.width = (isHorizontal ? (rulerGeometry.width + (ruler.segmentWidth * 2)) : ruler.thickness) + 'px';\n div.style.height = (isHorizontal ? ruler.thickness : (rulerGeometry.height + (ruler.segmentWidth * 2))) + 'px';\n }\n}\nfunction updateRulerDiv(diagram, rulerGeometry, isHorizontal) {\n var div = document.getElementById(diagram.element.id + (isHorizontal ? '_hRuler' : '_vRuler'));\n var ruler = isHorizontal ? diagram.hRuler : diagram.vRuler;\n if (div && diagram && rulerGeometry) {\n div.style.width = (isHorizontal ? (rulerGeometry.width + ruler.segmentWidth) : ruler.thickness) + 'px';\n div.style.height = (isHorizontal ? ruler.thickness : (rulerGeometry.height + ruler.segmentWidth)) + 'px';\n div = document.getElementById(diagram.element.id + '_overlapRuler');\n if (div) {\n isHorizontal ? (div.style.height = ruler.thickness + 'px') : (div.style.width = ruler.thickness + 'px');\n }\n }\n}\n","import { Rect } from './../primitives/rect';\nimport { identityMatrix, rotateMatrix, transformPointByMatrix, scaleMatrix } from './../primitives/matrix';\nimport { DiagramElement } from './../core/elements/diagram-element';\nimport { Container } from './../core/containers/container';\nimport { StrokeStyle } from './../core/appearance';\nimport { Point } from './../primitives/point';\nimport { ConnectorConstraints, NodeConstraints } from './../enum/enum';\nimport { SelectorConstraints, ThumbsConstraints } from './../enum/enum';\nimport { PathElement } from './../core/elements/path-element';\nimport { DiagramNativeElement } from './../core/elements/native-element';\nimport { TextElement } from '../core/elements/text-element';\nimport { ImageElement } from '../core/elements/image-element';\nimport { Node } from './../objects/node';\nimport { Connector, bezierPoints } from './../objects/connector';\nimport { getBasicShape } from './../objects/dictionary/basic-shapes';\nimport { getFlowShape } from './../objects/dictionary/flow-shapes';\nimport { Diagram } from './../diagram';\nimport { getContent, removeElement } from './dom-util';\nimport { getBounds, cloneObject, rotatePoint, getFunction } from './base-util';\nimport { getPolygonPath } from './../utility/path-util';\nimport { DiagramHtmlElement } from '../core/elements/html-element';\nimport { getRulerSize } from '../ruler/ruler';\n/** @private */\nexport function completeRegion(region, selectedObjects) {\n var collection = [];\n for (var i = 0; i < selectedObjects.length; i++) {\n var obj = selectedObjects[i];\n if (region.containsRect(obj.wrapper.bounds)) {\n collection.push(obj);\n }\n }\n return collection;\n}\n/**\n * @private\n */\nexport function findObjectType(drawingObject) {\n var type;\n if (drawingObject) {\n if (drawingObject.type) {\n type = 'Connector';\n }\n else if (drawingObject.shape && !drawingObject.type) {\n type = 'Node';\n }\n }\n return type;\n}\n/** @private */\nexport function findNearestPoint(reference, start, end) {\n var shortestPoint;\n var shortest = Point.findLength(start, reference);\n var shortest1 = Point.findLength(end, reference);\n if (shortest > shortest1) {\n shortestPoint = end;\n }\n else {\n shortestPoint = start;\n }\n var angleBWStAndEnd = Point.findAngle(start, end);\n var angleBWStAndRef = Point.findAngle(shortestPoint, reference);\n var r = Point.findLength(shortestPoint, reference);\n var vaAngle = angleBWStAndRef + ((angleBWStAndEnd - angleBWStAndRef) * 2);\n return {\n x: (shortestPoint.x + r * Math.cos(vaAngle * Math.PI / 180)),\n y: (shortestPoint.y + r * Math.sin(vaAngle * Math.PI / 180))\n };\n}\nfunction pointsForBezier(connector) {\n var points = [];\n if (connector.type === 'Bezier') {\n var k = 0;\n for (var i = 0; i < connector.segments.length; i++) {\n var tolerance = 1.5;\n var segment = connector.segments[i];\n var pt = { x: 0, y: 0 };\n var point1 = !Point.isEmptyPoint(segment.point1) ? segment.point1 : segment.bezierPoint1;\n var point2 = !Point.isEmptyPoint(segment.point2) ? segment.point2 : segment.bezierPoint2;\n var max = Number((connector.distance(point1, segment.points[0]) +\n connector.distance(point2, point1) +\n connector.distance(segment.points[1], point2)) / tolerance);\n for (var j = 0; j < max - 1; j = j + 10) {\n points[k] =\n bezierPoints(connector, segment.points[0], !Point.isEmptyPoint(segment.point1) ? segment.point1 : segment.bezierPoint1, !Point.isEmptyPoint(segment.point2) ? segment.point2 : segment.bezierPoint2, segment.points[1], j, max);\n k++;\n }\n }\n }\n return points;\n}\n/** @private */\nexport function isPointOverConnector(connector, reference) {\n var intermediatePoints;\n intermediatePoints = connector.type === 'Bezier' ? pointsForBezier(connector) :\n connector.intermediatePoints;\n for (var i = 0; i < intermediatePoints.length - 1; i++) {\n var start = intermediatePoints[i];\n var end = intermediatePoints[i + 1];\n var rect = Rect.toBounds([start, end]);\n rect.Inflate(connector.hitPadding);\n if (rect.containsPoint(reference)) {\n var intersectinPt = findNearestPoint(reference, start, end);\n var segment1 = { X1: start.x, X2: end.x, Y1: start.y, Y2: end.y };\n var segment2 = { X1: reference.x, X2: intersectinPt.x, Y1: reference.y, Y2: intersectinPt.y };\n var intersectDetails = intersect3(segment1, segment2);\n if (intersectDetails.enabled) {\n var distance = Point.findLength(reference, intersectDetails.intersectPt);\n if (Math.abs(distance) < connector.hitPadding) {\n return true;\n }\n }\n else {\n var rect_1 = Rect.toBounds([reference, reference]);\n rect_1.Inflate(3);\n if (rect_1.containsPoint(start) || rect_1.containsPoint(end)) {\n return true;\n }\n }\n if (Point.equals(reference, intersectinPt)) {\n return true;\n }\n }\n }\n return false;\n}\n/** @private */\nexport function intersect3(lineUtil1, lineUtil2) {\n var point = { x: 0, y: 0 };\n var l1 = lineUtil1;\n var l2 = lineUtil2;\n var d = (l2.Y2 - l2.Y1) * (l1.X2 - l1.X1) - (l2.X2 - l2.X1) * (l1.Y2 - l1.Y1);\n var na = (l2.X2 - l2.X1) * (l1.Y1 - l2.Y1) - (l2.Y2 - l2.Y1) * (l1.X1 - l2.X1);\n var nb = (l1.X2 - l1.X1) * (l1.Y1 - l2.Y1) - (l1.Y2 - l1.Y1) * (l1.X1 - l2.X1);\n if (d === 0) {\n return { enabled: false, intersectPt: point };\n }\n var ua = na / d;\n var ub = nb / d;\n if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {\n point.x = l1.X1 + (ua * (l1.X2 - l1.X1));\n point.y = l1.Y1 + (ua * (l1.Y2 - l1.Y1));\n return { enabled: true, intersectPt: point };\n }\n return { enabled: false, intersectPt: point };\n}\n/** @private */\nexport function getPoints(element, corners) {\n var line = [];\n var X1 = corners.topLeft;\n var X2 = corners.topRight;\n var Y1 = corners.bottomRight;\n var Y2 = corners.bottomLeft;\n if (element.rotateAngle !== 0 || element.parentTransform !== 0) {\n var matrix = identityMatrix();\n rotateMatrix(matrix, element.rotateAngle + element.parentTransform, element.offsetX, element.offsetY);\n X1 = transformPointByMatrix(matrix, X1);\n X2 = transformPointByMatrix(matrix, X2);\n Y1 = transformPointByMatrix(matrix, Y1);\n Y2 = transformPointByMatrix(matrix, Y2);\n }\n line.push(X1);\n line.push(X2);\n line.push(Y1);\n line.push(Y2);\n return line;\n}\n/**\n * @private\n * sets the offset of the tooltip.\n * @param diagram\n * @param mousePosition\n * @param node\n */\nexport function getTooltipOffset(diagram, mousePosition, node) {\n var offset;\n var inheritTooltip = (node instanceof Node) ? (node.constraints & NodeConstraints.InheritTooltip)\n : (node.constraints & ConnectorConstraints.InheritTooltip);\n var objectTooltip = (node instanceof Node) ? (node.constraints & NodeConstraints.Tooltip)\n : (node.constraints & ConnectorConstraints.Tooltip);\n var isMouseBased = ((!inheritTooltip && objectTooltip ? node.tooltip.relativeMode\n : diagram.tooltip.relativeMode) === 'Mouse') ? true : false;\n offset = tooltipOffset(node, mousePosition, diagram, isMouseBased);\n var rulerSize = getRulerSize(diagram);\n return { x: offset.x + rulerSize.width, y: offset.y + rulerSize.height };\n}\nfunction tooltipOffset(node, mousePosition, diagram, isMouseBased) {\n var point = {};\n var scale = diagram.scroller.transform.scale;\n var element = document.getElementById(diagram.element.id);\n var bounds = node.wrapper.outerBounds;\n var rect = element.getBoundingClientRect();\n var horizontalOffset = diagram.scroller.horizontalOffset;\n var verticalOffset = diagram.scroller.verticalOffset;\n switch (diagram.tooltipObject.position) {\n case 'BottomCenter':\n point = offsetPoint(mousePosition, bounds.bottomCenter, diagram, isMouseBased, (rect.width / 2), rect.height);\n break;\n case 'BottomLeft':\n case 'LeftBottom':\n point = offsetPoint(mousePosition, bounds.bottomLeft, diagram, isMouseBased, 0, rect.height);\n break;\n case 'BottomRight':\n case 'RightBottom':\n point = offsetPoint(mousePosition, bounds.bottomRight, diagram, isMouseBased, rect.width, rect.height);\n break;\n case 'LeftCenter':\n point = offsetPoint(mousePosition, bounds.middleLeft, diagram, isMouseBased, 0, (rect.height / 2));\n break;\n case 'LeftTop':\n case 'TopLeft':\n point = offsetPoint(mousePosition, bounds.topLeft, diagram, isMouseBased, 0, 0);\n break;\n case 'RightCenter':\n point = offsetPoint(mousePosition, bounds.middleRight, diagram, isMouseBased, rect.width, (rect.height / 2));\n break;\n case 'RightTop':\n case 'TopRight':\n point = offsetPoint(mousePosition, bounds.topRight, diagram, isMouseBased, rect.width, 0);\n break;\n case 'TopCenter':\n point = offsetPoint(mousePosition, bounds.topCenter, diagram, isMouseBased, (rect.width / 2), 0);\n break;\n }\n return point;\n}\nfunction offsetPoint(mousePosition, bound, diagram, isMouseBased, x, y) {\n var point = {};\n var scale = diagram.scroller.transform.scale;\n var horizontalOffset = diagram.scroller.horizontalOffset;\n var verticalOffset = diagram.scroller.verticalOffset;\n point.x = (isMouseBased ? mousePosition.x : bound.x) * scale + horizontalOffset - x;\n point.y = (isMouseBased ? mousePosition.y : bound.y) * scale + verticalOffset - y;\n return point;\n}\n/** @private */\nexport function sort(objects) {\n var i = 0;\n var j = 0;\n var temp;\n for (i = 0; i < objects.length; i++) {\n var b = getBounds(objects[i].wrapper);\n for (j = i; j < objects.length; j++) {\n var bounds = getBounds(objects[j].wrapper);\n if (b.center.x > bounds.center.x) {\n temp = objects[i];\n objects[i] = objects[j];\n objects[j] = temp;\n }\n }\n }\n return objects;\n}\n/** @private */\nexport function getAnnotationPosition(pts, annotation, bound) {\n var angle;\n var getloop;\n var point;\n getloop = getOffsetOfConnector(pts, annotation, bound);\n angle = Point.findAngle(pts[getloop.index], pts[getloop.index + 1]);\n var alignednumber = getAlignedPosition(annotation);\n point = Point.transform(getloop.point, angle + 45, alignednumber);\n getloop.point = point;\n getloop.angle = angle;\n return getloop;\n}\n/** @private */\nexport function getOffsetOfConnector(points, annotation, bounds) {\n var length = 0;\n var offset = annotation.offset;\n var point;\n var angle;\n var offsetLength;\n var lengths = [];\n var prevLength;\n var kCount;\n for (var j = 0; j < points.length - 1; j++) {\n length += Point.distancePoints(points[j], points[j + 1]);\n lengths.push(length);\n }\n offsetLength = offset * length;\n for (var k = 0; k < lengths.length; k++) {\n if (lengths[k] >= offsetLength) {\n angle = Point.findAngle(points[k], points[k + 1]);\n point = Point.transform(points[k], angle, offsetLength - (prevLength || 0));\n kCount = k;\n return { point: point, index: kCount };\n }\n prevLength = lengths[k];\n }\n return { point: point, index: kCount };\n}\n/** @private */\nexport function getAlignedPosition(annotation) {\n var cnst = annotation.content === undefined ? 10 : 0;\n var state = 0;\n switch (annotation.alignment) {\n case 'Center':\n state = 0;\n break;\n case 'Before':\n state = -((0) / 2 + cnst);\n break;\n case 'After':\n state = ((0) / 2 + cnst);\n break;\n }\n return state;\n}\n/** @private */\nexport function alignLabelOnSegments(obj, ang, pts) {\n var angle = ang % 360;\n ang %= 360;\n var fourty5 = 45;\n var one35 = 135;\n var two25 = 225;\n var three15 = 315;\n var vAlign;\n var hAlign;\n switch (obj.alignment) {\n case 'Before':\n if (ang >= fourty5 && ang <= one35) {\n hAlign = 'right';\n vAlign = obj.offset === 0.5 ? 'center' : 'top';\n }\n else if (ang >= two25 && ang <= three15) {\n hAlign = 'left';\n vAlign = obj.offset === 0.5 ? 'center' : 'bottom';\n }\n else if (ang > fourty5 && ang < two25) {\n vAlign = 'top';\n hAlign = obj.offset === 0.5 ? 'center' : 'right';\n }\n else {\n vAlign = 'bottom';\n hAlign = (obj.offset === 0.5) ? 'center' : 'left';\n }\n break;\n case 'After':\n if (ang >= fourty5 && ang <= one35) {\n hAlign = 'left';\n vAlign = obj.offset === 0.5 ? 'center' : 'top';\n }\n else if (ang >= two25 && ang <= three15) {\n hAlign = 'right';\n vAlign = obj.offset === 0.5 ? 'center' : 'bottom';\n }\n else if (ang > fourty5 && ang < two25) {\n vAlign = 'bottom';\n hAlign = obj.offset === 0.5 ? 'center' : 'right';\n }\n else {\n vAlign = 'top';\n hAlign = obj.offset === 0.5 ? 'center' : 'left';\n }\n break;\n case 'Center':\n hAlign = 'center';\n vAlign = 'center';\n break;\n }\n if (obj.offset === 0 || obj.offset === 1) {\n var direction = void 0;\n direction = getBezierDirection(pts[0], pts[1]);\n switch (direction) {\n case 'left':\n hAlign = obj.offset === 0 ? 'right' : 'left';\n break;\n case 'right':\n hAlign = obj.offset === 0 ? 'left' : 'right';\n break;\n case 'bottom':\n vAlign = obj.offset === 0 ? 'top' : 'bottom';\n break;\n case 'top':\n vAlign = obj.offset === 0 ? 'bottom' : 'top';\n break;\n }\n }\n return { hAlign: hAlign, vAlign: vAlign };\n}\n/** @private */\nexport function getBezierDirection(src, tar) {\n if (Math.abs(tar.x - src.x) > Math.abs(tar.y - src.y)) {\n return src.x < tar.x ? 'right' : 'left';\n }\n else {\n return src.y < tar.y ? 'bottom' : 'top';\n }\n}\n/** @private */\nexport function serialize(model) {\n var clonedObject = cloneObject(model, model.getCustomProperty);\n return JSON.stringify(clonedObject);\n}\n/** @private */\nexport function deserialize(model, diagram) {\n diagram.clear();\n diagram.protectPropertyChange(true);\n var map = diagram.dataSourceSettings.doBinding;\n var nodeTemp = diagram.setNodeTemplate;\n var getDescription = diagram.getDescription;\n var getCustomProperty = diagram.getCustomProperty;\n var commands = {};\n for (var _i = 0, _a = diagram.commandManager.commands; _i < _a.length; _i++) {\n var command = _a[_i];\n commands[command.name] = { execute: command.execute, canExecute: command.canExecute };\n }\n var arrangeTickHorizontal = diagram.rulerSettings.horizontalRuler.arrangeTick;\n var arrangeTickVertical = diagram.rulerSettings.verticalRuler.arrangeTick;\n var getLayoutInfo = diagram.layout.getLayoutInfo;\n var getBranch = diagram.layout.getBranch;\n var nodeDefaults = diagram.getNodeDefaults;\n var connectorDefaults = diagram.getConnectorDefaults;\n var dataObj = JSON.parse(model);\n diagram.contextMenuSettings = dataObj.contextMenuSettings;\n diagram.constraints = dataObj.constraints;\n diagram.tool = dataObj.tool;\n diagram.bridgeDirection = dataObj.bridgeDirection;\n diagram.pageSettings = dataObj.pageSettings;\n diagram.drawingObject = dataObj.drawingObject;\n diagram.tooltip = dataObj.tooltip;\n diagram.addInfo = dataObj.addInfo;\n diagram.getDescription = getDescription;\n diagram.scrollSettings = dataObj.scrollSettings;\n diagram.commandManager = dataObj.commandManager;\n diagram.layers = dataObj.layers;\n diagram.rulerSettings.horizontalRuler.arrangeTick = arrangeTickHorizontal;\n diagram.rulerSettings.verticalRuler.arrangeTick = arrangeTickVertical;\n for (var _b = 0, _c = diagram.commandManager.commands; _b < _c.length; _b++) {\n var cmd = _c[_b];\n if (commands[cmd.name]) {\n cmd.execute = commands[cmd.name].execute;\n cmd.canExecute = commands[cmd.name].canExecute;\n }\n }\n diagram.backgroundColor = dataObj.backgroundColor;\n diagram.basicElements = dataObj.basicElements;\n diagram.connectors = dataObj.connectors;\n diagram.dataSourceSettings = dataObj.dataSourceSettings;\n diagram.dataSourceSettings.doBinding = map;\n diagram.height = dataObj.height;\n diagram.setNodeTemplate = nodeTemp;\n diagram.getConnectorDefaults = connectorDefaults;\n diagram.getNodeDefaults = nodeDefaults;\n diagram.getCustomProperty = getCustomProperty;\n diagram.mode = dataObj.mode;\n diagram.nodes = dataObj.nodes;\n diagram.rulerSettings = dataObj.rulerSettings;\n diagram.snapSettings = dataObj.snapSettings;\n diagram.width = dataObj.width;\n diagram.layout = dataObj.layout;\n diagram.layout.getLayoutInfo = getFunction(getLayoutInfo);\n diagram.layout.getBranch = getFunction(getBranch);\n diagram.diagramActions = 0;\n diagram.isLoading = true;\n diagram.protectPropertyChange(false);\n var key = 'refresh';\n var component;\n for (var i = 0; i < diagram.views.length; i++) {\n component = diagram.views[diagram.views[i]];\n component.refresh();\n if (component instanceof Diagram) {\n diagram.element.classList.add('e-diagram');\n }\n }\n var selectedNodes = getCollection(dataObj.selectedItems.nodes, diagram.nodes);\n var selcectedConnectors = getCollection(dataObj.selectedItems.connectors, diagram.connectors);\n var selectedItems = [];\n selectedItems = selectedItems.concat(selectedNodes).concat(selcectedConnectors);\n diagram.select(selectedItems);\n return dataObj;\n}\nfunction getCollection(objNodes, diagramNodes) {\n var collection = [];\n for (var i = 0; i < objNodes.length; i++) {\n for (var _i = 0, diagramNodes_1 = diagramNodes; _i < diagramNodes_1.length; _i++) {\n var connectors = diagramNodes_1[_i];\n if (connectors.id === objNodes[i].id) {\n collection.push(connectors);\n }\n }\n }\n return collection;\n}\n/** @private */\nexport function updateStyle(changedObject, target) {\n //since text style model is the super set of shape style model, we used text style model\n var style = target.style;\n var textElement = target;\n for (var _i = 0, _a = Object.keys(changedObject); _i < _a.length; _i++) {\n var key = _a[_i];\n switch (key) {\n case 'fill':\n style.fill = changedObject.fill;\n if (style instanceof StrokeStyle) {\n /* tslint:disable:no-string-literal */\n style['fill'] = 'transparent';\n }\n break;\n case 'textOverflow':\n style.textOverflow = changedObject.textOverflow;\n break;\n case 'opacity':\n style.opacity = changedObject.opacity;\n break;\n case 'strokeColor':\n style.strokeColor = changedObject.strokeColor;\n break;\n case 'strokeDashArray':\n style.strokeDashArray = changedObject.strokeDashArray;\n break;\n case 'strokeWidth':\n style.strokeWidth = changedObject.strokeWidth;\n break;\n case 'bold':\n style.bold = changedObject.bold;\n break;\n case 'color':\n style.color = changedObject.color;\n break;\n case 'textWrapping':\n style.textWrapping = changedObject.textWrapping;\n break;\n case 'fontFamily':\n style.fontFamily = changedObject.fontFamily;\n break;\n case 'fontSize':\n style.fontSize = changedObject.fontSize;\n break;\n case 'italic':\n style.italic = changedObject.italic;\n break;\n case 'textAlign':\n style.textAlign = changedObject.textAlign;\n break;\n case 'whiteSpace':\n style.whiteSpace = changedObject.whiteSpace;\n break;\n case 'textDecoration':\n style.textDecoration = changedObject.textDecoration;\n break;\n case 'gradient':\n style.gradient = changedObject.gradient;\n break;\n }\n }\n if (target instanceof TextElement) {\n textElement.refreshTextElement();\n }\n}\n/** @private */\nexport function updateHyperlink(changedObject, target, actualAnnotation) {\n var textElement = target;\n var hyperlink = textElement.hyperlink;\n for (var _i = 0, _a = Object.keys(changedObject); _i < _a.length; _i++) {\n var key = _a[_i];\n switch (key) {\n case 'color':\n textElement.style.color = hyperlink.color = changedObject.color;\n break;\n case 'content':\n textElement.content = hyperlink.content = changedObject.content || hyperlink.link;\n break;\n case 'link':\n var labelStyle = actualAnnotation.style;\n textElement.style.color = changedObject.link ? hyperlink.color : labelStyle.color;\n textElement.style.textDecoration = changedObject.link ? hyperlink.textDecoration : actualAnnotation.style.textDecoration;\n textElement.content = changedObject.link ? hyperlink.content || changedObject.link : actualAnnotation.content;\n hyperlink.link = changedObject.link;\n break;\n case 'textDecoration':\n textElement.style.textDecoration = hyperlink.textDecoration = changedObject.textDecoration;\n break;\n }\n }\n}\nexport function updateShapeContent(content, actualObject, diagram) {\n content.width = actualObject.width;\n content.height = actualObject.height;\n content.minHeight = actualObject.minHeight;\n content.maxHeight = actualObject.maxHeight;\n content.minWidth = actualObject.minWidth;\n content.maxWidth = actualObject.maxWidth;\n content.horizontalAlignment = actualObject.wrapper.children[0].horizontalAlignment;\n content.verticalAlignment = actualObject.wrapper.children[0].verticalAlignment;\n content.relativeMode = actualObject.wrapper.children[0].relativeMode;\n content.visible = actualObject.wrapper.children[0].visible;\n if (actualObject.shape instanceof Text) {\n content.margin = actualObject.shape.margin;\n }\n content.id = actualObject.wrapper.children[0].id;\n content.style = actualObject.style;\n var view;\n for (var _i = 0, _a = diagram.views; _i < _a.length; _i++) {\n var elementId = _a[_i];\n removeElement(actualObject.id + '_groupElement', elementId);\n removeElement(actualObject.id + '_content_groupElement', elementId);\n removeElement(actualObject.id + '_content_html_element', elementId);\n }\n actualObject.wrapper.children.splice(0, 1);\n actualObject.wrapper.children.splice(0, 0, content);\n}\n/** @private */\nexport function updateShape(node, actualObject, oldObject, diagram) {\n var content = new DiagramElement();\n var i;\n var textStyle;\n var nodeStyle;\n switch (node.shape.type) {\n case 'Path':\n var pathContent = new PathElement();\n pathContent.data = actualObject.shape.data;\n content = pathContent;\n updateShapeContent(content, actualObject, diagram);\n break;\n case 'Image':\n var imageContent = new ImageElement();\n imageContent.source = actualObject.shape.source;\n imageContent.imageAlign = actualObject.shape.align;\n imageContent.imageScale = actualObject.shape.scale;\n content = imageContent;\n updateShapeContent(content, actualObject, diagram);\n break;\n case 'Text':\n //issue\n var textContent = new TextElement();\n // (textContent as TextElement).content = (node.shape as TextModel).content;\n content = textContent;\n updateShapeContent(content, actualObject, diagram);\n break;\n case 'Basic':\n var element = void 0;\n element = actualObject.shape.shape === 'Rectangle' ? new DiagramElement() : new PathElement();\n if (actualObject.shape.shape === 'Polygon') {\n element.data = getPolygonPath(actualObject.shape.points);\n }\n else {\n element.data = getBasicShape(actualObject.shape.shape);\n }\n updateShapeContent(content, actualObject, diagram);\n if (actualObject.shape.shape === 'Rectangle') {\n element.cornerRadius = actualObject.shape.cornerRadius;\n }\n content = element;\n break;\n case 'Flow':\n var flowShapeElement = new PathElement();\n flowShapeElement.data = getFlowShape(actualObject.shape.shape);\n content = flowShapeElement;\n updateShapeContent(content, actualObject, diagram);\n break;\n case 'Native':\n var nativeContent = new DiagramNativeElement();\n nativeContent.content = actualObject.shape.content;\n nativeContent.scale = actualObject.shape.scale;\n content = nativeContent;\n updateShapeContent(content, actualObject, diagram);\n break;\n case 'HTML':\n var htmlContent = new DiagramHtmlElement();\n htmlContent.content = actualObject.shape.content;\n content = htmlContent;\n updateShapeContent(content, actualObject, diagram);\n }\n if (node.shape.type === undefined || node.shape.type === oldObject.shape.type) {\n updateContent(node, actualObject);\n }\n else {\n content.width = actualObject.wrapper.children[0].width;\n content.height = actualObject.wrapper.children[0].height;\n if (actualObject.shape instanceof Text) {\n content.margin = actualObject.shape.margin;\n }\n content.style = actualObject.style;\n actualObject.wrapper.children[0] = content;\n }\n}\n/** @private */\nexport function updateContent(newValues, actualObject) {\n if (Object.keys(newValues.shape).length > 0) {\n if (actualObject.shape.type === 'Path' && newValues.shape.data !== undefined) {\n actualObject.wrapper.children[0].data = newValues.shape.data;\n }\n else if (actualObject.shape.type === 'Text' && newValues.shape.content !== undefined) {\n actualObject.wrapper.children[0].content = newValues.shape.content;\n }\n else if (actualObject.shape.type === 'Image' && newValues.shape.source !== undefined) {\n actualObject.wrapper.children[0].source = newValues.shape.source;\n }\n else if (actualObject.shape.type === 'Native') {\n var nativeElement = document.getElementById(actualObject.wrapper.children[0].id + '_groupElement');\n if (newValues.shape.content !== undefined && nativeElement) {\n nativeElement.removeChild(nativeElement.children[0]);\n actualObject.wrapper.children[0].content = newValues.shape.content;\n nativeElement.appendChild(getContent(actualObject.wrapper.children[0], false));\n }\n actualObject.wrapper.children[0].scale = newValues.shape.scale ?\n newValues.shape.scale : actualObject.wrapper.children[0].scale;\n }\n else if (actualObject.shape.type === 'HTML') {\n var htmlElement = document.getElementById(actualObject.wrapper.children[0].id + '_html_element');\n if (htmlElement) {\n htmlElement.removeChild(htmlElement.children[0]);\n actualObject.wrapper.children[0].content = newValues.shape.content;\n htmlElement.appendChild(getContent(actualObject.wrapper.children[0], true));\n }\n }\n else if (actualObject.shape.type === 'Flow' && newValues.shape.shape !== undefined) {\n actualObject.shape.shape = newValues.shape.shape;\n var shapes = actualObject.shape.shape;\n var flowshapedata = getFlowShape(shapes.toString());\n actualObject.wrapper.children[0].data = flowshapedata;\n }\n else if (newValues.shape.cornerRadius !== undefined) {\n actualObject.wrapper.children[0].cornerRadius = newValues.shape.cornerRadius;\n }\n else if (newValues.shape.shape !== undefined) {\n actualObject.shape.shape = newValues.shape.shape;\n var shapes = actualObject.shape.shape;\n var basicShapeData = getBasicShape(shapes.toString());\n actualObject.wrapper.children[0].data = basicShapeData;\n }\n }\n}\n/** @private */\nexport function removeItem(array, item) {\n var index = array.indexOf(item);\n if (index >= 0) {\n array.splice(index, 1);\n }\n}\n/** @private */\nexport function updateConnector(connector, points) {\n var srcPoint;\n var anglePoint;\n var srcDecorator;\n var tarDecorator;\n var targetPoint;\n connector.intermediatePoints = points;\n connector.updateSegmentElement(connector, points, connector.wrapper.children[0]);\n srcPoint = connector.sourcePoint;\n srcDecorator = connector.sourceDecorator;\n if (connector.type === 'Bezier') {\n var firstSegment = connector.segments[0];\n var lastSegment = connector.segments[connector.segments.length - 1];\n anglePoint = [!Point.isEmptyPoint(lastSegment.point2) ? lastSegment.point2 : lastSegment.bezierPoint2,\n !Point.isEmptyPoint(firstSegment.point1) ? firstSegment.point1 : firstSegment.bezierPoint1];\n }\n else {\n anglePoint = connector.intermediatePoints;\n }\n points = connector.clipDecorators(connector, points);\n var element = connector.wrapper.children[1];\n connector.updateDecoratorElement(element, points[0], anglePoint[1], srcDecorator);\n targetPoint = connector.targetPoint;\n tarDecorator = connector.targetDecorator;\n element = connector.wrapper.children[2];\n connector.updateDecoratorElement(element, points[points.length - 1], anglePoint[anglePoint.length - 2], tarDecorator);\n connector.updateShapeElement(connector);\n}\n/** @private */\nexport function getUserHandlePosition(selectorItem, handle, transform) {\n var wrapper = selectorItem.wrapper;\n var positionPoints;\n var bounds = wrapper.bounds;\n var offset = handle.offset;\n var size = handle.size / transform.scale;\n var margin = handle.margin;\n var point;\n var left = wrapper.offsetX - wrapper.actualSize.width * wrapper.pivot.x;\n var top = wrapper.offsetY - wrapper.actualSize.height * wrapper.pivot.y;\n point = { x: 0, y: 0 };\n if (selectorItem.nodes.length > 0) {\n switch (handle.side) {\n case 'Top':\n point.x += left + bounds.width * offset;\n point.y += top - size;\n break;\n case 'Bottom':\n point.x += left + offset * bounds.width;\n point.y += top + wrapper.actualSize.height + size;\n break;\n case 'Left':\n point.x += left - size;\n point.y += top + offset * bounds.height;\n break;\n case 'Right':\n point.x += left + wrapper.actualSize.width + size;\n point.y += top + offset * bounds.height;\n break;\n }\n point.x += (margin.left - margin.right) +\n (size / 2) * (handle.horizontalAlignment === 'Center' ? 0 : (handle.horizontalAlignment === 'Right' ? -1 : 1));\n point.y += (margin.top - margin.bottom) +\n (size / 2) * (handle.verticalAlignment === 'Center' ? 0 : (handle.verticalAlignment === 'Top' ? -1 : 1));\n }\n else if (selectorItem.connectors.length > 0) {\n var connector = selectorItem.connectors[0];\n var annotation = { offset: offset };\n var connectorOffset = getOffsetOfConnector(connector.intermediatePoints, annotation, bounds);\n var index = connectorOffset.index;\n point = connectorOffset.point;\n var getPointloop = getAnnotationPosition(connector.intermediatePoints, annotation, bounds);\n var points = connector.intermediatePoints;\n var offsetLength = void 0;\n var angle = getPointloop.angle;\n var matrix = identityMatrix();\n rotateMatrix(matrix, -angle, connector.intermediatePoints[index].x, connector.intermediatePoints[index].y);\n point = transformPointByMatrix(matrix, point);\n point.x += (margin.left - margin.right) +\n (size / 2) * (handle.horizontalAlignment === 'Center' ? 0 : (handle.horizontalAlignment === 'Right' ? -1 : 1));\n point.y += (margin.top - margin.bottom) +\n (size / 2) * (handle.verticalAlignment === 'Center' ? 0 : (handle.verticalAlignment === 'Top' ? -1 : 1));\n matrix = identityMatrix();\n rotateMatrix(matrix, angle, connector.intermediatePoints[index].x, connector.intermediatePoints[index].y);\n point = transformPointByMatrix(matrix, point);\n }\n if (wrapper.rotateAngle !== 0 || wrapper.parentTransform !== 0) {\n var matrix = identityMatrix();\n rotateMatrix(matrix, wrapper.rotateAngle + wrapper.parentTransform, wrapper.offsetX, wrapper.offsetY);\n point = transformPointByMatrix(matrix, point);\n }\n return point;\n}\n/** @private */\nexport function canResizeCorner(selectorConstraints, action, thumbsConstraints) {\n if ((SelectorConstraints[action] & selectorConstraints) && (ThumbsConstraints[action] & thumbsConstraints)) {\n return true;\n }\n return false;\n}\n/** @private */\nexport function canShowCorner(selectorConstraints, action) {\n if (SelectorConstraints[action] & selectorConstraints) {\n return true;\n }\n return false;\n}\n/** @private */\nexport function checkPortRestriction(port, portVisibility) {\n return port.visibility & portVisibility;\n}\n/** @private */\nexport function findAnnotation(node, id) {\n var annotation;\n if (node.shape.type === 'Text') {\n annotation = (node.shape);\n }\n else {\n var annotationId = id.split('_');\n id = annotationId[annotationId.length - 1];\n for (var i = 0; i < node.annotations.length; i++) {\n if (id === node.annotations[i].id) {\n annotation = node.annotations[i];\n }\n }\n }\n return annotation;\n}\nexport function findPortIndex(node, id) {\n var index;\n for (var i = 0; i < node.ports.length; i++) {\n if (node.ports[i].id === id) {\n return (i).toString();\n }\n }\n return null;\n}\n/** @private */\nexport function getObjectFromCollection(obj, id) {\n var i;\n for (i = 0; i < obj.length; i++) {\n if (id === obj[i].id) {\n return true;\n }\n }\n return false;\n}\n/** @private */\nexport function scaleElement(element, sw, sh, refObject) {\n if (element.width !== undefined && element.height !== undefined) {\n element.width *= sw;\n element.height *= sh;\n }\n if (element instanceof Container) {\n var matrix = identityMatrix();\n var width = refObject.width || refObject.actualSize.width;\n var height = refObject.height || refObject.actualSize.height;\n if (width !== undefined && height !== undefined) {\n var x = refObject.offsetX - width * refObject.pivot.x;\n var y = refObject.offsetY - height * refObject.pivot.y;\n var refPoint = {\n x: x + width * refObject.pivot.x,\n y: y + height * refObject.pivot.y\n };\n refPoint = rotatePoint(refObject.rotateAngle, refObject.offsetX, refObject.offsetY, refPoint);\n rotateMatrix(matrix, -refObject.rotateAngle, refPoint.x, refPoint.y);\n scaleMatrix(matrix, sw, sh, refPoint.x, refPoint.y);\n rotateMatrix(matrix, refObject.rotateAngle, refPoint.x, refPoint.y);\n for (var _i = 0, _a = element.children; _i < _a.length; _i++) {\n var child = _a[_i];\n if (child.width !== undefined && child.height !== undefined) {\n var newPosition = transformPointByMatrix(matrix, { x: child.offsetX, y: child.offsetY });\n child.offsetX = newPosition.x;\n child.offsetY = newPosition.y;\n scaleElement(child, sw, sh, refObject);\n }\n }\n }\n }\n}\n/** @private */\nexport function insertObject(obj, key, collection) {\n if (collection.length === 0) {\n collection.push(obj);\n }\n else if (collection.length === 1) {\n if (collection[0][key] > obj[key]) {\n collection.splice(0, 0, obj);\n }\n else {\n collection.push(obj);\n }\n }\n else if (collection.length > 1) {\n var low = 0;\n var high = collection.length - 1;\n var mid = Math.floor((low + high) / 2);\n while (mid !== low) {\n if (collection[mid][key] < obj[key]) {\n low = mid;\n mid = Math.floor((low + high) / 2);\n }\n else if (collection[mid][key] > obj[key]) {\n high = mid;\n mid = Math.floor((low + high) / 2);\n }\n }\n if (collection[high][key] < obj[key]) {\n collection.push(obj);\n }\n else if (collection[low][key] > obj[key]) {\n collection.splice(low, 0, obj);\n }\n else if ((collection[low][key] < obj[key]) && collection[high][key] > obj[key]) {\n collection.splice(high, 0, obj);\n }\n }\n}\n/**\n * Get the object as Node | Connector\n * @param obj\n */\nexport var getObjectType = function (obj) {\n if (obj) {\n if (obj.sourceID !== undefined || obj.sourcePoint !== undefined ||\n obj.targetID !== undefined || obj.targetPoint !== undefined ||\n obj.type !== undefined) {\n obj = Connector;\n }\n else {\n obj = Node;\n }\n }\n return obj;\n};\n","import { Connector } from '../objects/connector';\nimport { Node } from '../objects/node';\nimport { Rect } from '../primitives/rect';\nimport { identityMatrix, transformPointByMatrix, rotateMatrix } from '../primitives/matrix';\nimport { getUserHandlePosition, checkPortRestriction } from '../utility/diagram-util';\nimport { canMove, canDragSourceEnd, canDragTargetEnd, canContinuousDraw, canDragSegmentThumb } from '../utility/constraints-util';\nimport { canZoomPan, defaultTool, canDrawOnce, canDrag, canDraw } from '../utility/constraints-util';\nimport { canShowCorner, canResizeCorner } from '../utility/diagram-util';\nimport { Point } from '../primitives/point';\nimport { TextElement } from '../core/elements/text-element';\nimport { PortConstraints, DiagramTools, PortVisibility, ThumbsConstraints } from '../enum/enum';\nimport { Selector } from './selector';\nimport { PointPort } from './../objects/port';\n/**\n * Finds the action to be taken for the object under mouse\n *\n */\n/** @private */\nexport function findToolToActivate(obj, wrapper, position, diagram, touchStart, touchMove, target) {\n var conn = diagram.selectedItems.connectors[0];\n if (touchMove && touchMove.length > 1 && touchStart && touchStart.length > 1) {\n return 'PinchZoom';\n }\n if (diagram.currentSymbol) {\n return 'Drag';\n }\n var eventHandler = 'eventHandler';\n if (diagram[eventHandler].action === 'PortDraw') {\n diagram.tool &= ~DiagramTools.DrawOnce;\n }\n //Drawing Tools\n if ((canDrawOnce(diagram) || canContinuousDraw(diagram)) && diagram.drawingObject) {\n return 'Draw';\n }\n if (hasSelection(diagram)) {\n var handle = diagram.selectedItems;\n if (handle.wrapper && canShowCorner(handle.constraints, 'UserHandle')) {\n for (var _i = 0, _a = handle.userHandles; _i < _a.length; _i++) {\n var obj_1 = _a[_i];\n if (obj_1.visible) {\n var paddedBounds = getUserHandlePosition(handle, obj_1, diagram.scroller.transform);\n if (contains(position, paddedBounds, obj_1.size / 2)) {\n return obj_1.name;\n }\n }\n }\n }\n }\n //Panning\n if (canZoomPan(diagram) && !obj) {\n return 'Pan';\n }\n if (hasSelection(diagram)) {\n var element = diagram.selectedItems.wrapper;\n var selectorBnds = element.bounds;\n var paddedBounds = new Rect(selectorBnds.x, selectorBnds.y, selectorBnds.width, selectorBnds.height);\n var handle = diagram.selectedItems;\n if (hasSingleConnection(diagram)) {\n var conn_1 = diagram.selectedItems.connectors[0];\n var sourcePaddingValue = 10 / diagram.scrollSettings.currentZoom;\n var targetPaddingValue = 10 / diagram.scrollSettings.currentZoom;\n if (canShowCorner(handle.constraints, 'ResizeAll')) {\n if ((canShowCorner(handle.constraints, 'ConnectorSourceThumb'))\n && canDragSourceEnd(conn_1) && contains(position, conn_1.sourcePoint, sourcePaddingValue)) {\n return 'ConnectorSourceEnd';\n }\n if ((canShowCorner(handle.constraints, 'ConnectorTargetThumb'))\n && canDragTargetEnd(conn_1) && contains(position, conn_1.targetPoint, targetPaddingValue)) {\n return 'ConnectorTargetEnd';\n }\n var action = checkForConnectorSegment(conn_1, handle, position, diagram);\n if (action) {\n return action;\n }\n }\n }\n else {\n var ten = 10 / diagram.scroller.currentZoom;\n var matrix = identityMatrix();\n rotateMatrix(matrix, element.rotateAngle + element.parentTransform, element.offsetX, element.offsetY);\n //check for resizing tool\n var x = element.offsetX - element.pivot.x * element.actualSize.width;\n var y = element.offsetY - element.pivot.y * element.actualSize.height;\n var rotateThumb = { x: x + element.actualSize.width / 2, y: y - 30 / diagram.scroller.currentZoom };\n rotateThumb = transformPointByMatrix(matrix, rotateThumb);\n if ((canShowCorner(handle.constraints, 'Rotate')) && contains(position, rotateThumb, ten) &&\n (diagram.selectedItems.thumbsConstraints & ThumbsConstraints.Rotate)) {\n return 'Rotate';\n }\n paddedBounds.Inflate(ten);\n if (paddedBounds.containsPoint(position)) {\n var action = checkForResizeHandles(diagram, element, position, matrix, x, y);\n if (action) {\n return action;\n }\n }\n }\n }\n if (target instanceof PointPort && (!canZoomPan(diagram))) {\n var action = findPortToolToActivate(diagram, target);\n if (action !== 'None') {\n return action;\n }\n }\n if (obj !== null) {\n if (obj instanceof Node || obj instanceof Connector) {\n if (wrapper && wrapper.id) {\n var id = wrapper.id.split(obj.id)[1];\n if (id && id.match('^_icon')) {\n return 'LayoutAnimation';\n }\n }\n if (canMove(obj) && wrapper instanceof TextElement && wrapper.hyperlink.link) {\n return 'Hyperlink';\n }\n if (canMove(obj) && isSelected(diagram, obj, false)) {\n if ((obj instanceof Connector && !(contains(position, obj.sourcePoint, obj.hitPadding) ||\n contains(position, obj.targetPoint, obj.hitPadding))) ||\n !(obj instanceof Connector)) {\n return 'Drag';\n }\n }\n else if (obj && canZoomPan(diagram) && !defaultTool(diagram)) {\n return 'Pan';\n }\n else {\n return 'Select';\n }\n }\n else {\n return 'Select';\n }\n }\n return 'Select';\n}\nfunction checkForConnectorSegment(conn, handle, position, diagram) {\n var targetPaddingValue = 10 / diagram.scrollSettings.currentZoom;\n var sourcePaddingValue = 10 / diagram.scrollSettings.currentZoom;\n if (conn.type === 'Bezier') {\n for (var i = 0; i < conn.segments.length; i++) {\n var segment = (conn.segments)[i];\n if (contains(position, !Point.isEmptyPoint(segment.point1) ? segment.point1 : segment.bezierPoint1, sourcePaddingValue)) {\n return 'BezierSourceThumb';\n }\n if (contains(position, !Point.isEmptyPoint(segment.point2) ? segment.point2 : segment.bezierPoint2, targetPaddingValue)) {\n return 'BezierTargetThumb';\n }\n }\n }\n if (diagram.connectorEditingToolModule && canDragSegmentThumb(conn)) {\n if (conn.type === 'Straight' || conn.type === 'Bezier') {\n for (var i = 0; i < conn.segments.length; i++) {\n var segment = void 0;\n segment = (conn.segments)[i];\n if (contains(position, segment.point, 10)) {\n return 'SegmentEnd';\n }\n }\n }\n else {\n for (var i = 0; i < conn.segments.length; i++) {\n var segment = void 0;\n var segPoint = { x: 0, y: 0 };\n segment = (conn.segments)[i];\n for (var j = 0; j < segment.points.length - 1; j++) {\n var length_1 = Point.distancePoints(segment.points[j], segment.points[j + 1]);\n if (length_1 >= 50) {\n segPoint.x = ((segment.points[j].x + segment.points[j + 1].x) / 2);\n segPoint.y = ((segment.points[j].y + segment.points[j + 1].y) / 2);\n if (contains(position, segPoint, 30)) {\n return 'OrthoThumb';\n }\n }\n }\n }\n }\n }\n return null;\n}\n/** @private */\nexport function findPortToolToActivate(diagram, target, touchStart, touchMove) {\n if (canDrag(target, diagram) && (checkPortRestriction(target, PortVisibility.Hover)\n || (checkPortRestriction(target, PortVisibility.Visible)))) {\n if ((target.constraints & PortConstraints.Drag)) {\n return 'PortDrag';\n }\n }\n else if (canDraw(target, diagram) && (checkPortRestriction(target, PortVisibility.Hover)\n || (checkPortRestriction(target, PortVisibility.Visible)))) {\n if (target.constraints & PortConstraints.Draw) {\n diagram.drawingObject = {};\n var connector = { type: 'Orthogonal', sourcePortID: target.id };\n diagram.drawingObject = connector;\n diagram.tool |= DiagramTools.DrawOnce;\n diagram.currentDrawingObject = connector;\n return 'PortDraw';\n }\n }\n return 'None';\n}\nfunction checkForResizeHandles(diagram, element, position, matrix, x, y) {\n var node = diagram.selectedItems.nodes[0];\n var forty = 40 / diagram.scroller.currentZoom;\n var ten = 10 / diagram.scroller.currentZoom;\n var selectedItems = diagram.selectedItems;\n if (element.actualSize.width >= forty && element.actualSize.height >= forty) {\n if (canResizeCorner(selectedItems.constraints, 'ResizeSouthEast', selectedItems.thumbsConstraints) && contains(position, transformPointByMatrix(matrix, { x: x + element.actualSize.width, y: y + element.actualSize.height }), ten)) {\n return 'ResizeSouthEast';\n }\n if (canResizeCorner(selectedItems.constraints, 'ResizeSouthWest', selectedItems.thumbsConstraints) &&\n contains(position, transformPointByMatrix(matrix, { x: x, y: y + element.actualSize.height }), ten)) {\n return 'ResizeSouthWest';\n }\n if (canResizeCorner(selectedItems.constraints, 'ResizeNorthEast', selectedItems.thumbsConstraints) &&\n contains(position, transformPointByMatrix(matrix, { x: x + element.actualSize.width, y: y }), ten)) {\n return 'ResizeNorthEast';\n }\n if (canResizeCorner(selectedItems.constraints, 'ResizeNorthWest', selectedItems.thumbsConstraints) &&\n contains(position, transformPointByMatrix(matrix, { x: x, y: y }), ten)) {\n return 'ResizeNorthWest';\n }\n }\n if (canResizeCorner(selectedItems.constraints, 'ResizeEast', selectedItems.thumbsConstraints) && contains(position, transformPointByMatrix(matrix, { x: x + element.actualSize.width, y: y + element.actualSize.height / 2 }), ten)) {\n return 'ResizeEast';\n }\n if (canResizeCorner(selectedItems.constraints, 'ResizeWest', selectedItems.thumbsConstraints) &&\n contains(position, transformPointByMatrix(matrix, { x: x, y: y + element.actualSize.height / 2 }), ten)) {\n return 'ResizeWest';\n }\n if (canResizeCorner(selectedItems.constraints, 'ResizeSouth', selectedItems.thumbsConstraints) &&\n contains(position, transformPointByMatrix(matrix, { x: x + element.actualSize.width / 2, y: y + element.actualSize.height }), ten)) {\n return 'ResizeSouth';\n }\n if (canResizeCorner(selectedItems.constraints, 'ResizeNorth', selectedItems.thumbsConstraints) &&\n contains(position, transformPointByMatrix(matrix, { x: x + element.actualSize.width / 2, y: y }), ten)) {\n return 'ResizeNorth';\n }\n return null;\n}\n/** @private */\nexport function contains(mousePosition, corner, padding) {\n if (mousePosition.x >= corner.x - padding && mousePosition.x <= corner.x + padding) {\n if (mousePosition.y >= corner.y - padding && mousePosition.y <= corner.y + padding) {\n return true;\n }\n }\n return false;\n}\n/** @private */\nexport function hasSelection(diagram) {\n if (diagram.selectedItems.nodes.length > 0 || diagram.selectedItems.connectors.length > 0) {\n return true;\n }\n return false;\n}\n/** @private */\nexport function hasSingleConnection(diagram) {\n if (diagram.selectedItems.connectors.length === 1 && !diagram.selectedItems.nodes.length) {\n return true;\n }\n return false;\n}\n/** @private */\nexport function isSelected(diagram, element, firstLevel) {\n if (firstLevel === void 0) { firstLevel = true; }\n if (element instanceof Selector) {\n return true;\n }\n if (element instanceof Node) {\n while (element) {\n if (diagram.selectedItems.nodes.indexOf(element) !== -1) {\n return true;\n }\n if (!firstLevel) {\n element = diagram.nameTable[element.parentId];\n }\n else {\n break;\n }\n }\n }\n else if (element instanceof Connector) {\n if (diagram.selectedItems.connectors.indexOf(element) !== -1) {\n return true;\n }\n }\n return false;\n}\n/** @private */\nexport function getCursor(cursor, angle) {\n //to avoid angles less than 0 & angles greater than 360\n angle += 360;\n angle %= 360;\n if (cursor.indexOf('Resize') === -1) {\n return cursors[cursor];\n }\n else {\n var dir = cursors[cursor];\n if ((angle >= 0 && angle < 25) || (angle >= 160 && angle <= 205) || (angle >= 340 && angle <= 360)) {\n return dir;\n }\n else if ((angle >= 25 && angle <= 70) || (angle >= 205 && angle <= 250)) {\n if (dir === 'n-resize' || dir === 's-resize') {\n return 'ne-resize';\n }\n else if (dir === 'nw-resize' || dir === 'se-resize') {\n return 'n-resize';\n }\n else if (dir === 'e-resize' || dir === 'w-resize') {\n return 'nw-resize';\n }\n else {\n return 'e-resize';\n }\n }\n else if ((angle >= 70 && angle <= 115) || (angle >= 250 && angle <= 295)) {\n if (dir === 'n-resize' || dir === 's-resize') {\n return 'e-resize';\n }\n else if (dir === 'nw-resize' || dir === 'se-resize') {\n return 'ne-resize';\n }\n else if (dir === 'e-resize' || dir === 'w-resize') {\n return 'n-resize';\n }\n else {\n return 'nw-resize';\n }\n }\n else if ((angle >= 115 && angle <= 155) || (angle >= 295 && angle <= 340)) {\n if (dir === 'n-resize' || dir === 's-resize') {\n return 'nw-resize';\n }\n else if (dir === 'nw-resize' || dir === 'se-resize') {\n return 'e-resize';\n }\n else if (dir === 'e-resize' || dir === 'w-resize') {\n return 'ne-resize';\n }\n }\n else {\n return 'n-resize';\n }\n }\n return cursors[cursor];\n}\nvar cursors = {\n 'None': 'default',\n 'Rotate': 'crosshair',\n 'Select': 'default',\n 'Drag': 'move',\n 'ResizeWest': 'w-resize',\n 'ResizeEast': 'e-resize',\n 'ResizeSouth': 's-resize',\n 'ResizeNorth': 'n-resize',\n 'Draw': 'crosshair',\n 'PortDraw': 'crosshair',\n 'ResizeNorthEast': 'ne-resize',\n 'ResizeNorthWest': 'nw-resize',\n 'ResizeSouthEast': 'se-resize',\n 'ResizeSouthWest': 'sw-resize',\n 'ConnectorSourceEnd': 'move',\n 'ConnectorTargetEnd': 'move',\n 'BezierSourceThumb': 'move',\n 'BezierTargetThumb': 'move',\n 'OrthoThumb': 'move',\n 'SegmentEnd': 'move',\n 'Pan': 'pointer',\n 'Hyperlink': 'pointer',\n 'PortDrag': 'pointer'\n};\n","import { Node } from './../objects/node';\nimport { DiagramElement } from './../core/elements/diagram-element';\nimport { Canvas } from './../core/containers/canvas';\nimport { Container } from './../core/containers/container';\nimport { PathElement } from './../core/elements/path-element';\nimport { TextElement } from './../core/elements/text-element';\nimport { updateStyle } from './../../diagram/utility/diagram-util';\nimport { randomId, cloneObject } from './../utility/base-util';\nimport { Connector } from './../objects/connector';\nimport { BpmnAnnotation } from './../objects/node';\nimport { Transform } from '../enum/enum';\nimport { findAngle, getIntersectionPoints, getPortDirection } from '../utility/connector';\nimport { Point } from '../primitives/point';\nimport { NodeConstraints, ConnectorConstraints } from '../enum/enum';\nimport { Rect } from '../primitives/rect';\nimport { Size } from '../primitives/size';\nimport { getDiagramElement } from '../utility/dom-util';\n/**\n * BPMN Diagrams contains the BPMN functionalities\n */\nvar BpmnDiagrams = /** @class */ (function () {\n //End size region\n /**\n * Constructor for the BpmnDiagrams module\n * @private\n */\n function BpmnDiagrams() {\n //Code conversion for Bpmn Shapes\n //Start Region\n this.annotationObjects = {};\n //constructs the BpmnDiagrams module\n }\n Object.defineProperty(BpmnDiagrams.prototype, \"textAnnotationConnectors\", {\n get: function () {\n var connectors = [];\n for (var _i = 0, _a = Object.keys(this.annotationObjects); _i < _a.length; _i++) {\n var key = _a[_i];\n var entry = this.annotationObjects[key];\n for (var _b = 0, _c = Object.keys(entry); _b < _c.length; _b++) {\n var annotation = _c[_b];\n var key_1 = 'connector';\n connectors.push(entry[annotation][key_1]);\n }\n }\n return connectors;\n },\n enumerable: true,\n configurable: true\n });\n /** @private */\n BpmnDiagrams.prototype.getTextAnnotationConn = function (obj) {\n var connectors = [];\n if (obj.shape.type === 'Bpmn' && obj.shape.annotations.length !== 0) {\n var entry = this.annotationObjects[obj.id];\n for (var _i = 0, _a = Object.keys(entry); _i < _a.length; _i++) {\n var annotation = _a[_i];\n var key = 'connector';\n connectors.push(entry[annotation][key]);\n }\n }\n return connectors;\n };\n BpmnDiagrams.prototype.getSize = function (node, content) {\n var size = new Size(node.width, node.height);\n if (size.width === undefined || size.height === undefined) {\n if (!(content instanceof PathElement)) {\n size.width = size.width || 50;\n size.height = size.height || 50;\n }\n if (content.actualSize.width && content.actualSize.height) {\n return content.actualSize;\n }\n else {\n content.measure(new Size());\n size.width = size.width || content.desiredSize.width;\n size.height = size.height || content.desiredSize.height;\n }\n if (node.maxWidth !== undefined) {\n size.width = Math.min(size.width, node.maxWidth);\n }\n if (node.maxHeight !== undefined) {\n size.height = Math.min(size.height, node.maxHeight);\n }\n if (node.minWidth !== undefined) {\n size.width = Math.max(size.width, node.minWidth);\n }\n if (node.minHeight !== undefined) {\n size.height = Math.max(size.height, node.minHeight);\n }\n }\n return size;\n };\n /** @private */\n BpmnDiagrams.prototype.initBPMNContent = function (content, node, diagram) {\n var shape = node.shape;\n if (shape.shape === 'Event') {\n content = this.getBPMNEventShape(node, shape.event);\n }\n if (shape.shape === 'Gateway') {\n content = this.getBPMNGatewayShape(node);\n }\n if (shape.shape === 'DataObject') {\n content = this.getBPMNDataObjectShape(node);\n }\n if (shape.shape === 'Message' || shape.shape === 'DataSource') {\n content = this.getBPMNShapes(node);\n }\n // if (shape.shape === 'Group') {\n // content = this.getBPMNGroup(node, diagram);\n // content.style.strokeDashArray = '2 2 6 2';\n // content.horizontalAlignment = 'Center';\n // content.verticalAlignment = 'Center';\n // }\n if (shape.shape === 'Activity') {\n content = this.getBPMNActivityShape(node);\n }\n var annotations = {};\n if (shape.annotations.length > 0) {\n for (var i = 0; i < shape.annotations.length && shape.annotations[i].text; i++) {\n content.children.push(this.getBPMNTextAnnotation(node, diagram, shape.annotations[i], content));\n }\n }\n content.style.strokeDashArray = '2 2 6 2';\n return content;\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNShapes = function (node) {\n var bpmnShape = new PathElement();\n //set style\n this.setStyle(bpmnShape, node);\n if ((node.constraints & NodeConstraints.Shadow) !== 0) {\n bpmnShape.shadow = node.shadow;\n }\n var bpmnShapeData = getBpmnShapePathData(node.shape.shape);\n bpmnShape.data = bpmnShapeData;\n bpmnShape.id = node.id + '_' + node.shape.shape;\n if (node.width !== undefined && node.height !== undefined) {\n bpmnShape.width = node.width;\n bpmnShape.height = node.height;\n }\n return bpmnShape;\n };\n /** @private */\n // public getBPMNGroup(node: Node, diagram: Diagram): Container {\n // let group: Container = new Container();\n // group.id = node.id + '_group';\n // //group.style.strokeDashArray = '2 2 6 2';\n // if (!group.children) { group.children = []; }\n // let grp: BpmnGroup = ((node.shape as BpmnShape).group as BpmnGroup);\n // if ((node.shape as BpmnShape).group as BpmnGroup) {\n // for (let i: number = 0; i < grp.children.length; i++) {\n // let b: Node | Connector = diagram.nameTable[grp.children[i]];\n // group.children.push(b.wrapper);\n // }\n // }\n // return group;\n // }\n /** @private */\n BpmnDiagrams.prototype.getBPMNGatewayShape = function (node) {\n var gatewayshape = new Canvas();\n //childNode0\n var gatewayNode = new PathElement();\n gatewayNode.id = node.id + '_0_gateway';\n gatewayNode.offsetX = node.offsetX;\n gatewayNode.offsetY = node.offsetY;\n gatewayNode.data = 'M 40 20 L 20 40 L 0 20 L 20 0 L 40 20 Z';\n this.setStyle(gatewayNode, node);\n //childNode1\n var gatewayTypeNode = new PathElement();\n gatewayTypeNode.id = node.id + '_1_gatewayType';\n //set style - opacity\n gatewayTypeNode.style.opacity = node.style.opacity;\n gatewayTypeNode.horizontalAlignment = 'Center';\n gatewayTypeNode.verticalAlignment = 'Center';\n gatewayTypeNode.relativeMode = 'Object';\n var shapeType = node.shape.gateway;\n var gatewayTypeNodeShapeData;\n gatewayTypeNodeShapeData = getBpmnGatewayShapePathData(shapeType.type);\n if (shapeType.type === 'EventBased' || shapeType.type === 'ExclusiveEventBased' || shapeType.type === 'ParallelEventBased') {\n gatewayTypeNode.style.fill = 'white';\n }\n else {\n gatewayTypeNode.style.fill = 'black';\n }\n gatewayTypeNode.data = gatewayTypeNodeShapeData;\n // append child and set style\n gatewayshape.style.fill = 'transparent';\n gatewayshape.style.strokeColor = 'transparent';\n gatewayshape.style.strokeWidth = 0;\n gatewayshape.children = [gatewayNode, gatewayTypeNode];\n var size = this.getSize(node, gatewayNode);\n this.setSizeForBPMNGateway(node.shape.gateway, gatewayshape, size.width, size.height);\n return gatewayshape;\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNDataObjectShape = function (node) {\n var dataObjectshape = new Canvas();\n var shape = node.shape.dataObject;\n //childNode0\n var dataobjNode = new PathElement();\n dataobjNode.id = node.id + '_0_dataobj';\n dataobjNode.data = 'M29.904,5 L7.853,5 L7.853,45 L42.147,45 L42.147,17.242,L29.932,5,L29.932,17.242,L42.147,17.242';\n var size = this.getSize(node, dataobjNode);\n dataobjNode.width = size.width;\n dataobjNode.height = size.height;\n this.setStyle(dataobjNode, node);\n //childNode1\n var dataobjTypeNode = new PathElement();\n dataobjTypeNode.id = node.id + '_1_type';\n dataobjTypeNode.width = 25;\n dataobjTypeNode.height = 20;\n dataobjTypeNode.margin.left = 5;\n dataobjTypeNode.margin.top = 5;\n dataobjTypeNode.data = 'M 3 9.4 l 6 0 v 2.4 l 3.6 -4 L 9 4 v 2.5 H 3 V 9.4 Z';\n //set style - opacity\n dataobjTypeNode.style.opacity = node.style.opacity;\n //childNode2\n var dataobjCollectionNode = new PathElement();\n dataobjCollectionNode.id = node.id + '_2_collection';\n dataobjCollectionNode.width = 7.5;\n dataobjCollectionNode.height = 15;\n dataobjCollectionNode.style.fill = 'black';\n dataobjCollectionNode.visible = true;\n dataobjCollectionNode.horizontalAlignment = 'Center';\n dataobjCollectionNode.verticalAlignment = 'Bottom';\n dataobjCollectionNode.relativeMode = 'Object';\n //set style - opacity\n dataobjCollectionNode.style.opacity = node.style.opacity;\n dataobjCollectionNode.data = 'M 0 0 L 0.1 0 L 0.1 2 L 0 2 Z M 0.4 0 L 0.6 0 L 0.6 2 L0.4 2 Z M 0.9 0 L 1 0 L 1 2 L 0.9 2 Z';\n switch (shape.type) {\n case 'None':\n dataobjTypeNode.visible = false;\n break;\n case 'Input':\n dataobjTypeNode.style.fill = 'white';\n break;\n case 'Output':\n dataobjTypeNode.style.fill = 'black';\n break;\n }\n if (shape.collection === false) {\n dataobjCollectionNode.visible = false;\n }\n //append child and set style\n dataObjectshape.style.fill = 'transparent';\n dataObjectshape.style.strokeColor = 'transparent';\n dataObjectshape.style.strokeWidth = 0;\n dataObjectshape.children = [dataobjNode, dataobjTypeNode, dataobjCollectionNode];\n return dataObjectshape;\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNTaskShape = function (node) {\n var shape = node.shape.activity;\n var task = shape.task;\n var taskShapes = new Canvas();\n //childNode0\n var taskNode = new DiagramElement();\n taskNode.cornerRadius = 10;\n var size = this.getSize(node, taskNode);\n taskNode.id = node.id + '_0_task';\n taskNode.width = size.width;\n taskNode.height = size.height;\n this.setStyle(taskNode, node);\n // if task as call \n if ((task.call !== undefined) && task.call === true) {\n taskNode.style.strokeWidth = 4;\n }\n taskShapes.width = size.width;\n taskShapes.height = size.height;\n var childCount = this.getTaskChildCount(node);\n var x;\n var childSpace = childCount * 12;\n var area = size.width / 2 - childSpace;\n if (childCount === 1) {\n x = area + 8;\n }\n else {\n x = area + (childCount - 1) * 8;\n }\n //childNode1\n var taskTypeNode = new PathElement();\n var taskTypeNodeData;\n if (task.type === 'Receive' || task.type === 'Send') {\n taskTypeNode.width = 18;\n taskTypeNode.height = 16;\n }\n else {\n taskTypeNode.width = 20;\n taskTypeNode.height = 20;\n }\n taskTypeNode.id = node.id + '_1_tasktType';\n taskTypeNode.margin.left = 5;\n taskTypeNode.margin.top = 5;\n taskTypeNodeData = getBpmnTaskShapePathData(task.type);\n taskTypeNode.data = taskTypeNodeData;\n taskTypeNode.style.fill = 'transparent';\n taskTypeNode.style.opacity = node.style.opacity;\n // append child and set style\n taskShapes.style.fill = 'transparent';\n taskShapes.style.strokeColor = 'transparent';\n taskShapes.style.strokeWidth = 0;\n taskShapes.children = [taskNode, taskTypeNode];\n // if task as loop\n var loopType = task.loop;\n var taskLoopNode = new PathElement();\n var childNode2data;\n childNode2data = getBpmnLoopShapePathData(loopType);\n taskLoopNode.data = childNode2data;\n taskLoopNode.style.fill = 'black';\n if (loopType !== 'None') {\n taskLoopNode.visible = true;\n }\n else {\n taskLoopNode.visible = false;\n }\n if (childCount === 1) {\n x = area + 9;\n }\n taskLoopNode.margin.left = x;\n if (taskLoopNode.visible === true) {\n x += 12 + 8;\n }\n taskLoopNode.width = 12;\n taskLoopNode.height = 12;\n taskLoopNode.margin.bottom = 5;\n taskLoopNode.id = node.id + '_2_loop';\n taskLoopNode.horizontalAlignment = 'Left';\n taskLoopNode.verticalAlignment = 'Bottom';\n taskLoopNode.setOffsetWithRespectToBounds(0, 1, 'Fraction');\n taskLoopNode.relativeMode = 'Point';\n taskLoopNode.style.fill = 'transparent';\n taskTypeNode.style.opacity = node.style.opacity;\n taskShapes.children.push(taskLoopNode);\n //if task as compensation\n var taskCompNode = new PathElement();\n taskCompNode = this.getBPMNCompensationShape(node, taskCompNode);\n if (task.compensation === true) {\n taskCompNode.visible = true;\n }\n else {\n taskCompNode.visible = false;\n }\n if (childCount === 1) {\n x = area + 9;\n }\n taskCompNode.margin.left = x - 3;\n x += 12 + 6;\n taskShapes.children.push(taskCompNode);\n return taskShapes;\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNEventShape = function (node, subEvent, sub, id) {\n var eventshape = new Canvas();\n var event;\n var trigger;\n var width;\n var height;\n id = id || node.id;\n var pathdata = 'M164.1884,84.6909000000001C156.2414,84.6909000000001,149.7764,78.2259000000001,149.7764,70.2769000000001' +\n 'C149.7764,62.3279000000001,156.2414,55.8629000000001,164.1884,55.8629000000001C172.1354,55.8629000000001,178.6024,' +\n '62.3279000000001,178.6024,70.2769000000001C178.6024,78.2259000000001,172.1354,84.6909000000001,164.1884,84.6909000000001';\n var shapeEvent = node.shape.event;\n if (node.shape.shape === 'Event') {\n event = shapeEvent.event;\n trigger = shapeEvent.trigger;\n }\n width = subEvent.width;\n height = subEvent.height;\n if (sub) {\n width = width || 20;\n height = height || 20;\n }\n else if (subEvent.width === undefined || subEvent.height === undefined) {\n var pathElement = new PathElement();\n pathElement.data = pathdata;\n var size = this.getSize(node, pathElement);\n width = size.width;\n height = size.height;\n }\n var shapeActivity = node.shape.activity;\n if (node.shape.shape === 'Activity') {\n var subProcess = shapeActivity.subProcess;\n event = subEvent.event;\n trigger = subEvent.trigger;\n }\n //childNode0\n var innerEvtNode = new PathElement();\n innerEvtNode.data = pathdata;\n innerEvtNode.id = id + '_0_event';\n innerEvtNode.width = width;\n innerEvtNode.height = height;\n innerEvtNode.horizontalAlignment = 'Center';\n innerEvtNode.verticalAlignment = 'Center';\n innerEvtNode.relativeMode = 'Object';\n this.setStyle(innerEvtNode, node);\n //childNode1\n var outerEvtNode = new PathElement();\n outerEvtNode.data = pathdata;\n outerEvtNode.id = id + '_1_event';\n outerEvtNode.horizontalAlignment = 'Center';\n outerEvtNode.verticalAlignment = 'Center';\n outerEvtNode.relativeMode = 'Object';\n // set style opacity & strokeColor\n outerEvtNode.style.strokeColor = node.style.strokeColor;\n outerEvtNode.style.opacity = node.style.opacity;\n //childNode2\n var triggerNode = new PathElement();\n var triggerNodeData = getBpmnTriggerShapePathData(trigger);\n triggerNode.data = triggerNodeData;\n triggerNode.id = id + '_2_trigger';\n triggerNode.horizontalAlignment = 'Center';\n triggerNode.verticalAlignment = 'Center';\n triggerNode.relativeMode = 'Object';\n // set style opacity & strokeColor\n triggerNode.style.strokeColor = node.style.strokeColor;\n triggerNode.style.opacity = node.style.opacity;\n switch (event) {\n case 'Start':\n outerEvtNode.visible = false;\n break;\n case 'NonInterruptingStart':\n innerEvtNode.style.strokeDashArray = '2 3';\n outerEvtNode.visible = false;\n break;\n case 'Intermediate':\n innerEvtNode.style.fill = 'white';\n innerEvtNode.style.gradient = null;\n break;\n case 'NonInterruptingIntermediate':\n innerEvtNode.style.fill = 'white';\n innerEvtNode.style.gradient = null;\n innerEvtNode.style.strokeDashArray = '2 3';\n outerEvtNode.style.strokeDashArray = '2 3';\n break;\n case 'ThrowingIntermediate':\n case 'End':\n innerEvtNode.style.fill = event !== 'End' ? 'white' : 'black';\n innerEvtNode.style.gradient = null;\n triggerNode.style.fill = 'black';\n triggerNode.style.strokeColor = node.style.fill;\n break;\n }\n //append child and set style\n eventshape.style.fill = 'transparent';\n eventshape.style.strokeColor = 'transparent';\n eventshape.style.strokeWidth = 0;\n eventshape.children = [innerEvtNode, outerEvtNode, triggerNode];\n this.setSizeForBPMNEvents(shapeEvent, eventshape, width, height);\n return eventshape;\n };\n BpmnDiagrams.prototype.setEventVisibility = function (node, canvas) {\n var event = node.shape.event.event;\n var innerEvtNode = canvas[0];\n var outerEvtNode = canvas[1];\n var triggerNode = canvas[2];\n switch (event) {\n case 'Start':\n outerEvtNode.visible = false;\n break;\n case 'NonInterruptingStart':\n innerEvtNode.style.strokeDashArray = '2 3';\n outerEvtNode.visible = false;\n break;\n }\n };\n BpmnDiagrams.prototype.setSubProcessVisibility = function (node) {\n if (node.shape.activity.subProcess) {\n var subProcess = node.shape.activity.subProcess;\n var eventLength = subProcess.events.length;\n var index = (node.shape.activity.subProcess.type === 'Transaction') ? 2 : 0;\n var elementWrapper = node.wrapper.children[0].children[0];\n if (subProcess.adhoc === false) {\n elementWrapper.children[3 + index + eventLength].visible = false;\n }\n if (subProcess.compensation === false) {\n elementWrapper.children[4 + index + eventLength].visible = false;\n }\n if (eventLength > 0) {\n for (var i = 0; i < eventLength; i++) {\n this.setEventVisibility(node, elementWrapper.children[2 + i].children);\n }\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNSubProcessShape = function (node) {\n var subProcessShapes = new Canvas();\n var loopType;\n var events;\n var event;\n var subprocessAdhoc = new PathElement();\n var subProcessEventsShapes = new Canvas();\n var subProcessLoopShapes = new PathElement();\n var shape = node.shape.activity;\n var subProcess = shape.subProcess;\n var subChildCount = this.getSubprocessChildCount(node);\n var x;\n var subprocessNode = new DiagramElement();\n subprocessNode.id = node.id + '_0_Subprocess';\n subprocessNode.style.fill = 'transparent';\n subprocessNode.cornerRadius = 10;\n var size = this.getSize(node, subprocessNode);\n subprocessNode.width = size.width;\n subprocessNode.height = size.height;\n subProcessShapes.children = [subprocessNode];\n if (shape.subProcess.type === 'Transaction') {\n this.getBPMNSubProcessTransaction(node, node.shape, subProcessShapes);\n }\n var iconSpace = 4;\n var subChildSpace = 12;\n var childSpace = subChildCount * subChildSpace;\n var area = size.width / 2;\n if (subChildCount === 1) {\n x = area - (subChildSpace * 0.5);\n }\n else {\n x = area - (childSpace / 2) - ((subChildCount - 1) * iconSpace) / 2;\n }\n //set style\n this.setStyle(subprocessNode, node);\n if ((node.constraints & NodeConstraints.Shadow) !== 0) {\n subProcessShapes.shadow = node.shadow;\n }\n var collapsedShape = new PathElement();\n collapsedShape.id = node.id + '_0_collapsed';\n collapsedShape.width = 12;\n collapsedShape.height = 12;\n collapsedShape.style.fill = 'black';\n collapsedShape.margin.bottom = 5;\n collapsedShape.horizontalAlignment = 'Left';\n collapsedShape.verticalAlignment = 'Bottom';\n collapsedShape.setOffsetWithRespectToBounds(0, 1, 'Fraction');\n collapsedShape.relativeMode = 'Point';\n collapsedShape.data = getBpmnShapePathData('collapsedShape');\n collapsedShape.margin.left = x;\n if (subProcess.collapsed === true && !subProcess.processes) {\n collapsedShape.visible = true;\n }\n else {\n collapsedShape.visible = false;\n }\n if (collapsedShape.visible === true) {\n x += 12 + 6;\n }\n subProcessShapes.children.push(collapsedShape);\n if (subProcess.type === 'Event') {\n subprocessNode.style.strokeWidth = 1;\n subprocessNode.style.strokeDashArray = '2 2';\n events = subProcess.events;\n for (var i = 0; i < events.length; i++) {\n event = events[i];\n this.getBPMNSubEvent(event, node, subProcessShapes);\n }\n }\n // set loop for subprocess\n subProcessLoopShapes = this.getBPMNSubProcessLoopShape(node);\n if (subChildCount === 1) {\n x = area + 8;\n }\n subProcessLoopShapes.margin.left = x;\n if (subProcessLoopShapes.visible === true) {\n x += subChildSpace + iconSpace;\n }\n subProcessShapes.children.push(subProcessLoopShapes);\n // set boundary for subprocess\n subprocessNode.id = node.id + '_boundary';\n if (subProcess.boundary === 'Default') {\n subprocessNode.style.strokeWidth = 1;\n subprocessNode.style.strokeDashArray = '1 0';\n }\n if (subProcess.boundary === 'Call') {\n subprocessNode.style.strokeWidth = 4;\n subprocessNode.style.strokeDashArray = '1 0';\n }\n if (subProcess.boundary === 'Event') {\n subprocessNode.style.strokeWidth = 1;\n subprocessNode.style.strokeDashArray = '2 2';\n }\n //set adhoc for subprocess\n subprocessAdhoc = this.getBPMNAdhocShape(node, subprocessAdhoc, subProcess);\n if (subChildCount === 1) {\n x = area + 8;\n }\n subprocessAdhoc.margin.left = x;\n if (subprocessAdhoc.visible === true) {\n x += subChildSpace + iconSpace;\n }\n subProcessShapes.children.push(subprocessAdhoc);\n //set compensation for subprocess\n var subprocessComp = new PathElement();\n if (subProcess.compensation === true) {\n subprocessComp.visible = true;\n }\n else {\n subprocessComp.visible = false;\n }\n subprocessComp = this.getBPMNCompensationShape(node, subprocessComp);\n if (subChildCount === 1) {\n x = area + 8;\n }\n subprocessComp.margin.left = x;\n if (subprocessComp.visible === true) {\n x += subChildSpace + iconSpace;\n }\n subProcessShapes.children.push(subprocessComp);\n //set style for subprocess\n subProcessShapes.style.strokeColor = 'transparent';\n subProcessShapes.style.strokeWidth = 0;\n subProcessShapes.style.fill = 'transparent';\n return subProcessShapes;\n };\n BpmnDiagrams.prototype.getBPMNSubEvent = function (event, node, container, id) {\n container.children = container.children || [];\n var eventContainer;\n eventContainer = this.getBPMNEventShape(node, event, true, id);\n this.getBPMNSubprocessEvent(node, eventContainer, event);\n eventContainer.id = id || (node.id + '_subprocessEvents');\n eventContainer.width = event.width || 20;\n eventContainer.height = event.height || 20;\n // set offset for subevents\n eventContainer.setOffsetWithRespectToBounds(event.offset.x, event.offset.y, 'Fraction');\n eventContainer.relativeMode = 'Point';\n //set margin for subevents\n eventContainer.margin = event.margin;\n //set alignment for subevents\n eventContainer.horizontalAlignment = event.horizontalAlignment;\n eventContainer.verticalAlignment = event.verticalAlignment;\n // set style for subevent\n eventContainer.style.fill = 'transparent';\n eventContainer.style.strokeColor = 'transparent';\n eventContainer.style.strokeWidth = 0;\n container.children.push(eventContainer);\n };\n BpmnDiagrams.prototype.getBPMNSubProcessTransaction = function (node, shape, container) {\n var shapeWidth = container.children[0].width;\n var shapeHeight = container.children[0].height;\n var innerRect = new DiagramElement();\n innerRect.margin = { left: 3, right: 0, top: 3, bottom: 0 };\n innerRect.id = node.id + '_0_Subprocess_innnerRect';\n innerRect.cornerRadius = 10;\n innerRect.width = shapeWidth - 6;\n innerRect.height = shapeHeight - 6;\n container.children.push(innerRect);\n var transactionEvents = new Canvas();\n transactionEvents.id = node.id + '_transaction_events';\n var transaction = shape.activity.subProcess.transaction;\n this.getBPMNSubEvent(transaction.success, node, transactionEvents, node.id + '_success');\n this.getBPMNSubEvent(transaction.cancel, node, transactionEvents, node.id + '_cancel');\n this.getBPMNSubEvent(transaction.failure, node, transactionEvents, node.id + '_failure');\n this.updateDiagramContainerVisibility(transactionEvents.children[0], transaction.success.visible);\n this.updateDiagramContainerVisibility(transactionEvents.children[1], transaction.cancel.visible);\n this.updateDiagramContainerVisibility(transactionEvents.children[2], transaction.failure.visible);\n transactionEvents.float = true;\n transactionEvents.width = shapeWidth;\n transactionEvents.height = shapeHeight;\n transactionEvents.style.fill = transactionEvents.style.strokeColor = 'transparent';\n container.children.push(transactionEvents);\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNSubProcessLoopShape = function (node) {\n var shape = node.shape.activity;\n var loopType;\n var subprocessLoop = new PathElement();\n var subprocessLoopData;\n var subProcess = shape.subProcess;\n loopType = subProcess.loop;\n subprocessLoopData = getBpmnLoopShapePathData(loopType);\n if (loopType !== 'None') {\n subprocessLoop.visible = true;\n }\n else {\n subprocessLoop.visible = false;\n }\n subprocessLoop.id = node.id + '_loop';\n subprocessLoop.data = subprocessLoopData;\n subprocessLoop.style.fill = 'black';\n subprocessLoop.width = 12;\n subprocessLoop.height = 12;\n subprocessLoop.horizontalAlignment = 'Left';\n subprocessLoop.verticalAlignment = 'Bottom';\n subprocessLoop.setOffsetWithRespectToBounds(0, 1, 'Fraction');\n subprocessLoop.relativeMode = 'Point';\n subprocessLoop.margin.bottom = 5;\n subprocessLoop.style.fill = 'transparent';\n return subprocessLoop;\n };\n /** @private */\n BpmnDiagrams.prototype.drag = function (obj, tx, ty, diagram) {\n var node = diagram.nameTable[(obj).processId];\n if (obj.margin.top + ty >= 0) {\n diagram.nodePropertyChange(obj, {}, { margin: { top: obj.margin.top + ty } });\n }\n if (obj.margin.left + tx >= 0) {\n diagram.nodePropertyChange(obj, {}, { margin: { left: obj.margin.left + tx } });\n }\n var diffX = 0;\n var diffY = 0;\n var bound = this.getChildrenBound(node, obj.id, diagram);\n this.updateSubProcessess(bound, obj, diagram);\n node.wrapper.measure(new Size(undefined, undefined));\n node.wrapper.arrange(node.wrapper.desiredSize);\n diagram.refreshCanvasLayers();\n diagram.updateSelector();\n this.updateDocks(obj, diagram);\n };\n /** @private */\n BpmnDiagrams.prototype.dropBPMNchild = function (target, source, diagram) {\n if (source && source.shape.type === 'Bpmn') {\n var subProcess = diagram.nameTable[target.id].shape.activity.subProcess;\n if (diagram.currentSymbol && target.shape.type === 'Bpmn' && !subProcess.collapsed) {\n source.processId = target.id;\n return;\n }\n subProcess.processes = subProcess.processes || [];\n if (subProcess.processes && subProcess.processes.indexOf(source.id) === -1 && !subProcess.collapsed) {\n subProcess.processes.push(source.id);\n var redoElement = cloneObject(source);\n var sources = diagram.nameTable[source.id].wrapper;\n var targetWrapper = diagram.nameTable[target.id].wrapper;\n sources.margin.top = (sources.offsetY - (sources.actualSize.height / 2))\n - (target.offsetY - (target.actualSize.height / 2));\n sources.margin.left = (sources.offsetX - (sources.actualSize.width / 2))\n - (target.offsetX - (target.actualSize.width / 2));\n sources.margin.top = (sources.margin.top < 0) ? 0 : sources.margin.top;\n sources.margin.left = (sources.margin.left < 0) ? 0 : sources.margin.left;\n diagram.nameTable[source.id].processId = target.id;\n targetWrapper.children.push(diagram.nameTable[source.id].wrapper);\n var bound = this.getChildrenBound(target, source.id, diagram);\n this.updateSubProcessess(bound, source, diagram);\n targetWrapper.measure(new Size(undefined, undefined));\n targetWrapper.arrange(targetWrapper.desiredSize);\n diagram.refreshCanvasLayers();\n diagram.updateSelector();\n var edges = [];\n edges = edges.concat(source.outEdges, source.inEdges);\n for (var i = edges.length - 1; i >= 0; i--) {\n diagram.remove(diagram.nameTable[edges[i]]);\n }\n var obj = cloneObject(source);\n var entry = {\n type: 'PositionChanged', undoObject: { nodes: [redoElement] },\n redoObject: { nodes: [obj] }, category: 'Internal'\n };\n diagram.addHistoryEntry(entry);\n if (diagram.mode === 'SVG') {\n if (source.zIndex < target.zIndex) {\n diagram.updateProcesses(source);\n }\n }\n this.updateDocks(source, diagram);\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateDocks = function (obj, diagram) {\n if (obj.shape.type === 'Bpmn' && obj.shape.activity.subProcess.processes &&\n !obj.shape.activity.subProcess.collapsed) {\n var processTable = obj.shape.activity.subProcess.processes;\n for (var _i = 0, processTable_1 = processTable; _i < processTable_1.length; _i++) {\n var i = processTable_1[_i];\n var actualObject = diagram.nameTable[i];\n if (actualObject) {\n diagram.updateConnectorEdges(actualObject);\n actualObject.wrapper.measure(new Size(actualObject.wrapper.width, actualObject.wrapper.height));\n actualObject.wrapper.arrange(actualObject.wrapper.desiredSize);\n if (actualObject.shape.activity.subProcess.processes\n && actualObject.shape.activity.subProcess.processes.length) {\n this.updateDocks(actualObject, diagram);\n }\n }\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.removeBpmnProcesses = function (currentObj, diagram) {\n var element = diagram.nameTable[currentObj.processId];\n if (currentObj.shape.type === 'Bpmn' && currentObj.shape.activity.subProcess.processes &&\n currentObj.shape.activity.subProcess.processes.length > 0) {\n var processes = currentObj.shape.activity.subProcess.processes;\n for (var j = processes.length - 1; j >= 0; j--) {\n diagram.remove(diagram.nameTable[processes[j]]);\n }\n }\n if (element) {\n diagram.removeDependentConnector(currentObj);\n var processes = element.shape.activity.subProcess.processes;\n this.removeChildFromBPMN(element.wrapper, currentObj.id);\n var processIndex = processes.indexOf(currentObj.id);\n processes.splice(processIndex, 1);\n }\n };\n /** @private */\n BpmnDiagrams.prototype.removeChildFromBPMN = function (wrapper, name) {\n for (var _i = 0, _a = wrapper.children; _i < _a.length; _i++) {\n var i = _a[_i];\n if (i.id === name) {\n wrapper.children.splice(wrapper.children.indexOf(i), 1);\n }\n else if (i.children) {\n this.removeChildFromBPMN(i, name);\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.removeProcess = function (id, diagram) {\n var node = diagram.nameTable[id];\n if (node) {\n var parent_1 = diagram.nameTable[node.processId];\n if (parent_1 && parent_1.shape.type === 'Bpmn') {\n var processes = parent_1.shape.activity.subProcess.processes;\n diagram.removeDependentConnector(node);\n this.removeChildFromBPMN(parent_1.wrapper, id);\n var processIndex = processes.indexOf(id);\n processes.splice(processIndex, 1);\n node.processId = '';\n diagram.refreshDiagramLayer();\n diagram.updateSelector();\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.addProcess = function (process, parentId, diagram) {\n var id;\n process.id = process.id || randomId();\n id = process.id;\n var node = diagram.nameTable[id];\n if (!node) {\n diagram.add(process);\n }\n process.processId = parentId;\n var parentNode = diagram.nameTable[parentId];\n var subProcess = parentNode.shape.activity.subProcess;\n if (node && parentNode && parentNode.shape.type === 'Bpmn' && node.shape.type === 'Bpmn' &&\n subProcess.processes && !subProcess.collapsed) {\n node.processId = parentId;\n var processes = parentNode.shape.activity.subProcess.processes;\n if (processes.indexOf(id) < 0) {\n processes.push(id);\n }\n parentNode.wrapper.children.push(node.wrapper);\n parentNode.wrapper.measure(new Size());\n parentNode.wrapper.arrange(parentNode.wrapper.desiredSize);\n diagram.bpmnModule.updateDocks(parentNode, diagram);\n diagram.refreshDiagramLayer();\n if (diagram.mode === 'SVG' && (node.shape && node.shape.activity\n && !node.shape.activity.subProcess.processes)) {\n var child = getDiagramElement(parentId + '_groupElement');\n child.appendChild(getDiagramElement(process.id + '_groupElement'));\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.getChildrenBound = function (node, excludeChild, diagram) {\n var processes = node.shape.activity.subProcess.processes;\n var bound;\n if (processes && processes.length) {\n for (var _i = 0, processes_1 = processes; _i < processes_1.length; _i++) {\n var i = processes_1[_i];\n if (excludeChild !== i) {\n if (!bound) {\n bound = diagram.nameTable[i].wrapper.bounds;\n }\n else {\n bound = diagram.nameTable[i].wrapper.bounds.uniteRect(bound);\n }\n }\n }\n }\n return bound || diagram.nameTable[excludeChild].wrapper.bounds;\n };\n /** @private */\n BpmnDiagrams.prototype.updateSubProcessess = function (bound, obj, diagram) {\n var diffX;\n var diffY;\n var node = diagram.nameTable[obj.processId];\n var right;\n var bottom;\n var pivot = { x: 0.5, y: 0.5 };\n if ((node.wrapper.bounds.left + obj.margin.left + obj.width) > (node.wrapper.bounds.right)) {\n right = true;\n }\n if ((node.wrapper.bounds.top + obj.margin.top + obj.height) > (node.wrapper.bounds.bottom)) {\n bottom = true;\n }\n if (right) {\n pivot.x = 0;\n }\n if (bottom) {\n pivot.y = 0;\n }\n var actualSize = node.wrapper.actualSize;\n if (right) {\n diffX = (obj.wrapper.margin.left + obj.wrapper.bounds.width) / actualSize.width;\n }\n if (bottom) {\n diffY = (obj.wrapper.margin.top + obj.wrapper.bounds.height) / actualSize.height;\n }\n if (diffX > 0 || diffY > 0) {\n diagram.commandHandler.scale(diagram.nameTable[obj.processId], diffX || 1, diffY || 1, pivot);\n }\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNCompensationShape = function (node, compensationNode) {\n compensationNode.id = node.id + '_0_compensation';\n compensationNode.width = 12;\n compensationNode.height = 12;\n compensationNode.margin.bottom = 5;\n compensationNode.style.fill = 'transparent';\n compensationNode.horizontalAlignment = 'Left';\n compensationNode.verticalAlignment = 'Bottom';\n compensationNode.relativeMode = 'Object';\n compensationNode.data = 'M 22.462 18.754 l -6.79 3.92 l 6.79 3.92 V 22.89 l 6.415 3.705 v -7.841 l -6.415 3.705 V 18.754 Z' +\n ' M 28.331 19.701 v 5.947 l -5.149 -2.973 L 28.331 19.701 Z M 21.916 25.647 l -5.15 -2.973 l 5.15 -2.973 V 25.647 Z' +\n ' M 22.275 12.674 c -5.513 0 -9.999 4.486 -9.999 9.999 c 0 5.514 4.486 10.001 9.999 10.001' +\n ' c 5.514 0 9.999 -4.486 9.999 -10.001 C 32.274 17.16 27.789 12.674 22.275 12.674 Z M 22.275 32.127 ' +\n ' c -5.212 0 -9.453 -4.241 -9.453 -9.454 c 0 -5.212 4.241 -9.453 9.453 -9.453 c 5.212 0 9.453 4.241 9.453 9.453' +\n ' C 31.728 27.887 27.487 32.127 22.275 32.127 Z';\n return compensationNode;\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNActivityShape = function (node) {\n var eventshape = new Canvas();\n var content;\n var shape = node.shape.activity;\n var task = shape.activity;\n var subProcess = shape.subProcess;\n var activityType = shape.activity;\n if (task === 'Task') {\n content = this.getBPMNTaskShape(node);\n }\n if (task === 'SubProcess' && subProcess) {\n content = this.getBPMNSubProcessShape(node);\n }\n eventshape.children = [content];\n eventshape.style.fill = 'transparent';\n eventshape.style.strokeColor = 'transparent';\n eventshape.style.strokeWidth = 0;\n return eventshape;\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNSubprocessEvent = function (node, subProcessEventsShapes, events) {\n var annotations;\n var ports;\n if (events.annotations.length !== 0) {\n for (var i = 0; i < events.annotations.length; i++) {\n var annot = events.annotations[i];\n annotations = node.initAnnotationWrapper(annot);\n annotations.width = events.width;\n annotations.height = events.height;\n subProcessEventsShapes.children.push(annotations);\n }\n }\n if (events.ports.length !== 0) {\n for (var i = 0; i < events.ports.length; i++) {\n var port = events.ports[i];\n ports = node.initPortWrapper(port);\n subProcessEventsShapes.children.push(ports);\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNAdhocShape = function (node, adhocNode, subProcess) {\n adhocNode.id = node.id + '_0_adhoc';\n adhocNode.width = 12;\n adhocNode.height = 8;\n adhocNode.style.fill = 'black';\n adhocNode.margin.bottom = 5;\n adhocNode.horizontalAlignment = 'Left';\n adhocNode.verticalAlignment = 'Bottom';\n adhocNode.relativeMode = 'Object';\n adhocNode.data = 'M 49.832 76.811 v -2.906 c 0 0 0.466 -1.469 1.931 -1.5 c 1.465 -0.031 2.331 1.219 2.897 1.688 ' +\n 's 1.06 0.75 1.526 0.75 c 0.466 0 1.548 -0.521 1.682 -1.208 s 0.083 3.083 0.083 3.083 s -0.76 0.969 -1.859 0.969 ' +\n 'c -1.066 0 -1.865 -0.625 -2.464 -1.438 s -1.359 -0.998 -2.064 -0.906 C 50.598 75.467 49.832 76.811 49.832 76.811 Z';\n if (subProcess && subProcess.adhoc === true) {\n adhocNode.visible = true;\n }\n else {\n adhocNode.visible = false;\n }\n return adhocNode;\n };\n /** @private */\n BpmnDiagrams.prototype.getBPMNTextAnnotation = function (node, diagram, annotation, content) {\n annotation.id = annotation.id || randomId();\n var annotationContainer = new Canvas();\n var annotationPath = new PathElement();\n var textElement = new TextElement();\n var margin = 10;\n annotationPath.id = node.id + '_' + annotation.id + '_path';\n annotationPath.width = annotation.width;\n annotationPath.height = annotation.height;\n annotationPath.relativeMode = 'Object';\n textElement.id = node.id + '_' + annotation.id + '_text';\n textElement.content = annotation.text;\n var style = node.style;\n textElement.style = {\n fontSize: style.fontSize, italic: style.italic, gradient: null, opacity: style.opacity,\n bold: style.bold, textWrapping: style.textWrapping, color: style.color, fill: 'white',\n fontFamily: style.fontFamily, whiteSpace: style.whiteSpace, textOverflow: 'Wrap',\n strokeColor: 'none', strokeWidth: 0,\n strokeDashArray: style.strokeDashArray, textAlign: style.textAlign, textDecoration: style.textDecoration\n };\n textElement.horizontalAlignment = 'Center';\n textElement.verticalAlignment = 'Center';\n textElement.relativeMode = 'Object';\n textElement.margin = { left: 5, right: 5, top: 5, bottom: 5 };\n annotationContainer.offsetX = node.offsetX + annotation.length *\n Math.cos(annotation.angle * (Math.PI / 180));\n annotationContainer.offsetY = node.offsetY + annotation.length *\n Math.sin(annotation.angle * (Math.PI / 180));\n annotationContainer.float = true;\n annotationContainer.transform = Transform.Self;\n annotationContainer.id = node.id + '_textannotation_' + annotation.id;\n annotationContainer.style.strokeColor = 'transparent';\n annotationContainer.margin = { left: margin, right: margin, top: margin, bottom: margin };\n annotationContainer.relativeMode = 'Object';\n annotationContainer.rotateAngle = 0;\n annotationContainer.children = [annotationPath, textElement];\n var annotationNode = new Node(node.shape, 'annotations', { id: annotationContainer.id, shape: { type: 'Bpmn', shape: 'TextAnnotation' } }, true);\n annotationNode.ports = [\n {\n id: annotationPath.id + '_port', shape: 'Square',\n offset: { x: 0, y: 0.5 },\n }\n ];\n annotationNode.offsetX = annotationContainer.offsetX;\n annotationNode.offsetY = annotationContainer.offsetY;\n annotationNode.wrapper = annotationContainer;\n annotationContainer.children.push(annotationNode.initPortWrapper(annotationNode.ports[0]));\n var bounds = new Rect(0, 0, 0, 0);\n if (node.width !== undefined && node.height !== undefined) {\n bounds = new Rect(node.offsetX - node.width / 2, node.offsetY - node.height / 2, node.width, node.height);\n }\n this.setAnnotationPath(bounds, annotationContainer, { x: annotationNode.offsetX, y: annotationNode.offsetY }, annotationNode, annotation.length, annotation.angle);\n var connector = {\n id: node.id + '_' + annotation.id + '_connector',\n constraints: ConnectorConstraints.Default & ~ConnectorConstraints.DragTargetEnd,\n sourceID: node.id, targetID: annotationContainer.id,\n targetDecorator: { shape: 'None' }\n };\n var annotationConnector = new Connector(node.shape, 'annotations', connector, true);\n annotationConnector.targetPortID = annotationNode.ports[0].id;\n annotationConnector.init(diagram);\n annotationConnector.wrapper.float = false;\n annotationConnector.wrapper.transform = Transform.Self;\n content.children.push(annotationConnector.wrapper);\n annotationConnector.zIndex = 10000;\n var entry = this.annotationObjects[node.id];\n if (!entry) {\n entry = {};\n }\n if (!entry[annotation.id]) {\n entry[annotation.id] = {};\n }\n var nodeKey = 'node';\n var connKey = 'connector';\n entry[annotation.id][nodeKey] = annotationNode;\n entry[annotation.id][connKey] = annotationConnector;\n this.annotationObjects[node.id] = entry;\n diagram.initObject(annotationNode, undefined, false);\n annotationNode.zIndex = 10000;\n return annotationContainer;\n };\n /** @private */\n BpmnDiagrams.prototype.getTextAnnotationWrapper = function (node, id) {\n if (node && node.shape.type === 'Bpmn') {\n var shape = node.shape;\n if (shape.shape === 'TextAnnotation') {\n return node.wrapper.children[1];\n }\n else if (this.annotationObjects[node.id] && this.annotationObjects[node.id][id]) {\n var annotationNode = this.annotationObjects[node.id][id].node;\n return this.getTextAnnotationWrapper(annotationNode, id);\n }\n }\n return null;\n };\n /** @private */\n BpmnDiagrams.prototype.addAnnotation = function (node, annotation, diagram) {\n var bpmnShapeContent = node.wrapper.children[0];\n var shape = node.shape;\n var annotationObj = new BpmnAnnotation(shape, 'annotations', annotation, true);\n shape.annotations.push(annotationObj);\n bpmnShapeContent.children.push(this.getBPMNTextAnnotation(node, diagram, annotation, bpmnShapeContent));\n node.wrapper.measure(new Size());\n node.wrapper.arrange(node.wrapper.desiredSize);\n return this.annotationObjects[node.id][annotation.id].connector;\n };\n BpmnDiagrams.prototype.clearAnnotations = function (obj, diagram) {\n var bpmnShape = obj.shape;\n if (bpmnShape.annotations.length) {\n for (var _i = 0, _a = bpmnShape.annotations; _i < _a.length; _i++) {\n var annotation = _a[_i];\n this.removeAnnotationObjects(obj, annotation, diagram);\n }\n }\n delete this.annotationObjects[obj.id];\n };\n /** @private */\n BpmnDiagrams.prototype.checkAndRemoveAnnotations = function (node, diagram) {\n //remove connector path\n //remove annotation node wrapper\n //remove from a quad\n if (node.shape.type === 'Bpmn') {\n if (node.shape.shape === 'TextAnnotation') {\n var id = node.id.split('_');\n var annotationId = id[id.length - 1];\n var nodeId = id[id.length - 3];\n var parentNode = diagram.nameTable[nodeId];\n var bpmnShape = parentNode.shape;\n for (var _i = 0, _a = bpmnShape.annotations; _i < _a.length; _i++) {\n var annotation = _a[_i];\n if (annotation.id === annotationId) {\n var index = bpmnShape.annotations.indexOf(annotation);\n if (index !== -1) {\n diagram.removeDependentConnector(node);\n this.removeAnnotationObjects(parentNode, annotation, diagram);\n return true;\n }\n }\n }\n }\n else if (node.shape.annotations && node.shape.annotations.length) {\n this.clearAnnotations(node, diagram);\n }\n }\n return false;\n };\n BpmnDiagrams.prototype.removeAnnotationObjects = function (parentNode, annotation, diagram) {\n var bpmnShape = parentNode.shape;\n var index = bpmnShape.annotations.indexOf(annotation);\n if (index !== -1) {\n bpmnShape.annotations.splice(index, 1);\n var entry = this.annotationObjects[parentNode.id];\n if (entry && entry[annotation.id]) {\n var annotationNode = entry[annotation.id].node;\n var annotationConnector = entry[annotation.id].connector;\n diagram.removeElements(annotationNode);\n diagram.removeElements(annotationConnector);\n var nodeContent = parentNode.wrapper.children[0];\n index = nodeContent.children.indexOf(annotationNode.wrapper);\n nodeContent.children.splice(index, 1);\n index = nodeContent.children.indexOf(annotationConnector.wrapper);\n nodeContent.children.splice(index, 1);\n diagram.removeFromAQuad(annotationNode);\n diagram.removeFromAQuad(annotationConnector);\n delete diagram.nameTable[annotationNode.id];\n delete diagram.nameTable[annotationConnector.id];\n delete entry[annotation.id];\n }\n }\n };\n BpmnDiagrams.prototype.setAnnotationPath = function (parentBounds, wrapper, position, node, length, angle) {\n var rotateAngle = this.getAnnotationPathAngle(position, parentBounds);\n var data = '';\n var pathElement = wrapper.children[0];\n var portElement = wrapper.children[2];\n var textElement = wrapper.children[1];\n pathElement.horizontalAlignment = 'Stretch';\n pathElement.verticalAlignment = 'Stretch';\n textElement.margin.left = textElement.margin.right = 5;\n textElement.margin.top = textElement.margin.bottom = 5;\n var point;\n var segment;\n if (rotateAngle === 0) {\n data = 'M10,20 L0,20 L0,0 L10,0';\n pathElement.width = 10;\n pathElement.horizontalAlignment = 'Left';\n portElement.setOffsetWithRespectToBounds(0, 0.5, 'Fraction');\n textElement.margin.top = textElement.margin.bottom = 10;\n point = parentBounds.middleRight;\n segment = {\n X1: parentBounds.right, Y1: parentBounds.top,\n X2: parentBounds.right, Y2: parentBounds.bottom\n };\n }\n else if (rotateAngle === 180) {\n data = 'M0,0 L10,0 L10,20 L0,20';\n pathElement.width = 10;\n pathElement.horizontalAlignment = 'Right';\n portElement.setOffsetWithRespectToBounds(1, 0.5, 'Fraction');\n textElement.margin.top = textElement.margin.bottom = 10;\n point = parentBounds.middleLeft;\n segment = {\n X1: parentBounds.left, Y1: parentBounds.top,\n X2: parentBounds.left, Y2: parentBounds.bottom\n };\n }\n else if (rotateAngle === 90) {\n data = 'M20,10 L20,0 L0,0 L0,10';\n pathElement.height = 10;\n pathElement.verticalAlignment = 'Top';\n portElement.setOffsetWithRespectToBounds(0.5, 0, 'Fraction');\n textElement.margin.left = textElement.margin.right = 10;\n point = parentBounds.bottomCenter;\n segment = {\n X1: parentBounds.right, Y1: parentBounds.bottom,\n X2: parentBounds.left, Y2: parentBounds.bottom\n };\n }\n else {\n data = 'M0,0 L0,10 L20,10 L20,0';\n pathElement.height = 10;\n pathElement.verticalAlignment = 'Bottom';\n portElement.setOffsetWithRespectToBounds(0.5, 1, 'Fraction');\n textElement.margin.left = textElement.margin.right = 10;\n point = parentBounds.topCenter;\n segment = {\n X1: parentBounds.right, Y1: parentBounds.top,\n X2: parentBounds.left, Y2: parentBounds.top,\n };\n }\n var center = parentBounds.center;\n var endPoint = Point.transform(position, angle, Math.max(parentBounds.width, parentBounds.height));\n point = getIntersectionPoints(segment, [center, endPoint], false, center);\n pathElement.data = data;\n if (length !== undefined && angle !== undefined) {\n point = Point.transform(point, angle, length);\n wrapper.offsetX = node.offsetX = point.x;\n wrapper.offsetY = node.offsetY = point.y;\n }\n };\n BpmnDiagrams.prototype.isBpmnTextAnnotation = function (activeLabel, diagram) {\n if (this.annotationObjects) {\n var parentNodeId = activeLabel.parentId;\n var annotationId = activeLabel.id;\n var parentNode = diagram.nameTable[parentNodeId];\n if (parentNode && parentNode.shape.type === 'Bpmn' && this.annotationObjects[parentNodeId] &&\n this.annotationObjects[parentNodeId][annotationId]) {\n return parentNode;\n }\n return null;\n }\n return null;\n };\n /** @private */\n BpmnDiagrams.prototype.updateTextAnnotationContent = function (parentNode, activeLabel, text, diagram) {\n var parentNodeId = activeLabel.parentId;\n var annotationId = activeLabel.id;\n if (this.annotationObjects[parentNodeId] && this.annotationObjects[parentNodeId][annotationId]) {\n for (var _i = 0, _a = parentNode.shape.annotations; _i < _a.length; _i++) {\n var annotation = _a[_i];\n if (annotation.id === annotationId) {\n annotation.text = text;\n var wrapper = this.annotationObjects[parentNodeId][annotationId].node.wrapper.children[1];\n wrapper.content = text;\n wrapper.visible = true;\n parentNode.wrapper.measure(new Size());\n parentNode.wrapper.arrange(parentNode.wrapper.desiredSize);\n }\n }\n }\n };\n BpmnDiagrams.prototype.updateQuad = function (actualObject, diagram) {\n var annotation = actualObject.shape.annotations;\n var annotationNode;\n if (annotation && annotation.length > 0) {\n for (var i = 0; i < annotation.length; i++) {\n annotationNode = this.annotationObjects[actualObject.id][annotation[i].id].node;\n diagram.updateQuad(annotationNode);\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateTextAnnotationProp = function (actualObject, oldObject, diagram) {\n if (actualObject.shape.type === 'Bpmn') {\n var annotation = actualObject.shape.annotations;\n if (annotation && annotation.length > 0) {\n for (var i = 0; i < actualObject.wrapper.children[0].children.length; i++) {\n for (var j = 0; j < annotation.length; j++) {\n var annotationId = actualObject.wrapper.children[0].children[i].id.split('_');\n var id = annotationId[annotationId.length - 1];\n if (id === annotation[j].id) {\n var annotationNode = this.annotationObjects[actualObject.id][annotation[j].id].node;\n var connector = this.annotationObjects[actualObject.id][annotation[j].id].connector;\n var direction = getPortDirection(connector.targetPoint, actualObject.wrapper.bounds, actualObject.wrapper.bounds, false);\n var position = connector.sourcePoint;\n position = {\n x: connector.sourcePoint.x + actualObject.offsetX - (oldObject.offsetX),\n y: connector.sourcePoint.y + actualObject.offsetY - (oldObject.offsetY)\n };\n position = Point.transform(position, annotation[j].angle, annotation[j].length);\n actualObject.wrapper.children[0].children[i].offsetX =\n annotationNode.offsetX = position.x;\n actualObject.wrapper.children[0].children[i].offsetY =\n annotationNode.offsetY = position.y;\n diagram.updateQuad(annotationNode);\n }\n }\n }\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.findInteractableObject = function (obj, diagram) {\n if (obj.targetID) {\n var targetNode = diagram.nameTable[obj.targetID];\n if (targetNode.shape.type === 'Bpmn' && targetNode.shape.shape === 'TextAnnotation') {\n return targetNode;\n }\n }\n return obj;\n };\n /** @private */\n BpmnDiagrams.prototype.canAdd = function (obj) {\n if (obj.shape && obj.shape.type === 'Bpmn' && obj.shape.shape === 'TextAnnotation') {\n return false;\n }\n return true;\n };\n /** @private */\n BpmnDiagrams.prototype.getSubprocessChildCount = function (node) {\n var count = 0;\n var shape = node.shape.activity;\n var loopType;\n var subProcess = shape.subProcess;\n loopType = subProcess.loop;\n if (loopType !== undefined && loopType !== 'None') {\n count++;\n }\n if ((subProcess.compensation !== undefined) &&\n subProcess.compensation === true) {\n count++;\n }\n if ((subProcess.collapsed !== undefined) &&\n subProcess.collapsed === true) {\n count++;\n }\n if ((subProcess.adhoc !== undefined) &&\n subProcess.adhoc === true) {\n count++;\n }\n return count;\n };\n /** @private */\n BpmnDiagrams.prototype.getTaskChildCount = function (node) {\n var count = 0;\n var shape = node.shape.activity;\n var task = shape.task;\n var loopType;\n if ((task.compensation !== undefined) &&\n task.compensation === true) {\n count++;\n }\n if ((task.loop !== undefined) &&\n task.loop !== 'None') {\n count++;\n }\n return count;\n };\n /** @private */\n BpmnDiagrams.prototype.setStyle = function (child, node) {\n //set style\n child.style.fill = node.style.fill;\n child.style.strokeColor = node.style.strokeColor;\n child.style.strokeWidth = node.style.strokeWidth;\n child.style.strokeDashArray = node.style.strokeDashArray;\n child.style.opacity = node.style.opacity;\n child.style.gradient = node.style.gradient;\n if ((node.constraints & NodeConstraints.Shadow) !== 0) {\n child.shadow = node.shadow;\n }\n };\n //End code conversion region\n //Update BPMN Shapes on NodePropertyChange\n //Start region\n /** @private */\n BpmnDiagrams.prototype.updateBPMN = function (changedProp, oldObject, actualObject, diagram) {\n var newShape = changedProp.shape || {};\n var elementWrapper = actualObject.wrapper.children[0];\n var actualShape = actualObject.shape.shape;\n var sizeChanged = changedProp.width !== undefined || changedProp.height !== undefined;\n if (newShape.shape === 'Gateway' && newShape.gateway) {\n actualObject.wrapper.children[0] = this.getBPMNGatewayShape(actualObject);\n }\n else if (newShape.shape === 'DataObject' && newShape.dataObject) {\n actualObject.wrapper.children[0] = this.getBPMNDataObjectShape(actualObject);\n }\n else if (newShape.shape === 'Activity' && newShape.activity) {\n actualObject.wrapper.children[0] = this.getBPMNActivityShape(actualObject);\n }\n else if (newShape.shape === 'Event' && newShape.event) {\n var shapeEvent = newShape.event;\n actualObject.wrapper.children[0] = this.getBPMNEventShape(actualObject, shapeEvent);\n }\n else if (newShape.shape === 'Message' || newShape.shape === 'DataSource') {\n actualObject.wrapper.children[0] = this.getBPMNShapes(actualObject);\n //} \n // else if (newShape.shape === 'Group') {\n // actualObject.wrapper.children[0] = this.getBPMNGroup(actualObject, diagram);\n }\n else if (newShape.gateway !== undefined || (actualShape === 'Gateway' && sizeChanged)) {\n this.updateBPMNGateway(actualObject, changedProp);\n }\n else if (newShape.dataObject !== undefined || (actualShape === 'DataObject' && sizeChanged)) {\n this.updateBPMNDataObject(actualObject, changedProp, oldObject);\n }\n else if (newShape.activity !== undefined || (actualShape === 'Activity' && sizeChanged)) {\n this.updateBPMNActivity(actualObject, changedProp, oldObject, diagram);\n }\n else if (newShape.event !== undefined || (actualShape === 'Event' && sizeChanged)) {\n this.updateBPMNEvent(actualObject, changedProp, oldObject);\n }\n if (changedProp.style) {\n updateStyle(changedProp.style, elementWrapper instanceof Container ? (actualObject.shape.shape === 'Activity') ?\n elementWrapper.children[0].children[0] :\n elementWrapper.children[0] : elementWrapper);\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNGateway = function (node, changedProp) {\n var bpmnShape = node.shape;\n var elementWrapper = node.wrapper.children[0];\n if (bpmnShape) {\n updateStyle(node.style, elementWrapper.children[0]);\n var bpmnshapeGatewaydata = getBpmnGatewayShapePathData(bpmnShape.gateway.type);\n elementWrapper.children[1].data = bpmnshapeGatewaydata;\n }\n if (changedProp.width !== undefined || changedProp.height !== undefined) {\n this.setSizeForBPMNGateway(node.shape.gateway, elementWrapper, changedProp.width || node.width, changedProp.height || node.height);\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNDataObject = function (node, newObject, oldObject) {\n var bpmnShape = newObject.shape;\n var elementWrapper = node.wrapper.children[0];\n if (bpmnShape) {\n var elementWrapperChild1 = elementWrapper.children[1];\n var elementWrapperChild2 = elementWrapper.children[2];\n if (newObject.style !== undefined) {\n updateStyle(newObject.style, elementWrapper.children[0]);\n elementWrapperChild1.style.opacity = node.style.opacity;\n elementWrapperChild2.style.opacity = node.style.opacity;\n }\n if (bpmnShape.dataObject) {\n switch (bpmnShape.dataObject.type) {\n case 'None':\n elementWrapperChild1.visible = false;\n break;\n case 'Input':\n elementWrapperChild1.style.fill = 'white';\n break;\n case 'Output':\n elementWrapperChild1.style.fill = 'black';\n break;\n }\n if (oldObject.shape.dataObject.type === 'None') {\n elementWrapperChild1.visible = true;\n }\n if (newObject.shape.dataObject.collection !== undefined) {\n elementWrapperChild2.visible = bpmnShape.dataObject.collection;\n }\n }\n }\n if (newObject.width !== undefined || newObject.height !== undefined) {\n this.setSizeForBPMNDataObjects(node.shape.dataObject, elementWrapper, newObject.width || node.width, newObject.height || node.height);\n }\n };\n /** @private */\n BpmnDiagrams.prototype.getEvent = function (node, oldObject, event, child0, child1, child2) {\n switch (event) {\n case 'Start':\n child1.visible = false;\n child0.style.strokeDashArray = '';\n child2.style.fill = 'white';\n child2.style.strokeColor = 'black';\n child0.style.fill = 'white';\n break;\n case 'NonInterruptingStart':\n child0.style.strokeDashArray = '2 3';\n child2.style.fill = 'white';\n child0.style.fill = 'white';\n child2.style.strokeColor = 'black';\n child1.visible = false;\n break;\n case 'Intermediate':\n child0.style.strokeDashArray = '';\n child0.style.fill = 'white';\n child1.style.strokeDashArray = '';\n child0.style.gradient = null;\n child2.style.fill = 'white';\n child2.style.strokeColor = 'black';\n this.updateEventVisibility(oldObject, child1);\n break;\n case 'NonInterruptingIntermediate':\n child0.style.fill = 'white';\n child0.style.gradient = null;\n child2.style.fill = 'white';\n child2.style.strokeColor = 'black';\n child0.style.strokeDashArray = '2 3';\n child1.style.strokeDashArray = '2 3';\n this.updateEventVisibility(oldObject, child1);\n break;\n case 'ThrowingIntermediate':\n case 'End':\n child0.style.fill = event !== 'End' ? 'white' : 'black';\n child0.style.strokeDashArray = '';\n child1.style.strokeDashArray = '';\n child0.style.gradient = null;\n child2.style.fill = 'black';\n this.updateEventVisibility(oldObject, child1);\n child2.style.strokeColor = node.style.fill;\n break;\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateEventVisibility = function (oldObject, child1) {\n if (oldObject.shape.activity && oldObject.shape.activity.subProcess &&\n oldObject.shape.activity.subProcess.events &&\n oldObject.shape.activity.subProcess.events[0] !== undefined &&\n oldObject.shape.activity.subProcess.events[0].event !== undefined) {\n if (oldObject.shape.activity.subProcess.events[0].event === 'NonInterruptingStart' ||\n oldObject.shape.activity.subProcess.events[0].event === 'Start') {\n child1.visible = true;\n }\n }\n else if (oldObject.shape.event !== undefined) {\n if (oldObject.shape.event.event === 'NonInterruptingStart' ||\n oldObject.shape.event.event === 'Start') {\n child1.visible = true;\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNEvent = function (node, newObject, oldObject) {\n var bpmnShape = newObject.shape;\n var elementWrapper = node.wrapper.children[0];\n if (bpmnShape) {\n var elementWrapperChild0 = elementWrapper.children[0];\n var elementWrapperChild1 = elementWrapper.children[1];\n var elementWrapperChild2 = elementWrapper.children[2];\n var event_1;\n var trigger = void 0;\n if (newObject.style !== undefined) {\n updateStyle(node.style, elementWrapper.children[0]);\n if (newObject.style.opacity !== undefined || newObject.style.strokeColor !== undefined) {\n elementWrapperChild1.style.opacity = node.style.opacity;\n elementWrapperChild1.style.strokeColor = node.style.strokeColor;\n }\n }\n event_1 = bpmnShape.event.event;\n trigger = bpmnShape.event.trigger;\n if (event_1 !== undefined) {\n this.getEvent(node, oldObject, event_1, elementWrapperChild0, elementWrapperChild1, elementWrapperChild2);\n }\n if (trigger !== undefined) {\n this.updateBPMNEventTrigger(node, newObject);\n }\n }\n if (newObject.width !== undefined || newObject.height !== undefined) {\n this.setSizeForBPMNEvents(node.shape.event, elementWrapper, newObject.width || node.width, newObject.height || node.height);\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNEventTrigger = function (node, newObject) {\n var bpmnShape = node.shape;\n var elementWrapper = node.wrapper.children[0].children[2];\n if (newObject.style &&\n (newObject.style.strokeColor !== undefined || newObject.style.opacity !== undefined)) {\n updateStyle(node.style, elementWrapper);\n }\n var bpmnshapeTriggerdata = getBpmnTriggerShapePathData(bpmnShape.event.trigger);\n if (bpmnShape.event.trigger) {\n elementWrapper.height = elementWrapper.height * 0.8;\n }\n elementWrapper.data = bpmnshapeTriggerdata;\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNActivity = function (node, newObject, oldObject, diagram) {\n var bpmnShape = newObject.shape;\n var elementWrapper = node.wrapper.children[0];\n var size = this.getSize(node, elementWrapper.children[0].children[0]);\n if (bpmnShape) {\n var oldProp = oldObject.shape.activity.activity;\n var actualObjectProp = node.shape.activity.activity;\n if ((oldProp === 'SubProcess' || oldProp === 'Task') && (actualObjectProp === 'SubProcess' || actualObjectProp === 'Task')) {\n diagram.removeElements(node);\n node.wrapper.children[0] = this.getBPMNActivityShape(node);\n }\n else {\n if (actualObjectProp === 'Task' && bpmnShape.activity.task !== undefined) {\n this.updateBPMNActivityTask(node, newObject);\n var subChildCount = this.getTaskChildCount(node);\n var x = void 0;\n var childSpace = subChildCount * 12;\n var area = size.width / 2 - childSpace;\n if (subChildCount === 1) {\n x = area + 8;\n }\n else {\n x = area + (subChildCount - 1) * 8;\n }\n if (bpmnShape.activity.task.loop !== undefined) {\n this.updateBPMNActivityTaskLoop(node, newObject, x, subChildCount, area, 2);\n }\n }\n if (actualObjectProp === 'SubProcess' && bpmnShape.activity.subProcess !== undefined) {\n this.updateBPMNActivitySubProcess(node, newObject, oldObject, diagram);\n }\n }\n this.setSizeForBPMNActivity(node.shape.activity, elementWrapper, newObject.width || size.width, newObject.height || size.height, node);\n }\n if (newObject.width !== undefined || newObject.height !== undefined) {\n this.setSizeForBPMNActivity(node.shape.activity, elementWrapper, newObject.width || size.width, newObject.height || size.height, node);\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNActivityTask = function (node, newObject) {\n var bpmnShape = newObject.shape;\n var elementWrapper = node.wrapper.children[0].children[0];\n var task = bpmnShape.activity.task;\n if (task.type === 'Receive' || task.type === 'Send') {\n elementWrapper.children[1].height = 14;\n }\n else {\n elementWrapper.children[1].height = 20;\n }\n if (task.type !== undefined) {\n var bpmnshapeTaskdata = getBpmnTaskShapePathData(task.type);\n elementWrapper.children[1].data = bpmnshapeTaskdata;\n }\n if (bpmnShape.activity.task.call !== undefined) {\n if (bpmnShape.activity.task.call !== false) {\n elementWrapper.children[0].style.strokeWidth = 4;\n }\n else {\n elementWrapper.children[0].style.strokeWidth = 1;\n }\n }\n if (bpmnShape.activity.task.compensation !== undefined) {\n if (bpmnShape.activity.task.compensation === true) {\n elementWrapper.children[3].visible = true;\n }\n else {\n elementWrapper.children[3].visible = false;\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNActivityTaskLoop = function (node, newObject, x, subChildCount, area, start) {\n var bpmnShape = newObject.shape;\n var elementWrapper = node.wrapper.children[0].children[0];\n var activity = bpmnShape.activity;\n var loop;\n var index = 0;\n var bpmnshapeLoopdata;\n if (activity.subProcess !== undefined) {\n var subProcess = activity.subProcess;\n index = (activity.subProcess.type === 'Transaction') ? 2 : 0;\n loop = subProcess.loop;\n bpmnshapeLoopdata = getBpmnLoopShapePathData(loop);\n elementWrapper.children[2 + index].data = bpmnshapeLoopdata;\n elementWrapper.children[2 + index].visible = (loop === 'None') ? false : true;\n }\n else if (activity.task !== undefined && activity.task.loop !== undefined) {\n bpmnshapeLoopdata = getBpmnLoopShapePathData(activity.task.loop);\n elementWrapper.children[2].data = bpmnshapeLoopdata;\n elementWrapper.children[2].visible = (activity.task.loop === 'None') ? false : true;\n }\n this.updateChildMargin(elementWrapper, subChildCount, area, x, start + index);\n };\n /** @private */\n BpmnDiagrams.prototype.updateChildMargin = function (elementWrapper, subChildCount, area, x, start) {\n if (subChildCount === 1) {\n for (var i = start; i < elementWrapper.children.length; i++) {\n if (i !== 2 && elementWrapper.children[i].visible === true) {\n elementWrapper.children[i].margin.left = x;\n x = area + 8;\n }\n }\n }\n else {\n x = area + (subChildCount - 1) * 8;\n for (var i = start; i < elementWrapper.children.length; i++) {\n if (i !== 2 && elementWrapper.children[i].visible === true) {\n elementWrapper.children[i].margin.left = x;\n x += 12 + 8;\n }\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNActivitySubProcess = function (node, newObject, oldObject, diagram) {\n var bpmnShape = newObject.shape;\n var elementWrapper = node.wrapper.children[0];\n var size = this.getSize(node, elementWrapper.children[0].children[0]);\n var subProcess = bpmnShape.activity.subProcess;\n var subChildCount = this.getSubprocessChildCount(node);\n var x;\n var childSpace = subChildCount * 12;\n var area = size.width / 2 - childSpace;\n if (subChildCount === 1) {\n x = area + 8;\n }\n else {\n x = area + (subChildCount - 1) * 8;\n }\n updateStyle(node.style, elementWrapper.children[0].children[0]);\n if (subProcess.events !== undefined) {\n this.updateBPMNSubProcessEvent(node, newObject, oldObject, diagram);\n }\n if (subProcess.adhoc !== undefined) {\n this.updateBPMNSubProcessAdhoc(node, oldObject, subProcess, x, subChildCount, area);\n }\n if (subProcess.boundary !== undefined) {\n this.updateBPMNSubProcessBoundary(node, subProcess);\n }\n if (subProcess.collapsed !== undefined) {\n this.updateBPMNSubProcessCollapsed(node, oldObject, subProcess, x, subChildCount, area, diagram);\n }\n if (subProcess.compensation !== undefined) {\n this.updateBPMNSubProcessCompensation(node, oldObject, subProcess, x, subChildCount, area);\n }\n if (subProcess.loop !== undefined) {\n this.updateBPMNSubProcessLoop(node, oldObject, subProcess, x, subChildCount, area);\n }\n if (subProcess.transaction !== undefined) {\n this.updateBPMNSubProcessTransaction(node, newObject, oldObject, diagram);\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNSubProcessEvent = function (node, newObject, oldObject, diagram) {\n var bpmnShape = newObject.shape;\n var elementWrapper = node.wrapper.children[0];\n var nodeContent = elementWrapper.children[0];\n var index;\n var j = 0;\n var elementWrapperChildLen = elementWrapper.children[0].children.length;\n var subProcess = bpmnShape.activity.subProcess;\n var events;\n var start = 2;\n for (var _i = 0, _a = Object.keys(subProcess.events); _i < _a.length; _i++) {\n var key = _a[_i];\n var eventIndex = Number(key);\n var eventWrapper = nodeContent.children[eventIndex + start];\n var actualEvent = node.shape.activity.subProcess.events[eventIndex];\n this.updateBPMNSubEvent(node, subProcess.events[eventIndex], actualEvent, eventWrapper, newObject, oldObject, diagram);\n }\n };\n BpmnDiagrams.prototype.updateBPMNSubEvent = function (node, newEvent, actualEvent, eventWrapper, newObject, oldObject, diagram) {\n var elementWrapper = node.wrapper.children[0];\n var bpmnShape = newObject.shape;\n var child0 = eventWrapper.children[0];\n var child1 = eventWrapper.children[1];\n var child2 = eventWrapper.children[2];\n var eventType;\n var trigger;\n if (newObject.style) {\n if (newObject.style.strokeColor !== undefined || newObject.style.opacity !== undefined) {\n elementWrapper.children[0].children[1].style.strokeColor = newObject.style.strokeColor;\n elementWrapper.children[0].children[1].style.opacity = newObject.style.opacity;\n }\n }\n if (bpmnShape.activity.subProcess !== undefined) {\n eventType = newEvent.event;\n trigger = newEvent.trigger;\n }\n if (eventType !== undefined) {\n this.getEvent(newObject, oldObject, eventType, child0, child1, child2);\n }\n if (trigger !== undefined) {\n if (newObject.style) {\n updateStyle(newObject.style, elementWrapper.children[0]);\n }\n var bpmnshapeTriggerdata = getBpmnTriggerShapePathData(trigger);\n eventWrapper.children[2].data = bpmnshapeTriggerdata;\n }\n if (newEvent.height !== undefined || newEvent.width !== undefined) {\n this.getEventSize(newEvent, eventWrapper);\n }\n if (newEvent.id !== undefined) {\n eventWrapper.id = newEvent.id;\n }\n if (newEvent.margin !== undefined) {\n eventWrapper.margin = newEvent.margin;\n }\n if (newEvent.horizontalAlignment !== undefined) {\n eventWrapper.horizontalAlignment = newEvent.horizontalAlignment;\n }\n if (newEvent.verticalAlignment !== undefined) {\n eventWrapper.verticalAlignment = newEvent.verticalAlignment;\n }\n if (newEvent.offset !== undefined) {\n eventWrapper.setOffsetWithRespectToBounds(actualEvent.offset.x, actualEvent.offset.y, 'Fraction');\n eventWrapper.relativeMode = 'Point';\n }\n if (newEvent.annotations !== undefined) {\n var annotations = void 0;\n var annotation = elementWrapper.children[0].children[2];\n if (eventWrapper.children[3] && eventWrapper.children.length > 3) {\n annotations = eventWrapper.children[3];\n diagram.updateAnnotation(newEvent.annotations[0], annotations, annotation);\n }\n }\n if (newEvent.ports !== undefined) {\n var ports = void 0;\n var port = elementWrapper.children[0].children[2];\n if (eventWrapper.children[4] && eventWrapper.children.length > 4) {\n ports = eventWrapper.children[4];\n diagram.updatePort(newEvent.ports[0], ports, port);\n }\n }\n if (newEvent.visible !== undefined) {\n this.updateDiagramContainerVisibility(eventWrapper, newEvent.visible);\n }\n };\n BpmnDiagrams.prototype.updateBPMNSubProcessTransaction = function (node, newObject, oldObject, diagram) {\n var transaction = newObject.shape.activity.subProcess.transaction;\n var eventContainer = node.wrapper.children[0].children[0].children[2];\n var actualEvent;\n if (transaction.success !== undefined) {\n actualEvent = node.shape.activity.subProcess.transaction.success;\n this.updateBPMNSubEvent(node, transaction.success, actualEvent, eventContainer.children[0], newObject, oldObject, diagram);\n }\n if (transaction.cancel !== undefined) {\n actualEvent = node.shape.activity.subProcess.transaction.cancel;\n this.updateBPMNSubEvent(node, transaction.cancel, actualEvent, eventContainer.children[1], newObject, oldObject, diagram);\n }\n if (transaction.failure !== undefined) {\n actualEvent = node.shape.activity.subProcess.transaction.failure;\n this.updateBPMNSubEvent(node, transaction.failure, actualEvent, eventContainer.children[2], newObject, oldObject, diagram);\n }\n for (var _i = 0, _a = node.outEdges; _i < _a.length; _i++) {\n var edge = _a[_i];\n var connector = diagram.nameTable[edge];\n switch (connector.sourcePortID) {\n case 'success':\n if (transaction.success && transaction.success.visible !== undefined) {\n diagram.connectorPropertyChange(connector, {}, { sourcePortID: 'success' });\n }\n break;\n case 'cancel':\n if (transaction.cancel && transaction.cancel.visible !== undefined) {\n diagram.connectorPropertyChange(connector, {}, { sourcePortID: 'cancel' });\n }\n break;\n case 'failure':\n if (transaction.failure && transaction.failure.visible !== undefined) {\n diagram.connectorPropertyChange(connector, {}, { sourcePortID: 'failure' });\n }\n break;\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.getEventSize = function (events, wrapperChild) {\n if (events.height !== undefined) {\n wrapperChild.height = events.height;\n wrapperChild.children[0].height = events.height;\n wrapperChild.children[1].height = events.height * 0.85;\n wrapperChild.children[2].height = events.height * 0.54;\n }\n if (events.width !== undefined) {\n wrapperChild.width = events.width;\n wrapperChild.children[0].width = events.width;\n wrapperChild.children[1].width = events.width * 0.85;\n wrapperChild.children[2].width = events.width * 0.54;\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNSubProcessAdhoc = function (node, oldObject, subProcess, x, subChildCount, area) {\n var shape = node.shape;\n var elementWrapper = node.wrapper.children[0].children[0];\n var index = (node.shape.activity.subProcess.type === 'Transaction') ? 2 : 0;\n if (subProcess.adhoc === false) {\n elementWrapper.children[3 + index].visible = false;\n }\n else {\n elementWrapper.children[3 + index].visible = true;\n }\n this.updateChildMargin(elementWrapper, subChildCount, area, x, 3 + index);\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNSubProcessBoundary = function (node, subProcess) {\n var shape = node.shape;\n var elementWrapper = (node.wrapper.children[0].children[0].children[0]);\n if (subProcess.boundary === 'Default') {\n elementWrapper.style.strokeWidth = 1;\n elementWrapper.style.strokeDashArray = '1 0';\n }\n if (subProcess.boundary === 'Call') {\n elementWrapper.style.strokeWidth = 4;\n elementWrapper.style.strokeDashArray = '1 0';\n }\n if (subProcess.boundary === 'Event') {\n elementWrapper.style.strokeWidth = 1;\n elementWrapper.style.strokeDashArray = '2 2';\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateElementVisibility = function (node, visible, diagram) {\n if (node.shape.activity.subProcess.processes\n && node.shape.activity.subProcess.processes.length > 0) {\n var processes = node.shape.activity.subProcess.processes;\n for (var j = processes.length - 1; j >= 0; j--) {\n var currentNode = diagram.nameTable[processes[j]];\n currentNode.visible = visible;\n diagram.updateElementVisibility(currentNode.wrapper, currentNode, visible);\n if (visible) {\n if (currentNode.shape.shape === 'Event') {\n this.setEventVisibility(currentNode, currentNode.wrapper.children[0].children);\n }\n if (currentNode.shape.activity.activity === 'SubProcess') {\n this.setSubProcessVisibility(currentNode);\n }\n }\n var connectors = currentNode.inEdges.concat(currentNode.outEdges);\n for (var i = connectors.length - 1; i >= 0; i--) {\n var connector = diagram.nameTable[connectors[i]];\n connector.visible = visible;\n diagram.updateElementVisibility(connector.wrapper, connector, visible);\n }\n }\n }\n if (visible) {\n if (node.shape.shape === 'Event') {\n this.setEventVisibility(node, node.wrapper.children[0].children);\n }\n if (node.shape.activity.activity === 'SubProcess') {\n this.setSubProcessVisibility(node);\n }\n if (node.shape.activity.activity === 'Task' &&\n node.shape.shape === 'Activity' && node.shape.activity.subProcess.loop === 'None') {\n node.wrapper.children[0].children[0].children[3].visible = false;\n }\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNSubProcessCollapsed = function (node, oldObject, subProcess, x, subChildCount, area, diagram) {\n var eventLength = node.shape.activity.subProcess.events.length;\n var elementWrapper = node.wrapper.children[0].children[0];\n var index = (node.shape.activity.subProcess.type === 'Transaction') ? 3 : 1;\n if (subProcess.collapsed === false) {\n this.updateElementVisibility(node, true, diagram);\n elementWrapper.children[index + eventLength].visible = false;\n }\n else {\n this.updateElementVisibility(node, false, diagram);\n elementWrapper.children[index + eventLength].visible = true;\n }\n this.updateChildMargin(elementWrapper, subChildCount, area, x, 3 + eventLength);\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNSubProcessCompensation = function (node, oldObject, subProcess, x, subChildCount, area) {\n var elementWrapper = node.wrapper.children[0].children[0];\n var index = (node.shape.activity.subProcess.type === 'Transaction') ? 2 : 0;\n if (subProcess.compensation === false) {\n elementWrapper.children[4 + index].visible = false;\n }\n else {\n elementWrapper.children[4 + index].visible = true;\n }\n this.updateChildMargin(elementWrapper, subChildCount, area, x, 4 + index);\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNSubProcessLoop = function (node, oldObject, subProcess, x, subChildCount, area) {\n this.updateBPMNActivityTaskLoop(node, node, x, subChildCount, area, 1);\n };\n /** @private */\n BpmnDiagrams.prototype.updateBPMNConnector = function (actualObject, oldObject, connection, diagram) {\n var flowType = connection.shape;\n if (flowType.sequence !== undefined) {\n actualObject = this.getSequence(actualObject, oldObject, connection, diagram);\n }\n if (flowType.association !== undefined) {\n actualObject = this.getAssociation(actualObject, oldObject, connection, diagram);\n }\n if (flowType.message !== undefined) {\n actualObject = this.getMessage(actualObject, oldObject, connection, diagram);\n }\n return actualObject;\n };\n /** @private */\n BpmnDiagrams.prototype.getSequence = function (actualObject, oldObject, connection, diagram) {\n if ((connection.shape.sequence) === 'Normal') {\n diagram.connectorPropertyChange(actualObject, oldObject, {\n type: 'Straight',\n targetDecorator: { shape: 'Arrow', style: { fill: 'black' } }\n });\n actualObject.wrapper.children[3].visible = false;\n }\n if ((connection.shape.sequence) === 'Default') {\n diagram.connectorPropertyChange(actualObject, oldObject, {\n type: 'Straight',\n targetDecorator: { shape: 'Arrow', style: { fill: 'black' } },\n sourceDecorator: { shape: 'None' }\n });\n var segment = new PathElement();\n var pathseq = new PathElement();\n var pathseqData = void 0;\n segment = actualObject.getSegmentElement(actualObject, segment);\n var anglePoints = actualObject.intermediatePoints;\n for (var j = 0; j < anglePoints.length - 1; j++) {\n length = length + actualObject.distance(anglePoints[j], anglePoints[j + 1]);\n pathseqData = actualObject.findPath(anglePoints[j], anglePoints[j + 1]);\n }\n actualObject.wrapper.children[3].data = pathseqData[0];\n actualObject.wrapper.children[3].id = actualObject.id + '_' + (connection.shape.sequence);\n actualObject.wrapper.children[3].offsetX = pathseqData[1].x;\n actualObject.wrapper.children[3].offsetY = pathseqData[1].y;\n actualObject.wrapper.children[3].rotateAngle = 45;\n actualObject.wrapper.children[3].transform = Transform.Self;\n }\n if ((connection.shape.sequence) === 'Conditional') {\n diagram.connectorPropertyChange(actualObject, oldObject, {\n type: 'Straight',\n targetDecorator: { shape: 'Arrow', style: { fill: 'black' } },\n sourceDecorator: { shape: 'Diamond', width: 20, height: 10, style: { fill: 'white' } }\n });\n actualObject.wrapper.children[3].visible = false;\n }\n return actualObject;\n };\n /** @private */\n BpmnDiagrams.prototype.getAssociation = function (actualObject, oldObject, connection, diagram) {\n if ((connection.shape.association) === 'Default') {\n diagram.connectorPropertyChange(actualObject, oldObject, {\n type: 'Straight', style: { strokeDashArray: 'None' },\n targetDecorator: { shape: 'Arrow', style: { fill: 'black' } },\n sourceDecorator: { shape: 'None' }\n });\n }\n if ((connection.shape.association) === 'Directional') {\n diagram.connectorPropertyChange(actualObject, oldObject, {\n type: 'Straight', style: { strokeDashArray: '2 2' },\n targetDecorator: { shape: 'Arrow', style: { fill: 'black' } },\n sourceDecorator: { shape: 'None' }\n });\n }\n if ((connection.shape.association) === 'BiDirectional') {\n diagram.connectorPropertyChange(actualObject, oldObject, {\n type: 'Straight', style: { strokeDashArray: '2 2' },\n targetDecorator: { shape: 'Arrow', style: { fill: 'black' } },\n sourceDecorator: { shape: 'Arrow', width: 5, height: 10, style: { fill: 'white' } }\n });\n }\n return actualObject;\n };\n /** @private */\n BpmnDiagrams.prototype.getMessage = function (actualObject, oldObject, connection, diagram) {\n var segmentOffset = 0.5;\n var angle;\n var pt;\n if ((oldObject.shape.message) === 'Default') {\n if ((connection.shape.message) !== undefined) {\n if (((connection.shape.message) === 'InitiatingMessage') ||\n ((connection.shape.message) === 'NonInitiatingMessage')) {\n var segment = new PathElement();\n segment = actualObject.getSegmentElement(actualObject, segment);\n var anglePoints = actualObject.intermediatePoints;\n for (var j = 0; j < anglePoints.length - 1; j++) {\n length = length + actualObject.distance(anglePoints[j], anglePoints[j + 1]);\n var offLength = length * segmentOffset;\n if (length >= offLength) {\n angle = findAngle(anglePoints[j], anglePoints[j + 1]);\n pt = Point.transform(anglePoints[j], angle, offLength);\n }\n }\n }\n actualObject.wrapper.children[3].id = actualObject.id + '_' + (connection.shape.message);\n actualObject.wrapper.children[3].width = 25;\n actualObject.wrapper.children[3].height = 15;\n actualObject.wrapper.children[3].data = 'M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0';\n actualObject.wrapper.children[3].horizontalAlignment = 'Center';\n actualObject.wrapper.children[3].verticalAlignment = 'Center';\n actualObject.wrapper.children[3].transform = Transform.Self;\n actualObject.wrapper.children[3].style.fill = (connection.shape.message) === 'NonInitiatingMessage' ?\n 'lightgrey' : 'white';\n actualObject.wrapper.children[3].offsetX = pt.x;\n actualObject.wrapper.children[3].offsetY = pt.y;\n }\n }\n else if ((oldObject.shape.message) !== 'NonInitiatingMessage' ||\n (oldObject.shape.message) !== 'InitiatingMessage') {\n if ((connection.shape.message) !== 'Default') {\n actualObject.wrapper.children[3].style.fill = (connection.shape.message) === 'NonInitiatingMessage' ?\n 'lightgrey' : 'white';\n }\n else {\n actualObject.wrapper.children[3].visible = false;\n }\n }\n return actualObject;\n };\n //End update Region\n //size updation\n BpmnDiagrams.prototype.setSizeForBPMNEvents = function (event, wrapper, width, height) {\n wrapper.children[0].width = width;\n wrapper.children[0].height = height;\n //child node 1 - event node\n var eventNode = wrapper.children[1];\n eventNode.width = width * 0.85;\n eventNode.height = height * 0.85;\n var triggerNode = wrapper.children[2];\n if (event.trigger === 'Message') {\n triggerNode.width = width * 0.54;\n triggerNode.height = height * 0.4;\n }\n else {\n triggerNode.width = width * 0.5;\n triggerNode.height = height * 0.5;\n }\n };\n /** @private */\n BpmnDiagrams.prototype.updateAnnotationDrag = function (node, diagram, tx, ty) {\n var checkAnnotation = node.id.split('_');\n if (checkAnnotation[1] === 'textannotation') {\n var parentNode = void 0;\n for (var j = 0; j < node.inEdges.length; j++) {\n var connector = diagram.nameTable[node.inEdges[j]];\n if (connector) {\n parentNode = diagram.nameTable[connector.sourceID];\n }\n var start = { x: node.offsetX + tx, y: node.offsetY + ty };\n var end = connector.sourcePoint;\n var length_1 = Point.findLength(start, end);\n var angle = Point.findAngle(end, start);\n if (parentNode.shape.annotations) {\n for (var x = 0; x < (parentNode.shape.annotations).length; x++) {\n if ((parentNode.shape.annotations)[x].id === checkAnnotation[checkAnnotation.length - 1]) {\n (parentNode.shape.annotations[x]).length = length_1;\n (parentNode.shape.annotations[x]).angle = angle;\n this.setAnnotationPath(parentNode.wrapper.bounds, node.wrapper, start, node);\n return false;\n }\n }\n }\n }\n }\n if (node.processId) {\n this.drag(node, tx, ty, diagram);\n return true;\n }\n return false;\n };\n BpmnDiagrams.prototype.getAnnotationPathAngle = function (point, bounds) {\n var direction = getPortDirection(point, bounds, bounds, false);\n var rotateAngle = 0;\n switch (direction) {\n case 'Right':\n rotateAngle = 0;\n break;\n case 'Left':\n rotateAngle = 180;\n break;\n case 'Bottom':\n rotateAngle = 90;\n break;\n case 'Top':\n rotateAngle = 270;\n break;\n }\n return rotateAngle;\n };\n BpmnDiagrams.prototype.setSizeForBPMNGateway = function (event, wrapper, width, height) {\n wrapper.children[0].width = width;\n wrapper.children[0].height = height;\n wrapper.children[1].width = width * 0.45;\n wrapper.children[1].height = height * 0.45;\n };\n BpmnDiagrams.prototype.setSizeForBPMNDataObjects = function (event, wrapper, width, height) {\n wrapper.children[0].width = width;\n wrapper.children[0].height = height;\n };\n BpmnDiagrams.prototype.setSizeForBPMNActivity = function (activity, wrapper, width, height, node) {\n //child node 1 - event node\n wrapper.children[0].width = width;\n wrapper.children[0].height = height;\n wrapper.children[0].children[0].width = width;\n wrapper.children[0].children[0].height = height;\n if (activity.subProcess.type === 'Transaction') {\n wrapper.children[0].children[1].width = Math.max(width - 6, 1);\n wrapper.children[0].children[1].height = Math.max(height - 6, 1);\n wrapper.children[0].children[2].width = width;\n wrapper.children[0].children[2].height = height;\n }\n var taskNode = new DiagramElement();\n var x;\n var size = this.getSize(node, taskNode);\n var childCount;\n var iconSpace = 4;\n if (activity.activity === 'Task') {\n childCount = this.getTaskChildCount(node);\n }\n else {\n childCount = this.getSubprocessChildCount(node);\n }\n var childSpace = childCount * 12;\n var area = (width || size.width) / 2;\n if (childCount === 1) {\n x = area - 6;\n }\n else {\n x = area - (childSpace / 2) - ((childCount - 1) * iconSpace) / 2;\n }\n for (var i = 0; i < wrapper.children[0].children.length; i++) {\n if (wrapper.children[0].children[i].visible &&\n (wrapper.children[0].children[i].id.indexOf('_loop') > -1 ||\n wrapper.children[0].children[i].id.indexOf('_0_compensation') > -1 ||\n wrapper.children[0].children[i].id.indexOf('_0_adhoc') > -1 ||\n wrapper.children[0].children[i].id.indexOf('_0_collapsed') > -1)) {\n wrapper.children[0].children[i].margin.left = x;\n x += wrapper.children[0].children[i].actualSize.width + iconSpace;\n }\n }\n };\n BpmnDiagrams.prototype.updateDiagramContainerVisibility = function (element, visible) {\n if (element instanceof Container) {\n for (var i = 0; i < element.children.length; i++) {\n this.updateDiagramContainerVisibility(element.children[i], visible);\n }\n }\n element.visible = visible;\n };\n /**\n * To destroy the BpmnDiagrams module\n * @return {void}\n * @private\n */\n BpmnDiagrams.prototype.destroy = function () {\n /**\n * Destroys the BpmnDiagrams module\n */\n };\n /**\n * Get module name.\n */\n BpmnDiagrams.prototype.getModuleName = function () {\n /**\n * Returns the module name\n */\n return 'Bpmn';\n };\n return BpmnDiagrams;\n}());\nexport { BpmnDiagrams };\nexport function getBpmnShapePathData(shape) {\n return bpmnShapes[shape.toString()];\n}\nexport function getBpmnTriggerShapePathData(shape) {\n return bpmnTriggerShapes[shape.toString()];\n}\nexport function getBpmnGatewayShapePathData(shape) {\n return bpmnGatewayShapes[shape.toString()];\n}\nexport function getBpmnTaskShapePathData(shape) {\n return bpmnTaskShapes[shape.toString()];\n}\nexport function getBpmnLoopShapePathData(shape) {\n return bpmnLoopShapes[shape.toString()];\n}\nvar bpmnShapes = {\n 'Event': 'M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5' +\n 'C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z',\n 'Message': 'M0,0L19.8,12.8L40,0L0,0L0,25.5L40,25.5L40,0z',\n 'DataSource': 'M 0 10.6 c 0 5.9 16.8 10.6 37.5 10.6 S 75 16.4 75 10.6 v 0 v 68.9 v -0.1 C 75 85.3 58.2 90 37.5 90 ' +\n 'S 0 85.3 0 79.4 l 0 0.1 V 56 V 40.6 L 0 10.6 C 0 4.7 16.8 0 37.5 0 S 75 4.7 75 10.6 S 58.2 21.2 37.5 21.2' +\n 'S 0 16.5 0 10.6 l 0 6.7 v -0.2 c 0 5.9 16.8 10.6 37.5 10.6 S 75 22.9 75 17.1 v 6.8 v -0.1 ' +\n 'c 0 5.9 -16.8 10.6 -37.5 10.6 S 0 29.6 0 23.8',\n 'SubProcess': 'M100,100 h200 a20,20 0 0 1 20,20 v200 a20,20 0 0 1 -20,20 h-200 ' +\n 'a20,20 0 0 1 -20,-20 v-200 a20,20 0 0 1 20,-20 z',\n 'collapsedShape': 'M 8.13789 15 H 0 V 0 H 8.13789 V 15 Z M 0.625991 13.75 H 7.51189 V 1.25 H 0.625991 V 13.75 Z ' +\n 'M 2.18095 7.03125 L 5.95631 7.03125 L 5.95631 7.46875 L 2.18095 7.46875 Z M 3.8342 3.73 ' +\n 'L 4.30369 3.73 L 4.30369 11.2687 L 3.8342 11.2687 Z',\n};\nvar bpmnTriggerShapes = {\n // 'None': '',\n 'Message': 'M0,0 L19.8,12.8 L40,0 L0, 0 L0, 25.5 L40, 25.5 L 40, 0',\n 'Timer': 'M40,20c0,8.654-5.496,16.024-13.189,18.81' +\n 'C24.685,39.58,22.392,40,20,40C8.954,40,0,31.046,0,20S8.954,0,20,0S40,8.954,40,20z M20,0 L20,2.583 L20,5.283 M10.027,2.681' +\n 'L11.659,5.507 L12.669,7.257 M2.731,9.989 L6.014,11.885 L7.307,12.631 M0.067,19.967 L2.667,19.967 L5.35,19.967' +\n 'M2.748,29.939 L5.731,28.217 L7.323,27.298 M10.056,37.236 L11.292,35.095 L12.698,32.66 M20.033,39.9 L20.033,36.417 L20.033,34.617' +\n 'M30.006,37.219 L28.893,35.292 L27.364,32.643 M37.302,29.911 L34.608,28.355 L32.727,27.269' +\n 'M39.967,19.933 L37.417,19.933 L34.683,19.933 M37.286,9.961 L34.583,11.521 L32.71,12.602 M29.977,2.664 L28.653,4.957 L27.336,' +\n '7.24 M22.104,8.5 L19.688,20 L24.75,20 L31.604,20 L24.75,20 L19.688,20z',\n 'Error': 'M 23.77 18.527 l -7.107 27.396 l 8.507 -17.247 L 36.94 40.073 l 6.394 -25.997 l -8.497 15.754 L 23.77 18.527 Z',\n 'Escalation': 'M 30.001 8.098 L 11.842 43.543 l 18.159 -18.882 l 18.162 18.882 L 30.001 8.098 Z ',\n 'Cancel': 'M 3.5 16 L 0 12.6 L 4.6 8 L 0 3.5 L 3.4 0 L 8 4.6 l 4.5 -4.5 L 16 3.5 L 11.5 8 l 4.5 4.5 l -3.4 3.5 L 8 11.4 L 3.5 16 Z',\n 'Compensation': 'M 25.7086 0 L 0 25 L 25.7086 50 V 26.3752 L 50 50 V 0 L 25.7086 23.6248 V 0 Z ',\n 'Conditional': 'M 0 0 H 16 V 16 H 0 z M 1.14 3.2 H 14.85 M 1.14 6.4 H 14.85 M 1.14 9.6 H 14.85 M 1.14 12.8 H 14.85',\n 'Link': 'M 32.014 19.258 v 5.992 H 9.373 v 9.504 h 22.641 v 5.988 L 50.622 30 L 32.014 19.258 Z',\n 'Signal': 'M 50 50 H 0 L 25.0025 0 L 50 50 Z',\n 'Terminate': 'M 25 50 C 11.21 50 0 38.79 0 25 C 0 11.21 11.21 0 25 0 C 38.78 0 50 11.21 50 25 C 50 38.79 38.78 50 25 50',\n 'Multiple': 'M 17.784 48.889 H 42.21 l 7.548 -23.23 L 29.997 11.303 L 10.236 25.658 L 17.784 48.889 Z',\n 'Parallel': 'M 27.276 49.986 h 5.58 v -17.15 h 17.146 V 27.17 h -17.15 l 0.004 -17.15 h -5.58 l -0.004 17.15 ' +\n 'H 9.994 v 5.666 h 17.278 L 27.276 49.986 Z',\n};\nvar bpmnGatewayShapes = {\n 'None': '',\n //exclusive\n 'Exclusive': 'M 11.196 29.009 l 6.36 -9.712 l -5.764 -8.899 h 4.393 l 3.732 5.979 l 3.656 -5.979 h 4.354 l -5.789 9.039' +\n 'l 6.36 9.572 h -4.532 l -4.126 -6.437 l -4.139 6.437 H 11.196 Z',\n //inclusive\n 'Inclusive': 'M 20.323 31.333 c -6.625 0 -12.015 -5.39 -12.015 -12.015 s 5.39 -12.015 12.015 -12.015 ' +\n 's 12.016 5.39 12.016 12.015 S 26.948 31.333 20.323 31.333 Z M 20.323 9.303 c -5.522 0 -10.015 4.493 -10.015 10.015 ' +\n 's 4.492 10.015 10.015 10.015 s 10.016 -4.493 10.016 -10.015 S 25.846 9.303 20.323 9.303 Z',\n //parallel\n 'Parallel': 'M 18.394 29.542 v -8.833 H 9.626 v -3.691 h 8.768 V 8.251 h 3.734 v 8.767 h 8.768 v 3.691 h -8.768 v 8.833 H 18.394 Z',\n //complex\n 'Complex': 'M29.198,19.063L23.089,19.063L27.794,14.358L26.38,12.944L21.223,18.101L21.223,10.443L19.223,10.443L19.223,17.976' +\n 'L14.022,12.776L12.608,14.19L17.48,19.063L10.365,19.063L10.365,21.063L18.261,21.063L12.392,26.932L13.806,28.346' +\n 'L19.223,22.929L19.223,30.225L21.223,30.225L21.223,22.805L25.925,27.507L27.339,26.093L22.309,21.063L29.198,21.063z',\n //eventbased\n 'EventBased': 'M 20.322 29.874 c -5.444 0 -9.873 -4.43 -9.873 -9.874 s 4.429 -9.874 9.873 -9.874 s 9.874 4.429 9.874 9.874 ' +\n 'S 25.767 29.874 20.322 29.874 Z M 20.322 32.891 c -7.107 0 -12.89 -5.783 -12.89 -12.891 c 0 -7.107 5.782 -12.89 12.89 -12.89 ' +\n 'c 7.108 0 12.891 5.783 12.891 12.89 C 33.213 27.108 27.431 32.891 20.322 32.891 Z M 24.191 25.386 ' +\n 'h -7.984 l -2.469 -7.595 l 6.461 -4.693 l 6.461 4.693 L 24.191 25.386 Z',\n //exclusive event based\n 'ExclusiveEventBased': 'M 30 15 C 30 23.28 23.28 30 15 30 S 0 23.28 0 15 S 6.72 0 15 0 S 30 6.72 30 15 z M 15 5 ' +\n 'L 5 12.5 L 8 22.5 H 22 L 25 12.5 z',\n //parallel event based\n 'ParallelEventBased': 'M 35 17.5 C 35 27.16 27.16 35 17.5 35 S 0 27.16 0 17.5 S 7.84 0 17.5 0 S 35 7.84 35 17.5 z M 14.58 5.83 ' +\n 'V 14.58 H 5.83 V 20.42 H 14.58 V 29.17 H 20.42 V 20.42 H 29.17 V 14.58 H 20.42 V 5.83 z',\n};\nvar bpmnTaskShapes = {\n 'None': '',\n 'Service': 'M 32.699 20.187 v -4.005 h -3.32 c -0.125 -0.43 -0.292 -0.83 -0.488 -1.21 l 2.373 -2.375 ' +\n 'l -2.833 -2.83 l -2.333 2.333 c -0.44 -0.253 -0.9 -0.448 -1.387 -0.595 v -3.32 h -4.003 v 3.32 c -0.46 0.137 -0.89' +\n '0.322 -1.3 0.537 l -2.285 -2.275 l -2.833 2.83 l 2.285 2.278 c -0.235 0.42 -0.41 0.847 -0.547 1.307 h -3.33 v 4.005 h 3.33 ' +\n 'c 0.148 0.488 0.343 0.955 0.588 1.395 l -2.325 2.325 l 2.822 2.832 l 2.373 -2.382 c 0.392 0.205 0.792 0.37 1.212 0.497 v 3.33 ' +\n 'h 4.003 v -3.33 c 0.46 -0.138 0.89 -0.323 1.3 -0.547 l 2.43 2.432 l 2.822 -2.832 l -2.42 -2.422 c 0.222 -0.41 0.4 -0.85 0.535' +\n '-1.297 H 32.699 Z M 22.699 21.987 c -2.1 0 -3.803 -1.703 -3.803 -3.803 c 0 -2.1 1.703 -3.803 3.803 -3.803 c 2.1 0 3.803 ' +\n '1.703 3.803 3.803 C 26.502 20.285 24.8 21.987 22.699 21.987 Z',\n 'Receive': 'M 12.217 12.134 v 13.334 h 20 V 12.134 H 12.217 Z M 30.44 13.007 l -8.223 5.35 l -8.223 -5.35 H 30.44 Z M 13.09' +\n ' 24.594 V 13.459 l 9.127 5.94 l 9.127 -5.94 v 11.135 H 13.09 Z',\n 'Send': 'M 45.7256 3.16055 L 25 23.4017 L 4.27442 3.16055 H 45.7256 Z M 47.8963 46.8413 H 2.10375 V 4.80813' +\n ' L 25 27.1709 L 47.8963 4.80813 V 46.8413 Z',\n 'InstantiatingReceive': 'M 16.306 17.39 v 8.79 h 13.198 v -8.79 H 16.306 Z M 28.375 17.946 l -5.47 3.558 l -5.47 -3.558 ' +\n 'H 28.375 Z M 28.948 25.625 H 16.861 v -7.389 l 6.043 3.931 l 6.043 -3.931 V 25.625 Z M 22.905 11.785' +\n 'c -5.514 0 -9.999 4.486 -9.999 10 c 0 5.514 4.485 10 9.999 10 s 9.999 -4.486 9.999 -10 ' +\n 'C 32.904 16.272 28.419 11.785 22.905 11.785 Z M 22.905 31.239 c -5.212 0 -9.453 -4.241 -9.453 -9.454' +\n 'c 0 -5.212 4.241 -9.453 9.453 -9.453 s 9.452 4.241 9.452 9.453 C 32.357 26.998 28.117 31.239 22.905 31.239 Z',\n 'Manual': 'M 13.183 15.325 h 2.911 c 0.105 0 0.207 -0.043 0.281 -0.117 c 0.078 -0.074 0.117 -0.176 0.117 -0.281' +\n 'c 0 -0.753 0.718 -1.362 1.596 -1.362 h 2.579 c -0.117 0.227 -0.191 0.48 -0.195 0.757 c 0 0.433 0.168 0.851 0.46 1.144 ' +\n 'c 0.008 0.004 0.015 0.011 0.019 0.015 c -0.289 0.285 -0.475 0.691 -0.479 1.148 c 0 0.433 0.168 0.846 0.46 1.139 ' +\n 'c 0.011 0.012 0.023 0.02 0.035 0.032 c -0.301 0.281 -0.491 0.694 -0.495 1.155 c 0 0.432 0.168 0.847 0.46 1.143' +\n 'c 0.265 0.266 0.612 0.414 0.975 0.414 h 0.839 c 0.027 0.004 0.051 0.012 0.074 0.012 h 8.443 ' +\n 'c 0.352 0 0.636 0.344 0.636 0.761 c 0 0.414 -0.285 0.753 -0.636 0.753 h -6.687 c -0.019 0 -0.035 -0.008 -0.051 -0.008' +\n 'h -2.27 c -0.121 -0.835 -0.667 -1.187 -1.795 -1.187 h -2.158 c -0.223 0 -0.402 0.18 -0.402 0.403' +\n 'c 0 0.219 0.179 0.398 0.402 0.398 h 2.158 c 0.972 0 1.019 0.203 1.019 0.784 c 0 0.219 0.179 0.399 0.402 0.399 ' +\n 'c 0.008 0 0.016 -0.004 0.027 -0.004 c 0.028 0.004 0.055 0.016 0.082 0.016 h 2.56 c 0.34 0.015 0.616 0.343 0.616 0.752' +\n 'c 0 0.418 -0.285 0.757 -0.636 0.761 h -0.004 h -6.442 c -0.878 0 -1.595 -0.639 -1.595 -1.427 v -0.683 ' +\n 'c 0 -0.109 -0.043 -0.211 -0.114 -0.285 c -0.078 -0.074 -0.179 -0.117 -0.285 -0.117 h -0.004 l -2.989 0.027 ' +\n 'c -0.223 0 -0.398 0.184 -0.398 0.402 c 0 0.219 0.179 0.395 0.398 0.395 h 0.004 l 2.591 -0.02 v 0.282 ' +\n 'c 0 1.229 1.073 2.223 2.391 2.223 h 3.895 c 0.004 0 0.007 0.004 0.011 0.004 h 2.536 c 0.792 0 1.436 -0.698 1.436 -1.561 ' +\n 'c 0 -0.273 -0.07 -0.53 -0.188 -0.752 h 5.49 c 0.792 0 1.436 -0.695 1.436 -1.553 c 0 -0.858 -0.644 -1.557 -1.436 -1.557' +\n 'h -3.566 c 0.121 -0.226 0.199 -0.487 0.199 -0.768 c 0 -0.468 -0.195 -0.882 -0.495 -1.167' +\n 'c 0.301 -0.285 0.495 -0.698 0.495 -1.163 c 0 -0.456 -0.191 -0.866 -0.483 -1.152 c 0.293 -0.285 0.483 -0.694 0.483 -1.151' +\n 'c 0 -0.858 -0.647 -1.557 -1.439 -1.557 h -8.373 c -1.167 0 -2.142 0.757 -2.352 1.76 l -2.548 -0.004 ' +\n 'c -0.219 0 -0.399 0.18 -0.399 0.403 C 12.784 15.145 12.964 15.325 13.183 15.325 L 13.183 15.325 Z M 21.907 19.707 ' +\n 'c -0.191 0 -0.328 -0.094 -0.41 -0.176 c -0.144 -0.145 -0.226 -0.355 -0.226 -0.577 c 0.003 -0.418 0.289 -0.753 0.643 -0.753 ' +\n 'h 4.468 c 0.008 0 0.015 -0.004 0.027 -0.008 h 0.051 c 0.351 0 0.636 0.344 0.636 0.761 c 0 0.414 -0.286 0.753 -0.636 0.753 ' +\n 'H 21.907 Z M 27.097 16.629 c 0 0.414 -0.286 0.753 -0.64 0.753 h -4.464 c -0.004 0 -0.004 0 -0.004 0 h -0.082' +\n 'c -0.191 0 -0.328 -0.098 -0.414 -0.18 c -0.14 -0.145 -0.222 -0.352 -0.222 -0.573 c 0 -0.413 0.285 -0.749 0.631 -0.753' +\n 'h 3.434 c 0 0 0 0 0.004 0 h 1.116 c 0.008 0 0.012 -0.004 0.02 -0.004 C 26.819 15.887 27.097 16.215 27.097 16.629' +\n 'L 27.097 16.629 Z M 27.097 14.322 c 0 0.41 -0.278 0.737 -0.62 0.749 c -0.008 0 -0.012 0 -0.016 0 h -3.637 ' +\n 'c -0.008 0 -0.015 0.004 -0.023 0.004 h -0.886 c -0.004 0 -0.008 0 -0.012 0 c -0.187 0 -0.324 -0.094 -0.406 -0.176' +\n 'c -0.144 -0.144 -0.226 -0.355 -0.226 -0.577 c 0.003 -0.414 0.293 -0.753 0.643 -0.753 h 4.468 ' +\n 'c 0.008 0 0.015 -0.004 0.027 -0.004 h 0.051 C 26.811 13.565 27.097 13.905 27.097 14.322 L 27.097 14.322 Z M 27.097 14.322',\n 'BusinessRule': 'M 32.844 13.245 h -0.089 v 0 H 13.764 v -0.015 h -1.009 v 16.989 h 0.095 v 0.011 h 19.716 v -0.011 h 0.278 ' +\n 'V 13.245 Z M 31.844 14.229 v 4.185 h -18.08 v -4.185 H 31.844 Z M 18.168 25.306 v 3.938 h -4.404 v -3.938 H 18.168 Z ' +\n 'M 13.764 24.322 v -4.923 h 4.404 v 4.923 H 13.764 Z M 19.177 25.306 h 12.667 v 3.938 H 19.177 V 25.306 Z M 19.177 24.322' +\n 'v -4.923 h 12.667 v 4.923 H 19.177 Z',\n 'User': 'M 21.762 21.935 c 2.584 0 4.687 -2.561 4.687 -5.703 c 0 -3.147 -2.103 -5.703 -4.687 -5.703 c -1.279 0 -2.475 0.61' +\n '-3.363 1.721 c -0.855 1.071 -1.327 2.484 -1.324 3.983 C 17.075 19.374 19.178 21.935 21.762 21.935 L 21.762 21.935 Z' +\n 'M 21.762 11.779 c 1.894 0 3.436 1.995 3.436 4.452 c 0 2.453 -1.541 4.452 -3.436 4.452 c -1.895 0 -3.44 -1.999 -3.44 -4.452' +\n 'C 18.323 13.774 19.864 11.779 21.762 11.779 L 21.762 11.779 Z M 25.699 21.309 c -0.348 0 -0.626 0.277 -0.626 0.626 ' +\n 'c 0 0.344 0.277 0.622 0.626 0.622 c 2.136 0 3.875 1.74 3.875 3.879 c 0 0.272 -0.227 0.498 -0.501 0.498 H 14.447 c -0.274 0 ' +\n '-0.497 -0.223 -0.497 -0.498 c 0 -2.139 1.736 -3.879 3.872 -3.879 c 0.344 0 0.625 -0.277 0.625 -0.622 c 0 -0.348 -0.28 -0.626' +\n '-0.625 -0.626 c -2.826 0 -5.124 2.297 -5.124 5.126 c 0 0.965 0.784 1.749 1.748 1.749 h 14.626 c 0.964 0 1.748 -0.784' +\n '1.748 -1.749 C 30.822 23.606 28.524 21.309 25.699 21.309 L 25.699 21.309 Z M 22.217 9.832 c 0.448 -0.263 0.924 -0.396 ' +\n '1.419 -0.396 c 1.895 0 3.436 1.995 3.436 4.452 c 0 0.439 -0.048 0.873 -0.143 1.284 c -0.08 0.336 0.128 0.672 0.464 0.751 ' +\n 'c 0.048 0.012 0.098 0.019 0.143 0.019 c 0.284 0 0.541 -0.195 0.608 -0.483 c 0.119 -0.506 0.18 -1.034 0.18 -1.571' +\n 'c 0 -3.147 -2.102 -5.703 -4.687 -5.703 c -0.711 0 -1.419 0.198 -2.054 0.573 c -0.296 0.174 -0.397 0.559 -0.219 0.855' +\n 'C 21.536 9.911 21.921 10.009 22.217 9.832 L 22.217 9.832 Z M 27.697 18.81 c -0.345 0 -0.626 0.277 -0.626 0.622 ' +\n 'c 0 0.348 0.281 0.626 0.626 0.626 c 2.137 0 3.75 1.782 3.75 3.918 c 0 0.07 -0.013 0.141 -0.043 0.205 c -0.14 0.314 0.003' +\n '0.684 0.318 0.823 c 0.082 0.037 0.167 0.055 0.253 0.055 c 0.241 0 0.466 -0.141 0.57 -0.373 c 0.101 -0.226 0.153 -0.464 0.153' +\n '-0.714 C 32.699 21.15 30.523 18.81 27.697 18.81 L 27.697 18.81 Z M 27.697 18.81',\n 'Script': 'M 22.453 15.04 c 0 0 -1.194 -3.741 2.548 -3.774 c 0 0 2.497 0.126 1.766 4.321 c -0.008 0.043 -0.015 0.086 -0.024 0.13' +\n 'c -0.806 4.323 -2.516 8.42 -3.193 10.581 h 3.904 c 0 0 0.983 4.581 -2.549 4.968 H 13.292 c 0 0 -3.097 -1.42 -1.517 -5.323 l ' +\n '3 -10.839 H 11.84 c 0 0 -1.129 -2.902 1.709 -3.806 l 11.425 -0.032 l -0.73 0.355 l -1.193 1.726 L 22.453 15.04 Z M 22.409 ' +\n '12.597 c 0 0 -0.242 0.483 -0.278 0.98 h -9.098 c 0 0 -0.06 -0.871 0.714 -1.041 L 22.409 12.597 Z M 26.341 27.734' +\n 'c 0 0 -0.13 2.678 -2.226 1.871 c 0 0 -0.823 -0.565 -0.758 -1.855 L 26.341 27.734 Z M 22.905 15.008 c 0 0 0.653 -0.258 0.709' +\n '-1.501 c 0 0 0.145 -1.144 1.483 -0.693 c 0 0 0.808 0.355 0.259 2.404 c 0 0 -2.226 8.5 -3.032 10.339 c 0 0 -1.064 2.646 ' +\n '0.096 4.226 h -8.581 c 0 0 -1.806 -0.452 -0.741 -3.613 c 0 0 2.935 -9.549 3.193 -11.162 L 22.905 15.008 Z',\n};\nvar bpmnLoopShapes = {\n 'None': '',\n 'Standard': 'M 52.002 73.379 c -2.494 -2.536 -6.55 -2.534 -9.043 0 c -1.208 1.228 -1.874 2.861 -1.874 4.598 ' +\n 'c 0 1.225 0.337 2.395 0.957 3.411 l -1.167 1.186 l 2.071 0.458 l 2.071 0.458 l -0.45 -2.106 l -0.45 -2.106 l -1.292 1.314' +\n 'c -1.119 -2.065 -0.842 -4.709 0.877 -6.458 c 2.084 -2.119 5.475 -2.117 7.557 0 c 2.083 2.119 2.083 5.565 0 7.685' +\n 'c -0.976 0.992 -2.272 1.557 -3.65 1.59 l 0.025 1.068 c 1.65 -0.041 3.2 -0.716 4.368 -1.903 ' +\n 'c 1.208 -1.228 1.874 -2.861 1.874 -4.597 C 53.875 76.24 53.209 74.607 52.002 73.379 Z',\n 'ParallelMultiInstance': 'M 51.5,69.5 L52.5,69.5 L52.5,84.5 L51.5 84.5 Z M 46.5,69.5 L47.5,69.5 L47.5,84.5 L46.5 84.5 Z' +\n ' M 41.5,69.5 L42.5,69.5 L42.5,84.5 L41.5 84.5 Z ',\n 'SequenceMultiInstance': 'M 40.375,71.5 L 55.375,71.5 L 55.375,72.5 L 40.375,72.5 Z M 40.375,76.5 L 55.375,76.5 ' +\n 'L 55.375,77.5 L 40.375,77.5 Z M 40.375,76.5 L 55.375,76.5 L 55.375,77.5 L 40.375,77.5 Z M 40.375,81.5 L 55.375,81.5' +\n 'L 55.375,82.5 L 40.375,82.5 Z'\n};\n","import { Rect } from '../primitives/rect';\nimport { cloneObject } from '../utility/base-util';\nvar GraphForceNode = /** @class */ (function () {\n function GraphForceNode(gnNode) {\n /**\n * @private\n */\n this.velocityX = 0;\n /**\n * @private\n */\n this.velocityY = 0;\n /**\n * @private\n */\n this.nodes = [];\n this.graphNode = gnNode;\n var nNode = this.graphNode;\n var bounds = getGraphBounds(nNode);\n this.location = bounds.center;\n this.nodes = [];\n if (!gnNode.treeInfo.parents) {\n gnNode.treeInfo.parents = [];\n }\n if (!gnNode.treeInfo.children) {\n gnNode.treeInfo.children = [];\n }\n this.nodes = (gnNode.treeInfo.parents).concat(gnNode.treeInfo.children);\n }\n /**\n * @private\n */\n GraphForceNode.prototype.applyChanges = function () {\n this.graphNode.treeInfo.center = this.location;\n };\n return GraphForceNode;\n}());\nexport { GraphForceNode };\n/**\n * SymmetricalLayout\n */\nvar SymmetricLayout = /** @class */ (function () {\n function SymmetricLayout() {\n this.cdCOEF = 0.442;\n this.cfMAXVELOCITY = 50;\n this.cnMAXITERACTION = 1000;\n this.cnSPRINGLENGTH = 100;\n this.mszMaxForceVelocity = { width: this.cfMAXVELOCITY, height: this.cfMAXVELOCITY };\n /**\n * @private\n */\n this.springLength = 0;\n /**\n * @private\n */\n this.springFactor = this.cdCOEF;\n /**\n * @private\n */\n this.maxIteration = this.cnMAXITERACTION;\n this.springLength = this.cnSPRINGLENGTH;\n }\n /**\n * @private\n */\n SymmetricLayout.prototype.destroy = function () {\n /**\n * Destroys symmetricLayout\n */\n };\n SymmetricLayout.prototype.getModuleName = function () {\n return 'SymmetricalLayout';\n };\n SymmetricLayout.prototype.doGraphLayout = function (graphLayoutManager) {\n var graph = this.selectedNode;\n graph.treeInfo.Bounds = graphLayoutManager.getModelBounds(graphLayoutManager.nodes);\n var lstGraphNodes = graph.treeInfo.GraphNodes;\n var lstNodes = this.convertGraphNodes(lstGraphNodes);\n var count = lstNodes.length;\n count = Math.min(this.maxIteration, count * count * count);\n this.preLayoutNodes(lstNodes, graph.treeInfo.Bounds);\n for (var i = 0, nLenght = count; i < nLenght; i++) {\n this.makeSymmetricLayout(lstNodes);\n this.appendForces(lstNodes);\n }\n this.resetGraphPosition(lstNodes, graph);\n };\n SymmetricLayout.prototype.preLayoutNodes = function (lstNodes, rcBounds) {\n var fMaxSize = Math.max(rcBounds ? rcBounds.width : 25, rcBounds ? rcBounds.height : 25);\n var ptCenter = { x: fMaxSize / 2, y: fMaxSize / 2 };\n var dRotateAngle = 2 * Math.PI / lstNodes.length;\n var dAngle = dRotateAngle;\n for (var i = 0; i < lstNodes.length; i++) {\n var gnNode = lstNodes[i];\n var forceNode = this.getForceNode(gnNode);\n forceNode.location = {\n x: ptCenter.x + fMaxSize * Number((Math.cos(dAngle)).toFixed(2)),\n y: ptCenter.y + fMaxSize * Number(Math.sin(dAngle).toFixed(2))\n };\n dAngle -= dRotateAngle;\n }\n };\n /**\n * @private\n */\n SymmetricLayout.prototype.doLayout = function (graphLayoutManager) {\n this.selectedNode = graphLayoutManager.selectedNode;\n this.doGraphLayout(graphLayoutManager);\n };\n SymmetricLayout.prototype.makeSymmetricLayout = function (lstNodes) {\n var forceNode;\n var force;\n for (var k = 0; k < lstNodes.length; k++) {\n var gnNode = lstNodes[k];\n forceNode = this.getForceNode(gnNode);\n var nodes = forceNode.nodes;\n for (var l = 0; l < nodes.length; l++) {\n var gnChild = nodes[l];\n if (collectionContains(gnChild.id, lstNodes)) {\n this.calcNodesForce(forceNode, this.getForceNode(gnChild));\n }\n }\n for (var i = 0, length_1 = nodes.length; i < length_1; i++) {\n if (length_1 < 2) {\n break;\n }\n var vtx1 = this.getForceNode(nodes[i]);\n var vtx2 = (i + 1 >= length_1) ? this.getForceNode(nodes[0]) : this.getForceNode((nodes[i + 1]));\n var angle = (360 / nodes.length / 2) * Math.PI / 180;\n var normalDistance = 2 * this.springLength * Math.sin(angle);\n this.calcRelatesForce(vtx1, vtx2, normalDistance);\n }\n for (var s = 0; s < lstNodes.length; s++) {\n var gnChild = lstNodes[s];\n if (!collectionContains(gnChild.id, nodes) && gnChild.id !== gnNode.id) {\n force = this.getForceNode(gnChild);\n this.updateNeigbour(forceNode, force);\n }\n }\n }\n };\n SymmetricLayout.prototype.appendForces = function (lstNodes) {\n var gfnNode = null;\n for (var k = 0; k < lstNodes.length; k++) {\n var gnNode = lstNodes[k];\n gfnNode = this.getForceNode(gnNode);\n var ptPoint = gfnNode.location;\n ptPoint.x += Math.min(gfnNode.velocityX, this.mszMaxForceVelocity.width);\n ptPoint.y += Math.min(gfnNode.velocityY, this.mszMaxForceVelocity.height);\n gfnNode.velocityX = 0;\n gfnNode.velocityY = 0;\n gfnNode.location = ptPoint;\n }\n };\n SymmetricLayout.prototype.resetGraphPosition = function (lstNodes, graph) {\n var szMin = { width: Number.MAX_VALUE, height: Number.MAX_VALUE };\n var gfnNode = null;\n var gnNode;\n for (var k = 0; k < lstNodes.length; k++) {\n gnNode = lstNodes[k];\n gfnNode = this.getForceNode(gnNode);\n var ptLocation = {\n x: gfnNode.location.x - gnNode.actualSize.width / 2,\n y: gfnNode.location.y - gnNode.actualSize.height / 2\n };\n szMin.width = Math.min(szMin.width, ptLocation.x);\n szMin.height = Math.min(szMin.height, ptLocation.y);\n }\n for (var k = 0; k < lstNodes.length; k++) {\n gnNode = lstNodes[k];\n gfnNode = this.getForceNode(gnNode);\n var ptLocation = gfnNode.location;\n ptLocation.x -= szMin.width - (graph.treeInfo.location ? graph.treeInfo.location.x : 0);\n ptLocation.y -= szMin.height - (graph.treeInfo.location ? graph.treeInfo.location.y : 0);\n gfnNode.location = ptLocation;\n gfnNode.applyChanges();\n }\n };\n SymmetricLayout.prototype.convertGraphNodes = function (lstNodes) {\n var lstToReturn = [];\n var keys = Object.keys(lstNodes);\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var k = keys_1[_i];\n if (lstNodes[k]) {\n var gnNode = lstNodes[k];\n var forceNode = new GraphForceNode(gnNode);\n gnNode.treeInfo.tag = forceNode;\n lstToReturn.push(gnNode);\n }\n }\n return lstToReturn;\n };\n /**\n * @private\n */\n SymmetricLayout.prototype.getForceNode = function (gnNode) {\n return gnNode.treeInfo.tag;\n };\n SymmetricLayout.prototype.updateNeigbour = function (vtSource, vtTarget) {\n if (vtTarget == null || vtSource == null) {\n return;\n }\n var distance = this.pointDistance(vtSource.location, vtTarget.location);\n var angle = this.lineAngle(vtSource.location, vtTarget.location);\n var normalDistance = (this.springLength * 0.9);\n if (distance < normalDistance) {\n this.calcForce(distance, normalDistance, angle, vtTarget);\n }\n };\n SymmetricLayout.prototype.lineAngle = function (pt1, pt2) {\n var radians = 0;\n var vx = pt2.x - pt1.x;\n var vy = pt2.y - pt1.y;\n if (vx === 0) {\n if (vy <= 0) {\n radians = (3.0 * Math.PI) / 2.0;\n }\n else {\n radians = Math.PI / 2.0;\n }\n }\n else if (vy === 0) {\n if (vx < 0) {\n radians = Math.PI;\n }\n else {\n radians = 0;\n }\n }\n else {\n radians = Math.atan(vy / vx);\n if (vx < 0 && vy > 0) {\n radians = Math.PI + radians;\n }\n else if (vx < 0 && vy < 0) {\n radians = Math.PI + radians;\n }\n else if (vx > 0 && vy < 0) {\n radians = 2.0 * Math.PI + radians;\n }\n }\n return radians;\n };\n SymmetricLayout.prototype.pointDistance = function (pt1, pt2) {\n var d = 0;\n var dx = pt2.x - pt1.x;\n var dy = pt2.y - pt1.y;\n var t = (dx * dx) + (dy * dy);\n if (t > 0) {\n d = Math.sqrt(t);\n }\n return d;\n };\n SymmetricLayout.prototype.calcRelatesForce = function (vtSource, vtTarget, normalDistance) {\n var distance = this.pointDistance(vtSource.location, vtTarget.location);\n var angle = this.lineAngle(vtSource.location, vtTarget.location);\n if (distance < normalDistance) {\n this.calcForce(distance, normalDistance, angle, vtTarget);\n }\n };\n /**\n * @private\n */\n SymmetricLayout.prototype.updateLayout = function (nodeCollection, connectors, symmetricLayout, nameTable, layout, viewPort) {\n var layoutManager = new GraphLayoutManager();\n layoutManager.updateLayout(nodeCollection, connectors, symmetricLayout, nameTable, layout, viewPort);\n };\n SymmetricLayout.prototype.calcNodesForce = function (vtSource, vtTarget) {\n var distance = this.pointDistance(vtSource.location, vtTarget.location);\n var angle = this.lineAngle(vtSource.location, vtTarget.location);\n if (distance > this.springLength || distance < this.springLength) {\n this.calcForce(distance, this.springLength, angle, vtTarget);\n }\n };\n SymmetricLayout.prototype.calcForce = function (distance, minDist, angle, vtTarget) {\n var count = vtTarget.nodes.length;\n var length = distance - minDist;\n var factor = this.springFactor / (count * count) * Math.sqrt(count);\n if (length !== 0) {\n var fVelocity = length * factor;\n var fOffset = fVelocity;\n var offsetX = Math.cos(angle) * fOffset;\n var offsetY = Math.sin(angle) * fOffset;\n vtTarget.velocityX -= offsetX;\n vtTarget.velocityY -= offsetY;\n }\n };\n return SymmetricLayout;\n}());\nexport { SymmetricLayout };\nvar GraphLayoutManager = /** @class */ (function () {\n function GraphLayoutManager() {\n this.visitedStack = [];\n this.cycleEdgesCollection = [];\n this.graphObjects = [];\n this.passedNodes = [];\n }\n /**\n * @private\n */\n GraphLayoutManager.prototype.updateLayout = function (nodeCollection, connectors, symmetricLayout, nameTable, layout, viewPort) {\n this.nameTable = nameTable;\n this.nodes = nodeCollection;\n this.connectors = connectors;\n var selectionList = nodeCollection;\n if (selectionList.length > 0) {\n this.mhelperSelectedNode = cloneObject(selectionList[0]);\n }\n for (var _i = 0, nodeCollection_1 = nodeCollection; _i < nodeCollection_1.length; _i++) {\n var node = nodeCollection_1[_i];\n var nodeGraphObject = void 0;\n nodeGraphObject = node;\n nodeGraphObject.treeInfo = {};\n nodeGraphObject.treeInfo.graphType = 'Node';\n this.graphObjects.push(nodeGraphObject);\n }\n for (var _a = 0, connectors_1 = connectors; _a < connectors_1.length; _a++) {\n var connector = connectors_1[_a];\n var connectorGraphObject = void 0;\n connectorGraphObject = connector;\n connectorGraphObject.treeInfo = {};\n connectorGraphObject.treeInfo.graphType = 'Connector';\n this.graphObjects.push(connectorGraphObject);\n }\n this.updateLayout1(this.graphObjects, symmetricLayout);\n var modelBounds = this.getModelBounds(selectionList);\n for (var i = 0; i < selectionList.length; i++) {\n var node = selectionList[i];\n var trnsX = (viewPort.x - modelBounds.width) / 2;\n var margin = layout.margin || {};\n var marginX = void 0;\n var marginY = void 0;\n margin.left = margin.left || 0;\n margin.right = margin.right || 0;\n margin.top = margin.top || 0;\n margin.bottom = margin.bottom || 0;\n if (layout.margin.left) {\n margin.left = layout.margin.left;\n }\n if (layout.margin.top) {\n margin.top = layout.margin.top;\n }\n var dx = (node.treeInfo.tag.location.x - (node.offsetX - (node.actualSize.width / 2)) -\n modelBounds.x + trnsX + margin.left);\n var dy = (node.treeInfo.tag.location.y - (node.offsetY - (node.actualSize.height / 2)) - modelBounds.y + margin.top);\n node.offsetX += dx;\n node.offsetY += dy;\n delete node.treeInfo;\n }\n return true;\n };\n /**\n * @private\n */\n GraphLayoutManager.prototype.getModelBounds = function (lNodes) {\n lNodes = lNodes.slice();\n var rect = null;\n var rect1 = null;\n var node;\n for (var i = 0; i < lNodes.length; i++) {\n node = lNodes[i];\n var bounds = getGraphBounds(node);\n rect = new Rect(node.treeInfo.tag ? node.treeInfo.tag.location.x : bounds.x, node.treeInfo.tag ? node.treeInfo.tag.location.y : bounds.y, node.actualSize.width, node.actualSize.height);\n if (rect1) {\n rect1 = rect1.uniteRect(rect);\n }\n else {\n rect1 = rect;\n }\n }\n return rect1;\n };\n GraphLayoutManager.prototype.updateLayout1 = function (nodesToLayout, symmetricLayout) {\n this.detectCyclesInGraph(nodesToLayout);\n var nodesCount = nodesToLayout.length;\n if (nodesCount > 0) {\n var cycleConnColln = [];\n var nodes = [];\n var nodeSymbols = [];\n for (var s = 0; s < nodesToLayout.length; s++) {\n var nd = nodesToLayout[s];\n if (nd.treeInfo.isCycleEdge === undefined) {\n nd.treeInfo.isCycleEdge = false;\n }\n if (nd.treeInfo.graphType === 'Connector' && !nd.treeInfo.isCycleEdge) {\n nodes.push(nd);\n }\n else if (nd.treeInfo.graphType === 'Connector') {\n cycleConnColln.push(nd);\n }\n else {\n nodeSymbols.push(nd);\n }\n }\n nodes = nodes.concat(nodeSymbols);\n nodes = cycleConnColln.concat(nodes);\n while (nodesCount > this.dictionaryLength(this.passedNodes)) {\n this.getNodesToPosition(nodes);\n if (this.selectedNode == null) {\n continue;\n }\n symmetricLayout.doLayout(this);\n this.selectedNode = null;\n this.visitedStack = [];\n for (var _i = 0, _a = this.cycleEdgesCollection; _i < _a.length; _i++) {\n var connector = _a[_i];\n connector.treeInfo.isCycleEdge = false;\n }\n }\n this.passedNodes = null;\n this.selectedNode = null;\n }\n return false;\n };\n GraphLayoutManager.prototype.getNodesToPosition = function (nodes) {\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n if (!collectionContains(node.id, this.passedNodes)) {\n if (node) {\n this.selectNodes(node);\n }\n break;\n }\n }\n };\n GraphLayoutManager.prototype.selectNodes = function (node) {\n var nodeGraph = node;\n if (node.treeInfo.graphType === 'Connector') {\n this.exploreGraphEdge(node);\n }\n else if (nodeGraph != null) {\n if (this.addNode(node, 'passed')) {\n this.addNode(node, 'selected');\n if (this.isConnectedToAnotherNode(nodeGraph)) {\n this.selectedNode = { treeInfo: {} };\n this.selectedNode.treeInfo.LeftMargin = 10;\n this.selectedNode.treeInfo.TopMargin = 10;\n this.selectConnectedNodes(nodeGraph);\n }\n else {\n this.selectedNode = node;\n }\n }\n }\n };\n GraphLayoutManager.prototype.selectConnectedNodes = function (nodeGraph) {\n var graph = this.selectedNode;\n if (!graph.treeInfo.GraphNodes) {\n graph.treeInfo.GraphNodes = {};\n }\n var node = nodeGraph;\n if (node != null && this.addNode(node, 'passed')) {\n var nodeName = node.id;\n if (!this.dictionaryContains(graph.treeInfo.GraphNodes, node)) {\n var gnNode = this.addGraphNode(node);\n this.getConnectedRelatives(gnNode);\n this.exploreRelatives(nodeGraph);\n }\n else {\n var graphNode = graph.treeInfo.GraphNodes[nodeName];\n if (graphNode.treeInfo.Added) {\n graphNode.treeInfo.Added = false;\n this.getConnectedRelatives(graphNode);\n this.exploreRelatives(nodeGraph);\n }\n }\n }\n };\n GraphLayoutManager.prototype.exploreRelatives = function (nodeGraph) {\n this.exploreRelatives1(nodeGraph, 'Parents');\n this.exploreRelatives1(nodeGraph, 'Children');\n };\n GraphLayoutManager.prototype.exploreRelatives1 = function (nodeGraph, relativesToExplore) {\n var edges = [];\n if (relativesToExplore === 'Parents') {\n edges = nodeGraph.inEdges;\n }\n else if (relativesToExplore === 'Children') {\n edges = nodeGraph.outEdges;\n }\n for (var i = 0; i < edges.length; i++) {\n var edge = this.nameTable[edges[i]];\n if (this.addNode(edge, 'passed')) {\n var fromNode = this.nameTable[edge.sourceID];\n var toNode = this.nameTable[edge.targetID];\n if (relativesToExplore === 'Parents' && fromNode != null &&\n collectionContains(fromNode.id, this.nodes)) {\n this.selectConnectedNodes(this.nameTable[edge.sourceID]);\n }\n else if (relativesToExplore === 'Children' && toNode != null &&\n collectionContains(toNode.id, this.nodes)) {\n this.selectConnectedNodes(this.nameTable[edge.targetID]);\n }\n }\n }\n };\n GraphLayoutManager.prototype.getConnectedRelatives = function (graphNode) {\n this.getConnectedParents(graphNode);\n this.getConnectedChildren(graphNode);\n };\n GraphLayoutManager.prototype.dictionaryContains = function (obj, keyObj) {\n var keys = Object.keys(obj);\n for (var i = 0; i < keys.length; i++) {\n if (keys[i] === keyObj.id) {\n return true;\n }\n }\n return false;\n };\n GraphLayoutManager.prototype.dictionaryLength = function (obj) {\n var keys = Object.keys(obj);\n return keys.length;\n };\n GraphLayoutManager.prototype.getConnectedChildren = function (graphNode) {\n var graph = this.selectedNode;\n var nodeGraph = graphNode;\n for (var s = 0; s < nodeGraph.outEdges.length; s++) {\n var edge = this.nameTable[nodeGraph.outEdges[s]];\n if (!edge.treeInfo.isCycleEdge) {\n var node = this.nameTable[edge.targetID];\n if (collectionContains(node.id, this.nodes) && node != null && node.visible) {\n var gnNodeChildren = void 0;\n if (!this.dictionaryContains(graph.treeInfo.GraphNodes, node)) {\n gnNodeChildren = this.addGraphNode(node);\n gnNodeChildren.treeInfo.Added = true;\n }\n else {\n gnNodeChildren = graph.treeInfo.GraphNodes[node.id];\n }\n if (!graphNode.treeInfo.children) {\n graphNode.treeInfo.children = [];\n }\n if (!gnNodeChildren.treeInfo.parents) {\n gnNodeChildren.treeInfo.parents = [];\n }\n this.setNode(gnNodeChildren.treeInfo.parents, graphNode);\n if (this.findNode(graphNode.treeInfo.children, gnNodeChildren.id) < 0) {\n graphNode.treeInfo.children.push(gnNodeChildren);\n }\n }\n }\n }\n };\n GraphLayoutManager.prototype.getConnectedParents = function (graphNode) {\n var graph = this.selectedNode;\n var nodeGraph = graphNode;\n for (var s = 0; s < nodeGraph.inEdges.length; s++) {\n var edge = this.nameTable[nodeGraph.inEdges[s]];\n if (!edge.treeInfo.isCycleEdge) {\n var node = this.nameTable[edge.sourceID];\n if (collectionContains(node.id, this.nodes) && node != null && node.visible) {\n var gnNode = void 0;\n if (!this.dictionaryContains(graph.treeInfo.GraphNodes, node)) {\n gnNode = this.addGraphNode(node);\n gnNode.treeInfo.Added = true;\n }\n else {\n gnNode = graph.treeInfo.GraphNodes[node.id];\n }\n if (!graphNode.treeInfo.parents) {\n graphNode.treeInfo.parents = [];\n }\n if (!gnNode.treeInfo.children) {\n gnNode.treeInfo.children = [];\n }\n this.setNode(gnNode.treeInfo.children, graphNode);\n if (this.findNode(graphNode.treeInfo.parents, gnNode.id) < 0) {\n graphNode.treeInfo.parents.push(gnNode);\n }\n }\n }\n }\n };\n GraphLayoutManager.prototype.setNode = function (list, node) {\n var nIndex = this.findNode(list, node.id);\n if (nIndex >= 0 && nIndex < list.length) {\n list[nIndex] = node;\n }\n else {\n list.push(node);\n }\n };\n GraphLayoutManager.prototype.findNode = function (list, fullName) {\n var nIndex = -1;\n if (list != null && fullName !== '') {\n for (var i = 0, nLength = list.length; i < nLength; i++) {\n var gnNode = list[i];\n if (typeof (gnNode) === 'string' && gnNode === fullName) {\n nIndex = i;\n break;\n }\n else if (gnNode != null && gnNode.id === fullName) {\n nIndex = i;\n break;\n }\n }\n }\n return nIndex;\n };\n GraphLayoutManager.prototype.addGraphNode = function (node) {\n var graph = this.selectedNode;\n if (!graph.treeInfo.GraphNodes) {\n graph.treeInfo.GraphNodes = {};\n }\n var gnNode = node;\n if (graph != null) {\n graph.treeInfo.GraphNodes[gnNode.id] = gnNode;\n var nodeHelper = this.mhelperSelectedNode;\n if (nodeHelper != null && node.id === nodeHelper.id) {\n this.mhelperSelectedNode = gnNode;\n }\n }\n return gnNode;\n };\n GraphLayoutManager.prototype.isConnectedToAnotherNode = function (gnNode) {\n var bFoundConnectedNode = false;\n var edges = (gnNode.inEdges).concat(gnNode.outEdges);\n if (edges.length > 0) {\n if ((gnNode.inEdges != null) && (gnNode.inEdges.length > 0)) {\n bFoundConnectedNode = this.searchEdgeCollection(gnNode.inEdges, 'FromNode');\n }\n if ((!bFoundConnectedNode) && (gnNode.outEdges != null) && (gnNode.outEdges.length > 0)) {\n bFoundConnectedNode = this.searchEdgeCollection(gnNode.outEdges, 'ToNode');\n }\n }\n return bFoundConnectedNode;\n };\n GraphLayoutManager.prototype.searchEdgeCollection = function (edgesToSearchThrough, connectionDirection) {\n var bFoundConnectedNode = false;\n for (var i = 0; i < edgesToSearchThrough.length - 1; i++) {\n var edge = this.nameTable[edgesToSearchThrough[i]];\n if (!this.addNode(edge, 'passed')) {\n continue;\n }\n if (!edge.treeInfo.isCycleEdge && ((connectionDirection === 'FromNode' && this.nameTable[edge.sourceID] != null)\n || (connectionDirection === 'ToNode' && this.nameTable[edge.targetID] != null))) {\n bFoundConnectedNode = true;\n break;\n }\n }\n return bFoundConnectedNode;\n };\n GraphLayoutManager.prototype.exploreGraphEdge = function (node) {\n var nodeLink = node;\n if (nodeLink != null && !nodeLink.treeInfo.isCycleEdge && this.addNode(node, 'passed')) {\n this.addNode(node, 'selected');\n var fromNode = this.nameTable[nodeLink.sourceID];\n var toNode = this.nameTable[nodeLink.targetID];\n if (fromNode != null) {\n this.selectNodes(fromNode);\n }\n else if (toNode != null) {\n this.selectNodes(toNode);\n }\n else {\n this.selectedNode = node;\n }\n }\n };\n GraphLayoutManager.prototype.addNode = function (nodeToAdd, collectionToAdd) {\n var bResult = true;\n var node = nodeToAdd;\n if (collectionToAdd === 'passed' || !node.visible) {\n if (!this.dictionaryContains(this.passedNodes, node)) {\n this.passedNodes[node.id] = node;\n }\n }\n if (!node.visible) {\n return false;\n }\n return bResult;\n };\n GraphLayoutManager.prototype.detectCyclesInGraph = function (nodes) {\n var vertex = [];\n var currentStack = [];\n for (var k = 0; k < nodes.length; k++) {\n if (!(nodes[k].treeInfo.graphType === 'Connector')) {\n vertex.push(nodes[k]);\n }\n }\n if (vertex.length > 0) {\n currentStack.push(vertex[0]);\n this.visitedStack.push(vertex[0]);\n while (currentStack.length > 0) {\n var top_1 = currentStack[currentStack.length - 1];\n var childNodes = this.getUnVisitedChildNodes(top_1);\n if (childNodes.length > 0) {\n var child = childNodes[0];\n var currentEdge = childNodes[childNodes.length - 1];\n if (collectionContains(child.id, this.visitedStack)) {\n currentEdge.treeInfo.isCycleEdge = true;\n this.cycleEdgesCollection.push(currentEdge);\n }\n else {\n currentStack.push(child);\n this.visitedStack.splice(0, 0, child);\n }\n }\n else {\n currentStack.pop();\n }\n }\n }\n };\n GraphLayoutManager.prototype.getUnVisitedChildNodes = function (top) {\n var childNodes = [];\n if (top.outEdges.length > 0) {\n for (var i = 0; i < top.outEdges.length; i++) {\n var con = this.nameTable[top.outEdges[i]];\n if (!collectionContains(con.id, this.visitedStack)) {\n var toNode = this.nameTable[con.targetID];\n if (toNode != null) {\n childNodes.push(toNode);\n }\n childNodes.push(con);\n this.visitedStack.splice(0, 0, con);\n return childNodes;\n }\n }\n return childNodes;\n }\n return childNodes;\n };\n return GraphLayoutManager;\n}());\nexport { GraphLayoutManager };\nfunction getGraphBounds(node) {\n var x = node.offsetX - node.actualSize.width * node.pivot.x;\n var y = node.offsetY - node.actualSize.height * node.pivot.y;\n return new Rect(x, y, node.actualSize.width, node.actualSize.height);\n}\nfunction collectionContains(id, coll) {\n for (var i = 0; i < coll.length; i++) {\n if (coll[i].id === id) {\n return true;\n }\n }\n return false;\n}\n","/**\n * IncrementalSearch module file\n */\nvar queryString = '';\nvar prevString = '';\nvar matches = [];\nvar activeClass = 'e-active';\n/**\n * Search and focus the list item based on key code matches with list text content\n * @param { number } keyCode - Specifies the key code which pressed on keyboard events.\n * @param { HTMLElement[]] } items - Specifies an array of HTMLElement, from which matches find has done.\n * @param { number } selectedIndex - Specifies the selected item in list item, so that search will happen\n * after selected item otherwise it will do from initial.\n * @param { boolean } ignoreCase - Specifies the case consideration when search has done.\n */\nexport function incrementalSearch(keyCode, items, selectedIndex, ignoreCase) {\n queryString += String.fromCharCode(keyCode);\n setTimeout(function () { queryString = ''; }, 1000);\n var index;\n queryString = ignoreCase ? queryString.toLowerCase() : queryString;\n if (prevString === queryString) {\n for (var i = 0; i < matches.length; i++) {\n if (matches[i].classList.contains(activeClass)) {\n index = i;\n break;\n }\n }\n index = index + 1;\n return matches[index];\n }\n else {\n var listItems = items;\n var strLength = queryString.length;\n var text = void 0;\n var item = void 0;\n selectedIndex = selectedIndex ? selectedIndex + 1 : 0;\n var i = selectedIndex;\n matches = [];\n do {\n if (i === listItems.length) {\n i = -1;\n }\n i === -1 ? index = 0 : index = i;\n item = listItems[index];\n text = ignoreCase ? item.innerText.toLowerCase() : item.innerText;\n if (text.substr(0, strLength) === queryString) {\n matches.push(listItems[index]);\n }\n i++;\n } while (i !== selectedIndex);\n prevString = queryString;\n return matches[0];\n }\n}\nexport function Search(inputVal, items, searchType, ignoreCase) {\n var listItems = items;\n ignoreCase = ignoreCase !== undefined && ignoreCase !== null ? ignoreCase : true;\n var itemData = { item: null, index: null };\n if (inputVal.length) {\n var strLength = inputVal.length;\n var queryStr = ignoreCase ? inputVal.toLocaleLowerCase() : inputVal;\n for (var i = 0, itemsData = listItems; i < itemsData.length; i++) {\n var item = itemsData[i];\n var text = (ignoreCase ? item.textContent.toLocaleLowerCase() : item.textContent).replace(/^\\s+|\\s+$/g, '');\n if ((searchType === 'Equal' && text === queryStr) || (searchType === 'StartsWith' && text.substr(0, strLength) === queryStr)) {\n itemData.item = item;\n itemData.index = i;\n return { item: item, index: i };\n }\n }\n return itemData;\n }\n return itemData;\n}\n","/**\n * Function helps to find which highlightSearch is to call based on your data.\n * @param {HTMLElement} element - Specifies an li element.\n * @param {string} query - Specifies the string to be highlighted.\n * @param {boolean} ignoreCase - Specifies the ignoreCase option.\n * @param {HightLightType} type - Specifies the type of highlight.\n */\nexport function highlightSearch(element, query, ignoreCase, type) {\n if (query === '') {\n return;\n }\n else {\n var ignoreRegex = ignoreCase ? 'gim' : 'gm';\n query = /^[a-zA-Z0-9- ]*$/.test(query) ? query : query.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&');\n var replaceQuery = type === 'StartsWith' ? '^(' + query + ')' : type === 'EndsWith' ? '(' + query + ')$' : '(' + query + ')';\n var pattern = new RegExp(replaceQuery, ignoreRegex);\n element.innerHTML = element.innerHTML.replace(pattern, '$1');\n }\n}\n/**\n * Function helps to remove highlighted element based on your data.\n * @param {HTMLElement} content - Specifies an content element.\n */\nexport function revertHighlightSearch(content) {\n var contentElement = content.querySelectorAll('.e-highlight');\n for (var i = contentElement.length - 1; i >= 0; i--) {\n var parent_1 = contentElement[i].parentNode;\n var text = document.createTextNode(contentElement[i].textContent);\n parent_1.replaceChild(text, contentElement[i]);\n }\n}\n","/**\n * FloatLable Moduel\n * Specifies whether to display the floating label above the input element.\n */\nimport { removeClass, addClass, detach } from '@syncfusion/ej2-base';\nimport { attributes, isNullOrUndefined, createElement } from '@syncfusion/ej2-base';\nvar FLOATLINE = 'e-float-line';\nvar FLOATTEXT = 'e-float-text';\nvar LABELTOP = 'e-label-top';\nvar LABELBOTTOM = 'e-label-bottom';\n/**\n * Function to create Float Label element.\n * @param overAllWrapper - overall wrapper of multiselect.\n * @param element - the given html element.\n * @param inputElement - specify the input wrapper.\n * @param value - Value of the MultiSelect.\n * @param floatLabelType - Specify the FloatLabel Type.\n * @param placeholder - Specify the PlaceHolder text.\n */\nexport function createFloatLabel(overAllWrapper, searchWrapper, element, inputElement, value, floatLabelType, placeholder) {\n var floatLinelement;\n var floatLabelElement;\n floatLinelement = createElement('span', { className: FLOATLINE });\n floatLabelElement = createElement('label', { className: FLOATTEXT });\n if (!isNullOrUndefined(element.id) && element.id !== '') {\n floatLabelElement.id = 'label_' + element.id.replace(/ /g, '_');\n attributes(element, { 'aria-labelledby': floatLabelElement.id });\n }\n if (!isNullOrUndefined(inputElement.placeholder) && inputElement.placeholder !== '') {\n floatLabelElement.innerHTML = inputElement.placeholder;\n inputElement.removeAttribute('placeholder');\n }\n if (!isNullOrUndefined(placeholder) && placeholder !== '') {\n floatLabelElement.innerHTML = placeholder;\n }\n searchWrapper.appendChild(floatLinelement);\n searchWrapper.appendChild(floatLabelElement);\n overAllWrapper.classList.add('e-float-input');\n updateFloatLabelState(value, floatLabelElement);\n if (floatLabelType === 'Always') {\n if (floatLabelElement.classList.contains(LABELBOTTOM)) {\n removeClass([floatLabelElement], LABELBOTTOM);\n }\n addClass([floatLabelElement], LABELTOP);\n }\n}\n/**\n * Function to update status of the Float Label element.\n * @param value - Value of the MultiSelect.\n * @param label - float label element.\n */\nexport function updateFloatLabelState(value, label) {\n if (value && value.length > 0) {\n addClass([label], LABELTOP);\n removeClass([label], LABELBOTTOM);\n }\n else {\n removeClass([label], LABELTOP);\n addClass([label], LABELBOTTOM);\n }\n}\n/**\n * Function to remove Float Label element.\n * @param overAllWrapper - overall wrapper of multiselect.\n * @param componentWrapper - wrapper element of multiselect.\n * @param searchWrapper - search wrapper of multiselect.\n * @param inputElement - specify the input wrapper.\n * @param value - Value of the MultiSelect.\n * @param floatLabelType - Specify the FloatLabel Type.\n * @param placeholder - Specify the PlaceHolder text.\n */\nexport function removeFloating(overAllWrapper, componentWrapper, searchWrapper, inputElement, value, floatLabelType, placeholder) {\n var placeholderElement = componentWrapper.querySelector('.' + FLOATTEXT);\n var floatLine = componentWrapper.querySelector('.' + FLOATLINE);\n var placeholderText;\n if (!isNullOrUndefined(placeholderElement)) {\n placeholderText = placeholderElement.innerText;\n detach(searchWrapper.querySelector('.' + FLOATTEXT));\n setPlaceHolder(value, inputElement, placeholderText);\n if (!isNullOrUndefined(floatLine)) {\n detach(searchWrapper.querySelector('.' + FLOATLINE));\n }\n }\n else {\n placeholderText = (placeholder !== null) ? placeholder : '';\n setPlaceHolder(value, inputElement, placeholderText);\n }\n overAllWrapper.classList.remove('e-float-input');\n}\n/**\n * Function to set the placeholder to the element.\n * @param value - Value of the MultiSelect.\n * @param inputElement - specify the input wrapper.\n * @param placeholder - Specify the PlaceHolder text.\n */\nexport function setPlaceHolder(value, inputElement, placeholder) {\n if (value && value.length) {\n inputElement.placeholder = '';\n }\n else {\n inputElement.placeholder = placeholder;\n }\n}\n/**\n * Function for focusing the Float Element.\n * @param overAllWrapper - overall wrapper of multiselect.\n * @param componentWrapper - wrapper element of multiselect.\n */\nexport function floatLabelFocus(overAllWrapper, componentWrapper) {\n overAllWrapper.classList.add('e-input-focus');\n var label = componentWrapper.querySelector('.' + FLOATTEXT);\n if (!isNullOrUndefined(label)) {\n addClass([label], LABELTOP);\n if (label.classList.contains(LABELBOTTOM)) {\n removeClass([label], LABELBOTTOM);\n }\n }\n}\n/**\n * Function to focus the Float Label element.\n * @param overAllWrapper - overall wrapper of multiselect.\n * @param componentWrapper - wrapper element of multiselect.\n * @param value - Value of the MultiSelect.\n * @param floatLabelType - Specify the FloatLabel Type.\n * @param placeholder - Specify the PlaceHolder text.\n */\nexport function floatLabelBlur(overAllWrapper, componentWrapper, value, floatLabelType, placeholder) {\n overAllWrapper.classList.remove('e-input-focus');\n var label = componentWrapper.querySelector('.' + FLOATTEXT);\n if (value && value.length <= 0 && floatLabelType === 'Auto' && !isNullOrUndefined(label)) {\n if (label.classList.contains(LABELTOP)) {\n removeClass([label], LABELTOP);\n }\n addClass([label], LABELBOTTOM);\n }\n}\n","import { ChildProperty, compile as baseTemplateComplier, setValue } from '@syncfusion/ej2-base';\nimport { extend as baseExtend, isNullOrUndefined, getValue, classList } from '@syncfusion/ej2-base';\nimport { setStyleAttribute, addClass, attributes, remove, createElement, removeClass } from '@syncfusion/ej2-base';\nimport { DataUtil, Query, DataManager, Predicate } from '@syncfusion/ej2-data';\nimport { Column } from '../models/column';\nimport { calculateRelativeBasedPosition, calculatePosition } from '@syncfusion/ej2-popups';\n//https://typescript.codeplex.com/discussions/401501\n/**\n * Function to check whether target object implement specific interface\n * @param {Object} target\n * @param {string} checkFor\n * @returns no\n * @hidden\n */\nexport function doesImplementInterface(target, checkFor) {\n /* tslint:disable:no-any */\n return target.prototype && checkFor in target.prototype;\n}\n/**\n * Function to get value from provided data\n * @param {string} field\n * @param {Object} data\n * @param {IColumn} column\n * @hidden\n */\nexport function valueAccessor(field, data, column) {\n field = isNullOrUndefined(field) ? '' : field;\n return getValue(field, data);\n}\n/**\n * The function used to update Dom using requestAnimationFrame.\n * @param {Function} fn - Function that contains the actual action\n * @return {Promise}\n * @hidden\n */\nexport function getUpdateUsingRaf(updateFunction, callBack) {\n requestAnimationFrame(function () {\n try {\n callBack(null, updateFunction());\n }\n catch (e) {\n callBack(e);\n }\n });\n}\n/**\n * @hidden\n */\nexport function iterateArrayOrObject(collection, predicate) {\n var result = [];\n for (var i = 0, len = collection.length; i < len; i++) {\n var pred = predicate(collection[i], i);\n if (!isNullOrUndefined(pred)) {\n result.push(pred);\n }\n }\n return result;\n}\n/** @hidden */\nexport function templateCompiler(template) {\n if (template) {\n var e = void 0;\n try {\n if (document.querySelectorAll(template).length) {\n return baseTemplateComplier(document.querySelector(template).innerHTML.trim());\n }\n }\n catch (e) {\n return baseTemplateComplier(template);\n }\n }\n return undefined;\n}\n/** @hidden */\nexport function setStyleAndAttributes(node, customAttributes) {\n var copyAttr = {};\n var literals = ['style', 'class'];\n //Dont touch the original object - make a copy\n baseExtend(copyAttr, customAttributes, {});\n if ('style' in copyAttr) {\n setStyleAttribute(node, copyAttr[literals[0]]);\n delete copyAttr[literals[0]];\n }\n if ('class' in copyAttr) {\n addClass([node], copyAttr[literals[1]]);\n delete copyAttr[literals[1]];\n }\n attributes(node, copyAttr);\n}\n/** @hidden */\nexport function extend(copied, first, second, exclude) {\n var moved = baseExtend(copied, first, second);\n Object.keys(moved).forEach(function (value, index) {\n if (exclude.indexOf(value) !== -1) {\n delete moved[value];\n }\n });\n return moved;\n}\n/** @hidden */\nexport function prepareColumns(columns, autoWidth) {\n for (var c = 0, len = columns.length; c < len; c++) {\n var column = void 0;\n if (typeof columns[c] === 'string') {\n column = new Column({ field: columns[c] });\n }\n else if (!(columns[c] instanceof Column)) {\n if (!columns[c].columns) {\n column = new Column(columns[c]);\n }\n else {\n column = new Column(columns[c]);\n columns[c].columns = prepareColumns(columns[c].columns);\n }\n }\n else {\n column = columns[c];\n }\n column.headerText = isNullOrUndefined(column.headerText) ? column.foreignKeyValue || column.field || '' : column.headerText;\n column.foreignKeyField = column.foreignKeyField || column.field;\n column.valueAccessor = column.valueAccessor || valueAccessor;\n column.width = autoWidth && isNullOrUndefined(column.width) ? 200 : column.width;\n if (isNullOrUndefined(column.visible)) {\n column.visible = true;\n }\n columns[c] = column;\n }\n return columns;\n}\n/** @hidden */\nexport function setCssInGridPopUp(popUp, e, className) {\n var popUpSpan = popUp.querySelector('span');\n var position = popUp.parentElement.getBoundingClientRect();\n var targetPosition = e.target.getBoundingClientRect();\n var isBottomTail;\n popUpSpan.className = className;\n popUp.style.display = '';\n isBottomTail = (isNullOrUndefined(e.clientY) ? e.changedTouches[0].clientY :\n e.clientY) > popUp.offsetHeight + 10;\n popUp.style.top = targetPosition.top - position.top +\n (isBottomTail ? -(popUp.offsetHeight + 10) : popUp.offsetHeight + 10) + 'px'; //10px for tail element\n popUp.style.left = getPopupLeftPosition(popUp, e, targetPosition, position.left) + 'px';\n if (isBottomTail) {\n popUp.querySelector('.e-downtail').style.display = '';\n popUp.querySelector('.e-uptail').style.display = 'none';\n }\n else {\n popUp.querySelector('.e-downtail').style.display = 'none';\n popUp.querySelector('.e-uptail').style.display = '';\n }\n}\n/** @hidden */\nfunction getPopupLeftPosition(popup, e, targetPosition, left) {\n var width = popup.offsetWidth / 2;\n var x = getPosition(e).x;\n if (x - targetPosition.left < width) {\n return targetPosition.left - left;\n }\n else if (targetPosition.right - x < width) {\n return targetPosition.right - left - width * 2;\n }\n else {\n return x - left - width;\n }\n}\n/** @hidden */\nexport function getActualProperties(obj) {\n if (obj instanceof ChildProperty) {\n return getValue('properties', obj);\n }\n else {\n return obj;\n }\n}\n/** @hidden */\nexport function parentsUntil(elem, selector, isID) {\n var parent = elem;\n while (parent) {\n if (isID ? parent.id === selector : parent.classList.contains(selector)) {\n break;\n }\n parent = parent.parentElement;\n }\n return parent;\n}\n/** @hidden */\nexport function getElementIndex(element, elements) {\n var index = -1;\n for (var i = 0, len = elements.length; i < len; i++) {\n if (elements[i].isEqualNode(element)) {\n index = i;\n break;\n }\n }\n return index;\n}\n/** @hidden */\nexport function inArray(value, collection) {\n for (var i = 0, len = collection.length; i < len; i++) {\n if (collection[i] === value) {\n return i;\n }\n }\n return -1;\n}\n/** @hidden */\nexport function getActualPropFromColl(collection) {\n var coll = [];\n for (var i = 0, len = collection.length; i < len; i++) {\n if (collection[i].hasOwnProperty('properties')) {\n coll.push(collection[i].properties);\n }\n else {\n coll.push(collection[i]);\n }\n }\n return coll;\n}\n/** @hidden */\nexport function removeElement(target, selector) {\n var elements = [].slice.call(target.querySelectorAll(selector));\n for (var i = 0; i < elements.length; i++) {\n remove(elements[i]);\n }\n}\n/** @hidden */\nexport function getPosition(e) {\n var position = {};\n position.x = (isNullOrUndefined(e.clientX) ? e.changedTouches[0].clientX :\n e.clientX);\n position.y = (isNullOrUndefined(e.clientY) ? e.changedTouches[0].clientY :\n e.clientY);\n return position;\n}\nvar uid = 0;\n/** @hidden */\nexport function getUid(prefix) {\n return prefix + uid++;\n}\n/** @hidden */\nexport function appendChildren(elem, children) {\n for (var i = 0, len = children.length; i < len; i++) {\n if (len === children.length) {\n elem.appendChild(children[i]);\n }\n else {\n elem.appendChild(children[0]);\n }\n }\n return elem;\n}\n/** @hidden */\nexport function parents(elem, selector, isID) {\n var parent = elem;\n var parents = [];\n while (parent) {\n if (isID ? parent.id === selector : parent.classList.contains(selector)) {\n parents.push(parent);\n }\n parent = parent.parentElement;\n }\n return parents;\n}\n/** @hidden */\nexport function calculateAggregate(type, data, column, context) {\n if (type === 'Custom') {\n return column.customAggregate ? column.customAggregate.call(context, data, column) : '';\n }\n return column.field in data ? DataUtil.aggregates[type.toLowerCase()](data, column.field) : null;\n}\n/** @hidden */\nvar scrollWidth = null;\n/** @hidden */\nexport function getScrollBarWidth() {\n if (scrollWidth !== null) {\n return scrollWidth;\n }\n var divNode = document.createElement('div');\n var value = 0;\n divNode.style.cssText = 'width:100px;height: 100px;overflow: scroll;position: absolute;top: -9999px;';\n document.body.appendChild(divNode);\n value = (divNode.offsetWidth - divNode.clientWidth) | 0;\n document.body.removeChild(divNode);\n return scrollWidth = value;\n}\n/** @hidden */\nvar rowHeight;\n/** @hidden */\nexport function getRowHeight(element) {\n if (rowHeight !== undefined) {\n return rowHeight;\n }\n var table = createElement('table', { className: 'e-table', styles: 'visibility: hidden' });\n table.innerHTML = '
A
';\n element.appendChild(table);\n var rect = table.querySelector('td').getBoundingClientRect();\n element.removeChild(table);\n rowHeight = Math.ceil(rect.height);\n return rowHeight;\n}\n/** @hidden */\nexport function isComplexField(field) {\n return field.split('.').length > 1;\n}\n/** @hidden */\nexport function getComplexFieldID(field) {\n var length = field.split('.').length;\n var splits = field.split('.');\n var fieldName = '';\n for (var i = 0; i < length; i++) {\n fieldName = fieldName + splits[i];\n }\n return fieldName;\n}\n/** @hidden */\nexport function getComplexValue(rowData, field) {\n var length = field.split('.').length;\n var splits = field.split('.');\n var complexData = rowData[splits[0]];\n var complexValue = complexData[splits[1]];\n for (var i = 2; i < length; i++) {\n complexValue = complexValue[splits[i]];\n }\n return complexValue;\n}\n/** @hidden */\nexport function isEditable(col, type, elem) {\n var row = parentsUntil(elem, 'e-row');\n var isOldRow = !row ? true : row && !row.classList.contains('e-insertedrow');\n if (type === 'beginEdit' && isOldRow) {\n if (col.isIdentity || col.isPrimaryKey || !col.allowEditing) {\n return false;\n }\n return true;\n }\n else if (type === 'add' && col.isIdentity && col.isPrimaryKey) {\n return false;\n }\n else {\n if (isOldRow && !col.allowEditing && !col.isIdentity && !col.isPrimaryKey) {\n return false;\n }\n return true;\n }\n}\n/** @hidden */\nexport function isActionPrevent(inst) {\n var dlg = inst.element.querySelector('#' + inst.element.id + 'EditConfirm');\n return inst.editSettings.mode === 'Batch' &&\n (inst.element.querySelectorAll('.e-updatedtd').length) && inst.editSettings.showConfirmDialog &&\n (dlg ? dlg.classList.contains('e-popup-close') : true);\n}\n/** @hidden */\nexport function wrap(elem, action) {\n var clName = 'e-wrap';\n elem = elem instanceof Array ? elem : [elem];\n for (var i = 0; i < elem.length; i++) {\n action ? elem[i].classList.add(clName) : elem[i].classList.remove(clName);\n }\n}\nexport function changeButtonType(target) {\n var elements = [].slice.call(target.querySelectorAll('button'));\n for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n var button = elements_1[_i];\n attributes(button, { type: 'button' });\n }\n}\n/** @hidden */\nexport function setFormatter(serviceLocator, column) {\n var fmtr = serviceLocator.getService('valueFormatter');\n switch (column.type) {\n case 'date':\n column.setFormatter(fmtr.getFormatFunction({ type: 'date', skeleton: column.format }));\n column.setParser(fmtr.getParserFunction({ type: 'date', skeleton: column.format }));\n break;\n case 'datetime':\n column.setFormatter(fmtr.getFormatFunction({ type: 'dateTime', skeleton: column.format }));\n column.setParser(fmtr.getParserFunction({ type: 'dateTime', skeleton: column.format }));\n break;\n case 'number':\n column.setFormatter(fmtr.getFormatFunction({ format: column.format }));\n column.setParser(fmtr.getParserFunction({ format: column.format }));\n break;\n }\n}\n/** @hidden */\nexport function addRemoveActiveClasses(cells, add) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n for (var i = 0, len = cells.length; i < len; i++) {\n if (add) {\n classList(cells[i], args.slice(), []);\n cells[i].setAttribute('aria-selected', 'true');\n }\n else {\n classList(cells[i], [], args.slice());\n cells[i].removeAttribute('aria-selected');\n }\n }\n}\n/** @hidden */\nexport function distinctStringValues(result) {\n var temp = {};\n var res = [];\n for (var i = 0; i < result.length; i++) {\n if (!(result[i] in temp)) {\n res.push(result[i].toString());\n temp[result[i]] = 1;\n }\n }\n return res;\n}\n/** @hidden */\nexport function getFilterMenuPostion(target, dialogObj, grid) {\n var elementVisible = dialogObj.element.style.display;\n dialogObj.element.style.display = 'block';\n var dlgWidth = dialogObj.width;\n var newpos;\n if (!grid.enableRtl) {\n newpos = calculateRelativeBasedPosition(target, dialogObj.element);\n dialogObj.element.style.display = elementVisible;\n dialogObj.element.style.top = (newpos.top + target.getBoundingClientRect().height) - 5 + 'px';\n var leftPos = ((newpos.left - dlgWidth) + target.clientWidth);\n if (leftPos < 1) {\n dialogObj.element.style.left = (dlgWidth + leftPos) - 16 + 'px'; // right calculation\n }\n else {\n dialogObj.element.style.left = leftPos + -4 + 'px';\n }\n }\n else {\n newpos = calculatePosition(target, 'left', 'bottom');\n dialogObj.element.style.top = (newpos.top + target.getBoundingClientRect().height) - 35 + 'px';\n dialogObj.element.style.display = elementVisible;\n var leftPos = ((newpos.left - dlgWidth) + target.clientWidth);\n if (leftPos < 1) {\n dialogObj.element.style.left = (dlgWidth + leftPos) + -16 + 'px';\n }\n else {\n dialogObj.element.style.left = leftPos - 16 + 'px';\n }\n }\n}\n/** @hidden */\nexport function getZIndexCalcualtion(args, dialogObj) {\n args.popup.element.style.zIndex = (dialogObj.zIndex + 1).toString();\n}\n/** @hidden */\nexport function toogleCheckbox(elem) {\n var span = elem.querySelector('.e-frame');\n span.classList.contains('e-check') ? classList(span, ['e-uncheck'], ['e-check']) :\n classList(span, ['e-check'], ['e-uncheck']);\n}\n/** @hidden */\nexport function createCboxWithWrap(uid, elem, className) {\n var div = createElement('div', { className: className });\n div.appendChild(elem);\n div.setAttribute('uid', uid);\n return div;\n}\n/** @hidden */\nexport function removeAddCboxClasses(elem, checked) {\n removeClass([elem], ['e-check', 'e-stop', 'e-uncheck']);\n if (checked) {\n elem.classList.add('e-check');\n }\n else {\n elem.classList.add('e-uncheck');\n }\n}\n/**\n * Refresh the Row model's foreign data.\n * @param row - Grid Row model object.\n * @param columns - Foreign columns array.\n * @param data - Updated Row data.\n * @hidden\n */\nexport function refreshForeignData(row, columns, data) {\n columns.forEach(function (col) {\n setValue(col.field, getForeignData(col, data), row.foreignKeyData);\n });\n row.cells.forEach(function (cell) {\n if (cell.isForeignKey) {\n setValue('foreignKeyData', getValue(cell.column.field, row.foreignKeyData), cell);\n }\n });\n}\n/**\n * Get the foreign data for the corresponding cell value.\n * @param column - Foreign Key column\n * @param data - Row data.\n * @param lValue - cell value.\n * @param foreignData - foreign data source.\n * @hidden\n */\nexport function getForeignData(column, data, lValue, foreignKeyData) {\n var fField = column.foreignKeyField;\n var key = (lValue || valueAccessor(column.field, data, column));\n key = isNullOrUndefined(key) ? '' : key;\n var query = new Query();\n var fdata = foreignKeyData || (column.dataSource instanceof DataManager) && column.dataSource.dataSource.offline ?\n column.dataSource.dataSource.json : column.columnData;\n if (key.getDay) {\n query.where(getDatePredicate({ field: fField, operator: 'equal', value: key, matchCase: false }));\n }\n else {\n query.where(fField, '==', key, false);\n }\n return new DataManager(fdata).executeLocal(query);\n}\n/**\n * To use to get the column's object by the foreign key value.\n * @param foreignKeyValue - Defines ForeignKeyValue.\n * @param columns - Array of column object.\n * @hidden\n */\nexport function getColumnByForeignKeyValue(foreignKeyValue, columns) {\n var column;\n return columns.some(function (col) {\n column = col;\n return col.foreignKeyValue === foreignKeyValue;\n }) && column;\n}\n/**\n * @hidden\n * @param filterObject - Defines predicate model object\n */\nexport function getDatePredicate(filterObject) {\n var datePredicate;\n var prevDate;\n var nextDate;\n var prevObj = baseExtend({}, getActualProperties(filterObject));\n var nextObj = baseExtend({}, getActualProperties(filterObject));\n var value = new Date(filterObject.value);\n if (filterObject.operator === 'equal' || filterObject.operator === 'notequal') {\n prevDate = new Date(value.setHours(0) - 1);\n nextDate = new Date(value.setHours(24));\n prevObj.value = prevDate;\n nextObj.value = nextDate;\n if (filterObject.operator === 'equal') {\n prevObj.operator = 'greaterthan';\n nextObj.operator = 'lessthan';\n }\n else if (filterObject.operator === 'notequal') {\n prevObj.operator = 'lessthanorequal';\n nextObj.operator = 'greaterthanorequal';\n }\n var predicateSt = new Predicate(prevObj.field, prevObj.operator, prevObj.value, false);\n var predicateEnd = new Predicate(nextObj.field, nextObj.operator, nextObj.value, false);\n datePredicate = filterObject.operator === 'equal' ? predicateSt.and(predicateEnd) : predicateSt.or(predicateEnd);\n }\n else {\n if (typeof (prevObj.value) === 'string') {\n prevObj.value = new Date(prevObj.value);\n }\n var predicates = new Predicate(prevObj.field, prevObj.operator, prevObj.value, false);\n datePredicate = predicates;\n }\n if (filterObject.setProperties) {\n filterObject.setProperties({ ejpredicate: datePredicate }, true);\n }\n else {\n filterObject.ejpredicate = datePredicate;\n }\n return datePredicate;\n}\n/**\n * @hidden\n */\nexport function renderMovable(ele, frzCols) {\n var mEle = ele.cloneNode(true);\n for (var i = 0; i < frzCols; i++) {\n mEle.removeChild(mEle.children[0]);\n }\n for (var i = frzCols, len = ele.childElementCount; i < len; i++) {\n ele.removeChild(ele.children[ele.childElementCount - 1]);\n }\n return mEle;\n}\n","/**\n * AriaService\n * @hidden\n */\nvar AriaService = /** @class */ (function () {\n function AriaService() {\n }\n AriaService.prototype.setOptions = function (target, options) {\n var props = Object.keys(options);\n props.forEach(function (name) { return setStateAndProperties(target, config[name], options[name]); });\n };\n AriaService.prototype.setExpand = function (target, expand) {\n setStateAndProperties(target, config.expand, expand);\n };\n AriaService.prototype.setSort = function (target, direction) {\n setStateAndProperties(target, config.sort, direction, typeof direction === 'boolean');\n };\n AriaService.prototype.setBusy = function (target, isBusy) {\n setStateAndProperties(target, config.busy, isBusy);\n setStateAndProperties(target, config.invalid, null, true);\n };\n AriaService.prototype.setGrabbed = function (target, isGrabbed, remove) {\n setStateAndProperties(target, config.grabbed, isGrabbed, remove);\n };\n AriaService.prototype.setDropTarget = function (target, isTarget) {\n setStateAndProperties(target, config.dropeffect, 'copy', !isTarget);\n };\n return AriaService;\n}());\nexport { AriaService };\n/**\n * @hidden\n */\nfunction setStateAndProperties(target, attribute, value, remove) {\n if (remove) {\n target.removeAttribute(attribute);\n return;\n }\n if (target) {\n target.setAttribute(attribute, value);\n }\n}\nvar config = {\n expand: 'aria-expanded',\n role: 'role',\n selected: 'aria-selected',\n multiselectable: 'aria-multiselectable',\n sort: 'aria-sort',\n busy: 'aria-busy',\n invalid: 'aria-invalid',\n grabbed: 'aria-grabbed',\n dropeffect: 'aria-dropeffect',\n haspopup: 'aria-haspopup',\n level: 'aria-level',\n colcount: 'aria-colcount'\n};\n","import { remove } from '@syncfusion/ej2-base';\nimport { isNullOrUndefined } from '@syncfusion/ej2-base';\nimport { CellType } from '../base/enum';\nimport { uiUpdate, initialEnd, dataReady, modelChanged } from '../base/constant';\nimport { FooterRenderer } from '../renderer/footer-renderer';\nimport { SummaryCellRenderer } from '../renderer/summary-cell-renderer';\nimport { GroupSummaryModelGenerator, CaptionSummaryModelGenerator } from '../services/summary-model-generator';\n/**\n * Summary Action controller.\n */\nvar Aggregate = /** @class */ (function () {\n function Aggregate(parent, locator) {\n this.parent = parent;\n this.locator = locator;\n this.addEventListener();\n }\n Aggregate.prototype.getModuleName = function () {\n return 'aggregate';\n };\n Aggregate.prototype.initiateRender = function () {\n var _this = this;\n var cellFac = this.locator.getService('cellRendererFactory');\n var instance = new SummaryCellRenderer(this.parent, this.locator);\n [CellType.Summary, CellType.CaptionSummary, CellType.GroupSummary].forEach(function (type) {\n return cellFac.addCellRenderer(type, instance);\n });\n this.footerRenderer = new FooterRenderer(this.parent, this.locator);\n this.footerRenderer.renderPanel();\n this.footerRenderer.renderTable();\n this.locator.register('footerRenderer', this.footerRenderer);\n var fn = function () {\n _this.prepareSummaryInfo();\n _this.parent.off(dataReady, fn);\n };\n this.parent.on(dataReady, fn, this);\n this.parent.on(dataReady, this.footerRenderer.refresh, this.footerRenderer);\n };\n Aggregate.prototype.prepareSummaryInfo = function () {\n var _this = this;\n summaryIterator(this.parent.aggregates, function (column) {\n var dataColumn = _this.parent.getColumnByField(column.field) || {};\n var type = dataColumn.type;\n column.setPropertiesSilent({ format: _this.getFormatFromType(column.format, type) });\n column.setFormatter();\n column.setPropertiesSilent({ columnName: column.columnName || column.field });\n });\n };\n Aggregate.prototype.getFormatFromType = function (format, type) {\n if (isNullOrUndefined(type) || typeof format !== 'string') {\n return format;\n }\n var obj;\n switch (type) {\n case 'number':\n obj = { format: format };\n break;\n case 'date':\n obj = { type: type, skeleton: format };\n break;\n case 'datetime':\n obj = { type: 'dateTime', skeleton: format };\n break;\n }\n return obj;\n };\n Aggregate.prototype.onPropertyChanged = function (e) {\n if (e.module !== this.getModuleName()) {\n return;\n }\n if (isNullOrUndefined(this.footerRenderer)) {\n this.initiateRender();\n }\n this.prepareSummaryInfo();\n this.footerRenderer.refresh();\n var cModel = new CaptionSummaryModelGenerator(this.parent);\n var gModel = new GroupSummaryModelGenerator(this.parent);\n if (gModel.getData().length !== 0 || !cModel.isEmpty()) {\n this.parent.notify(modelChanged, {});\n }\n };\n Aggregate.prototype.addEventListener = function () {\n if (this.parent.isDestroyed) {\n return;\n }\n this.parent.on(initialEnd, this.initiateRender, this);\n this.parent.on(uiUpdate, this.onPropertyChanged, this);\n };\n Aggregate.prototype.removeEventListener = function () {\n if (this.parent.isDestroyed) {\n return;\n }\n this.footerRenderer.removeEventListener();\n this.parent.off(initialEnd, this.initiateRender);\n this.parent.off(dataReady, this.footerRenderer.refresh);\n this.parent.off(uiUpdate, this.onPropertyChanged);\n };\n Aggregate.prototype.destroy = function () {\n this.removeEventListener();\n remove(this.parent.element.querySelector('.e-gridfooter'));\n };\n return Aggregate;\n}());\nexport { Aggregate };\n/**\n * @private\n */\nexport function summaryIterator(aggregates, callback) {\n aggregates.forEach(function (row) {\n row.columns.forEach(function (column) {\n callback(column, row);\n });\n });\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { SvgRenderer, remove, createElement, isNullOrUndefined } from '@syncfusion/ej2-base';\nimport { RgbColor } from '../utils/colorMapping';\n/**\n * Helper method for heatmap\n */\n/** @private */\nexport function stringToNumber(value, containerSize) {\n if (value !== null && value !== undefined) {\n return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);\n }\n return null;\n}\n/**\n * Function to measure the height and width of the text.\n * @private\n */\nexport function measureText(text, font) {\n var htmlObject = document.getElementById('heatmapmeasuretext');\n if (htmlObject === null) {\n htmlObject = createElement('text', { id: 'heatmapmeasuretext' });\n document.body.appendChild(htmlObject);\n }\n htmlObject.innerHTML = text;\n htmlObject.style.position = 'absolute';\n htmlObject.style.visibility = 'hidden';\n htmlObject.style.fontSize = font.size;\n htmlObject.style.fontWeight = font.fontWeight;\n htmlObject.style.fontStyle = font.fontStyle;\n htmlObject.style.fontFamily = font.fontFamily;\n htmlObject.style.top = '-100';\n htmlObject.style.left = '0';\n htmlObject.style.whiteSpace = 'nowrap';\n // For bootstrap line height issue\n htmlObject.style.lineHeight = 'normal';\n return new Size(htmlObject.clientWidth, htmlObject.clientHeight);\n}\n/** @private */\nvar TextElement = /** @class */ (function () {\n function TextElement(fontModel, fontColor) {\n this['font-size'] = fontModel.size;\n this['font-style'] = fontModel.fontStyle;\n this['font-family'] = fontModel.fontFamily;\n this['font-weight'] = fontModel.fontWeight;\n this.fill = fontColor ? fontColor : '';\n }\n return TextElement;\n}());\nexport { TextElement };\nexport function titlePositionX(width, leftPadding, rightPadding, titleStyle) {\n var positionX;\n if (titleStyle.textAlignment === 'Near') {\n positionX = leftPadding;\n }\n else if (titleStyle.textAlignment === 'Center') {\n positionX = leftPadding + width / 2;\n }\n else {\n positionX = width - rightPadding;\n }\n return positionX;\n}\n/**\n * Internal class size for height and width\n */\nvar Size = /** @class */ (function () {\n function Size(width, height) {\n this.width = width;\n this.height = height;\n }\n return Size;\n}());\nexport { Size };\n/** @private */\nvar CustomizeOption = /** @class */ (function () {\n function CustomizeOption(id) {\n this.id = id;\n }\n return CustomizeOption;\n}());\nexport { CustomizeOption };\n/** @private */\nvar PathOption = /** @class */ (function (_super) {\n __extends(PathOption, _super);\n function PathOption(id, fill, width, color, opacity, dashArray, d) {\n var _this = _super.call(this, id) || this;\n _this.opacity = opacity;\n _this.fill = fill;\n _this.stroke = color ? color : '';\n _this['stroke-width'] = width;\n _this['stroke-dasharray'] = dashArray;\n _this.d = d;\n return _this;\n }\n return PathOption;\n}(CustomizeOption));\nexport { PathOption };\n/**\n * Class to define currentRect private property.\n * @private\n */\nvar CurrentRect = /** @class */ (function () {\n function CurrentRect(x, y, width, height, value, id) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.value = value;\n this.id = id;\n }\n return CurrentRect;\n}());\nexport { CurrentRect };\n/**\n * Class to define property to draw rectangle.\n * @private\n */\nvar RectOption = /** @class */ (function (_super) {\n __extends(RectOption, _super);\n function RectOption(id, fill, border, opacity, rect, borderColor, rx, ry, transform, dashArray) {\n var _this = _super.call(this, id, fill, border.width, borderColor, opacity, dashArray) || this;\n _this.y = rect.y;\n _this.x = rect.x;\n _this.height = rect.height;\n _this.width = rect.width;\n _this.rx = rx ? rx : 0;\n _this.ry = ry ? ry : 0;\n _this.transform = transform ? transform : '';\n return _this;\n }\n return RectOption;\n}(PathOption));\nexport { RectOption };\n/**\n * Helper Class to define property to draw rectangle.\n * @private\n */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n return Rect;\n}());\nexport { Rect };\n/**\n * Class to define property to draw text.\n * @private\n */\nvar TextOption = /** @class */ (function (_super) {\n __extends(TextOption, _super);\n function TextOption(id, basic, element, fontColor) {\n var _this = _super.call(this, element, fontColor) || this;\n _this.transform = '';\n _this['dominant-baseline'] = 'auto';\n _this.labelRotation = 0;\n _this.baseline = 'auto';\n _this.id = id;\n _this.x = basic.x;\n _this.y = basic.y;\n _this['text-anchor'] = basic['text-anchor'];\n _this.text = basic.text;\n _this.transform = basic.transform;\n _this.labelRotation = basic.labelRotation;\n _this['dominant-baseline'] = basic['dominant-baseline'];\n _this.baseline = basic.baseline;\n return _this;\n }\n return TextOption;\n}(TextElement));\nexport { TextOption };\n/**\n * Helper Class to define property to draw text.\n * @private\n */\nvar TextBasic = /** @class */ (function () {\n function TextBasic(x, y, anchor, text, labelRotation, transform, baseLine) {\n this.transform = '';\n this['dominant-baseline'] = 'auto';\n this.labelRotation = 0;\n this.baseline = 'auto';\n this.x = x ? x : 0;\n this.y = y ? y : 0;\n this['text-anchor'] = anchor ? anchor : '';\n this.text = text ? text : '';\n this.transform = transform ? transform : '';\n this.labelRotation = labelRotation;\n this['dominant-baseline'] = baseLine ? baseLine : '';\n this.baseline = baseLine ? baseLine : '';\n }\n return TextBasic;\n}());\nexport { TextBasic };\n/**\n * Class to define property to draw line.\n * @private\n */\nvar Line = /** @class */ (function () {\n function Line(x1, y1, x2, y2) {\n this.x1 = x1;\n this.y1 = y1;\n this.x2 = x2;\n this.y2 = y2;\n }\n return Line;\n}());\nexport { Line };\n/**\n * Class to define property to draw line.\n * @private\n */\nvar LineOption = /** @class */ (function (_super) {\n __extends(LineOption, _super);\n function LineOption(id, line, stroke, strokewidth, opacity, dasharray) {\n var _this = _super.call(this, id, null, strokewidth, stroke, opacity, dasharray, null) || this;\n _this.x1 = line.x1;\n _this.y1 = line.y1;\n _this.x2 = line.x2;\n _this.y2 = line.y2;\n return _this;\n }\n return LineOption;\n}(PathOption));\nexport { LineOption };\n/** @private */\nexport function sum(values) {\n var sum = 0;\n for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {\n var value = values_1[_i];\n sum += value;\n }\n return sum;\n}\nexport function titlePositionY(heatmapSize, topPadding, bottomPadding, titleStyle) {\n var positionY;\n if (titleStyle.textAlignment === 'Near') {\n positionY = heatmapSize.height - bottomPadding;\n }\n else if (titleStyle.textAlignment === 'Center') {\n positionY = heatmapSize.height / 2;\n }\n else {\n positionY = topPadding;\n }\n return positionY;\n}\n/** @private */\nexport function rotateTextSize(font, text, angle) {\n var renderer = new SvgRenderer('heatmapMeasureRotateText');\n var svgObject = renderer.createSvg({ id: 'heatmapMeasureRotateText_svg', width: 100, height: 100 });\n var box;\n var options;\n var htmlObject;\n options = {\n 'font-size': font.size,\n 'font-style': font.fontStyle,\n 'font-family': font.fontFamily,\n 'font-weight': font.fontWeight,\n 'transform': 'rotate(' + angle + ', 0, 0)',\n 'text-anchor': 'middle'\n };\n htmlObject = renderer.createText(options, text);\n svgObject.appendChild(htmlObject);\n document.body.appendChild(svgObject);\n box = htmlObject.getBoundingClientRect();\n remove(svgObject);\n return new Size((box.right - box.left), (box.bottom - box.top));\n}\n/**\n * Class to draw SVG and Canvas Rectangle & Text.\n * @private\n */\nvar DrawSvgCanvas = /** @class */ (function () {\n function DrawSvgCanvas(heatmap) {\n this.heatMap = heatmap;\n }\n //Svg & Canvas Rectangle Part\n DrawSvgCanvas.prototype.drawRectangle = function (properties, parentElement) {\n if (!this.heatMap.enableCanvasRendering) {\n parentElement.appendChild(this.heatMap.renderer.drawRectangle(properties));\n }\n else {\n this.drawCanvasRectangle(this.heatMap.canvasRenderer, properties);\n }\n };\n //Svg & Canvas Text Part\n DrawSvgCanvas.prototype.createText = function (properties, parentElement, text) {\n if (!this.heatMap.enableCanvasRendering) {\n parentElement.appendChild(this.heatMap.renderer.createText(properties, text));\n }\n else {\n this.canvasDrawText(properties, text);\n }\n };\n //Draw the wrapped text for both SVG & canvas\n DrawSvgCanvas.prototype.createWrapText = function (options, font, parentElement) {\n var renderOptions = {};\n var htmlObject;\n var tspanElement;\n var text;\n var height;\n renderOptions = {\n 'id': options.id,\n 'x': options.x,\n 'y': options.y,\n 'fill': options.fill,\n 'font-size': font.size,\n 'font-style': font.fontStyle,\n 'font-family': font.fontFamily,\n 'font-weight': font.fontWeight,\n 'text-anchor': options['text-anchor'],\n 'transform': options.transform,\n 'dominant-baseline': options['dominant-baseline']\n };\n text = options.text[0];\n if (!this.heatMap.enableCanvasRendering) {\n htmlObject = this.heatMap.renderer.createText(renderOptions, text);\n }\n else {\n this.heatMap.canvasRenderer.drawText(options, text);\n }\n if (typeof options.text !== 'string' && options.text.length > 1) {\n for (var i = 1, len = options.text.length; i < len; i++) {\n height = (measureText(options.text[i], font).height);\n if (!this.heatMap.enableCanvasRendering) {\n tspanElement = this.heatMap.renderer.createTSpan({\n 'x': options.x, 'id': options.id + i,\n 'y': (options.y) + (i * height)\n }, options.text[i]);\n htmlObject.appendChild(tspanElement);\n }\n else {\n options.id = options.id + i;\n options.y += height;\n this.heatMap.canvasRenderer.drawText(options, options.text[i]);\n }\n }\n }\n if (!this.heatMap.enableCanvasRendering) {\n parentElement.appendChild(htmlObject);\n }\n };\n DrawSvgCanvas.prototype.drawLine = function (properties, parentElement) {\n if (!this.heatMap.enableCanvasRendering) {\n parentElement.appendChild(this.heatMap.renderer.drawLine(properties));\n }\n else {\n this.heatMap.canvasRenderer.drawLine(properties);\n }\n };\n //Canvas Text Part\n DrawSvgCanvas.prototype.canvasDrawText = function (options, label, translateX, translateY) {\n var ctx = this.heatMap.canvasRenderer.ctx;\n if (!translateX) {\n translateX = options.x;\n }\n if (!translateY) {\n translateY = options.y;\n }\n var fontWeight = this.getOptionValue(options, 'font-weight');\n if (!isNullOrUndefined(fontWeight) && fontWeight.toLowerCase() === 'regular') {\n fontWeight = 'normal';\n }\n var fontFamily = this.getOptionValue(options, 'font-family');\n var fontSize = (options['font-size'].toString()).indexOf('px') === -1 ? options['font-size'] + 'px' : options['font-size'];\n var anchor = this.getOptionValue(options, 'text-anchor');\n var fontStyle = this.getOptionValue(options, 'font-style').toLowerCase();\n var font = (fontStyle + ' ' + fontWeight + ' ' + fontSize + ' ' + fontFamily);\n if (anchor === 'middle') {\n anchor = 'center';\n }\n ctx.save();\n ctx.fillStyle = options.fill;\n ctx.font = font;\n ctx.textAlign = anchor;\n if (options.baseline) {\n ctx.textBaseline = options.baseline;\n }\n ctx.translate(translateX, translateY);\n ctx.rotate(options.labelRotation * Math.PI / 180);\n ctx.fillText(label, options.x - translateX, options.y - translateY);\n ctx.restore();\n };\n // method to get the attributes value\n /* tslint:disable */\n DrawSvgCanvas.prototype.getOptionValue = function (options, key) {\n return options[key];\n };\n DrawSvgCanvas.prototype.setAttributes = function (canvas, options) {\n canvas.ctx.lineWidth = options['stroke-width'];\n var dashArray = options['stroke-dasharray'];\n if (!isNullOrUndefined(dashArray)) {\n var dashArrayString = dashArray.split(',');\n canvas.ctx.setLineDash([parseInt(dashArrayString[0], 10), parseInt(dashArrayString[1], 10)]);\n }\n canvas.ctx.strokeStyle = options['stroke'];\n };\n ;\n DrawSvgCanvas.prototype.drawCanvasRectangle = function (canvas, options) {\n var canvasCtx = canvas.ctx;\n var cornerRadius = options.rx;\n canvas.ctx.save();\n canvas.ctx.beginPath();\n canvas.ctx.globalAlpha = options['opacity'];\n this.setAttributes(canvas, options);\n canvas.ctx.rect(options.x, options.y, options.width, options.height);\n if (cornerRadius !== null && cornerRadius >= 0) {\n this.drawCornerRadius(canvas, options);\n }\n else {\n if (options.fill === 'none') {\n options.fill = 'transparent';\n }\n canvas.ctx.fillStyle = options.fill;\n canvas.ctx.fillRect(options.x, options.y, options.width, options.height);\n }\n if (options['stroke-width'] && options['stroke-width'] != 0) {\n canvas.ctx.stroke();\n }\n canvas.ctx.restore();\n canvas.ctx = canvasCtx;\n };\n ;\n // To draw the corner of a rectangle\n DrawSvgCanvas.prototype.drawCornerRadius = function (canvas, options) {\n var cornerRadius = options.rx;\n var x = options.x;\n var y = options.y;\n var width = options.width;\n var height = options.height;\n if (options.fill === 'none') {\n options.fill = 'transparent';\n }\n canvas.ctx.fillStyle = options.fill;\n if (width < 2 * cornerRadius) {\n cornerRadius = width / 2;\n }\n if (height < 2 * cornerRadius) {\n cornerRadius = height / 2;\n }\n canvas.ctx.beginPath();\n canvas.ctx.moveTo(x + width - cornerRadius, y);\n canvas.ctx.arcTo(x + width, y, x + width, y + height, cornerRadius);\n canvas.ctx.arcTo(x + width, y + height, x, y + height, cornerRadius);\n canvas.ctx.arcTo(x, y + height, x, y, cornerRadius);\n canvas.ctx.arcTo(x, y, x + width, y, cornerRadius);\n canvas.ctx.closePath();\n canvas.ctx.fill();\n };\n ;\n return DrawSvgCanvas;\n}());\nexport { DrawSvgCanvas };\nexport function getTitle(title, style, width) {\n var titleCollection = [];\n switch (style.textOverflow) {\n case 'Wrap':\n titleCollection = textWrap(title, width, style);\n break;\n case 'Trim':\n titleCollection.push(textTrim(width, title, style));\n break;\n default:\n titleCollection.push(textNone(width, title, style));\n break;\n }\n return titleCollection;\n}\nexport function textWrap(currentLabel, maximumWidth, font) {\n var textCollection = currentLabel.split(' ');\n var label = '';\n var labelCollection = [];\n var text;\n for (var i = 0, len = textCollection.length; i < len; i++) {\n text = textCollection[i];\n if (measureText(label.concat(text), font).width < maximumWidth) {\n label = label.concat((label === '' ? '' : ' ') + text);\n }\n else {\n if (label !== '') {\n labelCollection.push(textTrim(maximumWidth, label, font));\n label = text;\n }\n else {\n labelCollection.push(textTrim(maximumWidth, text, font));\n text = '';\n }\n }\n if (label && i === len - 1) {\n labelCollection.push(textTrim(maximumWidth, label, font));\n }\n }\n return labelCollection;\n}\n/** @private */\nexport function textTrim(maxWidth, text, font) {\n var label = text;\n var size = measureText(text, font).width;\n if (size > maxWidth) {\n var textLength = text.length;\n for (var index = textLength - 1; index >= 0; --index) {\n label = text.substring(0, index) + '...';\n size = measureText(label, font).width;\n if (size <= maxWidth) {\n return label;\n }\n }\n }\n return label;\n}\n/** @private */\nexport function textNone(maxWidth, text, font) {\n var label = text;\n var size = measureText(text, font).width;\n if (size > maxWidth) {\n var textLength = text.length;\n for (var i = textLength - 1; i >= 0; --i) {\n label = text.substring(0, i);\n size = measureText(label, font).width;\n if (size <= maxWidth) {\n return label;\n }\n }\n }\n return label;\n}\n/** @private */\nvar Gradient = /** @class */ (function () {\n function Gradient(x, x1, x2, y1, y2) {\n this.id = x;\n this.x1 = x1;\n this.x2 = x2;\n this.y1 = y1;\n this.y2 = y2;\n }\n return Gradient;\n}());\nexport { Gradient };\nvar GradientColor = /** @class */ (function () {\n function GradientColor(color, colorStop) {\n this.color = color;\n this.colorStop = colorStop;\n }\n return GradientColor;\n}());\nexport { GradientColor };\n/** @private */\nexport function showTooltip(text, x, y, areaWidth, id, element, isTouch) {\n var tooltip = document.getElementById(id);\n var width = measureText(text, {\n fontFamily: 'Segoe UI', size: '12px',\n fontStyle: 'Normal', fontWeight: 'Regular'\n }).width + 5;\n x = (x + width > areaWidth) ? x - width : x;\n x = x < 0 ? 5 : x;\n if (!tooltip) {\n tooltip = createElement('div', {\n innerHTML: text,\n id: id,\n styles: 'top:' + (y + 15).toString() + 'px;left:' + (x + 15).toString() +\n 'px;background-color: rgb(255, 255, 255) !important; color:black !important; ' +\n 'position:absolute;border:1px solid rgb(112, 112, 112); padding-left : 3px; padding-right : 2px;' +\n 'padding-bottom : 2px; padding-top : 2px; font-size:12px; font-family: Segoe UI'\n });\n element.appendChild(tooltip);\n }\n else {\n tooltip.innerHTML = text;\n tooltip.style.top = (y + 15).toString() + 'px';\n tooltip.style.left = (x + 15).toString() + 'px';\n }\n if (isTouch) {\n setTimeout(function () { removeElement(id); }, 1500);\n }\n}\n/** @private */\nexport function removeElement(id) {\n var element = getElement(id);\n if (element) {\n remove(element);\n }\n}\n/** @private */\nexport function getElement(id) {\n return document.getElementById(id);\n}\n/** @private */\nexport function increaseDateTimeInterval(value, interval, intervalType) {\n var result = new Date(value);\n interval = Math.ceil(interval);\n switch (intervalType) {\n case 'Years':\n result.setFullYear(result.getFullYear() + interval);\n break;\n case 'Months':\n result.setMonth(result.getMonth() + interval);\n break;\n case 'Days':\n result.setDate(result.getDate() + interval);\n break;\n case 'Hours':\n result.setHours(result.getHours() + interval);\n break;\n case 'Minutes':\n result.setMinutes(result.getMinutes() + interval);\n break;\n }\n return result;\n}\n/* private */\nvar CanvasTooltip = /** @class */ (function () {\n function CanvasTooltip(text, rect) {\n this.region = new Rect(0, 0, 0, 0);\n this.text = text;\n this.region = rect;\n }\n return CanvasTooltip;\n}());\nexport { CanvasTooltip };\n/* private*/\n/* Method to get the tool tip text in canvas based on region. */\nexport function getTooltipText(tooltipCollection, xPosition, yPosition) {\n var length = tooltipCollection.length;\n var tooltip;\n var region;\n var text;\n for (var i = 0; i < length; i++) {\n tooltip = tooltipCollection[i];\n region = tooltip.region;\n if (xPosition >= region.x && xPosition <= (region.x + region.width) && yPosition >= region.y && yPosition <= (region.y + region.height)) {\n text = tooltip.text;\n break;\n }\n }\n return text;\n}\n/**\n * @private\n */\nvar PaletterColor = /** @class */ (function () {\n function PaletterColor() {\n }\n return PaletterColor;\n}());\nexport { PaletterColor };\n/**\n * @private\n */\nvar GradientPointer = /** @class */ (function () {\n function GradientPointer(pathX1, pathY1, pathX2, pathY2, pathX3, pathY3) {\n this.pathX1 = pathX1;\n this.pathY1 = pathY1;\n this.pathX2 = pathX2;\n this.pathY2 = pathY2;\n this.pathX3 = pathX3;\n this.pathY3 = pathY3;\n }\n return GradientPointer;\n}());\nexport { GradientPointer };\n/** @private */\nexport function colorNameToHex(color) {\n var element;\n color = color === 'transparent' ? 'white' : color;\n element = document.getElementById('heatmapmeasuretext');\n element.style.color = color;\n color = window.getComputedStyle(element).color;\n var exp = /^(rgb|hsl)(a?)[(]\\s*([\\d.]+\\s*%?)\\s*,\\s*([\\d.]+\\s*%?)\\s*,\\s*([\\d.]+\\s*%?)\\s*(?:,\\s*([\\d.]+)\\s*)?[)]$/;\n var isRGBValue = exp.exec(color);\n return convertToHexCode(new RgbColor(parseInt(isRGBValue[3], 10), parseInt(isRGBValue[4], 10), parseInt(isRGBValue[5], 10)));\n}\n/** @private */\nexport function convertToHexCode(value) {\n return '#' + componentToHex(value.R) + componentToHex(value.G) + componentToHex(value.B);\n}\n/** @private */\nexport function componentToHex(value) {\n var hex = value.toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n}\n/** @private */\nexport function convertHexToColor(hex) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result ? new RgbColor(parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)) :\n new RgbColor(255, 255, 255);\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { SvgRenderer, compile as templateComplier, remove, merge, createElement } from '@syncfusion/ej2-base';\n/**\n * Specifies Linear-Gauge Helper methods\n */\n/** @private */\nexport function stringToNumber(value, containerSize) {\n if (value !== null && value !== undefined) {\n return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);\n }\n return null;\n}\n/**\n * Function to measure the height and width of the text.\n * @param {string} text\n * @param {FontModel} font\n * @param {string} id\n * @returns no\n * @private\n */\nexport function measureText(text, font) {\n var htmlObject = document.getElementById('gauge-measuretext');\n var size;\n if (htmlObject === null) {\n htmlObject = createElement('text', { id: 'gauge-measuretext' });\n document.body.appendChild(htmlObject);\n }\n htmlObject.innerHTML = text;\n htmlObject.style.position = 'absolute';\n htmlObject.style.fontSize = font.size;\n htmlObject.style.fontWeight = font.fontWeight;\n htmlObject.style.fontStyle = font.fontStyle;\n htmlObject.style.fontFamily = font.fontFamily;\n htmlObject.style.visibility = 'hidden';\n htmlObject.style.top = '-100';\n htmlObject.style.left = '0';\n htmlObject.style.whiteSpace = 'nowrap';\n size = new Size(htmlObject.clientWidth, htmlObject.clientHeight);\n //remove(htmlObject);\n return size;\n}\n/** @private */\nexport function withInRange(value, start, end, max, min, type) {\n var withIn;\n if (type === 'pointer') {\n withIn = (((value <= max) && (value >= min)));\n }\n else {\n withIn = (start != null && (start <= max) && (start >= min)) && (end != null && (end <= max) && (end >= min));\n }\n return withIn;\n}\nexport function convertPixelToValue(parentElement, pointerElement, orientation, axis, type, location) {\n var elementRect = parentElement.getBoundingClientRect();\n var pointerRect = pointerElement.getBoundingClientRect();\n var height = (pointerElement.id.indexOf('MarkerPointer') > -1) ? (pointerRect.height / 2) :\n (!axis.isInversed) ? 0 : pointerRect.height;\n var width = (pointerElement.id.indexOf('MarkerPointer') > -1) ? (pointerRect.width / 2) :\n (!axis.isInversed) ? pointerRect.width : 0;\n var size = new Size(axis.lineBounds.width, axis.lineBounds.height);\n var y = (type === 'drag') ? (location.y - axis.lineBounds.y) :\n ((pointerRect.top + height) - elementRect.top - axis.lineBounds.y);\n var x = (type === 'drag') ? (location.x - axis.lineBounds.x) :\n ((pointerRect.left + width) - elementRect.left - axis.lineBounds.x);\n var newSize = (orientation === 'Vertical') ? size.height : size.width;\n var divideVal = (orientation === 'Vertical') ? y : x;\n var value = (orientation === 'Vertical') ? (axis.isInversed) ? (divideVal / newSize) :\n (1 - (divideVal / newSize)) : (axis.isInversed) ? (1 - (divideVal / newSize)) : (divideVal / newSize);\n value = value * (axis.visibleRange.delta) + axis.visibleRange.min;\n return value;\n}\nexport function getPathToRect(path, size, parentElement) {\n var tempDiv = document.getElementById('gauge_path');\n if (tempDiv === null) {\n tempDiv = createElement('text', { id: 'gauge_path' });\n tempDiv.style.position = 'absolute';\n tempDiv.style.top = '0px';\n tempDiv.style.left = '0px';\n parentElement.appendChild(tempDiv);\n }\n var render = new SvgRenderer('id');\n var svg = render.createSvg({ id: 'box_path', width: size.width, height: size.height });\n svg.appendChild(path);\n tempDiv.appendChild(svg);\n var svgRect = path.getBBox();\n remove(tempDiv);\n return svgRect;\n}\n/** @private */\nexport function getElement(id) {\n return document.getElementById(id);\n}\n/** @private */\nexport function removeElement(id) {\n var element = getElement(id);\n if (element) {\n remove(element);\n }\n}\n/** @private */\nexport function isPointerDrag(axes) {\n var pointerEnable = false;\n axes.map(function (axis, index) {\n axis.pointers.map(function (pointer, index) {\n if (pointer.enableDrag) {\n pointerEnable = true;\n }\n });\n });\n return pointerEnable;\n}\n/** @private */\nexport function valueToCoefficient(value, axis, orientation, range) {\n var result = (value - range.min) / range.delta;\n result = (orientation === 'Vertical') ? (!axis.isInversed) ? (1 - result) : result : (!axis.isInversed) ? result : (1 - result);\n return result;\n}\nexport function getFontStyle(font) {\n var style = '';\n style = 'font-size:' + font.size +\n '; font-style:' + font.fontStyle + '; font-weight:' + font.fontWeight +\n '; font-family:' + font.fontFamily + ';opacity:' + font.opacity +\n '; color:' + font.color + ';';\n return style;\n}\n/** @private */\nexport function getLabelFormat(format) {\n var customLabelFormat = format && format.match('{value}') !== null;\n var skeleton = customLabelFormat ? '' : format;\n return skeleton;\n}\n/** @private */\nexport function getTemplateFunction(template) {\n var templateFn = null;\n var e;\n try {\n if (document.querySelectorAll(template).length) {\n templateFn = templateComplier(document.querySelector(template).innerHTML.trim());\n }\n }\n catch (e) {\n templateFn = templateComplier(template);\n }\n return templateFn;\n}\n/** @private */\nexport function getElementOffset(childElement, parentElement) {\n var width;\n var height;\n parentElement.appendChild(childElement);\n width = childElement.offsetWidth;\n height = childElement.offsetHeight;\n parentElement.removeChild(childElement);\n return new Size(width, height);\n}\n/** @private */\nvar VisibleRange = /** @class */ (function () {\n function VisibleRange(min, max, interval, delta) {\n this.min = min;\n this.max = max;\n this.interval = interval;\n this.delta = delta;\n }\n return VisibleRange;\n}());\nexport { VisibleRange };\n/** @private */\nvar GaugeLocation = /** @class */ (function () {\n function GaugeLocation(x, y) {\n this.x = x;\n this.y = y;\n }\n return GaugeLocation;\n}());\nexport { GaugeLocation };\n/**\n * Internal class size for height and width\n */\nvar Size = /** @class */ (function () {\n function Size(width, height) {\n this.width = width;\n this.height = height;\n }\n return Size;\n}());\nexport { Size };\n/** @private */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n return Rect;\n}());\nexport { Rect };\n/** @private */\nvar CustomizeOption = /** @class */ (function () {\n function CustomizeOption(id) {\n this.id = id;\n }\n return CustomizeOption;\n}());\nexport { CustomizeOption };\n/** @private */\nvar PathOption = /** @class */ (function (_super) {\n __extends(PathOption, _super);\n function PathOption(id, fill, width, color, opacity, dashArray, d, transform) {\n if (transform === void 0) { transform = ''; }\n var _this = _super.call(this, id) || this;\n _this.opacity = opacity;\n _this.fill = fill;\n _this.stroke = color;\n _this['stroke-width'] = width;\n _this['stroke-dasharray'] = dashArray;\n _this.d = d;\n _this.transform = transform;\n return _this;\n }\n return PathOption;\n}(CustomizeOption));\nexport { PathOption };\n/** @private */\nvar RectOption = /** @class */ (function () {\n function RectOption(id, fill, border, opacity, rect, transform, dashArray) {\n this.opacity = opacity;\n this.id = id;\n this.y = rect.y;\n this.x = rect.x;\n this.fill = fill;\n this.stroke = border.color;\n this['stroke-width'] = border.width;\n this.height = rect.height;\n this.width = rect.width;\n }\n return RectOption;\n}());\nexport { RectOption };\n/** @private */\nvar TextOption = /** @class */ (function (_super) {\n __extends(TextOption, _super);\n function TextOption(id, x, y, anchor, text, transform, baseLine) {\n if (transform === void 0) { transform = ''; }\n var _this = _super.call(this, id) || this;\n _this.transform = '';\n _this.baseLine = 'auto';\n _this.x = x;\n _this.y = y;\n _this.anchor = anchor;\n _this.text = text;\n _this.transform = transform;\n _this.baseLine = baseLine;\n return _this;\n }\n return TextOption;\n}(CustomizeOption));\nexport { TextOption };\n/** @private */\nvar VisibleLabels = /** @class */ (function () {\n function VisibleLabels(text, value, size) {\n this.text = text;\n this.value = value;\n this.size = size;\n }\n return VisibleLabels;\n}());\nexport { VisibleLabels };\n/** @private */\nvar Align = /** @class */ (function () {\n function Align(axisIndex, align) {\n this.align = align;\n this.axisIndex = axisIndex;\n }\n return Align;\n}());\nexport { Align };\n/** @private */\nexport function textElement(options, font, color, parent) {\n var renderOptions = {};\n var htmlObject;\n var renderer = new SvgRenderer('');\n var style = 'fill:' + color + '; font-size:' + font.size +\n '; font-style:' + font.fontStyle + ' ; font-weight:' + font.fontWeight + '; font-family:' +\n font.fontFamily + '; text-anchor:' + options.anchor + '; transform:' + options.transform +\n '; opacity:' + font.opacity + '; dominant-baseline:' + options.baseLine + ';';\n renderOptions = {\n 'id': options.id,\n 'x': options.x,\n 'y': options.y,\n 'style': style\n };\n htmlObject = renderer.createText(renderOptions, options.text);\n parent.appendChild(htmlObject);\n return htmlObject;\n}\nexport function calculateNiceInterval(min, max, size, orientation) {\n var delta = max - min;\n var currentInterval;\n var intervalDivs = [10, 5, 2, 1];\n var desiredIntervalsCount = getActualDesiredIntervalsCount(size, orientation);\n var niceInterval = delta / desiredIntervalsCount;\n var minInterval = Math.pow(10, Math.floor(Math.log(niceInterval) / Math.log(10)));\n for (var _i = 0, intervalDivs_1 = intervalDivs; _i < intervalDivs_1.length; _i++) {\n var interval = intervalDivs_1[_i];\n currentInterval = minInterval * interval;\n if (desiredIntervalsCount < (delta / currentInterval)) {\n break;\n }\n niceInterval = currentInterval;\n }\n return niceInterval;\n}\nexport function getActualDesiredIntervalsCount(size, orientation) {\n var maximumLabels = 5;\n var desiredIntervalsCount = (orientation === 'Horizontal' ? 0.533 : 1) * maximumLabels;\n desiredIntervalsCount = Math.max((size * (desiredIntervalsCount / 100)), 1);\n return desiredIntervalsCount;\n}\n/** @private */\nexport function getPointer(target, gauge) {\n var split = [];\n var axisIndex;\n var radix = 10;\n var pointIndex;\n var axis;\n var pointer;\n split = target.id.split('_');\n axisIndex = parseInt(split[2], radix);\n pointIndex = parseInt(split[4], radix);\n axis = gauge.axes[axisIndex];\n pointer = gauge.axes[axisIndex].pointers[pointIndex];\n return { axis: axis, axisIndex: axisIndex, pointer: pointer, pointerIndex: pointIndex };\n}\n/** @private */\nexport function getRangeColor(value, ranges) {\n var rangeColor = null;\n ranges.forEach(function (range, index) {\n if (value >= range.start && range.end >= value) {\n rangeColor = range.interior;\n }\n });\n return rangeColor;\n}\n/** @private */\nexport function getRangePalette() {\n var palette = ['#ff5985', '#ffb133', '#fcde0b', '#27d5ff', '#50c917'];\n return palette;\n}\n/** @private */\nexport function calculateShapes(location, shape, size, url, options, orientation, axis, pointer) {\n var path;\n var width = size.width;\n var height = size.height;\n var locX = location.x;\n var locY = location.y;\n var radius;\n switch (shape) {\n case 'Circle':\n radius = ((width + height) / 4);\n locX = (orientation === 'Vertical') ? (!axis.opposedPosition) ? (pointer.placement !== 'Far') ? locX - radius : locX + radius :\n pointer.placement === 'Near' ? locX - radius : locX + radius : locX;\n locY = (orientation === 'Vertical') ? locY : (!axis.opposedPosition) ? (pointer.placement === 'Far') ?\n locY + radius : locY - radius : (pointer.placement === 'Near') ? locY - radius : locY + radius;\n merge(options, { 'r': radius, 'cx': locX, 'cy': locY });\n break;\n case 'Diamond':\n case 'Rectangle':\n locX = (orientation === 'Horizontal') ? ((locX - (width / 2))) : ((!axis.opposedPosition && pointer.placement !== 'Far') ||\n (axis.opposedPosition && pointer.placement === 'Near')) ? locX - width : locX;\n locY = (orientation === 'Vertical') ? locY : (!axis.opposedPosition) ?\n (pointer.placement === 'Far') ? locY + (height / 2) : locY - (height / 2) :\n (pointer.placement === 'Near') ? locY - (height / 2) : locY + (height / 2);\n if (shape === 'Diamond') {\n path = 'M' + ' ' + locX + ' ' + locY + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + (locX + width) + ' ' + locY + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + locX + ' ' + locY + ' z';\n }\n else {\n path = 'M' + ' ' + locX + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + (locX + width) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + (locX + width) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + locX + ' ' + (locY - (height / 2)) + ' z';\n }\n merge(options, { 'd': path });\n break;\n case 'Triangle':\n if (orientation === 'Vertical') {\n path = 'M' + ' ' + locX + ' ' + locY + ' ' +\n 'L' + (locX - width) + ' ' + (locY - (height / 2)) +\n 'L' + (locX - width) + ' ' + (locY + (height / 2)) + ' Z';\n }\n else {\n path = 'M' + ' ' + locX + ' ' + locY + ' ' +\n 'L' + (locX + (width / 2)) + ' ' + (locY - height) +\n 'L' + (locX - (width / 2)) + ' ' + (locY - height) + ' Z';\n }\n merge(options, { 'd': path });\n break;\n case 'InvertedTriangle':\n if (orientation === 'Vertical') {\n path = 'M' + ' ' + locX + ' ' + locY + ' ' +\n 'L' + (locX + width) + ' ' + (locY - (height / 2)) +\n 'L' + (locX + width) + ' ' + (locY + (height / 2)) + ' Z';\n }\n else {\n path = 'M' + ' ' + locX + ' ' + locY + ' ' +\n 'L' + (locX + (width / 2)) + ' ' + (locY + height) +\n 'L' + (locX - (width / 2)) + ' ' + (locY + height) + ' Z';\n }\n merge(options, { 'd': path });\n break;\n case 'Arrow':\n if (orientation === 'Vertical') {\n path = 'M' + ' ' + locX + ' ' + locY + ' ' + 'L' + (locX - (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + (locX - (width / 2)) + ' ' + ((locY - (height / 2)) + (height / 4)) + ' ' + 'L' + (locX - width) + ' '\n + ((locY - (height / 2)) + (height / 4)) + ' ' + 'L' + (locX - width) + ' ' + ((locY + (height / 2)) -\n (height / 4)) + ' ' + 'L' + (locX - (width / 2)) + ' ' + ((locY + (height / 2)) - (height / 4)) + ' ' +\n 'L' + (locX - (width / 2)) + ' ' + (locY + height / 2) + 'z';\n }\n else {\n path = 'M' + ' ' + locX + ' ' + locY + ' ' + 'L' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ((locX + (width / 2)) - (width / 4)) + ' ' + (locY - (height / 2)) + ' ' + 'L' + ((locX + (width / 2)) -\n (width / 4)) + ' ' + (locY - height) + ' ' + 'L' + ((locX - (width / 2)) + (width / 4)) + ' ' + (locY - height) +\n ' ' + 'L' + ((locX - (width / 2)) + (width / 4)) + ' ' + (locY - (height / 2)) + ' ' + 'L' + (locX - (width / 2))\n + ' ' + (locY - (height / 2)) + 'z';\n }\n merge(options, { 'd': path });\n break;\n case 'InvertedArrow':\n if (orientation === 'Vertical') {\n path = 'M' + ' ' + locX + ' ' + locY + 'L' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + (locX + (width / 2)) + ' ' + ((locY - (height / 2)) + (height / 4)) + ' ' + 'L' + (locX + width) + ' '\n + ((locY - (height / 2)) + (height / 4)) + ' ' + 'L' + (locX + width) + ' ' + ((locY + (height / 2)) - (height / 4))\n + ' ' + 'L' + (locX + (width / 2)) + ' ' + ((locY + (height / 2)) - (height / 4)) + ' ' +\n 'L' + (locX + (width / 2)) + ' ' + (locY + height / 2) + 'z';\n }\n else {\n path = 'M' + ' ' + locX + ' ' + locY + ' ' + 'L' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ((locX + (width / 2)) - (width / 4)) + ' ' + (locY + (height / 2)) + ' ' + 'L' + ((locX + (width / 2)) -\n (width / 4)) + ' ' + (locY + height) + ' ' + 'L' + ((locX - (width / 2)) + (width / 4)) + ' ' + (locY + height)\n + ' ' + 'L' + ((locX - (width / 2)) + (width / 4)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + (locX - (width / 2)) + ' ' + (locY + (height / 2)) + 'z';\n }\n merge(options, { 'd': path });\n break;\n case 'Image':\n merge(options, { 'href': url, 'height': height, 'width': width, x: locX - (width / 2), y: locY - (height / 2) });\n break;\n }\n return options;\n}\n/** @private */\nexport function getBox(location, boxName, orientation, size, type, containerWidth, axis, cornerRadius) {\n var path = ' ';\n var radius = cornerRadius;\n var x1;\n var y1;\n var rectWidth;\n var rectHeight;\n var bottomRadius;\n var topRadius;\n switch (boxName) {\n case 'RoundedRectangle':\n x1 = location.x;\n y1 = location.y;\n rectWidth = location.width;\n rectHeight = location.height;\n path = 'M' + ' ' + x1 + ' ' + (radius + y1) + ' Q ' + x1 + ' ' + y1 + ' ' + (x1 + radius) + ' ' + y1 + ' ';\n path += 'L' + ' ' + (x1 + rectWidth - radius) + ' ' + y1 + ' Q ' + (x1 + rectWidth) + ' ' + y1 + ' '\n + (x1 + rectWidth) + ' ' + (y1 + radius) + ' ';\n path += 'L ' + (x1 + rectWidth) + ' ' + (y1 + rectHeight - radius) + ' Q ' + (x1 + rectWidth) + ' ' + (y1 + rectHeight)\n + ' ' + (x1 + rectWidth - radius) + ' ' + (y1 + rectHeight) + ' ';\n path += ' L ' + (x1 + radius) + ' ' + (y1 + rectHeight) + ' Q ' + x1 + ' ' + (y1 + rectHeight)\n + ' ' + x1 + ' ' + (y1 + rectHeight - radius) + ' ';\n path += 'L' + ' ' + x1 + ' ' + (radius + y1) + ' ' + 'z';\n break;\n case 'Thermometer':\n var width = (orientation === 'Vertical') ? location.width : location.height;\n bottomRadius = width + ((width / 2) / Math.PI);\n topRadius = width / 2;\n if (orientation === 'Vertical') {\n var addValue = ((containerWidth + ((containerWidth / 2) / Math.PI)) - bottomRadius);\n var y1_1 = (type === 'bar') ? location.y + addValue : location.y;\n var locY = (type === 'bar') ? location.y + (topRadius - (topRadius / Math.PI)) : location.y;\n var locHeight = location.height;\n path = 'M' + location.x + ' ' + (y1_1 + locHeight) +\n ' A ' + bottomRadius + ' ' + bottomRadius + ', 0, 1, 0, ' + (location.x + location.width) + ' ' + (y1_1 + locHeight) +\n ' L ' + (location.x + location.width) + ' ' + locY +\n ' A ' + topRadius + ' ' + topRadius + ', 0, 1, 0, ' + location.x + ' ' + locY + ' z ';\n }\n else {\n var x1_1 = (type === 'bar' && !axis.isInversed) ?\n location.x - ((containerWidth + ((containerWidth / 2) / Math.PI)) - bottomRadius) : location.x;\n var locWidth = (type === 'bar') ? (location.width - (topRadius - ((topRadius / Math.PI)))) : location.width;\n path = 'M' + x1_1 + ' ' + (location.y) +\n ' A ' + bottomRadius + ' ' + bottomRadius + ', 0, 1, 0, ' + x1_1 + ' ' + (location.y + location.height) +\n ' L ' + ((type === 'bar' ? location.x : x1_1) + locWidth) + ' ' + (location.y + location.height) +\n ' A ' + topRadius + ' ' + topRadius + ', 0, 1, 0, ' +\n ((type === 'bar' ? location.x : x1_1) + locWidth) + ' ' + (location.y) + ' z ';\n }\n break;\n }\n return path;\n}\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n/**\n * Helper functions for maps control\n */\nimport { SvgRenderer, createElement, isNullOrUndefined, remove, compile as templateComplier, merge } from '@syncfusion/ej2-base';\nimport { Animation } from '@syncfusion/ej2-base';\nimport { animationComplete } from '../index';\n/**\n * Maps internal use of `Size` type\n * @private\n */\nvar Size = /** @class */ (function () {\n function Size(width, height) {\n this.width = width;\n this.height = height;\n }\n return Size;\n}());\nexport { Size };\n/**\n * To find number from string\n * @private\n */\nexport function stringToNumber(value, containerSize) {\n if (value !== null && value !== undefined) {\n return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);\n }\n return null;\n}\n/**\n * Method to calculate the width and height of the maps\n */\nexport function calculateSize(maps) {\n var containerWidth = maps.element.clientWidth;\n var containerHeight = maps.element.clientHeight;\n maps.availableSize = new Size(stringToNumber(maps.width, containerWidth) || containerWidth || 600, stringToNumber(maps.height, containerHeight) || containerHeight || (maps.isDevice ?\n Math.min(window.innerWidth, window.innerHeight) : 450));\n}\n/**\n * Method to create svg for maps.\n */\nexport function createSvg(maps) {\n maps.renderer = new SvgRenderer(maps.element.id);\n calculateSize(maps);\n maps.svgObject = maps.renderer.createSvg({\n id: maps.element.id + '_svg',\n width: maps.availableSize.width,\n height: maps.availableSize.height\n });\n}\n/**\n * Method to convert degrees to radians\n */\nexport function degreesToRadians(deg) {\n return deg * (Math.PI / 180);\n}\n/**\n * Convert radians to degrees method\n */\nexport function radiansToDegrees(radian) {\n return radian * (180 / Math.PI);\n}\n/**\n * Method for converting from latitude and longitude values to points\n */\nexport function convertGeoToPoint(latitude, longitude, factor, layer, mapModel) {\n var mapSize = new Size(mapModel.mapAreaRect.width, mapModel.mapAreaRect.height);\n var x;\n var y;\n var value;\n var lat;\n var lng;\n var temp;\n var longitudeMinMax = mapModel.baseMapBounds.longitude;\n var latitudeMinMax = mapModel.baseMapBounds.latitude;\n var latRadian = degreesToRadians(latitude);\n var lngRadian = degreesToRadians(longitude);\n var type = mapModel.projectionType;\n var size = (mapModel.isTileMap) ? Math.pow(2, 1) * 256 : (isNullOrUndefined(factor)) ? Math.min(mapSize.width, mapSize.height) :\n (Math.min(mapSize.width, mapSize.height) * factor);\n if (layer.geometryType === 'Normal') {\n x = isNullOrUndefined(factor) ? longitude : Math.abs((longitude - longitudeMinMax.min) * factor);\n y = isNullOrUndefined(factor) ? latitude : Math.abs((latitudeMinMax.max - latitude) * factor);\n }\n else if (layer.geometryType === 'Geographic') {\n switch (type) {\n case 'Mercator':\n var pixelOrigin = new Point(size / 2, size / 2);\n x = pixelOrigin.x + longitude * (size / 360);\n var sinY = calculateBound(Math.sin(degreesToRadians(latitude)), -0.9999, 0.9999);\n y = pixelOrigin.y + 0.5 * (Math.log((1 + sinY) / (1 - sinY))) * (-(size / (2 * Math.PI)));\n break;\n case 'Winkel3':\n value = aitoff(lngRadian, latRadian);\n lng = (value.x + lngRadian / (Math.PI / 2)) / 2;\n lat = (value.y + latRadian) / 2;\n break;\n case 'Miller':\n lng = lngRadian;\n lat = (1.25 * Math.log(Math.tan((Math.PI / 4) + (.4 * latRadian))));\n break;\n case 'Eckert3':\n temp = Math.sqrt(Math.PI * (4 + Math.PI));\n lng = 2 / temp * lngRadian * (1 + Math.sqrt(1 - 4 * latRadian * latRadian / (Math.PI * Math.PI)));\n lat = 4 / temp * latRadian;\n break;\n case 'AitOff':\n value = aitoff(lngRadian, latRadian);\n lng = value.x;\n lat = value.y;\n break;\n case 'Eckert5':\n lng = lngRadian * (1 + Math.cos(latRadian)) / Math.sqrt(2 + Math.PI);\n lat = 2 * latRadian / Math.sqrt(2 + Math.PI);\n break;\n case 'Equirectangular':\n lng = lngRadian;\n lat = latRadian;\n break;\n case 'Eckert6':\n var epsilon = 1e-6;\n temp = (1 + (Math.PI / 2)) * Math.sin(latRadian);\n var delta = Infinity;\n for (var i = 0; i < 10 && Math.abs(delta) > epsilon; i++) {\n delta = (latRadian + (Math.sin(latRadian)) - temp) / (1 + Math.cos(latRadian));\n latRadian = latRadian - delta;\n }\n temp = Math.sqrt(2 + Math.PI);\n lng = lngRadian * (1 + Math.cos(latRadian)) / temp;\n lat = 2 * latRadian / temp;\n break;\n }\n x = (type === 'Mercator') ? x : roundTo(xToCoordinate(mapModel, radiansToDegrees(lng)), 3);\n y = (type === 'Mercator') ? y : (-(roundTo(yToCoordinate(mapModel, radiansToDegrees(lat)), 3)));\n }\n return new Point(x, y);\n}\n/**\n * Converting tile latitude and longitude to point\n */\nexport function convertTileLatLongToPoint(center, zoomLevel, tileTranslatePoint, isMapCoordinates) {\n var size = Math.pow(2, zoomLevel) * 256;\n var x = (center.x + 180) / 360;\n var sinLatitude = Math.sin(center.y * Math.PI / 180);\n var y = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);\n var pixelX = center.x;\n var pixelY = center.y;\n if (isMapCoordinates) {\n pixelX = (x * size + 0.5) + tileTranslatePoint.x;\n pixelY = (y * size + 0.5) + tileTranslatePoint.y;\n }\n return { x: pixelX, y: pixelY };\n}\n/**\n * Method for calculate x point\n */\nexport function xToCoordinate(mapObject, val) {\n var longitudeMinMax = mapObject.baseMapBounds.longitude;\n var totalSize = isNullOrUndefined(mapObject.baseSize) ? mapObject.mapAreaRect.width : mapObject.mapAreaRect.width +\n (Math.abs(mapObject.baseSize.width - mapObject.mapAreaRect.width) / 2);\n return Math.round(totalSize * (val - longitudeMinMax.min) / (longitudeMinMax.max - longitudeMinMax.min) * 100) / 100;\n}\n/**\n * Method for calculate y point\n */\nexport function yToCoordinate(mapObject, val) {\n var latitudeMinMax = mapObject.baseMapBounds.latitude;\n return Math.round(mapObject.mapAreaRect.height * (val - latitudeMinMax.min) / (latitudeMinMax.max - latitudeMinMax.min) * 100) / 100;\n}\n/**\n * Method for calculate aitoff projection\n */\nexport function aitoff(x, y) {\n var cosy = Math.cos(y);\n var sincia = sinci(acos(cosy * Math.cos(x /= 2)));\n return new Point(2 * cosy * Math.sin(x) * sincia, Math.sin(y) * sincia);\n}\n/**\n * Method to round the number\n */\nexport function roundTo(a, b) {\n var c = Math.pow(10, b);\n return (Math.round(a * c) / c);\n}\nexport function sinci(x) {\n return x / Math.sin(x);\n}\nexport function acos(a) {\n return Math.acos(a);\n}\n/**\n * Method to calculate bound\n */\nexport function calculateBound(value, min, max) {\n if (!isNullOrUndefined(min)) {\n value = Math.max(value, min);\n }\n if (!(isNullOrUndefined(max))) {\n value = Math.min(value, max);\n }\n return value;\n}\n/**\n * Map internal class for point\n */\nvar Point = /** @class */ (function () {\n function Point(x, y) {\n this.x = x;\n this.y = y;\n }\n return Point;\n}());\nexport { Point };\n/**\n * Map internal class for min and max\n *\n */\nvar MinMax = /** @class */ (function () {\n function MinMax(min, max) {\n this.min = min;\n this.max = max;\n }\n return MinMax;\n}());\nexport { MinMax };\n/**\n * Map internal class locations\n */\nvar GeoLocation = /** @class */ (function () {\n function GeoLocation(latitude, longitude) {\n this.latitude = new MinMax(latitude.min, latitude.max);\n this.longitude = new MinMax(longitude.min, longitude.max);\n }\n return GeoLocation;\n}());\nexport { GeoLocation };\n/**\n * Function to measure the height and width of the text.\n * @param {string} text\n * @param {FontModel} font\n * @param {string} id\n * @returns no\n * @private\n */\nexport function measureText(text, font) {\n var htmlObject = document.getElementById('mapsmeasuretext');\n if (htmlObject === null) {\n htmlObject = createElement('text', { id: 'mapsmeasuretext' });\n document.body.appendChild(htmlObject);\n }\n htmlObject.innerHTML = text;\n htmlObject.style.position = 'absolute';\n htmlObject.style.fontSize = font.size;\n htmlObject.style.fontWeight = font.fontWeight;\n htmlObject.style.fontStyle = font.fontStyle;\n htmlObject.style.fontFamily = font.fontFamily;\n htmlObject.style.visibility = 'hidden';\n htmlObject.style.top = '-100';\n htmlObject.style.left = '0';\n htmlObject.style.whiteSpace = 'nowrap';\n // For bootstrap line height issue\n htmlObject.style.lineHeight = 'normal';\n return new Size(htmlObject.clientWidth, htmlObject.clientHeight);\n}\n/**\n * Internal use of text options\n * @private\n */\nvar TextOption = /** @class */ (function () {\n function TextOption(id, x, y, anchor, text, transform, baseLine) {\n if (transform === void 0) { transform = ''; }\n this.transform = '';\n this.baseLine = 'auto';\n this.id = id;\n this.x = x;\n this.y = y;\n this.anchor = anchor;\n this.text = text;\n this.transform = transform;\n this.baseLine = baseLine;\n }\n return TextOption;\n}());\nexport { TextOption };\n/**\n * Internal use of path options\n * @private\n */\nvar PathOption = /** @class */ (function () {\n function PathOption(id, fill, width, color, opacity, dashArray, d) {\n this.id = id;\n this.opacity = opacity;\n this.fill = fill;\n this.stroke = color;\n this['stroke-width'] = width;\n this['stroke-dasharray'] = dashArray;\n this.d = d;\n }\n return PathOption;\n}());\nexport { PathOption };\n/**\n * Internal use of rectangle options\n * @private\n */\nvar RectOption = /** @class */ (function (_super) {\n __extends(RectOption, _super);\n function RectOption(id, fill, border, opacity, rect, rx, ry, transform, dashArray) {\n var _this = _super.call(this, id, fill, border.width, border.color, opacity, dashArray) || this;\n _this.y = rect.y;\n _this.x = rect.x;\n _this.height = rect.height;\n _this.width = rect.width;\n _this.rx = rx ? rx : 0;\n _this.ry = ry ? ry : 0;\n _this.transform = transform ? transform : '';\n _this['stroke-dasharray'] = dashArray;\n return _this;\n }\n return RectOption;\n}(PathOption));\nexport { RectOption };\n/**\n * Internal use of circle options\n * @private\n */\nvar CircleOption = /** @class */ (function (_super) {\n __extends(CircleOption, _super);\n function CircleOption(id, fill, border, opacity, cx, cy, r, dashArray) {\n var _this = _super.call(this, id, fill, border.width, border.color, opacity) || this;\n _this.cy = cy;\n _this.cx = cx;\n _this.r = r;\n _this['stroke-dasharray'] = dashArray;\n return _this;\n }\n return CircleOption;\n}(PathOption));\nexport { CircleOption };\n/**\n * Internal use of polygon options\n * @private\n */\nvar PolygonOption = /** @class */ (function (_super) {\n __extends(PolygonOption, _super);\n function PolygonOption(id, points, fill, width, color, opacity, dashArray) {\n if (opacity === void 0) { opacity = 1; }\n if (dashArray === void 0) { dashArray = ''; }\n var _this = _super.call(this, id, fill, width, color, opacity, dashArray) || this;\n _this.points = points;\n return _this;\n }\n return PolygonOption;\n}(PathOption));\nexport { PolygonOption };\n/**\n * Internal use of polyline options\n * @private\n */\nvar PolylineOption = /** @class */ (function (_super) {\n __extends(PolylineOption, _super);\n function PolylineOption(id, points, fill, width, color, opacity, dashArray) {\n if (opacity === void 0) { opacity = 1; }\n if (dashArray === void 0) { dashArray = ''; }\n return _super.call(this, id, points, fill, width, color, opacity, dashArray) || this;\n }\n return PolylineOption;\n}(PolygonOption));\nexport { PolylineOption };\n/**\n * Internal use of line options\n * @private\n */\nvar LineOption = /** @class */ (function (_super) {\n __extends(LineOption, _super);\n function LineOption(id, line, fill, width, color, opacity, dashArray) {\n if (opacity === void 0) { opacity = 1; }\n if (dashArray === void 0) { dashArray = ''; }\n var _this = _super.call(this, id, fill, width, color, opacity, dashArray) || this;\n _this.x1 = line.x1;\n _this.y1 = line.y1;\n _this.x2 = line.x2;\n _this.y2 = line.y2;\n return _this;\n }\n return LineOption;\n}(PathOption));\nexport { LineOption };\n/**\n * Internal use of line\n * @property\n */\nvar Line = /** @class */ (function () {\n function Line(x1, y1, x2, y2) {\n this.x1 = x1;\n this.y1 = y1;\n this.x2 = x2;\n this.y2 = y2;\n }\n return Line;\n}());\nexport { Line };\n/**\n * Internal use of map location type\n * @private\n */\nvar MapLocation = /** @class */ (function () {\n function MapLocation(x, y) {\n this.x = x;\n this.y = y;\n }\n return MapLocation;\n}());\nexport { MapLocation };\n/**\n * Internal use of type rect\n * @private\n */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n return Rect;\n}());\nexport { Rect };\n/**\n * Internal use for pattern creation.\n * @property\n */\nvar PatternOptions = /** @class */ (function () {\n function PatternOptions(id, x, y, width, height, patternUnits, patternContentUnits, patternTransform, href) {\n if (patternUnits === void 0) { patternUnits = 'userSpaceOnUse'; }\n if (patternContentUnits === void 0) { patternContentUnits = 'userSpaceOnUse'; }\n if (patternTransform === void 0) { patternTransform = ''; }\n if (href === void 0) { href = ''; }\n this.id = id;\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.patternUnits = patternUnits;\n this.patternContentUnits = patternContentUnits;\n this.patternTransform = patternTransform;\n this.href = href;\n }\n return PatternOptions;\n}());\nexport { PatternOptions };\n/**\n * Internal rendering of text\n * @private\n */\nexport function renderTextElement(options, font, color, parent, isMinus) {\n if (isMinus === void 0) { isMinus = false; }\n var renderOptions = {\n 'id': options.id,\n 'x': options.x,\n 'y': options.y,\n 'fill': color,\n 'font-size': font.size,\n 'font-style': font.fontStyle,\n 'font-family': font.fontFamily,\n 'font-weight': font.fontWeight,\n 'text-anchor': options.anchor,\n 'transform': options.transform,\n 'opacity': font.opacity,\n 'dominant-baseline': options.baseLine\n };\n var text = typeof options.text === 'string' ? options.text : isMinus ? options.text[options.text.length - 1] : options.text[0];\n var tspanElement;\n var renderer = new SvgRenderer('');\n var height;\n var htmlObject = renderer.createText(renderOptions, text);\n htmlObject.style['user-select'] = 'none';\n htmlObject.style['-moz-user-select'] = 'none';\n htmlObject.style['-webkit-touch-callout'] = 'none';\n htmlObject.style['-webkit-user-select'] = 'none';\n htmlObject.style['-khtml-user-select'] = 'none';\n htmlObject.style['-ms-user-select'] = 'none';\n htmlObject.style['-o-user-select'] = 'none';\n if (typeof options.text !== 'string' && options.text.length > 1) {\n for (var i = 1, len = options.text.length; i < len; i++) {\n height = (measureText(options.text[i], font).height);\n tspanElement = renderer.createTSpan({\n 'x': options.x, 'id': options.id,\n 'y': (options.y) + ((isMinus) ? -(i * height) : (i * height))\n }, isMinus ? options.text[options.text.length - (i + 1)] : options.text[i]);\n htmlObject.appendChild(tspanElement);\n }\n }\n parent.appendChild(htmlObject);\n return htmlObject;\n}\n/**\n * @private\n */\nexport function convertElement(element, markerId, data, index, mapObj) {\n var childElement = createElement('div', {\n id: markerId,\n styles: 'position: absolute;pointer-events: auto;'\n });\n while (element.length > 0) {\n childElement.appendChild(element[0]);\n }\n var templateHtml = childElement.innerHTML;\n var properties = Object.keys(data);\n for (var i = 0; i < properties.length; i++) {\n if (properties[i].toLowerCase() !== 'latitude' && properties[i].toLowerCase() !== 'longitude') {\n templateHtml = templateHtml.replace(new RegExp('{{:' + properties[i] + '}}', 'g'), data[properties[i].toString()]);\n }\n }\n childElement.innerHTML = templateHtml;\n return childElement;\n}\nexport function convertElementFromLabel(element, labelId, data, index, mapObj) {\n var labelEle = isNullOrUndefined(element.childElementCount) ? element[0] : element;\n var templateHtml = labelEle.outerHTML;\n var properties = Object.keys(data);\n for (var i = 0; i < properties.length; i++) {\n templateHtml = templateHtml.replace(new RegExp('{{:' + properties[i] + '}}', 'g'), data[properties[i].toString()]);\n }\n return createElement('div', {\n id: labelId,\n innerHTML: templateHtml,\n styles: 'position: absolute'\n });\n}\n/**\n * Internal use of append shape element\n * @private\n */\nexport function appendShape(shape, element) {\n if (element) {\n element.appendChild(shape);\n }\n return shape;\n}\n/**\n * Internal rendering of Circle\n * @private\n */\nexport function drawCircle(maps, options, element) {\n return appendShape(maps.renderer.drawCircle(options), element);\n}\n/**\n * Internal rendering of Rectangle\n * @private\n */\nexport function drawRectangle(maps, options, element) {\n return appendShape(maps.renderer.drawRectangle(options), element);\n}\n/**\n * Internal rendering of Path\n * @private\n */\nexport function drawPath(maps, options, element) {\n return appendShape(maps.renderer.drawPath(options), element);\n}\n/**\n * Internal rendering of Polygon\n * @private\n */\nexport function drawPolygon(maps, options, element) {\n return appendShape(maps.renderer.drawPolygon(options), element);\n}\n/**\n * Internal rendering of Polyline\n * @private\n */\nexport function drawPolyline(maps, options, element) {\n return appendShape(maps.renderer.drawPolyline(options), element);\n}\n/**\n * Internal rendering of Line\n * @private\n */\nexport function drawLine(maps, options, element) {\n return appendShape(maps.renderer.drawLine(options), element);\n}\n/**\n * @private\n * Calculate marker shapes\n */\nexport function calculateShapes(maps, shape, options, size, location, markerEle) {\n var tempGroup;\n switch (shape) {\n case 'Balloon':\n tempGroup = drawBalloon(maps, options, size, location, markerEle);\n break;\n case 'Cross':\n options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' + (location.y + size.height\n / 2) + ' M ' + (location.x - size.width / 2) + ' ' + location.y + ' L ' + (location.x + size.width / 2) + ' ' + location.y;\n break;\n case 'Diamond':\n options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + (location.x + size.width / 2) + ' '\n + location.y + ' L ' + location.x + ' ' + (location.y + size.height / 2) + ' L ' + (location.x - size.width / 2)\n + ' ' + location.y + ' Z';\n break;\n case 'Star':\n options.d = 'M ' + (location.x + size.width / 3) + ' ' + (location.y - size.height / 2) + ' L ' + (location.x - size.width / 2)\n + ' ' + (location.y + size.height / 6) + ' L ' + (location.x + size.width / 2) + ' ' + (location.y + size.height / 6)\n + ' L ' + (location.x - size.width / 3) + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' +\n (location.y + size.height / 2) + ' L ' + (location.x + size.width / 3) + ' ' + (location.y - size.height / 2) + ' Z';\n break;\n case 'Triangle':\n options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + (location.x + size.width / 2) + ' ' +\n (location.y + size.height / 2) + ' L ' + (location.x - size.width / 2) + ' ' + (location.y + size.height / 2) + ' Z';\n break;\n case 'HorizontalLine':\n options.d = ' M ' + (location.x - size.width / 2) + ' ' + location.y + ' L ' + (location.x + size.width / 2) + ' '\n + location.y;\n break;\n case 'VerticalLine':\n options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' +\n (location.y + size.height / 2);\n break;\n }\n return shape === 'Balloon' ? tempGroup : maps.renderer.drawPath(options);\n}\n/**\n * Internal rendering of Diamond\n * @private\n */\nexport function drawDiamond(maps, options, size, location, element) {\n options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + (location.x + size.width / 2) + ' ' + location.y +\n ' L ' + location.x + ' ' + (location.y + size.height / 2) + ' L ' + (location.x - size.width / 2) + ' ' + location.y + ' Z';\n return appendShape(maps.renderer.drawPath(options), element);\n}\n/**\n * Internal rendering of Triangle\n * @private\n */\nexport function drawTriangle(maps, options, size, location, element) {\n options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + (location.x + size.width / 2) + ' ' +\n (location.y + size.height / 2) + ' L ' + (location.x - size.width / 2) + ' ' + (location.y + size.height / 2) + ' Z';\n return appendShape(maps.renderer.drawPath(options), element);\n}\n/**\n * Internal rendering of Cross\n * @private\n */\nexport function drawCross(maps, options, size, location, element) {\n options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' + (location.y + size.height / 2) +\n ' M ' + (location.x - size.width / 2) + ' ' + location.y + ' L ' + (location.x + size.width / 2) + ' ' + location.y;\n return appendShape(maps.renderer.drawPath(options), element);\n}\n/**\n * Internal rendering of HorizontalLine\n * @private\n */\nexport function drawHorizontalLine(maps, options, size, location, element) {\n options.d = ' M ' + (location.x - size.width / 2) + ' ' + location.y + ' L ' + (location.x + size.width / 2) + ' ' + location.y;\n return appendShape(maps.renderer.drawPath(options), element);\n}\n/**\n * Internal rendering of VerticalLine\n * @private\n */\nexport function drawVerticalLine(maps, options, size, location, element) {\n options.d = 'M ' + location.x + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' + (location.y + size.height / 2);\n return appendShape(maps.renderer.drawPath(options), element);\n}\n/**\n * Internal rendering of Star\n * @private\n */\nexport function drawStar(maps, options, size, location, element) {\n options.d = 'M ' + (location.x + size.width / 3) + ' ' + (location.y - size.height / 2) + ' L ' + (location.x - size.width / 2)\n + ' ' + (location.y + size.height / 6) + ' L ' + (location.x + size.width / 2) + ' ' + (location.y + size.height / 6) + ' L '\n + (location.x - size.width / 3) + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' + (location.y + size.height / 2)\n + ' L ' + (location.x + size.width / 3) + ' ' + (location.y - size.height / 2) + ' Z';\n return appendShape(maps.renderer.drawPath(options), element);\n}\n/**\n * Internal rendering of Balloon\n * @private\n */\nexport function drawBalloon(maps, options, size, location, element) {\n var width = size.width;\n var height = size.height;\n var padding = 5;\n location.x -= width / 2;\n location.y -= height;\n options.d = 'M15,0C8.8,0,3.8,5,3.8,11.2C3.8,17.5,9.4,24.4,15,30c5.6-5.6,11.2-12.5,11.2-18.8C26.2,5,21.2,0,15,0z M15,16' +\n 'c-2.8,0-5-2.2-5-5s2.2-5,5-5s5,2.2,5,5S17.8,16,15,16z';\n var balloon = maps.renderer.drawPath(options);\n var x = size.width / 22.5;\n var y = size.height / 30;\n balloon.setAttribute('transform', 'translate(' + location.x + ', ' + location.y + ') scale(' + x + ', ' + y + ')');\n var g = maps.renderer.createGroup({ id: options.id });\n appendShape(balloon, g);\n return appendShape(g, element);\n}\n/**\n * Internal rendering of Pattern\n * @private\n */\nexport function drawPattern(maps, options, elements, element) {\n var pattern = maps.renderer.createPattern(options, 'pattern');\n for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n var ele = elements_1[_i];\n appendShape(ele, pattern);\n }\n return appendShape(pattern, element);\n}\n/**\n * Method to get specific field and vaues from data.\n * @private\n */\n// tslint:disable:no-any\nexport function getFieldData(dataSource, fields) {\n var newData = [];\n var data;\n for (var _i = 0, dataSource_1 = dataSource; _i < dataSource_1.length; _i++) {\n var temp = dataSource_1[_i];\n data = {};\n for (var _a = 0, fields_1 = fields; _a < fields_1.length; _a++) {\n var field = fields_1[_a];\n if (temp[field]) {\n data[field] = temp[field];\n }\n }\n newData.push(data);\n }\n return newData;\n}\n/**\n * To find the index of dataSource from shape properties\n */\n// tslint:disable:no-string-literal\nexport function checkShapeDataFields(dataSource, properties, dataPath, propertyPath) {\n if (!(isNullOrUndefined(properties))) {\n for (var i = 0; i < dataSource.length; i++) {\n if (dataSource[i][dataPath] === properties[propertyPath]) {\n return i;\n }\n }\n }\n return null;\n}\nexport function filter(points, start, end) {\n var pointObject = [];\n for (var i = 0; i < points.length; i++) {\n var point = points[i];\n if (start <= point.y && end >= point.y) {\n pointObject.push(point);\n }\n }\n return pointObject;\n}\n/**\n * To find the midpoint of the polygon from points\n */\nexport function findMidPointOfPolygon(points) {\n if (!points.length) {\n return null;\n }\n var min = 0;\n var max = points.length;\n var startX;\n var startY;\n var startX1;\n var startY1;\n var sum = 0;\n var xSum = 0;\n var ySum = 0;\n for (var i = min; i <= max - 1; i++) {\n startX = points[i].x;\n startY = points[i].y;\n if (i === max - 1) {\n startX1 = points[0].x;\n startY1 = points[0].y;\n }\n else {\n startX1 = points[i + 1].x;\n startY1 = points[i + 1].y;\n }\n sum = sum + Math.abs(((startX * startY1)) - (startX1 * startY));\n xSum = xSum + Math.abs(((startX + startX1) * (((startX * startY1) - (startX1 * startY)))));\n ySum = ySum + Math.abs(((startY + startY1) * (((startX * startY1) - (startX1 * startY)))));\n }\n sum = 0.5 * sum;\n xSum = (1 / (4 * sum)) * xSum;\n ySum = (1 / (4 * sum)) * ySum;\n /* Code for finding nearest points in polygon related to midPoint*/\n var rightMinPoint = { x: 0, y: 0 };\n var rightMaxPoint = { x: 0, y: 0 };\n var leftMinPoint = { x: 0, y: 0 };\n var leftMaxPoint = { x: 0, y: 0 };\n var bottomMinPoint = { x: 0, y: 0 };\n var bottomMaxPoint = { x: 0, y: 0 };\n var topMinPoint = { x: 0, y: 0 };\n var topMaxPoint = { x: 0, y: 0 };\n var height = 0;\n for (var i = min; i <= max - 1; i++) {\n var point = points[i];\n if (point.y > ySum) {\n if (point.x < xSum && xSum - point.x < xSum - bottomMinPoint.x) {\n bottomMinPoint = { x: point.x, y: point.y };\n }\n else if (point.x > xSum && (bottomMaxPoint.x === 0 || point.x - xSum < bottomMaxPoint.x - xSum)) {\n bottomMaxPoint = { x: point.x, y: point.y };\n }\n }\n else {\n if (point.x < xSum && xSum - point.x < xSum - topMinPoint.x) {\n topMinPoint = { x: point.x, y: point.y };\n }\n else if (point.x > xSum && (topMaxPoint.x === 0 || point.x - xSum < topMaxPoint.x - xSum)) {\n topMaxPoint = { x: point.x, y: point.y };\n }\n }\n height = (bottomMaxPoint.y - topMaxPoint.y) + ((bottomMaxPoint.y - topMaxPoint.y) / 4);\n if (point.x > xSum) {\n if (point.y < ySum && ySum - point.y < ySum - rightMinPoint.y) {\n rightMinPoint = { x: point.x, y: point.y };\n }\n else if (point.y > ySum && (rightMaxPoint.y === 0 || point.y - ySum < rightMaxPoint.y - ySum)) {\n rightMaxPoint = { x: point.x, y: point.y };\n }\n }\n else {\n if (point.y < ySum && ySum - point.y < ySum - leftMinPoint.y) {\n leftMinPoint = { x: point.x, y: point.y };\n }\n else if (point.y > ySum && (leftMaxPoint.y === 0 || point.y - ySum < leftMaxPoint.y - ySum)) {\n leftMaxPoint = { x: point.x, y: point.y };\n }\n }\n }\n return {\n x: xSum, y: ySum, rightMin: rightMinPoint, rightMax: rightMaxPoint,\n leftMin: leftMinPoint, leftMax: leftMaxPoint, points: points, topMax: topMaxPoint, topMin: topMinPoint,\n bottomMax: bottomMaxPoint, bottomMin: bottomMinPoint, height: height\n };\n}\n/**\n * @private\n * Check custom path\n */\n/* tslint:disable:no-string-literal */\nexport function isCustomPath(layerData) {\n var customPath = false;\n if (Object.prototype.toString.call(layerData) === '[object Array]') {\n layerData.forEach(function (layer, index) {\n if (!isNullOrUndefined(layer['geometry']) && layer['geometry']['type'] === 'Path') {\n customPath = true;\n }\n });\n }\n return customPath;\n}\n/**\n * @private\n * Trim the title text\n */\nexport function textTrim(maxWidth, text, font) {\n var label = text;\n var size = measureText(text, font).width;\n if (size > maxWidth) {\n var textLength = text.length;\n for (var i = textLength - 1; i >= 0; --i) {\n label = text.substring(0, i) + '...';\n size = measureText(label, font).width;\n if (size <= maxWidth || label.length < 4) {\n if (label.length < 4) {\n label = ' ';\n }\n return label;\n }\n }\n }\n return label;\n}\n/**\n * Method to calculate x position of title\n */\nexport function findPosition(location, alignment, textSize, type) {\n var x;\n var y;\n switch (alignment) {\n case 'Near':\n x = location.x;\n break;\n case 'Center':\n x = (type === 'title') ? (location.width / 2 - textSize.width / 2) :\n ((location.x + (location.width / 2)) - textSize.width / 2);\n break;\n case 'Far':\n x = (type === 'title') ? (location.width - location.y - textSize.width) :\n ((location.x + location.width) - textSize.width);\n break;\n }\n y = (type === 'title') ? location.y + (textSize.height / 2) : ((location.y + location.height / 2) + textSize.height / 2);\n return new Point(x, y);\n}\n/**\n * To remove element by id\n */\nexport function removeElement(id) {\n var element = document.getElementById(id);\n return element ? remove(element) : null;\n}\n/**\n * @private\n */\nexport function getTranslate(mapObject, layer, animate) {\n var zoomFactor = animate ? 1 : mapObject.zoomSettings.zoomFactor;\n var min = mapObject.baseMapRectBounds['min'];\n var max = mapObject.baseMapRectBounds['max'];\n var size = mapObject.mapAreaRect;\n var availSize = mapObject.availableSize;\n var x;\n var y;\n var mapWidth = Math.abs(max['x'] - min['x']);\n var mapHeight = Math.abs(min['y'] - max['y']);\n var factor = animate ? 1 : mapObject.zoomSettings.zoomFactor;\n var scaleFactor;\n var scaleX;\n var scaleY;\n var center = mapObject.centerPosition;\n if (!isNullOrUndefined(center.longitude) && !isNullOrUndefined(center.latitude)) {\n var leftPosition = ((mapWidth + Math.abs(mapObject.mapAreaRect.width - mapWidth)) / 2) / factor;\n var topPosition = ((mapHeight + Math.abs(mapObject.mapAreaRect.height - mapHeight)) / 2) / factor;\n var point = convertGeoToPoint(center.latitude, center.longitude, mapObject.mapLayerPanel.calculateFactor(layer), layer, mapObject);\n x = -point.x + leftPosition;\n y = -point.y + topPosition;\n scaleFactor = zoomFactor;\n }\n else {\n scaleFactor = parseFloat(Math.min(size.width / mapWidth, size.height / mapHeight).toFixed(2));\n mapWidth *= scaleFactor;\n mapHeight *= scaleFactor;\n x = size.x + ((-(min['x'])) + ((size.width / 2) - (mapWidth / 2)));\n y = size.y + ((-(min['y'])) + ((size.height / 2) - (mapHeight / 2)));\n }\n return { scale: scaleFactor, location: new Point(x, y) };\n}\n/**\n * To get the html element by specified id\n */\nexport function getElementByID(id) {\n return document.getElementById(id);\n}\n/**\n * To apply internalization\n */\nexport function Internalize(maps, value) {\n maps.formatFunction =\n maps.intl.getNumberFormat({ format: maps.format, useGrouping: maps.useGroupingSeparator });\n return maps.formatFunction(value);\n}\n/**\n * Function to compile the template function for maps.\n * @returns Function\n * @private\n */\nexport function getTemplateFunction(template) {\n var templateFn = null;\n var e;\n try {\n if (document.querySelectorAll(template).length) {\n templateFn = templateComplier(document.querySelector(template).innerHTML.trim());\n }\n }\n catch (e) {\n templateFn = templateComplier(template);\n }\n return templateFn;\n}\n/**\n * Function to get element from id.\n * @returns Element\n * @private\n */\nexport function getElement(id) {\n return document.getElementById(id);\n}\n/**\n * Function to get shape data using target id\n */\nexport function getShapeData(targetId, map) {\n var layerIndex = parseInt(targetId.split('_LayerIndex_')[1].split('_')[0], 10);\n var shapeIndex = parseInt(targetId.split('_ShapeIndex_')[1].split('_')[0], 10);\n var layer = map.layers[layerIndex];\n var shapeData = layer.layerData[shapeIndex]['property'];\n var data;\n if (layer.dataSource) {\n data = layer.dataSource[checkShapeDataFields(layer.dataSource, shapeData, layer.shapeDataPath, layer.shapePropertyPath)];\n }\n return { shapeData: shapeData, data: data };\n}\n/**\n * Function to trigger shapeSelected event\n * @private\n */\nexport function triggerShapeEvent(targetId, selection, maps, eventName) {\n var shape = getShapeData(targetId, maps);\n var eventArgs = {\n cancel: false,\n name: eventName,\n fill: selection.fill,\n opacity: selection.opacity,\n border: selection.border,\n shapeData: shape.shapeData,\n data: shape.data,\n target: targetId\n };\n maps.trigger(eventName, eventArgs);\n return eventArgs;\n}\n/**\n * Function to get elements using class name\n */\nexport function getElementsByClassName(className) {\n return document.getElementsByClassName(className);\n}\n/**\n * Function to get elements using querySelectorAll\n */\n// export function querySelectorAll(args: string, element: Element): NodeListOf {\n// return element.querySelectorAll('.' + args);\n// }\n/**\n * Function to get elements using querySelector\n */\nexport function querySelector(args, elementSelector) {\n var targetEle = null;\n if (document.getElementById(elementSelector)) {\n targetEle = document.getElementById(elementSelector).querySelector('#' + args);\n }\n return targetEle;\n}\n/**\n * Function to get the element for selection and highlight using public method\n */\nexport function getTargetElement(layerIndex, name, enable, map) {\n var shapeIndex;\n var targetId;\n var targetEle;\n var shapeData = map.layers[layerIndex].shapeData['features'];\n for (var i = 0; i < shapeData.length; i++) {\n if (shapeData[i]['properties'].name === name) {\n targetId = map.element.id + '_' + 'LayerIndex_' + layerIndex + '_ShapeIndex_' + i + '_dataIndex_undefined';\n break;\n }\n }\n targetEle = getElement(targetId);\n return targetEle;\n}\n/**\n * Function to create style element for highlight and selection\n */\nexport function createStyle(id, className, eventArgs) {\n return createElement('style', {\n id: id, innerHTML: '.' + className + '{fill:'\n + eventArgs.fill + ';' + 'opacity:' + eventArgs.opacity.toString() + ';' +\n '}'\n });\n}\n/**\n * Function to customize the style for highlight and selection\n */\nexport function customizeStyle(id, className, eventArgs) {\n var styleEle = getElement(id);\n styleEle.innerHTML = '.' + className + '{fill:'\n + eventArgs.fill + ';' + 'opacity:' + eventArgs.opacity.toString() + ';' +\n 'stroke-width:' + eventArgs.border.width.toString() +\n 'stroke-color:' + eventArgs.border.color + '}';\n}\n/**\n * Function to remove class from element\n */\nexport function removeClass(element) {\n element.removeAttribute('class');\n}\n/**\n * Animation Effect Calculation End\n * @private\n */\nexport function elementAnimate(element, delay, duration, point, maps, ele, radius) {\n if (radius === void 0) { radius = 0; }\n var centerX = point.x;\n var centerY = point.y;\n var height = 0;\n var transform = element.getAttribute('transform') || '';\n new Animation({}).animate(element, {\n duration: duration,\n delay: delay,\n progress: function (args) {\n if (args.timeStamp > args.delay) {\n height = ((args.timeStamp - args.delay) / args.duration);\n element.setAttribute('transform', 'translate( ' + (centerX - (radius * height)) + ' ' + (centerY - (radius * height)) +\n ' ) scale(' + height + ')');\n }\n },\n end: function (model) {\n element.setAttribute('transform', transform);\n if (!ele) {\n return;\n }\n var event = {\n cancel: false, name: animationComplete, element: ele, maps: maps\n };\n maps.trigger(animationComplete, event);\n }\n });\n}\nexport function timeout(id) {\n removeElement(id);\n}\nexport function showTooltip(text, size, x, y, areaWidth, areaHeight, id, element, isTouch) {\n var tooltip = document.getElementById(id);\n var width = measureText(text, {\n fontFamily: 'Segoe UI', size: '8px',\n fontStyle: 'Normal', fontWeight: 'Regular'\n }).width;\n var str = text.split(' ');\n var demo = str[0].length;\n for (var i = 1; i < str.length; i++) {\n if (demo < str[i].length) {\n demo = str[i].length;\n }\n }\n if (!tooltip) {\n tooltip = createElement('div', {\n id: id,\n styles: 'background-color: rgb(255, 255, 255) !important; color:black !important; ' +\n 'position:absolute;border:1px solid rgb(0, 0, 0); padding-left:5px;' +\n 'font-size:12px; font-family: \"Segoe UI\"; text-align:center'\n });\n }\n if (x < (areaWidth - width)) {\n x = x;\n }\n else if (x > (areaWidth - width) && x < areaWidth - (demo * 8)) {\n width = (areaWidth - x);\n }\n else if (x >= areaWidth - demo * 8) {\n if (x > width) {\n x = x - width;\n }\n else {\n width = x;\n x = 0;\n }\n }\n var size1 = size.split('px');\n wordWrap(tooltip, text, x, y, size1, width, areaWidth, element);\n var height = tooltip.clientHeight;\n if ((height + parseInt(size1[0], 10) * 2) > areaHeight) {\n width = x;\n x = 0;\n }\n wordWrap(tooltip, text, x, y, size1, width, areaWidth, element);\n if (isTouch) {\n setTimeout(timeout, 5000, id);\n }\n}\nexport function wordWrap(tooltip, text, x, y, size1, width, areaWidth, element) {\n tooltip.innerHTML = text;\n tooltip.style.top = (parseInt(size1[0], 10) * 2).toString() + 'px';\n tooltip.style.left = (x).toString() + 'px';\n tooltip.style.width = width.toString() + 'px';\n tooltip.style.maxWidth = (areaWidth).toString() + 'px';\n tooltip.style.wordWrap = 'break-word';\n element.appendChild(tooltip);\n}\n// /**\n// * \n// * @param touchList \n// * @param e \n// * @param touches \n// */\n// export function addTouchPointer(touchList: ITouches[], e: PointerEvent, touches: TouchList): ITouches[] {\n// if (touches) {\n// touchList = [];\n// for (let i: number = 0, length: number = touches.length; i < length; i++) {\n// touchList.push({ pageX: touches[i].clientX, pageY: touches[i].clientY, pointerId: null });\n// }\n// } else {\n// touchList = touchList ? touchList : [];\n// if (touchList.length === 0) {\n// touchList.push({ pageX: e.clientX, pageY: e.clientY, pointerId: e.pointerId });\n// } else {\n// for (let i: number = 0, length: number = touchList.length; i < length; i++) {\n// if (touchList[i].pointerId === e.pointerId) {\n// touchList[i] = { pageX: e.clientX, pageY: e.clientY, pointerId: e.pointerId };\n// } else {\n// touchList.push({ pageX: e.clientX, pageY: e.clientY, pointerId: e.pointerId });\n// }\n// }\n// }\n// }\n// return touchList;\n// }\n/** @private */\nexport function createTooltip(id, text, top, left, fontSize) {\n var tooltip = getElement(id);\n var style = 'top:' + top.toString() + 'px;' +\n 'left:' + left.toString() + 'px;' +\n 'color: #000000; ' +\n 'background:' + '#FFFFFF' + ';' +\n 'position:absolute;border:1px solid #707070;font-size:' + fontSize + ';border-radius:2px;';\n if (!tooltip) {\n tooltip = createElement('div', {\n id: id, innerHTML: ' ' + text + ' ', styles: style\n });\n document.body.appendChild(tooltip);\n }\n else {\n tooltip.setAttribute('innerHTML', ' ' + text + ' ');\n tooltip.setAttribute('styles', style);\n }\n}\n/** @private */\nexport function drawSymbol(location, shape, size, url, options) {\n var functionName = 'Path';\n var renderer = new SvgRenderer('');\n var temp = calculateLegendShapes(location, size, shape, options, url);\n var htmlObject = renderer['draw' + temp.functionName](temp.renderOption);\n return htmlObject;\n}\n/** @private */\nexport function calculateLegendShapes(location, size, shape, options, url) {\n var path;\n var functionName = 'Path';\n var width = size.width;\n var height = size.height;\n var locX = location.x;\n var locY = location.y;\n var x = location.x + (-width / 2);\n var y = location.y + (-height / 2);\n switch (shape) {\n case 'Circle':\n case 'Bubble':\n functionName = 'Ellipse';\n merge(options, { 'rx': width / 2, 'ry': height / 2, 'cx': locX, 'cy': locY });\n break;\n case 'Star':\n path = 'M ' + (location.x + size.width / 3) + ' ' + (location.y - size.height / 2) + ' L ' + (location.x - size.width / 2)\n + ' ' + (location.y + size.height / 6) + ' L ' + (location.x + size.width / 2) + ' ' + (location.y + size.height / 6)\n + ' L ' + (location.x - size.width / 3) + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' +\n (location.y + size.height / 2) + ' L ' + (location.x + size.width / 3) + ' ' + (location.y - size.height / 2) + ' Z';\n merge(options, { 'd': path });\n break;\n case 'Cross':\n path = 'M' + ' ' + x + ' ' + locY + ' ' + 'L' + ' ' + (locX + (width / 2)) + ' ' + locY + ' ' +\n 'M' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + locX + ' ' +\n (locY + (-height / 2));\n merge(options, { 'd': path });\n break;\n case 'HorizontalLine':\n path = 'M' + ' ' + x + ' ' + locY + ' ' + 'L' + ' ' + (locX + (width / 2)) + ' ' + locY;\n merge(options, { 'd': path });\n break;\n case 'VerticalLine':\n path = 'M' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' + 'L' + ' ' + locX + ' ' + (locY + (-height / 2));\n merge(options, { 'd': path });\n break;\n case 'Diamond':\n path = 'M' + ' ' + x + ' ' + locY + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + locY + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + locY + ' z';\n merge(options, { 'd': path });\n break;\n case 'Rectangle':\n path = 'M' + ' ' + x + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (-height / 2)) + ' z';\n merge(options, { 'd': path });\n break;\n case 'Triangle':\n path = 'M' + ' ' + x + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (-height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (locY + (height / 2)) + ' z';\n merge(options, { 'd': path });\n break;\n case 'InvertedTriangle':\n path = 'M' + ' ' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + locX + ' ' + (locY + (height / 2)) + ' ' +\n 'L' + ' ' + (locX - (width / 2)) + ' ' + (locY - (height / 2)) + ' ' +\n 'L' + ' ' + (locX + (width / 2)) + ' ' + (locY - (height / 2)) + ' z';\n merge(options, { 'd': path });\n break;\n case 'Pentagon':\n var eq = 72;\n var xValue = void 0;\n var yValue = void 0;\n for (var i = 0; i <= 5; i++) {\n xValue = (width / 2) * Math.cos((Math.PI / 180) * (i * eq));\n yValue = (height / 2) * Math.sin((Math.PI / 180) * (i * eq));\n if (i === 0) {\n path = 'M' + ' ' + (locX + xValue) + ' ' + (locY + yValue) + ' ';\n }\n else {\n path = path.concat('L' + ' ' + (locX + xValue) + ' ' + (locY + yValue) + ' ');\n }\n }\n path = path.concat('Z');\n merge(options, { 'd': path });\n break;\n case 'Image':\n functionName = 'Image';\n merge(options, { 'href': url, 'height': height, 'width': width, x: x, y: y });\n break;\n }\n return { renderOption: options, functionName: functionName };\n}\n/**\n * Animation Effect Calculation End\n * @private\n */\n// export function markerTemplateAnimate(element: Element, delay: number, duration: number, point: MapLocation): void {\n// let delta: number = 0;\n// let top: string = (element as HTMLElement).style.top;\n// let y: number = parseInt(top, 10);\n// new Animation({}).animate(element, {\n// duration: duration,\n// delay: delay,\n// progress: (args: AnimationOptions): void => {\n// if (args.timeStamp > args.delay) {\n// delta = ((args.timeStamp - args.delay) / args.duration);\n// (element as HTMLElement).style.top = y - 100 + (delta * 100) + 'px';\n// }\n// },\n// end: (model: AnimationOptions) => {\n// (element as HTMLElement).style.top = top;\n// }\n// });\n// }\n/** @private */\nexport function getElementOffset(childElement, parentElement) {\n var width;\n var height;\n parentElement.appendChild(childElement);\n width = childElement.offsetWidth;\n height = childElement.offsetHeight;\n parentElement.removeChild(childElement);\n return new Size(width, height);\n}\n/** @private */\nexport function changeBorderWidth(element, index, scale, maps) {\n var childNode;\n for (var l = 0; l < element.childElementCount; l++) {\n childNode = element.childNodes[l];\n if (childNode.id.indexOf('_NavigationGroup') > -1) {\n changeNavaigationLineWidth(childNode, index, scale, maps);\n }\n else {\n var currentStroke = (maps.layersCollection[index].shapeSettings.border.width);\n childNode.setAttribute('stroke-width', (currentStroke / scale).toString());\n }\n }\n}\n/** @private */\nexport function changeNavaigationLineWidth(element, index, scale, maps) {\n var node;\n for (var m = 0; m < element.childElementCount; m++) {\n node = element.childNodes[m];\n if (node.tagName === 'path') {\n var currentStroke = (maps.layersCollection[index]\n .navigationLineSettings[parseFloat(node.id.split('_')[2])].width);\n node.setAttribute('stroke-width', (currentStroke / scale).toString());\n }\n }\n}\n// /** Pinch zoom helper methods */\n/** @private */\nexport function targetTouches(event) {\n var targetTouches = [];\n var touches = event.touches;\n for (var i = 0; i < touches.length; i++) {\n targetTouches.push({ pageX: touches[i].pageX, pageY: touches[i].pageY });\n }\n return targetTouches;\n}\n/** @private */\nexport function calculateScale(startTouches, endTouches) {\n var startDistance = getDistance(startTouches[0], startTouches[1]);\n var endDistance = getDistance(endTouches[0], endTouches[1]);\n return (endDistance / startDistance);\n}\n/** @private */\nexport function getDistance(a, b) {\n var x = a.pageX - b.pageX;\n var y = a.pageY - b.pageY;\n return Math.sqrt(x * x + y * y);\n}\n/** @private */\nexport function getTouches(touches, maps) {\n var rect = maps.element.getBoundingClientRect();\n var posTop = rect.top + document.defaultView.pageXOffset;\n var posLeft = rect.left + document.defaultView.pageYOffset;\n return Array.prototype.slice.call(touches).map(function (touch) {\n return {\n x: touch.pageX - posLeft,\n y: touch.pageY - posTop,\n };\n });\n}\n/** @private */\nexport function getTouchCenter(touches) {\n return {\n x: touches.map(function (e) { return e['x']; }).reduce(sum) / touches.length,\n y: touches.map(function (e) { return e['y']; }).reduce(sum) / touches.length\n };\n}\n/** @private */\nexport function sum(a, b) {\n return a + b;\n}\n/**\n * Animation Effect Calculation End\n * @private\n */\nexport function zoomAnimate(element, delay, duration, point, scale, size, maps) {\n var delta = 0;\n var previousLocation = maps.previousPoint;\n var preScale = maps.previousScale;\n var diffScale = scale - preScale;\n var currentLocation = new MapLocation(0, 0);\n var currentScale = 1;\n if (scale === preScale) {\n element.setAttribute('transform', 'scale( ' + (scale) + ' ) translate( ' + point.x + ' ' + point.y + ' )');\n return;\n }\n var slope = function (previousLocation, point) {\n if (previousLocation.x === point.x) {\n return null;\n }\n return (point.y - previousLocation.y) / (point.x - previousLocation.x);\n };\n var intercept = function (point, slopeValue) {\n if (slopeValue === null) {\n return point.x;\n }\n return point.y - slopeValue * point.x;\n };\n var slopeFactor = slope(previousLocation, point);\n var slopeIntersection = intercept(previousLocation, slopeFactor);\n var horizontalDifference = point.x - previousLocation.x;\n var verticalDifference = point.y - previousLocation.y;\n animate(element, delay, duration, function (args) {\n if (args.timeStamp > args.delay) {\n delta = ((args.timeStamp - args.delay) / args.duration);\n currentScale = preScale + (delta * diffScale);\n currentLocation.x = previousLocation.x + (delta * horizontalDifference) / (currentScale / scale);\n if (slopeFactor == null) {\n currentLocation.y = previousLocation.y + (delta * verticalDifference);\n }\n else {\n currentLocation.y = ((slopeFactor * currentLocation.x) + slopeIntersection);\n }\n args.element.setAttribute('transform', 'scale( ' + currentScale + ' ) ' +\n 'translate( ' + currentLocation.x + ' ' + currentLocation.y + ' )');\n maps.translatePoint = currentLocation;\n maps.scale = currentScale;\n maps.zoomModule.processTemplate(point.x, point.y, currentScale, maps);\n }\n }, function () {\n maps.translatePoint = point;\n maps.scale = scale;\n element.setAttribute('transform', 'scale( ' + (scale) + ' ) translate( ' + point.x + ' ' + point.y + ' )');\n maps.zoomModule.processTemplate(point.x, point.y, scale, maps);\n });\n}\n/**\n * To process custom animation\n */\nexport function animate(element, delay, duration, process, end) {\n var _this = this;\n var start = null;\n var clearAnimation;\n var startAnimation = function (timestamp) {\n if (!start) {\n start = timestamp;\n }\n var progress = timestamp - start;\n if (progress < duration) {\n process.call(_this, { element: element, delay: 0, timeStamp: progress, duration: duration });\n window.requestAnimationFrame(startAnimation);\n }\n else {\n window.cancelAnimationFrame(clearAnimation);\n end.call(_this, { element: element });\n }\n };\n clearAnimation = window.requestAnimationFrame(startAnimation);\n}\nvar MapAjax = /** @class */ (function () {\n function MapAjax(options, type, async, contentType, sendData) {\n this.dataOptions = options;\n this.type = type || 'GET';\n this.async = async || true;\n this.contentType = contentType;\n this.sendData = sendData;\n }\n return MapAjax;\n}());\nexport { MapAjax };\n/**\n * Animation Translate\n * @private\n */\nexport function smoothTranslate(element, delay, duration, point) {\n var delta = 0;\n var transform = element.getAttribute('transform').split(' ');\n if (transform.length === 2) {\n transform[2] = transform[1].split(')')[0];\n transform[1] = transform[0].split('(')[1];\n }\n var previousLocation = new MapLocation(parseInt(transform[1], 10), parseInt(transform[2], 10));\n var diffx = point.x - previousLocation.x;\n var diffy = point.y - previousLocation.y;\n var currentLocation = new MapLocation(0, 0);\n animate(element, delay, duration, function (args) {\n if (args.timeStamp > args.delay) {\n delta = ((args.timeStamp - args.delay) / args.duration);\n currentLocation.x = previousLocation.x + (delta * diffx);\n currentLocation.y = previousLocation.y + (delta * diffy);\n args.element.setAttribute('transform', 'translate( ' + currentLocation.x + ' ' + currentLocation.y + ' )');\n }\n }, function () {\n element.setAttribute('transform', 'translate( ' + point.x + ' ' + point.y + ' )');\n });\n}\n","/**\n * Exports util methods used by RichTextEditor.\n */\nimport { isNullOrUndefined as isNOU, addClass, removeClass, selectAll } from '@syncfusion/ej2-base';\nimport * as classes from '../base/classes';\nimport * as model from '../models/items';\nimport { toolsLocale } from '../models/default-locale';\nvar undoRedoItems = ['Undo', 'Redo'];\nexport function getIndex(val, items) {\n var index = -1;\n items.some(function (item, i) {\n if (typeof item === 'string' && val === item.toLocaleLowerCase()) {\n index = i;\n return true;\n }\n return false;\n });\n return index;\n}\nexport function hasClass(element, className) {\n var hasClass = false;\n if (element.classList.contains(className)) {\n hasClass = true;\n }\n return hasClass;\n}\nexport function getDropDownValue(items, value, type, returnType) {\n var data;\n var result;\n for (var k = 0; k < items.length; k++) {\n if (type === 'value' && items[k].value.toLocaleLowerCase() === value.toLocaleLowerCase()) {\n data = items[k];\n break;\n }\n else if (type === 'text' && items[k].text.toLocaleLowerCase() === value.toLocaleLowerCase()) {\n data = items[k];\n break;\n }\n else if (type === 'subCommand' && items[k].subCommand.toLocaleLowerCase() === value.toLocaleLowerCase()) {\n data = items[k];\n break;\n }\n }\n if (!isNOU(data)) {\n switch (returnType) {\n case 'text':\n result = data.text;\n break;\n case 'value':\n result = data.value;\n break;\n case 'iconCss':\n result = data.iconCss;\n break;\n }\n }\n return result;\n}\nexport function isIDevice() {\n var result = false;\n var iosDevices = ['iphone', 'ipad', 'ipod'];\n for (var i = 0; i < iosDevices.length; i++) {\n if (navigator.platform.toLocaleLowerCase().indexOf(iosDevices[i]) > -1) {\n result = true;\n break;\n }\n }\n return result;\n}\nexport function getFormattedFontSize(value) {\n if (isNOU(value)) {\n return '';\n }\n var result = value.split('pt');\n return result[0] + ' pt';\n}\nexport function pageYOffset(e, parentElement, isIFrame) {\n var y = 0;\n if (isIFrame) {\n y = window.pageYOffset + parentElement.getBoundingClientRect().top + e.clientY;\n }\n else {\n y = e.pageY;\n }\n return y;\n}\nexport function getTooltipText(item, serviceLocator) {\n var i10n = serviceLocator.getService('rteLocale');\n var itemLocale = toolsLocale[item];\n var tooltipText = i10n.getConstant(itemLocale);\n return tooltipText;\n}\nexport function setToolbarStatus(e, isPopToolbar) {\n var dropDown = e.dropDownModule;\n var data = e.args;\n var keys = Object.keys(e.args);\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n for (var j = 0; j < e.tbItems.length; j++) {\n var item = e.tbItems[j].subCommand;\n var itemStr = item && item.toLocaleLowerCase();\n if (item && (itemStr === key) || (item === 'UL' && key === 'unorderedlist') || (item === 'OL' && key === 'orderedlist')) {\n if (typeof data[key] === 'boolean') {\n if (data[key] === true) {\n addClass([e.tbElements[j]], [classes.CLS_ACTIVE]);\n }\n else {\n removeClass([e.tbElements[j]], [classes.CLS_ACTIVE]);\n }\n }\n else if ((typeof data[key] === 'string' || data[key] === null) &&\n getIndex(key, e.parent.toolbarSettings.items) > -1) {\n var value = ((data[key]) ? data[key] : '');\n var result = '';\n switch (key) {\n case 'formats':\n if (isNOU(dropDown.formatDropDown) || isPopToolbar) {\n return;\n }\n var formatItems = e.parent.format.types;\n result = getDropDownValue(formatItems, value, 'subCommand', 'text');\n dropDown.formatDropDown.content = ('' +\n ''\n + (isNOU(result) ? 'Paragraph' : result) +\n '');\n dropDown.formatDropDown.dataBind();\n break;\n case 'alignments':\n if (isNOU(dropDown.alignDropDown)) {\n return;\n }\n var alignItems = model.alignmentItems;\n result = getDropDownValue(alignItems, value, 'subCommand', 'iconCss');\n dropDown.alignDropDown.iconCss = isNOU(result) ? 'e-icons e-justify-left' : result;\n dropDown.alignDropDown.dataBind();\n break;\n case 'fontname':\n if (isNOU(dropDown.fontNameDropDown) || isPopToolbar) {\n return;\n }\n var fontNameItems = e.parent.fontFamily.items;\n result = getDropDownValue(fontNameItems, value, 'value', 'text');\n var name_1 = (isNOU(result) ? 'Segoe UI' : result);\n e.tbElements[j].title = name_1;\n dropDown.fontNameDropDown.content = ('' +\n ''\n + name_1 + '');\n dropDown.fontNameDropDown.dataBind();\n break;\n case 'fontsize':\n if (isNOU(dropDown.fontSizeDropDown)) {\n return;\n }\n var fontSizeItems = e.parent.fontSize.items;\n result = getDropDownValue(fontSizeItems, value, 'value', 'value');\n dropDown.fontSizeDropDown.content = ('' +\n ''\n + (isNOU(result) ? '10 pt' : getFormattedFontSize(result)) +\n '');\n dropDown.fontSizeDropDown.dataBind();\n break;\n }\n }\n }\n }\n }\n}\nexport function getCollection(items) {\n if (typeof items === 'object') {\n return items;\n }\n else {\n return [items];\n }\n}\nexport function getTBarItemsIndex(items, toolbarItems) {\n var itemsIndex = [];\n for (var i = 0; i < items.length; i++) {\n for (var j = 0; j < toolbarItems.length; j++) {\n if (toolbarItems[j].type === 'Separator') {\n continue;\n }\n else {\n if (items[i] === 'OrderedList' && toolbarItems[j].subCommand === 'OL') {\n itemsIndex.push(j);\n break;\n }\n else if (items[i] === 'UnorderedList' && toolbarItems[j].subCommand === 'UL') {\n itemsIndex.push(j);\n break;\n }\n else if (items[i] === toolbarItems[j].subCommand) {\n itemsIndex.push(j);\n break;\n }\n }\n }\n }\n return itemsIndex;\n}\nexport function updateUndoRedoStatus(baseToolbar, undoRedoStatus) {\n var i = 0;\n var trgItems = getTBarItemsIndex(getCollection(undoRedoItems), baseToolbar.toolbarObj.items);\n var tbItems = selectAll('.' + classes.CLS_TB_ITEM, baseToolbar.toolbarObj.element);\n var keys = Object.keys(undoRedoStatus);\n for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {\n var key = keys_2[_i];\n var target = tbItems[trgItems[i]];\n if (target) {\n baseToolbar.toolbarObj.enableItems(target, undoRedoStatus[key]);\n }\n i++;\n }\n}\n/**\n * To dispatch the event manually\n */\nexport function dispatchEvent(element, type) {\n var evt = document.createEvent('HTMLEvents');\n evt.initEvent(type, false, true);\n element.dispatchEvent(evt);\n}\n","export function setAttributes(htmlAttributes, rte, isFrame) {\n var target;\n if (isFrame) {\n var iFrame = rte.contentModule.getDocument();\n target = iFrame.querySelector('body');\n }\n else {\n target = rte.element;\n }\n if (Object.keys(htmlAttributes).length) {\n for (var _i = 0, _a = Object.keys(htmlAttributes); _i < _a.length; _i++) {\n var htmlAttr = _a[_i];\n if (htmlAttr === 'class') {\n target.classList.add(htmlAttributes[htmlAttr]);\n }\n else if (htmlAttr === 'disabled' && htmlAttributes[htmlAttr] === 'disabled') {\n rte.enabled = false;\n rte.setEnable();\n }\n else if (htmlAttr === 'readonly' && htmlAttributes[htmlAttr] === 'readonly') {\n rte.readonly = true;\n rte.setReadOnly();\n }\n else if (htmlAttr === 'style') {\n target.setAttribute('style', htmlAttributes[htmlAttr]);\n }\n else if (htmlAttr === 'placeholder') {\n rte.placeholder = htmlAttributes[htmlAttr];\n rte.setPlaceHolder();\n }\n else {\n var validateAttr = ['name', 'required'];\n if (validateAttr.indexOf(htmlAttr) > -1) {\n rte.valueContainer.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);\n }\n else {\n target.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);\n }\n }\n }\n }\n}\n","/**\n * Schedule common utilities\n */\nexport var WEEK_LENGTH = 7;\nexport var MS_PER_DAY = 86400000;\nexport var MS_PER_MINUTE = 60000;\nexport function getWeekFirstDate(date1, firstDayOfWeek) {\n var date = new Date(date1.getTime());\n firstDayOfWeek = (firstDayOfWeek - date.getDay() + 7 * (-1)) % 7;\n return new Date(date.setDate(date.getDate() + firstDayOfWeek));\n}\nexport function firstDateOfMonth(date) {\n return new Date(date.getFullYear(), date.getMonth());\n}\nexport function lastDateOfMonth(dt) {\n return new Date(dt.getFullYear(), dt.getMonth() + 1, 0);\n}\nexport function getWeekNumber(dt) {\n var currentDate = new Date('' + dt).valueOf();\n var date = new Date(dt.getFullYear(), 0, 1).valueOf();\n var a = (currentDate - date);\n return Math.ceil((((a) / MS_PER_DAY) + new Date(date).getDay() + 1) / 7);\n}\nexport function setTime(date, time) {\n var tzOffsetBefore = date.getTimezoneOffset();\n var d = new Date(date.getTime() + time);\n var tzOffsetDiff = d.getTimezoneOffset() - tzOffsetBefore;\n date.setTime(d.getTime() + tzOffsetDiff * MS_PER_DAY);\n return date;\n}\nexport function resetTime(date) {\n date.setHours(0, 0, 0, 0);\n return date;\n}\nexport function getDateInMs(date) {\n return date.getTime() - new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0).getTime();\n}\nexport function addDays(date, i) {\n date = new Date('' + date);\n return new Date(date.setDate(date.getDate() + i));\n}\nexport function addMonths(date, i) {\n date = new Date('' + date);\n var day = date.getDate();\n date.setDate(1);\n date.setMonth(date.getMonth() + i);\n date.setDate(Math.min(day, getMaxDays(date)));\n return date;\n}\nexport function addYears(date, i) {\n date = new Date('' + date);\n var day = date.getDate();\n date.setDate(1);\n date.setFullYear(date.getFullYear() + i);\n date.setDate(Math.min(day, getMaxDays(date)));\n return date;\n}\nexport function getStartEndHours(date, startHour, endHour) {\n var date1 = new Date(date.getTime());\n date1.setHours(startHour.getHours());\n date1.setMinutes(startHour.getMinutes());\n date1.setSeconds(startHour.getSeconds());\n var date2 = new Date(date.getTime());\n if (endHour.getHours() === 0) {\n date2 = addDays(date2, 1);\n }\n else {\n date2.setHours(endHour.getHours());\n date2.setMinutes(endHour.getMinutes());\n date2.setSeconds(endHour.getSeconds());\n }\n return { startHour: date1, endHour: date2 };\n}\nexport function getMaxDays(d) {\n var date = new Date(d.getFullYear(), d.getMonth() + 1, 0);\n return date.getDate();\n}\nexport function getDaysCount(startDate, endDate) {\n var strTime = resetTime(new Date(startDate));\n var endTime = resetTime(new Date(endDate));\n return (endTime.getTime() - strTime.getTime()) / MS_PER_DAY;\n}\nexport function getDateFromString(date) {\n return date.indexOf('Date') !== -1 ? new Date(parseInt(date.match(/\\d+/g).toString(), 10)) :\n date.indexOf('T') !== -1 ? new Date(date) : new Date(date.replace(/-/g, '/'));\n}\n/** @hidden */\nvar scrollWidth = null;\n/** @hidden */\nexport function getScrollBarWidth() {\n if (scrollWidth !== null) {\n return scrollWidth;\n }\n var divNode = document.createElement('div');\n var value = 0;\n divNode.style.cssText = 'width:100px;height: 100px;overflow: scroll;position: absolute;top: -9999px;';\n document.body.appendChild(divNode);\n value = (divNode.offsetWidth - divNode.clientWidth) | 0;\n document.body.removeChild(divNode);\n return scrollWidth = value;\n}\nexport function findIndexInData(data, property, value) {\n for (var i = 0, length_1 = data.length; i < length_1; i++) {\n if (data[i][property] === value) {\n return i;\n }\n }\n return -1;\n}\n","import { isNullOrUndefined, getDefaultDateObject, getValue, cldrData } from '@syncfusion/ej2-base';\nimport { MS_PER_DAY } from '../schedule/base/util';\n/**\n * Date Generator from Recurrence Rule\n */\nexport function generateSummary(rule, localeObject, locale) {\n var ruleObject = extractObjectFromRule(rule);\n var summary = localeObject.getConstant(EVERY) + ' ';\n var cldrObj;\n var cldrObj1;\n if (locale === 'en' || locale === 'en-US') {\n cldrObj1 = (getValue('months.stand-alone.abbreviated', getDefaultDateObject()));\n cldrObj = (getValue('days.stand-alone.abbreviated', getDefaultDateObject()));\n }\n else {\n cldrObj1 = (getValue('main.' + '' + locale + '.dates.calendars.gregorian.months.stand-alone.abbreviated', cldrData));\n cldrObj = (getValue('main.' + '' + locale + '.dates.calendars.gregorian.days.stand-alone.abbreviated', cldrData));\n }\n if (ruleObject.interval > 1) {\n summary += ruleObject.interval + ' ';\n }\n switch (ruleObject.freq) {\n case 'DAILY':\n summary += localeObject.getConstant(DAYS);\n break;\n case 'WEEKLY':\n summary += localeObject.getConstant(WEEKS) + ' ' + localeObject.getConstant(ON) + ' ';\n ruleObject.day.forEach(function (day, index) {\n summary += getValue(DAYINDEXOBJECT[day], cldrObj);\n summary += (((ruleObject.day.length - 1) === index) ? '' : ', ');\n });\n break;\n case 'MONTHLY':\n summary += localeObject.getConstant(MONTHS) + ' ' + localeObject.getConstant(ON) + ' ';\n summary += getMonthSummary(ruleObject, cldrObj, localeObject);\n break;\n case 'YEARLY':\n summary += localeObject.getConstant(YEARS) + ' ' + localeObject.getConstant(ON) + ' ';\n summary += getValue((ruleObject.month[0]).toString(), cldrObj1) + ' ';\n summary += getMonthSummary(ruleObject, cldrObj, localeObject);\n break;\n default:\n return '';\n }\n if (ruleObject.count) {\n summary += ', ' + (ruleObject.count) + ' ' + localeObject.getConstant(TIMES);\n }\n else if (ruleObject.until) {\n var tempDate = ruleObject.until;\n summary += ', ' + localeObject.getConstant(UNTIL)\n + ' ' + tempDate.getDate()\n + ' ' + getValue((tempDate.getMonth() + 1).toString(), cldrObj1)\n + ' ' + tempDate.getFullYear();\n }\n return summary;\n}\nfunction getMonthSummary(ruleObject, cldrObj, localeObj) {\n var summary = '';\n if (ruleObject.monthDay.length) {\n summary += ruleObject.monthDay[0];\n }\n else if (ruleObject.day) {\n var pos = ruleObject.setPosition - 1;\n summary += localeObj.getConstant(WEEKPOS[pos > -1 ? pos : (WEEKPOS.length - 1)])\n + ' ' + getValue(DAYINDEXOBJECT[ruleObject.day[0]], cldrObj);\n }\n return summary;\n}\nexport function generate(startDate, rule, excludeDate, startDayOfWeek, maximumCount, viewDate) {\n if (maximumCount === void 0) { maximumCount = MAXOCCURRENCE; }\n if (viewDate === void 0) { viewDate = null; }\n var ruleObject = extractObjectFromRule(rule);\n var cacheDate;\n var data = [];\n var modifiedDate = new Date(startDate.getTime());\n if (viewDate && viewDate > startDate && !ruleObject.count) {\n tempViewDate = new Date(new Date(viewDate.getTime()).setHours(0, 0, 0));\n }\n else {\n tempViewDate = null;\n }\n if (!ruleObject.until && tempViewDate) {\n cacheDate = new Date(tempViewDate.getTime());\n cacheDate.setDate(tempViewDate.getDate() + 42 * (ruleObject.interval));\n ruleObject.until = cacheDate;\n }\n if (ruleObject.until && startDate > ruleObject.until) {\n return data;\n }\n maxOccurrence = maximumCount;\n setFirstDayOfWeek(DAYINDEX[startDayOfWeek]);\n tempExcludeDate = [];\n var tempDate = isNullOrUndefined(excludeDate) ? [] : excludeDate.split(',');\n tempDate.forEach(function (content) {\n var parsedDate = getDateFromRecurrenceDateString(content);\n tempExcludeDate.push(new Date(parsedDate.getTime()).setHours(0, 0, 0, 0));\n });\n switch (ruleObject.freq) {\n case 'DAILY':\n dailyType(modifiedDate, ruleObject.until, data, ruleObject);\n break;\n case 'WEEKLY':\n weeklyType(modifiedDate, ruleObject.until, data, ruleObject);\n break;\n case 'MONTHLY':\n monthlyType(modifiedDate, ruleObject.until, data, ruleObject);\n break;\n case 'YEARLY':\n yearlyType(modifiedDate, ruleObject.until, data, ruleObject);\n }\n return data;\n}\nfunction getDateFromRecurrenceDateString(recDateString) {\n return new Date(recDateString.substr(0, 4) +\n '-' + recDateString.substr(4, 2) +\n '-' + recDateString.substr(6, 5) +\n ':' + recDateString.substr(11, 2) +\n ':' + recDateString.substr(13));\n}\nfunction excludeDateHandler(data, date) {\n var zeroIndex = new Date(date).setHours(0, 0, 0, 0);\n if (tempExcludeDate.indexOf(zeroIndex) === -1 && (!tempViewDate || zeroIndex >= tempViewDate.getTime())) {\n data.push(date);\n }\n}\nfunction dailyType(startDate, endDate, data, ruleObject) {\n var tempDate = new Date(startDate.getTime());\n var interval = ruleObject.interval;\n var expectedCount = ruleObject.count ? ruleObject.count : maxOccurrence;\n var state;\n while (compareDates(tempDate, endDate)) {\n state = true;\n state = validateRules(tempDate, ruleObject);\n if (state) {\n excludeDateHandler(data, tempDate.getTime());\n if (expectedCount && (data.length + tempExcludeDate.length) >= expectedCount) {\n break;\n }\n }\n tempDate.setDate(tempDate.getDate() + interval);\n }\n}\nfunction weeklyType(startDate, endDate, data, ruleObject) {\n var tempDate = getStartDateForWeek(startDate, ruleObject.day);\n var interval = ruleObject.interval;\n var expectedDays = ruleObject.day;\n var expectedCount = ruleObject.count ? ruleObject.count : maxOccurrence;\n var state;\n var dayCycleData = processWeekDays(expectedDays);\n while (compareDates(tempDate, endDate)) {\n state = true;\n state = validateRules(tempDate, ruleObject);\n if (state) {\n excludeDateHandler(data, tempDate.getTime());\n if (expectedCount && (data.length + tempExcludeDate.length) >= expectedCount) {\n break;\n }\n }\n if (expectedDays.length > 1) {\n tempDate.setDate(tempDate.getDate()\n + dayCycleData[DAYINDEX[tempDate.getDay()]]\n + ((expectedDays.indexOf(DAYINDEX[tempDate.getDay()]) === expectedDays.length - 1) ?\n ((interval - 1) * 7) : 0));\n }\n else {\n tempDate.setDate(tempDate.getDate()\n + (interval * 7));\n }\n }\n}\nfunction monthlyType(startDate, endDate, data, ruleObject) {\n var ruleType = validateMonthlyRuleType(ruleObject);\n switch (ruleType) {\n case 'day':\n monthlyDayTypeProcess(startDate, endDate, data, ruleObject);\n break;\n case 'both':\n case 'date':\n monthlyDateTypeProcess(startDate, endDate, data, ruleObject);\n break;\n }\n}\nfunction yearlyType(startDate, endDate, data, ruleObject) {\n var typeValue = checkYearlyType(ruleObject);\n switch (typeValue) {\n case 'MONTH':\n monthlyType(startDate, endDate, data, ruleObject);\n break;\n case 'WEEKNO':\n processWeekNo(startDate, endDate, data, ruleObject);\n break;\n case 'YEARDAY':\n processYearDay(startDate, endDate, data, ruleObject);\n break;\n }\n}\nfunction processWeekNo(startDate, endDate, data, ruleObject) {\n var stDate = new Date(startDate.getFullYear(), 0, 0);\n var tempDate;\n var expectedCount = ruleObject.count ? ruleObject.count : maxOccurrence;\n var state;\n var startDay;\n var firstWeekSpan;\n var weekNos = ruleObject.weekNo;\n var weekNo;\n var maxDate;\n var minDate;\n while (compareDates(stDate, endDate)) {\n startDay = dayIndex.indexOf(DAYINDEX[stDate.getDay()]);\n firstWeekSpan = (6 - startDay) + 1;\n for (var index = 0; index < weekNos.length; index++) {\n weekNo = weekNos[index];\n weekNo = (weekNo > 0) ? weekNo : 53 + weekNo + 1;\n maxDate = (weekNo === 1) ? firstWeekSpan : firstWeekSpan + ((weekNo - 1) * 7);\n minDate = (weekNo === 1) ? firstWeekSpan - 7 : firstWeekSpan + ((weekNo - 2) * 7);\n while (minDate < maxDate) {\n tempDate = new Date(stDate.getTime() + (MS_PER_DAY * minDate));\n state = validateRules(tempDate, ruleObject);\n if ((tempDate >= startDate) && state && compareDates(tempDate, endDate)) {\n excludeDateHandler(data, tempDate.getTime());\n if (expectedCount && (data.length + tempExcludeDate.length) >= expectedCount) {\n return;\n }\n }\n minDate++;\n }\n }\n stDate = new Date(tempDate.getFullYear() + ruleObject.interval, 0, 0);\n }\n}\nfunction processYearDay(startDate, endDate, data, ruleObject) {\n var stDate = new Date(startDate.getFullYear(), 0, 0);\n var tempDate;\n var expectedCount = ruleObject.count ? ruleObject.count : maxOccurrence;\n var state;\n var date;\n while (compareDates(stDate, endDate)) {\n for (var index = 0; index < ruleObject.yearDay.length; index++) {\n date = ruleObject.yearDay[index];\n tempDate = new Date(stDate.getTime());\n if ((date === LEAPYEAR || date === -LEAPYEAR) && ((tempDate.getFullYear() + 1) % 4 !== 0)) {\n tempDate.setDate(tempDate.getDate() + 1);\n continue;\n }\n tempDate.setDate(tempDate.getDate() + ((date < 0) ? getMaxYearDay(tempDate.getFullYear() + 1) + 1 + date : date));\n state = validateRules(tempDate, ruleObject);\n if ((tempDate >= startDate) && state && compareDates(tempDate, endDate)) {\n excludeDateHandler(data, tempDate.getTime());\n if (expectedCount && (data.length + tempExcludeDate.length) >= expectedCount) {\n return;\n }\n }\n }\n stDate = new Date(tempDate.getFullYear() + ruleObject.interval, 0, 0);\n }\n}\nfunction getMaxYearDay(date) {\n return (date % 4 === 0) ? LEAPYEAR : NORMALYEAR;\n}\nfunction checkYearlyType(ruleObject) {\n if (ruleObject.yearDay.length) {\n return 'YEARDAY';\n }\n else if (ruleObject.weekNo.length) {\n return 'WEEKNO';\n }\n return 'MONTH';\n}\nfunction monthlyDateTypeProcess(startDate, endDate, data, ruleObject) {\n var tempDate = new Date(startDate.getTime());\n var mainDate = new Date(startDate.getTime());\n var expectedCount = ruleObject.count ? ruleObject.count : maxOccurrence;\n var interval = ruleObject.interval;\n var monthInit = 0;\n var date;\n var state;\n tempDate.setDate(1);\n mainDate.setDate(1);\n if (ruleObject.month.length) {\n tempDate.setMonth(ruleObject.month[0] - 1);\n }\n while (compareDates(tempDate, endDate)) {\n for (var index = 0; index < ruleObject.monthDay.length; index++) {\n date = ruleObject.monthDay[index];\n var maxDate = (tempDate.getMonth() === 1) ?\n (tempDate.getFullYear() % 4 === 0 ? 29 : 28) : monthDay[tempDate.getMonth()];\n date = date > 0 ? date : (maxDate + date + 1);\n if ((date > 0) && validateProperDate(tempDate, date, mainDate)) {\n tempDate.setDate(date);\n if (endDate && tempDate > endDate) {\n return;\n }\n state = validateRules(tempDate, ruleObject);\n if ((tempDate >= startDate) && state && compareDates(tempDate, endDate)) {\n excludeDateHandler(data, tempDate.getTime());\n if (expectedCount && (data.length + tempExcludeDate.length) >= expectedCount) {\n return;\n }\n }\n }\n }\n monthInit = setNextValidDate(tempDate, ruleObject, monthInit, interval);\n }\n}\nfunction setNextValidDate(tempDate, ruleObject, monthInit, interval, beginDate) {\n if (beginDate === void 0) { beginDate = null; }\n var monthData = beginDate ? beginDate.getMonth() : 0;\n tempDate.setDate(1);\n if (ruleObject.month.length) {\n monthInit++;\n monthInit = monthInit % ruleObject.month.length;\n tempDate.setMonth(ruleObject.month[monthInit] - 1);\n if (monthInit === 0) {\n tempDate.setFullYear(tempDate.getFullYear() + interval);\n }\n }\n else {\n if (beginDate && (beginDate.getFullYear() < tempDate.getFullYear())) {\n monthData = tempDate.getMonth() - 1;\n }\n tempDate.setMonth((beginDate ?\n monthData :\n tempDate.getMonth()) + interval);\n }\n return monthInit;\n}\nfunction monthlyDayTypeProcess(startDate, endDate, data, ruleObject) {\n var tempDate = new Date(startDate.getTime());\n var expectedDays = ruleObject.day;\n var expectedCount = ruleObject.count ? ruleObject.count : maxOccurrence;\n var dayCycleData = processWeekDays(expectedDays);\n var interval = ruleObject.interval;\n var state;\n var monthCollection = [];\n var weekCollection = [];\n var month;\n var index;\n var beginDate;\n var monthInit = 0;\n tempDate.setDate(1);\n if (ruleObject.month.length) {\n tempDate.setMonth(ruleObject.month[0] - 1);\n }\n tempDate = getStartDateForWeek(tempDate, ruleObject.day);\n while (compareDates(tempDate, endDate)) {\n month = tempDate.getMonth();\n beginDate = new Date(tempDate.getTime());\n if (expectedDays.length > 1) {\n while (tempDate.getMonth() === month) {\n weekCollection.push(tempDate.getTime());\n if (DAYINDEX[tempDate.getDay()] === expectedDays[expectedDays.length - 1]) {\n monthCollection.push(weekCollection);\n weekCollection = [];\n }\n tempDate.setDate(tempDate.getDate()\n + dayCycleData[DAYINDEX[tempDate.getDay()]]);\n }\n }\n else {\n var currentMonthDate = new Date(tempDate.getTime());\n while (currentMonthDate.getMonth() === month) {\n monthCollection.push([currentMonthDate.getTime()]);\n currentMonthDate.setDate(currentMonthDate.getDate() + (7));\n }\n }\n index = ((ruleObject.setPosition < 1) ? (monthCollection.length + ruleObject.setPosition) : ruleObject.setPosition - 1);\n if (ruleObject.setPosition === null) {\n index = 0;\n var datas = [];\n for (var week = 0; week < monthCollection.length; week++) {\n for (var row = 0; row < monthCollection[week].length; row++) {\n datas.push(monthCollection[week][row]);\n }\n }\n monthCollection = [datas];\n }\n for (var week = 0; week < monthCollection[index].length; week++) {\n var dayData = monthCollection[index][week];\n var chDate = new Date(dayData);\n state = validateRules(chDate, ruleObject);\n if ((chDate >= startDate) && compareDates(chDate, endDate) && state) {\n excludeDateHandler(data, dayData);\n if (expectedCount && (data.length + tempExcludeDate.length) >= expectedCount) {\n return;\n }\n }\n }\n monthInit = setNextValidDate(tempDate, ruleObject, monthInit, interval, beginDate);\n monthCollection = [];\n weekCollection = [];\n tempDate = getStartDateForWeek(tempDate, ruleObject.day);\n }\n}\nfunction compareDates(startDate, endDate) {\n return endDate ? (startDate <= endDate) : true;\n}\nfunction checkDayIndex(day, expectedDays) {\n return (expectedDays.indexOf(DAYINDEX[day]) === -1);\n}\nfunction getStartDateForWeek(startDate, expectedDays) {\n var tempDate = new Date(startDate.getTime());\n if (expectedDays.indexOf(DAYINDEX[tempDate.getDay()]) === -1) {\n do {\n tempDate.setDate(tempDate.getDate() + 1);\n } while (expectedDays.indexOf(DAYINDEX[tempDate.getDay()]) === -1);\n }\n return tempDate;\n}\nexport function extractObjectFromRule(rules) {\n var ruleObject = {\n freq: null,\n interval: 1,\n count: null,\n until: null,\n day: [],\n month: [],\n weekNo: [],\n monthDay: [],\n yearDay: [],\n setPosition: null,\n validRules: []\n };\n var rulesList = rules.split(';');\n var splitData = [];\n var temp;\n rulesList.forEach(function (data) {\n splitData = data.split('=');\n switch (splitData[0]) {\n case 'UNTIL':\n temp = splitData[1];\n ruleObject.until = getDateFromRecurrenceDateString(temp);\n break;\n case 'BYDAY':\n ruleObject.day = splitData[1].split(',');\n ruleObject.validRules.push(splitData[0]);\n break;\n case 'BYMONTHDAY':\n ruleObject.monthDay = splitData[1].split(',').map(Number);\n ruleObject.validRules.push(splitData[0]);\n break;\n case 'BYMONTH':\n ruleObject.month = splitData[1].split(',').map(Number);\n ruleObject.validRules.push(splitData[0]);\n break;\n case 'BYYEARDAY':\n ruleObject.yearDay = splitData[1].split(',').map(Number);\n ruleObject.validRules.push(splitData[0]);\n break;\n case 'BYWEEKNO':\n ruleObject.weekNo = splitData[1].split(',').map(Number);\n ruleObject.validRules.push(splitData[0]);\n break;\n case 'INTERVAL':\n ruleObject.interval = parseInt(splitData[1], 10);\n break;\n case 'COUNT':\n ruleObject.count = parseInt(splitData[1], 10);\n break;\n case 'BYSETPOS':\n ruleObject.setPosition = parseInt(splitData[1], 10);\n break;\n case 'FREQ':\n ruleObject.freq = splitData[1];\n break;\n }\n });\n if ((ruleObject.freq === 'MONTHLY') && (ruleObject.monthDay.length === 0)) {\n var index = ruleObject.validRules.indexOf('BYDAY');\n ruleObject.validRules.splice(index, 1);\n }\n return ruleObject;\n}\nfunction validateProperDate(tempDate, data, startDate) {\n var maxDate = (tempDate.getMonth() === 1) ? (tempDate.getFullYear() % 4 === 0 ? 29 : 28) : monthDay[tempDate.getMonth()];\n return (data <= maxDate) && (tempDate >= startDate);\n}\nfunction processWeekDays(expectedDays) {\n var dayCycle = {};\n expectedDays.forEach(function (element, index) {\n if (index === expectedDays.length - 1) {\n var startIndex = dayIndex.indexOf(element);\n var temp = startIndex;\n while (temp % 7 !== dayIndex.indexOf(expectedDays[0])) {\n temp++;\n }\n dayCycle[element] = temp - startIndex;\n }\n else {\n dayCycle[element] = dayIndex.indexOf(expectedDays[(index + 1)]) - dayIndex.indexOf(element);\n }\n });\n return dayCycle;\n}\nfunction checkMonth(tempDate, expectedMonth) {\n return (expectedMonth.indexOf(tempDate.getMonth() + 1) === -1);\n}\nfunction checkDate(tempDate, expectedDate) {\n var temp = expectedDate.slice(0);\n var data;\n var maxDate = (tempDate.getMonth() === 1) ?\n (tempDate.getFullYear() % 4 === 0 ? 29 : 28) : monthDay[tempDate.getMonth()];\n data = temp.shift();\n while (data) {\n if (data < 0) {\n data = data + maxDate + 1;\n }\n if (data === tempDate.getDate()) {\n return false;\n }\n data = temp.shift();\n }\n return true;\n}\nfunction checkYear(tempDate, expectedyearDay) {\n var temp = expectedyearDay.slice(0);\n var data;\n var yearDay = getYearDay(tempDate);\n data = temp.shift();\n while (data) {\n if (data < 0) {\n data = data + getMaxYearDay(tempDate.getFullYear()) + 1;\n }\n if (data === yearDay) {\n return false;\n }\n data = temp.shift();\n }\n return true;\n}\nfunction getYearDay(currentDate) {\n if (!startDateCollection[currentDate.getFullYear()]) {\n startDateCollection[currentDate.getFullYear()] = new Date(currentDate.getFullYear(), 0, 0);\n }\n var tempDate = startDateCollection[currentDate.getFullYear()];\n var diff = currentDate.getTime() - tempDate.getTime();\n return Math.ceil(diff / MS_PER_DAY);\n}\nfunction validateMonthlyRuleType(ruleObject) {\n if (ruleObject.monthDay.length && !ruleObject.day.length) {\n return 'date';\n }\n else if (!ruleObject.monthDay.length && ruleObject.day.length) {\n return 'day';\n }\n return 'both';\n}\nfunction rotate(days) {\n var data = days.shift();\n days.push(data);\n}\nfunction setFirstDayOfWeek(day) {\n while (dayIndex[0] !== day) {\n rotate(dayIndex);\n }\n}\nfunction validateRules(tempDate, ruleObject) {\n var state = true;\n var expectedDays = ruleObject.day;\n var expectedMonth = ruleObject.month;\n var expectedDate = ruleObject.monthDay;\n var expectedyearDay = ruleObject.yearDay;\n ruleObject.validRules.forEach(function (rule) {\n switch (rule) {\n case 'BYDAY':\n if (checkDayIndex(tempDate.getDay(), expectedDays)) {\n state = false;\n }\n break;\n case 'BYMONTH':\n if (checkMonth(tempDate, expectedMonth)) {\n state = false;\n }\n break;\n case 'BYMONTHDAY':\n if (checkDate(tempDate, expectedDate)) {\n state = false;\n }\n break;\n case 'BYYEARDAY':\n if (checkYear(tempDate, expectedyearDay)) {\n state = false;\n }\n break;\n }\n });\n return state;\n}\nvar startDateCollection = {};\nvar propertyKeys = {\n FREQ: 'freq',\n BYDAY: 'day',\n BYSETPOS: 'setPos',\n UNTIL: 'until',\n INTERVAL: 'interval',\n COUNT: 'count',\n BYMONTH: 'month',\n BYWEEKNO: 'weekNo',\n BYMONTHDAY: 'monthDay',\n BYYEARDAY: 'yearDay'\n};\nvar tempExcludeDate;\nvar dayIndex = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'];\nvar maxOccurrence;\nvar tempViewDate;\nvar monthDay = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYINDEX = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'];\nvar MAXOCCURRENCE = 43;\nvar LEAPYEAR = 366;\nvar NORMALYEAR = 365;\nvar WEEKPOS = ['first', 'second', 'third', 'fourth', 'last'];\nvar MONTHDATA = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];\nvar TIMES = 'summaryTimes';\nvar ON = 'summaryOn';\nvar REPEAT = 'summaryRepeat';\nvar EVERY = 'every';\nvar UNTIL = 'summaryUntil';\nvar DAYS = 'summaryDay';\nvar WEEKS = 'summaryWeek';\nvar MONTHS = 'summaryMonth';\nvar YEARS = 'summaryYear';\nvar DAYINDEXOBJECT = {\n SU: 'sun',\n MO: 'mon',\n TU: 'tue',\n WE: 'wed',\n TH: 'thu',\n FR: 'fri',\n SA: 'sat'\n};\nexport function getRecurrenceStringFromDate(date) {\n return [date.getUTCFullYear(),\n roundDateValues(date.getUTCMonth() + 1),\n roundDateValues(date.getUTCDate()),\n 'T',\n roundDateValues(date.getUTCHours()),\n roundDateValues(date.getUTCMinutes()),\n roundDateValues(date.getUTCSeconds()),\n 'Z'].join('');\n}\nfunction roundDateValues(date) {\n return ('0' + date).slice(-2);\n}\n","import { createElement, SvgRenderer, compile, merge, isNullOrUndefined } from '@syncfusion/ej2-base';\n/**\n * Create the class for size\n * @private\n */\nvar Size = /** @class */ (function () {\n function Size(width, height) {\n this.width = width;\n this.height = height;\n }\n return Size;\n}());\nexport { Size };\nexport function stringToNumber(value, containerSize) {\n if (value !== null && value !== undefined) {\n return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10);\n }\n return null;\n}\n/**\n * Internal use of type rect\n * @private\n */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n return Rect;\n}());\nexport { Rect };\n/**\n * Internal use of rectangle options\n * @private\n */\nvar RectOption = /** @class */ (function () {\n function RectOption(id, fill, border, opacity, rect, dashArray) {\n this.y = rect.y;\n this.x = rect.x;\n this.height = rect.height;\n this.width = rect.width;\n this.id = id;\n this.fill = fill;\n this.opacity = opacity;\n this.stroke = border.color;\n this['stroke-width'] = border.width;\n this['stroke-dasharray'] = dashArray;\n }\n return RectOption;\n}());\nexport { RectOption };\nvar PathOption = /** @class */ (function () {\n function PathOption(id, fill, width, color, opacity, dashArray, d) {\n this.id = id;\n this.opacity = opacity;\n this.fill = fill;\n this.stroke = color;\n this['stroke-width'] = width;\n this['stroke-dasharray'] = dashArray;\n this.d = d;\n }\n return PathOption;\n}());\nexport { PathOption };\n/**\n * Function to measure the height and width of the text.\n * @param {string} text\n * @param {FontModel} font\n * @param {string} id\n * @returns no\n * @private\n */\nexport function measureText(text, font) {\n var measureObject = document.getElementById('treeMapMeasureText');\n if (measureObject === null) {\n measureObject = createElement('text', { id: 'treeMapMeasureText' });\n document.body.appendChild(measureObject);\n }\n measureObject.innerHTML = text;\n measureObject.style.position = 'absolute';\n measureObject.style.fontSize = font.size;\n measureObject.style.fontWeight = font.fontWeight;\n measureObject.style.fontStyle = font.fontStyle;\n measureObject.style.fontFamily = font.fontFamily;\n measureObject.style.visibility = 'hidden';\n measureObject.style.top = '-100';\n measureObject.style.left = '0';\n measureObject.style.whiteSpace = 'nowrap';\n // For bootstrap line height issue\n measureObject.style.lineHeight = 'normal';\n return new Size(measureObject.clientWidth, measureObject.clientHeight);\n}\n/**\n * Internal use of text options\n * @private\n */\nvar TextOption = /** @class */ (function () {\n function TextOption(id, x, y, anchor, text, transform, baseLine) {\n if (transform === void 0) { transform = ''; }\n this.transform = '';\n this.baseLine = 'auto';\n this.id = id;\n this.text = text;\n this.transform = transform;\n this.anchor = anchor;\n this.x = x;\n this.y = y;\n this.baseLine = baseLine;\n }\n return TextOption;\n}());\nexport { TextOption };\n/**\n * @private\n * Trim the title text\n */\nexport function textTrim(maxWidth, text, font) {\n var label = text;\n var size = measureText(text, font).width;\n if (size > maxWidth) {\n var textLength = text.length;\n for (var i = textLength - 1; i >= 0; --i) {\n label = text.substring(0, i) + '...';\n size = measureText(label, font).width;\n if (size <= maxWidth || label.length < 4) {\n if (label.length < 4) {\n label = ' ';\n }\n return label;\n }\n }\n }\n return label;\n}\n/**\n * Map internal class for Point\n */\nvar Location = /** @class */ (function () {\n function Location(x, y) {\n this.x = x;\n this.y = y;\n }\n return Location;\n}());\nexport { Location };\n/**\n * Method to calculate x position of title\n */\nexport function findPosition(location, alignment, textSize, type) {\n var x;\n var y;\n switch (alignment) {\n case 'Near':\n x = location.x;\n break;\n case 'Center':\n x = (type === 'title') ? (location.width / 2 - textSize.width / 2) :\n ((location.x + (location.width / 2)) - textSize.width / 2);\n break;\n case 'Far':\n x = (type === 'title') ? (location.width - location.y - textSize.width) :\n ((location.x + location.width) - textSize.width);\n break;\n }\n y = (type === 'title') ? location.y + (textSize.height / 2) : ((location.y + location.height / 2) + textSize.height / 2);\n return new Location(x, y);\n}\n/**\n * Internal rendering of text\n * @private\n */\nexport function renderTextElement(options, font, color, parent, isMinus) {\n if (isMinus === void 0) { isMinus = false; }\n var renderOptions = {\n 'font-size': font.size,\n 'font-style': font.fontStyle,\n 'font-family': font.fontFamily,\n 'font-weight': font.fontWeight,\n 'text-anchor': options.anchor,\n 'transform': options.transform,\n 'opacity': font.opacity,\n 'dominant-baseline': options.baseLine,\n 'id': options.id,\n 'x': options.x,\n 'y': options.y,\n 'fill': color\n };\n var text = typeof options.text === 'string' ? options.text : isMinus ? options.text[options.text.length - 1] : options.text[0];\n var tspanElement;\n var renderer = new SvgRenderer('');\n var height;\n var htmlObject = renderer.createText(renderOptions, text);\n htmlObject.style['user-select'] = 'none';\n htmlObject.style['-moz-user-select'] = 'none';\n htmlObject.style['-webkit-touch-callout'] = 'none';\n htmlObject.style['-webkit-user-select'] = 'none';\n htmlObject.style['-khtml-user-select'] = 'none';\n htmlObject.style['-ms-user-select'] = 'none';\n htmlObject.style['-o-user-select'] = 'none';\n if (typeof options.text !== 'string' && options.text.length > 1) {\n for (var i = 1, len = options.text.length; i < len; i++) {\n height = (measureText(options.text[i], font).height);\n tspanElement = renderer.createTSpan({\n 'x': options.x, 'id': options.id,\n 'y': (options.y) + (i * height)\n }, options.text[i]);\n htmlObject.appendChild(tspanElement);\n }\n }\n parent.appendChild(htmlObject);\n return htmlObject;\n}\nexport function getElement(id) {\n return document.getElementById(id);\n}\n/* tslint:disable:no-string-literal */\nexport function itemsToOrder(a, b) {\n return a['weight'] === b['weight'] ? 0 : a['weight'] < b['weight'] ? 1 : -1;\n}\nexport function isContainsData(source, pathName, processData, treemap) {\n var isExist = false;\n var name = '';\n var path;\n var leaf = treemap.leafItemSettings;\n for (var i = 0; i < source.length; i++) {\n path = treemap.levels[i] ? treemap.levels[i].groupPath : leaf.labelPath ? leaf.labelPath : treemap.weightValuePath;\n if (source[i] === processData[path]) {\n name += (processData[path]) + (i === source.length - 1 ? '' : '_');\n if (name === pathName) {\n isExist = true;\n break;\n }\n }\n }\n return isExist;\n}\nexport function findChildren(data) {\n var children;\n if (data) {\n var keys = Object.keys(data);\n children = new Object();\n for (var i = 0; i < keys.length; i++) {\n if (data[keys[i]] instanceof Array) {\n children['values'] = data[keys[i]];\n children['key'] = keys[i];\n break;\n }\n }\n }\n return children;\n}\nexport function findHightLightItems(data, items, mode, treeMap) {\n if (mode === 'Child') {\n items.push(data['levelOrderName']);\n var children = findChildren(data)['values'];\n if (children && children.length > 0) {\n for (var i = 0; i < children.length; i++) {\n if (items.indexOf(children[i]['levelOrderName']) === -1) {\n items.push(children[i]['levelOrderName']);\n }\n }\n for (var j = 0; j < children.length; j++) {\n findHightLightItems(children[j], items, mode, treeMap);\n }\n }\n }\n else if (mode === 'Parent') {\n if (typeof data['levelOrderName'] === 'string' && items.indexOf(data['levelOrderName']) === -1) {\n items.push(data['levelOrderName']);\n findHightLightItems(data['parent'], items, mode, treeMap);\n }\n }\n else if (mode === 'All') {\n var parentName = data['levelOrderName'].split('_')[0];\n var currentItem = void 0;\n for (var i = 0; i < treeMap.layout.renderItems.length; i++) {\n currentItem = treeMap.layout.renderItems[i];\n if ((currentItem['levelOrderName']).indexOf(parentName) > -1 && items.indexOf(currentItem['levelOrderName']) === -1) {\n items.push(currentItem['levelOrderName']);\n }\n }\n }\n else {\n items.push(data['levelOrderName']);\n }\n return items;\n}\n/**\n * Function to compile the template function for maps.\n * @returns Function\n * @private\n */\nexport function getTemplateFunction(template) {\n var templateFn = null;\n var e;\n try {\n if (document.querySelectorAll(template).length) {\n templateFn = compile(document.querySelector(template).innerHTML.trim());\n }\n }\n catch (e) {\n templateFn = compile(template);\n }\n return templateFn;\n}\n/**\n * @private\n */\nexport function convertElement(element, labelId, data) {\n var childElement = createElement('div', {\n id: labelId,\n styles: 'position: absolute;pointer-events: auto;'\n });\n while (element.length > 0) {\n childElement.appendChild(element[0]);\n }\n var templateHtml = childElement.innerHTML;\n var keys = Object.keys(data);\n for (var i = 0; i < keys.length; i++) {\n templateHtml = templateHtml.replace(new RegExp('{{:' + keys[i] + '}}', 'g'), data[keys[i].toString()]);\n }\n childElement.innerHTML = templateHtml;\n return childElement;\n}\nexport function findLabelLocation(rect, position, labelSize, type, treemap) {\n var location = new Location(0, 0);\n var padding = 5;\n var paddings = 2;\n var elementRect = treemap.element.getBoundingClientRect();\n var x = (type === 'Template') ? treemap.areaRect.x : 0;\n var y = (type === 'Template') ? treemap.areaRect.y : 0;\n location.x = (Math.abs(x - ((position.indexOf('Left') > -1) ? rect.x + padding : !(position.indexOf('Right') > -1) ?\n rect.x + ((rect.width / 2) - (labelSize.width / 2)) : (rect.x + rect.width) - labelSize.width))) - paddings;\n location.y = Math.abs(y - ((position.indexOf('Top') > -1) ? (type === 'Template' ? rect.y : rect.y + labelSize.height) :\n !(position.indexOf('Bottom') > -1) ? type === 'Template' ? (rect.y + ((rect.height / 2) - (labelSize.height / 2))) :\n (rect.y + (rect.height / 2) + labelSize.height / 4) : (rect.y + rect.height) - labelSize.height));\n return location;\n}\nexport function measureElement(element, parentElement) {\n var size = new Size(0, 0);\n parentElement.appendChild(element);\n size.height = element.offsetHeight;\n size.width = element.offsetWidth;\n document.getElementById(element.id).remove();\n return size;\n}\nexport function getArea(rect) {\n return (rect.width - rect.x) * (rect.height - rect.y);\n}\nexport function getShortestEdge(input) {\n var container = convertToContainer(input);\n var width = container.width;\n var height = container.height;\n var result = Math.min(width, height);\n return result;\n}\nexport function convertToContainer(rect) {\n var x = rect.x;\n var y = rect.y;\n var width = rect.width;\n var height = rect.height;\n return {\n x: x,\n y: y,\n width: width - x,\n height: height - y\n };\n}\nexport function convertToRect(container) {\n var xOffset = container.x;\n var yOffset = container.y;\n var width = container.width;\n var height = container.height;\n return {\n x: xOffset,\n y: yOffset,\n width: xOffset + width,\n height: yOffset + height,\n };\n}\nexport function getMousePosition(pageX, pageY, element) {\n var elementRect = element.getBoundingClientRect();\n var pageXOffset = element.ownerDocument.defaultView.pageXOffset;\n var pageYOffset = element.ownerDocument.defaultView.pageYOffset;\n var clientTop = element.ownerDocument.documentElement.clientTop;\n var clientLeft = element.ownerDocument.documentElement.clientLeft;\n var positionX = elementRect.left + pageXOffset - clientLeft;\n var positionY = elementRect.top + pageYOffset - clientTop;\n return new Location((pageX - positionX), (pageY - positionY));\n}\nexport function colorMap(colorMapping, equalValue, value, weightValuePath) {\n var fill;\n var paths = [];\n var opacity;\n if (isNullOrUndefined(equalValue) && (isNullOrUndefined(value) && isNaN(value))) {\n return null;\n }\n for (var i = 0; i < colorMapping.length; i++) {\n var color = null;\n if (colorMapping[i].from && colorMapping[i].to && colorMapping[i].value) {\n if ((value >= colorMapping[i].from && colorMapping[i].to >= value) && (colorMapping[i].value === equalValue)) {\n color = colorMapping[i].color;\n }\n }\n else if ((colorMapping[i].from && colorMapping[i].to) || (colorMapping[i].value)) {\n colorMapping[i].value = !isNullOrUndefined(colorMapping[i].value) ? colorMapping[i].value.toString() : colorMapping[i].value;\n if ((value >= colorMapping[i].from && colorMapping[i].to >= value) || (colorMapping[i].value === equalValue)) {\n color = colorMapping[i].color;\n }\n }\n if (colorMapping[i].minOpacity && colorMapping[i].maxOpacity && color) {\n opacity = deSaturationColor(weightValuePath, colorMapping[i], color, value);\n }\n fill = color;\n opacity = (colorMapping[i].minOpacity) ? opacity : '1';\n paths.push(fill);\n }\n for (var j = paths.length - 1; j >= 0; j--) {\n fill = paths[j];\n j = (fill) ? -1 : j;\n }\n return { fill: fill, opacity: opacity };\n}\nexport function deSaturationColor(weightValuePath, colorMapping, color, rangeValue) {\n var opacity = 0;\n if ((rangeValue >= colorMapping.from && rangeValue <= colorMapping.to)) {\n var ratio = (rangeValue - colorMapping.from) / (colorMapping.to - colorMapping.from);\n opacity = (ratio * (colorMapping.maxOpacity - colorMapping.minOpacity)) + colorMapping.minOpacity;\n }\n return opacity.toString();\n}\nexport function wordWrap(maximumWidth, dataLabel, font) {\n var textCollection = dataLabel.split(' ');\n var label = '';\n var labelCollection = [];\n var text;\n for (var i = 0, len = textCollection.length; i < len; i++) {\n text = textCollection[i];\n if (measureText(label.concat(text), font).width < maximumWidth) {\n label = label.concat((label === '' ? '' : ' ') + text);\n }\n else {\n if (label !== '') {\n labelCollection.push(textTrim(maximumWidth, label, font));\n label = text;\n }\n else {\n labelCollection.push(textTrim(maximumWidth, text, font));\n text = '';\n }\n }\n if (label && i === len - 1) {\n labelCollection.push(textTrim(maximumWidth, label, font));\n }\n }\n return labelCollection;\n}\nexport function textWrap(maxWidth, label, font) {\n var text = label;\n var resultText = [];\n var currentLength = 0;\n var totalWidth = measureText(label, font).width;\n var totalLength = label.length;\n if (maxWidth >= totalWidth) {\n resultText.push(label);\n return resultText;\n }\n else {\n for (var i = label.length; i > currentLength; i--) {\n var sliceString = label.slice(currentLength, i);\n totalWidth = measureText(sliceString, font).width;\n if (totalWidth <= maxWidth) {\n resultText.push(sliceString);\n currentLength += sliceString.length;\n if (totalLength === currentLength) {\n return resultText;\n }\n i = totalLength + 1;\n }\n }\n }\n return resultText;\n}\n/**\n * hide function\n */\nexport function hide(maxWidth, maxHeight, text, font) {\n var hideText = text;\n var textSize = measureText(text, font);\n hideText = (textSize.width > maxWidth || textSize.height > maxHeight) ? ' ' : text;\n return hideText;\n}\nexport function orderByArea(a, b) {\n if (a['itemArea'] === b['itemArea']) {\n return 0;\n }\n else if (a['itemArea'] < b['itemArea']) {\n return 1;\n }\n return -1;\n}\nexport function removeClassNames(elements, type, treemap) {\n var opacity;\n var process = true;\n var element;\n var stroke;\n var strokeWidth;\n var fill;\n var options = {};\n for (var j = 0; j < elements.length; j++) {\n element = elements[j].childNodes[0];\n options = treemap.layout.renderItems[element.id.split('_')[6]]['options'];\n applyOptions(element, options);\n elements[j].classList.remove(type);\n j -= 1;\n }\n}\nexport function applyOptions(element, options) {\n element.setAttribute('opacity', options['opacity']);\n element.setAttribute('fill', options['fill']);\n element.setAttribute('stroke', options['border']['color']);\n element.setAttribute('stroke-width', options['border']['width']);\n}\nexport function textFormatter(format, data, treemap) {\n if (isNullOrUndefined(format)) {\n return null;\n }\n var keys = Object.keys(data);\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n format = format.split('${' + key + '}').join(formatValue(data[key], treemap).toString());\n }\n return format;\n}\nexport function formatValue(value, treemap) {\n var formatValue;\n var formatFunction;\n if (treemap.format && !isNaN(Number(value))) {\n formatFunction = treemap.intl.getNumberFormat({ format: treemap.format, useGrouping: treemap.useGroupingSeparator });\n formatValue = formatFunction(Number(value));\n }\n else {\n formatValue = value;\n }\n return formatValue ? formatValue : '';\n}\n/** @private */\nvar ColorValue = /** @class */ (function () {\n function ColorValue(r, g, b) {\n this.r = r;\n this.g = g;\n this.b = b;\n }\n return ColorValue;\n}());\nexport { ColorValue };\n/** @private */\nexport function convertToHexCode(value) {\n return '#' + componentToHex(value.r) + componentToHex(value.g) + componentToHex(value.b);\n}\n/** @private */\nexport function componentToHex(value) {\n var hex = value.toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n}\n/** @private */\nexport function convertHexToColor(hex) {\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result ? new ColorValue(parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)) :\n new ColorValue(255, 255, 255);\n}\n/** @private */\nexport function colorNameToHex(color) {\n var element;\n color = color === 'transparent' ? 'white' : color;\n element = document.getElementById('treeMapMeasureText');\n element.style.color = color;\n color = window.getComputedStyle(element).color;\n var exp = /^(rgb|hsl)(a?)[(]\\s*([\\d.]+\\s*%?)\\s*,\\s*([\\d.]+\\s*%?)\\s*,\\s*([\\d.]+\\s*%?)\\s*(?:,\\s*([\\d.]+)\\s*)?[)]$/;\n var isRGBValue = exp.exec(color);\n return convertToHexCode(new ColorValue(parseInt(isRGBValue[3], 10), parseInt(isRGBValue[4], 10), parseInt(isRGBValue[5], 10)));\n}\n/** @private */\nexport function drawSymbol(location, shape, size, url, options, label) {\n var functionName = 'Path';\n var svgRenderer = new SvgRenderer('');\n var temp = renderLegendShape(location, size, shape, options, url);\n var htmlElement = svgRenderer['draw' + temp.functionName](temp.renderOption);\n htmlElement.setAttribute('aria-label', label);\n return htmlElement;\n}\n/** @private */\nexport function renderLegendShape(location, size, shape, options, url) {\n var renderPath;\n var functionName = 'Path';\n var shapeWidth = size.width;\n var shapeHeight = size.height;\n var shapeX = location.x;\n var shapeY = location.y;\n var x = location.x + (-shapeWidth / 2);\n var y = location.y + (-shapeHeight / 2);\n switch (shape) {\n case 'Circle':\n case 'Bubble':\n functionName = 'Ellipse';\n merge(options, { 'rx': shapeWidth / 2, 'ry': shapeHeight / 2, 'cx': shapeX, 'cy': shapeY });\n break;\n case 'VerticalLine':\n renderPath = 'M' + ' ' + shapeX + ' ' + (shapeY + (shapeHeight / 2)) + ' ' + 'L' + ' ' + shapeX + ' '\n + (shapeY + (-shapeHeight / 2));\n merge(options, { 'd': renderPath });\n break;\n case 'Diamond':\n renderPath = 'M' + ' ' + x + ' ' + shapeY + ' ' +\n 'L' + ' ' + shapeX + ' ' + (shapeY + (-shapeHeight / 2)) + ' ' +\n 'L' + ' ' + (shapeX + (shapeWidth / 2)) + ' ' + shapeY + ' ' +\n 'L' + ' ' + shapeX + ' ' + (shapeY + (shapeHeight / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + shapeY + ' z';\n merge(options, { 'd': renderPath });\n break;\n case 'Rectangle':\n renderPath = 'M' + ' ' + x + ' ' + (shapeY + (-shapeHeight / 2)) + ' ' +\n 'L' + ' ' + (shapeX + (shapeWidth / 2)) + ' ' + (shapeY + (-shapeHeight / 2)) + ' ' +\n 'L' + ' ' + (shapeX + (shapeWidth / 2)) + ' ' + (shapeY + (shapeHeight / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (shapeY + (shapeHeight / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (shapeY + (-shapeHeight / 2)) + ' z';\n merge(options, { 'd': renderPath });\n break;\n case 'Triangle':\n renderPath = 'M' + ' ' + x + ' ' + (shapeY + (shapeHeight / 2)) + ' ' +\n 'L' + ' ' + shapeX + ' ' + (shapeY + (-shapeHeight / 2)) + ' ' +\n 'L' + ' ' + (shapeX + (shapeWidth / 2)) + ' ' + (shapeY + (shapeHeight / 2)) + ' ' +\n 'L' + ' ' + x + ' ' + (shapeY + (shapeHeight / 2)) + ' z';\n merge(options, { 'd': renderPath });\n break;\n case 'InvertedTriangle':\n renderPath = 'M' + ' ' + (shapeX + (shapeWidth / 2)) + ' ' + (shapeY - (shapeHeight / 2)) + ' ' +\n 'L' + ' ' + shapeX + ' ' + (shapeY + (shapeHeight / 2)) + ' ' +\n 'L' + ' ' + (shapeX - (shapeWidth / 2)) + ' ' + (shapeY - (shapeHeight / 2)) + ' ' +\n 'L' + ' ' + (shapeX + (shapeWidth / 2)) + ' ' + (shapeY - (shapeHeight / 2)) + ' z';\n merge(options, { 'd': renderPath });\n break;\n case 'Pentagon':\n var eq = 72;\n var xValue = void 0;\n var yValue = void 0;\n for (var i = 0; i <= 5; i++) {\n xValue = (shapeWidth / 2) * Math.cos((Math.PI / 180) * (i * eq));\n yValue = (shapeWidth / 2) * Math.sin((Math.PI / 180) * (i * eq));\n if (i === 0) {\n renderPath = 'M' + ' ' + (shapeX + xValue) + ' ' + (shapeY + yValue) + ' ';\n }\n else {\n renderPath = renderPath.concat('L' + ' ' + (shapeX + xValue) + ' ' + (shapeY + yValue) + ' ');\n }\n }\n renderPath = renderPath.concat('Z');\n merge(options, { 'd': renderPath });\n break;\n case 'Star':\n renderPath = 'M ' + (location.x + size.width / 3) + ' ' + (location.y - size.height / 2) + ' L ' + (location.x - size.width / 2)\n + ' ' + (location.y + size.height / 6) + ' L ' + (location.x + size.width / 2) + ' ' + (location.y + size.height / 6)\n + ' L ' + (location.x - size.width / 3) + ' ' + (location.y - size.height / 2) + ' L ' + location.x + ' ' +\n (location.y + size.height / 2) + ' L ' + (location.x + size.width / 3) + ' ' + (location.y - size.height / 2) + ' Z';\n merge(options, { 'd': renderPath });\n break;\n case 'Cross':\n renderPath = 'M' + ' ' + x + ' ' + shapeY + ' ' + 'L' + ' ' + (shapeX + (shapeWidth / 2)) + ' ' + shapeY + ' ' +\n 'M' + ' ' + shapeX + ' ' + (shapeY + (shapeHeight / 2)) + ' ' + 'L' + ' ' + shapeX + ' ' +\n (shapeY + (-shapeHeight / 2));\n merge(options, { 'd': renderPath });\n break;\n case 'Image':\n functionName = 'Image';\n merge(options, { 'href': url, 'height': shapeHeight, 'width': shapeWidth, x: x, y: y });\n break;\n }\n return { renderOption: options, functionName: functionName };\n}\nexport function isParentItem(data, item) {\n var isParentItem = false;\n for (var j = 0; j < data.length; j++) {\n if (item['levelOrderName'] === data[j]['levelOrderName']) {\n isParentItem = true;\n break;\n }\n }\n return isParentItem;\n}\nvar TreeMapAjax = /** @class */ (function () {\n function TreeMapAjax(options, type, async, contentType, sendData) {\n this.dataOptions = options;\n this.type = type || 'GET';\n this.async = async || true;\n this.contentType = contentType;\n this.sendData = sendData;\n }\n return TreeMapAjax;\n}());\nexport { TreeMapAjax };\n","import { isNullOrUndefined, merge } from './util';\nvar headerRegex = /^(.*?):[ \\t]*([^\\r\\n]*)$/gm;\nvar defaultType = 'GET';\n/**\n * Ajax class provides ability to make asynchronous HTTP request to the server\n * ```typescript\n * var ajax = new Ajax(\"index.html\", \"GET\", true);\n * ajax.send().then(\n * function (value) {\n * console.log(value);\n * },\n * function (reason) {\n * console.log(reason);\n * });\n * ```\n */\nvar Ajax = /** @class */ (function () {\n /**\n * Constructor for Ajax class\n * @param {string|Object} options?\n * @param {string} type?\n * @param {boolean} async?\n * @returns defaultType\n */\n function Ajax(options, type, async, contentType) {\n /**\n * A boolean value indicating whether the request should be sent asynchronous or not.\n * @default true\n */\n this.mode = true;\n /**\n * A boolean value indicating whether to ignore the promise reject.\n * @private\n * @default true\n */\n this.emitError = true;\n this.options = {};\n if (typeof options === 'string') {\n this.url = options;\n this.type = type ? type.toUpperCase() : defaultType;\n this.mode = !isNullOrUndefined(async) ? async : true;\n }\n else if (typeof options === 'object') {\n this.options = options;\n merge(this, this.options);\n }\n this.type = this.type ? this.type.toUpperCase() : defaultType;\n this.contentType = (this.contentType !== undefined) ? this.contentType : contentType;\n }\n /**\n * Send the request to server.\n * @param {any} data - To send the user data\n * @return {Promise}\n */\n Ajax.prototype.send = function (data) {\n var _this = this;\n this.data = isNullOrUndefined(data) ? this.data : data;\n var eventArgs = {\n cancel: false\n };\n var promise = new Promise(function (resolve, reject) {\n _this.httpRequest = new XMLHttpRequest();\n _this.httpRequest.onreadystatechange = function () { _this.stateChange(resolve, reject); };\n if (!isNullOrUndefined(_this.onLoad)) {\n _this.httpRequest.onload = _this.onLoad;\n }\n if (!isNullOrUndefined(_this.onProgress)) {\n _this.httpRequest.onprogress = _this.onProgress;\n }\n /* istanbul ignore next */\n if (!isNullOrUndefined(_this.onAbort)) {\n _this.httpRequest.onabort = _this.onAbort;\n }\n /* istanbul ignore next */\n if (!isNullOrUndefined(_this.onError)) {\n _this.httpRequest.onerror = _this.onError;\n }\n //** Upload Events **/\n /* istanbul ignore next */\n if (!isNullOrUndefined(_this.onUploadProgress)) {\n _this.httpRequest.upload.onprogress = _this.onUploadProgress;\n }\n _this.httpRequest.open(_this.type, _this.url, _this.mode);\n // Set default headers\n if (!isNullOrUndefined(_this.data) && _this.contentType !== null) {\n _this.httpRequest.setRequestHeader('Content-Type', _this.contentType || 'application/json; charset=utf-8');\n }\n if (_this.beforeSend) {\n _this.beforeSend(eventArgs);\n }\n if (!eventArgs.cancel) {\n _this.httpRequest.send(!isNullOrUndefined(_this.data) ? _this.data : null);\n }\n });\n return promise;\n };\n Ajax.prototype.successHandler = function (data) {\n if (this.onSuccess) {\n this.onSuccess(data, this);\n }\n return data;\n };\n Ajax.prototype.failureHandler = function (reason) {\n if (this.onFailure) {\n this.onFailure(this.httpRequest);\n }\n return reason;\n };\n Ajax.prototype.stateChange = function (resolve, reject) {\n var data = this.httpRequest.responseText;\n if (this.dataType && this.dataType.toLowerCase() === 'json') {\n if (data === '') {\n data = undefined;\n }\n else {\n try {\n data = JSON.parse(data);\n }\n catch (error) {\n // no exception handle\n }\n }\n }\n if (this.httpRequest.readyState === 4) {\n //success range should be 200 to 299\n if ((this.httpRequest.status >= 200 && this.httpRequest.status <= 299) || this.httpRequest.status === 304) {\n resolve(this.successHandler(data));\n }\n else {\n if (this.emitError) {\n reject(new Error(this.failureHandler(this.httpRequest.statusText)));\n }\n else {\n resolve();\n }\n }\n }\n };\n /**\n * To get the response header from XMLHttpRequest\n * @param {string} key Key to search in the response header\n * @returns {string}\n */\n Ajax.prototype.getResponseHeader = function (key) {\n var responseHeaders;\n var header;\n responseHeaders = {};\n var headers = headerRegex.exec(this.httpRequest.getAllResponseHeaders());\n while (headers) {\n responseHeaders[headers[1].toLowerCase()] = headers[2];\n headers = headerRegex.exec(this.httpRequest.getAllResponseHeaders());\n }\n header = responseHeaders[key.toLowerCase()];\n return isNullOrUndefined(header) ? null : header;\n };\n return Ajax;\n}());\nexport { Ajax };\n","import { debounce, extend } from './util';\n/**\n * EventHandler class provides option to add, remove, clear and trigger events to a HTML DOM element\n * @private\n * ```html\n *
\n * \n * ```\n */\nvar EventHandler = /** @class */ (function () {\n function EventHandler() {\n }\n // to get the event data based on element\n EventHandler.addOrGetEventData = function (element) {\n if ('__eventList' in element) {\n return element.__eventList.events;\n }\n else {\n element.__eventList = {};\n return element.__eventList.events = [];\n }\n };\n /**\n * Add an event to the specified DOM element.\n * @param {any} element - Target HTML DOM element\n * @param {string} eventName - A string that specifies the name of the event\n * @param {Function} listener - Specifies the function to run when the event occurs\n * @param {Object} bindTo - A object that binds 'this' variable in the event handler\n * @param {number} debounce - Specifies at what interval given event listener should be triggered.\n * @return {Function}\n */\n EventHandler.add = function (element, eventName, listener, bindTo, intDebounce) {\n var eventData = EventHandler.addOrGetEventData(element);\n var debounceListener;\n if (intDebounce) {\n debounceListener = debounce(listener, intDebounce);\n }\n else {\n debounceListener = listener;\n }\n if (bindTo) {\n debounceListener = debounceListener.bind(bindTo);\n }\n var event = eventName.split(' ');\n for (var i = 0; i < event.length; i++) {\n eventData.push({\n name: event[i],\n listener: listener,\n debounce: debounceListener\n });\n element.addEventListener(event[i], debounceListener);\n }\n return debounceListener;\n };\n /**\n * Remove an event listener that has been attached before.\n * @param {any} element - Specifies the target html element to remove the event\n * @param {string} eventName - A string that specifies the name of the event to remove\n * @param {Function} listener - Specifies the function to remove\n * @return {void}\n */\n EventHandler.remove = function (element, eventName, listener) {\n var eventData = EventHandler.addOrGetEventData(element);\n var event = eventName.split(' ');\n var _loop_1 = function (j) {\n var index = -1;\n var debounceListener;\n if (eventData && eventData.length !== 0) {\n eventData.some(function (x, i) {\n return x.name === event[j] && x.listener === listener ?\n (index = i, debounceListener = x.debounce, true) : false;\n });\n }\n if (index !== -1) {\n eventData.splice(index, 1);\n }\n if (debounceListener) {\n element.removeEventListener(event[j], debounceListener);\n }\n };\n for (var j = 0; j < event.length; j++) {\n _loop_1(j);\n }\n };\n /**\n * Clear all the event listeners that has been previously attached to the element.\n * @param {any} element - Specifies the target html element to clear the events\n * @return {void}\n */\n EventHandler.clearEvents = function (element) {\n var eventData;\n var copyData;\n eventData = EventHandler.addOrGetEventData(element);\n copyData = extend([], copyData, eventData);\n for (var i = 0; i < copyData.length; i++) {\n element.removeEventListener(copyData[i].name, copyData[i].debounce);\n eventData.shift();\n }\n };\n /**\n * Trigger particular event of the element.\n * @param {any} element - Specifies the target html element to trigger the events\n * @param {string} eventName - Specifies the event to trigger for the specified element.\n * Can be a custom event, or any of the standard events.\n * @param {any} eventProp - Additional parameters to pass on to the event properties\n * @return {void}\n */\n EventHandler.trigger = function (element, eventName, eventProp) {\n var eventData = EventHandler.addOrGetEventData(element);\n var fn = null;\n for (var _i = 0, eventData_1 = eventData; _i < eventData_1.length; _i++) {\n var event_1 = eventData_1[_i];\n if (event_1.name === eventName) {\n event_1.debounce.call(this, eventProp);\n }\n }\n };\n return EventHandler;\n}());\nexport { EventHandler };\n","import { isNullOrUndefined, getValue } from './util';\nvar Observer = /** @class */ (function () {\n function Observer(context) {\n this.ranArray = [];\n this.boundedEvents = {};\n if (isNullOrUndefined(context)) {\n return;\n }\n this.context = context;\n }\n ;\n /**\n * To attach handler for given property in current context.\n * @param {string} property - specifies the name of the event.\n * @param {Function} handler - Specifies the handler function to be called while event notified.\n * @param {Object} context - Specifies the context binded to the handler.\n * @param {string} id - specifies the random generated id.\n * @return {void}\n */\n Observer.prototype.on = function (property, handler, context, id) {\n if (isNullOrUndefined(handler)) {\n return;\n }\n var cntxt = context || this.context;\n if (this.notExist(property)) {\n this.boundedEvents[property] = [{ handler: handler, context: cntxt }];\n return;\n }\n if (!isNullOrUndefined(id)) {\n if (this.ranArray.indexOf(id) === -1) {\n this.ranArray.push(id);\n this.boundedEvents[property].push({ handler: handler, context: cntxt, id: id });\n }\n }\n else if (!this.isHandlerPresent(this.boundedEvents[property], handler)) {\n this.boundedEvents[property].push({ handler: handler, context: cntxt });\n }\n };\n /**\n * To remove handlers from a event attached using on() function.\n * @param {string} eventName - specifies the name of the event.\n * @param {Function} handler - Optional argument specifies the handler function to be called while event notified.\n * @param {string} id - specifies the random generated id.\n * @return {void}\n */\n Observer.prototype.off = function (property, handler, id) {\n if (this.notExist(property)) {\n return;\n }\n var curObject = getValue(property, this.boundedEvents);\n if (handler) {\n for (var i = 0; i < curObject.length; i++) {\n if (id) {\n curObject.splice(i, 1);\n var indexLocation = this.ranArray.indexOf(id);\n if (indexLocation !== -1) {\n this.ranArray.splice(indexLocation, 1);\n }\n break;\n }\n else if (handler === curObject[i].handler) {\n curObject.splice(i, 1);\n break;\n }\n }\n }\n else {\n delete this.boundedEvents[property];\n }\n };\n /**\n * To notify the handlers in the specified event.\n * @param {string} property - Specifies the event to be notify.\n * @param {Object} args - Additional parameters to pass while calling the handler.\n * @return {void}\n */\n Observer.prototype.notify = function (property, argument) {\n if (this.notExist(property)) {\n return;\n }\n if (argument) {\n argument.name = property;\n }\n var curObject = getValue(property, this.boundedEvents).slice(0);\n for (var _i = 0, curObject_1 = curObject; _i < curObject_1.length; _i++) {\n var cur = curObject_1[_i];\n cur.handler.call(cur.context, argument);\n }\n };\n /**\n * To destroy handlers in the event\n */\n Observer.prototype.destroy = function () {\n this.boundedEvents = this.context = undefined;\n };\n /**\n * Returns if the property exists.\n */\n Observer.prototype.notExist = function (prop) {\n return this.boundedEvents.hasOwnProperty(prop) === false;\n };\n /**\n * Returns if the handler is present.\n */\n Observer.prototype.isHandlerPresent = function (boundedEvents, handler) {\n for (var _i = 0, boundedEvents_1 = boundedEvents; _i < boundedEvents_1.length; _i++) {\n var cur = boundedEvents_1[_i];\n if (cur.handler === handler) {\n return true;\n }\n }\n return false;\n };\n return Observer;\n}());\nexport { Observer };\n","import { isUndefined, isNullOrUndefined, merge, setImmediate, setValue } from './util';\nimport { addClass, removeClass } from './dom';\nimport { Observer } from './observer';\n/* tslint:enable:no-any */\n/**\n * Base library module is common module for Framework modules like touch,keyboard and etc.,\n * @private\n */\nvar Base = /** @class */ (function () {\n /**\n * Base constructor accept options and element\n */\n function Base(options, element) {\n this.isProtectedOnChange = true;\n this.properties = {};\n this.changedProperties = {};\n this.oldProperties = {};\n this.refreshing = false;\n // tslint:disable-next-line:no-empty\n this.finalUpdate = function () { };\n this.childChangedProperties = {};\n this.modelObserver = new Observer(this);\n if (!isUndefined(element)) {\n if ('string' === typeof (element)) {\n this.element = document.querySelector(element);\n }\n else {\n this.element = element;\n }\n if (!isNullOrUndefined(this.element)) {\n this.isProtectedOnChange = false;\n this.addInstance();\n }\n }\n if (!isUndefined(options)) {\n this.setProperties(options, true);\n }\n this.isDestroyed = false;\n }\n /** Property base section */\n /**\n * Function used to set bunch of property at a time.\n * @private\n * @param {Object} prop - JSON object which holds components properties.\n * @param {boolean} muteOnChange? - Specifies to true when we set properties.\n */\n Base.prototype.setProperties = function (prop, muteOnChange) {\n var prevDetection = this.isProtectedOnChange;\n this.isProtectedOnChange = !!muteOnChange;\n merge(this, prop);\n if (muteOnChange !== true) {\n merge(this.changedProperties, prop);\n this.dataBind();\n }\n this.finalUpdate();\n this.changedProperties = {};\n this.oldProperties = {};\n this.isProtectedOnChange = prevDetection;\n };\n ;\n /**\n * Calls for child element data bind\n * @param {Object} obj\n * @param {Object} parent\n * @returns {void}\n */\n // tslint:disable-next-line:no-any\n Base.callChildDataBind = function (obj, parent) {\n var keys = Object.keys(obj);\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n if (parent[key] instanceof Array) {\n for (var _a = 0, _b = parent[key]; _a < _b.length; _a++) {\n var obj_1 = _b[_a];\n if (obj_1.dataBind !== undefined) {\n obj_1.dataBind();\n }\n }\n }\n else {\n parent[key].dataBind();\n }\n }\n };\n Base.prototype.clearChanges = function () {\n this.finalUpdate();\n this.changedProperties = {};\n this.oldProperties = {};\n this.childChangedProperties = {};\n };\n /**\n * Bind property changes immediately to components\n */\n Base.prototype.dataBind = function () {\n Base.callChildDataBind(this.childChangedProperties, this);\n if (Object.getOwnPropertyNames(this.changedProperties).length) {\n var prevDetection = this.isProtectedOnChange;\n var newChanges = this.changedProperties;\n var oldChanges = this.oldProperties;\n this.clearChanges();\n this.isProtectedOnChange = true;\n this.onPropertyChanged(newChanges, oldChanges);\n this.isProtectedOnChange = prevDetection;\n }\n };\n ;\n Base.prototype.saveChanges = function (key, newValue, oldValue) {\n if (this.isProtectedOnChange) {\n return;\n }\n this.oldProperties[key] = oldValue;\n this.changedProperties[key] = newValue;\n this.finalUpdate();\n this.finalUpdate = setImmediate(this.dataBind.bind(this));\n };\n ;\n /** Event Base Section */\n /**\n * Adds the handler to the given event listener.\n * @param {string} eventName - A String that specifies the name of the event\n * @param {Function} listener - Specifies the call to run when the event occurs.\n * @return {void}\n */\n Base.prototype.addEventListener = function (eventName, handler) {\n this.modelObserver.on(eventName, handler);\n };\n /**\n * Removes the handler from the given event listener.\n * @param {string} eventName - A String that specifies the name of the event to remove\n * @param {Function} listener - Specifies the function to remove\n * @return {void}\n */\n Base.prototype.removeEventListener = function (eventName, handler) {\n this.modelObserver.off(eventName, handler);\n };\n /**\n * Triggers the handlers in the specified event.\n * @private\n * @param {string} eventName - Specifies the event to trigger for the specified component properties.\n * Can be a custom event, or any of the standard events.\n * @param {Event} eventProp - Additional parameters to pass on to the event properties\n * @return {void}\n */\n Base.prototype.trigger = function (eventName, eventProp) {\n if (this.isDestroyed !== true) {\n var prevDetection = this.isProtectedOnChange;\n this.isProtectedOnChange = false;\n this.modelObserver.notify(eventName, eventProp);\n this.isProtectedOnChange = prevDetection;\n }\n };\n /**\n * To maintain instance in base class\n */\n Base.prototype.addInstance = function () {\n // Add module class to the root element\n var moduleClass = 'e-' + this.getModuleName().toLowerCase();\n addClass([this.element], ['e-control', moduleClass]);\n if (!isNullOrUndefined(this.element.ej2_instances)) {\n this.element.ej2_instances.push(this);\n }\n else {\n setValue('ej2_instances', [this], this.element);\n }\n };\n /**\n * To remove the instance from the element\n */\n Base.prototype.destroy = function () {\n var _this = this;\n this.element.ej2_instances =\n this.element.ej2_instances.filter(function (i) { return i !== _this; });\n removeClass([this.element], ['e-' + this.getModuleName()]);\n if (this.element.ej2_instances.length === 0) {\n // Remove module class from the root element\n removeClass([this.element], ['e-control']);\n }\n this.clearChanges();\n this.modelObserver.destroy();\n this.isDestroyed = true;\n };\n return Base;\n}());\nexport { Base };\nexport function getComponent(elem, comp) {\n var instance;\n var i;\n for (i = 0; i < elem.ej2_instances.length; i++) {\n instance = elem.ej2_instances[i];\n var compName = instance.getModuleName();\n if (comp === compName) {\n return instance;\n }\n }\n return undefined;\n}\n","import { isUndefined } from './util';\nvar REGX_MOBILE = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i;\nvar REGX_IE = /msie|trident/i;\nvar REGX_IE11 = /Trident\\/7\\./;\nvar REGX_IOS = /(ipad|iphone|ipod touch)/i;\nvar REGX_IOS7 = /(ipad|iphone|ipod touch);.*os 7_\\d|(ipad|iphone|ipod touch);.*os 8_\\d/i;\nvar REGX_ANDROID = /android/i;\nvar REGX_WINDOWS = /trident|windows phone|edge/i;\nvar REGX_VERSION = /(version)[ \\/]([\\w.]+)/i;\nvar REGX_BROWSER = {\n OPERA: /(opera|opr)(?:.*version|)[ \\/]([\\w.]+)/i,\n EDGE: /(edge)(?:.*version|)[ \\/]([\\w.]+)/i,\n CHROME: /(chrome|crios)[ \\/]([\\w.]+)/i,\n PANTHOMEJS: /(phantomjs)[ \\/]([\\w.]+)/i,\n SAFARI: /(safari)[ \\/]([\\w.]+)/i,\n WEBKIT: /(webkit)[ \\/]([\\w.]+)/i,\n MSIE: /(msie|trident) ([\\w.]+)/i,\n MOZILLA: /(mozilla)(?:.*? rv:([\\w.]+)|)/i\n};\n/* istanbul ignore else */\nif (typeof window !== 'undefined') {\n window.browserDetails = window.browserDetails || {};\n}\n/**\n * Get configuration details for Browser\n * @private\n */\nvar Browser = /** @class */ (function () {\n function Browser() {\n }\n Browser.extractBrowserDetail = function () {\n var browserInfo = { culture: {} };\n var keys = Object.keys(REGX_BROWSER);\n var clientInfo = [];\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n clientInfo = Browser.userAgent.match(REGX_BROWSER[key]);\n if (clientInfo) {\n browserInfo.name = (clientInfo[1].toLowerCase() === 'opr' ? 'opera' : clientInfo[1].toLowerCase());\n browserInfo.name = (clientInfo[1].toLowerCase() === 'crios' ? 'chrome' : browserInfo.name);\n browserInfo.version = clientInfo[2];\n browserInfo.culture.name = browserInfo.culture.language = navigator.language;\n if (!!Browser.userAgent.match(REGX_IE11)) {\n browserInfo.name = 'msie';\n break;\n }\n var version = Browser.userAgent.match(REGX_VERSION);\n if (browserInfo.name === 'safari' && version) {\n browserInfo.version = version[2];\n }\n break;\n }\n }\n return browserInfo;\n };\n /**\n * To get events from the browser\n * @param {string} event - type of event triggered.\n * @returns {Boolean}\n */\n Browser.getEvent = function (event) {\n // tslint:disable-next-line:no-any\n var events = {\n start: {\n isPointer: 'pointerdown', isTouch: 'touchstart', isDevice: 'mousedown'\n },\n move: {\n isPointer: 'pointermove', isTouch: 'touchmove', isDevice: 'mousemove'\n },\n end: {\n isPointer: 'pointerup', isTouch: 'touchend', isDevice: 'mouseup'\n },\n cancel: {\n isPointer: 'pointercancel', isTouch: 'touchcancel', isDevice: 'mouseleave'\n }\n };\n return (Browser.isPointer ? events[event].isPointer :\n (Browser.isTouch ? events[event].isTouch + (!Browser.isDevice ? ' ' + events[event].isDevice : '')\n : events[event].isDevice));\n };\n /**\n * To get the Touch start event from browser\n * @returns {string}\n */\n Browser.getTouchStartEvent = function () {\n return Browser.getEvent('start');\n };\n /**\n * To get the Touch end event from browser\n * @returns {string}\n */\n Browser.getTouchEndEvent = function () {\n return Browser.getEvent('end');\n };\n /**\n * To get the Touch move event from browser\n * @returns {string}\n */\n Browser.getTouchMoveEvent = function () {\n return Browser.getEvent('move');\n };\n /**\n * To cancel the touch event from browser\n * @returns {string}\n */\n Browser.getTouchCancelEvent = function () {\n return Browser.getEvent('cancel');\n };\n /**\n * To get the value based on provided key and regX\n * @param {string} key\n * @param {RegExp} regX\n * @returns {Object}\n */\n Browser.getValue = function (key, regX) {\n var browserDetails = window.browserDetails;\n if ('undefined' === typeof browserDetails[key]) {\n return browserDetails[key] = regX.test(Browser.userAgent);\n }\n return browserDetails[key];\n };\n Object.defineProperty(Browser, \"userAgent\", {\n get: function () {\n return Browser.uA;\n },\n //Properties \n /**\n * Property specifies the userAgent of the browser. Default userAgent value is based on the browser.\n * Also we can set our own userAgent.\n */\n set: function (uA) {\n Browser.uA = uA;\n window.browserDetails = {};\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"info\", {\n //Read Only Properties\n /**\n * Property is to get the browser information like Name, Version and Language\n * @returns BrowserInfo\n */\n get: function () {\n if (isUndefined(window.browserDetails.info)) {\n return window.browserDetails.info = Browser.extractBrowserDetail();\n }\n return window.browserDetails.info;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isIE\", {\n /**\n * Property is to get whether the userAgent is based IE.\n */\n get: function () {\n return Browser.getValue('isIE', REGX_IE);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isTouch\", {\n /**\n * Property is to get whether the browser has touch support.\n */\n get: function () {\n if (isUndefined(window.browserDetails.isTouch)) {\n return window.browserDetails.isTouch = ('ontouchstart' in window);\n }\n return window.browserDetails.isTouch;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isPointer\", {\n /**\n * Property is to get whether the browser has Pointer support.\n */\n get: function () {\n if (isUndefined(window.browserDetails.isPointer)) {\n return window.browserDetails.isPointer = ('pointerEnabled' in window.navigator);\n }\n return window.browserDetails.isPointer;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isMSPointer\", {\n /**\n * Property is to get whether the browser has MSPointer support.\n */\n get: function () {\n if (isUndefined(window.browserDetails.isMSPointer)) {\n return window.browserDetails.isMSPointer = ('msPointerEnabled' in window.navigator);\n }\n return window.browserDetails.isMSPointer;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isDevice\", {\n /**\n * Property is to get whether the userAgent is device based.\n */\n get: function () {\n return Browser.getValue('isDevice', REGX_MOBILE);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isIos\", {\n /**\n * Property is to get whether the userAgent is IOS.\n */\n get: function () {\n return Browser.getValue('isIos', REGX_IOS);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isIos7\", {\n /**\n * Property is to get whether the userAgent is Ios7.\n */\n get: function () {\n return Browser.getValue('isIos7', REGX_IOS7);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isAndroid\", {\n /**\n * Property is to get whether the userAgent is Android.\n */\n get: function () {\n return Browser.getValue('isAndroid', REGX_ANDROID);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isWebView\", {\n /**\n * Property is to identify whether application ran in web view.\n */\n get: function () {\n if (isUndefined(window.browserDetails.isWebView)) {\n window.browserDetails.isWebView = !(isUndefined(window.cordova) && isUndefined(window.PhoneGap)\n && isUndefined(window.phonegap) && window.forge !== 'object');\n return window.browserDetails.isWebView;\n }\n return window.browserDetails.isWebView;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"isWindows\", {\n /**\n * Property is to get whether the userAgent is Windows.\n */\n get: function () {\n return Browser.getValue('isWindows', REGX_WINDOWS);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"touchStartEvent\", {\n /**\n * Property is to get the touch start event. It returns event name based on browser.\n */\n get: function () {\n if (isUndefined(window.browserDetails.touchStartEvent)) {\n return window.browserDetails.touchStartEvent = Browser.getTouchStartEvent();\n }\n return window.browserDetails.touchStartEvent;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"touchMoveEvent\", {\n /**\n * Property is to get the touch move event. It returns event name based on browser.\n */\n get: function () {\n if (isUndefined(window.browserDetails.touchMoveEvent)) {\n return window.browserDetails.touchMoveEvent = Browser.getTouchMoveEvent();\n }\n return window.browserDetails.touchMoveEvent;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"touchEndEvent\", {\n /**\n * Property is to get the touch end event. It returns event name based on browser.\n */\n get: function () {\n if (isUndefined(window.browserDetails.touchEndEvent)) {\n return window.browserDetails.touchEndEvent = Browser.getTouchEndEvent();\n }\n return window.browserDetails.touchEndEvent;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Browser, \"touchCancelEvent\", {\n /**\n * Property is to cancel the touch end event.\n */\n get: function () {\n if (isUndefined(window.browserDetails.touchCancelEvent)) {\n return window.browserDetails.touchCancelEvent = Browser.getTouchCancelEvent();\n }\n return window.browserDetails.touchCancelEvent;\n },\n enumerable: true,\n configurable: true\n });\n /* istanbul ignore next */\n Browser.uA = typeof navigator !== 'undefined' ? navigator.userAgent : '';\n return Browser;\n}());\nexport { Browser };\n","import { defaultCurrencyCode } from '../internationalization';\nimport { getValue, isNullOrUndefined, extend } from '../util';\nimport { ParserBase as parser } from './parser-base';\nimport { DateFormat } from './date-formatter';\nimport { NumberFormat } from './number-formatter';\n/**\n * Date base common constants and function for date parser and formatter.\n */\nexport var IntlBase;\n(function (IntlBase) {\n // tslint:disable-next-line:max-line-length\n IntlBase.negativeDataRegex = /^(('[^']+'|''|[^*#@0,.E])*)(\\*.)?((([#,]*[0,]*0+)(\\.0*[0-9]*#*)?)|([#,]*@+#*))(E\\+?0+)?(('[^']+'|''|[^*#@0,.E])*)$/;\n IntlBase.customRegex = /^(('[^']+'|''|[^*#@0,.])*)(\\*.)?((([0#,]*[0,]*[0#]*)(\\.[0#]*)?)|([#,]*@+#*))(E\\+?0+)?(('[^']+'|''|[^*#@0,.E])*)$/;\n IntlBase.latnParseRegex = /0|1|2|3|4|5|6|7|8|9/g;\n var fractionRegex = /[0-9]/g;\n IntlBase.defaultCurrency = '$';\n var mapper = ['infinity', 'nan', 'group', 'decimal'];\n var patternRegex = /G|M|L|H|c|'| a|yy|y|EEEE|E/g;\n var patternMatch = {\n 'G': '',\n 'M': 'm',\n 'L': 'm',\n 'H': 'h',\n 'c': 'd',\n '\\'': '\"',\n ' a': ' AM/PM',\n 'yy': 'yy',\n 'y': 'yyyy',\n 'EEEE': 'dddd',\n 'E': 'ddd'\n };\n IntlBase.formatRegex = /(^[ncpae]{1})([0-1]?[0-9]|20)?$/i;\n IntlBase.currencyFormatRegex = /(^[ca]{1})([0-1]?[0-9]|20)?$/i;\n IntlBase.curWithoutNumberRegex = /(c|a)$/ig;\n var typeMapper = {\n '$': 'isCurrency',\n '%': 'isPercent',\n '-': 'isNegative',\n 0: 'nlead',\n 1: 'nend'\n };\n IntlBase.dateParseRegex = /([a-z])\\1*|'([^']|'')+'|''|./gi;\n IntlBase.basicPatterns = ['short', 'medium', 'long', 'full'];\n /* tslint:disable:quotemark */\n IntlBase.defaultObject = {\n 'dates': {\n 'calendars': {\n 'gregorian': {\n 'months': {\n 'stand-alone': {\n 'abbreviated': {\n '1': 'Jan',\n '2': 'Feb',\n '3': 'Mar',\n '4': 'Apr',\n '5': 'May',\n '6': 'Jun',\n '7': 'Jul',\n '8': 'Aug',\n '9': 'Sep',\n '10': 'Oct',\n '11': 'Nov',\n '12': 'Dec'\n },\n 'narrow': {\n '1': 'J',\n '2': 'F',\n '3': 'M',\n '4': 'A',\n '5': 'M',\n '6': 'J',\n '7': 'J',\n '8': 'A',\n '9': 'S',\n '10': 'O',\n '11': 'N',\n '12': 'D'\n },\n 'wide': {\n '1': 'January',\n '2': 'February',\n '3': 'March',\n '4': 'April',\n '5': 'May',\n '6': 'June',\n '7': 'July',\n '8': 'August',\n '9': 'September',\n '10': 'October',\n '11': 'November',\n '12': 'December'\n }\n }\n },\n \"days\": {\n \"stand-alone\": {\n \"abbreviated\": {\n \"sun\": \"Sun\",\n \"mon\": \"Mon\",\n \"tue\": \"Tue\",\n \"wed\": \"Wed\",\n \"thu\": \"Thu\",\n \"fri\": \"Fri\",\n \"sat\": \"Sat\"\n },\n \"narrow\": {\n \"sun\": \"S\",\n \"mon\": \"M\",\n \"tue\": \"T\",\n \"wed\": \"W\",\n \"thu\": \"T\",\n \"fri\": \"F\",\n \"sat\": \"S\"\n },\n \"short\": {\n \"sun\": \"Su\",\n \"mon\": \"Mo\",\n \"tue\": \"Tu\",\n \"wed\": \"We\",\n \"thu\": \"Th\",\n \"fri\": \"Fr\",\n \"sat\": \"Sa\"\n },\n \"wide\": {\n \"sun\": \"Sunday\",\n \"mon\": \"Monday\",\n \"tue\": \"Tuesday\",\n \"wed\": \"Wednesday\",\n \"thu\": \"Thursday\",\n \"fri\": \"Friday\",\n \"sat\": \"Saturday\"\n }\n }\n },\n \"dayPeriods\": {\n \"format\": {\n \"wide\": {\n \"am\": \"AM\",\n \"pm\": \"PM\"\n }\n }\n },\n 'eras': {\n 'eraNames': {\n '0': 'Before Christ',\n '0-alt-variant': 'Before Common Era',\n '1': 'Anno Domini',\n \"1-alt-variant\": \"Common Era\"\n },\n 'eraAbbr': {\n '0': 'BC',\n '0-alt-variant': 'BCE',\n '1': 'AD',\n '1-alt-variant': 'CE'\n },\n 'eraNarrow': {\n '0': 'B',\n '0-alt-variant': 'BCE',\n '1': 'A',\n '1-alt-variant': 'CE'\n }\n },\n 'dateFormats': {\n 'full': 'EEEE, MMMM d, y',\n 'long': 'MMMM d, y',\n 'medium': 'MMM d, y',\n 'short': 'M/d/yy'\n },\n 'timeFormats': {\n 'full': 'h:mm:ss a zzzz',\n 'long': 'h:mm:ss a z',\n 'medium': 'h:mm:ss a',\n 'short': 'h:mm a'\n },\n 'dateTimeFormats': {\n 'full': \"{1} 'at' {0}\",\n 'long': \"{1} 'at' {0}\",\n 'medium': '{1}, {0}',\n 'short': '{1}, {0}',\n 'availableFormats': {\n 'd': 'd',\n 'E': 'ccc',\n 'Ed': 'd E',\n 'Ehm': 'E h:mm a',\n 'EHm': 'E HH:mm',\n 'Ehms': 'E h:mm:ss a',\n 'EHms': 'E HH:mm:ss',\n 'Gy': 'y G',\n 'GyMMM': 'MMM y G',\n 'GyMMMd': 'MMM d, y G',\n 'GyMMMEd': 'E, MMM d, y G',\n 'h': 'h a',\n 'H': 'HH',\n 'hm': 'h:mm a',\n 'Hm': 'HH:mm',\n 'hms': 'h:mm:ss a',\n 'Hms': 'HH:mm:ss',\n 'hmsv': 'h:mm:ss a v',\n 'Hmsv': 'HH:mm:ss v',\n 'hmv': 'h:mm a v',\n 'Hmv': 'HH:mm v',\n 'M': 'L',\n 'Md': 'M/d',\n 'MEd': 'E, M/d',\n 'MMM': 'LLL',\n 'MMMd': 'MMM d',\n 'MMMEd': 'E, MMM d',\n 'MMMMd': 'MMMM d',\n 'ms': 'mm:ss',\n 'y': 'y',\n 'yM': 'M/y',\n 'yMd': 'M/d/y',\n 'yMEd': 'E, M/d/y',\n 'yMMM': 'MMM y',\n 'yMMMd': 'MMM d, y',\n 'yMMMEd': 'E, MMM d, y',\n 'yMMMM': 'MMMM y',\n },\n }\n }\n },\n 'timeZoneNames': {\n \"hourFormat\": \"+HH:mm;-HH:mm\",\n \"gmtFormat\": \"GMT{0}\",\n \"gmtZeroFormat\": \"GMT\",\n }\n },\n 'numbers': {\n 'currencies': {\n 'USD': {\n 'displayName': 'US Dollar',\n 'symbol': '$',\n 'symbol-alt-narrow': '$'\n },\n 'EUR': {\n 'displayName': 'Euro',\n 'symbol': '€',\n 'symbol-alt-narrow': '€'\n },\n 'GBP': {\n 'displayName': 'British Pound',\n 'symbol-alt-narrow': '£'\n },\n },\n 'defaultNumberingSystem': 'latn',\n 'minimumGroupingDigits': '1',\n 'symbols-numberSystem-latn': {\n 'decimal': '.',\n 'group': ',',\n 'list': ';',\n 'percentSign': '%',\n 'plusSign': '+',\n 'minusSign': '-',\n 'exponential': 'E',\n 'superscriptingExponent': '×',\n 'perMille': '‰',\n 'infinity': '∞',\n 'nan': 'NaN',\n 'timeSeparator': ':'\n },\n 'decimalFormats-numberSystem-latn': {\n 'standard': '#,##0.###',\n },\n 'percentFormats-numberSystem-latn': {\n 'standard': '#,##0%'\n },\n 'currencyFormats-numberSystem-latn': {\n 'standard': '¤#,##0.00',\n 'accounting': '¤#,##0.00;(¤#,##0.00)'\n },\n 'scientificFormats-numberSystem-latn': {\n 'standard': '#E0'\n }\n }\n };\n /* tslint:enable:quotemark */\n IntlBase.monthIndex = {\n 3: 'abbreviated',\n 4: 'wide',\n 5: 'narrow',\n 1: 'abbreviated'\n };\n /**\n *\n */\n IntlBase.month = 'months';\n IntlBase.days = 'days';\n /**\n * Default numerber Object\n */\n IntlBase.patternMatcher = {\n C: 'currency',\n P: 'percent',\n N: 'decimal',\n A: 'currency',\n E: 'scientific'\n };\n /**\n * Returns the resultant pattern based on the skeleton, dateObject and the type provided\n * @private\n * @param {string} skeleton\n * @param {Object} dateObject\n * @param {string} type\n * @returns {string}\n */\n function getResultantPattern(skeleton, dateObject, type) {\n var resPattern;\n var iType = type || 'date';\n if (IntlBase.basicPatterns.indexOf(skeleton) !== -1) {\n resPattern = getValue(iType + 'Formats.' + skeleton, dateObject);\n if (iType === 'dateTime') {\n var dPattern = getValue('dateFormats.' + skeleton, dateObject);\n var tPattern = getValue('timeFormats.' + skeleton, dateObject);\n resPattern = resPattern.replace('{1}', dPattern).replace('{0}', tPattern);\n }\n }\n else {\n resPattern = getValue('dateTimeFormats.availableFormats.' + skeleton, dateObject);\n }\n return resPattern;\n }\n IntlBase.getResultantPattern = getResultantPattern;\n /**\n * Returns the dependable object for provided cldr data and culture\n * @private\n * @param {Object} cldr\n * @param {string} culture\n * @param {boolean} isNumber\n * @returns {Dependables}\n */\n function getDependables(cldr, culture, isNumber) {\n var ret = {};\n ret.parserObject = parser.getMainObject(cldr, culture) || IntlBase.defaultObject;\n if (isNumber) {\n ret.numericObject = getValue('numbers', ret.parserObject);\n }\n else {\n ret.dateObject = getValue('dates.calendars.gregorian', ret.parserObject);\n }\n return ret;\n }\n IntlBase.getDependables = getDependables;\n /**\n * Returns the symbol pattern for provided parameters\n * @private\n * @param {string} type\n * @param {string} numSystem\n * @param {Object} obj\n * @param {boolean} isAccount\n * @returns {string}\n */\n function getSymbolPattern(type, numSystem, obj, isAccount) {\n return getValue(type + 'Formats-numberSystem-' +\n numSystem + (isAccount ? '.accounting' : '.standard'), obj) || (isAccount ? getValue(type + 'Formats-numberSystem-' +\n numSystem + '.standard', obj) : '');\n }\n IntlBase.getSymbolPattern = getSymbolPattern;\n /**\n * Returns proper numeric skeleton\n * @private\n * @param {string} skeleton\n * @returns {NumericSkeleton}\n */\n function getProperNumericSkeleton(skeleton) {\n var matches = skeleton.match(IntlBase.formatRegex);\n var ret = {};\n var pattern = matches[1].toUpperCase();\n ret.isAccount = (pattern === 'A');\n /* tslint:disable no-any */\n ret.type = IntlBase.patternMatcher[pattern];\n if (skeleton.length > 1) {\n ret.fractionDigits = parseInt(matches[2], 10);\n }\n return ret;\n }\n IntlBase.getProperNumericSkeleton = getProperNumericSkeleton;\n /**\n * Returns format data for number formatting like minimum fraction, maximum fraction, etc..,\n * @private\n * @param {string} pattern\n * @param {boolean} needFraction\n * @param {string} cSymbol\n * @param {boolean} fractionOnly\n * @returns {NegativeData}\n */\n function getFormatData(pattern, needFraction, cSymbol, fractionOnly) {\n var nData = fractionOnly ? {} : { nlead: '', nend: '' };\n var match = pattern.match(IntlBase.customRegex);\n if (match) {\n if (!fractionOnly) {\n nData.nlead = changeCurrencySymbol(match[1], cSymbol);\n nData.nend = changeCurrencySymbol(match[10], cSymbol);\n nData.groupPattern = match[4];\n }\n var fraction = match[7];\n if (fraction && needFraction) {\n var fmatch = fraction.match(fractionRegex);\n if (!isNullOrUndefined(fmatch)) {\n nData.minimumFraction = fmatch.length;\n }\n else {\n nData.minimumFraction = 0;\n }\n nData.maximumFraction = fraction.length - 1;\n }\n }\n return nData;\n }\n IntlBase.getFormatData = getFormatData;\n /**\n * Changes currency symbol\n * @private\n * @param {string} val\n * @param {string} sym\n * @returns {string}\n */\n function changeCurrencySymbol(val, sym) {\n if (val) {\n return val.replace(IntlBase.defaultCurrency, sym);\n }\n return '';\n }\n /**\n * Returns currency symbol based on currency code\n * @private\n * @param {Object} numericObject\n * @param {string} currencyCode\n * @returns {string}\n */\n function getCurrencySymbol(numericObject, currencyCode) {\n return getValue('currencies.' + currencyCode + '.symbol', numericObject) || '$';\n }\n IntlBase.getCurrencySymbol = getCurrencySymbol;\n /**\n * Returns formatting options for custom number format\n * @private\n * @param {string} format\n * @param {CommonOptions} dOptions\n * @param {Dependables} obj\n * @returns {GenericFormatOptions}\n */\n function customFormat(format, dOptions, obj) {\n var options = {};\n var formatSplit = format.split(';');\n var data = ['pData', 'nData', 'zeroData'];\n for (var i = 0; i < formatSplit.length; i++) {\n options[data[i]] = customNumberFormat(formatSplit[i], dOptions, obj);\n }\n if (isNullOrUndefined(options.nData)) {\n options.nData = extend({}, options.pData);\n options.nData.nlead = isNullOrUndefined(dOptions) ? '-' + options.nData.nlead : dOptions.minusSymbol + options.nData.nlead;\n }\n return options;\n }\n IntlBase.customFormat = customFormat;\n /**\n * Returns custom formatting options\n * @private\n * @param {string} format\n * @param {CommonOptions} dOptions\n * @param {Object} numObject\n * @returns {NegativeData}\n */\n function customNumberFormat(format, dOptions, numObject) {\n var cOptions = { type: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 0 };\n var pattern = format.match(IntlBase.customRegex);\n if (isNullOrUndefined(pattern) || (pattern[5] === '' && format !== 'N/A')) {\n cOptions.type = undefined;\n }\n cOptions.nlead = pattern[1];\n cOptions.nend = pattern[10];\n var integerPart = pattern[6];\n cOptions.useGrouping = integerPart.indexOf(',') !== -1;\n integerPart = integerPart.replace(/,/g, '');\n var fractionPart = pattern[7];\n if (integerPart.indexOf('0') !== -1) {\n cOptions.minimumIntegerDigits = integerPart.length - integerPart.indexOf('0');\n }\n if (!isNullOrUndefined(fractionPart)) {\n cOptions.minimumFractionDigits = fractionPart.lastIndexOf('0');\n cOptions.maximumFractionDigits = fractionPart.lastIndexOf('#');\n if (cOptions.minimumFractionDigits === -1) {\n cOptions.minimumFractionDigits = 0;\n }\n if (cOptions.maximumFractionDigits === -1 || cOptions.maximumFractionDigits < cOptions.minimumFractionDigits) {\n cOptions.maximumFractionDigits = cOptions.minimumFractionDigits;\n }\n }\n if (!isNullOrUndefined(dOptions)) {\n extend(cOptions, isCurrencyPercent([cOptions.nlead, cOptions.nend], '$', dOptions.currencySymbol));\n if (!cOptions.isCurrency) {\n extend(cOptions, isCurrencyPercent([cOptions.nlead, cOptions.nend], '%', dOptions.percentSymbol));\n }\n }\n else {\n extend(cOptions, isCurrencyPercent([cOptions.nlead, cOptions.nend], '%', '%'));\n }\n if (!isNullOrUndefined(numObject)) {\n var symbolPattern = getSymbolPattern(cOptions.type, dOptions.numberMapper.numberSystem, numObject, false);\n if (cOptions.useGrouping) {\n cOptions.groupSeparator = dOptions.numberMapper.numberSymbols[mapper[2]];\n cOptions.groupData = NumberFormat.getGroupingDetails(symbolPattern.split(';')[0]);\n }\n cOptions.nlead = cOptions.nlead.replace(/\\'/g, '');\n cOptions.nend = cOptions.nend.replace(/\\'/g, '');\n }\n return cOptions;\n }\n /**\n * Returns formatting options for currency or percent type\n * @private\n * @param {string[]} parts\n * @param {string} actual\n * @param {string} symbol\n * @returns {NegativeData}\n */\n function isCurrencyPercent(parts, actual, symbol) {\n var options = { nlead: parts[0], nend: parts[1] };\n for (var i = 0; i < 2; i++) {\n var part = parts[i];\n var loc = part.indexOf(actual);\n if ((loc !== -1) && ((loc < part.indexOf('\\'')) || (loc > part.lastIndexOf('\\'')))) {\n options[typeMapper[i]] = part.substr(0, loc) + symbol + part.substr(loc + 1);\n options[typeMapper[actual]] = true;\n options.type = options.isCurrency ? 'currency' : 'percent';\n break;\n }\n }\n return options;\n }\n IntlBase.isCurrencyPercent = isCurrencyPercent;\n /**\n * Returns culture based date separator\n * @private\n * @param {Object} dateObj\n * @returns {string}\n */\n function getDateSeparator(dateObj) {\n var value = (getValue('dateFormats.short', dateObj) || '').match(/[dM]([^dM])[dM]/i);\n return value ? value[1] : '/';\n }\n IntlBase.getDateSeparator = getDateSeparator;\n /**\n * Returns Native Date Time pattern\n * @private\n * @param {string} culture\n * @param {DateFormatOptions} options\n * @param {Object} cldr\n * @returns {string}\n */\n function getActualDateTimeFormat(culture, options, cldr, isExcelFormat) {\n var dependable = getDependables(cldr, culture);\n var actualPattern = options.format || getResultantPattern(options.skeleton, dependable.dateObject, options.type);\n if (isExcelFormat) {\n actualPattern = actualPattern.replace(patternRegex, function (pattern) {\n return patternMatch[pattern];\n });\n if (actualPattern.indexOf('z') !== -1) {\n var tLength = actualPattern.match(/z/g).length;\n var timeZonePattern = void 0;\n var options_1 = { 'timeZone': {} };\n options_1.numMapper = parser.getNumberMapper(dependable.parserObject, parser.getNumberingSystem(cldr));\n options_1.timeZone = getValue('dates.timeZoneNames', dependable.parserObject);\n var value = new Date();\n var timezone = value.getTimezoneOffset();\n var pattern = (tLength < 4) ? '+H;-H' : options_1.timeZone.hourFormat;\n pattern = pattern.replace(/:/g, options_1.numMapper.timeSeparator);\n if (timezone === 0) {\n timeZonePattern = options_1.timeZone.gmtZeroFormat;\n }\n else {\n timeZonePattern = DateFormat.getTimeZoneValue(timezone, pattern);\n timeZonePattern = options_1.timeZone.gmtFormat.replace(/\\{0\\}/, timeZonePattern);\n }\n actualPattern = actualPattern.replace(/[z]+/, '\"' + timeZonePattern + '\"');\n }\n actualPattern = actualPattern.replace(/ $/, '');\n }\n return actualPattern;\n }\n IntlBase.getActualDateTimeFormat = getActualDateTimeFormat;\n /**\n * Returns Native Number pattern\n * @private\n * @param {string} culture\n * @param {NumberFormatOptions} options\n * @param {Object} cldr\n * @returns {string}\n */\n function getActualNumberFormat(culture, options, cldr) {\n var dependable = getDependables(cldr, culture, true);\n var parseOptions = { custom: true };\n var minFrac;\n var curObj = {};\n var curMatch = (options.format || '').match(IntlBase.currencyFormatRegex);\n if (curMatch) {\n var dOptions = {};\n dOptions.numberMapper = parser.getNumberMapper(dependable.parserObject, parser.getNumberingSystem(cldr), true);\n var curCode = getCurrencySymbol(dependable.numericObject, options.currency || defaultCurrencyCode);\n var symbolPattern = getSymbolPattern('currency', dOptions.numberMapper.numberSystem, dependable.numericObject, (/a/i).test(options.format));\n symbolPattern = symbolPattern.replace(/\\u00A4/g, curCode);\n var split = symbolPattern.split(';');\n curObj.hasNegativePattern = (split.length > 1);\n curObj.nData = getFormatData(split[1] || '-' + split[0], true, curCode);\n curObj.pData = getFormatData(split[0], false, curCode);\n if (!curMatch[2] && !options.minimumFractionDigits && !options.maximumFractionDigits) {\n minFrac = getFormatData(symbolPattern.split(';')[0], true, '', true).minimumFraction;\n }\n }\n var actualPattern;\n if ((IntlBase.formatRegex.test(options.format)) || !(options.format)) {\n extend(parseOptions, getProperNumericSkeleton(options.format || 'N'));\n parseOptions.custom = false;\n actualPattern = '###0';\n if (parseOptions.fractionDigits || options.minimumFractionDigits || options.maximumFractionDigits || minFrac) {\n var defaultMinimum = 0;\n if (parseOptions.fractionDigits) {\n options.minimumFractionDigits = options.maximumFractionDigits = parseOptions.fractionDigits;\n }\n actualPattern = fractionDigitsPattern(actualPattern, minFrac || parseOptions.fractionDigits ||\n options.minimumFractionDigits || defaultMinimum, options.maximumFractionDigits || defaultMinimum);\n }\n if (options.minimumIntegerDigits) {\n actualPattern = minimumIntegerPattern(actualPattern, options.minimumIntegerDigits);\n }\n if (options.useGrouping) {\n actualPattern = groupingPattern(actualPattern);\n }\n if (parseOptions.type === 'currency') {\n var cPattern = actualPattern;\n actualPattern = curObj.pData.nlead + cPattern + curObj.pData.nend;\n if (curObj.hasNegativePattern) {\n actualPattern += ';' + curObj.nData.nlead + cPattern + curObj.nData.nend;\n }\n }\n if (parseOptions.type === 'percent') {\n actualPattern += ' %';\n }\n }\n else {\n actualPattern = options.format.replace(/\\'/g, '\"');\n }\n return actualPattern;\n }\n IntlBase.getActualNumberFormat = getActualNumberFormat;\n function fractionDigitsPattern(pattern, minDigits, maxDigits) {\n pattern += '.';\n for (var a = 0; a < minDigits; a++) {\n pattern += '0';\n }\n if (minDigits < maxDigits) {\n var diff = maxDigits - minDigits;\n for (var b = 0; b < diff; b++) {\n pattern += '#';\n }\n }\n return pattern;\n }\n function minimumIntegerPattern(pattern, digits) {\n var temp = pattern.split('.');\n var integer = '';\n for (var x = 0; x < digits; x++) {\n integer += '0';\n }\n return temp[1] ? (integer + '.' + temp[1]) : integer;\n }\n function groupingPattern(pattern) {\n var temp = pattern.split('.');\n var integer = temp[0];\n var no = 3 - integer.length % 3;\n var hash = (no && no === 1) ? '#' : (no === 2 ? '##' : '');\n integer = hash + integer;\n pattern = '';\n for (var x = integer.length - 1; x > 0; x = x - 3) {\n pattern = ',' + integer[x - 2] + integer[x - 1] + integer[x] + pattern;\n }\n pattern = pattern.slice(1);\n return temp[1] ? (pattern + '.' + temp[1]) : pattern;\n }\n})(IntlBase || (IntlBase = {}));\n","/**\n * To import utils\n */\nimport { isNullOrUndefined } from './util';\n/**\n * @private\n */\nvar CanvasRenderer = /** @class */ (function () {\n /* End-Properties */\n function CanvasRenderer(rootID) {\n this.rootId = rootID;\n }\n // method to get the attributes value\n /* tslint:disable */\n CanvasRenderer.prototype.getOptionValue = function (options, key) {\n return options[key];\n };\n /* tslint:enable */\n /**\n * To create a Html5 canvas element\n * @param {BaseAttibutes} options - Options to create canvas\n * @return {HTMLCanvasElement}\n */\n CanvasRenderer.prototype.createCanvas = function (options) {\n var canvasObj = document.createElement('canvas');\n canvasObj.setAttribute('id', this.rootId + '_canvas');\n this.ctx = canvasObj.getContext('2d');\n this.canvasObj = canvasObj;\n this.setCanvasSize(options.width, options.height);\n return this.canvasObj;\n };\n /**\n * To set the width and height for the Html5 canvas element\n * @param {number} width - width of the canvas\n * @param {number} height - height of the canvas\n * @return {void}\n */\n CanvasRenderer.prototype.setCanvasSize = function (width, height) {\n var element = document.getElementById(this.rootId);\n var size = !isNullOrUndefined(element) ? element.getBoundingClientRect() : null;\n if (isNullOrUndefined(this.width)) {\n this.canvasObj.setAttribute('width', width ? width.toString() : size.width.toString());\n }\n else {\n this.canvasObj.setAttribute('width', this.width.toString());\n }\n if (isNullOrUndefined(this.height)) {\n this.canvasObj.setAttribute('height', height ? height.toString() : '450');\n }\n else {\n this.canvasObj.setAttribute('height', this.height.toString());\n }\n };\n // To set the values to the attributes\n CanvasRenderer.prototype.setAttributes = function (options) {\n this.ctx.lineWidth = this.getOptionValue(options, 'stroke-width');\n var dashArray = this.getOptionValue(options, 'stroke-dasharray');\n if (!isNullOrUndefined(dashArray)) {\n var dashArrayString = dashArray.split(',');\n this.ctx.setLineDash([parseInt(dashArrayString[0], 10), parseInt(dashArrayString[1], 10)]);\n }\n this.ctx.strokeStyle = this.getOptionValue(options, 'stroke');\n };\n /**\n * To draw a line\n * @param {LineAttributes} options - required options to draw a line on the canvas\n * @return {void}\n */\n CanvasRenderer.prototype.drawLine = function (options) {\n this.ctx.save();\n this.ctx.beginPath();\n this.ctx.lineWidth = this.getOptionValue(options, 'stroke-width');\n this.ctx.strokeStyle = options.stroke;\n this.ctx.moveTo(options.x1, options.y1);\n this.ctx.lineTo(options.x2, options.y2);\n this.ctx.stroke();\n this.ctx.restore();\n this.dataUrl = this.canvasObj.toDataURL();\n };\n /**\n * To draw a rectangle\n * @param {RectAttributes} options - required options to draw a rectangle on the canvas\n * @return {void}\n */\n CanvasRenderer.prototype.drawRectangle = function (options) {\n var canvasCtx = this.ctx;\n var cornerRadius = options.rx;\n this.ctx.save();\n this.ctx.beginPath();\n this.ctx.globalAlpha = this.getOptionValue(options, 'opacity');\n this.setAttributes(options);\n this.ctx.rect(options.x, options.y, options.width, options.height);\n if (cornerRadius !== null && cornerRadius >= 0) {\n this.drawCornerRadius(options);\n }\n else {\n if (options.fill === 'none') {\n options.fill = 'transparent';\n }\n this.ctx.fillStyle = options.fill;\n this.ctx.fillRect(options.x, options.y, options.width, options.height);\n this.ctx.stroke();\n }\n this.ctx.restore();\n this.ctx = canvasCtx;\n this.dataUrl = this.canvasObj.toDataURL();\n };\n // To draw the corner of a rectangle\n CanvasRenderer.prototype.drawCornerRadius = function (options) {\n var cornerRadius = options.rx;\n var x = options.x;\n var y = options.y;\n var width = options.width;\n var height = options.height;\n if (options.fill === 'none') {\n options.fill = 'transparent';\n }\n this.ctx.fillStyle = options.fill;\n if (width < 2 * cornerRadius) {\n cornerRadius = width / 2;\n }\n if (height < 2 * cornerRadius) {\n cornerRadius = height / 2;\n }\n this.ctx.beginPath();\n this.ctx.moveTo(x + width - cornerRadius, y);\n this.ctx.arcTo(x + width, y, x + width, y + height, cornerRadius);\n this.ctx.arcTo(x + width, y + height, x, y + height, cornerRadius);\n this.ctx.arcTo(x, y + height, x, y, cornerRadius);\n this.ctx.arcTo(x, y, x + width, y, cornerRadius);\n this.ctx.closePath();\n this.ctx.fill();\n this.ctx.stroke();\n this.dataUrl = this.canvasObj.toDataURL();\n };\n /**\n * To draw a path on the canvas\n * @param {PathAttributes} options - options needed to draw path\n * @param {Int32Array} canvasTranslate - Array of numbers to translate the canvas\n * @return {void}\n */\n CanvasRenderer.prototype.drawPath = function (options, canvasTranslate) {\n var path = options.d;\n var dataSplit = path.split(' ');\n var borderWidth = this.getOptionValue(options, 'stroke-width');\n var canvasCtx = this.ctx;\n var flag = true;\n this.ctx.save();\n this.ctx.beginPath();\n if (canvasTranslate) {\n this.ctx.translate(canvasTranslate[0], canvasTranslate[1]);\n }\n this.ctx.globalAlpha = options.opacity ? options.opacity : this.getOptionValue(options, 'fill-opacity');\n this.setAttributes(options);\n for (var i = 0; i < dataSplit.length; i = i + 3) {\n var x1 = parseFloat(dataSplit[i + 1]);\n var y1 = parseFloat(dataSplit[i + 2]);\n switch (dataSplit[i]) {\n case 'M':\n if (!options.innerR && !options.cx) {\n this.ctx.moveTo(x1, y1);\n }\n break;\n case 'L':\n if (!options.innerR) {\n this.ctx.lineTo(x1, y1);\n }\n break;\n case 'C':\n var c1 = parseFloat(dataSplit[i + 3]);\n var c2 = parseFloat(dataSplit[i + 4]);\n var c3 = parseFloat(dataSplit[i + 5]);\n var c4 = parseFloat(dataSplit[i + 6]);\n this.ctx.bezierCurveTo(x1, y1, c1, c2, c3, c4);\n i = i + 4;\n break;\n case 'A':\n if (!options.innerR) {\n if (options.cx) {\n this.ctx.arc(options.cx, options.cy, options.radius, 0, 2 * Math.PI, options.counterClockWise);\n }\n else {\n this.ctx.moveTo(options.x, options.y);\n this.ctx.arc(options.x, options.y, options.radius, options.start, options.end, options.counterClockWise);\n this.ctx.lineTo(options.x, options.y);\n }\n }\n else if (flag) {\n this.ctx.arc(options.x, options.y, options.radius, options.start, options.end, options.counterClockWise);\n this.ctx.arc(options.x, options.y, options.innerR, options.end, options.start, !options.counterClockWise);\n flag = false;\n }\n i = i + 5;\n break;\n case 'z':\n this.ctx.closePath();\n break;\n }\n }\n if (options.fill !== 'none' && options.fill !== undefined) {\n this.ctx.fillStyle = options.fill;\n this.ctx.fill();\n }\n if (borderWidth > 0) {\n this.ctx.stroke();\n }\n this.ctx.restore();\n this.ctx = canvasCtx;\n this.dataUrl = this.canvasObj.toDataURL();\n };\n /**\n * To draw a text\n * @param {TextAttributes} options - options required to draw text\n * @param {string} label - Specifies the text which has to be drawn on the canvas\n * @return {void}\n */\n CanvasRenderer.prototype.drawText = function (options, label) {\n var fontWeight = this.getOptionValue(options, 'font-weight');\n if (!isNullOrUndefined(fontWeight) && fontWeight.toLowerCase() === 'regular') {\n fontWeight = 'normal';\n }\n var fontSize = this.getOptionValue(options, 'font-size');\n var fontFamily = this.getOptionValue(options, 'font-family');\n var fontStyle = this.getOptionValue(options, 'font-style').toLowerCase();\n var font = (fontStyle + ' ' + fontWeight + ' ' + fontSize + ' ' + fontFamily);\n var anchor = this.getOptionValue(options, 'text-anchor');\n var opacity = options.opacity !== undefined ? options.opacity : 1;\n if (anchor === 'middle') {\n anchor = 'center';\n }\n this.ctx.save();\n this.ctx.fillStyle = options.fill;\n this.ctx.font = font;\n this.ctx.textAlign = anchor;\n this.ctx.globalAlpha = opacity;\n if (options.baseline) {\n this.ctx.textBaseline = options.baseline;\n }\n var txtlngth = 0;\n this.ctx.translate(options.x + (txtlngth / 2), options.y);\n this.ctx.rotate(options.labelRotation * Math.PI / 180);\n this.ctx.fillText(label, 0, 0);\n this.ctx.restore();\n this.dataUrl = this.canvasObj.toDataURL();\n };\n /**\n * To draw circle on the canvas\n * @param {CircleAttributes} options - required options to draw the circle\n * @return {void}\n */\n CanvasRenderer.prototype.drawCircle = function (options) {\n var canvasCtx = this.ctx;\n this.ctx.save();\n this.ctx.beginPath();\n this.ctx.arc(options.cx, options.cy, options.r, 0, 2 * Math.PI);\n this.ctx.fillStyle = options.fill;\n this.ctx.globalAlpha = options.opacity;\n this.ctx.fill();\n this.setAttributes(options);\n this.ctx.stroke();\n this.ctx.restore();\n this.ctx = canvasCtx;\n this.dataUrl = this.canvasObj.toDataURL();\n };\n /**\n * To draw polyline\n * @param {PolylineAttributes} options - options needed to draw polyline\n * @return {void}\n */\n CanvasRenderer.prototype.drawPolyline = function (options) {\n this.ctx.save();\n this.ctx.beginPath();\n var points = options.points.split(' ');\n for (var i = 0; i < points.length - 1; i++) {\n var point = points[i].split(',');\n var x = parseFloat(point[0]);\n var y = parseFloat(point[1]);\n if (i === 0) {\n this.ctx.moveTo(x, y);\n }\n else {\n this.ctx.lineTo(x, y);\n }\n }\n this.ctx.lineWidth = this.getOptionValue(options, 'stroke-width');\n this.ctx.strokeStyle = options.stroke;\n this.ctx.stroke();\n this.ctx.restore();\n this.dataUrl = this.canvasObj.toDataURL();\n };\n /**\n * To draw an ellipse on the canvas\n * @param {EllipseAttributes} options - options needed to draw ellipse\n * @return {void}\n */\n CanvasRenderer.prototype.drawEllipse = function (options) {\n var canvasCtx = this.ctx;\n var circumference = Math.max(options.rx, options.ry);\n var scaleX = options.rx / circumference;\n var scaleY = options.ry / circumference;\n this.ctx.save();\n this.ctx.beginPath();\n this.ctx.translate(options.cx, options.cy);\n this.ctx.save();\n this.ctx.scale(scaleX, scaleY);\n this.ctx.arc(0, 0, circumference, 0, 2 * Math.PI, false);\n this.ctx.fillStyle = options.fill;\n this.ctx.fill();\n this.ctx.restore();\n this.ctx.lineWidth = this.getOptionValue(options, 'stroke-width');\n this.ctx.strokeStyle = options.stroke;\n this.ctx.stroke();\n this.ctx.restore();\n this.ctx = canvasCtx;\n this.dataUrl = this.canvasObj.toDataURL();\n };\n /**\n * To draw an image\n * @param {ImageAttributes} options - options required to draw an image on the canvas\n * @return {void}\n */\n CanvasRenderer.prototype.drawImage = function (options) {\n this.ctx.save();\n var imageObj = new Image();\n if (!isNullOrUndefined(options.href)) {\n imageObj.src = options.href;\n this.ctx.drawImage(imageObj, options.x, options.y, options.width, options.height);\n }\n this.ctx.restore();\n this.dataUrl = this.canvasObj.toDataURL();\n };\n /**\n * To create a linear gradient\n * @param {string[]} colors - Specifies the colors required to create linear gradient\n * @return {string}\n */\n CanvasRenderer.prototype.createLinearGradient = function (colors) {\n var myGradient;\n if (!isNullOrUndefined(colors[0].colorStop)) {\n myGradient = this.ctx.createLinearGradient(0, 0, 0, this.canvasObj.height);\n }\n var color = this.setGradientValues(colors, myGradient);\n return color;\n };\n /**\n * To create a radial gradient\n * @param {string[]} colors - Specifies the colors required to create linear gradient\n * @return {string}\n */\n CanvasRenderer.prototype.createRadialGradient = function (colors) {\n var myGradient;\n if (!isNullOrUndefined(colors[0].colorStop)) {\n myGradient = this.ctx.createRadialGradient(0, 0, 0, 0, 0, this.canvasObj.height);\n }\n var colorName = this.setGradientValues(colors, myGradient);\n return colorName;\n };\n // To set the gradient values\n CanvasRenderer.prototype.setGradientValues = function (colors, myGradient) {\n var colorName;\n if (!isNullOrUndefined(colors[0].colorStop)) {\n for (var i = 0; i <= colors.length - 1; i++) {\n var color = colors[i].color;\n var newColorStop = (colors[i].colorStop).slice(0, -1);\n var stopColor = parseInt(newColorStop, 10) / 100;\n myGradient.addColorStop(stopColor, color);\n }\n colorName = myGradient.toString();\n }\n else {\n colorName = colors[0].color.toString();\n }\n this.dataUrl = this.canvasObj.toDataURL();\n return colorName;\n };\n /**\n * To set the attributes to the element\n * @param {SVGCanvasAttributes} options - Attributes to set for the element\n * @param {HTMLElement} element - The element to which the attributes need to be set\n * @return {HTMLElement}\n */\n CanvasRenderer.prototype.setElementAttributes = function (options, element) {\n var keys = Object.keys(options);\n var values = Object.keys(options).map(function (key) { return options[key]; });\n for (var i = 0; i < keys.length; i++) {\n element.setAttribute(keys[i], values[i]);\n }\n return element;\n };\n /**\n * To update the values of the canvas element attributes\n * @param {SVGCanvasAttributes} options - Specifies the colors required to create gradient\n * @return {void}\n */\n CanvasRenderer.prototype.updateCanvasAttributes = function (options) {\n this.setElementAttributes(options, this.canvasObj);\n var ctx = this.ctx;\n if (!isNullOrUndefined(this.dataUrl)) {\n var img_1 = new Image;\n img_1.onload = function () {\n ctx.drawImage(img_1, 0, 0);\n };\n img_1.src = this.dataUrl;\n }\n };\n return CanvasRenderer;\n}());\nexport { CanvasRenderer };\n","/**\n * Module loading operations\n */\nimport { createInstance, setValue, getValue, deleteObject } from './util';\nvar MODULE_SUFFIX = 'Module';\nvar ModuleLoader = /** @class */ (function () {\n function ModuleLoader(parent) {\n this.loadedModules = [];\n this.parent = parent;\n }\n ;\n /**\n * Inject required modules in component library\n * @return {void}\n * @param {ModuleDeclaration[]} requiredModules - Array of modules to be required\n * @param {Function[]} moduleList - Array of modules to be injected from sample side\n */\n ModuleLoader.prototype.inject = function (requiredModules, moduleList) {\n var reqLength = requiredModules.length;\n if (reqLength === 0) {\n this.clean();\n return;\n }\n if (this.loadedModules.length) {\n this.clearUnusedModule(requiredModules);\n }\n for (var i = 0; i < reqLength; i++) {\n var modl = requiredModules[i];\n for (var _i = 0, moduleList_1 = moduleList; _i < moduleList_1.length; _i++) {\n var module = moduleList_1[_i];\n var modName = modl.member;\n if (module.prototype.getModuleName() === modl.member && !this.isModuleLoaded(modName)) {\n var moduleObject = createInstance(module, modl.args);\n var memberName = this.getMemberName(modName);\n if (modl.isProperty) {\n setValue(memberName, module, this.parent);\n }\n else {\n setValue(memberName, moduleObject, this.parent);\n }\n var loadedModule = modl;\n loadedModule.member = memberName;\n this.loadedModules.push(loadedModule);\n }\n }\n }\n };\n /**\n * To remove the created object while destroying the control\n * @return {void}\n */\n ModuleLoader.prototype.clean = function () {\n for (var _i = 0, _a = this.loadedModules; _i < _a.length; _i++) {\n var modules = _a[_i];\n if (!modules.isProperty) {\n getValue(modules.member, this.parent).destroy();\n }\n }\n this.loadedModules = [];\n };\n /**\n * Removes all unused modules\n * @param {ModuleDeclaration[]} moduleList\n * @returns {void}\n */\n ModuleLoader.prototype.clearUnusedModule = function (moduleList) {\n var _this = this;\n var usedModules = moduleList.map(function (arg) { return _this.getMemberName(arg.member); });\n var removableModule = this.loadedModules.filter(function (module) {\n return usedModules.indexOf(module.member) === -1;\n });\n for (var _i = 0, removableModule_1 = removableModule; _i < removableModule_1.length; _i++) {\n var mod = removableModule_1[_i];\n if (!mod.isProperty) {\n getValue(mod.member, this.parent).destroy();\n }\n this.loadedModules.splice(this.loadedModules.indexOf(mod), 1);\n deleteObject(this.parent, mod.member);\n }\n };\n /**\n * To get the name of the member.\n * @param {string} name\n * @returns {string}\n */\n ModuleLoader.prototype.getMemberName = function (name) {\n return name[0].toLowerCase() + name.substring(1) + MODULE_SUFFIX;\n };\n /**\n * Returns boolean based on whether the module specified is loaded or not\n * @param {string} modName\n * @returns {boolean}\n */\n ModuleLoader.prototype.isModuleLoaded = function (modName) {\n for (var _i = 0, _a = this.loadedModules; _i < _a.length; _i++) {\n var mod = _a[_i];\n if (mod.member === this.getMemberName(modName)) {\n return true;\n }\n }\n return false;\n };\n return ModuleLoader;\n}());\nexport { ModuleLoader };\n","import { getValue, setValue, merge } from './util';\nimport { Base } from './base';\n/**\n * To detect the changes for inner properties.\n * @private\n */\nvar ChildProperty = /** @class */ (function () {\n function ChildProperty(parent, propName, defaultValue, isArray) {\n this.properties = {};\n this.changedProperties = {};\n this.childChangedProperties = {};\n this.oldProperties = {};\n // tslint:disable-next-line:no-empty\n this.finalUpdate = function () { };\n this.callChildDataBind = getValue('callChildDataBind', Base);\n this.parentObj = parent;\n this.controlParent = this.parentObj.controlParent || this.parentObj;\n this.propName = propName;\n this.setProperties(defaultValue, true);\n this.isParentArray = isArray;\n }\n /**\n * Updates the property changes\n * @param {boolean} val\n * @param {string} propName\n * @returns {void}\n */\n ChildProperty.prototype.updateChange = function (val, propName) {\n if (val === true) {\n this.parentObj.childChangedProperties[propName] = val;\n }\n else {\n delete this.parentObj.childChangedProperties[propName];\n }\n if (this.parentObj.updateChange) {\n this.parentObj.updateChange(val, this.parentObj.propName);\n }\n };\n /**\n * Updates time out duration\n */\n ChildProperty.prototype.updateTimeOut = function () {\n if (this.parentObj.updateTimeOut) {\n this.parentObj.finalUpdate();\n this.parentObj.updateTimeOut();\n }\n else {\n var changeTime_1 = setTimeout(this.parentObj.dataBind.bind(this.parentObj));\n var clearUpdate = function () {\n clearTimeout(changeTime_1);\n };\n this.finalUpdate = clearUpdate;\n }\n };\n /**\n * Clears changed properties\n */\n ChildProperty.prototype.clearChanges = function () {\n this.finalUpdate();\n this.updateChange(false, this.propName);\n this.oldProperties = {};\n this.changedProperties = {};\n };\n /**\n * Set property changes\n * @param {Object} prop\n * @param {boolean} muteOnChange\n * {void}\n */\n ChildProperty.prototype.setProperties = function (prop, muteOnChange) {\n if (muteOnChange === true) {\n merge(this, prop);\n this.updateChange(false, this.propName);\n this.clearChanges();\n }\n else {\n merge(this, prop);\n }\n };\n /**\n * Binds data\n */\n ChildProperty.prototype.dataBind = function () {\n this.callChildDataBind(this.childChangedProperties, this);\n if (this.isParentArray) {\n var curIndex = this.parentObj[this.propName].indexOf(this);\n if (Object.keys(this.changedProperties).length) {\n setValue(this.propName + '.' + curIndex, this.changedProperties, this.parentObj.changedProperties);\n setValue(this.propName + '.' + curIndex, this.oldProperties, this.parentObj.oldProperties);\n }\n }\n else {\n this.parentObj.changedProperties[this.propName] = this.changedProperties;\n this.parentObj.oldProperties[this.propName] = this.oldProperties;\n }\n this.clearChanges();\n };\n /**\n * Saves changes to newer values\n * @param {string} key\n * @param {Object} newValue\n * @param {Object} oldValue\n * @returns {void}\n */\n ChildProperty.prototype.saveChanges = function (key, newValue, oldValue) {\n if (this.controlParent.isProtectedOnChange) {\n return;\n }\n this.oldProperties[key] = oldValue;\n this.changedProperties[key] = newValue;\n this.updateChange(true, this.propName);\n this.finalUpdate();\n this.updateTimeOut();\n };\n return ChildProperty;\n}());\nexport { ChildProperty };\n","/**\n * Parser\n */\nvar defaultNumberingSystem = {\n 'latn': {\n '_digits': '0123456789',\n '_type': 'numeric'\n }\n};\nimport { isUndefined, getValue } from '../util';\nvar latnRegex = /^[0-9]*$/;\nvar defaultNumberSymbols = {\n 'decimal': '.',\n 'group': ',',\n 'percentSign': '%',\n 'plusSign': '+',\n 'minusSign': '-',\n 'infinity': '∞',\n 'nan': 'NaN',\n 'exponential': 'E'\n};\nvar latnNumberSystem = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];\n/**\n * Interface for parser base\n * @private\n */\nvar ParserBase = /** @class */ (function () {\n function ParserBase() {\n }\n /**\n * Returns the cldr object for the culture specifies\n * @param {Object} obj - Specifies the object from which culture object to be acquired.\n * @param {string} cName - Specifies the culture name.\n * @returns {Object}\n */\n ParserBase.getMainObject = function (obj, cName) {\n return getValue('main.' + cName, obj);\n };\n /**\n * Returns the numbering system object from given cldr data.\n * @param {Object} obj - Specifies the object from which number system is acquired.\n * @returns {Object}\n */\n ParserBase.getNumberingSystem = function (obj) {\n return getValue('supplemental.numberingSystems', obj) || this.numberingSystems;\n };\n /**\n * Returns the reverse of given object keys or keys specified.\n * @param {Object} prop - Specifies the object to be reversed.\n * @param {number[]} keys - Optional parameter specifies the custom keyList for reversal.\n * @returns {Object}\n */\n ParserBase.reverseObject = function (prop, keys) {\n var propKeys = keys || Object.keys(prop);\n var res = {};\n for (var _i = 0, propKeys_1 = propKeys; _i < propKeys_1.length; _i++) {\n var key = propKeys_1[_i];\n /* tslint:disable no-any */\n if (!res.hasOwnProperty(prop[key])) {\n res[prop[key]] = key;\n }\n }\n return res;\n };\n /**\n * Returns the symbol regex by skipping the escape sequence.\n * @param {string[]} props - Specifies the array values to be skipped.\n * @returns {RegExp}\n */\n ParserBase.getSymbolRegex = function (props) {\n var regexStr = props.map(function (str) {\n return str.replace(/([.*+?^=!:${}()|\\[\\]\\/\\\\])/g, '\\\\$1');\n }).join('|');\n return new RegExp(regexStr, 'g');\n };\n ParserBase.getSymbolMatch = function (prop) {\n var matchKeys = Object.keys(defaultNumberSymbols);\n var ret = {};\n for (var _i = 0, matchKeys_1 = matchKeys; _i < matchKeys_1.length; _i++) {\n var key = matchKeys_1[_i];\n ret[prop[key]] = defaultNumberSymbols[key];\n }\n return ret;\n };\n /**\n * Returns regex string for provided value\n * @param {string} val\n * @returns {string}\n */\n ParserBase.constructRegex = function (val) {\n var len = val.length;\n var ret = '';\n for (var i = 0; i < len; i++) {\n if (i !== len - 1) {\n ret += val[i] + '|';\n }\n else {\n ret += val[i];\n }\n }\n return ret;\n };\n /**\n * Returns the replaced value of matching regex and obj mapper.\n * @param {string} value - Specifies the values to be replaced.\n * @param {RegExp} regex - Specifies the regex to search.\n * @param {Object} obj - Specifies the object matcher to be replace value parts.\n * @returns {string}\n */\n ParserBase.convertValueParts = function (value, regex, obj) {\n return value.replace(regex, function (str) {\n return obj[str];\n });\n };\n /**\n * Returns default numbering system object for formatting from cldr data\n * @param {Object} obj\n * @returns {NumericObject}\n */\n ParserBase.getDefaultNumberingSystem = function (obj) {\n var ret = {};\n ret.obj = getValue('numbers', obj);\n ret.nSystem = getValue('defaultNumberingSystem', ret.obj);\n return ret;\n };\n /**\n * Returns the replaced value of matching regex and obj mapper.\n */\n ParserBase.getCurrentNumericOptions = function (curObj, numberSystem, needSymbols) {\n var ret = {};\n var cur = this.getDefaultNumberingSystem(curObj);\n if (!isUndefined(cur.nSystem)) {\n var digits = getValue(cur.nSystem + '._digits', numberSystem);\n if (!isUndefined(digits)) {\n ret.numericPair = this.reverseObject(digits, latnNumberSystem);\n ret.numberParseRegex = new RegExp(this.constructRegex(digits), 'g');\n ret.numericRegex = '[' + digits[0] + '-' + digits[9] + ']';\n if (needSymbols) {\n ret.numericRegex = digits[0] + '-' + digits[9];\n ret.symbolNumberSystem = getValue('symbols-numberSystem-' + cur.nSystem, cur.obj);\n ret.symbolMatch = this.getSymbolMatch(ret.symbolNumberSystem);\n ret.numberSystem = cur.nSystem;\n }\n }\n }\n return ret;\n };\n /**\n * Returns number mapper object for the provided cldr data\n * @param {Object} curObj\n * @param {Object} numberSystem\n * @param {boolean} isNumber\n * @returns {NumberMapper}\n */\n ParserBase.getNumberMapper = function (curObj, numberSystem, isNumber) {\n var ret = { mapper: {} };\n var cur = this.getDefaultNumberingSystem(curObj);\n if (!isUndefined(cur.nSystem)) {\n ret.numberSystem = cur.nSystem;\n ret.numberSymbols = getValue('symbols-numberSystem-' + cur.nSystem, cur.obj);\n ret.timeSeparator = getValue('timeSeparator', ret.numberSymbols);\n var digits = getValue(cur.nSystem + '._digits', numberSystem);\n if (!isUndefined(digits)) {\n for (var _i = 0, latnNumberSystem_1 = latnNumberSystem; _i < latnNumberSystem_1.length; _i++) {\n var i = latnNumberSystem_1[_i];\n ret.mapper[i] = digits[i];\n }\n }\n }\n return ret;\n };\n ParserBase.nPair = 'numericPair';\n ParserBase.nRegex = 'numericRegex';\n ParserBase.numberingSystems = defaultNumberingSystem;\n return ParserBase;\n}());\nexport { ParserBase };\n","import { isUndefined, throwError, isNullOrUndefined, extend } from '../util';\nimport { defaultCurrencyCode } from '../internationalization';\nimport { IntlBase as base } from './intl-base';\nimport { ParserBase as parser } from './parser-base';\nvar errorText = {\n 'ms': 'minimumSignificantDigits',\n 'ls': 'maximumSignificantDigits',\n 'mf': 'minimumFractionDigits',\n 'lf': 'maximumFractionDigits',\n};\nvar integerError = 'minimumIntegerDigits';\nvar percentSign = 'percentSign';\nvar minusSign = 'minusSign';\nvar spaceRegex = /\\s/;\nvar mapper = ['infinity', 'nan', 'group', 'decimal', 'exponential'];\nvar infinity = 'infinity';\nvar nan = 'nan';\n/**\n * Module for number formatting.\n * @private\n */\nvar NumberFormat = /** @class */ (function () {\n function NumberFormat() {\n }\n /**\n * Returns the formatter function for given skeleton.\n * @param {string} culture - Specifies the culture name to be which formatting.\n * @param {NumberFormatOptions} option - Specific the format in which number will format.\n * @param {Object} object- Specifies the global cldr data collection.\n * @return Function.\n */\n NumberFormat.numberFormatter = function (culture, option, cldr) {\n var _this = this;\n var fOptions = extend({}, option);\n var cOptions = {};\n var dOptions = {};\n var symbolPattern;\n var dependable = base.getDependables(cldr, culture, true);\n dOptions.numberMapper = parser.getNumberMapper(dependable.parserObject, parser.getNumberingSystem(cldr), true);\n dOptions.currencySymbol = base.getCurrencySymbol(dependable.numericObject, fOptions.currency || defaultCurrencyCode);\n /* tslint:disable no-any */\n dOptions.percentSymbol = dOptions.numberMapper.numberSymbols[percentSign];\n dOptions.minusSymbol = dOptions.numberMapper.numberSymbols[minusSign];\n var symbols = dOptions.numberMapper.numberSymbols;\n if ((option.format) && !(base.formatRegex.test(option.format))) {\n cOptions = base.customFormat(option.format, dOptions, dependable.numericObject);\n }\n else {\n extend(fOptions, base.getProperNumericSkeleton(option.format || 'N'));\n fOptions.isCurrency = fOptions.type === 'currency';\n fOptions.isPercent = fOptions.type === 'percent';\n symbolPattern = base.getSymbolPattern(fOptions.type, dOptions.numberMapper.numberSystem, dependable.numericObject, fOptions.isAccount);\n fOptions.groupOne = this.checkValueRange(fOptions.maximumSignificantDigits, fOptions.minimumSignificantDigits, true);\n this.checkValueRange(fOptions.maximumFractionDigits, fOptions.minimumFractionDigits, false, true);\n if (!isUndefined(fOptions.fractionDigits)) {\n fOptions.minimumFractionDigits = fOptions.maximumFractionDigits = fOptions.fractionDigits;\n }\n if (isUndefined(fOptions.useGrouping)) {\n fOptions.useGrouping = true;\n }\n if (fOptions.isCurrency) {\n symbolPattern = symbolPattern.replace(/\\u00A4/g, base.defaultCurrency);\n }\n var split = symbolPattern.split(';');\n cOptions.nData = base.getFormatData(split[1] || '-' + split[0], true, dOptions.currencySymbol);\n cOptions.pData = base.getFormatData(split[0], false, dOptions.currencySymbol);\n if (fOptions.useGrouping) {\n fOptions.groupSeparator = symbols[mapper[2]];\n fOptions.groupData = this.getGroupingDetails(split[0]);\n }\n var minFrac = isUndefined(fOptions.minimumFractionDigits);\n if (minFrac) {\n fOptions.minimumFractionDigits = cOptions.nData.minimumFraction;\n }\n if (isUndefined(fOptions.maximumFractionDigits)) {\n var mval = cOptions.nData.maximumFraction;\n fOptions.maximumFractionDigits = isUndefined(mval) && fOptions.isPercent ? 0 : mval;\n }\n var mfrac = fOptions.minimumFractionDigits;\n var lfrac = fOptions.maximumFractionDigits;\n if (!isUndefined(mfrac) && !isUndefined(lfrac)) {\n if (mfrac > lfrac) {\n fOptions.maximumFractionDigits = mfrac;\n }\n }\n }\n extend(cOptions.nData, fOptions);\n extend(cOptions.pData, fOptions);\n return function (value) {\n if (isNaN(value)) {\n return symbols[mapper[1]];\n }\n else if (!isFinite(value)) {\n return symbols[mapper[0]];\n }\n return _this.intNumberFormatter(value, cOptions, dOptions);\n };\n };\n /**\n * Returns grouping details for the pattern provided\n * @param {string} pattern\n * @returns {GroupDetails}\n */\n NumberFormat.getGroupingDetails = function (pattern) {\n var ret = {};\n var match = pattern.match(base.negativeDataRegex);\n if (match && match[4]) {\n var pattern_1 = match[4];\n var p = pattern_1.lastIndexOf(',');\n if (p !== -1) {\n var temp = pattern_1.split('.')[0];\n ret.primary = (temp.length - p) - 1;\n var s = pattern_1.lastIndexOf(',', p - 1);\n if (s !== -1) {\n ret.secondary = p - 1 - s;\n }\n }\n }\n return ret;\n };\n /**\n * Returns if the provided integer range is valid.\n * @param {number} val1\n * @param {number} val2\n * @param {boolean} checkbothExist\n * @param {boolean} isFraction\n * @returns {boolean}\n */\n NumberFormat.checkValueRange = function (val1, val2, checkbothExist, isFraction) {\n var decide = isFraction ? 'f' : 's';\n var dint = 0;\n var str1 = errorText['l' + decide];\n var str2 = errorText['m' + decide];\n if (!isUndefined(val1)) {\n this.checkRange(val1, str1, isFraction);\n dint++;\n }\n if (!isUndefined(val2)) {\n this.checkRange(val2, str2, isFraction);\n dint++;\n }\n if (dint === 2) {\n if (val1 < val2) {\n throwError(str2 + 'specified must be less than the' + str1);\n }\n else {\n return true;\n }\n }\n else if (checkbothExist && dint === 1) {\n throwError('Both' + str2 + 'and' + str2 + 'must be present');\n }\n return false;\n };\n /**\n * Check if the provided fraction range is valid\n * @param {number} val\n * @param {string} text\n * @param {boolean} isFraction\n * @returns {void}\n */\n NumberFormat.checkRange = function (val, text, isFraction) {\n var range = isFraction ? [0, 20] : [1, 21];\n if (val < range[0] || val > range[1]) {\n throwError(text + 'value must be within the range' + range[0] + 'to' + range[1]);\n }\n };\n /**\n * Returns formatted numeric string for provided formatting options\n * @param {number} value\n * @param {base.GenericFormatOptions} fOptions\n * @param {CommonOptions} dOptions\n * @returns {string}\n */\n NumberFormat.intNumberFormatter = function (value, fOptions, dOptions) {\n var curData;\n if (isUndefined(fOptions.nData.type)) {\n return undefined;\n }\n else {\n if (value < 0) {\n value = value * -1;\n curData = fOptions.nData;\n }\n else if (value === 0) {\n curData = fOptions.zeroData || fOptions.pData;\n }\n else {\n curData = fOptions.pData;\n }\n var fValue = '';\n if (curData.isPercent) {\n value = value * 100;\n }\n if (curData.groupOne) {\n fValue = this.processSignificantDigits(value, curData.minimumSignificantDigits, curData.maximumSignificantDigits);\n }\n else {\n fValue = this.processFraction(value, curData.minimumFractionDigits, curData.maximumFractionDigits);\n if (curData.minimumIntegerDigits) {\n fValue = this.processMinimumIntegers(fValue, curData.minimumIntegerDigits);\n }\n }\n if (curData.type === 'scientific') {\n fValue = value.toExponential(curData.maximumFractionDigits);\n fValue = fValue.replace('e', dOptions.numberMapper.numberSymbols[mapper[4]]);\n }\n fValue = fValue.replace('.', dOptions.numberMapper.numberSymbols[mapper[3]]);\n if (curData.useGrouping) {\n fValue = this.groupNumbers(fValue, curData.groupData.primary, curData.groupSeparator || ',', dOptions.numberMapper.numberSymbols[mapper[3]] || '.', curData.groupData.secondary);\n }\n fValue = parser.convertValueParts(fValue, base.latnParseRegex, dOptions.numberMapper.mapper);\n if (curData.nlead === 'N/A') {\n return curData.nlead;\n }\n else {\n return curData.nlead + fValue + curData.nend;\n }\n }\n };\n /**\n * Returns significant digits processed numeric string\n * @param {number} value\n * @param {number} min\n * @param {number} max\n * @returns {string}\n */\n NumberFormat.processSignificantDigits = function (value, min, max) {\n var temp = value + '';\n var tn;\n var length = temp.length;\n if (length < min) {\n return value.toPrecision(min);\n }\n else {\n temp = value.toPrecision(max);\n tn = +temp;\n return tn + '';\n }\n };\n /**\n * Returns grouped numeric string\n * @param {string} val\n * @param {number} level1\n * @param {string} sep\n * @param {string} decimalSymbol\n * @param {number} level2\n * @returns {string}\n */\n NumberFormat.groupNumbers = function (val, level1, sep, decimalSymbol, level2) {\n var flag = !isNullOrUndefined(level2) && level2 !== 0;\n var split = val.split(decimalSymbol);\n var prefix = split[0];\n var length = prefix.length;\n var str = '';\n while (length > level1) {\n str = prefix.slice(length - level1, length) + (str.length ?\n (sep + str) : '');\n length -= level1;\n if (flag) {\n level1 = level2;\n flag = false;\n }\n }\n split[0] = prefix.slice(0, length) + (str.length ? sep : '') + str;\n return split.join(decimalSymbol);\n };\n /**\n * Returns fraction processed numeric string\n * @param {number} value\n * @param {number} min\n * @param {number} max\n * @returns {string}\n */\n NumberFormat.processFraction = function (value, min, max) {\n var temp = (value + '').split('.')[1];\n var length = temp ? temp.length : 0;\n if (min && length < min) {\n var ret = '';\n if (length === 0) {\n ret = value.toFixed(min);\n }\n else {\n ret += value;\n for (var j = 0; j < min - length; j++) {\n ret += '0';\n }\n return ret;\n }\n return value.toFixed(min);\n }\n else if (!isNullOrUndefined(max) && (length > max || max === 0)) {\n return value.toFixed(max);\n }\n return value + '';\n };\n /**\n * Returns integer processed numeric string\n * @param {string} value\n * @param {number} min\n * @returns {string}\n */\n NumberFormat.processMinimumIntegers = function (value, min) {\n var temp = value.split('.');\n var lead = temp[0];\n var len = lead.length;\n if (len < min) {\n for (var i = 0; i < min - len; i++) {\n lead = '0' + lead;\n }\n temp[0] = lead;\n }\n return temp.join('.');\n };\n return NumberFormat;\n}());\nexport { NumberFormat };\n","import { ParserBase as parser } from './parser-base';\nimport { IntlBase as base } from './intl-base';\nimport { isUndefined, throwError, getValue } from '../util';\nvar abbreviateRegexGlobal = /\\/MMMMM|MMMM|MMM|a|LLL|EEEEE|EEEE|E|K|ccc|G+|z+/gi;\nvar standalone = 'stand-alone';\nvar weekdayKey = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\nexport var basicPatterns = ['short', 'medium', 'long', 'full'];\nvar timeSetter = {\n m: 'getMinutes',\n h: 'getHours',\n H: 'getHours',\n s: 'getSeconds',\n d: 'getDate',\n};\nexport var datePartMatcher = {\n 'M': 'month',\n 'd': 'day',\n 'E': 'weekday',\n 'c': 'weekday',\n 'y': 'year',\n 'm': 'minute',\n 'h': 'hour',\n 'H': 'hour',\n 's': 'second',\n 'L': 'month',\n 'a': 'designator',\n 'z': 'timeZone',\n 'Z': 'timeZone',\n 'G': 'era'\n};\nvar timeSeparator = 'timeSeparator';\n/**\n * Date Format is a framework provides support for date formatting.\n * @private\n */\nvar DateFormat = /** @class */ (function () {\n function DateFormat() {\n }\n /**\n * Returns the formatter function for given skeleton.\n * @param {string} - Specifies the culture name to be which formatting.\n * @param {DateFormatOptions} - Specific the format in which date will format.\n * @param {cldr} - Specifies the global cldr data collection.\n * @return Function.\n */\n DateFormat.dateFormat = function (culture, option, cldr) {\n var _this = this;\n var dependable = base.getDependables(cldr, culture);\n var formatOptions = {};\n var resPattern = option.format || base.getResultantPattern(option.skeleton, dependable.dateObject, option.type);\n formatOptions.dateSeperator = base.getDateSeparator(dependable.dateObject);\n if (isUndefined(resPattern)) {\n throwError('Format options or type given must be invalid');\n }\n else {\n formatOptions.pattern = resPattern;\n formatOptions.numMapper = parser.getNumberMapper(dependable.parserObject, parser.getNumberingSystem(cldr));\n var patternMatch = resPattern.match(abbreviateRegexGlobal) || [];\n for (var _i = 0, patternMatch_1 = patternMatch; _i < patternMatch_1.length; _i++) {\n var str = patternMatch_1[_i];\n var len = str.length;\n var char = str[0];\n if (char === 'K') {\n char = 'h';\n }\n /* tslint:disable no-any */\n var charKey = datePartMatcher[char];\n switch (char) {\n case 'E':\n case 'c':\n formatOptions.weekday = dependable.dateObject[base.days][standalone][base.monthIndex[len]];\n break;\n case 'M':\n case 'L':\n formatOptions.month = dependable.dateObject[base.month][standalone][base.monthIndex[len]];\n break;\n case 'a':\n formatOptions.designator = getValue('dayPeriods.format.wide', dependable.dateObject);\n break;\n case 'G':\n var eText = (len <= 3) ? 'eraAbbr' : (len === 4) ? 'eraNames' : 'eraNarrow';\n formatOptions.era = getValue('eras.' + eText, dependable.dateObject);\n break;\n case 'z':\n formatOptions.timeZone = getValue('dates.timeZoneNames', dependable.parserObject);\n break;\n }\n }\n }\n return function (value) {\n if (isNaN(value.getDate())) {\n return null;\n }\n return _this.intDateFormatter(value, formatOptions);\n };\n };\n /**\n * Returns formatted date string based on options passed.\n * @param {Date} value\n * @param {FormatOptions} options\n */\n DateFormat.intDateFormatter = function (value, options) {\n var pattern = options.pattern;\n var ret = '';\n var matches = pattern.match(base.dateParseRegex);\n for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) {\n var match = matches_1[_i];\n var length_1 = match.length;\n var char = match[0];\n if (char === 'K') {\n char = 'h';\n }\n var curval = void 0;\n var isNumber = void 0;\n var processNumber = void 0;\n var curstr = '';\n switch (char) {\n case 'M':\n case 'L':\n curval = value.getMonth() + 1;\n if (length_1 > 2) {\n ret += options.month[curval];\n }\n else {\n isNumber = true;\n }\n break;\n case 'E':\n case 'c':\n ret += options.weekday[weekdayKey[value.getDay()]];\n break;\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'd':\n isNumber = true;\n curval = value[timeSetter[char]]();\n if (char === 'h') {\n curval = curval % 12 || 12;\n }\n break;\n case 'y':\n processNumber = true;\n curstr += value.getFullYear();\n if (length_1 === 2) {\n curstr = curstr.substr(curstr.length - 2);\n }\n break;\n case 'a':\n var desig = value.getHours() < 12 ? 'am' : 'pm';\n ret += options.designator[desig];\n break;\n case 'G':\n var dec = value.getFullYear() < 0 ? 0 : 1;\n ret += options.era[dec];\n break;\n case '\\'':\n ret += (match === '\\'\\'') ? '\\'' : match.replace(/\\'/g, '');\n break;\n case 'z':\n var timezone = value.getTimezoneOffset();\n var pattern_1 = (length_1 < 4) ? '+H;-H' : options.timeZone.hourFormat;\n pattern_1 = pattern_1.replace(/:/g, options.numMapper.timeSeparator);\n if (timezone === 0) {\n ret += options.timeZone.gmtZeroFormat;\n }\n else {\n processNumber = true;\n curstr = this.getTimeZoneValue(timezone, pattern_1);\n }\n curstr = options.timeZone.gmtFormat.replace(/\\{0\\}/, curstr);\n break;\n case ':':\n ret += options.numMapper.numberSymbols[timeSeparator];\n /* tslint:enable no-any */\n break;\n case '/':\n ret += options.dateSeperator;\n break;\n default:\n ret += match;\n }\n if (isNumber) {\n processNumber = true;\n curstr = this.checkTwodigitNumber(curval, length_1);\n }\n if (processNumber) {\n ret += parser.convertValueParts(curstr, base.latnParseRegex, options.numMapper.mapper);\n }\n }\n return ret;\n };\n /**\n * Returns two digit numbers for given value and length\n */\n DateFormat.checkTwodigitNumber = function (val, len) {\n var ret = val + '';\n if (len === 2 && ret.length !== 2) {\n return '0' + ret;\n }\n return ret;\n };\n /**\n * Returns the value of the Time Zone.\n * @param {number} tVal\n * @param {string} pattern\n * @private\n */\n DateFormat.getTimeZoneValue = function (tVal, pattern) {\n var _this = this;\n var splt = pattern.split(';');\n var curPattern = splt[tVal > 0 ? 1 : 0];\n var no = Math.abs(tVal);\n return curPattern = curPattern.replace(/HH?|mm/g, function (str) {\n var len = str.length;\n var ishour = str.indexOf('H') !== -1;\n return _this.checkTwodigitNumber(Math.floor(ishour ? (no / 60) : (no % 60)), len);\n });\n };\n return DateFormat;\n}());\nexport { DateFormat };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { isUndefined, getValue, isNullOrUndefined, setValue, uniqueID } from './util';\nimport { ModuleLoader } from './module-loader';\nimport { Base } from './base';\nimport { Observer } from './observer';\nimport { ChildProperty } from './child-property';\nimport { Property, NotifyPropertyChanges } from './notify-property-change';\nimport { onIntlChange, rightToLeft, defaultCulture } from './internationalization';\nvar componentCount = 0;\nvar lastPageID;\nvar lastHistoryLen = 0;\n/**\n * Base class for all Essential JavaScript components\n */\nvar Component = /** @class */ (function (_super) {\n __extends(Component, _super);\n /**\n * Initialize the constructor for component base\n */\n function Component(options, selector) {\n var _this = _super.call(this, options, selector) || this;\n _this.randomId = uniqueID();\n _this.needsID = false;\n if (isNullOrUndefined(_this.enableRtl)) {\n _this.setProperties({ 'enableRtl': rightToLeft }, true);\n }\n if (isNullOrUndefined(_this.locale)) {\n _this.setProperties({ 'locale': defaultCulture }, true);\n }\n _this.moduleLoader = new ModuleLoader(_this);\n _this.localObserver = new Observer(_this);\n // tslint:disable-next-line:no-function-constructor-with-string-args\n _this.detectFunction = new Function('args', 'var prop = Object.keys(args); if(prop.length){this[prop[0]] = args[prop[0]];}');\n onIntlChange.on('notifyExternalChange', _this.detectFunction, _this, _this.randomId);\n if (!isUndefined(selector)) {\n _this.appendTo();\n }\n return _this;\n }\n Component.prototype.requiredModules = function () {\n return [];\n };\n ;\n /**\n * Destroys the sub modules while destroying the widget\n */\n Component.prototype.destroy = function () {\n if (this.isDestroyed) {\n return;\n }\n if (this.enablePersistence) {\n this.setPersistData();\n }\n this.localObserver.destroy();\n if (this.refreshing) {\n return;\n }\n this.trigger('destroyed', { cancel: false });\n _super.prototype.destroy.call(this);\n this.moduleLoader.clean();\n onIntlChange.off('notifyExternalChange', this.detectFunction, this.randomId);\n };\n /**\n * Applies all the pending property changes and render the component again.\n */\n Component.prototype.refresh = function () {\n this.refreshing = true;\n this.moduleLoader.clean();\n this.destroy();\n this.clearChanges();\n this.localObserver = new Observer(this);\n this.preRender();\n this.injectModules();\n this.render();\n this.refreshing = false;\n };\n /**\n * Appends the control within the given HTML element\n * @param {string | HTMLElement} selector - Target element where control needs to be appended\n */\n Component.prototype.appendTo = function (selector) {\n if (!isNullOrUndefined(selector) && typeof (selector) === 'string') {\n this.element = document.querySelector(selector);\n }\n else if (!isNullOrUndefined(selector)) {\n this.element = selector;\n }\n if (!isNullOrUndefined(this.element)) {\n this.isProtectedOnChange = false;\n if (this.needsID && !this.element.id) {\n this.element.id = this.getUniqueID(this.getModuleName());\n }\n if (this.enablePersistence) {\n this.mergePersistData();\n window.addEventListener('unload', this.setPersistData.bind(this));\n }\n var inst = getValue('ej2_instances', this.element);\n if (!inst || inst.indexOf(this) === -1) {\n _super.prototype.addInstance.call(this);\n }\n this.preRender();\n this.injectModules();\n this.render();\n this.trigger('created');\n }\n };\n /**\n * When invoked, applies the pending property changes immediately to the component.\n */\n Component.prototype.dataBind = function () {\n this.injectModules();\n _super.prototype.dataBind.call(this);\n };\n ;\n /**\n * Attach one or more event handler to the current component context.\n * It is used for internal handling event internally within the component only.\n * @param {BoundOptions[]| string} event - It is optional type either to Set the collection of event list or the eventName.\n * @param {Function} handler - optional parameter Specifies the handler to run when the event occurs\n * @param {Object} context - optional parameter Specifies the context to be bind in the handler.\n * @return {void}\n * @private\n */\n Component.prototype.on = function (event, handler, context) {\n if (typeof event === 'string') {\n this.localObserver.on(event, handler, context);\n }\n else {\n for (var _i = 0, event_1 = event; _i < event_1.length; _i++) {\n var arg = event_1[_i];\n this.localObserver.on(arg.event, arg.handler, arg.context);\n }\n }\n };\n /**\n * To remove one or more event handler that has been attached with the on() method.\n * @param {BoundOptions[]| string} event - It is optional type either to Set the collection of event list or the eventName.\n * @param {Function} handler - optional parameter Specifies the function to run when the event occurs\n * @return {void}\n * @private\n */\n Component.prototype.off = function (event, handler) {\n if (typeof event === 'string') {\n this.localObserver.off(event, handler);\n }\n else {\n for (var _i = 0, event_2 = event; _i < event_2.length; _i++) {\n var arg = event_2[_i];\n this.localObserver.off(arg.event, arg.handler);\n }\n }\n };\n /**\n * To notify the handlers in the specified event.\n * @param {string} property - Specifies the event to be notify.\n * @param {Object} argument - Additional parameters to pass while calling the handler.\n * @return {void}\n * @private\n */\n Component.prototype.notify = function (property, argument) {\n if (this.isDestroyed !== true) {\n this.localObserver.notify(property, argument);\n }\n };\n /**\n * Get injected modules\n * @private\n */\n Component.prototype.getInjectedModules = function () {\n return this.injectedModules;\n };\n ;\n /**\n * Dynamically injects the required modules to the component.\n */\n Component.Inject = function () {\n var moduleList = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n moduleList[_i] = arguments[_i];\n }\n if (!this.prototype.injectedModules) {\n this.prototype.injectedModules = [];\n }\n for (var i = 0; i < moduleList.length; i++) {\n if (this.prototype.injectedModules.indexOf(moduleList[i]) === -1) {\n this.prototype.injectedModules.push(moduleList[i]);\n }\n }\n };\n Component.prototype.injectModules = function () {\n if (this.injectedModules && this.injectedModules.length) {\n this.moduleLoader.inject(this.requiredModules(), this.injectedModules);\n }\n };\n Component.prototype.mergePersistData = function () {\n var data = window.localStorage.getItem(this.getModuleName() + this.element.id);\n if (!(isNullOrUndefined(data) || (data === ''))) {\n this.setProperties(JSON.parse(data), true);\n }\n };\n Component.prototype.setPersistData = function () {\n if (!this.isDestroyed) {\n window.localStorage.setItem(this.getModuleName() + this.element.id, this.getPersistData());\n }\n };\n Component.prototype.clearTemplate = function (templateName) {\n //No Code\n };\n Component.prototype.getUniqueID = function (definedName) {\n if (this.isHistoryChanged()) {\n componentCount = 0;\n }\n lastPageID = this.pageID(location.href);\n lastHistoryLen = history.length;\n return definedName + '_' + lastPageID + '_' + componentCount++;\n };\n Component.prototype.pageID = function (url) {\n var hash = 0;\n if (url.length === 0) {\n return hash;\n }\n for (var i = 0; i < url.length; i++) {\n var char = url.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n return Math.abs(hash);\n };\n Component.prototype.isHistoryChanged = function () {\n return lastPageID !== this.pageID(location.href) || lastHistoryLen !== history.length;\n };\n Component.prototype.addOnPersist = function (options) {\n var _this = this;\n var persistObj = {};\n for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {\n var key = options_1[_i];\n var objValue = void 0;\n objValue = getValue(key, this);\n if (!isUndefined(objValue)) {\n setValue(key, this.getActualProperties(objValue), persistObj);\n }\n }\n return JSON.stringify(persistObj, function (key, value) {\n return _this.getActualProperties(value);\n });\n };\n Component.prototype.getActualProperties = function (obj) {\n if (obj instanceof ChildProperty) {\n return getValue('properties', obj);\n }\n else {\n return obj;\n }\n };\n Component.prototype.ignoreOnPersist = function (options) {\n return JSON.stringify(this.iterateJsonProperties(this.properties, options));\n };\n Component.prototype.iterateJsonProperties = function (obj, ignoreList) {\n var newObj = {};\n var _loop_1 = function (key) {\n if (ignoreList.indexOf(key) === -1) {\n // tslint:disable-next-line:no-any\n var value = obj[key];\n if (typeof value === 'object' && !(value instanceof Array)) {\n var newList = ignoreList.filter(function (str) {\n return new RegExp(key + '.').test(str);\n }).map(function (str) {\n return str.replace(key + '.', '');\n });\n newObj[key] = this_1.iterateJsonProperties(this_1.getActualProperties(value), newList);\n }\n else {\n newObj[key] = value;\n }\n }\n };\n var this_1 = this;\n for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) {\n var key = _a[_i];\n _loop_1(key);\n }\n return newObj;\n };\n __decorate([\n Property(false)\n ], Component.prototype, \"enablePersistence\", void 0);\n __decorate([\n Property()\n ], Component.prototype, \"enableRtl\", void 0);\n __decorate([\n Property()\n ], Component.prototype, \"locale\", void 0);\n Component = __decorate([\n NotifyPropertyChanges\n ], Component);\n return Component;\n}(Base));\nexport { Component };\n//Function handling for page navigation detection \n/* istanbul ignore next */\n(function () {\n if (typeof window !== 'undefined') {\n window.addEventListener('popstate', \n /* istanbul ignore next */\n function () {\n componentCount = 0;\n });\n }\n})();\n","import { IntlBase as base } from './intl-base';\nimport { ParserBase as parser } from './parser-base';\nimport { isUndefined, throwError, getValue, isNullOrUndefined } from '../util';\nimport { datePartMatcher } from './date-formatter';\nvar number = 'numbers';\nvar defNoSystem = 'defaultNumberingSystem';\nvar noSystem = 'numberingSystem';\nvar standalone = 'stand-alone';\nvar curWeekDay = 'curWeekDay';\nvar latnRegex = /^[0-9]*$/;\nvar abbreviateRegex = /\\/MMMMM|MMMM|MMM|a|LLL|EEEEE|EEEE|E|ccc/;\nvar timeSetter = {\n minute: 'setMinutes',\n hour: 'setHours',\n second: 'setSeconds',\n day: 'setDate',\n month: 'setMonth'\n};\nvar month = 'months';\n/* tslint:disable no-any */\n/**\n * Date Parser.\n * @private\n */\nvar DateParser = /** @class */ (function () {\n function DateParser() {\n }\n /**\n * Returns the parser function for given skeleton.\n * @param {string} - Specifies the culture name to be which formatting.\n * @param {DateFormatOptions} - Specific the format in which string date will be parsed.\n * @param {cldr} - Specifies the global cldr data collection.\n * @return Function.\n */\n // tslint:disable-next-line:max-func-body-length\n DateParser.dateParser = function (culture, option, cldr) {\n var _this = this;\n var dependable = base.getDependables(cldr, culture);\n var numOptions = parser.getCurrentNumericOptions(dependable.parserObject, parser.getNumberingSystem(cldr));\n var parseOptions = {};\n var resPattern = option.format || base.getResultantPattern(option.skeleton, dependable.dateObject, option.type);\n var regexString = '';\n var hourOnly;\n if (isUndefined(resPattern)) {\n throwError('Format options or type given must be invalid');\n }\n else {\n parseOptions = { pattern: resPattern, evalposition: {} };\n var patternMatch = resPattern.match(base.dateParseRegex) || [];\n var length_1 = patternMatch.length;\n var gmtCorrection = 0;\n var zCorrectTemp = 0;\n var isgmtTraversed = false;\n var nRegx = numOptions.numericRegex;\n for (var i = 0; i < length_1; i++) {\n var str = patternMatch[i];\n var len = str.length;\n var char = (str[0] === 'K') ? 'h' : str[0];\n var isNumber = void 0;\n var canUpdate = void 0;\n var charKey = datePartMatcher[char];\n var optional = (len === 2) ? '' : '?';\n if (isgmtTraversed) {\n gmtCorrection = zCorrectTemp;\n isgmtTraversed = false;\n }\n switch (char) {\n case 'E':\n case 'c':\n // tslint:disable-next-line\n var weekObject = parser.reverseObject(dependable.dateObject[base.days][standalone][base.monthIndex[len]]);\n regexString += '(' + Object.keys(weekObject).join('|') + ')';\n break;\n case 'M':\n case 'L':\n case 'd':\n case 'm':\n case 's':\n case 'h':\n case 'H':\n canUpdate = true;\n if ((char === 'M' || char === 'L') && len > 2) {\n // tslint:disable-next-line\n parseOptions[charKey] = parser.reverseObject(dependable.dateObject[month][standalone][base.monthIndex[len]]);\n /* tslint:disable no-any */\n regexString += '(' + Object.keys(parseOptions[charKey]).join('|') + ')';\n }\n else {\n isNumber = true;\n regexString += '(' + nRegx + nRegx + optional + ')';\n }\n if (char === 'h') {\n parseOptions.hour12 = true;\n }\n break;\n case 'y':\n canUpdate = isNumber = true;\n if (len === 2) {\n regexString += '(' + nRegx + nRegx + ')';\n }\n else {\n regexString += '(' + nRegx + '{' + len + ',})';\n }\n break;\n case 'a':\n canUpdate = true;\n parseOptions[charKey] = parser.reverseObject(getValue('dayPeriods.format.wide', dependable.dateObject));\n regexString += '(' + Object.keys(parseOptions[charKey]).join('|') + ')';\n break;\n case 'G':\n canUpdate = true;\n var eText = (len <= 3) ? 'eraAbbr' : (len === 4) ? 'eraNames' : 'eraNarrow';\n parseOptions[charKey] = parser.reverseObject(getValue('eras.' + eText, dependable.dateObject));\n regexString += '(' + Object.keys(parseOptions[charKey]).join('|') + '?)';\n break;\n case 'z':\n var tval = new Date().getTimezoneOffset();\n canUpdate = (tval !== 0);\n parseOptions[charKey] = getValue('dates.timeZoneNames', dependable.parserObject);\n var tzone = parseOptions[charKey];\n hourOnly = (len < 4);\n var hpattern = hourOnly ? '+H;-H' : tzone.hourFormat;\n regexString += '(' + this.parseTimeZoneRegx(hpattern, tzone, nRegx) + ')?';\n isgmtTraversed = true;\n zCorrectTemp = hourOnly ? 6 : 12;\n break;\n case '\\'':\n var iString = str.replace(/\\'/g, '');\n regexString += '(' + iString + ')?';\n break;\n default:\n regexString += '([\\\\D])';\n break;\n }\n if (canUpdate) {\n parseOptions.evalposition[charKey] = { isNumber: isNumber, pos: i + 1 + gmtCorrection, hourOnly: hourOnly };\n }\n if (i === length_1 - 1 && !isNullOrUndefined(regexString)) {\n parseOptions.parserRegex = new RegExp('^' + regexString + '$');\n }\n }\n }\n return function (value) {\n var parsedDateParts = _this.internalDateParse(value, parseOptions, numOptions);\n if (isNullOrUndefined(parsedDateParts) || !Object.keys(parsedDateParts).length) {\n return null;\n }\n return _this.getDateObject(parsedDateParts);\n };\n };\n /**\n * Returns date object for provided date options\n * @param {DateParts} options\n * @param {Date} value\n * @returns {Date}\n */\n DateParser.getDateObject = function (options, value) {\n var res = value || new Date();\n res.setMilliseconds(0);\n var tKeys = ['hour', 'minute', 'second', 'month', 'day'];\n var y = options.year;\n var desig = options.designator;\n var tzone = options.timeZone;\n if (!isUndefined(y)) {\n var len = (y + '').length;\n if (len <= 2) {\n var century = Math.floor(res.getFullYear() / 100) * 100;\n y += century;\n }\n res.setFullYear(y);\n }\n for (var _i = 0, tKeys_1 = tKeys; _i < tKeys_1.length; _i++) {\n var key = tKeys_1[_i];\n var tValue = options[key];\n if (!isUndefined(tValue)) {\n if (key === 'month') {\n tValue -= 1;\n if (tValue < 0 || tValue > 11) {\n return new Date('invalid');\n }\n var pDate = res.getDate();\n res.setDate(1);\n res[timeSetter[key]](tValue);\n var lDate = new Date(res.getFullYear(), tValue + 1, 0).getDate();\n res.setDate(pDate < lDate ? pDate : lDate);\n }\n else {\n if (key === 'day') {\n var lastDay = new Date(res.getFullYear(), res.getMonth() + 1, 0).getDate();\n if ((tValue < 1 || tValue > lastDay)) {\n return null;\n }\n }\n res[timeSetter[key]](tValue);\n }\n }\n }\n if (!isUndefined(desig)) {\n var hour = res.getHours();\n if (desig === 'pm') {\n res.setHours(hour + (hour === 12 ? 0 : 12));\n }\n else if (hour === 12) {\n res.setHours(0);\n }\n }\n if (!isUndefined(tzone)) {\n var tzValue = tzone - res.getTimezoneOffset();\n if (tzValue !== 0) {\n res.setMinutes(res.getMinutes() + tzValue);\n }\n }\n return res;\n };\n /**\n * Returns date parsing options for provided value along with parse and numeric options\n * @param {string} value\n * @param {ParseOptions} parseOptions\n * @param {NumericOptions} num\n * @returns {DateParts}\n */\n DateParser.internalDateParse = function (value, parseOptions, num) {\n var matches = value.match(parseOptions.parserRegex);\n var retOptions = { 'hour': 0, 'minute': 0, 'second': 0 };\n var nRegx = num.numericRegex;\n if (isNullOrUndefined(matches)) {\n return null;\n }\n else {\n var props = Object.keys(parseOptions.evalposition);\n for (var _i = 0, props_1 = props; _i < props_1.length; _i++) {\n var prop = props_1[_i];\n var curObject = parseOptions.evalposition[prop];\n var matchString = matches[curObject.pos];\n if (curObject.isNumber) {\n retOptions[prop] = this.internalNumberParser(matchString, num);\n }\n else {\n if (prop === 'timeZone' && !isUndefined(matchString)) {\n var pos = curObject.pos;\n var val = void 0;\n var tmatch = matches[pos + 1];\n var flag = !isUndefined(tmatch);\n if (curObject.hourOnly) {\n val = this.getZoneValue(flag, tmatch, matches[pos + 4], num) * 60;\n }\n else {\n val = this.getZoneValue(flag, tmatch, matches[pos + 7], num) * 60;\n val += this.getZoneValue(flag, matches[pos + 4], matches[pos + 10], num);\n }\n if (!isNullOrUndefined(val)) {\n retOptions[prop] = val;\n }\n }\n else {\n retOptions[prop] = parseOptions[prop][matchString];\n }\n }\n }\n if (parseOptions.hour12) {\n retOptions.hour12 = true;\n }\n }\n return retOptions;\n };\n /**\n * Returns parsed number for provided Numeric string and Numeric Options\n * @param {string} value\n * @param {NumericOptions} option\n * @returns {number}\n */\n DateParser.internalNumberParser = function (value, option) {\n value = parser.convertValueParts(value, option.numberParseRegex, option.numericPair);\n if (latnRegex.test(value)) {\n return +value;\n }\n return null;\n };\n /**\n * Returns parsed time zone RegExp for provided hour format and time zone\n * @param {string} hourFormat\n * @param {base.TimeZoneOptions} tZone\n * @param {string} nRegex\n * @returns {string}\n */\n DateParser.parseTimeZoneRegx = function (hourFormat, tZone, nRegex) {\n var pattern = tZone.gmtFormat;\n var ret;\n var result;\n var cRegex = '(' + nRegex + ')' + '(' + nRegex + ')';\n var splitStr;\n ret = hourFormat.replace('+', '\\\\+');\n if (hourFormat.indexOf('HH') !== -1) {\n ret = ret.replace(/HH|mm/g, '(' + cRegex + ')');\n }\n else {\n ret = ret.replace(/H|m/g, '(' + cRegex + '?)');\n }\n splitStr = (ret.split(';').map(function (str) {\n return pattern.replace('{0}', str);\n }));\n ret = splitStr.join('|') + '|' + tZone.gmtZeroFormat;\n return ret;\n };\n /**\n * Returns zone based value.\n * @param {boolean} flag\n * @param {string} val1\n * @param {string} val2\n * @param {NumericOptions} num\n * @returns {number}\n */\n DateParser.getZoneValue = function (flag, val1, val2, num) {\n var ival = flag ? val1 : val2;\n if (!ival) {\n return 0;\n }\n var value = this.internalNumberParser(ival, num);\n if (flag) {\n return -value;\n }\n return value;\n };\n return DateParser;\n}());\nexport { DateParser };\n","import { extend, isNullOrUndefined } from '../util';\nimport { ParserBase as parser } from './parser-base';\nimport { IntlBase as base } from './intl-base';\nvar formatRegex = /(^[ncpa]{1})([0-1]?[0-9]|20)?$/i;\nvar parseRegex = /^([^0-9]*)(([0-9,]*[0-9]+)(\\.[0-9]+)?)([Ee][+-]?[0-9]+)?([^0-9]*)$/;\nvar groupRegex = /,/g;\nvar latnDecimalRegex = /^[0-9]*(\\.[0-9]+)?$/;\nvar keys = ['minusSign', 'infinity'];\n/**\n * Module for Number Parser.\n * @private\n */\nvar NumberParser = /** @class */ (function () {\n function NumberParser() {\n }\n /**\n * Returns the parser function for given skeleton.\n * @param {string} - Specifies the culture name to be which formatting.\n * @param {NumberFormatOptions} - Specific the format in which number will parsed.\n * @param {cldr} - Specifies the global cldr data collection.\n * @return Function.\n */\n NumberParser.numberParser = function (culture, option, cldr) {\n var _this = this;\n var dependable = base.getDependables(cldr, culture, true);\n var parseOptions = { custom: true };\n var numOptions;\n if ((base.formatRegex.test(option.format)) || !(option.format)) {\n extend(parseOptions, base.getProperNumericSkeleton(option.format || 'N'));\n parseOptions.custom = false;\n }\n else {\n extend(parseOptions, base.customFormat(option.format, null, null));\n }\n numOptions = parser.getCurrentNumericOptions(dependable.parserObject, parser.getNumberingSystem(cldr), true);\n parseOptions.symbolRegex = parser.getSymbolRegex(Object.keys(numOptions.symbolMatch));\n // tslint:disable-next-line:no-any\n parseOptions.infinity = numOptions.symbolNumberSystem[keys[1]];\n var symbolpattern = base.getSymbolPattern(parseOptions.type, numOptions.numberSystem, dependable.numericObject, parseOptions.isAccount);\n if (symbolpattern) {\n symbolpattern = symbolpattern.replace(/\\u00A4/g, base.defaultCurrency);\n var split = symbolpattern.split(';');\n parseOptions.nData = base.getFormatData(split[1] || '-' + split[0], true, '');\n parseOptions.pData = base.getFormatData(split[0], true, '');\n }\n return function (value) {\n return _this.getParsedNumber(value, parseOptions, numOptions);\n };\n };\n /**\n * Returns parsed number for the provided formatting options\n * @param {string} value\n * @param {NumericParts} options\n * @param {NumericOptions} numOptions\n * @returns {number}\n */\n NumberParser.getParsedNumber = function (value, options, numOptions) {\n var isNegative;\n var isPercent;\n var tempValue;\n var lead;\n var end;\n var ret;\n if (value.indexOf(options.infinity) !== -1) {\n return Infinity;\n }\n else {\n value = parser.convertValueParts(value, options.symbolRegex, numOptions.symbolMatch);\n value = parser.convertValueParts(value, numOptions.numberParseRegex, numOptions.numericPair);\n if (value.indexOf('.') === 0) {\n value = '0' + value;\n }\n var matches = value.match(parseRegex);\n if (isNullOrUndefined(matches)) {\n return NaN;\n }\n lead = matches[1];\n tempValue = matches[2];\n var exponent = matches[5];\n end = matches[6];\n isNegative = options.custom ? ((lead === options.nData.nlead) && (end === options.nData.nend)) :\n ((lead.indexOf(options.nData.nlead) !== -1) && (end.indexOf(options.nData.nend) !== -1));\n isPercent = isNegative ?\n options.nData.isPercent :\n options.pData.isPercent;\n tempValue = tempValue.replace(groupRegex, '');\n if (exponent) {\n tempValue += exponent;\n }\n ret = +tempValue;\n if (options.type === 'percent' || isPercent) {\n ret = ret / 100;\n }\n if (options.custom || options.fractionDigits) {\n ret = parseFloat(ret.toFixed(options.custom ?\n (isNegative ? options.nData.maximumFractionDigits : options.pData.maximumFractionDigits) : options.fractionDigits));\n }\n if (isNegative) {\n ret *= -1;\n }\n return ret;\n }\n };\n return NumberParser;\n}());\nexport { NumberParser };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Base } from './base';\nimport { Browser } from './browser';\nimport { isVisible } from './dom';\nimport { Property, Complex, NotifyPropertyChanges, Event } from './notify-property-change';\nimport { EventHandler } from './event-handler';\nimport { ChildProperty } from './child-property';\nimport { select, closest, setStyleAttribute, addClass, createElement } from './dom';\nimport { extend, isUndefined, isNullOrUndefined, compareElementParent } from './util';\nvar defaultPosition = { left: 0, top: 0, bottom: 0, right: 0 };\nvar positionProp = ['offsetLeft', 'offsetTop'];\nvar axisMapper = ['x', 'y'];\nvar axisValueMapper = ['left', 'top'];\n/**\n * Specifies the position coordinates\n */\nvar Position = /** @class */ (function (_super) {\n __extends(Position, _super);\n function Position() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property(0)\n ], Position.prototype, \"left\", void 0);\n __decorate([\n Property(0)\n ], Position.prototype, \"top\", void 0);\n return Position;\n}(ChildProperty));\nexport { Position };\n/**\n * Draggable Module provides support to enable draggable functionality in Dom Elements.\n * ```html\n *
Draggable
\n * \n * ```\n */\nvar Draggable = /** @class */ (function (_super) {\n __extends(Draggable, _super);\n function Draggable(element, options) {\n var _this = _super.call(this, options, element) || this;\n _this.dragLimit = Draggable_1.getDefaultPosition();\n _this.borderWidth = Draggable_1.getDefaultPosition();\n _this.padding = Draggable_1.getDefaultPosition();\n _this.diffX = 0;\n _this.diffY = 0;\n _this.droppables = {};\n _this.bind();\n return _this;\n }\n Draggable_1 = Draggable;\n Draggable.prototype.bind = function () {\n this.toggleEvents();\n if (Browser.isIE) {\n addClass([this.element], 'e-block-touch');\n }\n this.droppables[this.scope] = {};\n };\n Draggable.getDefaultPosition = function () {\n return extend({}, defaultPosition);\n };\n Draggable.prototype.toggleEvents = function (isUnWire) {\n var ele;\n if (!isUndefined(this.handle)) {\n ele = select(this.handle, this.element);\n }\n if (isUnWire) {\n EventHandler.remove(ele || this.element, Browser.touchStartEvent, this.initialize);\n }\n else {\n EventHandler.add(ele || this.element, Browser.touchStartEvent, this.initialize, this);\n }\n };\n Draggable.prototype.initialize = function (evt) {\n this.target = evt.currentTarget;\n if (this.preventDefault && !isUndefined(evt.changedTouches)) {\n evt.preventDefault();\n }\n if (this.abort) {\n if (!isNullOrUndefined(closest(evt.target, this.abort))) {\n return;\n }\n }\n this.element.setAttribute('aria-grabbed', 'true');\n var intCoord = this.getCoordinates(evt);\n this.initialPosition = { x: intCoord.pageX, y: intCoord.pageY };\n if (!this.clone) {\n var pos = this.element.getBoundingClientRect();\n this.relativeXPosition = intCoord.pageX - pos.left;\n this.relativeYPosition = intCoord.pageY - pos.top;\n }\n EventHandler.add(document, Browser.touchMoveEvent, this.intDragStart, this);\n EventHandler.add(document, Browser.touchEndEvent, this.intDestroy, this);\n this.toggleEvents(true);\n document.body.classList.add('e-prevent-select');\n EventHandler.trigger(document.documentElement, Browser.touchStartEvent, evt);\n };\n Draggable.prototype.intDragStart = function (evt) {\n var isChangeTouch = !isUndefined(evt.changedTouches);\n if (isChangeTouch && (evt.changedTouches.length !== 1)) {\n return;\n }\n if (isChangeTouch) {\n evt.preventDefault();\n }\n var intCordinate = this.getCoordinates(evt);\n var pos;\n var styleProp = getComputedStyle(this.element);\n this.margin = {\n left: parseInt(styleProp.marginLeft, 10),\n top: parseInt(styleProp.marginTop, 10),\n right: parseInt(styleProp.marginRight, 10),\n bottom: parseInt(styleProp.marginBottom, 10),\n };\n var element = this.element;\n if (this.clone && this.dragTarget) {\n var intClosest = closest(evt.target, this.dragTarget);\n if (!isNullOrUndefined(intClosest)) {\n element = intClosest;\n }\n }\n this.offset = this.calculateParentPosition(element);\n this.position = this.getMousePosition(evt);\n var x = this.initialPosition.x - intCordinate.pageX;\n var y = this.initialPosition.y - intCordinate.pageY;\n var distance = Math.sqrt((x * x) + (y * y));\n if (distance >= this.distance) {\n var ele = this.getHelperElement(evt);\n if (!ele || isNullOrUndefined(ele)) {\n return;\n }\n var dragTargetElement = this.helperElement = ele;\n this.parentClientRect = this.calculateParentPosition(dragTargetElement.offsetParent);\n if (this.dragStart) {\n var curTarget = this.getProperTargetElement(evt);\n this.trigger('dragStart', { event: evt, element: element, target: curTarget });\n }\n if (this.dragArea) {\n this.setDragArea();\n }\n else {\n this.dragLimit = { left: 0, right: 0, bottom: 0, top: 0 };\n this.borderWidth = { top: 0, left: 0 };\n }\n pos = { left: this.position.left - this.parentClientRect.left, top: this.position.top - this.parentClientRect.top };\n if (this.clone && !this.enableTailMode) {\n this.diffX = this.position.left - this.offset.left;\n this.diffY = this.position.top - this.offset.top;\n }\n var posValue = this.getProcessedPositionValue({\n top: (pos.top - this.diffY) + 'px',\n left: (pos.left - this.diffX) + 'px'\n });\n setStyleAttribute(dragTargetElement, this.getDragPosition({ position: 'absolute', left: posValue.left, top: posValue.top }));\n EventHandler.remove(document, Browser.touchMoveEvent, this.intDragStart);\n EventHandler.remove(document, Browser.touchEndEvent, this.intDestroy);\n if (isVisible(dragTargetElement)) {\n EventHandler.add(document, Browser.touchMoveEvent, this.intDrag, this);\n EventHandler.add(document, Browser.touchEndEvent, this.intDragStop, this);\n this.setGlobalDroppables(false, this.element, dragTargetElement);\n }\n else {\n this.toggleEvents();\n document.body.classList.remove('e-prevent-select');\n }\n }\n };\n Draggable.prototype.elementInViewport = function (el) {\n this.top = el.offsetTop;\n this.left = el.offsetLeft;\n this.width = el.offsetWidth;\n this.height = el.offsetHeight;\n while (el.offsetParent) {\n el = el.offsetParent;\n this.top += el.offsetTop;\n this.left += el.offsetLeft;\n }\n return (this.top >= window.pageYOffset &&\n this.left >= window.pageXOffset &&\n (this.top + this.height) <= (window.pageYOffset + window.innerHeight) &&\n (this.left + this.width) <= (window.pageXOffset + window.innerWidth));\n };\n Draggable.prototype.getProcessedPositionValue = function (value) {\n if (this.queryPositionInfo) {\n return this.queryPositionInfo(value);\n }\n return value;\n };\n Draggable.prototype.calculateParentPosition = function (ele) {\n if (isNullOrUndefined(ele)) {\n return { left: 0, top: 0 };\n }\n var rect = ele.getBoundingClientRect();\n var style = getComputedStyle(ele);\n return {\n left: (rect.left + window.pageXOffset) - parseInt(style.marginLeft, 10),\n top: (rect.top + window.pageYOffset) - parseInt(style.marginTop, 10)\n };\n };\n Draggable.prototype.intDrag = function (evt) {\n if (!isUndefined(evt.changedTouches) && (evt.changedTouches.length !== 1)) {\n return;\n }\n var left;\n var top;\n this.position = this.getMousePosition(evt);\n var docHeight = this.getDocumentWidthHeight('Height');\n if (docHeight < this.position.top) {\n this.position.top = docHeight;\n }\n var docWidth = this.getDocumentWidthHeight('Width');\n if (docWidth < this.position.left) {\n this.position.left = docWidth;\n }\n if (this.drag) {\n var curTarget = this.getProperTargetElement(evt);\n this.trigger('drag', { event: evt, element: this.element, target: curTarget });\n }\n var eleObj = this.checkTargetElement(evt);\n if (eleObj.target && eleObj.instance) {\n /* tslint:disable no-any */\n eleObj.instance.dragData[this.scope] = this.droppables[this.scope];\n eleObj.instance.intOver(evt, eleObj.target);\n this.hoverObject = eleObj;\n }\n else if (this.hoverObject) {\n this.hoverObject.instance.intOut(evt, eleObj.target);\n this.hoverObject.instance.dragData[this.scope] = null;\n this.hoverObject = null;\n }\n var helperElement = this.droppables[this.scope].helper;\n this.parentClientRect = this.calculateParentPosition(this.helperElement.offsetParent);\n var tLeft = this.parentClientRect.left;\n var tTop = this.parentClientRect.top;\n var intCoord = this.getCoordinates(evt);\n var pagex = intCoord.pageX;\n var pagey = intCoord.pageY;\n var dLeft = this.position.left - this.diffX;\n var dTop = this.position.top - this.diffY;\n if (this.dragArea) {\n var styles = getComputedStyle(helperElement);\n if (this.pageX !== pagex || this.skipDistanceCheck) {\n var helperWidth = helperElement.offsetWidth + (parseFloat(styles.marginLeft)\n + parseFloat(styles.marginRight));\n if (this.dragLimit.left > dLeft) {\n left = this.dragLimit.left;\n }\n else if (this.dragLimit.right < dLeft + helperWidth) {\n left = this.dragLimit.right - helperWidth;\n }\n else {\n left = dLeft;\n }\n }\n if (this.pageY !== pagey || this.skipDistanceCheck) {\n var helperHeight = helperElement.offsetHeight + (parseFloat(styles.marginTop)\n + parseFloat(styles.marginBottom));\n if (this.dragLimit.top > dTop) {\n top = this.dragLimit.top;\n }\n else if (this.dragLimit.bottom < dTop + helperHeight) {\n top = this.dragLimit.bottom - helperHeight;\n }\n else {\n top = dTop;\n }\n }\n }\n else {\n left = dLeft;\n top = dTop;\n }\n var iTop = tTop + this.borderWidth.top;\n var iLeft = tLeft + this.borderWidth.left;\n var dragValue = this.getProcessedPositionValue({ top: (top - iTop) + 'px', left: (left - iLeft) + 'px' });\n setStyleAttribute(helperElement, this.getDragPosition(dragValue));\n if (!this.elementInViewport(helperElement) && this.enableAutoScroll) {\n this.helperElement.scrollIntoView();\n }\n this.position.left = left;\n this.position.top = top;\n this.pageX = pagex;\n this.pageY = pagey;\n };\n Draggable.prototype.getDragPosition = function (dragValue) {\n var temp = extend({}, dragValue);\n if (this.axis) {\n if (this.axis === 'x') {\n delete temp.top;\n }\n else if (this.axis === 'y') {\n delete temp.left;\n }\n }\n return temp;\n };\n Draggable.prototype.getDocumentWidthHeight = function (str) {\n var docBody = document.body;\n var docEle = document.documentElement;\n var returnValue = Math.max(docBody['scroll' + str], docEle['scroll' + str], docBody['offset' + str], docEle['offset' + str], docEle['client' + str]);\n return returnValue;\n };\n Draggable.prototype.intDragStop = function (evt) {\n if (!isUndefined(evt.changedTouches) && (evt.changedTouches.length !== 1)) {\n return;\n }\n var type = ['touchend', 'pointerup', 'mouseup'];\n if (type.indexOf(evt.type) !== -1) {\n if (this.dragStop) {\n var curTarget = this.getProperTargetElement(evt);\n this.trigger('dragStop', { event: evt, element: this.element, target: curTarget, helper: this.helperElement });\n }\n this.intDestroy(evt);\n }\n else {\n this.element.setAttribute('aria-grabbed', 'false');\n }\n var eleObj = this.checkTargetElement(evt);\n if (eleObj.target && eleObj.instance) {\n eleObj.instance.dragStopCalled = true;\n eleObj.instance.dragData[this.scope] = this.droppables[this.scope];\n eleObj.instance.intDrop(evt, eleObj.target);\n }\n this.setGlobalDroppables(true);\n document.body.classList.remove('e-prevent-select');\n };\n Draggable.prototype.intDestroy = function (evt) {\n this.toggleEvents();\n document.body.classList.remove('e-prevent-select');\n this.element.setAttribute('aria-grabbed', 'false');\n EventHandler.remove(document, Browser.touchMoveEvent, this.intDragStart);\n EventHandler.remove(document, Browser.touchEndEvent, this.intDragStop);\n EventHandler.remove(document, Browser.touchEndEvent, this.intDestroy);\n EventHandler.remove(document, Browser.touchMoveEvent, this.intDrag);\n };\n // triggers when property changed\n Draggable.prototype.onPropertyChanged = function (newProp, oldProp) {\n //No Code to handle\n };\n Draggable.prototype.getModuleName = function () {\n return 'draggable';\n };\n Draggable.prototype.setDragArea = function () {\n var eleWidthBound;\n var eleHeightBound;\n var top = 0;\n var left = 0;\n var ele;\n var type = typeof this.dragArea;\n if (type === 'string') {\n ele = select(this.dragArea);\n }\n else {\n ele = this.dragArea;\n }\n if (ele) {\n var elementArea = ele.getBoundingClientRect();\n eleWidthBound = elementArea.width ? elementArea.width : elementArea.right - elementArea.left;\n eleHeightBound = elementArea.height ? elementArea.height : elementArea.bottom - elementArea.top;\n var keys = ['Top', 'Left', 'Bottom', 'Right'];\n var styles = getComputedStyle(ele);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var tborder = styles['border' + key + 'Width'];\n var tpadding = styles['padding' + key];\n var lowerKey = key.toLowerCase();\n this.borderWidth[lowerKey] = isNaN(parseFloat(tborder)) ? 0 : parseFloat(tborder);\n this.padding[lowerKey] = isNaN(parseFloat(tpadding)) ? 0 : parseFloat(tpadding);\n }\n top = elementArea.top;\n left = elementArea.left;\n this.dragLimit.left = left + this.borderWidth.left + this.padding.left;\n this.dragLimit.top = top + this.borderWidth.top + this.padding.top;\n this.dragLimit.right = left + eleWidthBound - (this.borderWidth.right + this.padding.right);\n this.dragLimit.bottom = top + eleHeightBound - (this.borderWidth.bottom + this.padding.bottom);\n }\n };\n Draggable.prototype.getProperTargetElement = function (evt) {\n var intCoord = this.getCoordinates(evt);\n var ele;\n var prevStyle = this.helperElement.style.display || '';\n if (compareElementParent(evt.target, this.helperElement) || evt.type.indexOf('touch') !== -1) {\n this.helperElement.style.display = 'none';\n ele = document.elementFromPoint(intCoord.clientX, intCoord.clientY);\n this.helperElement.style.display = prevStyle;\n }\n else {\n ele = evt.target;\n }\n return ele;\n };\n Draggable.prototype.getMousePosition = function (evt) {\n var intCoord = this.getCoordinates(evt);\n var pageX = this.clone ? intCoord.pageX : intCoord.pageX - this.relativeXPosition;\n var pageY = this.clone ? intCoord.pageY : intCoord.pageY - this.relativeYPosition;\n return {\n left: pageX - (this.margin.left + this.cursorAt.left),\n top: pageY - (this.margin.top + this.cursorAt.top)\n };\n };\n Draggable.prototype.getCoordinates = function (evt) {\n if (evt.type.indexOf('touch') > -1) {\n return evt.changedTouches[0];\n }\n return evt;\n };\n Draggable.prototype.getHelperElement = function (evt) {\n var element;\n if (this.clone) {\n if (this.helper) {\n element = this.helper({ sender: evt, element: this.target });\n }\n else {\n element = createElement('div', { className: 'e-drag-helper e-block-touch', innerHTML: 'Draggable' });\n document.body.appendChild(element);\n }\n }\n else {\n element = this.element;\n }\n return element;\n };\n Draggable.prototype.setGlobalDroppables = function (reset, drag, helper) {\n this.droppables[this.scope] = reset ? null : {\n draggable: drag,\n helper: helper,\n draggedElement: this.element\n };\n };\n Draggable.prototype.checkTargetElement = function (evt) {\n var target = this.getProperTargetElement(evt);\n var dropIns = this.getDropInstance(target);\n if (!dropIns && target && !isNullOrUndefined(target.parentNode)) {\n var parent_1 = closest(target.parentNode, '.e-droppable') || target.parentElement;\n if (parent_1) {\n dropIns = this.getDropInstance(parent_1);\n }\n }\n return { target: target, instance: dropIns };\n };\n Draggable.prototype.getDropInstance = function (ele) {\n var name = 'getModuleName';\n var drop;\n var eleInst = ele && ele.ej2_instances;\n if (eleInst) {\n for (var _i = 0, eleInst_1 = eleInst; _i < eleInst_1.length; _i++) {\n var inst = eleInst_1[_i];\n if (inst[name]() === 'droppable') {\n drop = inst;\n break;\n }\n }\n }\n return drop;\n };\n Draggable.prototype.destroy = function () {\n this.toggleEvents(true);\n _super.prototype.destroy.call(this);\n };\n __decorate([\n Complex({}, Position)\n ], Draggable.prototype, \"cursorAt\", void 0);\n __decorate([\n Property(true)\n ], Draggable.prototype, \"clone\", void 0);\n __decorate([\n Property()\n ], Draggable.prototype, \"dragArea\", void 0);\n __decorate([\n Event()\n ], Draggable.prototype, \"drag\", void 0);\n __decorate([\n Event()\n ], Draggable.prototype, \"dragStart\", void 0);\n __decorate([\n Event()\n ], Draggable.prototype, \"dragStop\", void 0);\n __decorate([\n Property(1)\n ], Draggable.prototype, \"distance\", void 0);\n __decorate([\n Property()\n ], Draggable.prototype, \"handle\", void 0);\n __decorate([\n Property()\n ], Draggable.prototype, \"abort\", void 0);\n __decorate([\n Property()\n ], Draggable.prototype, \"helper\", void 0);\n __decorate([\n Property('default')\n ], Draggable.prototype, \"scope\", void 0);\n __decorate([\n Property('')\n ], Draggable.prototype, \"dragTarget\", void 0);\n __decorate([\n Property()\n ], Draggable.prototype, \"axis\", void 0);\n __decorate([\n Property()\n ], Draggable.prototype, \"queryPositionInfo\", void 0);\n __decorate([\n Property(false)\n ], Draggable.prototype, \"enableTailMode\", void 0);\n __decorate([\n Property(false)\n ], Draggable.prototype, \"skipDistanceCheck\", void 0);\n __decorate([\n Property(true)\n ], Draggable.prototype, \"preventDefault\", void 0);\n __decorate([\n Property(false)\n ], Draggable.prototype, \"enableAutoScroll\", void 0);\n Draggable = Draggable_1 = __decorate([\n NotifyPropertyChanges\n ], Draggable);\n return Draggable;\n var Draggable_1;\n}(Base));\nexport { Draggable };\n","import { createElement, attributes, addClass, removeClass, detach, classList, closest, isNullOrUndefined } from '@syncfusion/ej2-base';\nvar CLASSNAMES = {\n RTL: 'e-rtl',\n DISABLE: 'e-disabled',\n INPUT: 'e-input',\n INPUTGROUP: 'e-input-group',\n FLOATINPUT: 'e-float-input',\n FLOATLINE: 'e-float-line',\n FLOATTEXT: 'e-float-text',\n CLEARICON: 'e-clear-icon',\n CLEARICONHIDE: 'e-clear-icon-hide',\n LABELTOP: 'e-label-top',\n LABELBOTTOM: 'e-label-bottom',\n NOFLOATLABEL: 'e-no-float-label',\n INPUTCUSTOMTAG: 'e-input-custom-tag',\n FLOATCUSTOMTAG: 'e-float-custom-tag'\n};\n/**\n * Base for Input creation through util methods.\n */\nexport var Input;\n(function (Input) {\n var privateInputObj = {\n container: null,\n buttons: [],\n clearButton: null\n };\n /**\n * Create a wrapper to input element with multiple span elements and set the basic properties to input based components.\n * ```\n * E.g : Input.createInput({ element: element, floatLabelType : \"Auto\", properties: { placeholder: 'Search' } });\n * ```\n * @param args\n */\n function createInput(args) {\n var inputObject = { container: null, buttons: [], clearButton: null };\n if (isNullOrUndefined(args.floatLabelType) || args.floatLabelType === 'Never') {\n inputObject.container = createInputContainer(args, CLASSNAMES.INPUTGROUP, CLASSNAMES.INPUTCUSTOMTAG, 'span');\n args.element.parentNode.insertBefore(inputObject.container, args.element);\n addClass([args.element], CLASSNAMES.INPUT);\n inputObject.container.appendChild(args.element);\n }\n else {\n createFloatingInput(args, inputObject);\n }\n args.element.addEventListener('focus', function () {\n var parent = getParentNode(this);\n if (parent.classList.contains('e-input-group')) {\n parent.classList.add('e-input-focus');\n }\n });\n args.element.addEventListener('blur', function () {\n var parent = getParentNode(this);\n if (parent.classList.contains('e-input-group')) {\n parent.classList.remove('e-input-focus');\n }\n });\n if (!isNullOrUndefined(args.properties) && !isNullOrUndefined(args.properties.showClearButton) && args.properties.showClearButton) {\n setClearButton(args.properties.showClearButton, args.element, inputObject, true);\n if (inputObject.container.classList.contains(CLASSNAMES.FLOATINPUT)) {\n addClass([inputObject.container], CLASSNAMES.INPUTGROUP);\n }\n }\n if (!isNullOrUndefined(args.buttons)) {\n for (var i = 0; i < args.buttons.length; i++) {\n inputObject.buttons.push(appendSpan(args.buttons[i], inputObject.container));\n }\n }\n inputObject = setPropertyValue(args, inputObject);\n privateInputObj = inputObject;\n return inputObject;\n }\n Input.createInput = createInput;\n function _focusFn() {\n var label = getParentNode(this).getElementsByClassName('e-float-text')[0];\n addClass([label], CLASSNAMES.LABELTOP);\n if (label.classList.contains(CLASSNAMES.LABELBOTTOM)) {\n removeClass([label], CLASSNAMES.LABELBOTTOM);\n }\n }\n function _blurFn() {\n var parent = getParentNode(this);\n if (parent.getElementsByTagName('input')[0].value === '') {\n var label = parent.getElementsByClassName('e-float-text')[0];\n if (label.classList.contains(CLASSNAMES.LABELTOP)) {\n removeClass([label], CLASSNAMES.LABELTOP);\n }\n addClass([label], CLASSNAMES.LABELBOTTOM);\n }\n }\n function wireFloatingEvents(element) {\n element.addEventListener('focus', _focusFn);\n element.addEventListener('blur', _blurFn);\n }\n function unwireFloatingEvents(element) {\n element.removeEventListener('focus', _focusFn);\n element.removeEventListener('blur', _blurFn);\n }\n function createFloatingInput(args, inputObject) {\n var inputElement;\n var floatLinelement;\n var floatLabelElement;\n if (args.floatLabelType === 'Auto') {\n wireFloatingEvents(args.element);\n }\n if (isNullOrUndefined(inputObject.container)) {\n inputObject.container = createInputContainer(args, CLASSNAMES.FLOATINPUT, CLASSNAMES.FLOATCUSTOMTAG, 'div');\n args.element.parentNode.insertBefore(inputObject.container, args.element);\n }\n else {\n if (!isNullOrUndefined(args.customTag)) {\n inputObject.container.classList.add(CLASSNAMES.FLOATCUSTOMTAG);\n }\n inputObject.container.classList.add(CLASSNAMES.FLOATINPUT);\n }\n floatLinelement = createElement('span', { className: CLASSNAMES.FLOATLINE });\n floatLabelElement = createElement('label', { className: CLASSNAMES.FLOATTEXT });\n if (!isNullOrUndefined(args.element.id) && args.element.id !== '') {\n floatLabelElement.id = 'label_' + args.element.id.replace(/ /g, '_');\n attributes(args.element, { 'aria-labelledby': floatLabelElement.id });\n }\n if (!isNullOrUndefined(args.element.placeholder) && args.element.placeholder !== '') {\n floatLabelElement.innerHTML = args.element.placeholder;\n args.element.removeAttribute('placeholder');\n }\n if (!isNullOrUndefined(args.properties) && !isNullOrUndefined(args.properties.placeholder) &&\n args.properties.placeholder !== '') {\n floatLabelElement.innerHTML = args.properties.placeholder;\n }\n if (!floatLabelElement.innerHTML) {\n inputObject.container.classList.add(CLASSNAMES.NOFLOATLABEL);\n }\n inputObject.container.appendChild(args.element);\n inputObject.container.appendChild(floatLinelement);\n inputObject.container.appendChild(floatLabelElement);\n updateLabelState(args.element.value, floatLabelElement);\n if (args.floatLabelType === 'Always') {\n if (floatLabelElement.classList.contains(CLASSNAMES.LABELBOTTOM)) {\n removeClass([floatLabelElement], CLASSNAMES.LABELBOTTOM);\n }\n addClass([floatLabelElement], CLASSNAMES.LABELTOP);\n }\n if (args.floatLabelType === 'Auto') {\n args.element.addEventListener('input', function (event) {\n updateLabelState(args.element.value, floatLabelElement);\n });\n args.element.addEventListener('blur', function (event) {\n updateLabelState(args.element.value, floatLabelElement);\n });\n }\n }\n function setPropertyValue(args, inputObject) {\n if (!isNullOrUndefined(args.properties)) {\n for (var _i = 0, _a = Object.keys(args.properties); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'cssClass':\n setCssClass(args.properties.cssClass, [inputObject.container]);\n break;\n case 'enabled':\n setEnabled(args.properties.enabled, args.element);\n break;\n case 'enableRtl':\n setEnableRtl(args.properties.enableRtl, [inputObject.container]);\n break;\n case 'placeholder':\n setPlaceholder(args.properties.placeholder, args.element);\n break;\n case 'readonly':\n setReadonly(args.properties.readonly, args.element);\n break;\n }\n }\n }\n return inputObject;\n }\n function updateIconState(value, button) {\n if (value) {\n removeClass([button], CLASSNAMES.CLEARICONHIDE);\n }\n else {\n addClass([button], CLASSNAMES.CLEARICONHIDE);\n }\n }\n function updateLabelState(value, label) {\n if (value) {\n addClass([label], CLASSNAMES.LABELTOP);\n if (label.classList.contains(CLASSNAMES.LABELBOTTOM)) {\n removeClass([label], CLASSNAMES.LABELBOTTOM);\n }\n }\n else {\n if (label.classList.contains(CLASSNAMES.LABELTOP)) {\n removeClass([label], CLASSNAMES.LABELTOP);\n }\n addClass([label], CLASSNAMES.LABELBOTTOM);\n }\n }\n function getParentNode(element) {\n var parentNode = element.parentNode;\n return parentNode;\n }\n /**\n * To create clear button.\n */\n function createClearButton(element, inputObject, initial) {\n var button = createElement('span', { className: CLASSNAMES.CLEARICON });\n var container = inputObject.container;\n if (!isNullOrUndefined(initial)) {\n container.appendChild(button);\n }\n else {\n var baseElement = inputObject.container.classList.contains(CLASSNAMES.FLOATINPUT) ?\n inputObject.container.querySelector('.' + CLASSNAMES.FLOATTEXT) : element;\n baseElement.insertAdjacentElement('afterend', button);\n }\n if (!isNullOrUndefined(container) &&\n container.classList.contains(CLASSNAMES.FLOATINPUT)) {\n addClass([container], CLASSNAMES.INPUTGROUP);\n }\n addClass([button], CLASSNAMES.CLEARICONHIDE);\n wireClearBtnEvents(element, button, container);\n return button;\n }\n function wireClearBtnEvents(element, button, container) {\n button.addEventListener('click', function (event) {\n if (!(element.classList.contains(CLASSNAMES.DISABLE) || element.readOnly)) {\n event.preventDefault();\n if (element !== document.activeElement) {\n element.focus();\n }\n element.value = '';\n addClass([button], CLASSNAMES.CLEARICONHIDE);\n }\n });\n element.addEventListener('input', function (event) {\n updateIconState(element.value, button);\n });\n element.addEventListener('focus', function (event) {\n updateIconState(element.value, button);\n });\n element.addEventListener('blur', function (event) {\n setTimeout(function () { addClass([button], CLASSNAMES.CLEARICONHIDE); }, 200);\n });\n }\n function validateLabel(element, floatLabelType) {\n var parent = getParentNode(element);\n if (parent.classList.contains(CLASSNAMES.FLOATINPUT) && floatLabelType === 'Auto') {\n var label = getParentNode(element).getElementsByClassName('e-float-text')[0];\n updateLabelState(element.value, label);\n }\n }\n /**\n * To create input box contianer.\n */\n function createInputContainer(args, className, tagClass, tag) {\n var container;\n if (!isNullOrUndefined(args.customTag)) {\n container = createElement(args.customTag, { className: className });\n container.classList.add(tagClass);\n }\n else {\n container = createElement(tag, { className: className });\n }\n container.classList.add('e-control-wrapper');\n return container;\n }\n /**\n * Sets the value to the input element.\n * ```\n * E.g : Input.setValue('content', element, \"Auto\", true );\n * ```\n * @param value - Specify the value of the input element.\n * @param element - The element on which the specified value is updated.\n * @param floatLabelType - Specify the float label type of the input element.\n * @param clearButton - Boolean value to specify whether the clear icon is enabled / disabled on the input.\n */\n function setValue(value, element, floatLabelType, clearButton) {\n element.value = value;\n if ((!isNullOrUndefined(floatLabelType)) && floatLabelType === 'Auto') {\n validateLabel(element, floatLabelType);\n }\n if (!isNullOrUndefined(clearButton) && clearButton) {\n var parentElement = getParentNode(element);\n var button = parentElement.getElementsByClassName(CLASSNAMES.CLEARICON)[0];\n if (element.value && parentElement.classList.contains('e-input-focus')) {\n removeClass([button], CLASSNAMES.CLEARICONHIDE);\n }\n else {\n addClass([button], CLASSNAMES.CLEARICONHIDE);\n }\n }\n }\n Input.setValue = setValue;\n /**\n * Sets the single or multiple cssClass to wrapper of input element.\n * ```\n * E.g : Input.setCssClass('e-custom-class', [element]);\n * ```\n * @param cssClass - Css class names which are needed to add.\n * @param elements - The elements which are needed to add / remove classes.\n * @param oldClass - Css class names which are needed to remove. If old classes are need to remove, can give this optional parameter.\n */\n function setCssClass(cssClass, elements, oldClass) {\n if (!isNullOrUndefined(oldClass) && oldClass !== '') {\n removeClass(elements, oldClass);\n }\n if (!isNullOrUndefined(cssClass) && cssClass !== '') {\n addClass(elements, cssClass);\n }\n }\n Input.setCssClass = setCssClass;\n /**\n * Set the placeholder attribute to the input element.\n * ```\n * E.g : Input.setPlaceholder('Search here', element);\n * ```\n * @param placeholder - Placeholder value which is need to add.\n * @param element - The element on which the placeholder is need to add.\n */\n function setPlaceholder(placeholder, element) {\n var parentElement;\n parentElement = getParentNode(element);\n if (parentElement.classList.contains(CLASSNAMES.FLOATINPUT)) {\n if (!isNullOrUndefined(placeholder) && placeholder !== '') {\n parentElement.getElementsByClassName(CLASSNAMES.FLOATTEXT)[0].textContent = placeholder;\n parentElement.classList.remove(CLASSNAMES.NOFLOATLABEL);\n }\n else {\n parentElement.classList.add(CLASSNAMES.NOFLOATLABEL);\n parentElement.getElementsByClassName(CLASSNAMES.FLOATTEXT)[0].textContent = '';\n }\n }\n else {\n if (!isNullOrUndefined(placeholder) && placeholder !== '') {\n attributes(element, { 'placeholder': placeholder, 'aria-placeholder': placeholder });\n }\n else {\n element.removeAttribute('placeholder');\n element.removeAttribute('aria-placeholder');\n }\n }\n }\n Input.setPlaceholder = setPlaceholder;\n /**\n * Set the read only attribute to the input element\n * ```\n * E.g : Input.setReadonly(true, element);\n * ```\n * @param isReadonly\n * - Boolean value to specify whether to set read only. Setting \"True\" value enables read only.\n * @param element\n * - The element which is need to enable read only.\n */\n function setReadonly(isReadonly, element, floatLabelType) {\n if (isReadonly) {\n attributes(element, { readonly: '' });\n }\n else {\n element.removeAttribute('readonly');\n }\n if (!isNullOrUndefined(floatLabelType)) {\n validateLabel(element, floatLabelType);\n }\n }\n Input.setReadonly = setReadonly;\n /**\n * Displays the element direction from right to left when its enabled.\n * ```\n * E.g : Input.setEnableRtl(true, [inputObj.container]);\n * ```\n * @param isRtl\n * - Boolean value to specify whether to set RTL. Setting \"True\" value enables the RTL mode.\n * @param elements\n * - The elements that are needed to enable/disable RTL.\n */\n function setEnableRtl(isRtl, elements) {\n if (isRtl) {\n addClass(elements, CLASSNAMES.RTL);\n }\n else {\n removeClass(elements, CLASSNAMES.RTL);\n }\n }\n Input.setEnableRtl = setEnableRtl;\n /**\n * Enables or disables the given input element.\n * ```\n * E.g : Input.setEnabled(false, element);\n * ```\n * @param isEnable\n * - Boolean value to specify whether to enable or disable.\n * @param element\n * - Element to be enabled or disabled.\n */\n function setEnabled(isEnable, element, floatLabelType) {\n var disabledAttrs = { 'disabled': 'disabled', 'aria-disabled': 'true' };\n if (isEnable) {\n element.classList.remove(CLASSNAMES.DISABLE);\n removeAttributes(disabledAttrs, element);\n }\n else {\n element.classList.add(CLASSNAMES.DISABLE);\n addAttributes(disabledAttrs, element);\n }\n if (!isNullOrUndefined(floatLabelType)) {\n validateLabel(element, floatLabelType);\n }\n }\n Input.setEnabled = setEnabled;\n function setClearButton(isClear, element, inputObject, initial) {\n if (isClear) {\n inputObject.clearButton = createClearButton(element, inputObject, initial);\n }\n else {\n inputObject.clearButton.remove();\n inputObject.clearButton = null;\n }\n }\n Input.setClearButton = setClearButton;\n /**\n * Removing the multiple attributes from the given element such as \"disabled\",\"id\" , etc.\n * ```\n * E.g : Input.removeAttributes({ 'disabled': 'disabled', 'aria-disabled': 'true' }, element);\n * ```\n * @param attrs\n * - Array of attributes which are need to removed from the element.\n * @param element\n * - Element on which the attributes are needed to be removed.\n */\n function removeAttributes(attrs, element) {\n for (var _i = 0, _a = Object.keys(attrs); _i < _a.length; _i++) {\n var key = _a[_i];\n var parentElement = void 0;\n parentElement = getParentNode(element);\n if (key === 'disabled') {\n element.classList.remove(CLASSNAMES.DISABLE);\n }\n if (key === 'disabled' && parentElement.classList.contains(CLASSNAMES.INPUTGROUP)) {\n parentElement.classList.remove(CLASSNAMES.DISABLE);\n }\n if (key === 'placeholder' && parentElement.classList.contains(CLASSNAMES.FLOATINPUT)) {\n parentElement.getElementsByClassName(CLASSNAMES.FLOATTEXT)[0].textContent = '';\n }\n else {\n element.removeAttribute(key);\n }\n }\n }\n Input.removeAttributes = removeAttributes;\n /**\n * Adding the multiple attributes to the given element such as \"disabled\",\"id\" , etc.\n * ```\n * E.g : Input.addAttributes({ 'id': 'inputpopup' }, element);\n * ```\n * @param attrs\n * - Array of attributes which is added to element.\n * @param element\n * - Element on which the attributes are needed to be added.\n */\n function addAttributes(attrs, element) {\n for (var _i = 0, _a = Object.keys(attrs); _i < _a.length; _i++) {\n var key = _a[_i];\n var parentElement = void 0;\n parentElement = getParentNode(element);\n if (key === 'disabled') {\n element.classList.add(CLASSNAMES.DISABLE);\n }\n if (key === 'disabled' && parentElement.classList.contains(CLASSNAMES.INPUTGROUP)) {\n parentElement.classList.add(CLASSNAMES.DISABLE);\n }\n if (key === 'placeholder' && parentElement.classList.contains(CLASSNAMES.FLOATINPUT)) {\n parentElement.getElementsByClassName(CLASSNAMES.FLOATTEXT)[0].textContent = attrs[key];\n }\n else {\n element.setAttribute(key, attrs[key]);\n }\n }\n }\n Input.addAttributes = addAttributes;\n function removeFloating(input) {\n var container = input.container;\n if (!isNullOrUndefined(container) && container.classList.contains(CLASSNAMES.FLOATINPUT)) {\n var inputEle = container.querySelector('input');\n var placeholder = container.querySelector('.' + CLASSNAMES.FLOATTEXT).textContent;\n var clearButton = container.querySelector('.e-clear-icon') !== null;\n detach(container.querySelector('.' + CLASSNAMES.FLOATLINE));\n detach(container.querySelector('.' + CLASSNAMES.FLOATTEXT));\n classList(container, [CLASSNAMES.INPUTGROUP], [CLASSNAMES.FLOATINPUT]);\n unwireFloatingEvents(inputEle);\n attributes(inputEle, { 'placeholder': placeholder });\n inputEle.classList.add(CLASSNAMES.INPUT);\n if (!clearButton) {\n inputEle.removeAttribute('required');\n }\n }\n }\n Input.removeFloating = removeFloating;\n function addFloating(input, type, placeholder) {\n var container = closest(input, '.' + CLASSNAMES.INPUTGROUP);\n if (type !== 'Never') {\n var customTag = container.tagName;\n customTag = customTag !== 'DIV' && customTag !== 'SPAN' ? customTag : null;\n var args = { element: input, floatLabelType: type, customTag: customTag, properties: { placeholder: placeholder } };\n var iconEle = container.querySelector('.e-clear-icon');\n var inputObj = { container: container };\n input.classList.remove(CLASSNAMES.INPUT);\n createFloatingInput(args, inputObj);\n if (isNullOrUndefined(iconEle)) {\n iconEle = container.querySelector('.e-input-group-icon');\n }\n if (isNullOrUndefined(iconEle)) {\n container.classList.remove(CLASSNAMES.INPUTGROUP);\n }\n else {\n var floatLine = container.querySelector('.' + CLASSNAMES.FLOATLINE);\n var floatText = container.querySelector('.' + CLASSNAMES.FLOATTEXT);\n container.insertBefore(input, iconEle);\n container.insertBefore(floatLine, iconEle);\n container.insertBefore(floatText, iconEle);\n }\n }\n }\n Input.addFloating = addFloating;\n /**\n * Enable or Disable the ripple effect on the icons inside the Input. Ripple effect is only applicable for material theme.\n * ```\n * E.g : Input.setRipple(true, [inputObjects]);\n * ```\n * @param isRipple\n * - Boolean value to specify whether to enable the ripple effect.\n * @param inputObject\n * - Specify the collection of input objects.\n */\n function setRipple(isRipple, inputObj) {\n for (var i = 0; i < inputObj.length; i++) {\n _internalRipple(isRipple, inputObj[i].container);\n }\n }\n Input.setRipple = setRipple;\n function _internalRipple(isRipple, container, button) {\n var argsButton = [];\n argsButton.push(button);\n var buttons = isNullOrUndefined(button) ?\n container.querySelectorAll('.e-input-group-icon') : argsButton;\n if (isRipple && buttons.length > 0) {\n for (var index = 0; index < buttons.length; index++) {\n buttons[index].addEventListener('mousedown', _onMouseDownRipple, false);\n buttons[index].addEventListener('mouseup', _onMouseUpRipple, false);\n }\n }\n else if (buttons.length > 0) {\n for (var index = 0; index < buttons.length; index++) {\n buttons[index].removeEventListener('mousedown', _onMouseDownRipple, this);\n buttons[index].removeEventListener('mouseup', _onMouseUpRipple, this);\n }\n }\n }\n function _onMouseRipple(container, button) {\n if (!container.classList.contains('e-disabled') && !container.querySelector('input').readOnly) {\n button.classList.add('e-input-btn-ripple');\n }\n }\n function _onMouseDownRipple() {\n var ele = this;\n var parentEle = this.parentElement;\n while (!parentEle.classList.contains('e-input-group')) {\n parentEle = parentEle.parentElement;\n }\n _onMouseRipple(parentEle, ele);\n }\n function _onMouseUpRipple() {\n var ele = this;\n setTimeout(function () { ele.classList.remove('e-input-btn-ripple'); }, 500);\n }\n /**\n * Creates a new span element with the given icons added and append it in container element.\n * ```\n * E.g : Input.appendSpan('e-icon-spin', inputObj.container);\n * ```\n * @param iconClass - Icon classes which are need to add to the span element which is going to created.\n * Span element acts as icon or button element for input.\n * @param container - The container on which created span element is going to append.\n */\n function appendSpan(iconClass, container) {\n var button = createElement('span', { className: iconClass });\n button.classList.add('e-input-group-icon');\n container.appendChild(button);\n if (!container.classList.contains(CLASSNAMES.INPUTGROUP)) {\n container.classList.add(CLASSNAMES.INPUTGROUP);\n }\n _internalRipple(true, container, button);\n return button;\n }\n Input.appendSpan = appendSpan;\n})(Input || (Input = {}));\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Base } from './base';\nimport { Browser } from './browser';\nimport { isVisible, matches } from './dom';\nimport { Property, NotifyPropertyChanges, Event } from './notify-property-change';\nimport { EventHandler } from './event-handler';\nimport { compareElementParent } from './util';\n/**\n * Droppable Module provides support to enable droppable functionality in Dom Elements.\n * ```html\n *
Droppable
\n * \n * ```\n */\nvar Droppable = /** @class */ (function (_super) {\n __extends(Droppable, _super);\n function Droppable(element, options) {\n var _this = _super.call(this, options, element) || this;\n _this.mouseOver = false;\n _this.dragData = {};\n _this.dragStopCalled = false;\n _this.bind();\n return _this;\n }\n Droppable.prototype.bind = function () {\n this.wireEvents();\n };\n Droppable.prototype.wireEvents = function () {\n EventHandler.add(this.element, Browser.touchEndEvent, this.intDrop, this);\n };\n // triggers when property changed\n Droppable.prototype.onPropertyChanged = function (newProp, oldProp) {\n //No Code to handle\n };\n Droppable.prototype.getModuleName = function () {\n return 'droppable';\n };\n Droppable.prototype.intOver = function (event, element) {\n if (!this.mouseOver) {\n var drag = this.dragData[this.scope];\n this.trigger('over', { event: event, target: element, dragData: drag });\n this.mouseOver = true;\n }\n };\n Droppable.prototype.intOut = function (event, element) {\n if (this.mouseOver) {\n this.trigger('out', { evt: event, target: element });\n this.mouseOver = false;\n }\n };\n Droppable.prototype.intDrop = function (evt, element) {\n if (!this.dragStopCalled) {\n return;\n }\n else {\n this.dragStopCalled = false;\n }\n var accept = true;\n var drag = this.dragData[this.scope];\n var isDrag = drag ? (drag.helper && isVisible(drag.helper)) : false;\n var area;\n if (isDrag) {\n area = this.isDropArea(evt, drag.helper, element);\n if (this.accept) {\n accept = matches(drag.helper, this.accept);\n }\n }\n if (isDrag && this.drop && area.canDrop && accept) {\n this.trigger('drop', { event: evt, target: area.target, droppedElement: drag.helper, dragData: drag });\n }\n this.mouseOver = false;\n };\n Droppable.prototype.isDropArea = function (evt, helper, element) {\n var area = { canDrop: true, target: element || evt.target };\n var isTouch = evt.type === 'touchend';\n if (isTouch || area.target === helper) {\n helper.style.display = 'none';\n var coord = isTouch ? (evt.changedTouches[0]) : evt;\n var ele = document.elementFromPoint(coord.clientX, coord.clientY);\n area.canDrop = false;\n area.canDrop = compareElementParent(ele, this.element);\n if (area.canDrop) {\n area.target = ele;\n }\n helper.style.display = '';\n }\n return area;\n };\n Droppable.prototype.destroy = function () {\n EventHandler.remove(this.element, Browser.touchEndEvent, this.intDrop);\n _super.prototype.destroy.call(this);\n };\n __decorate([\n Property()\n ], Droppable.prototype, \"accept\", void 0);\n __decorate([\n Property('default')\n ], Droppable.prototype, \"scope\", void 0);\n __decorate([\n Event()\n ], Droppable.prototype, \"drop\", void 0);\n __decorate([\n Event()\n ], Droppable.prototype, \"over\", void 0);\n __decorate([\n Event()\n ], Droppable.prototype, \"out\", void 0);\n Droppable = __decorate([\n NotifyPropertyChanges\n ], Droppable);\n return Droppable;\n}(Base));\nexport { Droppable };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Property, NotifyPropertyChanges, Event } from './notify-property-change';\nimport { Base } from './base';\nvar keyCode = {\n 'backspace': 8,\n 'tab': 9,\n 'enter': 13,\n 'shift': 16,\n 'control': 17,\n 'alt': 18,\n 'pause': 19,\n 'capslock': 20,\n 'space': 32,\n 'escape': 27,\n 'pageup': 33,\n 'pagedown': 34,\n 'end': 35,\n 'home': 36,\n 'leftarrow': 37,\n 'uparrow': 38,\n 'rightarrow': 39,\n 'downarrow': 40,\n 'insert': 45,\n 'delete': 46,\n 'f1': 112,\n 'f2': 113,\n 'f3': 114,\n 'f4': 115,\n 'f5': 116,\n 'f6': 117,\n 'f7': 118,\n 'f8': 119,\n 'f9': 120,\n 'f10': 121,\n 'f11': 122,\n 'f12': 123,\n 'semicolon': 186,\n 'plus': 187,\n 'comma': 188,\n 'minus': 189,\n 'dot': 190,\n 'forwardslash': 191,\n 'graveaccent': 192,\n 'openbracket': 219,\n 'backslash': 220,\n 'closebracket': 221,\n 'singlequote': 222\n};\n/**\n * KeyboardEvents class enables you to bind key action desired key combinations for ex., Ctrl+A, Delete, Alt+Space etc.\n * ```html\n *
;\n * \n * ```\n */\nvar KeyboardEvents = /** @class */ (function (_super) {\n __extends(KeyboardEvents, _super);\n /**\n * Initializes the KeyboardEvents\n * @param {HTMLElement} element\n * @param {KeyboardEventsModel} options\n */\n function KeyboardEvents(element, options) {\n var _this = _super.call(this, options, element) || this;\n /**\n * To handle a key press event returns null\n */\n _this.keyPressHandler = function (e) {\n var isAltKey = e.altKey;\n var isCtrlKey = e.ctrlKey;\n var isShiftKey = e.shiftKey;\n var curkeyCode = e.which;\n var keys = Object.keys(_this.keyConfigs);\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n var configCollection = _this.keyConfigs[key].split(',');\n for (var _a = 0, configCollection_1 = configCollection; _a < configCollection_1.length; _a++) {\n var rconfig = configCollection_1[_a];\n var rKeyObj = KeyboardEvents_1.getKeyConfigData(rconfig.trim());\n if (isAltKey === rKeyObj.altKey && isCtrlKey === rKeyObj.ctrlKey &&\n isShiftKey === rKeyObj.shiftKey && curkeyCode === rKeyObj.keyCode) {\n e.action = key;\n if (_this.keyAction) {\n _this.keyAction(e);\n }\n }\n }\n }\n };\n _this.bind();\n return _this;\n }\n KeyboardEvents_1 = KeyboardEvents;\n /**\n * Unwire bound events and destroy the instance.\n * @return {void}\n */\n KeyboardEvents.prototype.destroy = function () {\n this.unwireEvents();\n _super.prototype.destroy.call(this);\n };\n /**\n * Function can be used to specify certain action if a property is changed\n * @param newProp\n * @param oldProp\n * @returns {void}\n * @private\n */\n KeyboardEvents.prototype.onPropertyChanged = function (newProp, oldProp) {\n // No code are needed\n };\n ;\n KeyboardEvents.prototype.bind = function () {\n this.wireEvents();\n };\n /**\n * To get the module name, returns 'keyboard'.\n * @private\n */\n KeyboardEvents.prototype.getModuleName = function () {\n return 'keyboard';\n };\n /**\n * Wiring event handlers to events\n */\n KeyboardEvents.prototype.wireEvents = function () {\n this.element.addEventListener(this.eventName, this.keyPressHandler);\n };\n /**\n * Unwiring event handlers to events\n */\n KeyboardEvents.prototype.unwireEvents = function () {\n this.element.removeEventListener(this.eventName, this.keyPressHandler);\n };\n /**\n * To get the key configuration data\n * @param {string} config - configuration data\n * returns {KeyData}\n */\n KeyboardEvents.getKeyConfigData = function (config) {\n if (config in this.configCache) {\n return this.configCache[config];\n }\n var keys = config.toLowerCase().split('+');\n var keyData = {\n altKey: (keys.indexOf('alt') !== -1 ? true : false),\n ctrlKey: (keys.indexOf('ctrl') !== -1 ? true : false),\n shiftKey: (keys.indexOf('shift') !== -1 ? true : false),\n keyCode: null\n };\n if (keys[keys.length - 1].length > 1 && !!Number(keys[keys.length - 1])) {\n keyData.keyCode = Number(keys[keys.length - 1]);\n }\n else {\n keyData.keyCode = KeyboardEvents_1.getKeyCode(keys[keys.length - 1]);\n }\n KeyboardEvents_1.configCache[config] = keyData;\n return keyData;\n };\n // Return the keycode value as string \n KeyboardEvents.getKeyCode = function (keyVal) {\n return keyCode[keyVal] || keyVal.toUpperCase().charCodeAt(0);\n };\n KeyboardEvents.configCache = {};\n __decorate([\n Property({})\n ], KeyboardEvents.prototype, \"keyConfigs\", void 0);\n __decorate([\n Property('keyup')\n ], KeyboardEvents.prototype, \"eventName\", void 0);\n __decorate([\n Event()\n ], KeyboardEvents.prototype, \"keyAction\", void 0);\n KeyboardEvents = KeyboardEvents_1 = __decorate([\n NotifyPropertyChanges\n ], KeyboardEvents);\n return KeyboardEvents;\n var KeyboardEvents_1;\n}(Base));\nexport { KeyboardEvents };\n","import { extend } from './util';\nimport { defaultCulture } from './internationalization';\n/**\n * L10n modules provides localized text for different culture.\n * ```typescript\n * import {setCulture} from '@syncfusion/ts-base-library';\n * //load global locale object common for all components.\n * L10n.load({\n * 'fr-BE': {\n * 'button': {\n * 'check': 'vérifié'\n * }\n * }\n * });\n * //set globale default locale culture.\n * setCulture('fr-BE');\n * let instance: L10n = new L10n('button', {\n * check: 'checked'\n * });\n * //Get locale text for current property.\n * instance.getConstant('check');\n * //Change locale culture in a component.\n * instance.setLocale('en-US');\n * ```\n */\nvar L10n = /** @class */ (function () {\n /**\n * Constructor\n */\n function L10n(controlName, localeStrings, locale) {\n this.controlName = controlName;\n this.localeStrings = localeStrings;\n this.setLocale(locale || defaultCulture);\n }\n /**\n * Sets the locale text\n * @param {string} locale\n * @returns {void}\n */\n L10n.prototype.setLocale = function (locale) {\n var intLocale = this.intGetControlConstant(L10n.locale, locale);\n this.currentLocale = intLocale || this.localeStrings;\n };\n /**\n * Sets the global locale for all components.\n * @param {Object} localeObject - specifies the localeObject to be set as global locale.\n */\n L10n.load = function (localeObject) {\n this.locale = extend(this.locale, localeObject, {}, true);\n };\n /**\n * Returns current locale text for the property based on the culture name and control name.\n * @param {string} propertyName - specifies the property for which localize text to be returned.\n * @return string\n */\n L10n.prototype.getConstant = function (prop) {\n /* tslint:disable no-any */\n return this.currentLocale[prop] || this.localeStrings[prop] || '';\n };\n /**\n * Returns the control constant object for current object and the locale specified.\n * @param {Object} curObject\n * @param {string} locale\n * @returns {Object}\n */\n L10n.prototype.intGetControlConstant = function (curObject, locale) {\n if (curObject[locale]) {\n return curObject[locale][this.controlName];\n }\n return null;\n };\n L10n.locale = {};\n return L10n;\n}());\nexport { L10n };\n","/**\n * To import utils\n */\nimport { isNullOrUndefined, } from './util';\nvar SvgRenderer = /** @class */ (function () {\n /* End-Properties */\n function SvgRenderer(rootID) {\n //Internal Variables \n this.svgLink = 'http://www.w3.org/2000/svg';\n this.rootId = rootID;\n }\n // method to get the attributes value\n /* tslint:disable */\n SvgRenderer.prototype.getOptionValue = function (options, key) {\n return options[key];\n }; /* tslint:enable */\n /**\n * To create a Html5 SVG element\n * @param {SVGAttributes} options - Options to create SVG\n * @return {Element}\n */\n SvgRenderer.prototype.createSvg = function (options) {\n if (isNullOrUndefined(options.id)) {\n options.id = this.rootId + '_svg';\n }\n this.svgObj = document.getElementById(options.id);\n if (isNullOrUndefined(document.getElementById(options.id))) {\n this.svgObj = document.createElementNS(this.svgLink, 'svg');\n }\n this.svgObj = this.setElementAttributes(options, this.svgObj);\n this.setSVGSize(options.width, options.height);\n return this.svgObj;\n };\n // method to set the height and width for the SVG element\n SvgRenderer.prototype.setSVGSize = function (width, height) {\n var element = document.getElementById(this.rootId);\n var size = !isNullOrUndefined(element) ? element.getBoundingClientRect() : null;\n if (isNullOrUndefined(this.width) || this.width <= 0) {\n this.svgObj.setAttribute('width', width ? width.toString() : size.width.toString());\n }\n else {\n this.svgObj.setAttribute('width', this.width.toString());\n }\n if (isNullOrUndefined(this.height) || this.height <= 0) {\n this.svgObj.setAttribute('height', height ? height.toString() : '450');\n }\n else {\n this.svgObj.setAttribute('height', this.height.toString());\n }\n };\n /**\n * To draw a path\n * @param {PathAttributes} options - Options to draw a path in SVG\n * @return {Element}\n */\n SvgRenderer.prototype.drawPath = function (options) {\n var path = document.getElementById(options.id);\n if (path === null) {\n path = document.createElementNS(this.svgLink, 'path');\n }\n path = this.setElementAttributes(options, path);\n return path;\n };\n /**\n * To draw a line\n * @param {LineAttributes} options - Options to draw a line in SVG\n * @return {Element}\n */\n SvgRenderer.prototype.drawLine = function (options) {\n var line = document.getElementById(options.id);\n if (line === null) {\n line = document.createElementNS(this.svgLink, 'line');\n }\n line = this.setElementAttributes(options, line);\n return line;\n };\n /**\n * To draw a rectangle\n * @param {BaseAttibutes} options - Required options to draw a rectangle in SVG\n * @return {Element}\n */\n SvgRenderer.prototype.drawRectangle = function (options) {\n var rectangle = document.getElementById(options.id);\n if (rectangle === null) {\n rectangle = document.createElementNS(this.svgLink, 'rect');\n }\n rectangle = this.setElementAttributes(options, rectangle);\n return rectangle;\n };\n /**\n * To draw a circle\n * @param {CircleAttributes} options - Required options to draw a circle in SVG\n * @return {Element}\n */\n SvgRenderer.prototype.drawCircle = function (options) {\n var circle = document.getElementById(options.id);\n if (circle === null) {\n circle = document.createElementNS(this.svgLink, 'circle');\n }\n circle = this.setElementAttributes(options, circle);\n return circle;\n };\n /**\n * To draw a polyline\n * @param {PolylineAttributes} options - Options required to draw a polyline\n * @return {Element}\n */\n SvgRenderer.prototype.drawPolyline = function (options) {\n var polyline = document.getElementById(options.id);\n if (polyline === null) {\n polyline = document.createElementNS(this.svgLink, 'polyline');\n }\n polyline = this.setElementAttributes(options, polyline);\n return polyline;\n };\n /**\n * To draw an ellipse\n * @param {EllipseAttributes} options - Options required to draw an ellipse\n * @return {Element}\n */\n SvgRenderer.prototype.drawEllipse = function (options) {\n var ellipse = document.getElementById(options.id);\n if (ellipse === null) {\n ellipse = document.createElementNS(this.svgLink, 'ellipse');\n }\n ellipse = this.setElementAttributes(options, ellipse);\n return ellipse;\n };\n /**\n * To draw a polygon\n * @param {PolylineAttributes} options - Options needed to draw a polygon in SVG\n * @return {Element}\n */\n SvgRenderer.prototype.drawPolygon = function (options) {\n var polygon = document.getElementById(options.id);\n if (polygon === null) {\n polygon = document.createElementNS(this.svgLink, 'polygon');\n }\n polygon = this.setElementAttributes(options, polygon);\n return polygon;\n };\n /**\n * To draw an image\n * @param {ImageAttributes} options - Required options to draw an image in SVG\n * @return {Element}\n */\n SvgRenderer.prototype.drawImage = function (options) {\n var img = document.createElementNS(this.svgLink, 'image');\n img.setAttributeNS(null, 'height', options.height.toString());\n img.setAttributeNS(null, 'width', options.width.toString());\n img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', options.href);\n img.setAttributeNS(null, 'x', options.x.toString());\n img.setAttributeNS(null, 'y', options.y.toString());\n img.setAttributeNS(null, 'id', options.id);\n img.setAttributeNS(null, 'visibility', options.visibility);\n if (!isNullOrUndefined(this.getOptionValue(options, 'clip-path'))) {\n img.setAttributeNS(null, 'clip-path', this.getOptionValue(options, 'clip-path'));\n }\n if (!isNullOrUndefined(options.preserveAspectRatio)) {\n img.setAttributeNS(null, 'preserveAspectRatio', options.preserveAspectRatio);\n }\n return img;\n };\n /**\n * To draw a text\n * @param {TextAttributes} options - Options needed to draw a text in SVG\n * @return {Element}\n */\n SvgRenderer.prototype.createText = function (options, label) {\n var text = document.createElementNS(this.svgLink, 'text');\n text = this.setElementAttributes(options, text);\n if (!isNullOrUndefined(label)) {\n text.textContent = label;\n }\n return text;\n };\n /**\n * To create a tSpan\n * @param {TextAttributes} options - Options to create tSpan\n * @param {string} label - The text content which is to be rendered in the tSpan\n * @return {Element}\n */\n SvgRenderer.prototype.createTSpan = function (options, label) {\n var tSpan = document.createElementNS(this.svgLink, 'tspan');\n tSpan = this.setElementAttributes(options, tSpan);\n if (!isNullOrUndefined(label)) {\n tSpan.textContent = label;\n }\n return tSpan;\n };\n /**\n * To create a title\n * @param {string} text - The text content which is to be rendered in the title\n * @return {Element}\n */\n SvgRenderer.prototype.createTitle = function (text) {\n var title = document.createElementNS(this.svgLink, 'title');\n title.textContent = text;\n return title;\n };\n /**\n * To create defs element in SVG\n * @return {Element}\n */\n SvgRenderer.prototype.createDefs = function () {\n var defs = document.createElementNS(this.svgLink, 'defs');\n return defs;\n };\n /**\n * To create clip path in SVG\n * @param {BaseAttibutes} options - Options needed to create clip path\n * @return {Element}\n */\n SvgRenderer.prototype.createClipPath = function (options) {\n var clipPath = document.createElementNS(this.svgLink, 'clipPath');\n clipPath = this.setElementAttributes(options, clipPath);\n return clipPath;\n };\n /**\n * To create foreign object in SVG\n * @param {BaseAttibutes} options - Options needed to create foreign object\n * @return {Element}\n */\n SvgRenderer.prototype.createForeignObject = function (options) {\n var foreignObject = document.createElementNS(this.svgLink, 'foreignObject');\n foreignObject = this.setElementAttributes(options, foreignObject);\n return foreignObject;\n };\n /**\n * To create group element in SVG\n * @param {BaseAttibutes} options - Options needed to create group\n * @return {Element}\n */\n SvgRenderer.prototype.createGroup = function (options) {\n var group = document.createElementNS(this.svgLink, 'g');\n group = this.setElementAttributes(options, group);\n return group;\n };\n /**\n * To create pattern in SVG\n * @param {PatternAttributes} options - Required options to create pattern in SVG\n * @param {string} type - Specifies the name of the pattern\n * @return {Element}\n */\n SvgRenderer.prototype.createPattern = function (options, element) {\n var pattern = document.createElementNS(this.svgLink, element);\n pattern = this.setElementAttributes(options, pattern);\n return pattern;\n };\n /**\n * To create radial gradient in SVG\n * @param {string[]} colors - Specifies the colors required to create radial gradient\n * @param {string[]} colorStop - Specifies the colorstop required to create radial gradient\n * @param {string} name - Specifies the name of the gradient\n * @param {RadialGradient} options - value for radial gradient\n * @return {string}\n */\n SvgRenderer.prototype.createRadialGradient = function (colors, name, options) {\n var colorName;\n if (!isNullOrUndefined(colors[0].colorStop)) {\n var newOptions = {\n 'id': this.rootId + '_' + name + 'radialGradient',\n 'cx': options.cx + '%',\n 'cy': options.cy + '%',\n 'r': options.r + '%',\n 'fx': options.fx + '%',\n 'fy': options.fy + '%'\n };\n this.drawGradient('radialGradient', newOptions, colors);\n colorName = 'url(#' + this.rootId + '_' + name + 'radialGradient)';\n }\n else {\n colorName = colors[0].color.toString();\n }\n return colorName;\n };\n /**\n * To create linear gradient in SVG\n * @param {string[]} colors - Array of string specifies the values for color\n * @param {string[]} colors - Array of string specifies the values for colorStop\n * @param {string} name - Specifies the name of the gradient\n * @param {LinearGradient} options - Specifies the options for gradient\n * @return {string}\n */\n SvgRenderer.prototype.createLinearGradient = function (colors, name, options) {\n var colorName;\n if (!isNullOrUndefined(colors[0].colorStop)) {\n var newOptions = {\n 'id': this.rootId + '_' + name + 'linearGradient',\n 'x1': options.x1 + '%',\n 'y1': options.y1 + '%',\n 'x2': options.x2 + '%',\n 'y2': options.y2 + '%'\n };\n this.drawGradient('linearGradient', newOptions, colors);\n colorName = 'url(#' + this.rootId + '_' + name + 'linearGradient)';\n }\n else {\n colorName = colors[0].color.toString();\n }\n return colorName;\n };\n /**\n * To render the gradient element in SVG\n * @param {string} gradientType - Specifies the type of the gradient\n * @param {RadialGradient | LinearGradient} options - Options required to render a gradient\n * @param {string[]} colors - Array of string specifies the values for color\n * @param {string[]} colorStop - Array of string specifies the values for colorStop\n * @return {Element}\n */\n SvgRenderer.prototype.drawGradient = function (gradientType, options, colors) {\n var defs = this.createDefs();\n var gradient = document.createElementNS(this.svgLink, gradientType);\n gradient = this.setElementAttributes(options, gradient);\n for (var i = 0; i < colors.length; i++) {\n var stop_1 = document.createElementNS(this.svgLink, 'stop');\n stop_1.setAttribute('offset', colors[i].colorStop);\n stop_1.setAttribute('stop-color', colors[i].color);\n stop_1.setAttribute('stop-opacity', '1');\n gradient.appendChild(stop_1);\n }\n defs.appendChild(gradient);\n return defs;\n };\n /**\n * To render a clip path\n * @param {BaseAttibutes} options - Options required to render a clip path\n * @return {Element}\n */\n SvgRenderer.prototype.drawClipPath = function (options) {\n var defs = this.createDefs();\n var clipPath = this.createClipPath({ 'id': options.id });\n var rect = this.drawRectangle(options);\n clipPath.appendChild(rect);\n defs.appendChild(clipPath);\n return defs;\n };\n /**\n * To create circular clip path in SVG\n * @param {CircleAttributes} options - Options required to create circular clip path\n * @return {Element}\n */\n SvgRenderer.prototype.drawCircularClipPath = function (options) {\n var defs = this.createDefs();\n var clipPath = this.createClipPath({ 'id': options.id });\n var circle = this.drawCircle(options);\n clipPath.appendChild(circle);\n defs.appendChild(clipPath);\n return defs;\n };\n /**\n * To set the attributes to the element\n * @param {SVGCanvasAttributes} options - Attributes to set for the element\n * @param {Element} element - The element to which the attributes need to be set\n * @return {Element}\n */\n SvgRenderer.prototype.setElementAttributes = function (options, element) {\n var keys = Object.keys(options);\n for (var i = 0; i < keys.length; i++) {\n element.setAttribute(keys[i], options[keys[i]]);\n }\n return element;\n };\n return SvgRenderer;\n}());\nexport { SvgRenderer };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { extend } from './util';\nimport { Property, Complex, NotifyPropertyChanges, Event } from './notify-property-change';\nimport { Browser } from './browser';\nimport { Base } from './base';\nimport { ChildProperty } from './child-property';\nimport { EventHandler } from './event-handler';\n/**\n * SwipeSettings is a framework module that provides support to handle swipe event like swipe up, swipe right, etc..,\n * @private\n */\nvar SwipeSettings = /** @class */ (function (_super) {\n __extends(SwipeSettings, _super);\n function SwipeSettings() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property(50)\n ], SwipeSettings.prototype, \"swipeThresholdDistance\", void 0);\n return SwipeSettings;\n}(ChildProperty));\nexport { SwipeSettings };\nvar swipeRegex = /(Up|Down)/;\n/**\n * Touch class provides support to handle the touch event like tap, double tap, tap hold, etc..,\n * ```typescript\n * let node: HTMLElement;\n * let touchObj: Touch = new Touch({\n * element: node,\n * tap: function (e) {\n * // tap handler function code\n * }\n * tapHold: function (e) {\n * // tap hold handler function code\n * }\n * scroll: function (e) {\n * // scroll handler function code\n * }\n * swipe: function (e) {\n * // swipe handler function code\n * }\n * });\n * ```\n */\nvar Touch = /** @class */ (function (_super) {\n __extends(Touch, _super);\n /* End-Properties */\n function Touch(element, options) {\n var _this = _super.call(this, options, element) || this;\n _this.touchAction = true;\n _this.tapCount = 0;\n _this.startEvent = function (evt) {\n if (_this.touchAction === true) {\n var point = (evt.changedTouches ? evt.changedTouches[0] : evt);\n if (evt.changedTouches !== undefined) {\n _this.touchAction = false;\n }\n _this.isTouchMoved = false;\n _this.movedDirection = '';\n _this.startPoint = _this.lastMovedPoint = { clientX: point.clientX, clientY: point.clientY };\n _this.startEventData = point;\n _this.hScrollLocked = _this.vScrollLocked = false;\n _this.tStampStart = Date.now();\n _this.timeOutTapHold = setTimeout(function () { _this.tapHoldEvent(evt); }, _this.tapHoldThreshold);\n EventHandler.add(_this.element, Browser.touchMoveEvent, _this.moveEvent, _this);\n EventHandler.add(_this.element, Browser.touchEndEvent, _this.endEvent, _this);\n EventHandler.add(_this.element, Browser.touchCancelEvent, _this.cancelEvent, _this);\n }\n };\n _this.moveEvent = function (evt) {\n var point = evt.changedTouches ? evt.changedTouches[0] : evt;\n _this.movedPoint = point;\n _this.isTouchMoved = !(point.clientX === _this.startPoint.clientX && point.clientY === _this.startPoint.clientY);\n var eScrollArgs = {};\n if (_this.isTouchMoved) {\n clearTimeout(_this.timeOutTapHold);\n _this.calcScrollPoints(evt);\n var scrollArg = {\n startEvents: _this.startEventData,\n originalEvent: evt, startX: _this.startPoint.clientX,\n startY: _this.startPoint.clientY, distanceX: _this.distanceX,\n distanceY: _this.distanceY, scrollDirection: _this.scrollDirection,\n velocity: _this.getVelocity(point)\n };\n eScrollArgs = extend(eScrollArgs, {}, scrollArg);\n _this.trigger('scroll', eScrollArgs);\n _this.lastMovedPoint = { clientX: point.clientX, clientY: point.clientY };\n }\n };\n _this.cancelEvent = function (evt) {\n clearTimeout(_this.timeOutTapHold);\n clearTimeout(_this.timeOutTap);\n _this.tapCount = 0;\n _this.swipeFn(evt);\n EventHandler.remove(_this.element, Browser.touchCancelEvent, _this.cancelEvent);\n };\n _this.endEvent = function (evt) {\n _this.swipeFn(evt);\n if (!_this.isTouchMoved) {\n if (typeof _this.tap === 'function') {\n _this.trigger('tap', { originalEvent: evt, tapCount: ++_this.tapCount });\n _this.timeOutTap = setTimeout(function () {\n _this.tapCount = 0;\n }, _this.tapThreshold);\n }\n }\n _this.modeclear();\n };\n _this.swipeFn = function (evt) {\n clearTimeout(_this.timeOutTapHold);\n clearTimeout(_this.timeOutTap);\n var point = evt;\n if (evt.changedTouches) {\n point = evt.changedTouches[0];\n }\n var diffX = point.clientX - _this.startPoint.clientX;\n var diffY = point.clientY - _this.startPoint.clientY;\n diffX = Math.floor(diffX < 0 ? -1 * diffX : diffX);\n diffY = Math.floor(diffY < 0 ? -1 * diffY : diffX);\n _this.isTouchMoved = diffX > 1 || diffY > 1;\n _this.endPoint = point;\n _this.calcPoints(evt);\n var swipeArgs = {\n originalEvent: evt,\n startEvents: _this.startEventData,\n startX: _this.startPoint.clientX,\n startY: _this.startPoint.clientY,\n distanceX: _this.distanceX, distanceY: _this.distanceY, swipeDirection: _this.movedDirection,\n velocity: _this.getVelocity(point)\n };\n if (_this.isTouchMoved) {\n var eSwipeArgs = void 0;\n var tDistance = _this.swipeSettings.swipeThresholdDistance;\n eSwipeArgs = extend(eSwipeArgs, _this.defaultArgs, swipeArgs);\n var canTrigger = false;\n var ele = _this.element;\n var scrollBool = _this.isScrollable(ele);\n var moved = swipeRegex.test(_this.movedDirection);\n if ((tDistance < _this.distanceX && !moved) || (tDistance < _this.distanceY && moved)) {\n if (!scrollBool) {\n canTrigger = true;\n }\n else {\n canTrigger = _this.checkSwipe(ele, moved);\n }\n }\n if (canTrigger) {\n _this.trigger('swipe', eSwipeArgs);\n }\n }\n _this.modeclear();\n };\n _this.modeclear = function () {\n _this.modeClear = setTimeout(function () {\n _this.touchAction = true;\n }, (typeof _this.tap !== 'function' ? 0 : 10));\n _this.lastTapTime = new Date().getTime();\n EventHandler.remove(_this.element, Browser.touchMoveEvent, _this.moveEvent);\n EventHandler.remove(_this.element, Browser.touchEndEvent, _this.endEvent);\n EventHandler.remove(_this.element, Browser.touchCancelEvent, _this.cancelEvent);\n };\n _this.bind();\n return _this;\n }\n // triggers when property changed \n /**\n * @private\n * @param newProp\n * @param oldProp\n */\n Touch.prototype.onPropertyChanged = function (newProp, oldProp) {\n //No Code to handle\n };\n Touch.prototype.bind = function () {\n this.wireEvents();\n if (Browser.isIE) {\n this.element.classList.add('e-block-touch');\n }\n };\n /**\n * To destroy the touch instance.\n * @return {void}\n */\n Touch.prototype.destroy = function () {\n this.unwireEvents();\n _super.prototype.destroy.call(this);\n };\n // Need to changes the event binding once we updated the event handler.\n Touch.prototype.wireEvents = function () {\n EventHandler.add(this.element, Browser.touchStartEvent, this.startEvent, this);\n };\n Touch.prototype.unwireEvents = function () {\n EventHandler.remove(this.element, Browser.touchStartEvent, this.startEvent);\n };\n /**\n * Returns module name as touch\n * @returns {string}\n * @private\n */\n Touch.prototype.getModuleName = function () {\n return 'touch';\n };\n /**\n * Returns if the HTML element is Scrollable.\n * @param {HTMLElement} element - HTML Element to check if Scrollable.\n * @returns {boolean}\n */\n Touch.prototype.isScrollable = function (element) {\n var eleStyle = getComputedStyle(element);\n var style = eleStyle.overflow + eleStyle.overflowX + eleStyle.overflowY;\n if ((/(auto|scroll)/).test(style)) {\n return true;\n }\n return false;\n };\n Touch.prototype.tapHoldEvent = function (evt) {\n this.tapCount = 0;\n this.touchAction = true;\n var eTapArgs;\n EventHandler.remove(this.element, Browser.touchMoveEvent, this.moveEvent);\n EventHandler.remove(this.element, Browser.touchEndEvent, this.endEvent);\n eTapArgs = { originalEvent: evt };\n this.trigger('tapHold', eTapArgs);\n EventHandler.remove(this.element, Browser.touchCancelEvent, this.cancelEvent);\n };\n Touch.prototype.calcPoints = function (evt) {\n var point = evt.changedTouches ? evt.changedTouches[0] : evt;\n this.defaultArgs = { originalEvent: evt };\n this.distanceX = Math.abs((Math.abs(point.clientX) - Math.abs(this.startPoint.clientX)));\n this.distanceY = Math.abs((Math.abs(point.clientY) - Math.abs(this.startPoint.clientY)));\n if (this.distanceX > this.distanceY) {\n this.movedDirection = (point.clientX > this.startPoint.clientX) ? 'Right' : 'Left';\n }\n else {\n this.movedDirection = (point.clientY < this.startPoint.clientY) ? 'Up' : 'Down';\n }\n };\n Touch.prototype.calcScrollPoints = function (evt) {\n var point = evt.changedTouches ? evt.changedTouches[0] : evt;\n this.defaultArgs = { originalEvent: evt };\n this.distanceX = Math.abs((Math.abs(point.clientX) - Math.abs(this.lastMovedPoint.clientX)));\n this.distanceY = Math.abs((Math.abs(point.clientY) - Math.abs(this.lastMovedPoint.clientY)));\n if ((this.distanceX > this.distanceY || this.hScrollLocked === true) && this.vScrollLocked === false) {\n this.scrollDirection = (point.clientX > this.lastMovedPoint.clientX) ? 'Right' : 'Left';\n this.hScrollLocked = true;\n }\n else {\n this.scrollDirection = (point.clientY < this.lastMovedPoint.clientY) ? 'Up' : 'Down';\n this.vScrollLocked = true;\n }\n };\n Touch.prototype.getVelocity = function (pnt) {\n var newX = pnt.clientX;\n var newY = pnt.clientY;\n var newT = Date.now();\n var xDist = newX - this.startPoint.clientX;\n var yDist = newY - this.startPoint.clientX;\n var interval = newT - this.tStampStart;\n return Math.sqrt(xDist * xDist + yDist * yDist) / interval;\n };\n // tslint:disable-next-line:no-any\n Touch.prototype.checkSwipe = function (ele, flag) {\n var keys = ['scroll', 'offset'];\n var temp = flag ? ['Height', 'Top'] : ['Width', 'Left'];\n if ((ele[keys[0] + temp[0]] <= ele[keys[1] + temp[0]])) {\n return true;\n }\n return (ele[keys[0] + temp[1]] === 0) ||\n (ele[keys[1] + temp[0]] + ele[keys[0] + temp[1]] >= ele[keys[0] + temp[0]]);\n };\n __decorate([\n Event()\n ], Touch.prototype, \"tap\", void 0);\n __decorate([\n Event()\n ], Touch.prototype, \"tapHold\", void 0);\n __decorate([\n Event()\n ], Touch.prototype, \"swipe\", void 0);\n __decorate([\n Event()\n ], Touch.prototype, \"scroll\", void 0);\n __decorate([\n Property(350)\n ], Touch.prototype, \"tapThreshold\", void 0);\n __decorate([\n Property(750)\n ], Touch.prototype, \"tapHoldThreshold\", void 0);\n __decorate([\n Complex({}, SwipeSettings)\n ], Touch.prototype, \"swipeSettings\", void 0);\n Touch = __decorate([\n NotifyPropertyChanges\n ], Touch);\n return Touch;\n}(Base));\nexport { Touch };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Property, NotifyPropertyChanges, Component } from '@syncfusion/ej2-base';\nimport { addClass, createElement, detach, removeClass, rippleEffect, EventHandler } from '@syncfusion/ej2-base';\nimport { getTextNode } from '../common/common';\nvar cssClassName = {\n RTL: 'e-rtl',\n BUTTON: 'e-btn',\n PRIMARY: 'e-primary',\n ICONBTN: 'e-icon-btn'\n};\n/**\n * The Button is a graphical user interface element that triggers an event on its click action. It can contain a text, an image, or both.\n * ```html\n * \n * ```\n * ```typescript\n * \n * ```\n */\nvar Button = /** @class */ (function (_super) {\n __extends(Button, _super);\n /**\n * Constructor for creating the widget\n * @param {ButtonModel} options?\n * @param {string|HTMLButtonElement} element?\n */\n function Button(options, element) {\n return _super.call(this, options, element) || this;\n }\n Button.prototype.preRender = function () {\n // pre render code snippets\n };\n /**\n * Initialize the control rendering\n * @returns void\n * @private\n */\n Button.prototype.render = function () {\n this.initialize();\n };\n Button.prototype.initialize = function () {\n if (this.cssClass) {\n addClass([this.element], this.cssClass.split(' '));\n }\n if (this.isPrimary) {\n this.element.classList.add(cssClassName.PRIMARY);\n }\n if (this.content) {\n this.element.innerHTML = this.content;\n }\n this.setIconCss();\n if (this.enableRtl) {\n this.element.classList.add(cssClassName.RTL);\n }\n if (this.disabled) {\n this.controlStatus(this.disabled);\n }\n else {\n this.wireEvents();\n }\n this.removeRippleEffect = rippleEffect(this.element, { selector: '.' + cssClassName.BUTTON });\n };\n Button.prototype.controlStatus = function (disabled) {\n this.element.disabled = disabled;\n };\n Button.prototype.setIconCss = function () {\n if (this.iconCss) {\n var span = createElement('span', { className: 'e-btn-icon ' + this.iconCss });\n if (!this.element.textContent.trim()) {\n this.element.classList.add(cssClassName.ICONBTN);\n }\n else {\n span.classList.add('e-icon-' + this.iconPosition.toLowerCase());\n }\n var node = this.element.childNodes[0];\n if (node && (this.iconPosition === 'Left')) {\n this.element.insertBefore(span, node);\n }\n else {\n this.element.appendChild(span);\n }\n }\n };\n Button.prototype.wireEvents = function () {\n if (this.isToggle) {\n EventHandler.add(this.element, 'click', this.btnClickHandler, this);\n }\n };\n Button.prototype.unWireEvents = function () {\n if (this.isToggle) {\n EventHandler.remove(this.element, 'click', this.btnClickHandler);\n }\n };\n Button.prototype.btnClickHandler = function () {\n if (this.element.classList.contains('e-active')) {\n this.element.classList.remove('e-active');\n }\n else {\n this.element.classList.add('e-active');\n }\n };\n /**\n * Destroys the widget.\n * @returns void\n */\n Button.prototype.destroy = function () {\n var span;\n var element = this.element;\n _super.prototype.destroy.call(this);\n removeClass([this.element], [cssClassName.PRIMARY, cssClassName.RTL, cssClassName.ICONBTN, 'e-success',\n 'e-info', 'e-danger', 'e-warning', 'e-flat', 'e-outline', 'e-small', 'e-bigger', 'e-active', 'e-round']);\n ['e-ripple', 'disabled'].forEach(function (value) {\n element.removeAttribute(value);\n });\n if (this.content) {\n element.innerHTML = element.innerHTML.replace(this.content, '');\n }\n span = element.querySelector('span.e-btn-icon');\n if (span) {\n detach(span);\n }\n this.unWireEvents();\n this.removeRippleEffect();\n };\n /**\n * Get component name.\n * @returns string\n * @private\n */\n Button.prototype.getModuleName = function () {\n return 'btn';\n };\n /**\n * Get the properties to be maintained in the persisted state.\n * @returns string\n */\n Button.prototype.getPersistData = function () {\n return this.addOnPersist([]);\n };\n /**\n * Called internally if any of the property value changed.\n * @param {Button} newProp\n * @param {Button} oldProp\n * @returns void\n * @private\n */\n Button.prototype.onPropertyChanged = function (newProp, oldProp) {\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'isPrimary':\n if (newProp.isPrimary) {\n this.element.classList.add(cssClassName.PRIMARY);\n }\n else {\n this.element.classList.remove(cssClassName.PRIMARY);\n }\n break;\n case 'disabled':\n this.controlStatus(newProp.disabled);\n this.unWireEvents();\n break;\n case 'iconCss':\n var span = this.element.querySelector('span.e-btn-icon');\n if (span) {\n span.className = 'e-btn-icon ' + newProp.iconCss;\n if (this.element.textContent.trim()) {\n if (this.iconPosition === 'Left') {\n span.classList.add('e-icon-left');\n }\n else {\n span.classList.add('e-icon-right');\n }\n }\n }\n else {\n this.setIconCss();\n }\n break;\n case 'iconPosition':\n span = this.element.querySelector('span.e-btn-icon');\n if (span) {\n detach(span);\n }\n this.setIconCss();\n break;\n case 'cssClass':\n if (oldProp.cssClass) {\n removeClass([this.element], oldProp.cssClass.split(' '));\n }\n if (newProp.cssClass) {\n addClass([this.element], newProp.cssClass.split(' '));\n }\n break;\n case 'enableRtl':\n if (newProp.enableRtl) {\n this.element.classList.add(cssClassName.RTL);\n }\n else {\n this.element.classList.remove(cssClassName.RTL);\n }\n break;\n case 'content':\n var node = getTextNode(this.element);\n if (!node) {\n this.element.classList.remove(cssClassName.ICONBTN);\n }\n this.element.innerHTML = newProp.content;\n this.setIconCss();\n break;\n case 'isToggle':\n if (newProp.isToggle) {\n EventHandler.add(this.element, 'click', this.btnClickHandler, this);\n }\n else {\n EventHandler.remove(this.element, 'click', this.btnClickHandler);\n removeClass([this.element], ['e-active']);\n }\n break;\n }\n }\n };\n __decorate([\n Property('Left')\n ], Button.prototype, \"iconPosition\", void 0);\n __decorate([\n Property('')\n ], Button.prototype, \"iconCss\", void 0);\n __decorate([\n Property(false)\n ], Button.prototype, \"disabled\", void 0);\n __decorate([\n Property(false)\n ], Button.prototype, \"isPrimary\", void 0);\n __decorate([\n Property('')\n ], Button.prototype, \"cssClass\", void 0);\n __decorate([\n Property('')\n ], Button.prototype, \"content\", void 0);\n __decorate([\n Property(false)\n ], Button.prototype, \"isToggle\", void 0);\n Button = __decorate([\n NotifyPropertyChanges\n ], Button);\n return Button;\n}(Component));\nexport { Button };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, NotifyPropertyChanges, Property } from '@syncfusion/ej2-base';\nimport { Event, EventHandler } from '@syncfusion/ej2-base';\nimport { addClass, createElement, detach, getUniqueID, isRippleEnabled, removeClass, rippleEffect } from '@syncfusion/ej2-base';\nimport { wrapperInitialize, rippleMouseHandler } from './../common/common';\nvar CHECK = 'e-check';\nvar DISABLED = 'e-checkbox-disabled';\nvar FRAME = 'e-frame';\nvar INDETERMINATE = 'e-stop';\nvar LABEL = 'e-label';\nvar RIPPLE = 'e-ripple-container';\nvar RIPPLECHECK = 'e-ripple-check';\nvar RIPPLEINDETERMINATE = 'e-ripple-stop';\nvar RTL = 'e-rtl';\nvar WRAPPER = 'e-checkbox-wrapper';\n/**\n * The CheckBox is a graphical user interface element that allows you to select one or more options from the choices.\n * It contains checked, unchecked, and indeterminate states.\n * ```html\n * \n * \n * ```\n */\nvar CheckBox = /** @class */ (function (_super) {\n __extends(CheckBox, _super);\n /**\n * Constructor for creating the widget\n * @private\n */\n function CheckBox(options, element) {\n var _this = _super.call(this, options, element) || this;\n _this.isKeyPressed = false;\n return _this;\n }\n CheckBox.prototype.changeState = function (state) {\n var ariaState;\n var rippleSpan;\n var frameSpan = this.getWrapper().getElementsByClassName(FRAME)[0];\n if (isRippleEnabled) {\n rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE)[0];\n }\n if (state === 'check') {\n frameSpan.classList.remove(INDETERMINATE);\n frameSpan.classList.add(CHECK);\n if (rippleSpan) {\n rippleSpan.classList.remove(RIPPLEINDETERMINATE);\n rippleSpan.classList.add(RIPPLECHECK);\n }\n ariaState = 'true';\n this.element.checked = true;\n }\n else if (state === 'uncheck') {\n removeClass([frameSpan], [CHECK, INDETERMINATE]);\n if (rippleSpan) {\n removeClass([rippleSpan], [RIPPLECHECK, RIPPLEINDETERMINATE]);\n }\n ariaState = 'false';\n this.element.checked = false;\n }\n else {\n frameSpan.classList.remove(CHECK);\n frameSpan.classList.add(INDETERMINATE);\n if (rippleSpan) {\n rippleSpan.classList.remove(RIPPLECHECK);\n rippleSpan.classList.add(RIPPLEINDETERMINATE);\n }\n ariaState = 'mixed';\n this.element.indeterminate = true;\n }\n this.getWrapper().setAttribute('aria-checked', ariaState);\n };\n CheckBox.prototype.clickHandler = function (event) {\n this.focusOutHandler();\n if (this.indeterminate) {\n this.changeState(this.checked ? 'check' : 'uncheck');\n this.indeterminate = false;\n this.element.indeterminate = false;\n }\n else if (this.checked) {\n this.changeState('uncheck');\n this.checked = false;\n }\n else {\n this.changeState('check');\n this.checked = true;\n }\n var changeEventArgs = { checked: this.element.checked, event: event };\n this.trigger('change', changeEventArgs);\n };\n /**\n * Destroys the widget.\n * @returns void\n */\n CheckBox.prototype.destroy = function () {\n var _this = this;\n var wrapper = this.getWrapper();\n _super.prototype.destroy.call(this);\n if (!this.disabled) {\n this.unWireEvents();\n }\n if (this.tagName === 'INPUT') {\n wrapper.parentNode.insertBefore(this.element, wrapper);\n detach(wrapper);\n this.element.checked = false;\n if (this.indeterminate) {\n this.element.indeterminate = false;\n }\n ['name', 'value', 'disabled'].forEach(function (key) {\n _this.element.removeAttribute(key);\n });\n }\n else {\n ['role', 'aria-checked', 'class'].forEach(function (key) {\n wrapper.removeAttribute(key);\n });\n if (this.element.id) {\n wrapper.setAttribute('id', this.element.id);\n }\n wrapper.innerHTML = '';\n }\n };\n CheckBox.prototype.focusHandler = function () {\n if (this.isKeyPressed) {\n this.getWrapper().classList.add('e-focus');\n }\n };\n CheckBox.prototype.focusOutHandler = function () {\n this.getWrapper().classList.remove('e-focus');\n };\n /**\n * Gets the module name.\n * @private\n */\n CheckBox.prototype.getModuleName = function () {\n return 'checkbox';\n };\n /**\n * Gets the properties to be maintained in the persistence state.\n * @private\n */\n CheckBox.prototype.getPersistData = function () {\n return this.addOnPersist(['checked', 'indeterminate']);\n };\n CheckBox.prototype.getWrapper = function () {\n return this.element.parentElement.parentElement;\n };\n CheckBox.prototype.initialize = function () {\n if (this.name) {\n this.element.setAttribute('name', this.name);\n }\n if (this.value) {\n this.element.setAttribute('value', this.value);\n }\n if (this.checked) {\n this.changeState('check');\n }\n if (this.indeterminate) {\n this.changeState();\n }\n if (this.disabled) {\n this.setDisabled();\n }\n };\n CheckBox.prototype.initWrapper = function () {\n var wrapper = this.element.parentElement;\n if (!wrapper.classList.contains(WRAPPER)) {\n wrapper = createElement('div', {\n className: WRAPPER, attrs: { 'role': 'checkbox', 'aria-checked': 'false' }\n });\n this.element.parentNode.insertBefore(wrapper, this.element);\n }\n var label = createElement('label', { attrs: { for: this.element.id } });\n var frameSpan = createElement('span', { className: 'e-icons ' + FRAME });\n if (this.enableRtl) {\n wrapper.classList.add(RTL);\n }\n if (this.cssClass) {\n addClass([wrapper], this.cssClass.split(' '));\n }\n wrapper.appendChild(label);\n label.appendChild(this.element);\n label.appendChild(frameSpan);\n if (isRippleEnabled) {\n var rippleSpan = createElement('span', { className: RIPPLE });\n if (this.labelPosition === 'Before') {\n label.appendChild(rippleSpan);\n }\n else {\n label.insertBefore(rippleSpan, frameSpan);\n }\n rippleEffect(rippleSpan, { duration: 400, isCenterRipple: true });\n }\n if (this.label) {\n this.setText(this.label);\n }\n };\n CheckBox.prototype.keyDownHandler = function () {\n this.isKeyPressed = true;\n };\n CheckBox.prototype.labelMouseHandler = function (e) {\n var rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE)[0];\n rippleMouseHandler(e, rippleSpan);\n };\n CheckBox.prototype.mouseDownHandler = function () {\n this.isKeyPressed = false;\n };\n /**\n * Called internally if any of the property value changes.\n * @private\n */\n CheckBox.prototype.onPropertyChanged = function (newProp, oldProp) {\n var wrapper = this.getWrapper();\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'checked':\n this.indeterminate = false;\n this.element.indeterminate = false;\n this.changeState(newProp.checked ? 'check' : 'uncheck');\n break;\n case 'indeterminate':\n if (newProp.indeterminate) {\n this.changeState();\n }\n else {\n this.element.indeterminate = false;\n this.changeState(this.checked ? 'check' : 'uncheck');\n }\n break;\n case 'disabled':\n if (newProp.disabled) {\n this.setDisabled();\n this.unWireEvents();\n }\n else {\n this.element.disabled = false;\n wrapper.classList.remove(DISABLED);\n wrapper.setAttribute('aria-disabled', 'false');\n this.wireEvents();\n }\n break;\n case 'cssClass':\n if (oldProp.cssClass) {\n wrapper.classList.remove(oldProp.cssClass);\n }\n wrapper.classList.add(newProp.cssClass);\n break;\n case 'enableRtl':\n if (newProp.enableRtl) {\n wrapper.classList.add(RTL);\n }\n else {\n wrapper.classList.remove(RTL);\n }\n break;\n case 'label':\n this.setText(newProp.label);\n break;\n case 'labelPosition':\n var label = wrapper.getElementsByClassName(LABEL)[0];\n var labelWrap = wrapper.getElementsByTagName('label')[0];\n detach(label);\n if (newProp.labelPosition === 'After') {\n labelWrap.appendChild(label);\n }\n else {\n labelWrap.insertBefore(label, wrapper.getElementsByClassName(FRAME)[0]);\n }\n break;\n case 'name':\n this.element.setAttribute('name', newProp.name);\n break;\n case 'value':\n this.element.setAttribute('value', newProp.value);\n break;\n }\n }\n };\n /**\n * Initialize Angular, React and Unique ID support.\n * @private\n */\n CheckBox.prototype.preRender = function () {\n var element = this.element;\n this.tagName = this.element.tagName;\n element = wrapperInitialize('EJS-CHECKBOX', 'checkbox', element, WRAPPER, 'checkbox');\n this.element = element;\n if (this.element.getAttribute('type') !== 'checkbox') {\n this.element.setAttribute('type', 'checkbox');\n }\n if (!this.element.id) {\n this.element.id = getUniqueID('e-' + this.getModuleName());\n }\n };\n /**\n * Initialize the control rendering\n * @private\n */\n CheckBox.prototype.render = function () {\n this.initWrapper();\n this.initialize();\n if (!this.disabled) {\n this.wireEvents();\n }\n };\n CheckBox.prototype.setDisabled = function () {\n var wrapper = this.getWrapper();\n this.element.disabled = true;\n wrapper.classList.add(DISABLED);\n wrapper.setAttribute('aria-disabled', 'true');\n };\n CheckBox.prototype.setText = function (text) {\n var label = this.getWrapper().getElementsByClassName(LABEL)[0];\n if (label) {\n label.textContent = text;\n }\n else {\n label = createElement('span', { className: LABEL, innerHTML: text });\n var labelWrap = this.getWrapper().getElementsByTagName('label')[0];\n if (this.labelPosition === 'Before') {\n labelWrap.insertBefore(label, this.getWrapper().getElementsByClassName(FRAME)[0]);\n }\n else {\n labelWrap.appendChild(label);\n }\n }\n };\n CheckBox.prototype.unWireEvents = function () {\n var wrapper = this.getWrapper();\n EventHandler.remove(this.element, 'click', this.clickHandler);\n EventHandler.remove(document, 'keydown', this.keyDownHandler);\n EventHandler.remove(wrapper, 'mousedown', this.mouseDownHandler);\n EventHandler.remove(this.element, 'focus', this.focusHandler);\n EventHandler.remove(this.element, 'focusout', this.focusOutHandler);\n var label = wrapper.getElementsByTagName('label')[0];\n EventHandler.remove(label, 'mousedown', this.labelMouseHandler);\n EventHandler.remove(label, 'mouseup', this.labelMouseHandler);\n };\n CheckBox.prototype.wireEvents = function () {\n var wrapper = this.getWrapper();\n EventHandler.add(this.element, 'click', this.clickHandler, this);\n EventHandler.add(document, 'keydown', this.keyDownHandler, this);\n EventHandler.add(wrapper, 'mousedown', this.mouseDownHandler, this);\n EventHandler.add(this.element, 'focus', this.focusHandler, this);\n EventHandler.add(this.element, 'focusout', this.focusOutHandler, this);\n var label = wrapper.getElementsByTagName('label')[0];\n EventHandler.add(label, 'mousedown', this.labelMouseHandler, this);\n EventHandler.add(label, 'mouseup', this.labelMouseHandler, this);\n };\n __decorate([\n Event()\n ], CheckBox.prototype, \"change\", void 0);\n __decorate([\n Property(false)\n ], CheckBox.prototype, \"checked\", void 0);\n __decorate([\n Property('')\n ], CheckBox.prototype, \"cssClass\", void 0);\n __decorate([\n Property(false)\n ], CheckBox.prototype, \"disabled\", void 0);\n __decorate([\n Property(false)\n ], CheckBox.prototype, \"indeterminate\", void 0);\n __decorate([\n Property('')\n ], CheckBox.prototype, \"label\", void 0);\n __decorate([\n Property('After')\n ], CheckBox.prototype, \"labelPosition\", void 0);\n __decorate([\n Property('')\n ], CheckBox.prototype, \"name\", void 0);\n __decorate([\n Property('')\n ], CheckBox.prototype, \"value\", void 0);\n CheckBox = __decorate([\n NotifyPropertyChanges\n ], CheckBox);\n return CheckBox;\n}(Component));\nexport { CheckBox };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, rippleEffect, NotifyPropertyChanges, Property } from '@syncfusion/ej2-base';\nimport { addClass, createElement, getInstance, getUniqueID, isRippleEnabled, removeClass } from '@syncfusion/ej2-base';\nimport { detach, Event, EventHandler } from '@syncfusion/ej2-base';\nimport { wrapperInitialize, rippleMouseHandler } from './../common/common';\nvar LABEL = 'e-label';\nvar RIPPLE = 'e-ripple-container';\nvar RTL = 'e-rtl';\nvar WRAPPER = 'e-radio-wrapper';\n/**\n * The RadioButton is a graphical user interface element that allows you to select one option from the choices.\n * It contains checked and unchecked states.\n * ```html\n * \n * \n * ```\n */\nvar RadioButton = /** @class */ (function (_super) {\n __extends(RadioButton, _super);\n /**\n * Constructor for creating the widget\n * @private\n */\n function RadioButton(options, element) {\n var _this = _super.call(this, options, element) || this;\n _this.isKeyPressed = false;\n return _this;\n }\n RadioButton_1 = RadioButton;\n RadioButton.prototype.changeHandler = function (event) {\n this.checked = true;\n this.dataBind();\n var changeEventArgs = { value: this.value, event: event };\n this.trigger('change', changeEventArgs);\n };\n RadioButton.prototype.updateChange = function (state) {\n var input;\n var name = this.element.getAttribute('name');\n var radioGrp = document.querySelectorAll('input.e-radio[name=\"' + name + '\"]');\n for (var i = 0; i < radioGrp.length; i++) {\n input = radioGrp[i];\n if (input !== this.element) {\n getInstance(input, RadioButton_1).checked = false;\n }\n }\n };\n /**\n * Destroys the widget.\n * @returns void\n */\n RadioButton.prototype.destroy = function () {\n var _this = this;\n var radioWrap = this.element.parentElement;\n _super.prototype.destroy.call(this);\n if (!this.disabled) {\n this.unWireEvents();\n }\n if (this.tagName === 'INPUT') {\n radioWrap.parentNode.insertBefore(this.element, radioWrap);\n detach(radioWrap);\n this.element.checked = false;\n ['name', 'value', 'disabled'].forEach(function (key) {\n _this.element.removeAttribute(key);\n });\n }\n else {\n ['role', 'aria-checked', 'class'].forEach(function (key) {\n radioWrap.removeAttribute(key);\n });\n if (this.element.id) {\n radioWrap.setAttribute('id', this.element.id);\n }\n radioWrap.innerHTML = '';\n }\n };\n RadioButton.prototype.focusHandler = function () {\n if (this.isKeyPressed) {\n this.getLabel().classList.add('e-focus');\n }\n };\n RadioButton.prototype.focusOutHandler = function () {\n this.getLabel().classList.remove('e-focus');\n };\n RadioButton.prototype.getModuleName = function () {\n return 'radio';\n };\n /**\n * Gets the properties to be maintained in the persistence state.\n * @private\n */\n RadioButton.prototype.getPersistData = function () {\n return this.addOnPersist(['checked']);\n };\n RadioButton.prototype.getLabel = function () {\n return this.element.nextElementSibling;\n };\n RadioButton.prototype.initialize = function () {\n this.initWrapper();\n if (this.name) {\n this.element.setAttribute('name', this.name);\n }\n if (this.value) {\n this.element.setAttribute('value', this.value);\n }\n if (this.checked) {\n this.element.checked = true;\n }\n if (this.disabled) {\n this.setDisabled();\n }\n };\n RadioButton.prototype.initWrapper = function () {\n var rippleSpan;\n var wrapper = this.element.parentElement;\n if (!wrapper.classList.contains(WRAPPER)) {\n wrapper = createElement('div', { className: WRAPPER });\n this.element.parentNode.insertBefore(wrapper, this.element);\n }\n var label = createElement('label', { attrs: { for: this.element.id } });\n wrapper.appendChild(this.element);\n wrapper.appendChild(label);\n if (isRippleEnabled) {\n rippleSpan = createElement('span', { className: (RIPPLE) });\n label.appendChild(rippleSpan);\n rippleEffect(rippleSpan, {\n duration: 400,\n isCenterRipple: true\n });\n }\n if (this.enableRtl) {\n label.classList.add(RTL);\n }\n if (this.cssClass) {\n addClass([label], this.cssClass.split(' '));\n }\n if (this.label) {\n this.setText(this.label);\n }\n };\n RadioButton.prototype.keyDownHandler = function () {\n this.isKeyPressed = true;\n };\n RadioButton.prototype.labelRippleHandler = function (e) {\n var ripple = this.getLabel().getElementsByClassName(RIPPLE)[0];\n rippleMouseHandler(e, ripple);\n };\n RadioButton.prototype.mouseDownHandler = function () {\n this.isKeyPressed = false;\n };\n /**\n * Called internally if any of the property value changes.\n * @private\n */\n RadioButton.prototype.onPropertyChanged = function (newProp, oldProp) {\n var label = this.getLabel();\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'checked':\n if (newProp.checked) {\n this.updateChange(newProp.checked);\n }\n this.element.checked = newProp.checked;\n break;\n case 'disabled':\n if (newProp.disabled) {\n this.setDisabled();\n this.unWireEvents();\n }\n else {\n this.element.disabled = false;\n this.wireEvents();\n }\n break;\n case 'cssClass':\n if (oldProp.cssClass) {\n removeClass([label], oldProp.cssClass.split(' '));\n }\n addClass([label], newProp.cssClass.split(' '));\n break;\n case 'enableRtl':\n if (newProp.enableRtl) {\n label.classList.add(RTL);\n }\n else {\n label.classList.remove(RTL);\n }\n break;\n case 'label':\n this.setText(newProp.label);\n break;\n case 'labelPosition':\n if (newProp.labelPosition === 'Before') {\n label.classList.add('e-right');\n }\n else {\n label.classList.remove('e-right');\n }\n break;\n case 'name':\n this.element.setAttribute('name', newProp.name);\n break;\n case 'value':\n this.element.setAttribute('value', newProp.value);\n break;\n }\n }\n };\n /**\n * Initialize checked Property, Angular and React and Unique ID support.\n * @private\n */\n RadioButton.prototype.preRender = function () {\n var element = this.element;\n this.tagName = this.element.tagName;\n element = wrapperInitialize('EJS-RADIOBUTTON', 'radio', element, WRAPPER, 'radio');\n this.element = element;\n if (this.element.getAttribute('type') !== 'radio') {\n this.element.setAttribute('type', 'radio');\n }\n if (!this.element.id) {\n this.element.id = getUniqueID('e-' + this.getModuleName());\n }\n };\n /**\n * Initialize the control rendering\n * @private\n */\n RadioButton.prototype.render = function () {\n this.initialize();\n if (!this.disabled) {\n this.wireEvents();\n }\n };\n RadioButton.prototype.setDisabled = function () {\n this.element.disabled = true;\n };\n RadioButton.prototype.setText = function (text) {\n var label = this.getLabel();\n var textLabel = label.getElementsByClassName(LABEL)[0];\n if (textLabel) {\n textLabel.textContent = text;\n }\n else {\n textLabel = createElement('span', { className: LABEL, innerHTML: text });\n label.appendChild(textLabel);\n }\n if (this.labelPosition === 'Before') {\n this.getLabel().classList.add('e-right');\n }\n else {\n this.getLabel().classList.remove('e-right');\n }\n };\n RadioButton.prototype.unWireEvents = function () {\n var label = this.getLabel();\n EventHandler.remove(this.element, 'change', this.changeHandler);\n EventHandler.remove(document, 'keydown', this.keyDownHandler);\n EventHandler.remove(label, 'mousedown', this.mouseDownHandler);\n EventHandler.remove(this.element, 'focus', this.focusHandler);\n EventHandler.remove(this.element, 'focusout', this.focusOutHandler);\n var rippleLabel = label.getElementsByClassName(LABEL)[0];\n if (rippleLabel) {\n EventHandler.remove(rippleLabel, 'mousedown', this.labelRippleHandler);\n EventHandler.remove(rippleLabel, 'mouseup', this.labelRippleHandler);\n }\n };\n RadioButton.prototype.wireEvents = function () {\n var label = this.getLabel();\n EventHandler.add(this.element, 'change', this.changeHandler, this);\n EventHandler.add(document, 'keydown', this.keyDownHandler, this);\n EventHandler.add(label, 'mousedown', this.mouseDownHandler, this);\n EventHandler.add(this.element, 'focus', this.focusHandler, this);\n EventHandler.add(this.element, 'focusout', this.focusOutHandler, this);\n var rippleLabel = label.getElementsByClassName(LABEL)[0];\n if (rippleLabel) {\n EventHandler.add(rippleLabel, 'mousedown', this.labelRippleHandler, this);\n EventHandler.add(rippleLabel, 'mouseup', this.labelRippleHandler, this);\n }\n };\n __decorate([\n Event()\n ], RadioButton.prototype, \"change\", void 0);\n __decorate([\n Property(false)\n ], RadioButton.prototype, \"checked\", void 0);\n __decorate([\n Property('')\n ], RadioButton.prototype, \"cssClass\", void 0);\n __decorate([\n Property(false)\n ], RadioButton.prototype, \"disabled\", void 0);\n __decorate([\n Property('')\n ], RadioButton.prototype, \"label\", void 0);\n __decorate([\n Property('After')\n ], RadioButton.prototype, \"labelPosition\", void 0);\n __decorate([\n Property('')\n ], RadioButton.prototype, \"name\", void 0);\n __decorate([\n Property('')\n ], RadioButton.prototype, \"value\", void 0);\n RadioButton = RadioButton_1 = __decorate([\n NotifyPropertyChanges\n ], RadioButton);\n return RadioButton;\n var RadioButton_1;\n}(Component));\nexport { RadioButton };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, NotifyPropertyChanges, Property } from '@syncfusion/ej2-base';\nimport { Event, EventHandler } from '@syncfusion/ej2-base';\nimport { addClass, createElement, isRippleEnabled, removeClass, rippleEffect } from '@syncfusion/ej2-base';\nimport { rippleMouseHandler, destroy, preRender } from './../common/common';\nvar CHECK = 'e-check';\nvar DISABLED = 'e-switch-disabled';\nvar RIPPLE = 'e-ripple-container';\nvar RIPPLE_CHECK = 'e-ripple-check';\nvar RTL = 'e-rtl';\nvar WRAPPER = 'e-switch-wrapper';\nvar ACTIVE = 'e-switch-active';\n/**\n * The Switch is a graphical user interface element that allows you to toggle between checked and unchecked states.\n * ```html\n * \n * \n * ```\n */\nvar Switch = /** @class */ (function (_super) {\n __extends(Switch, _super);\n /**\n * Constructor for creating the widget.\n * @private\n */\n function Switch(options, element) {\n var _this = _super.call(this, options, element) || this;\n _this.isKeyPressed = false;\n _this.isDrag = false;\n return _this;\n }\n Switch.prototype.changeState = function (state) {\n var ariaState;\n var rippleSpan;\n var wrapper = this.getWrapper();\n var bar = wrapper.querySelector('.e-switch-inner');\n var handle = wrapper.querySelector('.e-switch-handle');\n if (isRippleEnabled) {\n rippleSpan = wrapper.getElementsByClassName(RIPPLE)[0];\n }\n if (state) {\n addClass([bar, handle], ACTIVE);\n ariaState = 'true';\n this.element.checked = true;\n this.checked = true;\n if (rippleSpan) {\n addClass([rippleSpan], [RIPPLE_CHECK]);\n }\n }\n else {\n removeClass([bar, handle], ACTIVE);\n ariaState = 'false';\n this.element.checked = false;\n this.checked = false;\n if (rippleSpan) {\n removeClass([rippleSpan], [RIPPLE_CHECK]);\n }\n }\n wrapper.setAttribute('aria-checked', ariaState);\n };\n Switch.prototype.clickHandler = function (evt) {\n this.isDrag = false;\n this.focusOutHandler();\n this.changeState(!this.checked);\n this.element.focus();\n var changeEventArgs = { checked: this.element.checked, event: evt };\n this.trigger('change', changeEventArgs);\n };\n /**\n * Destroys the Switch widget.\n * @returns void\n */\n Switch.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n if (!this.disabled) {\n this.unWireEvents();\n }\n destroy(this, this.getWrapper(), this.tagName);\n };\n Switch.prototype.focusHandler = function () {\n if (this.isKeyPressed) {\n this.getWrapper().classList.add('e-focus');\n }\n };\n Switch.prototype.focusOutHandler = function () {\n this.getWrapper().classList.remove('e-focus');\n };\n /**\n * Gets the module name.\n * @private\n */\n Switch.prototype.getModuleName = function () {\n return 'switch';\n };\n /**\n * Gets the properties to be maintained in the persistence state.\n * @private\n */\n Switch.prototype.getPersistData = function () {\n return this.addOnPersist(['checked']);\n };\n Switch.prototype.getWrapper = function () {\n return this.element.parentElement;\n };\n Switch.prototype.initialize = function () {\n if (this.name) {\n this.element.setAttribute('name', this.name);\n }\n if (this.value) {\n this.element.setAttribute('value', this.value);\n }\n if (this.checked) {\n this.changeState(true);\n }\n if (this.disabled) {\n this.setDisabled();\n }\n if (this.onLabel || this.offLabel) {\n this.setLabel(this.onLabel, this.offLabel);\n }\n };\n Switch.prototype.initWrapper = function () {\n var wrapper = this.element.parentElement;\n if (!wrapper.classList.contains(WRAPPER)) {\n wrapper = createElement('div', {\n className: WRAPPER, attrs: { 'role': 'switch', 'aria-checked': 'false' }\n });\n this.element.parentNode.insertBefore(wrapper, this.element);\n }\n var switchInner = createElement('span', { className: 'e-switch-inner' });\n var onLabel = createElement('span', { className: 'e-switch-on' });\n var offLabel = createElement('span', { className: 'e-switch-off' });\n var handle = createElement('span', { className: 'e-switch-handle' });\n wrapper.appendChild(this.element);\n switchInner.appendChild(onLabel);\n switchInner.appendChild(offLabel);\n wrapper.appendChild(switchInner);\n wrapper.appendChild(handle);\n if (isRippleEnabled) {\n var rippleSpan = createElement('span', { className: RIPPLE });\n handle.appendChild(rippleSpan);\n rippleEffect(rippleSpan, { duration: 400, isCenterRipple: true });\n }\n if (this.enableRtl) {\n wrapper.classList.add(RTL);\n }\n if (this.cssClass) {\n addClass([wrapper], this.cssClass.split(' '));\n }\n };\n /**\n * Called internally if any of the property value changes.\n * @private\n */\n Switch.prototype.onPropertyChanged = function (newProp, oldProp) {\n var wrapper = this.getWrapper();\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'checked':\n this.changeState(newProp.checked);\n break;\n case 'disabled':\n if (newProp.disabled) {\n this.setDisabled();\n this.unWireEvents();\n }\n else {\n this.element.disabled = false;\n wrapper.classList.remove(DISABLED);\n wrapper.setAttribute('aria-disabled', 'false');\n this.wireEvents();\n }\n break;\n case 'value':\n this.element.setAttribute('value', newProp.value);\n break;\n case 'name':\n this.element.setAttribute('name', newProp.name);\n break;\n case 'onLabel':\n case 'offLabel':\n this.setLabel(newProp.onLabel, newProp.offLabel);\n break;\n case 'enableRtl':\n if (newProp.enableRtl) {\n wrapper.classList.add(RTL);\n }\n else {\n wrapper.classList.remove(RTL);\n }\n break;\n case 'cssClass':\n if (oldProp.cssClass) {\n wrapper.classList.remove(oldProp.cssClass);\n }\n wrapper.classList.add(newProp.cssClass);\n break;\n }\n }\n };\n /**\n * Initialize Angular, React and Unique ID support.\n * @private\n */\n Switch.prototype.preRender = function () {\n var element = this.element;\n this.tagName = this.element.tagName;\n preRender(this, 'EJS-SWITCH', WRAPPER, element, this.getModuleName());\n };\n /**\n * Initialize control rendering.\n * @private\n */\n Switch.prototype.render = function () {\n this.initWrapper();\n this.initialize();\n if (!this.disabled) {\n this.wireEvents();\n }\n };\n Switch.prototype.rippleHandler = function (e) {\n var rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE)[0];\n rippleMouseHandler(e, rippleSpan);\n if (e.type === 'mousedown' && e.currentTarget.classList.contains('e-switch-wrapper') && e.which === 1) {\n this.isDrag = true;\n this.isKeyPressed = false;\n }\n };\n Switch.prototype.rippleTouchHandler = function (eventType) {\n var rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE)[0];\n if (rippleSpan) {\n var event_1 = document.createEvent('MouseEvents');\n event_1.initEvent(eventType, false, true);\n rippleSpan.dispatchEvent(event_1);\n }\n };\n Switch.prototype.setDisabled = function () {\n var wrapper = this.getWrapper();\n this.element.disabled = true;\n wrapper.classList.add(DISABLED);\n wrapper.setAttribute('aria-disabled', 'true');\n };\n Switch.prototype.setLabel = function (onText, offText) {\n var wrapper = this.getWrapper();\n if (onText) {\n wrapper.querySelector('.e-switch-on').textContent = onText;\n }\n if (offText) {\n wrapper.querySelector('.e-switch-off').textContent = offText;\n }\n };\n Switch.prototype.switchFocusHandler = function () {\n this.isKeyPressed = true;\n };\n Switch.prototype.switchMouseUp = function (e) {\n var target = e.target;\n var rippleSpan = this.getWrapper().getElementsByClassName(RIPPLE)[0];\n if (e.type === 'touchmove') {\n e.preventDefault();\n }\n if (e.type === 'touchstart') {\n this.isDrag = true;\n this.rippleTouchHandler('mousedown');\n }\n if (this.isDrag) {\n if ((e.type === 'mouseup' && target.className.indexOf('e-switch') < 0) || e.type === 'touchend') {\n this.clickHandler(e);\n this.rippleTouchHandler('mouseup');\n e.preventDefault();\n }\n }\n };\n /**\n * Toggle the Switch component state into checked/unchecked.\n * @returns void\n */\n Switch.prototype.toggle = function () {\n this.clickHandler();\n };\n Switch.prototype.wireEvents = function () {\n var wrapper = this.getWrapper();\n var handle = wrapper.querySelector('.e-switch-handle');\n EventHandler.add(wrapper, 'click', this.clickHandler, this);\n EventHandler.add(this.element, 'focus', this.focusHandler, this);\n EventHandler.add(this.element, 'focusout', this.focusOutHandler, this);\n EventHandler.add(document, 'mouseup', this.switchMouseUp, this);\n EventHandler.add(document, 'keydown', this.switchFocusHandler, this);\n EventHandler.add(wrapper, 'mousedown mouseup', this.rippleHandler, this);\n EventHandler.add(wrapper, 'touchstart touchmove touchend', this.switchMouseUp, this);\n };\n Switch.prototype.unWireEvents = function () {\n var wrapper = this.getWrapper();\n var handle = wrapper.querySelector('.e-switch-handle');\n EventHandler.remove(wrapper, 'click', this.clickHandler);\n EventHandler.remove(this.element, 'focus', this.focusHandler);\n EventHandler.remove(this.element, 'focusout', this.focusOutHandler);\n EventHandler.remove(document, 'mouseup', this.switchMouseUp);\n EventHandler.remove(document, 'keydown', this.switchFocusHandler);\n EventHandler.remove(wrapper, 'mousedown mouseup', this.rippleHandler);\n EventHandler.remove(wrapper, 'touchstart touchmove touchend', this.switchMouseUp);\n };\n __decorate([\n Event()\n ], Switch.prototype, \"change\", void 0);\n __decorate([\n Property(false)\n ], Switch.prototype, \"checked\", void 0);\n __decorate([\n Property('')\n ], Switch.prototype, \"cssClass\", void 0);\n __decorate([\n Property(false)\n ], Switch.prototype, \"disabled\", void 0);\n __decorate([\n Property('')\n ], Switch.prototype, \"name\", void 0);\n __decorate([\n Property('')\n ], Switch.prototype, \"onLabel\", void 0);\n __decorate([\n Property('')\n ], Switch.prototype, \"offLabel\", void 0);\n __decorate([\n Property('')\n ], Switch.prototype, \"value\", void 0);\n Switch = __decorate([\n NotifyPropertyChanges\n ], Switch);\n return Switch;\n}(Component));\nexport { Switch };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, Property, Event, Collection, L10n, Browser, Complex, compile } from '@syncfusion/ej2-base';\nimport { createElement, addClass, removeClass, detach, attributes, prepend, setStyleAttribute } from '@syncfusion/ej2-base';\nimport { NotifyPropertyChanges, ChildProperty } from '@syncfusion/ej2-base';\nimport { isNullOrUndefined, formatUnit, append } from '@syncfusion/ej2-base';\nimport { EventHandler } from '@syncfusion/ej2-base';\nimport { Draggable } from '@syncfusion/ej2-base';\nimport { Popup, PositionData, getZindexPartial } from '../popup/popup';\nimport { Button } from '@syncfusion/ej2-buttons';\nvar ButtonProps = /** @class */ (function (_super) {\n __extends(ButtonProps, _super);\n function ButtonProps() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property()\n ], ButtonProps.prototype, \"buttonModel\", void 0);\n __decorate([\n Property()\n ], ButtonProps.prototype, \"click\", void 0);\n return ButtonProps;\n}(ChildProperty));\nexport { ButtonProps };\n/**\n * Configures the animation properties for both open and close the dialog.\n */\nvar AnimationSettings = /** @class */ (function (_super) {\n __extends(AnimationSettings, _super);\n function AnimationSettings() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('Fade')\n ], AnimationSettings.prototype, \"effect\", void 0);\n __decorate([\n Property(400)\n ], AnimationSettings.prototype, \"duration\", void 0);\n __decorate([\n Property(0)\n ], AnimationSettings.prototype, \"delay\", void 0);\n return AnimationSettings;\n}(ChildProperty));\nexport { AnimationSettings };\nvar ROOT = 'e-dialog';\nvar RTL = 'e-rtl';\nvar DLG_HEADER_CONTENT = 'e-dlg-header-content';\nvar DLG_HEADER = 'e-dlg-header';\nvar DLG_FOOTER_CONTENT = 'e-footer-content';\nvar MODAL_DLG = 'e-dlg-modal';\nvar DLG_CONTENT = 'e-dlg-content';\nvar DLG_CLOSE_ICON = 'e-icon-dlg-close';\nvar DLG_OVERLAY = 'e-dlg-overlay';\nvar DLG_CONTAINER = 'e-dlg-container';\nvar SCROLL_DISABLED = 'e-scroll-disabled';\nvar DLG_PRIMARY_BUTTON = 'e-primary';\nvar ICON = 'e-icons';\nvar POPUP_ROOT = 'e-popup';\nvar DEVICE = 'e-device';\nvar FULLSCREEN = 'e-dlg-fullscreen';\nvar DLG_CLOSE_ICON_BTN = 'e-dlg-closeicon-btn';\nvar DLG_HIDE = 'e-popup-close';\nvar DLG_SHOW = 'e-popup-open';\n/**\n * Represents the dialog component that displays the information and get input from the user.\n * Two types of dialog components are `Modal and Modeless (non-modal)` depending on its interaction with parent application.\n * ```html\n * \n * ```\n * ```typescript\n * \n * ```\n */\nvar Dialog = /** @class */ (function (_super) {\n __extends(Dialog, _super);\n /**\n * Constructor for creating the widget\n * @hidden\n */\n function Dialog(options, element) {\n return _super.call(this, options, element) || this;\n }\n /**\n * Initialize the control rendering\n * @private\n */\n Dialog.prototype.render = function () {\n this.initialize();\n this.initRender();\n this.wireEvents();\n };\n /**\n * Initialize the event handler\n * @private\n */\n Dialog.prototype.preRender = function () {\n var _this = this;\n this.headerContent = null;\n var classArray = [];\n for (var j = 0; j < this.element.classList.length; j++) {\n if (!isNullOrUndefined(this.element.classList[j].match('e-control')) ||\n !isNullOrUndefined(this.element.classList[j].match(ROOT))) {\n classArray.push(this.element.classList[j]);\n }\n }\n removeClass([this.element], classArray);\n this.clonedEle = this.element.cloneNode(true);\n this.closeIconClickEventHandler = function (event) {\n _this.hide(event);\n };\n this.dlgOverlayClickEventHandler = function (event) {\n _this.trigger('overlayClick', event);\n };\n var localeText = { close: 'Close' };\n this.l10n = new L10n('dialog', localeText, this.locale);\n if (isNullOrUndefined(this.target)) {\n var prevOnChange = this.isProtectedOnChange;\n this.isProtectedOnChange = true;\n this.target = document.body;\n this.isProtectedOnChange = prevOnChange;\n }\n };\n ;\n /* istanbul ignore next */\n Dialog.prototype.keyDown = function (event) {\n var _this = this;\n if (event.keyCode === 9) {\n if (this.isModal) {\n var buttonObj = void 0;\n if (!isNullOrUndefined(this.btnObj)) {\n buttonObj = this.btnObj[this.btnObj.length - 1];\n }\n if (!isNullOrUndefined(buttonObj) && document.activeElement === buttonObj.element && !event.shiftKey) {\n event.preventDefault();\n this.focusableElements(this.element).focus();\n }\n if (document.activeElement === this.focusableElements(this.element) && event.shiftKey) {\n event.preventDefault();\n if (!isNullOrUndefined(buttonObj)) {\n buttonObj.element.focus();\n }\n }\n }\n }\n var element = document.activeElement;\n var isTagName = (['input', 'textarea'].indexOf(element.tagName.toLowerCase()) > -1);\n var isContentEdit = false;\n if (!isTagName) {\n isContentEdit = element.hasAttribute('contenteditable') && element.getAttribute('contenteditable') === 'true';\n }\n if (event.keyCode === 27 && this.closeOnEscape) {\n this.hide(event);\n }\n if ((event.keyCode === 13 && !event.ctrlKey && element.tagName.toLowerCase() !== 'textarea' &&\n isTagName && !isNullOrUndefined(this.primaryButtonEle)) ||\n (event.keyCode === 13 && event.ctrlKey && (element.tagName.toLowerCase() === 'textarea' ||\n isContentEdit)) && !isNullOrUndefined(this.primaryButtonEle)) {\n var buttonIndex_1;\n var firstPrimary = this.buttons.some(function (data, index) {\n buttonIndex_1 = index;\n var buttonModel = data.buttonModel;\n return !isNullOrUndefined(buttonModel) && buttonModel.isPrimary === true;\n });\n if (firstPrimary && typeof (this.buttons[buttonIndex_1].click) === 'function') {\n setTimeout(function () {\n _this.buttons[buttonIndex_1].click.call(_this, event);\n });\n }\n }\n };\n /**\n * Initialize the control rendering\n * @private\n */\n Dialog.prototype.initialize = function () {\n if (!isNullOrUndefined(this.target)) {\n this.targetEle = ((typeof this.target) === 'string') ?\n document.querySelector(this.target) : this.target;\n }\n addClass([this.element], ROOT);\n if (Browser.isDevice) {\n addClass([this.element], DEVICE);\n }\n this.setCSSClass();\n this.setMaxHeight();\n };\n /**\n * Initialize the rendering\n * @private\n */\n Dialog.prototype.initRender = function () {\n var _this = this;\n this.initialRender = true;\n attributes(this.element, { role: 'dialog' });\n if (this.zIndex === 1000) {\n this.zIndex = getZindexPartial(this.element);\n }\n this.setTargetContent();\n if (this.header !== '' && !isNullOrUndefined(this.header)) {\n this.setHeader();\n }\n if (this.showCloseIcon) {\n this.renderCloseIcon();\n }\n this.setContent();\n if (this.footerTemplate !== '' && !isNullOrUndefined(this.footerTemplate)) {\n this.setFooterTemplate();\n }\n else if (!isNullOrUndefined(this.buttons[0].buttonModel)) {\n this.setButton();\n }\n if (this.allowDragging && (!this.isModal) && (!isNullOrUndefined(this.headerContent))) {\n this.setAllowDragging();\n }\n attributes(this.element, { 'aria-modal': (this.isModal ? 'true' : 'false') });\n if (this.isModal) {\n this.setIsModal();\n }\n if (!isNullOrUndefined(this.targetEle)) {\n this.isModal ? this.targetEle.appendChild(this.dlgContainer) : this.targetEle.appendChild(this.element);\n }\n this.popupObj = new Popup(this.element, {\n height: this.height,\n width: this.width,\n zIndex: this.zIndex,\n relateTo: this.target,\n actionOnScroll: 'none',\n open: function (event) {\n _this.focusContent();\n var eventArgs = {\n container: _this.isModal ? _this.dlgContainer : _this.element,\n element: _this.element,\n target: _this.target\n };\n _this.trigger('open', eventArgs);\n },\n close: function (event) {\n _this.unBindEvent(_this.element);\n if (_this.isModal) {\n _this.dlgContainer.style.display = 'none';\n }\n _this.trigger('close', _this.closeArgs);\n if (!isNullOrUndefined(_this.storeActiveElement)) {\n _this.storeActiveElement.focus();\n }\n }\n });\n this.positionChange();\n this.setEnableRTL();\n addClass([this.element], DLG_HIDE);\n if (this.isModal) {\n this.setOverlayZindex();\n }\n if (this.visible) {\n this.show();\n }\n else {\n if (this.isModal) {\n this.dlgOverlay.style.display = 'none';\n }\n }\n this.initialRender = false;\n };\n Dialog.prototype.setOverlayZindex = function (zIndexValue) {\n var zIndex;\n if (isNullOrUndefined(zIndexValue)) {\n zIndex = parseInt(this.element.style.zIndex, 10) ? parseInt(this.element.style.zIndex, 10) : this.zIndex;\n }\n else {\n zIndex = zIndexValue;\n }\n this.dlgOverlay.style.zIndex = (zIndex - 1).toString();\n this.dlgContainer.style.zIndex = zIndex.toString();\n };\n Dialog.prototype.positionChange = function () {\n if (this.isModal) {\n this.dlgContainer.classList.add('e-dlg-' + this.position.X + '-' + this.position.Y);\n if (typeof (this.position.X) === 'number' && typeof (this.position.Y) === 'number') {\n this.setPopupPosition();\n }\n }\n else {\n this.setPopupPosition();\n }\n };\n Dialog.prototype.setPopupPosition = function () {\n this.popupObj.setProperties({\n position: {\n X: this.position.X, Y: this.position.Y\n }\n });\n };\n Dialog.prototype.setAllowDragging = function () {\n var _this = this;\n var handleContent = '.' + DLG_HEADER_CONTENT;\n this.dragObj = new Draggable(this.element, {\n clone: false,\n handle: handleContent,\n dragStart: function (event) {\n _this.trigger('dragStart', event);\n },\n dragStop: function (event) {\n _this.trigger('dragStop', event);\n },\n drag: function (event) {\n _this.trigger('drag', event);\n }\n });\n if (!isNullOrUndefined(this.targetEle)) {\n this.dragObj.dragArea = this.targetEle;\n }\n };\n Dialog.prototype.setButton = function () {\n this.buttonContent = [];\n this.btnObj = [];\n var primaryBtnFlag = true;\n for (var i = 0; i < this.buttons.length; i++) {\n var btn = createElement('button', { attrs: { type: 'button' } });\n this.buttonContent.push(btn.outerHTML);\n }\n this.setFooterTemplate();\n for (var i = 0; i < this.buttons.length; i++) {\n this.btnObj[i] = new Button(this.buttons[i].buttonModel);\n if (typeof (this.buttons[i].click) === 'function') {\n EventHandler.add(this.ftrTemplateContent.children[i], 'click', this.buttons[i].click, this);\n }\n this.btnObj[i].appendTo(this.ftrTemplateContent.children[i]);\n this.btnObj[i].element.classList.add('e-flat');\n this.primaryButtonEle = this.element.getElementsByClassName('e-primary')[0];\n }\n };\n Dialog.prototype.setContent = function () {\n attributes(this.element, { 'aria-describedby': this.element.id + '_dialog-content' });\n this.contentEle = createElement('div', { className: DLG_CONTENT, id: this.element.id + '_dialog-content' });\n if (this.innerContentElement) {\n this.contentEle.appendChild(this.innerContentElement);\n }\n else if (!isNullOrUndefined(this.content) && this.content !== '' || !this.initialRender) {\n if (typeof (this.content) === 'string') {\n this.contentEle.innerHTML = this.content;\n }\n else if (this.content instanceof HTMLElement) {\n this.contentEle.appendChild(this.content);\n }\n else {\n this.setTemplate(this.content, this.contentEle);\n }\n }\n if (!isNullOrUndefined(this.headerContent)) {\n this.element.insertBefore(this.contentEle, this.element.children[1]);\n }\n else {\n this.element.insertBefore(this.contentEle, this.element.children[0]);\n }\n if (this.height === 'auto') {\n this.setMaxHeight();\n }\n };\n Dialog.prototype.setTemplate = function (template, toElement) {\n var templateFn = compile(template);\n var fromElements = [];\n for (var _i = 0, _a = templateFn({}); _i < _a.length; _i++) {\n var item = _a[_i];\n fromElements.push(item);\n }\n append([].slice.call(fromElements), toElement);\n };\n Dialog.prototype.setMaxHeight = function () {\n var display = this.element.style.display;\n this.element.style.display = 'none';\n this.element.style.maxHeight = (!isNullOrUndefined(this.target)) ?\n (this.targetEle.offsetHeight - 20) + 'px' : (window.innerHeight - 20) + 'px';\n this.element.style.display = display;\n };\n Dialog.prototype.setEnableRTL = function () {\n this.enableRtl ? addClass([this.element], RTL) : removeClass([this.element], RTL);\n };\n Dialog.prototype.setTargetContent = function () {\n if (isNullOrUndefined(this.content) || this.content === '') {\n var isContent = this.element.innerHTML.replace(/\\s/g, '') !== '';\n if (this.element.children.length > 0 || isContent) {\n this.innerContentElement = document.createDocumentFragment();\n while (this.element.childNodes.length !== 0) {\n this.innerContentElement.appendChild(this.element.childNodes[0]);\n }\n }\n }\n };\n Dialog.prototype.setHeader = function () {\n if (this.headerEle) {\n this.headerEle.innerHTML = '';\n }\n else {\n this.headerEle = createElement('div', { id: this.element.id + '_title', className: DLG_HEADER });\n }\n this.createHeaderContent();\n this.headerContent.appendChild(this.headerEle);\n this.setTemplate(this.header, this.headerEle);\n attributes(this.element, { 'aria-labelledby': this.element.id + '_title' });\n this.element.insertBefore(this.headerContent, this.element.children[0]);\n };\n Dialog.prototype.setFooterTemplate = function () {\n if (this.ftrTemplateContent) {\n this.ftrTemplateContent.innerHTML = '';\n }\n else {\n this.ftrTemplateContent = createElement('div', {\n className: DLG_FOOTER_CONTENT\n });\n }\n if (this.footerTemplate !== '' && !isNullOrUndefined(this.footerTemplate)) {\n this.setTemplate(this.footerTemplate, this.ftrTemplateContent);\n }\n else {\n this.ftrTemplateContent.innerHTML = this.buttonContent.join('');\n }\n this.element.appendChild(this.ftrTemplateContent);\n };\n Dialog.prototype.createHeaderContent = function () {\n if (isNullOrUndefined(this.headerContent)) {\n this.headerContent = createElement('div', { className: DLG_HEADER_CONTENT });\n }\n };\n Dialog.prototype.renderCloseIcon = function () {\n this.closeIcon = createElement('button', { className: DLG_CLOSE_ICON_BTN, attrs: { type: 'button' } });\n this.closeIconBtnObj = new Button({ cssClass: 'e-flat', iconCss: DLG_CLOSE_ICON + ' ' + ICON });\n this.closeIconTitle();\n if (!isNullOrUndefined(this.headerContent)) {\n prepend([this.closeIcon], this.headerContent);\n }\n else {\n this.createHeaderContent();\n prepend([this.closeIcon], this.headerContent);\n this.element.insertBefore(this.headerContent, this.element.children[0]);\n }\n this.closeIconBtnObj.appendTo(this.closeIcon);\n };\n Dialog.prototype.closeIconTitle = function () {\n this.l10n.setLocale(this.locale);\n var closeIconTitle = this.l10n.getConstant('close');\n this.closeIcon.setAttribute('title', closeIconTitle);\n };\n Dialog.prototype.setCSSClass = function (oldCSSClass) {\n if (this.cssClass) {\n addClass([this.element], this.cssClass.split(' '));\n }\n if (oldCSSClass) {\n removeClass([this.element], oldCSSClass.split(' '));\n }\n };\n Dialog.prototype.setIsModal = function () {\n this.dlgContainer = createElement('div', { className: DLG_CONTAINER });\n this.element.classList.remove(DLG_SHOW);\n this.element.parentNode.insertBefore(this.dlgContainer, this.element);\n this.dlgContainer.appendChild(this.element);\n addClass([this.element], MODAL_DLG);\n this.dlgOverlay = createElement('div', { className: DLG_OVERLAY });\n this.dlgOverlay.style.zIndex = (this.zIndex - 1).toString();\n this.dlgContainer.appendChild(this.dlgOverlay);\n };\n Dialog.prototype.getValidFocusNode = function (items) {\n var node;\n for (var u = 0; u < items.length; u++) {\n node = items[u];\n if ((node.clientHeight > 0 || (node.tagName.toLowerCase() === 'a' && node.hasAttribute('href'))) && node.tabIndex > -1 &&\n !node.disabled && !this.disableElement(node, '[disabled],[aria-disabled=\"true\"],[type=\"hidden\"]')) {\n return node;\n }\n }\n return node;\n };\n Dialog.prototype.focusableElements = function (content) {\n if (!isNullOrUndefined(content)) {\n var value = 'input,select,textarea,button,a,[contenteditable=\"true\"],[tabindex]';\n var items = content.querySelectorAll(value);\n return this.getValidFocusNode(items);\n }\n return null;\n };\n Dialog.prototype.getAutoFocusNode = function (container) {\n var node = container.querySelector('.' + DLG_CLOSE_ICON_BTN);\n var value = '[autofocus]';\n var items = container.querySelectorAll(value);\n var validNode = this.getValidFocusNode(items);\n if (!isNullOrUndefined(validNode)) {\n node = validNode;\n }\n else {\n validNode = this.focusableElements(this.contentEle);\n if (!isNullOrUndefined(validNode)) {\n return node = validNode;\n }\n else if (!isNullOrUndefined(this.primaryButtonEle)) {\n return this.element.querySelector('.' + DLG_PRIMARY_BUTTON);\n }\n }\n return node;\n };\n Dialog.prototype.disableElement = function (element, t) {\n var elementMatch = element ? element.matches || element.webkitMatchesSelector || element.msMatchesSelector : null;\n if (elementMatch) {\n for (; element; element = element.parentNode) {\n if (element instanceof Element && elementMatch.call(element, t)) {\n /* istanbul ignore next */\n return element;\n }\n }\n }\n return null;\n };\n Dialog.prototype.focusContent = function () {\n var element = this.getAutoFocusNode(this.element);\n var node = !isNullOrUndefined(element) ? element : this.element;\n node.focus();\n this.bindEvent(this.element);\n };\n Dialog.prototype.bindEvent = function (element) {\n EventHandler.add(element, 'keydown', this.keyDown, this);\n };\n Dialog.prototype.unBindEvent = function (element) {\n EventHandler.remove(element, 'keydown', this.keyDown);\n };\n /**\n * Module required function\n * @private\n */\n Dialog.prototype.getModuleName = function () {\n return 'dialog';\n };\n /**\n * Called internally if any of the property value changed\n * @private\n */\n Dialog.prototype.onPropertyChanged = function (newProp, oldProp) {\n if (!this.element.classList.contains(ROOT)) {\n return;\n }\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'content':\n if (!isNullOrUndefined(this.content) && this.content !== '') {\n if (!isNullOrUndefined(this.contentEle) && this.contentEle.getAttribute('role') !== 'dialog') {\n this.contentEle.innerHTML = '';\n typeof (this.content) === 'string' ?\n this.contentEle.innerHTML = this.content : this.contentEle.appendChild(this.content);\n this.setMaxHeight();\n }\n else {\n this.setContent();\n }\n }\n else if (!isNullOrUndefined(this.contentEle)) {\n detach(this.contentEle);\n this.contentEle = null;\n }\n break;\n case 'header':\n if (this.header === '' || isNullOrUndefined(this.header)) {\n detach(this.headerEle);\n }\n else {\n this.setHeader();\n }\n break;\n case 'footerTemplate':\n if (this.footerTemplate === '' || isNullOrUndefined(this.footerTemplate)) {\n if (!this.ftrTemplateContent) {\n return;\n }\n detach(this.ftrTemplateContent);\n this.ftrTemplateContent = null;\n this.buttons = [{}];\n }\n else {\n this.setFooterTemplate();\n this.buttons = [{}];\n }\n break;\n case 'showCloseIcon':\n if (this.element.getElementsByClassName(DLG_CLOSE_ICON).length > 0) {\n if (!this.showCloseIcon && (this.header === '' || isNullOrUndefined(this.header))) {\n detach(this.headerContent);\n this.headerContent = null;\n }\n else if (!this.showCloseIcon) {\n detach(this.closeIcon);\n }\n }\n else {\n this.renderCloseIcon();\n this.wireEvents();\n }\n break;\n case 'locale':\n if (this.showCloseIcon) {\n this.closeIconTitle();\n }\n break;\n case 'visible':\n this.visible ? this.show() : this.hide();\n break;\n case 'isModal':\n this.updateIsModal();\n break;\n case 'height':\n setStyleAttribute(this.element, { 'height': formatUnit(newProp.height) });\n break;\n case 'width':\n setStyleAttribute(this.element, { 'width': formatUnit(newProp.width) });\n break;\n case 'zIndex':\n this.popupObj.zIndex = this.zIndex;\n if (this.isModal) {\n this.setOverlayZindex(this.zIndex);\n }\n break;\n case 'cssClass':\n this.setCSSClass(oldProp.cssClass);\n break;\n case 'buttons':\n if (!isNullOrUndefined(this.buttons[0].buttonModel)) {\n if (!isNullOrUndefined(this.ftrTemplateContent)) {\n detach(this.ftrTemplateContent);\n this.ftrTemplateContent = null;\n }\n this.footerTemplate = '';\n this.setButton();\n }\n break;\n case 'allowDragging':\n if (this.allowDragging && (!this.isModal) && (!isNullOrUndefined(this.headerContent))) {\n this.setAllowDragging();\n }\n else {\n this.dragObj.destroy();\n }\n break;\n case 'target':\n this.popupObj.relateTo = newProp.target;\n break;\n case 'position':\n this.positionChange();\n break;\n case 'enableRtl':\n this.setEnableRTL();\n break;\n }\n }\n };\n Dialog.prototype.updateIsModal = function () {\n this.element.setAttribute('aria-modal', this.isModal ? 'true' : 'false');\n if (this.isModal) {\n this.setIsModal();\n this.element.style.top = '0px';\n this.element.style.left = '0px';\n if (!isNullOrUndefined(this.targetEle)) {\n this.targetEle.appendChild(this.dlgContainer);\n }\n }\n else {\n removeClass([this.element], MODAL_DLG);\n removeClass([document.body], SCROLL_DISABLED);\n detach(this.dlgOverlay);\n while (this.dlgContainer.firstChild) {\n this.dlgContainer.parentElement.insertBefore(this.dlgContainer.firstChild, this.dlgContainer);\n }\n this.dlgContainer.parentElement.removeChild(this.dlgContainer);\n }\n if (this.visible) {\n this.show();\n }\n this.positionChange();\n };\n /**\n * Get the properties to be maintained in the persisted state.\n * @private\n */\n Dialog.prototype.getPersistData = function () {\n return this.addOnPersist([]);\n };\n /**\n * To destroy the widget\n * @method destroy\n * @return {void}\n * @memberof dialog\n */\n Dialog.prototype.destroy = function () {\n if (this.element.classList.contains(ROOT)) {\n this.unWireEvents();\n _super.prototype.destroy.call(this);\n var classArray = [\n ROOT, RTL, MODAL_DLG\n ];\n removeClass([this.element, this.element], classArray);\n if (this.popupObj.element.classList.contains(POPUP_ROOT)) {\n this.popupObj.destroy();\n }\n /* istanbul ignore next */\n if (!isNullOrUndefined(this.btnObj)) {\n for (var i = void 0; i < this.btnObj.length; i++) {\n this.btnObj[i].destroy();\n }\n }\n if (this.isModal) {\n detach(this.dlgOverlay);\n this.dlgContainer.parentNode.insertBefore(this.element, this.dlgContainer);\n detach(this.dlgContainer);\n }\n this.element.innerHTML = '';\n while (this.element.attributes.length > 0) {\n this.element.removeAttribute(this.element.attributes[0].name);\n }\n for (var k = 0; k < this.clonedEle.attributes.length; k++) {\n this.element.setAttribute(this.clonedEle.attributes[k].name, this.clonedEle.attributes[k].value);\n }\n }\n };\n /**\n * Binding event to the element while widget creation\n * @hidden\n */\n Dialog.prototype.wireEvents = function () {\n if (this.showCloseIcon) {\n EventHandler.add(this.closeIcon, 'click', this.closeIconClickEventHandler, this);\n }\n if (this.isModal) {\n EventHandler.add(this.dlgOverlay, 'click', this.dlgOverlayClickEventHandler, this);\n }\n };\n /**\n * Unbinding event to the element while widget destroy\n * @hidden\n */\n Dialog.prototype.unWireEvents = function () {\n if (this.showCloseIcon) {\n EventHandler.remove(this.closeIcon, 'click', this.closeIconClickEventHandler);\n }\n if (this.isModal) {\n EventHandler.remove(this.dlgOverlay, 'click', this.dlgOverlayClickEventHandler);\n }\n if (!isNullOrUndefined(this.buttons[0].buttonModel)) {\n for (var i = 0; i < this.buttons.length; i++) {\n if (typeof (this.buttons[i].click) === 'function') {\n EventHandler.remove(this.ftrTemplateContent.children[i], 'click', this.buttons[i].click);\n }\n }\n }\n };\n /**\n * Refreshes the dialog's position when the user changes its header and footer height/width dynamically.\n * @return {void}\n */\n Dialog.prototype.refreshPosition = function () {\n this.popupObj.refreshPosition();\n };\n /**\n * Opens the dialog if it is in hidden state.\n * To open the dialog with full screen width, set the parameter to true.\n * @param { boolean } isFullScreen - Enable the fullScreen Dialog.\n * @return {void}\n */\n Dialog.prototype.show = function (isFullScreen) {\n if (!this.element.classList.contains(ROOT)) {\n return;\n }\n if (!this.element.classList.contains(DLG_SHOW) || (!isNullOrUndefined(isFullScreen))) {\n if (!isNullOrUndefined(isFullScreen)) {\n this.fullScreen(isFullScreen);\n }\n var eventArgs = {\n cancel: false,\n element: this.element,\n container: this.isModal ? this.dlgContainer : this.element,\n target: this.target\n };\n this.trigger('beforeOpen', eventArgs);\n if (eventArgs.cancel) {\n return;\n }\n this.storeActiveElement = document.activeElement;\n this.element.tabIndex = -1;\n if (this.isModal && (!isNullOrUndefined(this.dlgOverlay))) {\n this.dlgOverlay.style.display = 'block';\n this.dlgContainer.style.display = 'flex';\n if (!isNullOrUndefined(this.targetEle)) {\n if (this.targetEle === document.body) {\n this.dlgContainer.style.position = 'fixed';\n }\n else {\n this.dlgContainer.style.position = 'absolute';\n }\n this.dlgOverlay.style.position = 'absolute';\n this.element.style.position = 'relative';\n addClass([this.targetEle], SCROLL_DISABLED);\n }\n else {\n addClass([document.body], SCROLL_DISABLED);\n }\n }\n var openAnimation = {\n name: this.animationSettings.effect + 'In',\n duration: this.animationSettings.duration,\n delay: this.animationSettings.delay\n };\n this.animationSettings.effect === 'None' ? this.popupObj.show() : this.popupObj.show(openAnimation);\n this.dialogOpen = true;\n var prevOnChange = this.isProtectedOnChange;\n this.isProtectedOnChange = true;\n this.visible = true;\n this.isProtectedOnChange = prevOnChange;\n }\n };\n /**\n * Closes the dialog if it is in visible state.\n * @return {void}\n */\n Dialog.prototype.hide = function (event) {\n if (!this.element.classList.contains(ROOT)) {\n return;\n }\n var eventArgs = {\n cancel: false,\n isInteraction: event ? true : false,\n element: this.element,\n target: this.target,\n container: this.isModal ? this.dlgContainer : this.element,\n event: event\n };\n this.trigger('beforeClose', eventArgs);\n this.closeArgs = eventArgs;\n if (eventArgs.cancel) {\n return;\n }\n if (this.isModal) {\n this.dlgOverlay.style.display = 'none';\n !isNullOrUndefined(this.targetEle) ? removeClass([this.targetEle], SCROLL_DISABLED) :\n removeClass([document.body], SCROLL_DISABLED);\n }\n var closeAnimation = {\n name: this.animationSettings.effect + 'Out',\n duration: this.animationSettings.duration,\n delay: this.animationSettings.delay\n };\n this.animationSettings.effect === 'None' ? this.popupObj.hide() : this.popupObj.hide(closeAnimation);\n this.dialogOpen = false;\n var prevOnChange = this.isProtectedOnChange;\n this.isProtectedOnChange = true;\n this.visible = false;\n this.isProtectedOnChange = prevOnChange;\n };\n /**\n * Specifies to view the Full screen Dialog.\n * @private\n */\n Dialog.prototype.fullScreen = function (args) {\n var top = this.element.offsetTop;\n var left = this.element.offsetLeft;\n if (args) {\n addClass([this.element], FULLSCREEN);\n var display = this.element.style.display;\n this.element.style.display = 'none';\n this.element.style.maxHeight = (!isNullOrUndefined(this.target)) ?\n (this.targetEle.offsetHeight) + 'px' : (window.innerHeight) + 'px';\n this.element.style.display = display;\n addClass([document.body], SCROLL_DISABLED);\n if (this.allowDragging && !isNullOrUndefined(this.dragObj)) {\n this.dragObj.destroy();\n }\n }\n else {\n removeClass([this.element], FULLSCREEN);\n removeClass([document.body], SCROLL_DISABLED);\n if (this.allowDragging && (!this.isModal) && (!isNullOrUndefined(this.headerContent))) {\n this.setAllowDragging();\n }\n }\n return args;\n };\n __decorate([\n Property('')\n ], Dialog.prototype, \"content\", void 0);\n __decorate([\n Property(false)\n ], Dialog.prototype, \"showCloseIcon\", void 0);\n __decorate([\n Property(false)\n ], Dialog.prototype, \"isModal\", void 0);\n __decorate([\n Property('')\n ], Dialog.prototype, \"header\", void 0);\n __decorate([\n Property(true)\n ], Dialog.prototype, \"visible\", void 0);\n __decorate([\n Property('auto')\n ], Dialog.prototype, \"height\", void 0);\n __decorate([\n Property('100%')\n ], Dialog.prototype, \"width\", void 0);\n __decorate([\n Property('')\n ], Dialog.prototype, \"cssClass\", void 0);\n __decorate([\n Property(1000)\n ], Dialog.prototype, \"zIndex\", void 0);\n __decorate([\n Property(null)\n ], Dialog.prototype, \"target\", void 0);\n __decorate([\n Property('')\n ], Dialog.prototype, \"footerTemplate\", void 0);\n __decorate([\n Property(false)\n ], Dialog.prototype, \"allowDragging\", void 0);\n __decorate([\n Collection([{}], ButtonProps)\n ], Dialog.prototype, \"buttons\", void 0);\n __decorate([\n Property(true)\n ], Dialog.prototype, \"closeOnEscape\", void 0);\n __decorate([\n Complex({}, AnimationSettings)\n ], Dialog.prototype, \"animationSettings\", void 0);\n __decorate([\n Complex({ X: 'center', Y: 'center' }, PositionData)\n ], Dialog.prototype, \"position\", void 0);\n __decorate([\n Event()\n ], Dialog.prototype, \"created\", void 0);\n __decorate([\n Event()\n ], Dialog.prototype, \"open\", void 0);\n __decorate([\n Event()\n ], Dialog.prototype, \"beforeOpen\", void 0);\n __decorate([\n Event()\n ], Dialog.prototype, \"close\", void 0);\n __decorate([\n Event()\n ], Dialog.prototype, \"beforeClose\", void 0);\n __decorate([\n Event()\n ], Dialog.prototype, \"dragStart\", void 0);\n __decorate([\n Event()\n ], Dialog.prototype, \"dragStop\", void 0);\n __decorate([\n Event()\n ], Dialog.prototype, \"drag\", void 0);\n __decorate([\n Event()\n ], Dialog.prototype, \"overlayClick\", void 0);\n Dialog = __decorate([\n NotifyPropertyChanges\n ], Dialog);\n return Dialog;\n}(Component));\nexport { Dialog };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, Property, ChildProperty, Event, append, compile } from '@syncfusion/ej2-base';\nimport { EventHandler, Touch, Browser, Animation as PopupAnimation } from '@syncfusion/ej2-base';\nimport { isNullOrUndefined, getUniqueID, formatUnit } from '@syncfusion/ej2-base';\nimport { attributes, createElement, closest, removeClass, addClass, remove } from '@syncfusion/ej2-base';\nimport { NotifyPropertyChanges, Complex } from '@syncfusion/ej2-base';\nimport { Popup } from '../popup/popup';\nimport { calculatePosition } from '../common/position';\nimport { isCollide, fit } from '../common/collision';\nvar TOUCHEND_HIDE_DELAY = 1500;\nvar TAPHOLD_THRESHOLD = 500;\nvar SHOW_POINTER_TIP_GAP = 0;\nvar HIDE_POINTER_TIP_GAP = 8;\nvar MOUSE_TRAIL_GAP = 2;\nvar POINTER_ADJUST = 2;\nvar ROOT = 'e-tooltip';\nvar RTL = 'e-rtl';\nvar DEVICE = 'e-bigger';\nvar ICON = 'e-icons';\nvar CLOSE = 'e-tooltip-close';\nvar TOOLTIP_WRAP = 'e-tooltip-wrap';\nvar CONTENT = 'e-tip-content';\nvar ARROW_TIP = 'e-arrow-tip';\nvar ARROW_TIP_OUTER = 'e-arrow-tip-outer';\nvar ARROW_TIP_INNER = 'e-arrow-tip-inner';\nvar TIP_BOTTOM = 'e-tip-bottom';\nvar TIP_TOP = 'e-tip-top';\nvar TIP_LEFT = 'e-tip-left';\nvar TIP_RIGHT = 'e-tip-right';\nvar POPUP_ROOT = 'e-popup';\nvar POPUP_OPEN = 'e-popup-open';\nvar POPUP_CLOSE = 'e-popup-close';\nvar Animation = /** @class */ (function (_super) {\n __extends(Animation, _super);\n function Animation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property({ effect: 'FadeIn', duration: 150, delay: 0 })\n ], Animation.prototype, \"open\", void 0);\n __decorate([\n Property({ effect: 'FadeOut', duration: 150, delay: 0 })\n ], Animation.prototype, \"close\", void 0);\n return Animation;\n}(ChildProperty));\nexport { Animation };\n/**\n * Represents the Tooltip component that displays a piece of information about the target element on mouse hover.\n * ```html\n *
Show Tooltip
\n * ```\n * ```typescript\n * \n * ```\n */\nvar Tooltip = /** @class */ (function (_super) {\n __extends(Tooltip, _super);\n /**\n * Constructor for creating the Tooltip Component\n */\n function Tooltip(options, element) {\n return _super.call(this, options, element) || this;\n }\n Tooltip.prototype.initialize = function () {\n this.formatPosition();\n addClass([this.element], ROOT);\n };\n Tooltip.prototype.formatPosition = function () {\n if (this.position.indexOf('Top') === 0 || this.position.indexOf('Bottom') === 0) {\n _a = this.position.split(/(?=[A-Z])/), this.tooltipPositionY = _a[0], this.tooltipPositionX = _a[1];\n }\n else {\n _b = this.position.split(/(?=[A-Z])/), this.tooltipPositionX = _b[0], this.tooltipPositionY = _b[1];\n }\n var _a, _b;\n };\n Tooltip.prototype.renderArrow = function () {\n this.setTipClass(this.position);\n var tip = createElement('div', { className: ARROW_TIP + ' ' + this.tipClass });\n tip.appendChild(createElement('div', { className: ARROW_TIP_OUTER + ' ' + this.tipClass }));\n tip.appendChild(createElement('div', { className: ARROW_TIP_INNER + ' ' + this.tipClass }));\n this.tooltipEle.appendChild(tip);\n };\n Tooltip.prototype.setTipClass = function (position) {\n if (position.indexOf('Right') === 0) {\n this.tipClass = TIP_LEFT;\n }\n else if (position.indexOf('Bottom') === 0) {\n this.tipClass = TIP_TOP;\n }\n else if (position.indexOf('Left') === 0) {\n this.tipClass = TIP_RIGHT;\n }\n else {\n this.tipClass = TIP_BOTTOM;\n }\n };\n Tooltip.prototype.renderPopup = function (target) {\n var elePos = this.mouseTrail ? { top: 0, left: 0 } : this.getTooltipPosition(target);\n this.popupObj = new Popup(this.tooltipEle, {\n height: this.height,\n width: this.width,\n position: {\n X: elePos.left,\n Y: elePos.top\n },\n enableRtl: this.enableRtl,\n open: this.openPopupHandler.bind(this),\n close: this.closePopupHandler.bind(this)\n });\n };\n Tooltip.prototype.getTooltipPosition = function (target) {\n this.tooltipEle.style.display = 'none';\n var pos = calculatePosition(target, this.tooltipPositionX, this.tooltipPositionY);\n this.tooltipEle.style.display = '';\n var offsetPos = this.calculateTooltipOffset(this.position);\n var elePos = this.collisionFlipFit(target, pos.left + offsetPos.left, pos.top + offsetPos.top);\n return elePos;\n };\n Tooltip.prototype.reposition = function (target) {\n var elePos = this.getTooltipPosition(target);\n this.popupObj.position = { X: elePos.left, Y: elePos.top };\n this.popupObj.dataBind();\n };\n Tooltip.prototype.openPopupHandler = function () {\n this.trigger('afterOpen', this.tooltipEventArgs);\n };\n Tooltip.prototype.closePopupHandler = function () {\n this.clear();\n this.trigger('afterClose', this.tooltipEventArgs);\n };\n Tooltip.prototype.calculateTooltipOffset = function (position) {\n var pos = { top: 0, left: 0 };\n var tooltipEleWidth = this.tooltipEle.offsetWidth;\n var tooltipEleHeight = this.tooltipEle.offsetHeight;\n var arrowEle = this.tooltipEle.querySelector('.' + ARROW_TIP);\n var tipWidth = arrowEle ? arrowEle.offsetWidth : 0;\n var tipHeight = arrowEle ? arrowEle.offsetHeight : 0;\n var tipAdjust = (this.showTipPointer ? SHOW_POINTER_TIP_GAP : HIDE_POINTER_TIP_GAP);\n var tipHeightAdjust = (tipHeight / 2) + POINTER_ADJUST + (this.tooltipEle.offsetHeight - this.tooltipEle.clientHeight);\n var tipWidthAdjust = (tipWidth / 2) + POINTER_ADJUST + (this.tooltipEle.offsetWidth - this.tooltipEle.clientWidth);\n if (this.mouseTrail) {\n tipAdjust += MOUSE_TRAIL_GAP;\n }\n switch (position) {\n case 'RightTop':\n pos.left += tipWidth + tipAdjust;\n pos.top -= tooltipEleHeight - tipHeightAdjust;\n break;\n case 'RightCenter':\n pos.left += tipWidth + tipAdjust;\n pos.top -= (tooltipEleHeight / 2);\n break;\n case 'RightBottom':\n pos.left += tipWidth + tipAdjust;\n pos.top -= (tipHeightAdjust);\n break;\n case 'BottomRight':\n pos.top += (tipHeight + tipAdjust);\n pos.left -= (tipWidthAdjust);\n break;\n case 'BottomCenter':\n pos.top += (tipHeight + tipAdjust);\n pos.left -= (tooltipEleWidth / 2);\n break;\n case 'BottomLeft':\n pos.top += (tipHeight + tipAdjust);\n pos.left -= (tooltipEleWidth - tipWidthAdjust);\n break;\n case 'LeftBottom':\n pos.left -= (tipWidth + tooltipEleWidth + tipAdjust);\n pos.top -= (tipHeightAdjust);\n break;\n case 'LeftCenter':\n pos.left -= (tipWidth + tooltipEleWidth + tipAdjust);\n pos.top -= (tooltipEleHeight / 2);\n break;\n case 'LeftTop':\n pos.left -= (tipWidth + tooltipEleWidth + tipAdjust);\n pos.top -= (tooltipEleHeight - tipHeightAdjust);\n break;\n case 'TopLeft':\n pos.top -= (tooltipEleHeight + tipHeight + tipAdjust);\n pos.left -= (tooltipEleWidth - tipWidthAdjust);\n break;\n case 'TopRight':\n pos.top -= (tooltipEleHeight + tipHeight + tipAdjust);\n pos.left -= (tipWidthAdjust);\n break;\n default:\n pos.top -= (tooltipEleHeight + tipHeight + tipAdjust);\n pos.left -= (tooltipEleWidth / 2);\n break;\n }\n pos.left += this.offsetX;\n pos.top += this.offsetY;\n return pos;\n };\n Tooltip.prototype.updateTipPosition = function (position) {\n var selEle = this.tooltipEle.querySelectorAll('.' + ARROW_TIP + ',.' + ARROW_TIP_OUTER + ',.' + ARROW_TIP_INNER);\n var removeList = [TIP_BOTTOM, TIP_TOP, TIP_LEFT, TIP_RIGHT];\n removeClass(selEle, removeList);\n this.setTipClass(position);\n addClass(selEle, this.tipClass);\n };\n Tooltip.prototype.adjustArrow = function (target, position, tooltipPositionX, tooltipPositionY) {\n if (this.showTipPointer === false) {\n return;\n }\n this.updateTipPosition(position);\n var leftValue;\n var topValue;\n var tooltipWidth = this.tooltipEle.clientWidth;\n var tooltipHeight = this.tooltipEle.clientHeight;\n var arrowEle = this.tooltipEle.querySelector('.' + ARROW_TIP);\n var arrowInnerELe = this.tooltipEle.querySelector('.' + ARROW_TIP_INNER);\n var tipWidth = arrowEle.offsetWidth;\n var tipHeight = arrowEle.offsetHeight;\n if (this.tipClass === TIP_BOTTOM || this.tipClass === TIP_TOP) {\n if (this.tipClass === TIP_BOTTOM) {\n topValue = '99.9%';\n // Arrow icon aligned -2px height from ArrowOuterTip div\n arrowInnerELe.style.top = '-' + (tipHeight - 2) + 'px';\n }\n else {\n topValue = -(tipHeight - 1) + 'px';\n // Arrow icon aligned -6px height from ArrowOuterTip div\n arrowInnerELe.style.top = '-' + (tipHeight - 6) + 'px';\n }\n var tipPosExclude = tooltipPositionX !== 'Center' || (tooltipWidth > target.offsetWidth) || this.mouseTrail;\n if ((tipPosExclude && tooltipPositionX === 'Left') || (!tipPosExclude && this.tipPointerPosition === 'End')) {\n leftValue = (tooltipWidth - tipWidth - POINTER_ADJUST) + 'px';\n }\n else if ((tipPosExclude && tooltipPositionX === 'Right') || (!tipPosExclude && this.tipPointerPosition === 'Start')) {\n leftValue = POINTER_ADJUST + 'px';\n }\n else {\n leftValue = ((tooltipWidth / 2) - (tipWidth / 2)) + 'px';\n }\n }\n else {\n if (this.tipClass === TIP_RIGHT) {\n leftValue = '99.9%';\n // Arrow icon aligned -2px left from ArrowOuterTip div\n arrowInnerELe.style.left = '-' + (tipWidth - 2) + 'px';\n }\n else {\n leftValue = -(tipWidth - 1) + 'px';\n // Arrow icon aligned -2px from ArrowOuterTip width\n arrowInnerELe.style.left = (-(tipWidth) + (tipWidth - 2)) + 'px';\n }\n var tipPosExclude = tooltipPositionY !== 'Center' || (tooltipHeight > target.offsetHeight) || this.mouseTrail;\n if ((tipPosExclude && tooltipPositionY === 'Top') || (!tipPosExclude && this.tipPointerPosition === 'End')) {\n topValue = (tooltipHeight - tipHeight - POINTER_ADJUST) + 'px';\n }\n else if ((tipPosExclude && tooltipPositionY === 'Bottom') || (!tipPosExclude && this.tipPointerPosition === 'Start')) {\n topValue = POINTER_ADJUST + 'px';\n }\n else {\n topValue = ((tooltipHeight / 2) - (tipHeight / 2)) + 'px';\n }\n }\n arrowEle.style.top = topValue;\n arrowEle.style.left = leftValue;\n };\n Tooltip.prototype.renderContent = function (target) {\n var tooltipContent = this.tooltipEle.querySelector('.' + CONTENT);\n if (target && !isNullOrUndefined(target.getAttribute('title'))) {\n target.setAttribute('data-content', target.getAttribute('title'));\n target.removeAttribute('title');\n }\n if (!isNullOrUndefined(this.content)) {\n tooltipContent.innerHTML = '';\n if (this.content instanceof HTMLElement) {\n tooltipContent.appendChild(this.content);\n }\n else if (typeof this.content === 'string') {\n tooltipContent.innerHTML = this.content;\n }\n else {\n var templateFunction = compile(this.content);\n append(templateFunction(), tooltipContent);\n }\n }\n else {\n if (target && !isNullOrUndefined(target.getAttribute('data-content'))) {\n tooltipContent.innerHTML = target.getAttribute('data-content');\n }\n }\n };\n Tooltip.prototype.renderCloseIcon = function () {\n if (!this.isSticky) {\n return;\n }\n var tipClose = createElement('div', { className: ICON + ' ' + CLOSE });\n this.tooltipEle.appendChild(tipClose);\n EventHandler.add(tipClose, Browser.touchStartEvent, this.onStickyClose, this);\n };\n Tooltip.prototype.addDescribedBy = function (target, id) {\n var describedby = (target.getAttribute('aria-describedby') || '').split(/\\s+/);\n if (describedby.indexOf(id) < 0) {\n describedby.push(id);\n }\n attributes(target, { 'aria-describedby': describedby.join(' ').trim(), 'data-tooltip-id': id });\n };\n Tooltip.prototype.removeDescribedBy = function (target) {\n var id = target.getAttribute('data-tooltip-id');\n var describedby = (target.getAttribute('aria-describedby') || '').split(/\\s+/);\n var index = describedby.indexOf(id);\n if (index !== -1) {\n describedby.splice(index, 1);\n }\n target.removeAttribute('data-tooltip-id');\n var orgdescribedby = describedby.join(' ').trim();\n if (orgdescribedby) {\n target.setAttribute('aria-describedby', orgdescribedby);\n }\n else {\n target.removeAttribute('aria-describedby');\n }\n };\n Tooltip.prototype.tapHoldHandler = function (evt) {\n clearTimeout(this.autoCloseTimer);\n this.targetHover(evt.originalEvent);\n };\n Tooltip.prototype.touchEndHandler = function (e) {\n var _this = this;\n if (this.isSticky) {\n return;\n }\n var close = function () {\n _this.close();\n };\n this.autoCloseTimer = setTimeout(close, TOUCHEND_HIDE_DELAY);\n };\n Tooltip.prototype.targetClick = function (e) {\n var target;\n if (this.target) {\n target = closest(e.target, this.target);\n }\n else {\n target = this.element;\n }\n if (isNullOrUndefined(target)) {\n return;\n }\n if (target.getAttribute('data-tooltip-id') === null) {\n this.targetHover(e);\n }\n else if (!this.isSticky) {\n this.hideTooltip(this.animation.close, e, target);\n }\n };\n Tooltip.prototype.targetHover = function (e) {\n var target;\n if (this.target) {\n target = closest(e.target, this.target);\n }\n else {\n target = this.element;\n }\n if (isNullOrUndefined(target) || target.getAttribute('data-tooltip-id') !== null) {\n return;\n }\n var targetList = [].slice.call(document.querySelectorAll('[data-tooltip-id= ' + this.ctrlId + '_content]'));\n for (var _i = 0, targetList_1 = targetList; _i < targetList_1.length; _i++) {\n var target_1 = targetList_1[_i];\n this.restoreElement(target_1);\n }\n this.showTooltip(target, this.animation.open, e);\n this.wireMouseEvents(e, target);\n };\n Tooltip.prototype.showTooltip = function (target, showAnimation, e) {\n var _this = this;\n clearTimeout(this.showTimer);\n clearTimeout(this.hideTimer);\n this.tooltipEventArgs = e ? { type: e.type, cancel: false, target: target, event: e, element: this.tooltipEle } :\n { type: null, cancel: false, target: target, event: null, element: this.tooltipEle };\n this.trigger('beforeRender', this.tooltipEventArgs);\n if (this.tooltipEventArgs.cancel) {\n this.isHidden = true;\n this.clear();\n return;\n }\n this.isHidden = false;\n if (isNullOrUndefined(this.tooltipEle)) {\n this.ctrlId = this.element.getAttribute('id') ? getUniqueID(this.element.getAttribute('id')) : getUniqueID('tooltip');\n this.tooltipEle = createElement('div', {\n className: TOOLTIP_WRAP + ' ' + POPUP_ROOT, attrs: {\n role: 'tooltip', 'aria-hidden': 'false', 'id': this.ctrlId + '_content'\n }, styles: 'width:' + formatUnit(this.width) + ';height:' + formatUnit(this.height) + ';position:absolute;'\n });\n if (this.cssClass) {\n addClass([this.tooltipEle], this.cssClass.split(' '));\n }\n if (Browser.isDevice) {\n addClass([this.tooltipEle], DEVICE);\n }\n if (this.width !== 'auto') {\n this.tooltipEle.style.maxWidth = formatUnit(this.width);\n }\n this.tooltipEle.appendChild(createElement('div', { className: CONTENT }));\n document.body.appendChild(this.tooltipEle);\n this.addDescribedBy(target, this.ctrlId + '_content');\n this.renderContent(target);\n addClass([this.tooltipEle], POPUP_OPEN);\n if (this.showTipPointer) {\n this.renderArrow();\n }\n this.renderCloseIcon();\n this.renderPopup(target);\n }\n else {\n this.adjustArrow(target, this.position, this.tooltipPositionX, this.tooltipPositionY);\n this.addDescribedBy(target, this.ctrlId + '_content');\n this.renderContent(target);\n PopupAnimation.stop(this.tooltipEle);\n this.reposition(target);\n }\n removeClass([this.tooltipEle], POPUP_OPEN);\n addClass([this.tooltipEle], POPUP_CLOSE);\n this.tooltipEventArgs = e ? { type: e.type, cancel: false, target: target, event: e, element: this.tooltipEle } :\n { type: null, cancel: false, target: target, event: null, element: this.tooltipEle };\n this.trigger('beforeOpen', this.tooltipEventArgs);\n if (this.tooltipEventArgs.cancel) {\n this.isHidden = true;\n this.clear();\n return;\n }\n var openAnimation = {\n name: showAnimation.effect, duration: showAnimation.duration, delay: showAnimation.delay, timingFunction: 'easeOut'\n };\n if (showAnimation.effect === 'None') {\n openAnimation = undefined;\n }\n if (this.openDelay > 0) {\n var show = function () {\n if (_this.popupObj) {\n _this.popupObj.show(openAnimation);\n }\n };\n this.showTimer = setTimeout(show, this.openDelay);\n }\n else {\n this.popupObj.show(openAnimation);\n }\n };\n Tooltip.prototype.checkCollision = function (target, x, y) {\n var elePos = {\n left: x, top: y, position: this.position,\n horizontal: this.tooltipPositionX, vertical: this.tooltipPositionY\n };\n var affectedPos = isCollide(this.tooltipEle, (this.target ? this.element : null), x, y);\n if (affectedPos.length > 0) {\n elePos.horizontal = affectedPos.indexOf('left') >= 0 ? 'Right' : affectedPos.indexOf('right') >= 0 ? 'Left' :\n this.tooltipPositionX;\n elePos.vertical = affectedPos.indexOf('top') >= 0 ? 'Bottom' : affectedPos.indexOf('bottom') >= 0 ? 'Top' :\n this.tooltipPositionY;\n }\n return elePos;\n };\n Tooltip.prototype.collisionFlipFit = function (target, x, y) {\n var elePos = this.checkCollision(target, x, y);\n var newpos = elePos.position;\n if (this.tooltipPositionY !== elePos.vertical) {\n newpos = ((this.position.indexOf('Bottom') === 0 || this.position.indexOf('Top') === 0) ?\n elePos.vertical + this.tooltipPositionX : this.tooltipPositionX + elePos.vertical);\n }\n if (this.tooltipPositionX !== elePos.horizontal) {\n if (newpos.indexOf('Left') === 0) {\n elePos.vertical = (newpos === 'LeftTop' || newpos === 'LeftCenter') ? 'Top' : 'Bottom';\n newpos = (elePos.vertical + 'Left');\n }\n if (newpos.indexOf('Right') === 0) {\n elePos.vertical = (newpos === 'RightTop' || newpos === 'RightCenter') ? 'Top' : 'Bottom';\n newpos = (elePos.vertical + 'Right');\n }\n elePos.horizontal = this.tooltipPositionX;\n }\n this.tooltipEventArgs = {\n type: null, cancel: false, target: target, event: null,\n element: this.tooltipEle, collidedPosition: newpos\n };\n this.trigger('beforeCollision', this.tooltipEventArgs);\n if (elePos.position !== newpos) {\n var pos = calculatePosition(target, this.tooltipPositionX, elePos.vertical);\n this.adjustArrow(target, newpos, elePos.horizontal, elePos.vertical);\n var offsetPos = this.calculateTooltipOffset(newpos);\n elePos.position = newpos;\n elePos.left = pos.left + offsetPos.left;\n elePos.top = pos.top + offsetPos.top;\n }\n else {\n this.adjustArrow(target, newpos, elePos.horizontal, elePos.vertical);\n }\n var eleOffset = { left: elePos.left, top: elePos.top };\n var left = fit(this.tooltipEle, (this.target ? this.element : null), { X: true, Y: false }, eleOffset).left;\n if (this.showTipPointer && (newpos.indexOf('Bottom') === 0 || newpos.indexOf('Top') === 0)) {\n var arrowEle = this.tooltipEle.querySelector('.' + ARROW_TIP);\n var arrowleft = parseInt(arrowEle.style.left, 10) - (left - elePos.left);\n if (arrowleft < 0) {\n arrowleft = 0;\n }\n else if ((arrowleft + arrowEle.offsetWidth) > this.tooltipEle.clientWidth) {\n arrowleft = this.tooltipEle.clientWidth - arrowEle.offsetWidth;\n }\n arrowEle.style.left = arrowleft.toString() + 'px';\n }\n eleOffset.left = left;\n return eleOffset;\n };\n Tooltip.prototype.hideTooltip = function (hideAnimation, e, targetElement) {\n var _this = this;\n var target;\n if (e) {\n target = this.target ? (targetElement || e.target) : this.element;\n this.tooltipEventArgs = {\n type: e.type, cancel: false, target: target, event: e, element: this.tooltipEle\n };\n }\n else {\n target = document.querySelector('[data-tooltip-id= ' + this.ctrlId + '_content]');\n this.tooltipEventArgs = {\n type: null, cancel: false, target: target, event: null, element: this.tooltipEle\n };\n }\n if (isNullOrUndefined(target)) {\n return;\n }\n this.trigger('beforeClose', this.tooltipEventArgs);\n if (!this.tooltipEventArgs.cancel) {\n this.restoreElement(target);\n this.isHidden = true;\n var closeAnimation_1 = {\n name: hideAnimation.effect, duration: hideAnimation.duration, delay: hideAnimation.delay, timingFunction: 'easeIn'\n };\n if (hideAnimation.effect === 'None') {\n closeAnimation_1 = undefined;\n }\n if (this.closeDelay > 0) {\n var hide = function () {\n if (_this.popupObj) {\n _this.popupObj.hide(closeAnimation_1);\n }\n };\n this.hideTimer = setTimeout(hide, this.closeDelay);\n }\n else {\n this.popupObj.hide(closeAnimation_1);\n }\n }\n else {\n this.isHidden = false;\n }\n };\n Tooltip.prototype.restoreElement = function (target) {\n this.unwireMouseEvents(target);\n if (!isNullOrUndefined(target.getAttribute('data-content'))) {\n target.setAttribute('title', target.getAttribute('data-content'));\n target.removeAttribute('data-content');\n }\n this.removeDescribedBy(target);\n };\n Tooltip.prototype.clear = function () {\n if (this.tooltipEle) {\n removeClass([this.tooltipEle], POPUP_CLOSE);\n addClass([this.tooltipEle], POPUP_OPEN);\n }\n if (this.isHidden) {\n if (this.popupObj) {\n this.popupObj.destroy();\n }\n if (this.tooltipEle) {\n remove(this.tooltipEle);\n }\n this.tooltipEle = null;\n this.popupObj = null;\n }\n };\n Tooltip.prototype.onMouseOut = function (e) {\n this.hideTooltip(this.animation.close, e);\n };\n Tooltip.prototype.onStickyClose = function (e) {\n this.close();\n };\n Tooltip.prototype.onMouseMove = function (event) {\n var eventPageX = 0;\n var eventPageY = 0;\n if (event.type.indexOf('touch') > -1) {\n event.preventDefault();\n eventPageX = event.touches[0].pageX;\n eventPageY = event.touches[0].pageY;\n }\n else {\n eventPageX = event.pageX;\n eventPageY = event.pageY;\n }\n PopupAnimation.stop(this.tooltipEle);\n removeClass([this.tooltipEle], POPUP_CLOSE);\n addClass([this.tooltipEle], POPUP_OPEN);\n this.adjustArrow(event.target, this.position, this.tooltipPositionX, this.tooltipPositionY);\n var pos = this.calculateTooltipOffset(this.position);\n var x = eventPageX + pos.left + this.offsetX;\n var y = eventPageY + pos.top + this.offsetY;\n var elePos = this.checkCollision(event.target, x, y);\n if (this.tooltipPositionX !== elePos.horizontal || this.tooltipPositionY !== elePos.vertical) {\n var newpos = (this.position.indexOf('Bottom') === 0 || this.position.indexOf('Top') === 0) ?\n elePos.vertical + elePos.horizontal : elePos.horizontal + elePos.vertical;\n elePos.position = newpos;\n this.adjustArrow(event.target, elePos.position, elePos.horizontal, elePos.vertical);\n var colpos = this.calculateTooltipOffset(elePos.position);\n elePos.left = eventPageX + colpos.left - this.offsetX;\n elePos.top = eventPageY + colpos.top - this.offsetY;\n }\n this.tooltipEle.style.left = elePos.left + 'px';\n this.tooltipEle.style.top = elePos.top + 'px';\n };\n Tooltip.prototype.keyDown = function (event) {\n if (this.tooltipEle && event.keyCode === 27) {\n this.close();\n }\n };\n Tooltip.prototype.touchEnd = function (e) {\n if (this.tooltipEle && closest(e.target, '.' + ROOT) === null) {\n this.close();\n }\n };\n Tooltip.prototype.scrollHandler = function (e) {\n if (this.tooltipEle) {\n this.close();\n }\n };\n /**\n * Core method that initializes the control rendering.\n * @private\n */\n Tooltip.prototype.render = function () {\n this.initialize();\n this.wireEvents(this.opensOn);\n };\n /**\n * Initializes the values of private members.\n * @private\n */\n Tooltip.prototype.preRender = function () {\n this.tipClass = TIP_BOTTOM;\n this.tooltipPositionX = 'Center';\n this.tooltipPositionY = 'Top';\n this.isHidden = true;\n };\n /**\n * Binding events to the Tooltip element.\n * @hidden\n */\n Tooltip.prototype.wireEvents = function (trigger) {\n var triggerList = this.getTriggerList(trigger);\n for (var _i = 0, triggerList_1 = triggerList; _i < triggerList_1.length; _i++) {\n var opensOn = triggerList_1[_i];\n if (opensOn === 'Custom') {\n return;\n }\n if (opensOn === 'Focus') {\n this.wireFocusEvents();\n }\n if (opensOn === 'Click') {\n EventHandler.add(this.element, Browser.touchStartEvent, this.targetClick, this);\n }\n if (opensOn === 'Hover') {\n if (Browser.isDevice) {\n this.touchModule = new Touch(this.element, {\n tapHoldThreshold: TAPHOLD_THRESHOLD,\n tapHold: this.tapHoldHandler.bind(this)\n });\n EventHandler.add(this.element, Browser.touchEndEvent, this.touchEndHandler, this);\n }\n else {\n EventHandler.add(this.element, 'mouseover', this.targetHover, this);\n }\n }\n }\n EventHandler.add(document, 'touchend', this.touchEnd, this);\n EventHandler.add(document, 'scroll', this.scrollHandler, this);\n EventHandler.add(document, 'keydown', this.keyDown, this);\n };\n Tooltip.prototype.getTriggerList = function (trigger) {\n if (trigger === 'Auto') {\n trigger = (Browser.isDevice) ? 'Hover' : 'Hover Focus';\n }\n return trigger.split(' ');\n };\n Tooltip.prototype.wireFocusEvents = function () {\n if (!isNullOrUndefined(this.target)) {\n var targetList = [].slice.call(this.element.querySelectorAll(this.target));\n for (var _i = 0, targetList_2 = targetList; _i < targetList_2.length; _i++) {\n var target = targetList_2[_i];\n EventHandler.add(target, 'focus', this.targetHover, this);\n }\n }\n else {\n EventHandler.add(this.element, 'focus', this.targetHover, this);\n }\n };\n Tooltip.prototype.wireMouseEvents = function (e, target) {\n if (this.tooltipEle) {\n if (!this.isSticky) {\n if (e.type === 'focus') {\n EventHandler.add(target, 'blur', this.onMouseOut, this);\n }\n if (e.type === 'mouseover') {\n EventHandler.add(target, 'mouseleave', this.onMouseOut, this);\n }\n }\n if (this.mouseTrail) {\n EventHandler.add(target, 'mousemove touchstart mouseenter', this.onMouseMove, this);\n }\n }\n };\n /**\n * Unbinding events from the element on widget destroy.\n * @hidden\n */\n Tooltip.prototype.unwireEvents = function (trigger) {\n var triggerList = this.getTriggerList(trigger);\n for (var _i = 0, triggerList_2 = triggerList; _i < triggerList_2.length; _i++) {\n var opensOn = triggerList_2[_i];\n if (opensOn === 'Custom') {\n return;\n }\n if (opensOn === 'Focus') {\n this.unwireFocusEvents();\n }\n if (opensOn === 'Click') {\n EventHandler.remove(this.element, Browser.touchStartEvent, this.targetClick);\n }\n if (opensOn === 'Hover') {\n if (Browser.isDevice) {\n if (this.touchModule) {\n this.touchModule.destroy();\n }\n EventHandler.remove(this.element, Browser.touchEndEvent, this.touchEndHandler);\n }\n else {\n EventHandler.remove(this.element, 'mouseover', this.targetHover);\n }\n }\n }\n EventHandler.remove(document, 'touchend', this.touchEnd);\n EventHandler.remove(document, 'scroll', this.scrollHandler);\n EventHandler.remove(document, 'keydown', this.keyDown);\n };\n Tooltip.prototype.unwireFocusEvents = function () {\n if (!isNullOrUndefined(this.target)) {\n var targetList = [].slice.call(this.element.querySelectorAll(this.target));\n for (var _i = 0, targetList_3 = targetList; _i < targetList_3.length; _i++) {\n var target = targetList_3[_i];\n EventHandler.remove(target, 'focus', this.targetHover);\n }\n }\n else {\n EventHandler.remove(this.element, 'focus', this.targetHover);\n }\n };\n Tooltip.prototype.unwireMouseEvents = function (target) {\n if (!this.isSticky) {\n var triggerList = this.getTriggerList(this.opensOn);\n for (var _i = 0, triggerList_3 = triggerList; _i < triggerList_3.length; _i++) {\n var opensOn = triggerList_3[_i];\n if (opensOn === 'Focus') {\n EventHandler.remove(target, 'blur', this.onMouseOut);\n }\n if (opensOn === 'Hover' && !Browser.isDevice) {\n EventHandler.remove(target, 'mouseleave', this.onMouseOut);\n }\n }\n }\n if (this.mouseTrail) {\n EventHandler.remove(target, 'mousemove touchstart mouseenter', this.onMouseMove);\n }\n };\n /**\n * Core method to return the component name.\n * @private\n */\n Tooltip.prototype.getModuleName = function () {\n return 'tooltip';\n };\n /**\n * Returns the properties to be maintained in the persisted state.\n * @private\n */\n Tooltip.prototype.getPersistData = function () {\n return this.addOnPersist([]);\n };\n /**\n * Called internally, if any of the property value changed.\n * @private\n */\n Tooltip.prototype.onPropertyChanged = function (newProp, oldProp) {\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'width':\n if (this.tooltipEle) {\n this.tooltipEle.style.width = formatUnit(newProp.width);\n }\n break;\n case 'height':\n if (this.tooltipEle) {\n this.tooltipEle.style.height = formatUnit(newProp.height);\n }\n break;\n case 'content':\n if (this.tooltipEle) {\n this.renderContent();\n }\n break;\n case 'opensOn':\n this.unwireEvents(oldProp.opensOn);\n this.wireEvents(newProp.opensOn);\n break;\n case 'position':\n this.formatPosition();\n var target = document.querySelector('[data-tooltip-id= ' + this.ctrlId + '_content]');\n if (this.tooltipEle && target) {\n var arrowInnerELe = this.tooltipEle.querySelector('.' + ARROW_TIP_INNER);\n arrowInnerELe.style.top = arrowInnerELe.style.left = null;\n this.reposition(target);\n }\n break;\n case 'tipPointerPosition':\n var trgt = document.querySelector('[data-tooltip-id= ' + this.ctrlId + '_content]');\n if (this.tooltipEle && trgt) {\n this.reposition(trgt);\n }\n break;\n case 'offsetX':\n if (this.tooltipEle) {\n var x = newProp.offsetX - oldProp.offsetX;\n this.tooltipEle.style.left = (parseInt(this.tooltipEle.style.left, 10) + (x)).toString() + 'px';\n }\n break;\n case 'offsetY':\n if (this.tooltipEle) {\n var y = newProp.offsetY - oldProp.offsetY;\n this.tooltipEle.style.top = (parseInt(this.tooltipEle.style.top, 10) + (y)).toString() + 'px';\n }\n break;\n case 'cssClass':\n if (this.tooltipEle) {\n if (oldProp.cssClass) {\n removeClass([this.tooltipEle], oldProp.cssClass.split(' '));\n }\n if (newProp.cssClass) {\n addClass([this.tooltipEle], newProp.cssClass.split(' '));\n }\n }\n break;\n case 'enableRtl':\n if (this.tooltipEle) {\n if (this.enableRtl) {\n addClass([this.tooltipEle], RTL);\n }\n else {\n removeClass([this.tooltipEle], RTL);\n }\n }\n break;\n }\n }\n };\n /**\n * It is used to show the Tooltip on the specified target with specific animation settings.\n * @param element Target element where the Tooltip is to be displayed.\n * @param animation Sets the specific animation, while showing the Tooltip on the screen.\n * @return {void}\n */\n Tooltip.prototype.open = function (element, animation) {\n if (animation === void 0) { animation = this.animation.open; }\n if (element.style.display === 'none') {\n return;\n }\n this.showTooltip(element, animation);\n };\n /**\n * It is used to hide the Tooltip with specific animation effect.\n * @param animation Sets the specific animation when hiding Tooltip from the screen.\n * @return {void}\n */\n Tooltip.prototype.close = function (animation) {\n if (animation === void 0) { animation = this.animation.close; }\n this.hideTooltip(animation);\n };\n /**\n * It is used to refresh the Tooltip content and its position.\n * @param target Target element where the Tooltip content or position needs to be refreshed.\n * @return {void}\n */\n Tooltip.prototype.refresh = function (target) {\n if (this.tooltipEle) {\n this.renderContent(target);\n }\n if (this.popupObj && target) {\n this.reposition(target);\n }\n };\n /**\n * It is used to destroy the Tooltip component.\n * @method destroy\n * @return {void}\n * @memberof Tooltip\n */\n Tooltip.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n removeClass([this.element], ROOT);\n this.unwireEvents(this.opensOn);\n if (this.popupObj) {\n this.popupObj.destroy();\n }\n if (this.tooltipEle) {\n remove(this.tooltipEle);\n }\n this.tooltipEle = null;\n this.popupObj = null;\n };\n __decorate([\n Property('auto')\n ], Tooltip.prototype, \"width\", void 0);\n __decorate([\n Property('auto')\n ], Tooltip.prototype, \"height\", void 0);\n __decorate([\n Property()\n ], Tooltip.prototype, \"content\", void 0);\n __decorate([\n Property()\n ], Tooltip.prototype, \"target\", void 0);\n __decorate([\n Property('TopCenter')\n ], Tooltip.prototype, \"position\", void 0);\n __decorate([\n Property(0)\n ], Tooltip.prototype, \"offsetX\", void 0);\n __decorate([\n Property(0)\n ], Tooltip.prototype, \"offsetY\", void 0);\n __decorate([\n Property(true)\n ], Tooltip.prototype, \"showTipPointer\", void 0);\n __decorate([\n Property('Auto')\n ], Tooltip.prototype, \"tipPointerPosition\", void 0);\n __decorate([\n Property('Auto')\n ], Tooltip.prototype, \"opensOn\", void 0);\n __decorate([\n Property(false)\n ], Tooltip.prototype, \"mouseTrail\", void 0);\n __decorate([\n Property(false)\n ], Tooltip.prototype, \"isSticky\", void 0);\n __decorate([\n Complex({}, Animation)\n ], Tooltip.prototype, \"animation\", void 0);\n __decorate([\n Property(0)\n ], Tooltip.prototype, \"openDelay\", void 0);\n __decorate([\n Property(0)\n ], Tooltip.prototype, \"closeDelay\", void 0);\n __decorate([\n Property()\n ], Tooltip.prototype, \"cssClass\", void 0);\n __decorate([\n Property(false)\n ], Tooltip.prototype, \"enableRtl\", void 0);\n __decorate([\n Event()\n ], Tooltip.prototype, \"beforeRender\", void 0);\n __decorate([\n Event()\n ], Tooltip.prototype, \"beforeOpen\", void 0);\n __decorate([\n Event()\n ], Tooltip.prototype, \"afterOpen\", void 0);\n __decorate([\n Event()\n ], Tooltip.prototype, \"beforeClose\", void 0);\n __decorate([\n Event()\n ], Tooltip.prototype, \"afterClose\", void 0);\n __decorate([\n Event()\n ], Tooltip.prototype, \"beforeCollision\", void 0);\n __decorate([\n Event()\n ], Tooltip.prototype, \"created\", void 0);\n __decorate([\n Event()\n ], Tooltip.prototype, \"destroyed\", void 0);\n Tooltip = __decorate([\n NotifyPropertyChanges\n ], Tooltip);\n return Tooltip;\n}(Component));\nexport { Tooltip };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Collection, Event, NotifyPropertyChanges, detach, Property, EventHandler } from '@syncfusion/ej2-base';\nimport { addClass, createElement, getUniqueID, rippleEffect } from '@syncfusion/ej2-base';\nimport { attributes, Component, closest, select } from '@syncfusion/ej2-base';\nimport { classList, removeClass } from '@syncfusion/ej2-base';\nimport { Button } from '@syncfusion/ej2-buttons';\nimport { Popup, getZindexPartial } from '@syncfusion/ej2-popups';\nimport { getModel, Item } from './../common/common';\nvar classNames = {\n DISABLED: 'e-disabled',\n FOCUS: 'e-focused',\n ICON: 'e-menu-icon',\n ITEM: 'e-item',\n POPUP: 'e-dropdown-popup',\n RTL: 'e-rtl',\n SEPARATOR: 'e-separator',\n VERTICAL: 'e-vertical'\n};\n/**\n * DropDownButton component is used to toggle contextual overlays for displaying list of action items.\n * It can contain both text and images.\n * ``````html\n * \n * ```\n * ```typescript\n * \n * ```\n */\nvar DropDownButton = /** @class */ (function (_super) {\n __extends(DropDownButton, _super);\n /**\n * Constructor for creating the widget\n * @param {DropDownButtonModel} options?\n * @param {string|HTMLButtonElement} element?\n */\n function DropDownButton(options, element) {\n return _super.call(this, options, element) || this;\n }\n DropDownButton.prototype.preRender = function () {\n /** */\n };\n /**\n * Get the properties to be maintained in the persisted state.\n * @returns string\n */\n DropDownButton.prototype.getPersistData = function () {\n return this.addOnPersist([]);\n };\n /**\n * To open/close DropDownButton popup based on current state of the DropDownButton.\n * @returns void\n */\n DropDownButton.prototype.toggle = function () {\n this.canOpen() ? this.openPopUp() : this.closePopup();\n };\n /**\n * Initialize the Component rendering\n * @returns void\n * @private\n */\n DropDownButton.prototype.render = function () {\n this.initialize();\n if (!this.disabled) {\n this.wireEvents();\n }\n };\n DropDownButton.prototype.createPopup = function () {\n var div = createElement('div', {\n className: classNames.POPUP,\n id: this.element.id + '-popup'\n });\n document.body.appendChild(div);\n this.dropDown = new Popup(div, {\n relateTo: this.element,\n collision: { X: 'fit', Y: 'flip' },\n position: { X: 'left', Y: 'bottom' },\n targetType: 'relative',\n content: this.target ? this.getTargetElement() : '',\n zIndex: getZindexPartial(div),\n enableRtl: this.enableRtl\n });\n this.dropDown.hide();\n attributes(this.element, (_a = {},\n _a['role'] = 'menu',\n _a['aria-haspopup'] = this.items.length || this.target ? 'true' : 'false',\n _a['aria-expanded'] = 'false',\n _a['aria-owns'] = this.getPopUpElement().id,\n _a['type'] = 'button',\n _a));\n if (this.cssClass) {\n addClass([div], this.cssClass.split(' '));\n }\n var _a;\n };\n DropDownButton.prototype.getTargetElement = function () {\n return typeof (this.target) === 'string' ? select(this.target) : this.target;\n };\n DropDownButton.prototype.createItems = function (items) {\n var showIcon = this.hasIcon(items, 'iconCss');\n var span;\n var item;\n var li;\n var eventArgs;\n var ul = createElement('ul', {\n attrs: { 'tabindex': '0' }\n });\n for (var i = 0; i < items.length; i++) {\n item = items[i];\n li = createElement('li', {\n innerHTML: item.url ? '' : item.text,\n className: item.separator ? classNames.ITEM + ' ' + classNames.SEPARATOR : classNames.ITEM,\n attrs: { 'role': 'menuItem', 'tabindex': '-1' },\n id: item.id ? item.id : getUniqueID('e-' + this.getModuleName() + '-item')\n });\n if (item.iconCss) {\n span = createElement('span', { className: classNames.ICON + ' ' + item.iconCss });\n li.insertBefore(span, li.childNodes[0]);\n }\n else {\n if (showIcon && !item.separator) {\n li.classList.add('e-blank-icon');\n }\n }\n if (item.url) {\n li.appendChild(this.createAnchor(item));\n }\n eventArgs = { item: item, element: li };\n this.trigger('beforeItemRender', eventArgs);\n ul.appendChild(li);\n }\n return ul;\n };\n DropDownButton.prototype.hasIcon = function (items, field) {\n for (var i = 0, len = items.length; i < len; i++) {\n if (items[i][field]) {\n return true;\n }\n }\n return false;\n };\n DropDownButton.prototype.createAnchor = function (item) {\n return createElement('a', { className: 'e-menu-text e-menu-url', innerHTML: item.text, attrs: { 'href': item.url } });\n };\n DropDownButton.prototype.initialize = function () {\n this.button = new Button({\n iconCss: this.iconCss, cssClass: this.cssClass, content: this.content,\n disabled: this.disabled, enableRtl: this.enableRtl, enablePersistence: this.enablePersistence\n });\n this.button.appendTo(this.element);\n if (!this.element.id) {\n this.element.id = getUniqueID('e-' + this.getModuleName());\n }\n this.setIconPositionTop();\n this.appendArrowSpan();\n this.createPopup();\n this.setActiveElem([this.element]);\n };\n DropDownButton.prototype.setIconPositionTop = function () {\n var iconSpan = this.element.querySelector('.e-icon-left');\n if (iconSpan && this.iconPosition === 'Top') {\n addClass([this.element], 'e-top-icon-btn');\n removeClass([iconSpan], 'e-icon-left');\n addClass([iconSpan], 'e-icon-top');\n }\n };\n DropDownButton.prototype.appendArrowSpan = function () {\n this.element.appendChild(createElement('span', {\n className: 'e-btn-icon e-icons ' + 'e-icon-' + (this.cssClass.indexOf(classNames.VERTICAL) > -1\n ? 'bottom' : 'right') + ' e-caret'\n }));\n };\n DropDownButton.prototype.setActiveElem = function (elem) {\n this.activeElem = elem;\n };\n /**\n * Get component name.\n * @returns string\n * @private\n */\n DropDownButton.prototype.getModuleName = function () {\n return 'dropdown-btn';\n };\n DropDownButton.prototype.canOpen = function () {\n return this.getPopUpElement().classList.contains('e-popup-close');\n };\n /**\n * Destroys the widget.\n * @returns void\n */\n DropDownButton.prototype.destroy = function () {\n var _this = this;\n if (this.element.querySelector('span.e-caret')) {\n detach(this.element.querySelector('span.e-caret'));\n }\n _super.prototype.destroy.call(this);\n this.button.destroy();\n ['role', 'aria-haspopup', 'aria-expanded', 'aria-owns', 'type'].forEach(function (key) {\n _this.element.removeAttribute(key);\n });\n removeClass([this.element], ['e-btn']);\n removeClass(this.activeElem, ['e-active']);\n this.dropDown.destroy();\n var popupEle = document.getElementById(this.getPopUpElement().id);\n if (popupEle) {\n removeClass([popupEle], ['e-popup-open', 'e-popup-close']);\n detach(popupEle);\n }\n if (!this.disabled) {\n this.unWireEvents();\n }\n };\n DropDownButton.prototype.getPopUpElement = function () {\n return this.dropDown.element;\n };\n DropDownButton.prototype.getULElement = function () {\n return this.getPopUpElement().children[0];\n };\n DropDownButton.prototype.wireEvents = function () {\n var popupElement = this.getPopUpElement();\n this.delegateMousedownHandler = this.mousedownHandler.bind(this);\n EventHandler.add(document, 'mousedown touchstart', this.delegateMousedownHandler, this);\n EventHandler.add(this.element, 'click', this.clickHandler, this);\n EventHandler.add(popupElement, 'click', this.clickHandler, this);\n EventHandler.add(this.element, 'keydown', this.keyBoardHandler, this);\n EventHandler.add(popupElement, 'keydown', this.keyBoardHandler, this);\n this.rippleFn = rippleEffect(popupElement, { selector: '.' + classNames.ITEM });\n };\n DropDownButton.prototype.keyBoardHandler = function (e) {\n if (e.target === this.element && (e.keyCode === 9 || (!e.altKey && e.keyCode === 40) || e.keyCode === 38)) {\n return;\n }\n switch (e.keyCode) {\n case 38:\n case 40:\n if (e.altKey && (e.keyCode === 38 || e.keyCode === 40)) {\n this.keyEventHandler(e);\n }\n else {\n this.upDownKeyHandler(e);\n }\n break;\n case 9:\n case 13:\n case 27:\n case 32:\n this.keyEventHandler(e);\n break;\n }\n };\n DropDownButton.prototype.upDownKeyHandler = function (e) {\n if (this.target && (e.keyCode === 38 || e.keyCode === 40)) {\n return;\n }\n e.preventDefault();\n var ul = this.getULElement();\n var defaultIdx = e.keyCode === 40 ? 0 : ul.childElementCount - 1;\n var liIdx = defaultIdx;\n var li = null;\n this.removeCustomSelection();\n for (var i = 0, len = ul.children.length; i < len; i++) {\n if (ul.children[i].classList.contains(classNames.FOCUS)) {\n li = ul.children[i];\n liIdx = i;\n li.classList.remove(classNames.FOCUS);\n e.keyCode === 40 ? liIdx++ : liIdx--;\n if (liIdx === (e.keyCode === 40 ? ul.childElementCount : -1)) {\n liIdx = defaultIdx;\n }\n }\n }\n li = ul.children[liIdx];\n liIdx = this.isValidLI(li, liIdx, e.keyCode);\n if (liIdx !== -1) {\n addClass([ul.children[liIdx]], classNames.FOCUS);\n ul.children[liIdx].focus();\n }\n };\n DropDownButton.prototype.removeCustomSelection = function () {\n var selectedLi = this.getULElement().querySelector('.e-selected');\n if (selectedLi) {\n selectedLi.classList.remove('e-selected');\n }\n };\n DropDownButton.prototype.isValidLI = function (li, index, keyCode, count) {\n if (count === void 0) { count = 0; }\n if (li.classList.contains(classNames.SEPARATOR) || li.classList.contains(classNames.DISABLED)) {\n if (index === (keyCode === 40 ? this.items.length - 1 : 0)) {\n index = keyCode === 40 ? 0 : this.items.length - 1;\n }\n else {\n keyCode === 40 ? index++ : index--;\n }\n }\n li = this.getULElement().children[index];\n if (li.classList.contains(classNames.SEPARATOR) || li.classList.contains(classNames.DISABLED)) {\n count++;\n if (count === this.items.length) {\n return index = -1;\n }\n index = this.isValidLI(li, index, keyCode, count);\n }\n return index;\n };\n DropDownButton.prototype.keyEventHandler = function (e) {\n if (this.target && (e.keyCode === 13 || e.keyCode === 9)) {\n return;\n }\n if (e.keyCode !== 9) {\n e.preventDefault();\n }\n if (e.keyCode === 27 || e.keyCode === 38 || e.keyCode === 9) {\n if (!this.canOpen()) {\n this.closePopup(e, this.element);\n }\n }\n else {\n this.clickHandler(e);\n }\n };\n DropDownButton.prototype.getLI = function (elem) {\n return elem.tagName === 'LI' ? elem : closest(elem, 'li');\n };\n DropDownButton.prototype.mousedownHandler = function (e) {\n var trgt = e.target;\n if (!this.canOpen() && !(closest(trgt, '#' + this.getPopUpElement().id) || closest(trgt, '#' + this.element.id))) {\n this.closePopup(e);\n }\n };\n DropDownButton.prototype.clickHandler = function (e) {\n var trgt = e.target;\n var canOpen = this.canOpen();\n if (closest(trgt, '#' + this.element.id)) {\n if (canOpen) {\n this.openPopUp(e);\n }\n else {\n this.closePopup(e, this.activeElem[0]);\n }\n }\n else {\n if (closest(trgt, '#' + this.getPopUpElement().id)) {\n var eventArgs = void 0;\n var liIdx = void 0;\n var item = void 0;\n var li = this.getLI(trgt);\n if (li) {\n liIdx = Array.prototype.indexOf.call(this.getULElement().children, li);\n item = this.items[liIdx];\n if (item) {\n eventArgs = { element: li, item: item };\n this.trigger('select', eventArgs);\n }\n this.closePopup(e, this.activeElem[0]);\n }\n }\n else {\n if (!canOpen) {\n this.closePopup(e);\n }\n }\n }\n };\n DropDownButton.prototype.openPopUp = function (e) {\n if (e === void 0) { e = null; }\n if (!this.target) {\n this.getPopUpElement().appendChild(this.createItems(this.items));\n }\n var ul = this.getULElement();\n var beforeOpenArgs = { element: ul, items: this.items, event: e, cancel: false };\n this.trigger('beforeOpen', beforeOpenArgs);\n if (!beforeOpenArgs.cancel) {\n this.dropDown.show();\n addClass([this.element], 'e-active');\n this.element.setAttribute('aria-expanded', 'true');\n ul.focus();\n var openArgs = { element: ul, items: this.items };\n this.trigger('open', openArgs);\n }\n };\n DropDownButton.prototype.closePopup = function (e, focusEle) {\n if (e === void 0) { e = null; }\n var ul = this.getULElement();\n var beforeCloseArgs = { element: ul, items: this.items, event: e, cancel: false };\n this.trigger('beforeClose', beforeCloseArgs);\n if (!beforeCloseArgs.cancel) {\n this.removeCustomSelection();\n this.dropDown.hide();\n removeClass(this.activeElem, 'e-active');\n this.element.setAttribute('aria-expanded', 'false');\n if (focusEle) {\n focusEle.focus();\n }\n var closeArgs = { element: ul, items: this.items };\n this.trigger('close', closeArgs);\n if (!this.target && ul) {\n detach(ul);\n }\n }\n };\n DropDownButton.prototype.unWireEvents = function () {\n EventHandler.remove(document, 'mousedown touchstart', this.delegateMousedownHandler);\n EventHandler.remove(this.element, 'click', this.clickHandler);\n EventHandler.remove(this.getPopUpElement(), 'click', this.clickHandler);\n EventHandler.remove(this.element, 'keydown', this.keyBoardHandler);\n EventHandler.remove(this.getPopUpElement(), 'keydown', this.keyBoardHandler);\n this.rippleFn();\n };\n /**\n * Called internally if any of the property value changed.\n * @param {DropDownButtonModel} newProp\n * @param {DropDownButtonModel} oldProp\n * @returns void\n * @private\n */\n DropDownButton.prototype.onPropertyChanged = function (newProp, oldProp) {\n var btnModel = ['content', 'cssClass', 'iconCss', 'disabled', 'enableRtl'];\n if (newProp.iconPosition === 'Left') {\n btnModel.push('iconPosition');\n }\n this.button.setProperties(getModel(newProp, btnModel));\n var popupElement = this.getPopUpElement();\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'content':\n if (!this.element.querySelector('span.e-caret')) {\n this.appendArrowSpan();\n }\n break;\n case 'disabled':\n if (newProp.disabled) {\n this.unWireEvents();\n if (!this.canOpen()) {\n this.closePopup();\n }\n }\n else {\n this.wireEvents();\n }\n break;\n case 'cssClass':\n if (newProp.cssClass.indexOf(classNames.VERTICAL) > -1) {\n var arrowSpan = this.element.querySelector('span.e-caret');\n classList(arrowSpan, ['e-icon-bottom'], ['e-icon-right']);\n }\n if (oldProp.cssClass) {\n removeClass([popupElement], oldProp.cssClass.split(' '));\n }\n if (newProp.cssClass) {\n addClass([popupElement], newProp.cssClass.split(' '));\n }\n break;\n case 'iconPosition':\n this.setIconPositionTop();\n break;\n case 'enableRtl':\n popupElement.classList.toggle(classNames.RTL);\n break;\n case 'target':\n this.target = newProp.target;\n detach(this.getULElement());\n popupElement.appendChild(this.getTargetElement());\n this.dropDown.content = this.getTargetElement();\n break;\n case 'items':\n this.dropDown.refresh();\n if (popupElement.classList.contains('e-popup-open')) {\n classList(popupElement, ['e-popup-close'], ['e-popup-open']);\n }\n break;\n }\n }\n };\n __decorate([\n Property('')\n ], DropDownButton.prototype, \"content\", void 0);\n __decorate([\n Property('')\n ], DropDownButton.prototype, \"cssClass\", void 0);\n __decorate([\n Property(false)\n ], DropDownButton.prototype, \"disabled\", void 0);\n __decorate([\n Property('')\n ], DropDownButton.prototype, \"iconCss\", void 0);\n __decorate([\n Property('Left')\n ], DropDownButton.prototype, \"iconPosition\", void 0);\n __decorate([\n Collection([], Item)\n ], DropDownButton.prototype, \"items\", void 0);\n __decorate([\n Property('')\n ], DropDownButton.prototype, \"target\", void 0);\n __decorate([\n Event()\n ], DropDownButton.prototype, \"beforeItemRender\", void 0);\n __decorate([\n Event()\n ], DropDownButton.prototype, \"beforeOpen\", void 0);\n __decorate([\n Event()\n ], DropDownButton.prototype, \"beforeClose\", void 0);\n __decorate([\n Event()\n ], DropDownButton.prototype, \"close\", void 0);\n __decorate([\n Event()\n ], DropDownButton.prototype, \"open\", void 0);\n __decorate([\n Event()\n ], DropDownButton.prototype, \"select\", void 0);\n DropDownButton = __decorate([\n NotifyPropertyChanges\n ], DropDownButton);\n return DropDownButton;\n}(Component));\nexport { DropDownButton };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n/// \nimport { Event, createElement, remove, addClass, removeClass, detach, getValue, setValue } from '@syncfusion/ej2-base';\nimport { EventHandler, Collection, NotifyPropertyChanges, Property } from '@syncfusion/ej2-base';\nimport { attributes, getUniqueID, getInstance, KeyboardEvents } from '@syncfusion/ej2-base';\nimport { Button } from '@syncfusion/ej2-buttons';\nimport { getModel, Item } from './../common/common';\nimport { DropDownButton } from '../drop-down-button/drop-down-button';\nvar RTL = 'e-rtl';\nvar TAGNAME = 'EJS-SPLITBUTTON';\n/**\n * SplitButton component has primary and secondary button. Primary button is used to select\n * default action and secondary button is used to toggle contextual overlays for displaying list of\n * action items. It can contain both text and images.\n * ```html\n * \n * ```\n * ```typescript\n * \n * ```\n */\nvar SplitButton = /** @class */ (function (_super) {\n __extends(SplitButton, _super);\n /**\n * Constructor for creating the widget\n * @param {SplitButtonModel} options?\n * @param {string|HTMLButtonElement} element?\n */\n function SplitButton(options, element) {\n return _super.call(this, options, element) || this;\n }\n /**\n * Initialize Angular support.\n * @private\n */\n SplitButton.prototype.preRender = function () {\n var ele = this.element;\n if (ele.tagName === TAGNAME) {\n var ejInstance = getValue('ej2_instances', ele);\n var btn = createElement('button', { attrs: { 'type': 'button' } });\n var wrapper = createElement(TAGNAME, { className: 'e-' + this.getModuleName() + '-wrapper' });\n for (var idx = 0, len = ele.attributes.length; idx < len; idx++) {\n btn.setAttribute(ele.attributes[idx].nodeName, ele.attributes[idx].nodeValue);\n }\n ele.parentNode.insertBefore(wrapper, ele);\n detach(ele);\n ele = btn;\n wrapper.appendChild(ele);\n setValue('ej2_instances', ejInstance, ele);\n this.wrapper = wrapper;\n this.element = ele;\n }\n if (!this.element.id) {\n this.element.id = getUniqueID('e-' + this.getModuleName());\n }\n };\n SplitButton.prototype.render = function () {\n this.initWrapper();\n this.createPrimaryButton();\n this.createSecondaryButton();\n this.setActiveElem([this.element, this.secondaryBtnObj.element]);\n this.setAria();\n this.wireEvents();\n };\n SplitButton.prototype.initWrapper = function () {\n if (!this.wrapper) {\n this.wrapper = createElement('div', { className: 'e-' + this.getModuleName() + '-wrapper' });\n this.element.parentNode.insertBefore(this.wrapper, this.element);\n }\n this.element.classList.remove('e-' + this.getModuleName());\n if (this.enableRtl) {\n this.wrapper.classList.add(RTL);\n }\n if (this.cssClass) {\n addClass([this.wrapper], this.cssClass.split(' '));\n }\n };\n SplitButton.prototype.createPrimaryButton = function () {\n var btnModel = {\n cssClass: this.cssClass,\n enableRtl: this.enableRtl,\n iconCss: this.iconCss,\n content: this.content,\n disabled: this.disabled\n };\n this.primaryBtnObj = new Button(btnModel, this.element);\n this.element.classList.add('e-' + this.getModuleName());\n this.element.type = 'button';\n this.wrapper.appendChild(this.element);\n this.setIconPositionTop();\n };\n SplitButton.prototype.createSecondaryButton = function () {\n var _this = this;\n var btnElem = createElement('button', {\n className: 'e-icon-btn',\n attrs: { 'tabindex': '-1' },\n id: this.element.id + '_dropdownbtn'\n });\n this.wrapper.appendChild(btnElem);\n var dropDownBtnModel = {\n cssClass: this.cssClass,\n disabled: this.disabled,\n enableRtl: this.enableRtl,\n items: this.items,\n target: this.target,\n beforeItemRender: function (args) {\n _this.trigger('beforeItemRender', args);\n },\n beforeOpen: function (args) {\n _this.trigger('beforeOpen', args);\n },\n beforeClose: function (args) {\n _this.trigger('beforeClose', args);\n },\n open: function (args) {\n _this.trigger('open', args);\n },\n close: function (args) {\n _this.trigger('close', args);\n },\n select: function (args) {\n _this.trigger('select', args);\n }\n };\n this.secondaryBtnObj = new DropDownButton(dropDownBtnModel, btnElem);\n this.secondaryBtnObj.dropDown.relateTo = this.wrapper;\n this.dropDown = this.secondaryBtnObj.dropDown;\n this.secondaryBtnObj.activeElem = [this.element, this.secondaryBtnObj.element];\n EventHandler.remove(this.getPopUpElement(), 'keydown', this.secondaryBtnObj.keyBoardHandler);\n this.secondaryBtnObj.element.querySelector('.e-btn-icon').classList.remove('e-icon-right');\n };\n SplitButton.prototype.setAria = function () {\n attributes(this.element, {\n 'role': 'listbox', 'aria-expanded': 'false', 'aria-haspopup': 'true',\n 'aria-label': this.element.textContent + ' splitbutton', 'aria-owns': this.secondaryBtnObj.dropDown.element.id\n });\n };\n /**\n * Get component name.\n * @returns string\n * @private\n */\n SplitButton.prototype.getModuleName = function () {\n return 'split-btn';\n };\n /**\n * To open/close SplitButton popup based on current state of the SplitButton.\n * @returns void\n */\n SplitButton.prototype.toggle = function () {\n this.secondaryBtnObj.toggle();\n };\n SplitButton.prototype.destroy = function () {\n var _this = this;\n this.primaryBtnObj.destroy();\n this.secondaryBtnObj.destroy();\n var element = document.getElementById(this.element.id);\n if (element && element.parentElement === this.wrapper) {\n if (this.wrapper.tagName === TAGNAME) {\n this.wrapper.innerHTML = '';\n removeClass([this.wrapper], ['e-rtl', 'e-' + this.getModuleName() + '-wrapper']);\n removeClass([this.wrapper], this.cssClass.split(' '));\n }\n else {\n removeClass([this.element], ['e-' + this.getModuleName(), RTL]);\n ['role', 'aria-label', 'aria-haspopup', 'aria-expanded', 'aria-owns', 'type'].forEach(function (key) {\n _this.element.removeAttribute(key);\n });\n this.wrapper.parentNode.insertBefore(this.element, this.wrapper);\n remove(this.wrapper);\n }\n this.unWireEvents();\n }\n };\n SplitButton.prototype.wireEvents = function () {\n EventHandler.add(this.element, 'click', this.primaryBtnClickHandler, this);\n EventHandler.add(this.getPopUpElement(), 'keydown', this.keyBoardHandler, this);\n new KeyboardEvents(this.element, {\n keyAction: this.btnKeyBoardHandler.bind(this),\n keyConfigs: {\n altdownarrow: 'alt+downarrow'\n }\n });\n };\n SplitButton.prototype.unWireEvents = function () {\n EventHandler.remove(this.element, 'click', this.primaryBtnClickHandler);\n getInstance(this.element, KeyboardEvents).destroy();\n };\n SplitButton.prototype.primaryBtnClickHandler = function () {\n this.trigger('click', { element: this.element });\n };\n SplitButton.prototype.btnKeyBoardHandler = function (e) {\n switch (e.action) {\n case 'altdownarrow':\n this.clickHandler(e);\n break;\n }\n };\n /**\n * Called internally if any of the property value changed.\n * @param {SplitButtonModel} newProp\n * @param {SplitButtonModel} oldProp\n * @returns void\n */\n SplitButton.prototype.onPropertyChanged = function (newProp, oldProp) {\n var model = ['content', 'iconCss', 'cssClass', 'disabled', 'enableRtl'];\n if (newProp.iconPosition === 'Left') {\n model.push('iconPosition');\n }\n this.primaryBtnObj.setProperties(getModel(newProp, model));\n model = ['items', 'beforeOpen', 'beforeItemRender', 'select', 'open',\n 'close', 'cssClass', 'disabled', 'enableRtl'];\n this.secondaryBtnObj.setProperties(getModel(newProp, model));\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'cssClass':\n if (oldProp.cssClass) {\n removeClass([this.wrapper], oldProp.cssClass.split(' '));\n }\n addClass([this.wrapper], newProp.cssClass.split(' '));\n break;\n case 'iconPosition':\n this.setIconPositionTop();\n break;\n case 'enableRtl':\n if (newProp.enableRtl) {\n addClass([this.wrapper], RTL);\n }\n else {\n removeClass([this.wrapper], RTL);\n }\n break;\n }\n }\n };\n __decorate([\n Property('')\n ], SplitButton.prototype, \"content\", void 0);\n __decorate([\n Property('')\n ], SplitButton.prototype, \"cssClass\", void 0);\n __decorate([\n Property(false)\n ], SplitButton.prototype, \"disabled\", void 0);\n __decorate([\n Property('')\n ], SplitButton.prototype, \"iconCss\", void 0);\n __decorate([\n Property('Left')\n ], SplitButton.prototype, \"iconPosition\", void 0);\n __decorate([\n Collection([], Item)\n ], SplitButton.prototype, \"items\", void 0);\n __decorate([\n Property('')\n ], SplitButton.prototype, \"target\", void 0);\n __decorate([\n Event()\n ], SplitButton.prototype, \"beforeItemRender\", void 0);\n __decorate([\n Event()\n ], SplitButton.prototype, \"beforeOpen\", void 0);\n __decorate([\n Event()\n ], SplitButton.prototype, \"beforeClose\", void 0);\n __decorate([\n Event()\n ], SplitButton.prototype, \"click\", void 0);\n __decorate([\n Event()\n ], SplitButton.prototype, \"close\", void 0);\n __decorate([\n Event()\n ], SplitButton.prototype, \"open\", void 0);\n __decorate([\n Event()\n ], SplitButton.prototype, \"select\", void 0);\n SplitButton = __decorate([\n NotifyPropertyChanges\n ], SplitButton);\n return SplitButton;\n}(DropDownButton));\nexport { SplitButton };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, EventHandler, Property, Event, Browser, L10n } from '@syncfusion/ej2-base';\nimport { NotifyPropertyChanges } from '@syncfusion/ej2-base';\nimport { createElement, attributes, addClass, removeClass, setStyleAttribute, detach } from '@syncfusion/ej2-base';\nimport { isNullOrUndefined, getValue, formatUnit, setValue, merge } from '@syncfusion/ej2-base';\nimport { Internationalization, getNumericObject } from '@syncfusion/ej2-base';\nimport { Input } from '../input/input';\nvar ROOT = 'e-control-wrapper e-numeric';\nvar SPINICON = 'e-input-group-icon';\nvar SPINUP = 'e-spin-up';\nvar SPINDOWN = 'e-spin-down';\nvar ERROR = 'e-error';\nvar INCREMENT = 'increment';\nvar DECREMENT = 'decrement';\nvar INTREGEXP = new RegExp('/^(-)?(\\d*)$/');\nvar DECIMALSEPARATOR = '.';\n/**\n * Represents the NumericTextBox component that allows the user to enter only numeric values.\n * ```html\n * \n * ```\n * ```typescript\n * \n * ```\n */\nvar NumericTextBox = /** @class */ (function (_super) {\n __extends(NumericTextBox, _super);\n function NumericTextBox(options, element) {\n return _super.call(this, options, element) || this;\n }\n NumericTextBox.prototype.preRender = function () {\n this.isPrevFocused = false;\n this.decimalSeparator = '.';\n this.intRegExp = new RegExp('/^(-)?(\\d*)$/');\n this.isCalled = false;\n var ejInstance = getValue('ej2_instances', this.element);\n this.cloneElement = this.element.cloneNode(true);\n this.angularTagName = null;\n if (this.element.tagName === 'EJS-NUMERICTEXTBOX') {\n this.angularTagName = this.element.tagName;\n var input = createElement('input');\n var index = 0;\n for (index; index < this.element.attributes.length; index++) {\n input.setAttribute(this.element.attributes[index].nodeName, this.element.attributes[index].nodeValue);\n input.innerHTML = this.element.innerHTML;\n }\n if (this.element.hasAttribute('id')) {\n this.element.removeAttribute('id');\n }\n this.element.classList.remove('e-control', 'e-numerictextbox');\n this.element.appendChild(input);\n this.element = input;\n setValue('ej2_instances', ejInstance, this.element);\n }\n attributes(this.element, { 'role': 'spinbutton', 'tabindex': '0', 'autocomplete': 'off', 'aria-live': 'assertive' });\n var localeText = { incrementTitle: 'Increment value', decrementTitle: 'Decrement value', placeholder: '' };\n this.l10n = new L10n('numerictextbox', localeText, this.locale);\n this.isValidState = true;\n this.inputStyle = null;\n this.inputName = null;\n this.cultureInfo = {};\n this.initCultureInfo();\n this.initCultureFunc();\n this.checkAttributes();\n this.prevValue = this.value;\n this.validateMinMax();\n this.validateStep();\n if (this.placeholder === null) {\n this.updatePlaceholder();\n }\n };\n /**\n * To Initialize the control rendering\n * @private\n */\n NumericTextBox.prototype.render = function () {\n if (this.element.tagName.toLowerCase() === 'input') {\n this.createWrapper();\n if (this.showSpinButton) {\n this.spinBtnCreation();\n }\n if (!isNullOrUndefined(this.width)) {\n setStyleAttribute(this.container, { 'width': formatUnit(this.width) });\n }\n if (!this.container.classList.contains('e-input-group')) {\n this.container.classList.add('e-input-group');\n }\n this.changeValue(this.value === null || isNaN(this.value) ? null : this.strictMode ? this.trimValue(this.value) : this.value);\n this.wireEvents();\n if (this.value !== null && !isNaN(this.value)) {\n if (this.decimals) {\n this.setProperties({ value: this.roundNumber(this.value, this.decimals) }, true);\n }\n }\n }\n };\n NumericTextBox.prototype.checkAttributes = function () {\n var attributes = ['value', 'min', 'max', 'step', 'disabled', 'readonly', 'style', 'name'];\n for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {\n var prop = attributes_1[_i];\n if (!isNullOrUndefined(this.element.getAttribute(prop))) {\n switch (prop) {\n case 'disabled':\n var enabled = this.element.getAttribute(prop) === 'disabled' ||\n this.element.getAttribute(prop) === 'true' ? false : true;\n this.setProperties({ enabled: enabled }, true);\n break;\n case 'readonly':\n var readonly = this.element.getAttribute(prop) === 'readonly'\n || this.element.getAttribute(prop) === 'true' ? true : false;\n this.setProperties({ readonly: readonly }, true);\n break;\n case 'style':\n this.inputStyle = this.element.getAttribute(prop);\n break;\n case 'name':\n this.inputName = this.element.getAttribute(prop);\n break;\n default:\n var value = this.instance.getNumberParser({ format: 'n' })(this.element.getAttribute(prop));\n if ((value !== null && !isNaN(value)) || (prop === 'value')) {\n this.setProperties(setValue(prop, value, {}), true);\n }\n break;\n }\n }\n }\n };\n NumericTextBox.prototype.updatePlaceholder = function () {\n this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);\n };\n NumericTextBox.prototype.initCultureFunc = function () {\n this.instance = new Internationalization(this.locale);\n };\n NumericTextBox.prototype.initCultureInfo = function () {\n this.cultureInfo.format = this.format;\n if (getValue('currency', this) !== null) {\n setValue('currency', this.currency, this.cultureInfo);\n this.setProperties({ currencyCode: this.currency }, true);\n }\n };\n /* Wrapper creation */\n NumericTextBox.prototype.createWrapper = function () {\n var inputObj = Input.createInput({\n element: this.element,\n floatLabelType: this.floatLabelType,\n properties: {\n readonly: this.readonly,\n placeholder: this.placeholder,\n cssClass: this.cssClass,\n enableRtl: this.enableRtl,\n showClearButton: this.showClearButton,\n enabled: this.enabled\n }\n });\n this.inputWrapper = inputObj;\n this.container = inputObj.container;\n this.container.setAttribute('class', ROOT + ' ' + this.container.getAttribute('class'));\n if (this.readonly) {\n attributes(this.element, { 'aria-readonly': 'true' });\n }\n this.hiddenInput = (createElement('input', { attrs: { type: 'hidden', 'validateHidden': 'true' } }));\n this.inputName = this.inputName !== null ? this.inputName : this.element.id;\n this.element.removeAttribute('name');\n attributes(this.hiddenInput, { 'name': this.inputName });\n this.container.insertBefore(this.hiddenInput, this.container.childNodes[1]);\n if (this.inputStyle !== null) {\n attributes(this.container, { 'style': this.inputStyle });\n }\n };\n /* Spinner creation */\n NumericTextBox.prototype.spinBtnCreation = function () {\n this.spinDown = Input.appendSpan(SPINICON + ' ' + SPINDOWN, this.container);\n attributes(this.spinDown, {\n 'title': this.l10n.getConstant('decrementTitle'),\n 'aria-label': this.l10n.getConstant('decrementTitle')\n });\n this.spinUp = Input.appendSpan(SPINICON + ' ' + SPINUP, this.container);\n attributes(this.spinUp, {\n 'title': this.l10n.getConstant('incrementTitle'),\n 'aria-label': this.l10n.getConstant('incrementTitle')\n });\n this.wireSpinBtnEvents();\n };\n NumericTextBox.prototype.validateMinMax = function () {\n if (!(typeof (this.min) === 'number' && !isNaN(this.min))) {\n this.setProperties({ min: -(Number.MAX_VALUE) }, true);\n }\n if (!(typeof (this.max) === 'number' && !isNaN(this.max))) {\n this.setProperties({ max: Number.MAX_VALUE }, true);\n }\n if (this.decimals !== null) {\n if (this.min !== -(Number.MAX_VALUE)) {\n this.setProperties({ min: this.instance.getNumberParser({ format: 'n' })(this.formattedValue(this.decimals, this.min)) }, true);\n }\n if (this.max !== (Number.MAX_VALUE)) {\n this.setProperties({ max: this.instance.getNumberParser({ format: 'n' })(this.formattedValue(this.decimals, this.max)) }, true);\n }\n }\n this.setProperties({ min: this.min > this.max ? this.max : this.min }, true);\n attributes(this.element, { 'aria-valuemin': this.min.toString(), 'aria-valuemax': this.max.toString() });\n };\n NumericTextBox.prototype.formattedValue = function (decimals, value) {\n return this.instance.getNumberFormat({\n maximumFractionDigits: decimals,\n minimumFractionDigits: decimals, useGrouping: false\n })(value);\n };\n NumericTextBox.prototype.validateStep = function () {\n if (this.decimals !== null) {\n this.setProperties({ step: this.instance.getNumberParser({ format: 'n' })(this.formattedValue(this.decimals, this.step)) }, true);\n }\n };\n NumericTextBox.prototype.action = function (operation, event) {\n this.isInteract = true;\n var value = this.isFocused ? this.instance.getNumberParser({ format: 'n' })(this.element.value) : this.value;\n this.changeValue(this.performAction(value, this.step, operation));\n this.raiseChangeEvent(event);\n };\n NumericTextBox.prototype.checkErrorClass = function () {\n if (this.isValidState) {\n removeClass([this.container], ERROR);\n }\n else {\n addClass([this.container], ERROR);\n }\n attributes(this.element, { 'aria-invalid': this.isValidState ? 'false' : 'true' });\n };\n NumericTextBox.prototype.bindClearEvent = function () {\n if (this.showClearButton) {\n EventHandler.add(this.inputWrapper.clearButton, 'mousedown touchstart', this.resetHandler, this);\n }\n };\n NumericTextBox.prototype.resetHandler = function (e) {\n e.preventDefault();\n if (!(this.inputWrapper.clearButton.classList.contains('e-clear-icon-hide'))) {\n this.clear(e);\n }\n };\n NumericTextBox.prototype.clear = function (event) {\n this.setProperties({ value: null }, true);\n this.setElementValue('');\n };\n NumericTextBox.prototype.wireEvents = function () {\n EventHandler.add(this.element, 'focus', this.focusIn, this);\n EventHandler.add(this.element, 'blur', this.focusOut, this);\n EventHandler.add(this.element, 'keydown', this.keyDownHandler, this);\n EventHandler.add(this.element, 'keyup', this.keyUpHandler, this);\n EventHandler.add(this.element, 'input', this.inputHandler, this);\n EventHandler.add(this.element, 'keypress', this.keyPressHandler, this);\n EventHandler.add(this.element, 'change', this.changeHandler, this);\n EventHandler.add(this.element, 'paste', this.pasteHandler, this);\n if (this.enabled) {\n this.bindClearEvent();\n }\n };\n NumericTextBox.prototype.wireSpinBtnEvents = function () {\n /* bind spin button events */\n EventHandler.add(this.spinUp, Browser.touchStartEvent, this.mouseDownOnSpinner, this);\n EventHandler.add(this.spinDown, Browser.touchStartEvent, this.mouseDownOnSpinner, this);\n EventHandler.add(this.spinUp, Browser.touchEndEvent, this.mouseUpOnSpinner, this);\n EventHandler.add(this.spinDown, Browser.touchEndEvent, this.mouseUpOnSpinner, this);\n EventHandler.add(this.spinUp, Browser.touchMoveEvent, this.touchMoveOnSpinner, this);\n EventHandler.add(this.spinDown, Browser.touchMoveEvent, this.touchMoveOnSpinner, this);\n };\n NumericTextBox.prototype.unwireEvents = function () {\n EventHandler.remove(this.element, 'focus', this.focusIn);\n EventHandler.remove(this.element, 'blur', this.focusOut);\n EventHandler.remove(this.element, 'keyup', this.keyUpHandler);\n EventHandler.remove(this.element, 'input', this.inputHandler);\n EventHandler.remove(this.element, 'keydown', this.keyDownHandler);\n EventHandler.remove(this.element, 'keypress', this.keyPressHandler);\n EventHandler.remove(this.element, 'change', this.changeHandler);\n EventHandler.remove(this.element, 'paste', this.pasteHandler);\n };\n NumericTextBox.prototype.unwireSpinBtnEvents = function () {\n /* unbind spin button events */\n EventHandler.remove(this.spinUp, Browser.touchStartEvent, this.mouseDownOnSpinner);\n EventHandler.remove(this.spinDown, Browser.touchStartEvent, this.mouseDownOnSpinner);\n EventHandler.remove(this.spinUp, Browser.touchEndEvent, this.mouseUpOnSpinner);\n EventHandler.remove(this.spinDown, Browser.touchEndEvent, this.mouseUpOnSpinner);\n EventHandler.remove(this.spinUp, Browser.touchMoveEvent, this.touchMoveOnSpinner);\n EventHandler.remove(this.spinDown, Browser.touchMoveEvent, this.touchMoveOnSpinner);\n };\n NumericTextBox.prototype.changeHandler = function (event) {\n if (!this.element.value.length) {\n this.setProperties({ value: null }, true);\n }\n var parsedInput = this.instance.getNumberParser({ format: 'n' })(this.element.value);\n this.updateValue(parsedInput, event);\n };\n NumericTextBox.prototype.raiseChangeEvent = function (event) {\n if (this.prevValue !== this.value) {\n var eventArgs = {};\n this.changeEventArgs = { value: this.value, previousValue: this.prevValue, isInteraction: this.isInteract, event: event };\n if (event) {\n this.changeEventArgs.event = event;\n }\n merge(eventArgs, this.changeEventArgs);\n this.prevValue = this.value;\n this.isInteract = false;\n this.trigger('change', eventArgs);\n }\n };\n NumericTextBox.prototype.pasteHandler = function () {\n var _this = this;\n var beforeUpdate = this.element.value;\n setTimeout(function () {\n if (!_this.numericRegex().test(_this.element.value)) {\n _this.setElementValue(beforeUpdate);\n }\n });\n };\n NumericTextBox.prototype.preventHandler = function () {\n var _this = this;\n var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);\n setTimeout(function () {\n if (_this.element.selectionStart > 0) {\n var currentPos = _this.element.selectionStart;\n var prevPos = _this.element.selectionStart - 1;\n var start = 0;\n var ignoreKeyCode = void 0;\n var valArray = _this.element.value.split('');\n var numericObject = getNumericObject(_this.locale);\n var decimalSeparator = getValue('decimal', numericObject);\n ignoreKeyCode = decimalSeparator.charCodeAt(0);\n if (_this.element.value[prevPos] === ' ' && _this.element.selectionStart > 0 && !iOS) {\n if (isNullOrUndefined(_this.prevVal)) {\n _this.element.value = _this.element.value.trim();\n }\n else if (prevPos !== 0) {\n _this.element.value = _this.prevVal;\n }\n else if (prevPos === 0) {\n _this.element.value = _this.element.value.trim();\n }\n _this.element.setSelectionRange(prevPos, prevPos);\n }\n else if (isNaN(parseFloat(_this.element.value[_this.element.selectionStart - 1])) &&\n _this.element.value[_this.element.selectionStart - 1].charCodeAt(0) !== 45) {\n if ((valArray.indexOf(_this.element.value[_this.element.selectionStart - 1]) !==\n valArray.lastIndexOf(_this.element.value[_this.element.selectionStart - 1]) &&\n _this.element.value[_this.element.selectionStart - 1].charCodeAt(0) === ignoreKeyCode) ||\n _this.element.value[_this.element.selectionStart - 1].charCodeAt(0) !== ignoreKeyCode) {\n _this.element.value = _this.element.value.substring(0, prevPos) +\n _this.element.value.substring(currentPos, _this.element.value.length);\n _this.element.setSelectionRange(prevPos, prevPos);\n if (isNaN(parseFloat(_this.element.value[_this.element.selectionStart - 1])) && _this.element.selectionStart > 0\n && _this.element.value.length) {\n _this.preventHandler();\n }\n }\n }\n else if (isNaN(parseFloat(_this.element.value[_this.element.selectionStart - 2])) && _this.element.selectionStart > 1 &&\n _this.element.value[_this.element.selectionStart - 2].charCodeAt(0) !== 45) {\n if ((valArray.indexOf(_this.element.value[_this.element.selectionStart - 2]) !==\n valArray.lastIndexOf(_this.element.value[_this.element.selectionStart - 2]) &&\n _this.element.value[_this.element.selectionStart - 2].charCodeAt(0) === ignoreKeyCode) ||\n _this.element.value[_this.element.selectionStart - 2].charCodeAt(0) !== ignoreKeyCode) {\n _this.element.setSelectionRange(prevPos, prevPos);\n _this.nextEle = _this.element.value[_this.element.selectionStart];\n _this.cursorPosChanged = true;\n _this.preventHandler();\n }\n }\n if (_this.cursorPosChanged === true && _this.element.value[_this.element.selectionStart] === _this.nextEle &&\n isNaN(parseFloat(_this.element.value[_this.element.selectionStart - 1]))) {\n _this.element.setSelectionRange(_this.element.selectionStart + 1, _this.element.selectionStart + 1);\n _this.cursorPosChanged = false;\n _this.nextEle = null;\n }\n if (_this.element.value.trim() === '') {\n _this.element.setSelectionRange(start, start);\n }\n if (_this.element.selectionStart > 0) {\n if ((_this.element.value[_this.element.selectionStart - 1].charCodeAt(0) === 45) && _this.element.selectionStart > 1) {\n if (isNullOrUndefined(_this.prevVal)) {\n _this.element.value = _this.element.value;\n }\n else {\n _this.element.value = _this.prevVal;\n }\n _this.element.setSelectionRange(_this.element.selectionStart, _this.element.selectionStart);\n }\n }\n _this.prevVal = _this.element.value;\n }\n });\n };\n NumericTextBox.prototype.keyUpHandler = function (event) {\n var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);\n if (!iOS && Browser.isDevice) {\n this.preventHandler();\n }\n };\n ;\n NumericTextBox.prototype.inputHandler = function (event) {\n var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);\n if (iOS && Browser.isDevice) {\n this.preventHandler();\n }\n };\n ;\n NumericTextBox.prototype.keyDownHandler = function (event) {\n if (!this.readonly) {\n switch (event.keyCode) {\n case 38:\n event.preventDefault();\n this.action(INCREMENT, event);\n break;\n case 40:\n event.preventDefault();\n this.action(DECREMENT, event);\n break;\n default: break;\n }\n }\n };\n ;\n NumericTextBox.prototype.performAction = function (value, step, operation) {\n if (value === null || isNaN(value)) {\n value = 0;\n }\n var updatedValue = operation === INCREMENT ? value + step : value - step;\n updatedValue = this.correctRounding(value, step, updatedValue);\n return this.strictMode ? this.trimValue(updatedValue) : updatedValue;\n };\n ;\n NumericTextBox.prototype.correctRounding = function (value, step, result) {\n var floatExp = new RegExp('[,.](.*)');\n var valueText = value.toString();\n var stepText = step.toString();\n var floatValue = floatExp.test(value.toString());\n var floatStep = floatExp.test(step.toString());\n if (floatValue || floatStep) {\n var valueCount = floatValue ? floatExp.exec(value.toString())[0].length : 0;\n var stepCount = floatStep ? floatExp.exec(step.toString())[0].length : 0;\n var max = Math.max(valueCount, stepCount);\n return value = this.roundValue(result, max);\n }\n return result;\n };\n ;\n NumericTextBox.prototype.roundValue = function (result, precision) {\n precision = precision || 0;\n var divide = Math.pow(10, precision);\n return result *= divide, result = Math.round(result) / divide;\n };\n ;\n NumericTextBox.prototype.updateValue = function (value, event) {\n if (event) {\n this.isInteract = true;\n }\n if (value !== null && !isNaN(value)) {\n if (this.decimals) {\n value = this.roundNumber(value, this.decimals);\n }\n }\n this.changeValue(value === null || isNaN(value) ? null : this.strictMode ? this.trimValue(value) : value);\n this.raiseChangeEvent(event);\n };\n NumericTextBox.prototype.updateCurrency = function (prop, propVal) {\n setValue(prop, propVal, this.cultureInfo);\n this.updateValue(this.value);\n };\n NumericTextBox.prototype.changeValue = function (value) {\n if (!(value || value === 0)) {\n value = null;\n this.setProperties({ value: value }, true);\n }\n else {\n var numberOfDecimals = void 0;\n var decimalPart = value.toString().split('.')[1];\n numberOfDecimals = !decimalPart || !decimalPart.length ? 0 : decimalPart.length;\n if (this.decimals !== null) {\n numberOfDecimals = numberOfDecimals < this.decimals ? numberOfDecimals : this.decimals;\n }\n this.setProperties({ value: this.roundNumber(value, numberOfDecimals) }, true);\n }\n this.modifyText();\n if (!this.strictMode) {\n this.validateState();\n }\n };\n ;\n NumericTextBox.prototype.modifyText = function () {\n if (this.value || this.value === 0) {\n var value = this.formatNumber();\n var elementValue = this.isFocused ? value : this.instance.getNumberFormat(this.cultureInfo)(this.value);\n this.setElementValue(elementValue);\n attributes(this.element, { 'aria-valuenow': value });\n this.hiddenInput.value = value;\n }\n else {\n this.setElementValue('');\n this.element.removeAttribute('aria-valuenow');\n this.hiddenInput.value = null;\n }\n };\n ;\n NumericTextBox.prototype.setElementValue = function (val, element) {\n Input.setValue(val, (element ? element : this.element), this.floatLabelType, this.showClearButton);\n };\n NumericTextBox.prototype.validateState = function () {\n this.isValidState = true;\n if (this.value || this.value === 0) {\n this.isValidState = !(this.value > this.max || this.value < this.min);\n }\n this.checkErrorClass();\n };\n NumericTextBox.prototype.formatNumber = function () {\n var numberOfDecimals;\n var currentValue = this.value;\n var decimalPart = currentValue.toString().split('.')[1];\n numberOfDecimals = !decimalPart || !decimalPart.length ? 0 : decimalPart.length;\n if (this.decimals !== null) {\n numberOfDecimals = numberOfDecimals < this.decimals ? numberOfDecimals : this.decimals;\n }\n return this.instance.getNumberFormat({\n maximumFractionDigits: numberOfDecimals,\n minimumFractionDigits: numberOfDecimals, useGrouping: false\n })(this.value);\n };\n ;\n NumericTextBox.prototype.trimValue = function (value) {\n if (value > this.max) {\n return this.max;\n }\n if (value < this.min) {\n return this.min;\n }\n return value;\n };\n ;\n NumericTextBox.prototype.roundNumber = function (value, precision) {\n var result = value;\n var decimals = precision || 0;\n var result1 = result.toString().split('e');\n result = Math.round(Number(result1[0] + 'e' + (result1[1] ? (Number(result1[1]) + decimals) : decimals)));\n var result2 = result.toString().split('e');\n result = Number(result2[0] + 'e' + (result2[1] ? (Number(result2[1]) - decimals) : -decimals));\n return Number(result.toFixed(decimals));\n };\n ;\n NumericTextBox.prototype.cancelEvent = function (event) {\n event.preventDefault();\n return false;\n };\n NumericTextBox.prototype.keyPressHandler = function (event) {\n if (event.which === 0 || event.metaKey || event.ctrlKey || event.keyCode === 8 || event.keyCode === 13) {\n return true;\n }\n var currentChar = String.fromCharCode(event.which);\n var text = this.element.value;\n text = text.substring(0, this.element.selectionStart) + currentChar + text.substring(this.element.selectionEnd);\n if (!this.numericRegex().test(text)) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n else {\n return true;\n }\n };\n ;\n NumericTextBox.prototype.numericRegex = function () {\n var numericObject = getNumericObject(this.locale);\n var decimalSeparator = getValue('decimal', numericObject);\n var fractionRule = '*';\n if (decimalSeparator === DECIMALSEPARATOR) {\n decimalSeparator = '\\\\' + decimalSeparator;\n }\n if (this.decimals === 0) {\n return INTREGEXP;\n }\n if (this.decimals && this.validateDecimalOnType) {\n fractionRule = '{0,' + this.decimals + '}';\n }\n return new RegExp('^(-)?(((\\\\d+(' + decimalSeparator + '\\\\d' + fractionRule +\n ')?)|(' + decimalSeparator + '\\\\d' + fractionRule + ')))?$');\n };\n ;\n NumericTextBox.prototype.mouseWheel = function (event) {\n event.preventDefault();\n var delta;\n var rawEvent = event;\n if (rawEvent.wheelDelta) {\n delta = rawEvent.wheelDelta / 120;\n }\n else if (rawEvent.detail) {\n delta = -rawEvent.detail / 3;\n }\n if (delta > 0) {\n this.action(INCREMENT, event);\n }\n else if (delta < 0) {\n this.action(DECREMENT, event);\n }\n this.cancelEvent(event);\n };\n NumericTextBox.prototype.focusIn = function (event) {\n var _this = this;\n if (!this.enabled || this.readonly) {\n return;\n }\n this.isFocused = true;\n removeClass([this.container], ERROR);\n this.prevValue = this.value;\n if ((this.value || this.value === 0)) {\n var formatValue_1 = this.formatNumber();\n this.setElementValue(formatValue_1);\n if (!this.isPrevFocused) {\n var delay = (Browser.isDevice && Browser.isIos) ? 600 : 0;\n setTimeout(function () {\n _this.element.setSelectionRange(0, formatValue_1.length);\n }, delay);\n }\n }\n if (!Browser.isDevice) {\n EventHandler.add(this.element, 'mousewheel DOMMouseScroll', this.mouseWheel, this);\n }\n };\n ;\n NumericTextBox.prototype.focusOut = function (event) {\n var _this = this;\n if (this.isPrevFocused) {\n event.preventDefault();\n if (Browser.isDevice) {\n var value_1 = this.element.value;\n this.element.focus();\n this.isPrevFocused = false;\n var ele_1 = this.element;\n setTimeout(function () {\n _this.setElementValue(value_1, ele_1);\n }, 200);\n }\n }\n else {\n this.isFocused = false;\n if (!this.element.value.length) {\n this.setProperties({ value: null }, true);\n }\n var parsedInput = this.instance.getNumberParser({ format: 'n' })(this.element.value);\n this.updateValue(parsedInput);\n if (!Browser.isDevice) {\n EventHandler.remove(this.element, 'mousewheel DOMMouseScroll', this.mouseWheel);\n }\n }\n };\n ;\n NumericTextBox.prototype.mouseDownOnSpinner = function (event) {\n var _this = this;\n if (this.isFocused) {\n this.isPrevFocused = true;\n event.preventDefault();\n }\n if (!this.getElementData(event)) {\n return;\n }\n var result = this.getElementData(event);\n var target = event.currentTarget;\n var action = (target.classList.contains(SPINUP)) ? INCREMENT : DECREMENT;\n EventHandler.add(target, 'mouseleave', this.mouseUpClick, this);\n this.timeOut = setInterval(function () { _this.isCalled = true; _this.action(action, event); }, 150);\n EventHandler.add(document, 'mouseup', this.mouseUpClick, this);\n };\n NumericTextBox.prototype.touchMoveOnSpinner = function (event) {\n var target = document.elementFromPoint(event.clientX, event.clientY);\n if (!(target.classList.contains(SPINICON))) {\n clearInterval(this.timeOut);\n }\n };\n NumericTextBox.prototype.mouseUpOnSpinner = function (event) {\n if (this.isPrevFocused) {\n this.element.focus();\n if (!Browser.isDevice) {\n this.isPrevFocused = false;\n }\n }\n if (!Browser.isDevice) {\n event.preventDefault();\n }\n if (!this.getElementData(event)) {\n return;\n }\n var target = event.currentTarget;\n var action = (target.classList.contains(SPINUP)) ? INCREMENT : DECREMENT;\n EventHandler.remove(target, 'mouseleave', this.mouseUpClick);\n if (!this.isCalled) {\n this.action(action, event);\n }\n this.isCalled = false;\n EventHandler.remove(document, 'mouseup', this.mouseUpClick);\n };\n NumericTextBox.prototype.getElementData = function (event) {\n if ((event.which && event.which === 3) || (event.button && event.button === 2)\n || !this.enabled || this.readonly) {\n return false;\n }\n clearInterval(this.timeOut);\n return true;\n };\n NumericTextBox.prototype.floatLabelTypeUpdate = function () {\n Input.removeFloating(this.inputWrapper);\n var hiddenInput = this.hiddenInput;\n this.hiddenInput.remove();\n Input.addFloating(this.element, this.floatLabelType, this.placeholder);\n this.container.insertBefore(hiddenInput, this.container.childNodes[1]);\n };\n NumericTextBox.prototype.mouseUpClick = function (event) {\n event.stopPropagation();\n clearInterval(this.timeOut);\n this.isCalled = false;\n EventHandler.remove(this.spinUp, 'mouseleave', this.mouseUpClick);\n EventHandler.remove(this.spinDown, 'mouseleave', this.mouseUpClick);\n };\n /**\n * Increments the NumericTextBox value with the specified step value.\n * @param {number} step - Specifies the value used to increment the NumericTextBox value.\n * if its not given then numeric value will be incremented based on the step property value.\n */\n NumericTextBox.prototype.increment = function (step) {\n if (step === void 0) { step = this.step; }\n this.isInteract = false;\n this.changeValue(this.performAction(this.value, step, INCREMENT));\n this.raiseChangeEvent();\n };\n /**\n * Decrements the NumericTextBox value with specified step value.\n * @param {number} step - Specifies the value used to decrement the NumericTextBox value.\n * if its not given then numeric value will be decremented based on the step property value.\n */\n NumericTextBox.prototype.decrement = function (step) {\n if (step === void 0) { step = this.step; }\n this.isInteract = false;\n this.changeValue(this.performAction(this.value, step, DECREMENT));\n this.raiseChangeEvent();\n };\n /**\n * Removes the component from the DOM and detaches all its related event handlers.\n * Also it maintains the initial input element from the DOM.\n * @method destroy\n * @return {void}\n */\n NumericTextBox.prototype.destroy = function () {\n this.unwireEvents();\n detach(this.hiddenInput);\n if (this.showSpinButton) {\n this.unwireSpinBtnEvents();\n detach(this.spinUp);\n detach(this.spinDown);\n }\n this.container.parentElement.appendChild(this.cloneElement);\n detach(this.container);\n _super.prototype.destroy.call(this);\n };\n /**\n * Returns the value of NumericTextBox with the format applied to the NumericTextBox.\n */\n NumericTextBox.prototype.getText = function () {\n return this.element.value;\n };\n /**\n * Gets the properties to be maintained in the persisted state.\n * @return {string}\n */\n NumericTextBox.prototype.getPersistData = function () {\n var keyEntity = ['value'];\n return this.addOnPersist(keyEntity);\n };\n /**\n * Calls internally if any of the property value is changed.\n * @private\n */\n NumericTextBox.prototype.onPropertyChanged = function (newProp, oldProp) {\n var elementVal;\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'width':\n setStyleAttribute(this.container, { 'width': formatUnit(newProp.width) });\n break;\n case 'cssClass':\n Input.setCssClass(newProp.cssClass, [this.container], oldProp.cssClass);\n break;\n case 'enabled':\n Input.setEnabled(newProp.enabled, this.element);\n break;\n case 'enableRtl':\n Input.setEnableRtl(newProp.enableRtl, [this.container]);\n break;\n case 'readonly':\n Input.setReadonly(newProp.readonly, this.element);\n if (this.readonly) {\n attributes(this.element, { 'aria-readonly': 'true' });\n }\n else {\n this.element.removeAttribute('aria-readonly');\n }\n break;\n case 'placeholder':\n Input.setPlaceholder(newProp.placeholder, this.element);\n break;\n case 'step':\n this.step = newProp.step;\n this.validateStep();\n break;\n case 'showSpinButton':\n if (newProp.showSpinButton) {\n this.spinBtnCreation();\n }\n else {\n detach(this.spinUp);\n detach(this.spinDown);\n }\n break;\n case 'showClearButton':\n Input.setClearButton(newProp.showClearButton, this.element, this.inputWrapper);\n this.bindClearEvent();\n break;\n case 'floatLabelType':\n this.floatLabelType = newProp.floatLabelType;\n this.floatLabelTypeUpdate();\n break;\n case 'value':\n this.updateValue(newProp.value);\n break;\n case 'min':\n case 'max':\n setValue(prop, getValue(prop, newProp), this);\n this.validateMinMax();\n this.updateValue(this.value);\n break;\n case 'strictMode':\n this.strictMode = newProp.strictMode;\n this.updateValue(this.value);\n this.validateState();\n break;\n case 'locale':\n this.initCultureFunc();\n this.l10n.setLocale(this.locale);\n if (!isNullOrUndefined(this.spinDown)) {\n attributes(this.spinDown, {\n 'title': this.l10n.getConstant('decrementTitle'),\n 'aria-label': this.l10n.getConstant('decrementTitle')\n });\n }\n if (!isNullOrUndefined(this.spinUp)) {\n attributes(this.spinUp, {\n 'title': this.l10n.getConstant('incrementTitle'),\n 'aria-label': this.l10n.getConstant('incrementTitle')\n });\n }\n this.updatePlaceholder();\n Input.setPlaceholder(this.placeholder, this.element);\n this.updateValue(this.value);\n break;\n case 'currency':\n var propVal = getValue(prop, newProp);\n this.setProperties({ currencyCode: propVal }, true);\n this.updateCurrency(prop, propVal);\n break;\n case 'currencyCode':\n var propValue = getValue(prop, newProp);\n this.setProperties({ currency: propValue }, true);\n this.updateCurrency('currency', propValue);\n break;\n case 'format':\n setValue(prop, getValue(prop, newProp), this);\n this.initCultureInfo();\n this.updateValue(this.value);\n break;\n case 'decimals':\n this.decimals = newProp.decimals;\n this.updateValue(this.value);\n }\n }\n };\n /**\n * Gets the component name\n * @private\n */\n NumericTextBox.prototype.getModuleName = function () {\n return 'numerictextbox';\n };\n __decorate([\n Property('')\n ], NumericTextBox.prototype, \"cssClass\", void 0);\n __decorate([\n Property(null)\n ], NumericTextBox.prototype, \"value\", void 0);\n __decorate([\n Property(-(Number.MAX_VALUE))\n ], NumericTextBox.prototype, \"min\", void 0);\n __decorate([\n Property(Number.MAX_VALUE)\n ], NumericTextBox.prototype, \"max\", void 0);\n __decorate([\n Property(1)\n ], NumericTextBox.prototype, \"step\", void 0);\n __decorate([\n Property(null)\n ], NumericTextBox.prototype, \"width\", void 0);\n __decorate([\n Property(null)\n ], NumericTextBox.prototype, \"placeholder\", void 0);\n __decorate([\n Property(true)\n ], NumericTextBox.prototype, \"showSpinButton\", void 0);\n __decorate([\n Property(false)\n ], NumericTextBox.prototype, \"readonly\", void 0);\n __decorate([\n Property(true)\n ], NumericTextBox.prototype, \"enabled\", void 0);\n __decorate([\n Property(false)\n ], NumericTextBox.prototype, \"enableRtl\", void 0);\n __decorate([\n Property(false)\n ], NumericTextBox.prototype, \"showClearButton\", void 0);\n __decorate([\n Property(false)\n ], NumericTextBox.prototype, \"enablePersistence\", void 0);\n __decorate([\n Property('n2')\n ], NumericTextBox.prototype, \"format\", void 0);\n __decorate([\n Property(null)\n ], NumericTextBox.prototype, \"decimals\", void 0);\n __decorate([\n Property(null)\n ], NumericTextBox.prototype, \"currency\", void 0);\n __decorate([\n Property(null)\n ], NumericTextBox.prototype, \"currencyCode\", void 0);\n __decorate([\n Property(true)\n ], NumericTextBox.prototype, \"strictMode\", void 0);\n __decorate([\n Property(false)\n ], NumericTextBox.prototype, \"validateDecimalOnType\", void 0);\n __decorate([\n Property('Never')\n ], NumericTextBox.prototype, \"floatLabelType\", void 0);\n __decorate([\n Event()\n ], NumericTextBox.prototype, \"created\", void 0);\n __decorate([\n Event()\n ], NumericTextBox.prototype, \"destroyed\", void 0);\n __decorate([\n Event()\n ], NumericTextBox.prototype, \"change\", void 0);\n NumericTextBox = __decorate([\n NotifyPropertyChanges\n ], NumericTextBox);\n return NumericTextBox;\n}(Component));\nexport { NumericTextBox };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { selectAll, select, createElement, Base } from '@syncfusion/ej2-base';\nimport { extend, isNullOrUndefined, EventHandler } from '@syncfusion/ej2-base';\nimport { Property, NotifyPropertyChanges, Event } from '@syncfusion/ej2-base';\n/**\n * global declarations\n */\nvar VALIDATE_EMAIL = new RegExp('^[A-Za-z0-9._%+-]{3,}@[a-zA-Z]{3,}([.]{1}[a-zA-Z]{2,5}' +\n '|[.]{1}[a-zA-Z]{2,4}[.]{1}[a-zA-Z]{2,4})$');\nvar VALIDATE_URL = new RegExp('^((ftp|http|https):\\/\\/)?www\\.([A-z]{2,})\\.([A-z]{2,})$');\nvar VALIDATE_DATE_ISO = new RegExp('^([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$');\nvar VALIDATE_DIGITS = new RegExp('^[0-9]*$');\nvar VALIDATE_PHONE = new RegExp('^[+]?[0-9]{9,13}$');\nvar VALIDATE_CREDITCARD = new RegExp('^\\\\d{13,16}$');\n/**\n * ErrorOption values\n * @private\n */\nexport var ErrorOption;\n(function (ErrorOption) {\n ErrorOption[ErrorOption[\"Message\"] = 0] = \"Message\";\n ErrorOption[ErrorOption[\"Label\"] = 1] = \"Label\";\n})(ErrorOption || (ErrorOption = {}));\n/**\n * FormValidator class enables you to validate the form fields based on your defined rules\n * ```html\n * \n * \n * ```\n */\nvar FormValidator = /** @class */ (function (_super) {\n __extends(FormValidator, _super);\n // Initializes the FormValidator \n function FormValidator(element, options) {\n var _this = _super.call(this, options, element) || this;\n _this.validated = [];\n _this.errorRules = [];\n _this.allowSubmit = false;\n _this.required = 'required';\n _this.infoElement = null;\n _this.inputElement = null;\n _this.selectQuery = 'input:not([type=reset]):not([type=button]), select, textarea';\n /**\n * Specifies the default messages for validation rules.\n * @default : { List of validation message };\n */\n _this.defaultMessages = {\n required: 'This field is required.',\n email: 'Please enter a valid email address.',\n url: 'Please enter a valid URL.',\n date: 'Please enter a valid date.',\n dateIso: 'Please enter a valid date ( ISO ).',\n creditcard: 'Please enter valid card number',\n number: 'Please enter a valid number.',\n digits: 'Please enter only digits.',\n maxLength: 'Please enter no more than {0} characters.',\n minLength: 'Please enter at least {0} characters.',\n rangeLength: 'Please enter a value between {0} and {1} characters long.',\n range: 'Please enter a value between {0} and {1}.',\n max: 'Please enter a value less than or equal to {0}.',\n min: 'Please enter a value greater than or equal to {0}.',\n regex: 'Please enter a correct value.',\n tel: 'Please enter a valid phone number.',\n pattern: 'Please enter a correct pattern value.',\n equalTo: 'Please enter the valid match text',\n };\n if (typeof _this.rules === 'undefined') {\n _this.rules = {};\n }\n element = typeof element === 'string' ? select(element, document) : element;\n // Set novalidate to prevent default HTML5 form validation\n if (_this.element != null) {\n _this.element.setAttribute('novalidate', '');\n _this.inputElements = selectAll(_this.selectQuery, _this.element);\n _this.createHTML5Rules();\n _this.wireEvents();\n }\n else {\n return undefined;\n }\n return _this;\n }\n FormValidator_1 = FormValidator;\n /**\n * Add validation rules to the corresponding input element based on `name` attribute.\n * @param {string} name `name` of form field.\n * @param {Object} rules Validation rules for the corresponding element.\n * @return {void}\n */\n FormValidator.prototype.addRules = function (name, rules) {\n if (name) {\n if (this.rules.hasOwnProperty(name)) {\n extend(this.rules[name], rules, {});\n }\n else {\n this.rules[name] = rules;\n }\n }\n };\n /**\n * Remove validation to the corresponding field based on name attribute.\n * When no parameter is passed, remove all the validations in the form.\n * @param {string} name Input name attribute value.\n * @param {string[]} rules List of validation rules need to be remove from the corresponding element.\n * @return {void}\n */\n FormValidator.prototype.removeRules = function (name, rules) {\n if (!name && !rules) {\n this.rules = {};\n }\n else if (this.rules[name] && !rules) {\n delete this.rules[name];\n }\n else if (!isNullOrUndefined(this.rules[name] && rules)) {\n for (var i = 0; i < rules.length; i++) {\n delete this.rules[name][rules[i]];\n }\n }\n else {\n return;\n }\n };\n /**\n * Validate the current form values using defined rules.\n * Returns `true` when the form is valid otherwise `false`\n * @param {string} selected - Optional parameter to validate specified element.\n * @return {boolean}\n */\n FormValidator.prototype.validate = function (selected) {\n var rules = Object.keys(this.rules);\n if (selected && rules.length) {\n this.validateRules(selected);\n //filter the selected element it don't have any valid input element\n return rules.indexOf(selected) !== -1 && this.errorRules.filter(function (data) {\n return data.name === selected;\n }).length === 0;\n }\n else {\n for (var _i = 0, rules_1 = rules; _i < rules_1.length; _i++) {\n var name_1 = rules_1[_i];\n this.validateRules(name_1);\n }\n return this.errorRules.length === 0;\n }\n };\n /**\n * Reset the value of all the fields in form.\n * @return {void}\n */\n FormValidator.prototype.reset = function () {\n this.element.reset();\n this.clearForm();\n };\n /**\n * Get input element by name.\n * @param {string} name - Input element name attribute value.\n * @return {HTMLInputElement}\n */\n FormValidator.prototype.getInputElement = function (name) {\n this.inputElement = (select('[name=' + name + ']', this.element));\n return this.inputElement;\n };\n /**\n * Destroy the form validator object and error elements.\n * @return {void}\n */\n FormValidator.prototype.destroy = function () {\n this.reset();\n this.unwireEvents();\n this.rules = {};\n var elements = selectAll('.' + this.errorClass + ', .' + this.validClass, this.element);\n for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {\n var element = elements_1[_i];\n element.remove();\n }\n _super.prototype.destroy.call(this);\n };\n /**\n * @private\n */\n FormValidator.prototype.onPropertyChanged = function (newProp, oldProp) {\n // No code are needed\n };\n ;\n /**\n * @private\n */\n FormValidator.prototype.getModuleName = function () {\n return 'formValidator';\n };\n FormValidator.prototype.clearForm = function () {\n this.errorRules = [];\n this.validated = [];\n var elements = selectAll(this.selectQuery, this.element);\n for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {\n var element = elements_2[_i];\n var input = element;\n input.removeAttribute('aria-invalid');\n input.classList.remove(this.errorClass);\n if (input.name.length > 0) {\n this.getInputElement(input.name);\n this.getErrorElement(input.name);\n this.hideMessage(input.name);\n }\n input.classList.remove(this.validClass);\n }\n };\n FormValidator.prototype.createHTML5Rules = function () {\n var defRules = ['required', 'validateHidden', 'regex', 'rangeLength', 'maxLength', 'minLength', 'dateIso', 'digits',\n 'pattern', 'data-val-required', 'type', 'data-validation', 'min', 'max', 'range', 'equalTo', 'data-val-minlength-min',\n 'data-val-equalto-other', 'data-val-maxlength-max', 'data-val-range-min', 'data-val-regex-pattern', 'data-val-length-max',\n 'data-val-creditcard', 'data-val-phone'];\n var acceptedTypes = ['hidden', 'email', 'url', 'date', 'number', 'tel'];\n for (var _i = 0, _a = (this.inputElements); _i < _a.length; _i++) {\n var input = _a[_i];\n // Default attribute rules \n var allRule = {};\n for (var _b = 0, defRules_1 = defRules; _b < defRules_1.length; _b++) {\n var rule = defRules_1[_b];\n if (input.getAttribute(rule) !== null) {\n switch (rule) {\n case 'required':\n this.defRule(input, allRule, rule, input.required);\n break;\n case 'data-validation':\n rule = input.getAttribute(rule);\n this.defRule(input, allRule, rule, true);\n break;\n case 'type':\n if (acceptedTypes.indexOf(input.type) !== -1) {\n this.defRule(input, allRule, input.type, true);\n }\n break;\n case 'rangeLength':\n case 'range':\n this.defRule(input, allRule, rule, JSON.parse(input.getAttribute(rule)));\n break;\n case 'equalTo':\n var id = input.getAttribute(rule);\n this.defRule(input, allRule, rule, id);\n break;\n default:\n if (input.getAttribute('data-val') === 'true') {\n this.annotationRule(input, allRule, rule, input.getAttribute(rule));\n }\n else {\n this.defRule(input, allRule, rule, input.getAttribute(rule));\n }\n }\n }\n }\n //adding pattern type validation\n if (Object.keys(allRule).length !== 0) {\n this.addRules(input.name, allRule);\n }\n }\n };\n FormValidator.prototype.annotationRule = function (input, ruleCon, ruleName, value) {\n var annotationRule = ruleName.split('-');\n var rulesList = ['required', 'creditcard', 'phone', 'maxlength', 'minlength', 'range', 'regex', 'equalto'];\n var ruleFirstName = annotationRule[annotationRule.length - 1];\n var ruleSecondName = annotationRule[annotationRule.length - 2];\n if (rulesList.indexOf(ruleFirstName) !== -1) {\n switch (ruleFirstName) {\n case 'required':\n this.defRule(input, ruleCon, 'required', value);\n break;\n case 'creditcard':\n this.defRule(input, ruleCon, 'creditcard', value);\n break;\n case 'phone':\n this.defRule(input, ruleCon, 'tel', value);\n break;\n }\n }\n else if (rulesList.indexOf(ruleSecondName) !== -1) {\n switch (ruleSecondName) {\n case 'maxlength':\n this.defRule(input, ruleCon, 'maxLength', value);\n break;\n case 'minlength':\n this.defRule(input, ruleCon, 'minLength', value);\n break;\n case 'range':\n var minvalue = input.getAttribute('data-val-range-min');\n var maxvalue = input.getAttribute('data-val-range-max');\n this.defRule(input, ruleCon, 'range', [minvalue, maxvalue]);\n break;\n case 'equalto':\n var id = input.getAttribute(ruleName).split('.');\n this.defRule(input, ruleCon, 'equalTo', id[id.length - 1]);\n break;\n case 'regex':\n this.defRule(input, ruleCon, 'regex', value);\n break;\n }\n }\n };\n FormValidator.prototype.defRule = function (input, ruleCon, ruleName, value) {\n var message = input.getAttribute('data-' + ruleName + '-message');\n var annotationMessage = input.getAttribute('data-val-' + ruleName);\n if (message) {\n value = [value, message];\n }\n else if (annotationMessage) {\n value = [value, annotationMessage];\n }\n ruleCon[ruleName] = value;\n };\n // Wire events to the form elements\n FormValidator.prototype.wireEvents = function () {\n for (var _i = 0, _a = (this.inputElements); _i < _a.length; _i++) {\n var input = _a[_i];\n if (FormValidator_1.isCheckable(input)) {\n EventHandler.add(input, 'click', this.clickHandler, this);\n }\n else if (input.tagName === 'SELECT') {\n EventHandler.add(input, 'change', this.changeHandler, this);\n }\n else {\n EventHandler.add(input, 'focusout', this.focusOutHandler, this);\n EventHandler.add(input, 'keyup', this.keyUpHandler, this);\n }\n }\n EventHandler.add(this.element, 'submit', this.submitHandler, this);\n EventHandler.add(this.element, 'reset', this.resetHandler, this);\n };\n // UnWire events to the form elements\n FormValidator.prototype.unwireEvents = function () {\n for (var _i = 0, _a = (this.inputElements); _i < _a.length; _i++) {\n var input = _a[_i];\n EventHandler.clearEvents(input);\n }\n EventHandler.remove(this.element, 'submit', this.submitHandler);\n EventHandler.remove(this.element, 'reset', this.resetHandler);\n };\n // Handle input element focusout event\n FormValidator.prototype.focusOutHandler = function (e) {\n this.trigger('focusout', e);\n //FormValidator.triggerCallback(this.focusout, e);\n var element = e.target;\n if (this.rules[element.name]) {\n if (this.rules[element.name][this.required] || element.value.length > 0) {\n this.validate(element.name);\n }\n else if (this.validated.indexOf(element.name) === -1) {\n this.validated.push(element.name);\n }\n }\n };\n // Handle input element keyup event\n FormValidator.prototype.keyUpHandler = function (e) {\n this.trigger('keyup', e);\n var element = e.target;\n // List of keys need to prevent while validation\n var excludeKeys = [16, 17, 18, 20, 35, 36, 37, 38, 39, 40, 45, 144, 225];\n if (e.which === 9 && (!this.rules[element.name] || (this.rules[element.name] && !this.rules[element.name][this.required]))) {\n return;\n }\n if (this.validated.indexOf(element.name) !== -1 && this.rules[element.name] && excludeKeys.indexOf(e.which) === -1) {\n this.validate(element.name);\n }\n };\n // Handle input click event\n FormValidator.prototype.clickHandler = function (e) {\n this.trigger('click', e);\n var element = e.target;\n // If element type is not submit allow validation\n if (element.type !== 'submit') {\n this.validate(element.name);\n }\n else if (element.getAttribute('formnovalidate') !== null) {\n // Prevent form validation, if submit button has formnovalidate attribute\n this.allowSubmit = true;\n }\n };\n // Handle input change event\n FormValidator.prototype.changeHandler = function (e) {\n this.trigger('change', e);\n var element = e.target;\n this.validate(element.name);\n };\n // Handle form submit event\n FormValidator.prototype.submitHandler = function (e) {\n this.trigger('submit', e);\n //FormValidator.triggerCallback(this.submit, e);\n // Prevent form submit if validation failed\n if (!this.allowSubmit && !this.validate()) {\n e.preventDefault();\n }\n else {\n this.allowSubmit = false;\n }\n };\n // Handle form reset\n FormValidator.prototype.resetHandler = function () {\n this.clearForm();\n };\n // Validate each rule based on input element name\n FormValidator.prototype.validateRules = function (name) {\n if (!this.rules[name]) {\n return;\n }\n var rules = Object.keys(this.rules[name]);\n var hiddenType = false;\n var validateHiddenType = false;\n var vhPos = rules.indexOf('validateHidden');\n var hPos = rules.indexOf('hidden');\n this.getInputElement(name);\n if (hPos !== -1) {\n hiddenType = true;\n }\n if (vhPos !== -1) {\n validateHiddenType = true;\n }\n if (!hiddenType || (hiddenType && validateHiddenType)) {\n if (vhPos !== -1) {\n rules.splice(vhPos, 1);\n }\n if (hPos !== -1) {\n rules.splice((hPos - 1), 1);\n }\n this.getErrorElement(name);\n for (var _i = 0, rules_2 = rules; _i < rules_2.length; _i++) {\n var rule = rules_2[_i];\n var errorMessage = this.getErrorMessage(this.rules[name][rule], rule);\n var errorRule = { name: name, message: errorMessage };\n var eventArgs = {\n inputName: name,\n element: this.inputElement,\n message: errorMessage\n };\n if (!this.isValid(name, rule) && !this.inputElement.classList.contains(this.ignore)) {\n this.removeErrorRules(name);\n this.errorRules.push(errorRule);\n // Set aria attributes to invalid elements\n this.inputElement.setAttribute('aria-invalid', 'true');\n this.inputElement.setAttribute('aria-describedby', this.inputElement.id + '-info');\n this.inputElement.classList.add(this.errorClass);\n this.inputElement.classList.remove(this.validClass);\n if (!this.infoElement) {\n this.createErrorElement(name, errorRule.message, this.inputElement);\n }\n else {\n this.showMessage(errorRule);\n }\n eventArgs.errorElement = this.infoElement;\n eventArgs.status = 'failure';\n this.trigger('validationComplete', eventArgs);\n // Set aria-required to required rule elements\n if (rule === 'required') {\n this.inputElement.setAttribute('aria-required', 'true');\n }\n break;\n }\n else {\n this.hideMessage(name);\n eventArgs.status = 'success';\n this.trigger('validationComplete', eventArgs);\n }\n }\n }\n else {\n return;\n }\n };\n // Check the input element whether it's value satisfy the validation rule or not\n FormValidator.prototype.isValid = function (name, rule) {\n var params = this.rules[name][rule];\n var param = (params instanceof Array && typeof params[1] === 'string') ? params[0] : params;\n var currentRule = this.rules[name][rule];\n var args = { value: this.inputElement.value, param: param, element: this.inputElement, formElement: this.element };\n this.trigger('validationBegin', args);\n if (currentRule && typeof currentRule[0] === 'function') {\n var fn = currentRule[0];\n return fn.call(this, { element: this.inputElement, value: this.inputElement.value });\n }\n else if (FormValidator_1.isCheckable(this.inputElement)) {\n if (rule !== 'required') {\n return true;\n }\n return selectAll('input[name=' + name + ']:checked', this.element).length > 0;\n }\n else {\n return FormValidator_1.checkValidator[rule](args);\n }\n };\n // Return default error message or custom error message \n FormValidator.prototype.getErrorMessage = function (ruleValue, rule) {\n var message = (ruleValue instanceof Array && typeof ruleValue[1] === 'string') ? ruleValue[1] : this.defaultMessages[rule];\n var formats = message.match(/{(\\d)}/g);\n if (!isNullOrUndefined(formats)) {\n for (var i = 0; i < formats.length; i++) {\n var value = ruleValue instanceof Array ? ruleValue[i] : ruleValue;\n message = message.replace(formats[i], value);\n }\n }\n return message;\n };\n // Create error element based on name and error message\n FormValidator.prototype.createErrorElement = function (name, message, input) {\n var errorElement = createElement(this.errorElement, {\n className: this.errorClass,\n innerHTML: message,\n attrs: { for: name }\n });\n // Create message design if errorOption is message\n if (this.errorOption === ErrorOption.Message) {\n errorElement.classList.remove(this.errorClass);\n errorElement.classList.add('e-message');\n errorElement = createElement(this.errorContainer, { className: this.errorClass, innerHTML: errorElement.outerHTML });\n }\n errorElement.id = this.inputElement.name + '-info';\n // Append error message into MVC error message element\n if (this.element.querySelector('[data-valmsg-for=\"' + input.id + '\"]')) {\n this.element.querySelector('[data-valmsg-for=\"' + input.id + '\"]').appendChild(errorElement);\n }\n else if (input.hasAttribute('data-msg-containerid') === true) {\n // Append error message into custom div element\n var containerId = input.getAttribute('data-msg-containerid');\n var divElement = this.element.querySelector('#' + containerId);\n divElement.appendChild(errorElement);\n }\n else if (this.customPlacement != null) {\n // Call custom placement function if customPlacement is not null\n this.customPlacement.call(this, this.inputElement, errorElement);\n }\n else {\n this.inputElement.parentNode.insertBefore(errorElement, this.inputElement.nextSibling);\n }\n errorElement.style.display = 'block';\n this.getErrorElement(name);\n this.validated.push(name);\n this.checkRequired(name);\n };\n // Get error element by name\n FormValidator.prototype.getErrorElement = function (name) {\n this.infoElement = select(this.errorElement + '.' + this.errorClass, this.inputElement.parentElement);\n if (!this.infoElement) {\n this.infoElement = select(this.errorElement + '.' + this.errorClass + '[for=\"' + name + '\"]');\n }\n return this.infoElement;\n };\n // Remove existing rule from errorRules object\n FormValidator.prototype.removeErrorRules = function (name) {\n for (var i = 0; i < this.errorRules.length; i++) {\n var rule = this.errorRules[i];\n if (rule.name === name) {\n this.errorRules.splice(i, 1);\n }\n }\n };\n // Show error message to the input element\n FormValidator.prototype.showMessage = function (errorRule) {\n this.infoElement.style.display = 'block';\n this.infoElement.innerHTML = errorRule.message;\n this.checkRequired(errorRule.name);\n };\n // Hide error message based on input name\n FormValidator.prototype.hideMessage = function (name) {\n if (this.infoElement) {\n this.infoElement.style.display = 'none';\n this.removeErrorRules(name);\n this.inputElement.classList.add(this.validClass);\n this.inputElement.classList.remove(this.errorClass);\n this.inputElement.setAttribute('aria-invalid', 'false');\n }\n };\n // Check whether the input element have required rule and its value is not empty\n FormValidator.prototype.checkRequired = function (name) {\n if (!this.rules[name][this.required] && !this.inputElement.value.length) {\n this.infoElement.innerHTML = this.inputElement.value;\n this.infoElement.setAttribute('aria-invalid', 'false');\n this.hideMessage(name);\n }\n };\n // Return boolean result if the input have chekcable or submit types\n FormValidator.isCheckable = function (input) {\n var inputType = input.getAttribute('type');\n return inputType && (inputType === 'checkbox' || inputType === 'radio' || inputType === 'submit');\n };\n // List of function to validate the rules\n FormValidator.checkValidator = {\n required: function (option) {\n return option.value.length > 0;\n },\n email: function (option) {\n return VALIDATE_EMAIL.test(option.value);\n },\n url: function (option) {\n return VALIDATE_URL.test(option.value);\n },\n dateIso: function (option) {\n return VALIDATE_DATE_ISO.test(option.value);\n },\n tel: function (option) {\n return VALIDATE_PHONE.test(option.value);\n },\n creditcard: function (option) {\n return VALIDATE_CREDITCARD.test(option.value);\n },\n number: function (option) {\n return !isNaN(Number(option.value)) && option.value.indexOf(' ') === -1;\n },\n digits: function (option) {\n return VALIDATE_DIGITS.test(option.value);\n },\n maxLength: function (option) {\n return option.value.length <= option.param;\n },\n minLength: function (option) {\n return option.value.length >= option.param;\n },\n rangeLength: function (option) {\n var param = option.param;\n return option.value.length >= param[0] && option.value.length <= param[1];\n },\n range: function (option) {\n var param = option.param;\n return !isNaN(Number(option.value)) && Number(option.value) >= param[0] && Number(option.value) <= param[1];\n },\n date: function (option) {\n return !isNaN(new Date(option.value).getTime());\n },\n max: function (option) {\n if (!isNaN(Number(option.value))) {\n // Maximum rule validation for number\n return +option.value <= option.param;\n }\n // Maximum rule validation for date\n return new Date(option.value).getTime() <= new Date(JSON.parse(JSON.stringify(option.param))).getTime();\n },\n min: function (option) {\n if (!isNaN(Number(option.value))) {\n // Minimum rule validation for number\n return +option.value >= option.param;\n }\n // Minimum rule validation for date\n return new Date(option.value).getTime() >= new Date(JSON.parse(JSON.stringify(option.param))).getTime();\n },\n regex: function (option) {\n return new RegExp(option.param).test(option.value);\n },\n equalTo: function (option) {\n var compareTo = option.formElement.querySelector('#' + option.param);\n option.param = compareTo.value;\n return option.param === option.value;\n },\n };\n __decorate([\n Property('e-hidden')\n ], FormValidator.prototype, \"ignore\", void 0);\n __decorate([\n Property()\n ], FormValidator.prototype, \"rules\", void 0);\n __decorate([\n Property('e-error')\n ], FormValidator.prototype, \"errorClass\", void 0);\n __decorate([\n Property('e-valid')\n ], FormValidator.prototype, \"validClass\", void 0);\n __decorate([\n Property('label')\n ], FormValidator.prototype, \"errorElement\", void 0);\n __decorate([\n Property('div')\n ], FormValidator.prototype, \"errorContainer\", void 0);\n __decorate([\n Property(ErrorOption.Label)\n ], FormValidator.prototype, \"errorOption\", void 0);\n __decorate([\n Event()\n ], FormValidator.prototype, \"focusout\", void 0);\n __decorate([\n Event()\n ], FormValidator.prototype, \"keyup\", void 0);\n __decorate([\n Event()\n ], FormValidator.prototype, \"click\", void 0);\n __decorate([\n Event()\n ], FormValidator.prototype, \"change\", void 0);\n __decorate([\n Event()\n ], FormValidator.prototype, \"submit\", void 0);\n __decorate([\n Event()\n ], FormValidator.prototype, \"validationBegin\", void 0);\n __decorate([\n Event()\n ], FormValidator.prototype, \"validationComplete\", void 0);\n __decorate([\n Event()\n ], FormValidator.prototype, \"customPlacement\", void 0);\n FormValidator = FormValidator_1 = __decorate([\n NotifyPropertyChanges\n ], FormValidator);\n return FormValidator;\n var FormValidator_1;\n}(Base));\nexport { FormValidator };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, Event, Property, NotifyPropertyChanges } from '@syncfusion/ej2-base';\nimport { isNullOrUndefined, formatUnit, getValue, setValue, addClass, detach, createElement } from '@syncfusion/ej2-base';\nimport { Input } from '../../input/input';\nimport { regularExpressions, createMask, applyMask, wireEvents, unwireEvents, unstrippedValue, strippedValue } from '../base/index';\nimport { setMaskValue, setElementValue, bindClearEvent } from '../base/index';\nimport { maskInputBlurHandler } from '../base/mask-base';\nvar ROOT = 'e-widget e-control-wrapper e-mask';\nvar INPUT = 'e-input';\n/**\n * The MaskedTextBox allows the user to enter the valid input only based on the provided mask.\n * ```html\n * \n * ```\n * ```typescript\n * \n * ```\n */\nvar MaskedTextBox = /** @class */ (function (_super) {\n __extends(MaskedTextBox, _super);\n function MaskedTextBox(options, element) {\n return _super.call(this, options, element) || this;\n }\n /**\n * Gets the component name\n * @private\n */\n MaskedTextBox.prototype.getModuleName = function () {\n return 'maskedtextbox';\n };\n /**\n * Initializes the event handler\n * @private\n */\n MaskedTextBox.prototype.preRender = function () {\n this.promptMask = '';\n this.hiddenMask = '';\n this.escapeMaskValue = '';\n this.regExpCollec = regularExpressions;\n this.customRegExpCollec = [];\n this.undoCollec = [];\n this.redoCollec = [];\n this.changeEventArgs = {};\n this.focusEventArgs = {};\n this.maskKeyPress = false;\n this.isFocus = false;\n this.isInitial = false;\n this.isIosInvalid = false;\n var ejInstance = getValue('ej2_instances', this.element);\n this.cloneElement = this.element.cloneNode(true);\n this.angularTagName = null;\n if (this.element.tagName === 'EJS-MASKEDTEXTBOX') {\n this.angularTagName = this.element.tagName;\n var input = createElement('input');\n for (var i = 0; i < this.element.attributes.length; i++) {\n input.setAttribute(this.element.attributes[i].nodeName, this.element.attributes[i].nodeValue);\n input.innerHTML = this.element.innerHTML;\n }\n if (this.element.hasAttribute('id')) {\n this.element.removeAttribute('id');\n }\n this.element.classList.remove('e-control', 'e-maskedtextbox');\n this.element.classList.add('e-mask-container');\n this.element.appendChild(input);\n this.element = input;\n setValue('ej2_instances', ejInstance, this.element);\n }\n };\n /**\n * Gets the properties to be maintained in the persisted state.\n * @return {string}\n */\n MaskedTextBox.prototype.getPersistData = function () {\n var keyEntity = ['value'];\n return this.addOnPersist(keyEntity);\n };\n /**\n * Initializes the component rendering.\n * @private\n */\n MaskedTextBox.prototype.render = function () {\n if (this.element.tagName.toLowerCase() === 'input') {\n if (this.floatLabelType === 'Never') {\n addClass([this.element], INPUT);\n }\n this.createWrapper();\n this.isInitial = true;\n this.resetMaskedTextBox();\n this.isInitial = false;\n this.setMaskPlaceholder(true, false);\n this.setWidth(this.width);\n }\n };\n MaskedTextBox.prototype.resetMaskedTextBox = function () {\n this.promptMask = '';\n this.hiddenMask = '';\n this.escapeMaskValue = '';\n this.customRegExpCollec = [];\n this.undoCollec = [];\n this.redoCollec = [];\n if (this.promptChar.length > 1) {\n this.promptChar = this.promptChar[0];\n }\n createMask.call(this);\n applyMask.call(this);\n if (this.mask === null || this.mask === '' && this.value !== undefined) {\n setElementValue.call(this, this.value);\n }\n var val = strippedValue.call(this, this.element);\n this.prevValue = val;\n this.value = val;\n if (!this.isInitial) {\n unwireEvents.call(this);\n }\n wireEvents.call(this);\n };\n MaskedTextBox.prototype.setMaskPlaceholder = function (setVal, dynamicPlaceholder) {\n if (dynamicPlaceholder || this.placeholder) {\n Input.setPlaceholder(this.placeholder, this.element);\n if (this.element.value === this.promptMask && setVal && this.floatLabelType !== 'Always') {\n setElementValue.call(this, '');\n }\n if (this.floatLabelType === 'Never') {\n maskInputBlurHandler.call(this);\n }\n }\n };\n MaskedTextBox.prototype.setCssClass = function (cssClass, element) {\n if (cssClass) {\n addClass(element, cssClass);\n }\n };\n MaskedTextBox.prototype.setWidth = function (width) {\n if (!isNullOrUndefined(width)) {\n this.element.style.width = formatUnit(width);\n this.inputObj.container.style.width = formatUnit(width);\n }\n };\n MaskedTextBox.prototype.createWrapper = function () {\n this.inputObj = Input.createInput({\n element: this.element,\n floatLabelType: this.floatLabelType,\n properties: {\n enableRtl: this.enableRtl,\n cssClass: this.cssClass,\n enabled: this.enabled,\n placeholder: this.placeholder,\n showClearButton: this.showClearButton\n }\n });\n this.inputObj.container.setAttribute('class', ROOT + ' ' + this.inputObj.container.getAttribute('class'));\n };\n /**\n * Calls internally if any of the property value is changed.\n * @hidden\n */\n MaskedTextBox.prototype.onPropertyChanged = function (newProp, oldProp) {\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'value':\n setMaskValue.call(this, this.value);\n if (this.placeholder) {\n this.setMaskPlaceholder(false, false);\n }\n break;\n case 'placeholder':\n this.setMaskPlaceholder(true, true);\n break;\n case 'width':\n this.setWidth(newProp.width);\n break;\n case 'cssClass':\n this.setCssClass(newProp.cssClass, [this.inputObj.container]);\n break;\n case 'enabled':\n Input.setEnabled(newProp.enabled, this.element);\n break;\n case 'enableRtl':\n Input.setEnableRtl(newProp.enableRtl, [this.inputObj.container]);\n break;\n case 'customCharacters':\n this.customCharacters = newProp.customCharacters;\n this.resetMaskedTextBox();\n break;\n case 'showClearButton':\n Input.setClearButton(newProp.showClearButton, this.element, this.inputObj);\n bindClearEvent.call(this);\n break;\n case 'floatLabelType':\n this.floatLabelType = newProp.floatLabelType;\n Input.removeFloating(this.inputObj);\n Input.addFloating(this.element, this.floatLabelType, this.placeholder);\n break;\n case 'mask':\n var strippedValue_1 = this.value;\n this.mask = newProp.mask;\n this.updateValue(strippedValue_1);\n break;\n case 'promptChar':\n if (newProp.promptChar.length > 1) {\n newProp.promptChar = newProp.promptChar[0];\n }\n if (newProp.promptChar) {\n this.promptChar = newProp.promptChar;\n }\n else {\n this.promptChar = '_';\n }\n var value = this.element.value.replace(new RegExp('[' + oldProp.promptChar + ']', 'g'), this.promptChar);\n if (this.promptMask === this.element.value) {\n value = this.promptMask.replace(new RegExp('[' + oldProp.promptChar + ']', 'g'), this.promptChar);\n }\n this.promptMask = this.promptMask.replace(new RegExp('[' + oldProp.promptChar + ']', 'g'), this.promptChar);\n this.undoCollec = this.redoCollec = [];\n setElementValue.call(this, value);\n break;\n }\n }\n };\n MaskedTextBox.prototype.updateValue = function (strippedVal) {\n this.resetMaskedTextBox();\n setMaskValue.call(this, strippedVal);\n };\n /**\n * Gets the value of the MaskedTextBox with the masked format.\n * By using `value` property, you can get the raw value of maskedtextbox without literals and prompt characters.\n * @return {string}\n */\n MaskedTextBox.prototype.getMaskedValue = function () {\n return unstrippedValue.call(this, this.element);\n };\n /**\n * Removes the component from the DOM and detaches all its related event handlers.\n * Also it maintains the initial input element from the DOM.\n * @method destroy\n * @return {void}\n */\n MaskedTextBox.prototype.destroy = function () {\n unwireEvents.call(this);\n this.inputObj.container.parentElement.appendChild(this.cloneElement);\n detach(this.inputObj.container);\n _super.prototype.destroy.call(this);\n };\n __decorate([\n Property(null)\n ], MaskedTextBox.prototype, \"cssClass\", void 0);\n __decorate([\n Property(null)\n ], MaskedTextBox.prototype, \"width\", void 0);\n __decorate([\n Property(null)\n ], MaskedTextBox.prototype, \"placeholder\", void 0);\n __decorate([\n Property('Never')\n ], MaskedTextBox.prototype, \"floatLabelType\", void 0);\n __decorate([\n Property(true)\n ], MaskedTextBox.prototype, \"enabled\", void 0);\n __decorate([\n Property(false)\n ], MaskedTextBox.prototype, \"showClearButton\", void 0);\n __decorate([\n Property(false)\n ], MaskedTextBox.prototype, \"enablePersistence\", void 0);\n __decorate([\n Property(false)\n ], MaskedTextBox.prototype, \"enableRtl\", void 0);\n __decorate([\n Property(null)\n ], MaskedTextBox.prototype, \"mask\", void 0);\n __decorate([\n Property('_')\n ], MaskedTextBox.prototype, \"promptChar\", void 0);\n __decorate([\n Property(null)\n ], MaskedTextBox.prototype, \"value\", void 0);\n __decorate([\n Property(null)\n ], MaskedTextBox.prototype, \"customCharacters\", void 0);\n __decorate([\n Event()\n ], MaskedTextBox.prototype, \"created\", void 0);\n __decorate([\n Event()\n ], MaskedTextBox.prototype, \"destroyed\", void 0);\n __decorate([\n Event()\n ], MaskedTextBox.prototype, \"change\", void 0);\n __decorate([\n Event()\n ], MaskedTextBox.prototype, \"focus\", void 0);\n MaskedTextBox = __decorate([\n NotifyPropertyChanges\n ], MaskedTextBox);\n return MaskedTextBox;\n}(Component));\nexport { MaskedTextBox };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, EventHandler, Property, Event, Complex } from '@syncfusion/ej2-base';\nimport { L10n, Internationalization } from '@syncfusion/ej2-base';\nimport { NotifyPropertyChanges, ChildProperty } from '@syncfusion/ej2-base';\nimport { createElement, attributes, addClass, removeClass, setStyleAttribute, detach } from '@syncfusion/ej2-base';\nimport { isNullOrUndefined, formatUnit, Browser } from '@syncfusion/ej2-base';\nimport { Tooltip } from '@syncfusion/ej2-popups';\n/**\n * Configures the ticks data of the Slider.\n */\nvar TicksData = /** @class */ (function (_super) {\n __extends(TicksData, _super);\n function TicksData() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('None')\n ], TicksData.prototype, \"placement\", void 0);\n __decorate([\n Property(10)\n ], TicksData.prototype, \"largeStep\", void 0);\n __decorate([\n Property(1)\n ], TicksData.prototype, \"smallStep\", void 0);\n __decorate([\n Property(false)\n ], TicksData.prototype, \"showSmallTicks\", void 0);\n __decorate([\n Property(null)\n ], TicksData.prototype, \"format\", void 0);\n return TicksData;\n}(ChildProperty));\nexport { TicksData };\n/**\n * It illustrates the limit data in slider.\n */\nvar LimitData = /** @class */ (function (_super) {\n __extends(LimitData, _super);\n function LimitData() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property(false)\n ], LimitData.prototype, \"enabled\", void 0);\n __decorate([\n Property(null)\n ], LimitData.prototype, \"minStart\", void 0);\n __decorate([\n Property(null)\n ], LimitData.prototype, \"minEnd\", void 0);\n __decorate([\n Property(null)\n ], LimitData.prototype, \"maxStart\", void 0);\n __decorate([\n Property(null)\n ], LimitData.prototype, \"maxEnd\", void 0);\n __decorate([\n Property(false)\n ], LimitData.prototype, \"startHandleFixed\", void 0);\n __decorate([\n Property(false)\n ], LimitData.prototype, \"endHandleFixed\", void 0);\n return LimitData;\n}(ChildProperty));\nexport { LimitData };\n/**\n * It illustrates the tooltip data in slider.\n */\nvar TooltipData = /** @class */ (function (_super) {\n __extends(TooltipData, _super);\n function TooltipData() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('')\n ], TooltipData.prototype, \"cssClass\", void 0);\n __decorate([\n Property('Before')\n ], TooltipData.prototype, \"placement\", void 0);\n __decorate([\n Property('Focus')\n ], TooltipData.prototype, \"showOn\", void 0);\n __decorate([\n Property(false)\n ], TooltipData.prototype, \"isVisible\", void 0);\n __decorate([\n Property(null)\n ], TooltipData.prototype, \"format\", void 0);\n return TooltipData;\n}(ChildProperty));\nexport { TooltipData };\nvar bootstrapTooltipOffset = 6;\nvar classNames = {\n root: 'e-slider',\n rtl: 'e-rtl',\n sliderHiddenInput: 'e-slider-input',\n controlWrapper: 'e-control-wrapper',\n sliderHandle: 'e-handle',\n rangeBar: 'e-range',\n sliderButton: 'e-slider-button',\n firstButton: 'e-first-button',\n secondButton: 'e-second-button',\n scale: 'e-scale',\n tick: 'e-tick',\n large: 'e-large',\n tickValue: 'e-tick-value',\n sliderTooltip: 'e-slider-tooltip',\n sliderHover: 'e-slider-hover',\n sliderFirstHandle: 'e-handle-first',\n sliderSecondHandle: 'e-handle-second',\n sliderDisabled: 'e-disabled',\n sliderContainer: 'e-slider-container',\n horizontalTooltipBefore: 'e-slider-horizontal-before',\n horizontalTooltipAfter: 'e-slider-horizontal-after',\n verticalTooltipBefore: 'e-slider-vertical-before',\n verticalTooltipAfter: 'e-slider-vertical-after',\n materialTooltip: 'e-material-tooltip',\n materialTooltipOpen: 'e-material-tooltip-open',\n materialTooltipActive: 'e-tooltip-active',\n materialSlider: 'e-material-slider',\n sliderTrack: 'e-slider-track',\n sliderHandleFocused: 'e-handle-focused',\n verticalSlider: 'e-vertical',\n horizontalSlider: 'e-horizontal',\n sliderHandleStart: 'e-handle-start',\n sliderTooltipStart: 'e-material-tooltip-start',\n sliderTabHandle: 'e-tab-handle',\n sliderButtonIcon: 'e-button-icon',\n sliderSmallSize: 'e-small-size',\n sliderTickPosition: 'e-tick-pos',\n sliderFirstTick: 'e-first-tick',\n sliderLastTick: 'e-last-tick',\n sliderButtonClass: 'e-slider-btn',\n sliderTooltipWrapper: 'e-tooltip-wrap',\n sliderTabTrack: 'e-tab-track',\n sliderTabRange: 'e-tab-range',\n sliderActiveHandle: 'e-handle-active',\n sliderMaterialHandle: 'e-material-handle',\n sliderMaterialRange: 'e-material-range',\n sliderMaterialDefault: 'e-material-default',\n materialTooltipShow: 'e-material-tooltip-show',\n materialTooltipHide: 'e-material-tooltip-hide',\n readonly: 'e-read-only',\n limits: 'e-limits',\n limitBarDefault: 'e-limit-bar',\n limitBarFirst: 'e-limit-first',\n limitBarSecond: 'e-limit-second',\n dragHorizontal: 'e-drag-horizontal',\n dragVertical: 'e-drag-vertical'\n};\n/**\n * The Slider component allows the user to select a value or range\n * of values in-between a min and max range, by dragging the handle over the slider bar.\n * ```html\n * \n * ```\n * ```typescript\n * \n * ```\n */\nvar Slider = /** @class */ (function (_super) {\n __extends(Slider, _super);\n function Slider(options, element) {\n var _this = _super.call(this, options, element) || this;\n _this.horDir = 'left';\n _this.verDir = 'bottom';\n _this.transition = {\n handle: 'left .4s cubic-bezier(.25, .8, .25, 1), right .4s cubic-bezier(.25, .8, .25, 1), ' +\n 'top .4s cubic-bezier(.25, .8, .25, 1) , bottom .4s cubic-bezier(.25, .8, .25, 1)',\n rangeBar: 'all .4s cubic-bezier(.25, .8, .25, 1)'\n };\n _this.transitionOnMaterialTooltip = {\n handle: 'left 1ms ease-out, right 1ms ease-out, bottom 1ms ease-out',\n rangeBar: 'left 1ms ease-out, right 1ms ease-out, bottom 1ms ease-out, width 1ms ease-out, height 1ms ease-out'\n };\n _this.scaleTransform = 'transform .4s cubic-bezier(.25, .8, .25, 1)';\n _this.customAriaText = null;\n _this.drag = true;\n return _this;\n }\n Slider.prototype.preRender = function () {\n var localeText = { incrementTitle: 'Increase', decrementTitle: 'Decrease' };\n this.l10n = new L10n('slider', localeText, this.locale);\n this.isElementFocused = false;\n this.tickElementCollection = [];\n this.tooltipFormatInfo = {};\n this.ticksFormatInfo = {};\n this.initCultureInfo();\n this.initCultureFunc();\n };\n Slider.prototype.initCultureFunc = function () {\n this.internationalization = new Internationalization(this.locale);\n };\n Slider.prototype.initCultureInfo = function () {\n this.tooltipFormatInfo.format = (!isNullOrUndefined(this.tooltip.format)) ? this.tooltip.format : null;\n this.ticksFormatInfo.format = (!isNullOrUndefined(this.ticks.format)) ? this.ticks.format : null;\n };\n Slider.prototype.formatString = function (value, formatInfo) {\n var formatValue = null;\n var formatString = null;\n if ((value || value === 0)) {\n formatValue = this.formatNumber(value);\n var numberOfDecimals = this.numberOfDecimals(value);\n formatString = this.internationalization.getNumberFormat(formatInfo)(this.makeRoundNumber(value, numberOfDecimals));\n }\n return { elementVal: formatValue, formatString: formatString };\n };\n ;\n Slider.prototype.formatNumber = function (value) {\n var numberOfDecimals = this.numberOfDecimals(value);\n return this.internationalization.getNumberFormat({\n maximumFractionDigits: numberOfDecimals,\n minimumFractionDigits: numberOfDecimals, useGrouping: false\n })(value);\n };\n ;\n Slider.prototype.numberOfDecimals = function (value) {\n var decimalPart = value.toString().split('.')[1];\n var numberOfDecimals = !decimalPart || !decimalPart.length ? 0 : decimalPart.length;\n return numberOfDecimals;\n };\n Slider.prototype.makeRoundNumber = function (value, precision) {\n var decimals = precision || 0;\n return Number(value.toFixed(decimals));\n };\n ;\n Slider.prototype.fractionalToInteger = function (value) {\n value = (this.numberOfDecimals(value) === 0) ? Number(value).toFixed(this.noOfDecimals) : value;\n var tens = 1;\n for (var i = 0; i < this.noOfDecimals; i++) {\n tens *= 10;\n }\n value = Number((value * tens).toFixed(0));\n return value;\n };\n /**\n * To Initialize the control rendering\n * @private\n */\n Slider.prototype.render = function () {\n this.initialize();\n this.initRender();\n this.wireEvents();\n this.setZindex();\n };\n Slider.prototype.initialize = function () {\n addClass([this.element], classNames.root);\n this.setCSSClass();\n };\n Slider.prototype.setCSSClass = function (oldCSSClass) {\n if (oldCSSClass) {\n removeClass([this.element], oldCSSClass.split(' '));\n }\n if (this.cssClass) {\n addClass([this.element], this.cssClass.split(' '));\n }\n };\n Slider.prototype.setEnabled = function () {\n var tooltipElement = this.type !== 'Range' ? [this.firstTooltipElement] :\n [this.firstTooltipElement, this.secondTooltipElement];\n if (!this.enabled) {\n addClass([this.sliderContainer], [classNames.sliderDisabled]);\n if (this.tooltip.isVisible && this.tooltip.showOn === 'Always') {\n tooltipElement.forEach(function (tooltipElement) {\n tooltipElement.classList.add(classNames.sliderDisabled);\n });\n }\n this.unwireEvents();\n }\n else {\n removeClass([this.sliderContainer], [classNames.sliderDisabled]);\n if (this.tooltip.isVisible && this.tooltip.showOn === 'Always') {\n tooltipElement.forEach(function (tooltipElement) {\n tooltipElement.classList.remove(classNames.sliderDisabled);\n });\n }\n this.wireEvents();\n }\n };\n Slider.prototype.getTheme = function (container) {\n var theme = window.getComputedStyle(container, ':after').getPropertyValue('content');\n return theme.replace(/['\"]+/g, '');\n };\n /**\n * Initialize the rendering\n * @private\n */\n Slider.prototype.initRender = function () {\n this.sliderContainer = createElement('div', { className: classNames.sliderContainer + ' ' + classNames.controlWrapper });\n this.element.parentNode.insertBefore(this.sliderContainer, this.element);\n this.sliderContainer.appendChild(this.element);\n this.sliderTrack = createElement('div', { className: classNames.sliderTrack });\n this.element.appendChild(this.sliderTrack);\n this.element.tabIndex = -1;\n this.isMaterial = this.getTheme(this.sliderContainer) === 'material';\n this.isBootstrap = this.getTheme(this.sliderContainer) === 'bootstrap';\n this.setHandler();\n this.createRangeBar();\n if (this.limits.enabled) {\n this.createLimitBar();\n }\n this.setOrientClass();\n this.hiddenInput = (createElement('input', {\n attrs: {\n type: 'hidden', value: (isNullOrUndefined(this.value) ? this.min.toString() : this.value.toString()),\n name: this.element.getAttribute('name') || this.element.getAttribute('id') ||\n '_' + (Math.random() * 1000).toFixed(0) + 'slider', class: classNames.sliderHiddenInput\n }\n }));\n this.hiddenInput.tabIndex = -1;\n this.sliderContainer.appendChild(this.hiddenInput);\n if (this.showButtons) {\n this.setButtons();\n }\n this.setEnableRTL();\n if (this.type === 'Range') {\n this.rangeValueUpdate();\n }\n else {\n this.value = isNullOrUndefined(this.value) ? parseFloat(formatUnit(this.min.toString())) : this.value;\n }\n this.previousVal = this.type !== 'Range' ? this.checkHandleValue(parseFloat(formatUnit(this.value.toString()))) :\n [this.checkHandleValue(parseFloat(formatUnit(this.value[0].toString()))),\n this.checkHandleValue(parseFloat(formatUnit(this.value[1].toString())))];\n this.previousChanged = this.previousVal;\n if (!isNullOrUndefined(this.element.hasAttribute('name'))) {\n this.element.removeAttribute('name');\n }\n this.setValue();\n if (this.limits.enabled) {\n this.setLimitBar();\n }\n if (this.ticks.placement !== 'None') {\n this.renderScale();\n }\n if (this.tooltip.isVisible) {\n this.renderTooltip();\n }\n if (!this.enabled) {\n addClass([this.sliderContainer], [classNames.sliderDisabled]);\n }\n else {\n removeClass([this.sliderContainer], [classNames.sliderDisabled]);\n }\n if (this.readonly) {\n addClass([this.sliderContainer], [classNames.readonly]);\n }\n else {\n removeClass([this.sliderContainer], [classNames.readonly]);\n }\n };\n Slider.prototype.createRangeBar = function () {\n if (this.type !== 'Default') {\n this.rangeBar = (createElement('div', { attrs: { class: classNames.rangeBar } }));\n this.element.appendChild(this.rangeBar);\n if (this.drag && this.type === 'Range') {\n if (this.orientation === 'Horizontal') {\n this.rangeBar.classList.add(classNames.dragHorizontal);\n }\n else {\n this.rangeBar.classList.add(classNames.dragVertical);\n }\n }\n }\n };\n Slider.prototype.createLimitBar = function () {\n var firstElementClassName = this.type !== 'Range' ? classNames.limitBarDefault :\n classNames.limitBarFirst;\n firstElementClassName += ' ' + classNames.limits;\n this.limitBarFirst = (createElement('div', {\n attrs: { class: firstElementClassName }\n }));\n this.element.appendChild(this.limitBarFirst);\n if (this.type === 'Range') {\n this.limitBarSecond = (createElement('div', {\n attrs: {\n class: classNames.limitBarSecond + ' ' + classNames.limits\n }\n }));\n this.element.appendChild(this.limitBarSecond);\n }\n };\n Slider.prototype.setOrientClass = function () {\n if (this.orientation !== 'Vertical') {\n this.sliderContainer.classList.remove(classNames.verticalSlider);\n this.sliderContainer.classList.add(classNames.horizontalSlider);\n this.firstHandle.setAttribute('aria-orientation', 'horizontal');\n if (this.type === 'Range') {\n this.secondHandle.setAttribute('aria-orientation', 'horizontal');\n }\n }\n else {\n this.sliderContainer.classList.remove(classNames.horizontalSlider);\n this.sliderContainer.classList.add(classNames.verticalSlider);\n this.firstHandle.setAttribute('aria-orientation', 'vertical');\n if (this.type === 'Range') {\n this.secondHandle.setAttribute('aria-orientation', 'vertical');\n }\n }\n };\n Slider.prototype.setAriaAttributes = function (element) {\n var _this = this;\n var min = this.min;\n var max = this.max;\n if (!isNullOrUndefined(this.customValues) && this.customValues.length > 0) {\n min = this.customValues[0];\n max = this.customValues[this.customValues.length - 1];\n }\n if (this.type !== 'Range') {\n attributes(element, {\n 'aria-valuemin': min.toString(), 'aria-valuemax': max.toString()\n });\n }\n else {\n var range = !isNullOrUndefined(this.customValues) && this.customValues.length > 0 ?\n [[min.toString(), (this.customValues[this.value[1]]).toString()],\n [(this.customValues[this.value[0]]).toString(), max.toString()]] :\n [[min.toString(), this.value[1].toString()], [this.value[0].toString(), max.toString()]];\n range.forEach(function (range, index) {\n var element = index === 0 ? _this.firstHandle : _this.secondHandle;\n if (element) {\n attributes(element, {\n 'aria-valuemin': range[0], 'aria-valuemax': range[1]\n });\n }\n });\n }\n };\n Slider.prototype.createSecondHandle = function () {\n this.secondHandle = createElement('div', {\n attrs: {\n class: classNames.sliderHandle, 'role': 'slider', 'aria-labelledby': this.element.id + '_title', tabIndex: '0'\n }\n });\n this.secondHandle.classList.add(classNames.sliderSecondHandle);\n this.element.appendChild(this.secondHandle);\n if (this.isMaterial && this.tooltip.isVisible) {\n this.secondMaterialHandle = createElement('div', {\n attrs: {\n class: classNames.sliderHandle + ' ' +\n classNames.sliderMaterialHandle\n }\n });\n this.element.appendChild(this.secondMaterialHandle);\n }\n };\n Slider.prototype.createFirstHandle = function () {\n this.firstHandle = createElement('div', {\n attrs: {\n class: classNames.sliderHandle, 'role': 'slider', 'aria-labelledby': this.element.id + '_title', tabIndex: '0'\n }\n });\n this.firstHandle.classList.add(classNames.sliderFirstHandle);\n this.element.appendChild(this.firstHandle);\n if (this.isMaterial && this.tooltip.isVisible) {\n this.firstMaterialHandle = createElement('div', {\n attrs: {\n class: classNames.sliderHandle + ' ' +\n classNames.sliderMaterialHandle\n }\n });\n this.element.appendChild(this.firstMaterialHandle);\n }\n };\n Slider.prototype.wireFirstHandleEvt = function (destroy) {\n if (!destroy) {\n EventHandler.add(this.firstHandle, 'mousedown touchstart', this.handleFocus, this);\n EventHandler.add(this.firstHandle, 'transitionend', this.transitionEnd, this);\n EventHandler.add(this.firstHandle, 'mouseenter touchenter', this.handleOver, this);\n EventHandler.add(this.firstHandle, 'mouseleave touchend', this.handleLeave, this);\n }\n else {\n EventHandler.remove(this.firstHandle, 'mousedown touchstart', this.handleFocus);\n EventHandler.remove(this.firstHandle, 'transitionend', this.transitionEnd);\n EventHandler.remove(this.firstHandle, 'mouseenter touchenter', this.handleOver);\n EventHandler.remove(this.firstHandle, 'mouseleave touchend', this.handleLeave);\n }\n };\n Slider.prototype.wireSecondHandleEvt = function (destroy) {\n if (!destroy) {\n EventHandler.add(this.secondHandle, 'mousedown touchstart', this.handleFocus, this);\n EventHandler.add(this.secondHandle, 'transitionend', this.transitionEnd, this);\n EventHandler.add(this.secondHandle, 'mouseenter touchenter', this.handleOver, this);\n EventHandler.add(this.secondHandle, 'mouseleave touchend', this.handleLeave, this);\n }\n else {\n EventHandler.remove(this.secondHandle, 'mousedown touchstart', this.handleFocus);\n EventHandler.remove(this.secondHandle, 'transitionend', this.transitionEnd);\n EventHandler.remove(this.secondHandle, 'mouseenter touchenter', this.handleOver);\n EventHandler.remove(this.secondHandle, 'mouseleave touchend', this.handleLeave);\n }\n };\n Slider.prototype.handleStart = function () {\n var pos = (this.activeHandle === 1) ? this.handlePos1 : this.handlePos2;\n var tooltipElement = this.activeHandle === 1 ? this.firstTooltipElement : this.secondTooltipElement;\n if (pos === 0 && this.type !== 'Range') {\n this.getHandle().classList.add(classNames.sliderHandleStart);\n if (this.isMaterial && this.tooltip.isVisible) {\n this.firstMaterialHandle.classList.add(classNames.sliderHandleStart);\n if (tooltipElement) {\n tooltipElement.classList.add(classNames.sliderTooltipStart);\n }\n }\n }\n };\n Slider.prototype.transitionEnd = function (e) {\n this.handleStart();\n this.getHandle().style.transition = 'none';\n if (this.type !== 'Default') {\n this.rangeBar.style.transition = 'none';\n }\n if (this.tooltip.isVisible) {\n var tooltipObj = this.activeHandle === 1 ? this.firstTooltipObj : this.secondTooltipObj;\n var tooltipElement = this.activeHandle === 1 ? this.firstTooltipElement : this.secondTooltipElement;\n if (!this.isMaterial) {\n tooltipObj.animation = { open: { effect: 'None' }, close: { effect: 'FadeOut', duration: 500 } };\n this.tooltipAnimation();\n }\n else {\n if (!tooltipElement.classList.contains(classNames.materialTooltipOpen) && e.propertyName !== 'transform') {\n this.openMaterialTooltip();\n }\n else {\n if (this.type === 'Default') {\n tooltipElement.style.transition = this.transition.handle;\n }\n this.refreshTooltip();\n }\n }\n }\n if (this.tooltip.showOn !== 'Always') {\n this.closeTooltip();\n }\n };\n Slider.prototype.handleFocusOut = function () {\n if (this.firstHandle.classList.contains(classNames.sliderHandleFocused)) {\n this.firstHandle.classList.remove(classNames.sliderHandleFocused);\n }\n if (this.type === 'Range') {\n if (this.secondHandle.classList.contains(classNames.sliderHandleFocused)) {\n this.secondHandle.classList.remove(classNames.sliderHandleFocused);\n }\n }\n };\n Slider.prototype.handleFocus = function (e) {\n if (e.currentTarget === this.firstHandle) {\n this.firstHandle.classList.add(classNames.sliderHandleFocused);\n }\n else {\n this.secondHandle.classList.add(classNames.sliderHandleFocused);\n }\n };\n Slider.prototype.handleOver = function (e) {\n if (this.tooltip.isVisible && this.tooltip.showOn === 'Hover') {\n this.tooltipValue();\n var tooltipObj = e.currentTarget === this.firstHandle ? this.firstTooltipObj : this.secondTooltipObj;\n tooltipObj.animation = { open: { effect: 'None' }, close: { effect: 'FadeOut', duration: 500 } };\n if (e.currentTarget === this.firstHandle) {\n this.firstTooltipObj.open(this.firstHandle);\n }\n else {\n this.secondTooltipObj.open(this.secondHandle);\n }\n }\n };\n Slider.prototype.handleLeave = function (e) {\n if (this.tooltip.isVisible && this.tooltip.showOn === 'Hover' &&\n !e.currentTarget.classList.contains(classNames.sliderHandleFocused) &&\n !e.currentTarget.classList.contains(classNames.sliderTabHandle)) {\n this.tooltipValue();\n var tooltipObj = e.currentTarget === this.firstHandle ? this.firstTooltipObj : this.secondTooltipObj;\n if (e.currentTarget === this.firstHandle) {\n this.firstTooltipObj.close();\n }\n else {\n this.secondTooltipObj.close();\n }\n tooltipObj.animation = { open: { effect: 'None' }, close: { effect: 'FadeOut', duration: 500 } };\n }\n };\n Slider.prototype.setHandler = function () {\n if (this.min > this.max) {\n this.min = this.max;\n }\n this.createFirstHandle();\n if (this.type === 'Range') {\n this.createSecondHandle();\n }\n };\n Slider.prototype.setEnableRTL = function () {\n this.enableRtl && this.orientation !== 'Vertical' ? addClass([this.sliderContainer], classNames.rtl) :\n removeClass([this.sliderContainer], classNames.rtl);\n var preDir = (this.orientation !== 'Vertical') ? this.horDir : this.verDir;\n if (this.enableRtl) {\n this.horDir = 'right';\n this.verDir = 'bottom';\n }\n else {\n this.horDir = 'left';\n this.verDir = 'bottom';\n }\n var currDir = (this.orientation !== 'Vertical') ? this.horDir : this.verDir;\n if (preDir !== currDir) {\n if (this.orientation === 'Horizontal') {\n setStyleAttribute(this.firstHandle, { 'right': '', 'left': 'auto' });\n if (this.type === 'Range') {\n setStyleAttribute(this.secondHandle, { 'top': '', 'left': 'auto' });\n }\n }\n }\n };\n Slider.prototype.tooltipValue = function () {\n var text;\n var value1;\n var value2;\n var args = {\n value: this.value,\n text: ''\n };\n this.setTooltipContent();\n args.text = text = this.firstTooltipObj.content;\n this.trigger('tooltipChange', args);\n this.addTooltipClass(args.text);\n if (text !== args.text) {\n this.customAriaText = args.text;\n this.firstTooltipObj.content = args.text;\n this.setAriaAttrValue(this.firstHandle);\n if (this.type === 'Range') {\n this.secondTooltipObj.content = args.text;\n this.setAriaAttrValue(this.secondHandle);\n }\n }\n };\n Slider.prototype.setTooltipContent = function () {\n var content;\n if (this.type === 'Range') {\n content = this.formatContent(this.tooltipFormatInfo, false);\n this.firstTooltipObj.content = content;\n this.secondTooltipObj.content = content;\n }\n else {\n if (!isNullOrUndefined(this.handleVal1)) {\n content = this.formatContent(this.tooltipFormatInfo, false);\n this.firstTooltipObj.content = content;\n }\n }\n };\n Slider.prototype.formatContent = function (formatInfo, ariaContent) {\n var content = '';\n var handle1 = this.handleVal1;\n var handle2 = this.handleVal2;\n if (!isNullOrUndefined(this.customValues) && this.customValues.length > 0) {\n handle1 = this.customValues[this.handleVal1];\n handle2 = this.customValues[this.handleVal2];\n }\n if (!ariaContent) {\n if (this.type === 'Range') {\n if (this.enableRtl && this.orientation !== 'Vertical') {\n content = (!isNullOrUndefined(formatInfo.format)) ? (this.formatString(handle2, formatInfo)\n .formatString + ' - ' + this.formatString(handle1, formatInfo).formatString) :\n (handle2.toString() + ' - ' + handle1.toString());\n }\n else {\n content = (!isNullOrUndefined(formatInfo.format)) ? (this.formatString(handle1, formatInfo)\n .formatString + ' - ' + this.formatString(handle2, formatInfo).formatString) :\n (handle1.toString() + ' - ' + handle2.toString());\n }\n }\n else {\n if (!isNullOrUndefined(handle1)) {\n content = (!isNullOrUndefined(formatInfo.format)) ?\n this.formatString(handle1, formatInfo).formatString : handle1.toString();\n }\n }\n return content;\n }\n else {\n if (this.type === 'Range') {\n if (this.enableRtl && this.orientation !== 'Vertical') {\n content = (!isNullOrUndefined(this.tooltip) && !isNullOrUndefined(this.tooltip.format)) ?\n (this.formatString(handle2, formatInfo).elementVal + ' - ' +\n this.formatString(handle1, formatInfo).elementVal) :\n (handle2.toString() + ' - ' + handle1.toString());\n }\n else {\n content = (!isNullOrUndefined(this.tooltip) && !isNullOrUndefined(this.tooltip.format)) ?\n (this.formatString(handle1, formatInfo).elementVal + ' - ' +\n this.formatString(handle2, formatInfo).elementVal) :\n (handle1.toString() + ' - ' + handle2.toString());\n }\n }\n else {\n if (!isNullOrUndefined(handle1)) {\n content = (!isNullOrUndefined(this.tooltip) && !isNullOrUndefined(this.tooltip.format)) ?\n this.formatString(handle1, formatInfo).elementVal : handle1.toString();\n }\n }\n return content;\n }\n };\n Slider.prototype.addTooltipClass = function (content) {\n var _this = this;\n if (this.isMaterial && this.tooltip.isVisible) {\n var count_1 = content.toString().length;\n var tooltipElement = this.type !== 'Range' ? [this.firstTooltipElement] :\n [this.firstTooltipElement, this.secondTooltipElement];\n tooltipElement.forEach(function (element, index) {\n if (!element) {\n var cssClass = count_1 > 4 ? classNames.sliderMaterialRange : classNames.sliderMaterialDefault;\n !index ? _this.firstTooltipObj.cssClass = classNames.sliderTooltip + ' ' + cssClass :\n _this.secondTooltipObj.cssClass = classNames.sliderTooltip + ' ' + cssClass;\n }\n else {\n if (count_1 > 4) {\n element.classList.remove(classNames.sliderMaterialDefault);\n if (!element.classList.contains(classNames.sliderMaterialRange)) {\n element.classList.add(classNames.sliderMaterialRange);\n element.style.transform = 'scale(1)';\n }\n }\n else {\n element.classList.remove(classNames.sliderMaterialRange);\n if (!element.classList.contains(classNames.sliderMaterialDefault)) {\n element.classList.add(classNames.sliderMaterialDefault);\n element.style.transform = _this.getTooltipTransformProperties(_this.previousTooltipClass).rotate;\n }\n }\n }\n });\n }\n };\n Slider.prototype.tooltipPlacement = function () {\n var tooltipPosition;\n if (this.orientation === 'Horizontal') {\n this.tooltip.placement === 'Before' ? tooltipPosition = 'TopCenter' : tooltipPosition = 'BottomCenter';\n }\n else {\n this.tooltip.placement === 'Before' ? tooltipPosition = 'LeftCenter' : tooltipPosition = 'RightCenter';\n }\n this.firstTooltipObj.position = tooltipPosition;\n if (this.type === 'Range') {\n this.secondTooltipObj.position = tooltipPosition;\n }\n if (this.isMaterial) {\n this.firstTooltipObj.showTipPointer = true;\n this.setProperties({ tooltip: { showOn: 'Always' } }, true);\n this.firstTooltipObj.height = 30;\n if (this.type === 'Range') {\n this.secondTooltipObj.showTipPointer = true;\n this.secondTooltipObj.height = 30;\n }\n }\n };\n Slider.prototype.tooltipBeforeOpen = function (args) {\n var tooltipElement = args.target === this.firstHandle ? this.firstTooltipElement = args.element :\n this.secondTooltipElement = args.element;\n if (this.tooltip.cssClass !== '') {\n addClass([tooltipElement], this.tooltip.cssClass.split(' '));\n }\n args.target.removeAttribute('aria-describedby');\n if (this.isMaterial && this.tooltip.isVisible) {\n var transformProperties = this.getTooltipTransformProperties(this.previousTooltipClass);\n tooltipElement.firstChild.classList.add(classNames.materialTooltipHide);\n this.handleStart();\n if (tooltipElement.firstElementChild.innerText.length > 4) {\n tooltipElement.style.transform = transformProperties.translate + \" scale(0.01)\";\n }\n else {\n tooltipElement.style.transform = transformProperties.translate + \" \" + transformProperties.rotate + \" scale(0.01)\";\n }\n }\n if (this.isBootstrap) {\n switch (this.bootstrapCollisionArgs.collidedPosition) {\n case 'TopCenter':\n this.firstTooltipObj.setProperties({ 'offsetY': -(bootstrapTooltipOffset) }, false);\n if (this.type === 'Range') {\n this.secondTooltipObj.setProperties({ 'offsetY': -(bootstrapTooltipOffset) }, false);\n }\n break;\n case 'BottomCenter':\n this.firstTooltipObj.setProperties({ 'offsetY': bootstrapTooltipOffset }, false);\n if (this.type === 'Range') {\n this.secondTooltipObj.setProperties({ 'offsetY': bootstrapTooltipOffset }, false);\n }\n break;\n case 'LeftCenter':\n this.firstTooltipObj.setProperties({ 'offsetX': -(bootstrapTooltipOffset) }, false);\n if (this.type === 'Range') {\n this.secondTooltipObj.setProperties({ 'offsetX': -(bootstrapTooltipOffset) }, false);\n }\n break;\n case 'RightCenter':\n this.firstTooltipObj.setProperties({ 'offsetX': bootstrapTooltipOffset }, false);\n if (this.type === 'Range') {\n this.secondTooltipObj.setProperties({ 'offsetX': bootstrapTooltipOffset }, false);\n }\n break;\n default:\n break;\n }\n }\n };\n Slider.prototype.wireMaterialTooltipEvent = function (destroy) {\n if (this.isMaterial && this.tooltip.isVisible) {\n if (!destroy) {\n EventHandler.add(this.firstTooltipElement, 'mousedown touchstart', this.sliderDown, this);\n if (this.type === 'Range') {\n EventHandler.add(this.secondTooltipElement, 'mousedown touchstart', this.sliderDown, this);\n }\n }\n else {\n EventHandler.remove(this.firstTooltipElement, 'mousedown touchstart', this.sliderDown);\n if (this.type === 'Range') {\n EventHandler.remove(this.secondTooltipElement, 'mousedown touchstart', this.sliderDown);\n }\n }\n }\n };\n Slider.prototype.tooltipPositionCalculation = function (position) {\n var cssClass;\n switch (position) {\n case 'TopCenter':\n cssClass = classNames.horizontalTooltipBefore;\n break;\n case 'BottomCenter':\n cssClass = classNames.horizontalTooltipAfter;\n break;\n case 'LeftCenter':\n cssClass = classNames.verticalTooltipBefore;\n break;\n case 'RightCenter':\n cssClass = classNames.verticalTooltipAfter;\n break;\n }\n return cssClass;\n };\n Slider.prototype.getTooltipTransformProperties = function (className) {\n if (this.firstTooltipElement) {\n var position = void 0;\n if (this.orientation === 'Horizontal') {\n position = (this.firstTooltipElement.clientHeight + 14) - (this.firstTooltipElement.clientHeight / 2);\n }\n else {\n position = (this.firstTooltipElement.clientWidth + 14) - (this.firstTooltipElement.clientWidth / 2);\n }\n var transformProperties = this.orientation === 'Horizontal' ?\n (className === classNames.horizontalTooltipBefore ? { rotate: 'rotate(45deg)', translate: \"translateY(\" + position + \"px)\" } :\n { rotate: 'rotate(225deg)', translate: \"translateY(\" + -(position) + \"px)\" }) :\n (className === classNames.verticalTooltipBefore ? { rotate: 'rotate(-45deg)', translate: \"translateX(\" + position + \"px)\" } :\n { rotate: 'rotate(-225deg)', translate: \"translateX(\" + (-position) + \"px)\" });\n return transformProperties;\n }\n return undefined;\n };\n Slider.prototype.openMaterialTooltip = function () {\n var _this = this;\n this.refreshTooltip();\n var tooltipElement = this.activeHandle === 1 ? this.firstTooltipElement : this.secondTooltipElement;\n var handle = this.activeHandle === 1 ? this.firstMaterialHandle : this.secondMaterialHandle;\n if (tooltipElement.firstChild.classList.contains(classNames.materialTooltipHide)) {\n tooltipElement.firstChild.classList.remove(classNames.materialTooltipHide);\n }\n tooltipElement.firstChild.classList.add(classNames.materialTooltipShow);\n this.getHandle().style.cursor = 'default';\n tooltipElement.style.transition = this.scaleTransform;\n tooltipElement.classList.add(classNames.materialTooltipOpen);\n handle.style.transform = 'scale(0)';\n if (tooltipElement.firstElementChild.innerText.length > 4) {\n tooltipElement.style.transform = 'scale(1)';\n }\n else {\n tooltipElement.style.transform = this.getTooltipTransformProperties(this.previousTooltipClass).rotate;\n }\n if (this.type === 'Default') {\n setTimeout(function () { tooltipElement.style.transition = _this.transition.handle; }, 2500);\n }\n else {\n setTimeout(function () { tooltipElement.style.transition = 'none'; }, 2500);\n }\n };\n Slider.prototype.checkTooltipPosition = function (args) {\n var tooltipPosition = args.target === this.firstHandle ? this.firstHandleTooltipPosition :\n this.secondHandleTooltipPosition;\n if (this.isMaterial && (tooltipPosition === undefined || tooltipPosition !== args.collidedPosition)) {\n var tooltipClass = this.tooltipPositionCalculation(args.collidedPosition);\n args.element.classList.remove(this.previousTooltipClass);\n args.element.classList.add(tooltipClass);\n this.previousTooltipClass = tooltipClass;\n if (args.element.style.transform && args.element.classList.contains(classNames.materialTooltipOpen) &&\n args.element.firstElementChild.innerText.length < 4) {\n args.element.style.transform = this.getTooltipTransformProperties(this.previousTooltipClass).rotate;\n }\n if (args.target === this.firstHandle) {\n this.firstHandleTooltipPosition = args.collidedPosition;\n }\n else {\n this.secondHandleTooltipPosition = args.collidedPosition;\n }\n }\n this.bootstrapCollisionArgs = args;\n };\n Slider.prototype.renderTooltip = function () {\n if (this.tooltip.showOn === 'Auto') {\n this.setProperties({ tooltip: { showOn: 'Hover' } }, true);\n }\n var tooltipPointer = this.isBootstrap ? true : false;\n this.firstTooltipObj = new Tooltip({\n showTipPointer: tooltipPointer,\n cssClass: classNames.sliderTooltip,\n animation: { open: { effect: 'None' }, close: { effect: 'None' } },\n opensOn: 'Custom',\n beforeOpen: this.tooltipBeforeOpen.bind(this),\n beforeCollision: this.checkTooltipPosition.bind(this),\n afterClose: this.tooltipAfterClose.bind(this)\n });\n this.firstTooltipObj.appendTo(this.firstHandle);\n if (this.type === 'Range') {\n this.secondTooltipObj = new Tooltip({\n showTipPointer: tooltipPointer,\n cssClass: classNames.sliderTooltip,\n animation: { open: { effect: 'None' }, close: { effect: 'None' } },\n opensOn: 'Custom',\n beforeOpen: this.tooltipBeforeOpen.bind(this),\n beforeCollision: this.checkTooltipPosition.bind(this),\n afterClose: this.tooltipAfterClose.bind(this)\n });\n this.secondTooltipObj.appendTo(this.secondHandle);\n }\n this.tooltipPlacement();\n this.firstHandle.style.transition = 'none';\n if (this.type !== 'Default') {\n this.rangeBar.style.transition = 'none';\n }\n if (this.type === 'Range') {\n this.secondHandle.style.transition = 'none';\n }\n if (this.isMaterial) {\n this.sliderContainer.classList.add(classNames.materialSlider);\n this.tooltipValue();\n this.firstTooltipObj.open(this.firstHandle);\n if (this.type === 'Range') {\n this.secondTooltipObj.open(this.secondHandle);\n }\n }\n };\n Slider.prototype.tooltipAfterClose = function (args) {\n if (args.element === this.firstTooltipElement) {\n this.firstTooltipElement = undefined;\n }\n else {\n this.secondTooltipElement = undefined;\n }\n };\n Slider.prototype.setButtons = function () {\n this.firstBtn = createElement('div', { className: classNames.sliderButton + ' ' + classNames.firstButton });\n this.firstBtn.appendChild(createElement('span', { className: classNames.sliderButtonIcon }));\n this.firstBtn.tabIndex = -1;\n this.secondBtn = createElement('div', { className: classNames.sliderButton + ' ' + classNames.secondButton });\n this.secondBtn.appendChild(createElement('span', { className: classNames.sliderButtonIcon }));\n this.secondBtn.tabIndex = -1;\n this.sliderContainer.classList.add(classNames.sliderButtonClass);\n this.sliderContainer.appendChild(this.firstBtn);\n this.sliderContainer.appendChild(this.secondBtn);\n this.sliderContainer.appendChild(this.element);\n this.buttonTitle();\n };\n Slider.prototype.buttonTitle = function () {\n var enabledRTL = this.enableRtl && this.orientation !== 'Vertical';\n this.l10n.setLocale(this.locale);\n var decrementTitle = this.l10n.getConstant('decrementTitle');\n var incrementTitle = this.l10n.getConstant('incrementTitle');\n attributes(enabledRTL ? this.secondBtn : this.firstBtn, { 'aria-label': decrementTitle, title: decrementTitle });\n attributes(enabledRTL ? this.firstBtn : this.secondBtn, { 'aria-label': incrementTitle, title: incrementTitle });\n };\n Slider.prototype.buttonFocusOut = function () {\n if (this.isMaterial) {\n this.getHandle().classList.remove('e-large-thumb-size');\n }\n };\n Slider.prototype.repeatButton = function (args) {\n var buttonElement = args.target.parentElement;\n var tooltipElement = this.activeHandle === 1 ? this.firstTooltipElement : this.secondTooltipElement;\n if (!tooltipElement && this.tooltip.isVisible) {\n this.openTooltip();\n }\n var hVal = this.handleValueUpdate();\n var enabledRTL = this.enableRtl && this.orientation !== 'Vertical';\n var value;\n if (args.target.parentElement.classList.contains(classNames.firstButton)\n || args.target.classList.contains(classNames.firstButton)) {\n enabledRTL ? (value = this.add(hVal, parseFloat(this.step.toString()), true)) :\n (value = this.add(hVal, parseFloat(this.step.toString()), false));\n }\n else if (args.target.parentElement.classList.contains(classNames.secondButton)\n || (args.target.classList.contains(classNames.secondButton))) {\n enabledRTL ? (value = this.add(hVal, parseFloat(this.step.toString()), false)) :\n (value = this.add(hVal, parseFloat(this.step.toString()), true));\n }\n if (this.limits.enabled) {\n value = this.getLimitCorrectedValues(value);\n }\n if (value >= this.min && value <= this.max) {\n this.changeHandleValue(value);\n this.refreshTooltipOnMove();\n }\n };\n Slider.prototype.repeatHandlerMouse = function (args) {\n args.preventDefault();\n if (args.type === ('mousedown') || args.type === ('touchstart')) {\n this.buttonClick(args);\n this.repeatInterval = setInterval(this.repeatButton.bind(this), 180, args);\n }\n };\n Slider.prototype.materialChange = function () {\n if (!this.getHandle().classList.contains('e-large-thumb-size')) {\n this.getHandle().classList.add('e-large-thumb-size');\n }\n };\n Slider.prototype.repeatHandlerUp = function (e) {\n this.changeEvent('changed');\n if (this.tooltip.isVisible && this.tooltip.showOn !== 'Always' && !this.isMaterial) {\n this.closeTooltip();\n }\n clearInterval(this.repeatInterval);\n this.getHandle().focus();\n };\n Slider.prototype.customTickCounter = function (bigNum) {\n var tickCount = 4;\n if (!isNullOrUndefined(this.customValues) && this.customValues.length > 0) {\n if (bigNum > 4) {\n tickCount = 3;\n }\n if (bigNum > 7) {\n tickCount = 2;\n }\n if (bigNum > 14) {\n tickCount = 1;\n }\n if (bigNum > 28) {\n tickCount = 0;\n }\n }\n return tickCount;\n };\n Slider.prototype.renderScale = function () {\n var orien = this.orientation === 'Vertical' ? 'v' : 'h';\n var spanText;\n this.noOfDecimals = this.numberOfDecimals(this.step);\n this.ul = createElement('ul', {\n className: classNames.scale + ' ' + 'e-' + orien + '-scale ' + classNames.tick + '-' + this.ticks.placement.toLowerCase(),\n attrs: { role: 'presentation', tabIndex: '-1', 'aria-hidden': 'true' }\n });\n this.ul.style.zIndex = '-1';\n if (Browser.isAndroid && orien === 'h') {\n this.ul.classList.add(classNames.sliderTickPosition);\n }\n var smallStep = this.ticks.smallStep;\n if (!this.ticks.showSmallTicks) {\n this.ticks.largeStep > 0 ? (smallStep = this.ticks.largeStep) :\n (smallStep = (parseFloat(formatUnit(this.max))) - (parseFloat(formatUnit(this.min))));\n }\n else if (smallStep <= 0) {\n smallStep = parseFloat(formatUnit(this.step));\n }\n var min = this.fractionalToInteger(this.min);\n var max = this.fractionalToInteger(this.max);\n var steps = this.fractionalToInteger(smallStep);\n var bigNum = !isNullOrUndefined(this.customValues) && this.customValues.length > 0 && this.customValues.length - 1;\n var customStep = this.customTickCounter(bigNum);\n var count = !isNullOrUndefined(this.customValues) && this.customValues.length > 0 ?\n (bigNum * customStep) + bigNum : Math.abs((max - min) / steps);\n this.element.appendChild(this.ul);\n var li;\n var start = parseFloat(this.min.toString());\n if (orien === 'v') {\n start = parseFloat(this.max.toString());\n }\n var left = 0;\n var islargeTick;\n var tickWidth = 100 / count;\n if (tickWidth === Infinity) {\n tickWidth = 5;\n }\n for (var i = 0, y = !isNullOrUndefined(this.customValues) && this.customValues.length > 0 ?\n this.customValues.length - 1 : 0, k = 0; i <= count; i++) {\n li = (createElement('li', {\n attrs: {\n class: classNames.tick, role: 'presentation', tabIndex: '-1',\n 'aria-hidden': 'true'\n }\n }));\n if (!isNullOrUndefined(this.customValues) && this.customValues.length > 0) {\n islargeTick = i % (customStep + 1) === 0;\n if (islargeTick) {\n if (orien === 'h') {\n start = this.customValues[k];\n k++;\n }\n else {\n start = this.customValues[y];\n y--;\n }\n li.setAttribute('title', start.toString());\n }\n }\n else {\n li.setAttribute('title', start.toString());\n if (this.numberOfDecimals(this.max) === 0 && this.numberOfDecimals(this.min) === 0 &&\n this.numberOfDecimals(this.step) === 0) {\n if (orien === 'h') {\n islargeTick = ((start - parseFloat(this.min.toString())) % this.ticks.largeStep === 0) ? true : false;\n }\n else {\n islargeTick = (Math.abs(start - parseFloat(this.max.toString())) % this.ticks.largeStep === 0) ? true : false;\n }\n }\n else {\n var largestep = this.fractionalToInteger(this.ticks.largeStep);\n var startValue = this.fractionalToInteger(start);\n islargeTick = ((startValue - min) % largestep === 0) ? true : false;\n }\n }\n if (islargeTick) {\n li.classList.add(classNames.large);\n }\n (orien === 'h') ? (li.style.width = tickWidth + '%') : (li.style.height = tickWidth + '%');\n var repeat = islargeTick ? (this.ticks.placement === 'Both' ? 2 : 1) : 0;\n if (islargeTick) {\n for (var j = 0; j < repeat; j++) {\n this.createTick(li, start);\n }\n }\n else if (isNullOrUndefined(this.customValues)) {\n this.formatTicksValue(li, start);\n }\n this.ul.appendChild(li);\n this.tickElementCollection.push(li);\n var decimalPoints = void 0;\n if (isNullOrUndefined(this.customValues)) {\n if (this.numberOfDecimals(smallStep) > this.numberOfDecimals(start)) {\n decimalPoints = this.numberOfDecimals(smallStep);\n }\n else {\n decimalPoints = this.numberOfDecimals(start);\n }\n if (orien === 'h') {\n start = this.makeRoundNumber(start + smallStep, decimalPoints);\n }\n else {\n start = this.makeRoundNumber(start - smallStep, decimalPoints);\n }\n left = this.makeRoundNumber(left + smallStep, decimalPoints);\n }\n }\n this.tickesAlignment(orien, tickWidth);\n };\n Slider.prototype.tickesAlignment = function (orien, tickWidth) {\n this.firstChild = this.ul.firstElementChild;\n this.lastChild = this.ul.lastElementChild;\n this.firstChild.classList.add(classNames.sliderFirstTick);\n this.lastChild.classList.add(classNames.sliderLastTick);\n this.sliderContainer.classList.add(classNames.scale + '-' + this.ticks.placement.toLowerCase());\n if (orien === 'h') {\n this.firstChild.style.width = tickWidth / 2 + '%';\n this.lastChild.style.width = tickWidth / 2 + '%';\n }\n else {\n this.firstChild.style.height = tickWidth / 2 + '%';\n this.lastChild.style.height = tickWidth / 2 + '%';\n }\n var eventArgs = { ticksWrapper: this.ul, tickElements: this.tickElementCollection };\n this.trigger('renderedTicks', eventArgs);\n this.scaleAlignment();\n };\n Slider.prototype.createTick = function (li, start) {\n var span = createElement('span', {\n className: classNames.tickValue + ' ' + classNames.tick + '-' + this.ticks.placement.toLowerCase(),\n attrs: { role: 'presentation', tabIndex: '-1', 'aria-hidden': 'true' }\n });\n li.appendChild(span);\n span.innerHTML = isNullOrUndefined(this.customValues) ? this.formatTicksValue(li, start) : start;\n };\n Slider.prototype.formatTicksValue = function (li, start) {\n var tickText = this.formatNumber(start);\n var text = !isNullOrUndefined(this.ticks) && !isNullOrUndefined(this.ticks.format) ?\n this.formatString(start, this.ticksFormatInfo).formatString : tickText;\n var eventArgs = { value: start, text: text, tickElement: li };\n this.trigger('renderingTicks', eventArgs);\n li.setAttribute('title', eventArgs.text.toString());\n return eventArgs.text.toString();\n };\n Slider.prototype.scaleAlignment = function () {\n this.tickValuePosition();\n var smallTick = 12;\n var largeTick = 20;\n var half = largeTick / 2;\n var orien = this.orientation === 'Vertical' ? 'v' : 'h';\n if (this.orientation === 'Vertical') {\n (this.element.getBoundingClientRect().width <= 15) ?\n this.sliderContainer.classList.add(classNames.sliderSmallSize) :\n this.sliderContainer.classList.remove(classNames.sliderSmallSize);\n }\n else {\n (this.element.getBoundingClientRect().height <= 15) ?\n this.sliderContainer.classList.add(classNames.sliderSmallSize) :\n this.sliderContainer.classList.remove(classNames.sliderSmallSize);\n }\n };\n Slider.prototype.tickValuePosition = function () {\n var first = this.firstChild.getBoundingClientRect();\n var firstChild;\n var smallStep = this.ticks.smallStep;\n var count = Math.abs((parseFloat(formatUnit(this.max))) - (parseFloat(formatUnit(this.min)))) / smallStep;\n if (this.firstChild.children.length > 0) {\n firstChild = this.firstChild.children[0].getBoundingClientRect();\n }\n var tickElements = [this.sliderContainer.querySelectorAll('.' + classNames.tick + '.' +\n classNames.large + ' .' + classNames.tickValue)];\n var other;\n if (this.ticks.placement === 'Both') {\n other = [].slice.call(tickElements[0], 2);\n }\n else {\n other = [].slice.call(tickElements[0], 1);\n }\n var tickWidth = this.orientation === 'Vertical' ?\n (first.height * 2) : (first.width * 2);\n for (var i = 0; i < this.firstChild.children.length; i++) {\n if (this.orientation === 'Vertical') {\n this.firstChild.children[i].style.top = -(firstChild.height / 2) + 'px';\n }\n else {\n if (!this.enableRtl) {\n this.firstChild.children[i].style.left = -(firstChild.width / 2) + 'px';\n }\n else {\n this.firstChild.children[i].style.left = (tickWidth -\n this.firstChild.children[i].getBoundingClientRect().width) / 2 + 'px';\n }\n }\n }\n for (var i = 0; i < other.length; i++) {\n var otherChild = other[i].getBoundingClientRect();\n if (this.orientation === 'Vertical') {\n setStyleAttribute(other[i], { top: (tickWidth - otherChild.height) / 2 + 'px' });\n }\n else {\n setStyleAttribute(other[i], { left: (tickWidth - otherChild.width) / 2 + 'px' });\n }\n }\n if (this.enableRtl && this.lastChild.children.length && count !== 0) {\n this.lastChild.children[0].style.left = -(this.lastChild.getBoundingClientRect().width / 2) + 'px';\n if (this.ticks.placement === 'Both') {\n this.lastChild.children[1].style.left = -(this.lastChild.getBoundingClientRect().width / 2) + 'px';\n }\n }\n if (count === 0) {\n if (this.orientation === 'Horizontal') {\n if (!this.enableRtl) {\n this.firstChild.classList.remove(classNames.sliderLastTick);\n this.firstChild.style.left = this.firstHandle.style.left;\n }\n else {\n this.firstChild.classList.remove(classNames.sliderLastTick);\n this.firstChild.style.right = this.firstHandle.style.right;\n this.firstChild.children[0].style.left =\n (this.firstChild.getBoundingClientRect().width / 2) + 2 + 'px';\n if (this.ticks.placement === 'Both') {\n this.firstChild.children[1].style.left =\n (this.firstChild.getBoundingClientRect().width / 2) + 2 + 'px';\n }\n }\n }\n if (this.orientation === 'Vertical') {\n this.firstChild.classList.remove(classNames.sliderLastTick);\n }\n }\n };\n Slider.prototype.setAriaAttrValue = function (element) {\n var ariaValueText;\n var isTickFormatted = ((!isNullOrUndefined(this.ticks) && !isNullOrUndefined(this.ticks.format))) ? true : false;\n var text = !isTickFormatted ?\n this.formatContent(this.ticksFormatInfo, false) : this.formatContent(this.tooltipFormatInfo, false);\n var valuenow = isTickFormatted ? this.formatContent(this.ticksFormatInfo, true) :\n this.formatContent(this.tooltipFormatInfo, true);\n text = (!this.customAriaText) ? (text) : (this.customAriaText);\n if (text.split(' - ').length === 2) {\n ariaValueText = text.split(' - ');\n }\n else {\n ariaValueText = [text, text];\n }\n this.setAriaAttributes(element);\n if (this.type !== 'Range') {\n attributes(element, { 'aria-valuenow': valuenow, 'aria-valuetext': text });\n }\n else {\n (!this.enableRtl) ? ((element === this.firstHandle) ?\n attributes(element, { 'aria-valuenow': valuenow.split(' - ')[0], 'aria-valuetext': ariaValueText[0] }) :\n attributes(element, { 'aria-valuenow': valuenow.split(' - ')[1], 'aria-valuetext': ariaValueText[1] })) :\n ((element === this.firstHandle) ?\n attributes(element, { 'aria-valuenow': valuenow.split(' - ')[1], 'aria-valuetext': ariaValueText[1] }) :\n attributes(element, { 'aria-valuenow': valuenow.split(' - ')[0], 'aria-valuetext': ariaValueText[0] }));\n }\n };\n Slider.prototype.handleValueUpdate = function () {\n var hVal;\n if (this.type === 'Range') {\n if (this.activeHandle === 1) {\n hVal = this.handleVal1;\n }\n else {\n hVal = this.handleVal2;\n }\n }\n else {\n hVal = this.handleVal1;\n }\n return hVal;\n };\n Slider.prototype.getLimitCorrectedValues = function (value) {\n if (this.type === 'MinRange' || this.type === 'Default') {\n value = (this.getLimitValueAndPosition(value, this.limits.minStart, this.limits.minEnd))[0];\n }\n else {\n if (this.activeHandle === 1) {\n value = (this.getLimitValueAndPosition(value, this.limits.minStart, this.limits.minEnd))[0];\n }\n else {\n value = (this.getLimitValueAndPosition(value, this.limits.maxStart, this.limits.maxEnd))[0];\n }\n }\n return value;\n };\n Slider.prototype.focusSliderElement = function () {\n if (!this.isElementFocused) {\n this.element.focus();\n this.isElementFocused = true;\n }\n };\n Slider.prototype.buttonClick = function (args) {\n this.focusSliderElement();\n var value;\n var enabledRTL = this.enableRtl && this.orientation !== 'Vertical';\n var hVal = this.handleValueUpdate();\n if ((args.keyCode === 40) || (args.keyCode === 37)\n || args.currentTarget.classList.contains(classNames.firstButton)) {\n enabledRTL ? (value = this.add(hVal, parseFloat(this.step.toString()), true)) :\n (value = this.add(hVal, parseFloat(this.step.toString()), false));\n }\n else if ((args.keyCode === 38) || (args.keyCode === 39) ||\n args.currentTarget.classList.contains(classNames.secondButton)) {\n enabledRTL ? (value = this.add(hVal, parseFloat(this.step.toString()), false)) :\n (value = this.add(hVal, parseFloat(this.step.toString()), true));\n }\n else if ((args.keyCode === 33\n || args.currentTarget.classList.contains(classNames.firstButton))) {\n enabledRTL ? (value = this.add(hVal, parseFloat(this.ticks.largeStep.toString()), false)) :\n (value = this.add(hVal, parseFloat(this.ticks.largeStep.toString()), true));\n }\n else if ((args.keyCode === 34) ||\n args.currentTarget.classList.contains(classNames.secondButton)) {\n enabledRTL ? (value = this.add(hVal, parseFloat(this.ticks.largeStep.toString()), true)) :\n (value = this.add(hVal, parseFloat(this.ticks.largeStep.toString()), false));\n }\n else if ((args.keyCode === 36)) {\n value = parseFloat(this.min.toString());\n }\n else if ((args.keyCode === 35)) {\n value = parseFloat(this.max.toString());\n }\n if (this.limits.enabled) {\n value = this.getLimitCorrectedValues(value);\n }\n this.changeHandleValue(value);\n if (this.isMaterial && !this.tooltip.isVisible &&\n !this.getHandle().classList.contains(classNames.sliderTabHandle)) {\n this.materialChange();\n }\n this.tooltipAnimation();\n this.getHandle().focus();\n if (args.currentTarget.classList.contains(classNames.firstButton)) {\n EventHandler.add(this.firstBtn, 'mouseup touchend', this.buttonUp, this);\n }\n if (args.currentTarget.classList.contains(classNames.secondButton)) {\n EventHandler.add(this.secondBtn, 'mouseup touchend', this.buttonUp, this);\n }\n };\n Slider.prototype.tooltipAnimation = function () {\n if (this.tooltip.isVisible) {\n var tooltipObj = this.activeHandle === 1 ? this.firstTooltipObj : this.secondTooltipObj;\n var tooltipElement = this.activeHandle === 1 ? this.firstTooltipElement : this.secondTooltipElement;\n if (this.isMaterial) {\n !tooltipElement.classList.contains(classNames.materialTooltipOpen) ? this.openMaterialTooltip() : this.refreshTooltip();\n }\n else {\n tooltipObj.animation = { open: { effect: 'None' }, close: { effect: 'FadeOut', duration: 500 } };\n this.openTooltip();\n }\n }\n };\n Slider.prototype.buttonUp = function (args) {\n if (this.tooltip.isVisible) {\n if (!this.isMaterial) {\n var tooltipObj = this.activeHandle === 1 ? this.firstTooltipObj : this.secondTooltipObj;\n tooltipObj.animation = { open: { effect: 'None' }, close: { effect: 'None' } };\n }\n }\n if (args.currentTarget.classList.contains(classNames.firstButton)) {\n EventHandler.remove(this.firstBtn, 'mouseup touchend', this.buttonUp);\n }\n if (args.currentTarget.classList.contains(classNames.secondButton)) {\n EventHandler.remove(this.secondBtn, 'mouseup touchend', this.buttonUp);\n }\n };\n Slider.prototype.setRangeBar = function () {\n if (this.orientation === 'Horizontal') {\n if (this.type === 'MinRange') {\n this.enableRtl ? (this.rangeBar.style.right = '0px') : (this.rangeBar.style.left = '0px');\n setStyleAttribute(this.rangeBar, { 'width': isNullOrUndefined(this.handlePos1) ? 0 : this.handlePos1 + 'px' });\n }\n else {\n this.enableRtl ? (this.rangeBar.style.right =\n this.handlePos1 + 'px') : (this.rangeBar.style.left = this.handlePos1 + 'px');\n setStyleAttribute(this.rangeBar, { 'width': this.handlePos2 - this.handlePos1 + 'px' });\n }\n }\n else {\n if (this.type === 'MinRange') {\n this.rangeBar.style.bottom = '0px';\n setStyleAttribute(this.rangeBar, { 'height': isNullOrUndefined(this.handlePos1) ? 0 : this.handlePos1 + 'px' });\n }\n else {\n this.rangeBar.style.bottom = this.handlePos1 + 'px';\n setStyleAttribute(this.rangeBar, { 'height': this.handlePos2 - this.handlePos1 + 'px' });\n }\n }\n };\n Slider.prototype.checkValidValueAndPos = function (value) {\n value = this.checkHandleValue(value);\n value = this.checkHandlePosition(value);\n return value;\n };\n Slider.prototype.setLimitBarPositions = function (fromMinPostion, fromMaxpostion, toMinPostion, toMaxpostion) {\n if (this.orientation === 'Horizontal') {\n if (!this.enableRtl) {\n this.limitBarFirst.style.left = fromMinPostion + 'px';\n this.limitBarFirst.style.width = (fromMaxpostion - fromMinPostion) + 'px';\n }\n else {\n this.limitBarFirst.style.right = fromMinPostion + 'px';\n this.limitBarFirst.style.width = (fromMaxpostion - fromMinPostion) + 'px';\n }\n }\n else {\n this.limitBarFirst.style.bottom = fromMinPostion + 'px';\n this.limitBarFirst.style.height = (fromMaxpostion - fromMinPostion) + 'px';\n }\n if (this.type === 'Range') {\n if (this.orientation === 'Horizontal') {\n if (!this.enableRtl) {\n this.limitBarSecond.style.left = toMinPostion + 'px';\n this.limitBarSecond.style.width = (toMaxpostion - toMinPostion) + 'px';\n }\n else {\n this.limitBarSecond.style.right = toMinPostion + 'px';\n this.limitBarSecond.style.width = (toMaxpostion - toMinPostion) + 'px';\n }\n }\n else {\n this.limitBarSecond.style.bottom = toMinPostion + 'px';\n this.limitBarSecond.style.height = (toMaxpostion - toMinPostion) + 'px';\n }\n }\n };\n Slider.prototype.setLimitBar = function () {\n if (this.type === 'Default' || this.type === 'MinRange') {\n var fromPosition = (this.getLimitValueAndPosition(this.limits.minStart, this.limits.minStart, this.limits.minEnd, true))[0];\n fromPosition = this.checkValidValueAndPos(fromPosition);\n var toPosition = (this.getLimitValueAndPosition(this.limits.minEnd, this.limits.minStart, this.limits.minEnd, true))[0];\n toPosition = this.checkValidValueAndPos(toPosition);\n this.setLimitBarPositions(fromPosition, toPosition);\n }\n else if (this.type === 'Range') {\n var fromMinPostion = (this.getLimitValueAndPosition(this.limits.minStart, this.limits.minStart, this.limits.minEnd, true))[0];\n fromMinPostion = this.checkValidValueAndPos(fromMinPostion);\n var fromMaxpostion = (this.getLimitValueAndPosition(this.limits.minEnd, this.limits.minStart, this.limits.minEnd, true))[0];\n fromMaxpostion = this.checkValidValueAndPos(fromMaxpostion);\n var toMinPostion = (this.getLimitValueAndPosition(this.limits.maxStart, this.limits.maxStart, this.limits.maxEnd, true))[0];\n toMinPostion = this.checkValidValueAndPos(toMinPostion);\n var toMaxpostion = (this.getLimitValueAndPosition(this.limits.maxEnd, this.limits.maxStart, this.limits.maxEnd, true))[0];\n toMaxpostion = this.checkValidValueAndPos(toMaxpostion);\n this.setLimitBarPositions(fromMinPostion, fromMaxpostion, toMinPostion, toMaxpostion);\n }\n };\n Slider.prototype.getLimitValueAndPosition = function (currentValue, minValue, maxValue, limitBar) {\n if (isNullOrUndefined(minValue)) {\n minValue = this.min;\n if (isNullOrUndefined(currentValue) && limitBar) {\n currentValue = minValue;\n }\n }\n if (isNullOrUndefined(maxValue)) {\n maxValue = this.max;\n if (isNullOrUndefined(currentValue) && limitBar) {\n currentValue = maxValue;\n }\n }\n if (currentValue < minValue) {\n currentValue = minValue;\n }\n if (currentValue > maxValue) {\n currentValue = maxValue;\n }\n return [currentValue, this.checkHandlePosition(currentValue)];\n };\n Slider.prototype.setValue = function () {\n if (!isNullOrUndefined(this.customValues) && this.customValues.length > 0) {\n this.min = 0;\n this.max = this.customValues.length - 1;\n }\n this.setAriaAttributes(this.firstHandle);\n this.handleVal1 = isNullOrUndefined(this.value) ? this.checkHandleValue(parseFloat(this.min.toString())) :\n this.checkHandleValue(parseFloat(this.value.toString()));\n this.handlePos1 = this.checkHandlePosition(this.handleVal1);\n this.preHandlePos1 = this.handlePos1;\n isNullOrUndefined(this.activeHandle) ? (this.type === 'Range' ? this.activeHandle = 2 : this.activeHandle = 1) :\n this.activeHandle = this.activeHandle;\n if (this.type === 'Default' || this.type === 'MinRange') {\n if (this.limits.enabled) {\n var values = this.getLimitValueAndPosition(this.handleVal1, this.limits.minStart, this.limits.minEnd);\n this.handleVal1 = values[0];\n this.handlePos1 = values[1];\n this.preHandlePos1 = this.handlePos1;\n }\n this.setHandlePosition();\n this.handleStart();\n this.value = this.handleVal1;\n this.setAriaAttrValue(this.firstHandle);\n this.changeEvent('changed');\n }\n else {\n this.validateRangeValue();\n }\n if (this.type !== 'Default') {\n this.setRangeBar();\n }\n if (this.limits.enabled) {\n this.setLimitBar();\n }\n };\n Slider.prototype.rangeValueUpdate = function () {\n if (this.value === null || typeof (this.value) !== 'object') {\n this.value = [parseFloat(formatUnit(this.min)), parseFloat(formatUnit(this.max))];\n }\n };\n Slider.prototype.validateRangeValue = function () {\n this.rangeValueUpdate();\n this.setRangeValue();\n };\n Slider.prototype.modifyZindex = function () {\n if (this.type === 'Range') {\n if (this.activeHandle === 1) {\n this.firstHandle.style.zIndex = (this.zIndex + 4) + '';\n this.secondHandle.style.zIndex = (this.zIndex + 3) + '';\n if (this.isMaterial && this.tooltip.isVisible && this.firstTooltipElement && this.secondTooltipElement) {\n this.firstTooltipElement.style.zIndex = (this.zIndex + 4) + '';\n this.secondTooltipElement.style.zIndex = (this.zIndex + 3) + '';\n }\n }\n else {\n this.firstHandle.style.zIndex = (this.zIndex + 3) + '';\n this.secondHandle.style.zIndex = (this.zIndex + 4) + '';\n if (this.isMaterial && this.tooltip.isVisible && this.firstTooltipElement && this.secondTooltipElement) {\n this.firstTooltipElement.style.zIndex = (this.zIndex + 3) + '';\n this.secondTooltipElement.style.zIndex = (this.zIndex + 4) + '';\n }\n }\n }\n else if (this.isMaterial && this.tooltip.isVisible && this.firstTooltipElement) {\n this.firstTooltipElement.style.zIndex = (this.zIndex + 4) + '';\n }\n };\n Slider.prototype.setHandlePosition = function () {\n var _this = this;\n var pos = (this.activeHandle === 1) ? this.handlePos1 : this.handlePos2;\n var val = (this.activeHandle === 1) ? this.handleVal1 : this.handleVal2;\n var handle;\n var tooltipElement;\n if (this.isMaterial && this.tooltip.isVisible) {\n tooltipElement = this.activeHandle === 1 ? this.firstTooltipElement : this.secondTooltipElement;\n handle = [this.getHandle(), (this.activeHandle === 1 ? this.firstMaterialHandle : this.secondMaterialHandle)];\n }\n else {\n handle = [this.getHandle()];\n }\n if (this.tooltip.isVisible && pos === 0 && this.type !== 'Range') {\n handle[0].classList.add(classNames.sliderHandleStart);\n if (this.isMaterial) {\n handle[1].classList.add(classNames.sliderHandleStart);\n if (tooltipElement) {\n tooltipElement.classList.add(classNames.sliderTooltipStart);\n }\n }\n }\n else {\n handle[0].classList.remove(classNames.sliderHandleStart);\n if (this.tooltip.isVisible && this.isMaterial) {\n handle[1].classList.remove(classNames.sliderHandleStart);\n if (tooltipElement) {\n tooltipElement.classList.remove(classNames.sliderTooltipStart);\n }\n }\n }\n handle.forEach(function (handle) {\n if (_this.orientation === 'Horizontal') {\n _this.enableRtl ? (handle.style.right =\n pos + \"px\") : (handle.style.left = pos + \"px\");\n }\n else {\n handle.style.bottom = pos + \"px\";\n }\n });\n this.changeEvent('change');\n };\n Slider.prototype.getHandle = function () {\n return (this.activeHandle === 1) ? this.firstHandle : this.secondHandle;\n };\n Slider.prototype.setRangeValue = function () {\n var temp = this.activeHandle;\n this.updateRangeValue();\n this.activeHandle = 1;\n this.setHandlePosition();\n this.activeHandle = 2;\n this.setHandlePosition();\n this.activeHandle = 1;\n };\n Slider.prototype.changeEvent = function (eventName) {\n var previous = eventName === 'change' ? this.previousVal : this.previousChanged;\n if (this.type !== 'Range') {\n this.setProperties({ 'value': this.handleVal1 }, true);\n if (previous !== this.value) {\n this.trigger(eventName, this.changeEventArgs(eventName));\n this.setPreviousVal(eventName, this.value);\n }\n this.setAriaAttrValue(this.firstHandle);\n }\n else {\n var value = this.value = [this.handleVal1, this.handleVal2];\n this.setProperties({ 'value': value }, true);\n if (previous.length === this.value.length\n && this.value[0] !== previous[0] || this.value[1] !== previous[1]) {\n this.trigger(eventName, this.changeEventArgs(eventName));\n this.setPreviousVal(eventName, this.value);\n }\n this.setAriaAttrValue(this.getHandle());\n }\n this.hiddenInput.value = this.value.toString();\n };\n Slider.prototype.changeEventArgs = function (eventName) {\n var eventArgs;\n if (this.tooltip.isVisible && this.firstTooltipObj) {\n this.tooltipValue();\n eventArgs = {\n value: this.value,\n previousValue: eventName === 'change' ? this.previousVal : this.previousChanged,\n action: eventName, text: this.firstTooltipObj.content\n };\n }\n else {\n eventArgs = {\n value: this.value,\n previousValue: eventName === 'change' ? this.previousVal : this.previousChanged,\n action: eventName, text: isNullOrUndefined(this.ticksFormatInfo.format) ? this.value.toString() :\n (this.type !== 'Range' ? this.formatString(this.value, this.ticksFormatInfo).formatString :\n (this.formatString(this.value[0], this.ticksFormatInfo).formatString + ' - ' +\n this.formatString(this.value[1], this.ticksFormatInfo).formatString))\n };\n }\n return eventArgs;\n };\n Slider.prototype.setPreviousVal = function (eventName, value) {\n if (eventName === 'change') {\n this.previousVal = value;\n }\n else {\n this.previousChanged = value;\n }\n };\n Slider.prototype.updateRangeValue = function () {\n var values = this.value.toString().split(',').map(Number);\n if ((this.enableRtl && this.orientation !== 'Vertical') || this.rtl) {\n this.value = [values[1], values[0]];\n }\n else {\n this.value = [values[0], values[1]];\n }\n if (this.enableRtl && this.orientation !== 'Vertical') {\n this.handleVal1 = this.checkHandleValue(this.value[1]);\n this.handleVal2 = this.checkHandleValue(this.value[0]);\n }\n else {\n this.handleVal1 = this.checkHandleValue(this.value[0]);\n this.handleVal2 = this.checkHandleValue(this.value[1]);\n }\n this.handlePos1 = this.checkHandlePosition(this.handleVal1);\n this.handlePos2 = this.checkHandlePosition(this.handleVal2);\n if (this.handlePos1 > this.handlePos2) {\n this.handlePos1 = this.handlePos2;\n this.handleVal1 = this.handleVal2;\n }\n this.preHandlePos1 = this.handlePos1;\n this.preHandlePos2 = this.handlePos2;\n if (this.limits.enabled) {\n this.activeHandle = 1;\n var values_1 = this.getLimitValueAndPosition(this.handleVal1, this.limits.minStart, this.limits.minEnd);\n this.handleVal1 = values_1[0];\n this.handlePos1 = values_1[1];\n this.preHandlePos1 = this.handlePos1;\n this.activeHandle = 2;\n values_1 = this.getLimitValueAndPosition(this.handleVal2, this.limits.maxStart, this.limits.maxEnd);\n this.handleVal2 = values_1[0];\n this.handlePos2 = values_1[1];\n this.preHandlePos2 = this.handlePos2;\n }\n };\n Slider.prototype.checkHandlePosition = function (value) {\n var pos;\n value = (100 *\n (value - (parseFloat(formatUnit(this.min))))) / ((parseFloat(formatUnit(this.max))) - (parseFloat(formatUnit(this.min))));\n if (this.orientation === 'Horizontal') {\n pos = this.element.getBoundingClientRect().width * (value / 100);\n }\n else {\n pos = this.element.getBoundingClientRect().height * (value / 100);\n }\n if (((parseFloat(formatUnit(this.max))) === (parseFloat(formatUnit(this.min))))) {\n if (this.orientation === 'Horizontal') {\n pos = this.element.getBoundingClientRect().width;\n }\n else {\n pos = this.element.getBoundingClientRect().height;\n }\n }\n return pos;\n };\n Slider.prototype.checkHandleValue = function (value) {\n if (this.min > this.max) {\n this.min = this.max;\n }\n if (this.min === this.max) {\n return (parseFloat(formatUnit(this.max)));\n }\n var handle = this.tempStartEnd();\n if (value < handle.start) {\n value = handle.start;\n }\n else if (value > handle.end) {\n value = handle.end;\n }\n return value;\n };\n Slider.prototype.onResize = function () {\n var _this = this;\n this.firstHandle.style.transition = 'none';\n if (this.type !== 'Default') {\n this.rangeBar.style.transition = 'none';\n }\n if (this.type === 'Range') {\n this.secondHandle.style.transition = 'none';\n }\n this.handlePos1 = this.checkHandlePosition(this.handleVal1);\n if (this.handleVal2) {\n this.handlePos2 = this.checkHandlePosition(this.handleVal2);\n }\n if (this.orientation === 'Horizontal') {\n this.enableRtl ? this.firstHandle.style.right =\n this.handlePos1 + \"px\" : this.firstHandle.style.left = this.handlePos1 + \"px\";\n if (this.isMaterial && this.tooltip.isVisible && this.firstMaterialHandle) {\n this.enableRtl ? this.firstMaterialHandle.style.right =\n this.handlePos1 + \"px\" : this.firstMaterialHandle.style.left = this.handlePos1 + \"px\";\n }\n if (this.type === 'MinRange') {\n this.enableRtl ? (this.rangeBar.style.right = '0px') : (this.rangeBar.style.left = '0px');\n setStyleAttribute(this.rangeBar, { 'width': isNullOrUndefined(this.handlePos1) ? 0 : this.handlePos1 + 'px' });\n }\n else if (this.type === 'Range') {\n this.enableRtl ? this.secondHandle.style.right =\n this.handlePos2 + \"px\" : this.secondHandle.style.left = this.handlePos2 + \"px\";\n if (this.isMaterial && this.tooltip.isVisible && this.secondMaterialHandle) {\n this.enableRtl ? this.secondMaterialHandle.style.right =\n this.handlePos2 + \"px\" : this.secondMaterialHandle.style.left = this.handlePos2 + \"px\";\n }\n this.enableRtl ? (this.rangeBar.style.right =\n this.handlePos1 + 'px') : (this.rangeBar.style.left = this.handlePos1 + 'px');\n setStyleAttribute(this.rangeBar, { 'width': this.handlePos2 - this.handlePos1 + 'px' });\n }\n }\n else {\n this.firstHandle.style.bottom = this.handlePos1 + \"px\";\n if (this.isMaterial && this.tooltip.isVisible && this.firstMaterialHandle) {\n this.firstMaterialHandle.style.bottom = this.handlePos1 + \"px\";\n }\n if (this.type === 'MinRange') {\n this.rangeBar.style.bottom = '0px';\n setStyleAttribute(this.rangeBar, { 'height': isNullOrUndefined(this.handlePos1) ? 0 : this.handlePos1 + 'px' });\n }\n else if (this.type === 'Range') {\n this.secondHandle.style.bottom = this.handlePos2 + \"px\";\n if (this.isMaterial && this.tooltip.isVisible && this.secondMaterialHandle) {\n this.secondMaterialHandle.style.bottom = this.handlePos2 + \"px\";\n }\n this.rangeBar.style.bottom = this.handlePos1 + 'px';\n setStyleAttribute(this.rangeBar, { 'height': this.handlePos2 - this.handlePos1 + 'px' });\n }\n }\n if (this.limits.enabled) {\n this.setLimitBar();\n }\n if (this.ticks.placement !== 'None' && this.ul) {\n this.removeElement(this.ul);\n this.renderScale();\n }\n if (!this.tooltip.isVisible) {\n setTimeout(function () {\n _this.firstHandle.style.transition = _this.scaleTransform;\n if (_this.type === 'Range') {\n _this.secondHandle.style.transition = _this.scaleTransform;\n }\n });\n }\n this.refreshTooltip();\n };\n Slider.prototype.changeHandleValue = function (value) {\n var position = null;\n if (this.activeHandle === 1) {\n if (!(this.limits.enabled && this.limits.startHandleFixed)) {\n this.handleVal1 = this.checkHandleValue(value);\n this.handlePos1 = this.checkHandlePosition(this.handleVal1);\n if (this.type === 'Range' && this.handlePos1 > this.handlePos2) {\n this.handlePos1 = this.handlePos2;\n this.handleVal1 = this.handleVal2;\n }\n if (this.handlePos1 !== this.preHandlePos1) {\n position = this.preHandlePos1 = this.handlePos1;\n }\n }\n this.modifyZindex();\n }\n else {\n if (!(this.limits.enabled && this.limits.endHandleFixed)) {\n this.handleVal2 = this.checkHandleValue(value);\n this.handlePos2 = this.checkHandlePosition(this.handleVal2);\n if (this.type === 'Range' && this.handlePos2 < this.handlePos1) {\n this.handlePos2 = this.handlePos1;\n this.handleVal2 = this.handleVal1;\n }\n if (this.handlePos2 !== this.preHandlePos2) {\n position = this.preHandlePos2 = this.handlePos2;\n }\n }\n this.modifyZindex();\n }\n if (position !== null) {\n if (this.type !== 'Default') {\n this.setRangeBar();\n }\n this.setHandlePosition();\n }\n };\n Slider.prototype.tempStartEnd = function () {\n if (this.min > this.max) {\n return {\n start: this.max,\n end: this.min\n };\n }\n else {\n return {\n start: this.min,\n end: this.max\n };\n }\n };\n Slider.prototype.xyToPosition = function (position) {\n var pos;\n if (this.min === this.max) {\n return 100;\n }\n if (this.orientation === 'Horizontal') {\n var left = position.x - this.element.getBoundingClientRect().left;\n var num = this.element.offsetWidth / 100;\n this.val = (left / num);\n }\n else {\n var top_1 = position.y - this.element.getBoundingClientRect().top;\n var num = this.element.offsetHeight / 100;\n this.val = 100 - (top_1 / num);\n }\n var val = this.stepValueCalculation(this.val);\n if (val < 0) {\n val = 0;\n }\n else if (val > 100) {\n val = 100;\n }\n if (this.enableRtl && this.orientation !== 'Vertical') {\n val = 100 - val;\n }\n if (this.orientation === 'Horizontal') {\n pos = this.element.getBoundingClientRect().width * (val / 100);\n }\n else {\n pos = this.element.getBoundingClientRect().height * (val / 100);\n }\n return pos;\n };\n Slider.prototype.stepValueCalculation = function (value) {\n if (this.step === 0) {\n this.step = 1;\n }\n var percentStep = (parseFloat(formatUnit(this.step))) / ((parseFloat(formatUnit(this.max)) - parseFloat(formatUnit(this.min))) / 100);\n var remain = value % Math.abs(percentStep);\n if (remain !== 0) {\n if ((percentStep / 2) > remain) {\n value -= remain;\n }\n else {\n value += Math.abs(percentStep) - remain;\n }\n }\n return value;\n };\n Slider.prototype.add = function (a, b, addition) {\n var precision;\n var x = Math.pow(10, precision || 3);\n var val;\n if (addition) {\n val = (Math.round(a * x) + Math.round(b * x)) / x;\n }\n else {\n val = (Math.round(a * x) - Math.round(b * x)) / x;\n }\n return val;\n };\n Slider.prototype.round = function (a) {\n var f = this.step.toString().split('.');\n return f[1] ? parseFloat(a.toFixed(f[1].length)) : Math.round(a);\n };\n Slider.prototype.positionToValue = function (pos) {\n var val;\n var diff = parseFloat(formatUnit(this.max)) - parseFloat(formatUnit(this.min));\n if (this.orientation === 'Horizontal') {\n val = (pos / this.element.getBoundingClientRect().width) * diff;\n }\n else {\n val = (pos / this.element.getBoundingClientRect().height) * diff;\n }\n var total = this.add(val, parseFloat(this.min.toString()), true);\n return (total);\n };\n Slider.prototype.sliderBarClick = function (evt) {\n evt.preventDefault();\n var pos;\n if (evt.type === 'mousedown' || evt.type === 'click') {\n pos = { x: evt.clientX, y: evt.clientY };\n }\n else if (evt.type === 'touchstart') {\n pos = { x: evt.changedTouches[0].clientX, y: evt.changedTouches[0].clientY };\n }\n var handlepos = this.xyToPosition(pos);\n var handleVal = this.positionToValue(handlepos);\n if (this.type === 'Range' && (this.handlePos2 - handlepos) < (handlepos - this.handlePos1)) {\n this.activeHandle = 2;\n if (!(this.limits.enabled && this.limits.endHandleFixed)) {\n if (this.limits.enabled) {\n var value = this.getLimitValueAndPosition(handleVal, this.limits.maxStart, this.limits.maxEnd);\n handleVal = value[0];\n handlepos = value[1];\n }\n this.secondHandle.classList.add(classNames.sliderActiveHandle);\n this.handlePos2 = this.preHandlePos2 = handlepos;\n this.handleVal2 = handleVal;\n }\n this.modifyZindex();\n this.secondHandle.focus();\n }\n else {\n this.activeHandle = 1;\n if (!(this.limits.enabled && this.limits.startHandleFixed)) {\n if (this.limits.enabled) {\n var value = this.getLimitValueAndPosition(handleVal, this.limits.minStart, this.limits.minEnd);\n handleVal = value[0];\n handlepos = value[1];\n }\n this.firstHandle.classList.add(classNames.sliderActiveHandle);\n this.handlePos1 = this.preHandlePos1 = handlepos;\n this.handleVal1 = handleVal;\n }\n this.modifyZindex();\n this.firstHandle.focus();\n }\n if (this.isMaterial && this.tooltip.isVisible) {\n var tooltipElement = this.activeHandle === 1 ? this.firstTooltipElement : this.secondTooltipElement;\n tooltipElement.classList.add(classNames.materialTooltipActive);\n }\n var focusedElement = this.element.querySelector('.' + classNames.sliderTabHandle);\n if (focusedElement && this.getHandle() !== focusedElement) {\n focusedElement.classList.remove(classNames.sliderTabHandle);\n }\n var handle = this.activeHandle === 1 ? this.firstHandle : this.secondHandle;\n if (evt.target === handle) {\n if (this.isMaterial && !this.tooltip.isVisible &&\n !this.getHandle().classList.contains(classNames.sliderTabHandle)) {\n this.materialChange();\n }\n this.tooltipAnimation();\n return;\n }\n if (!this.checkRepeatedValue(handleVal)) {\n return;\n }\n var transition = this.isMaterial && this.tooltip.isVisible ?\n this.transitionOnMaterialTooltip : this.transition;\n this.getHandle().style.transition = transition.handle;\n if (this.type !== 'Default') {\n this.rangeBar.style.transition = transition.rangeBar;\n }\n this.setHandlePosition();\n if (this.type !== 'Default') {\n this.setRangeBar();\n }\n };\n Slider.prototype.refreshTooltipOnMove = function () {\n if (this.tooltip.isVisible) {\n this.tooltipValue();\n this.activeHandle === 1 ? this.firstTooltipObj.refresh(this.firstHandle) :\n this.secondTooltipObj.refresh(this.secondHandle);\n }\n };\n Slider.prototype.sliderDown = function (event) {\n event.preventDefault();\n this.focusSliderElement();\n if (this.type === 'Range' && this.drag && event.target === this.rangeBar) {\n var xPostion = void 0;\n var yPostion = void 0;\n if (event.type === 'mousedown') {\n _a = [event.clientX, event.clientY], xPostion = _a[0], yPostion = _a[1];\n }\n else if (event.type === 'touchstart') {\n _b = [event.changedTouches[0].clientX, event.changedTouches[0].clientY], xPostion = _b[0], yPostion = _b[1];\n }\n if (this.orientation === 'Horizontal') {\n this.firstPartRemain = xPostion - this.rangeBar.getBoundingClientRect().left;\n this.secondPartRemain = this.rangeBar.getBoundingClientRect().right - xPostion;\n }\n else {\n this.firstPartRemain = yPostion - this.rangeBar.getBoundingClientRect().top;\n this.secondPartRemain = this.rangeBar.getBoundingClientRect().bottom - yPostion;\n }\n this.minDiff = this.handleVal2 - this.handleVal1;\n this.getHandle().focus();\n EventHandler.add(document, 'mousemove touchmove', this.dragRangeBarMove, this);\n EventHandler.add(document, 'mouseup touchend', this.dragRangeBarUp, this);\n }\n else {\n this.sliderBarClick(event);\n EventHandler.add(document, 'mousemove touchmove', this.sliderBarMove, this);\n EventHandler.add(document, 'mouseup touchend', this.sliderBarUp, this);\n }\n var _a, _b;\n };\n Slider.prototype.handleValueAdjust = function (handleValue, assignValue, handleNumber) {\n if (handleNumber === 1) {\n this.handleVal1 = assignValue;\n this.handleVal2 = this.handleVal1 + this.minDiff;\n }\n else if (handleNumber === 2) {\n this.handleVal2 = assignValue;\n this.handleVal1 = this.handleVal2 - this.minDiff;\n }\n this.handlePos1 = this.checkHandlePosition(this.handleVal1);\n this.handlePos2 = this.checkHandlePosition(this.handleVal2);\n };\n Slider.prototype.dragRangeBarMove = function (event) {\n if (event.type !== 'touchmove') {\n event.preventDefault();\n }\n var pos;\n this.rangeBar.style.transition = 'none';\n this.firstHandle.style.transition = 'none';\n this.secondHandle.style.transition = 'none';\n var xPostion;\n var yPostion;\n if (event.type === 'mousemove') {\n _a = [event.clientX, event.clientY], xPostion = _a[0], yPostion = _a[1];\n }\n else {\n _b = [event.changedTouches[0].clientX, event.changedTouches[0].clientY], xPostion = _b[0], yPostion = _b[1];\n }\n if (!(this.limits.enabled && this.limits.startHandleFixed) && !(this.limits.enabled && this.limits.endHandleFixed)) {\n if (!this.enableRtl) {\n pos = { x: xPostion - this.firstPartRemain, y: yPostion + this.secondPartRemain };\n }\n else {\n pos = { x: xPostion + this.secondPartRemain, y: yPostion + this.secondPartRemain };\n }\n this.handlePos1 = this.xyToPosition(pos);\n this.handleVal1 = this.positionToValue(this.handlePos1);\n if (!this.enableRtl) {\n pos = { x: xPostion + this.secondPartRemain, y: yPostion - this.firstPartRemain };\n }\n else {\n pos = { x: xPostion - this.firstPartRemain, y: yPostion - this.firstPartRemain };\n }\n this.handlePos2 = this.xyToPosition(pos);\n this.handleVal2 = this.positionToValue(this.handlePos2);\n if (this.limits.enabled) {\n var value = this.getLimitValueAndPosition(this.handleVal1, this.limits.minStart, this.limits.minEnd);\n this.handleVal1 = value[0];\n this.handlePos1 = value[1];\n if (this.handleVal1 === this.limits.minEnd) {\n this.handleValueAdjust(this.handleVal1, this.limits.minEnd, 1);\n }\n if (this.handleVal1 === this.limits.minStart) {\n this.handleValueAdjust(this.handleVal1, this.limits.minStart, 1);\n }\n value = this.getLimitValueAndPosition(this.handleVal2, this.limits.maxStart, this.limits.maxEnd);\n this.handleVal2 = value[0];\n this.handlePos2 = value[1];\n if (this.handleVal2 === this.limits.maxStart) {\n this.handleValueAdjust(this.handleVal2, this.limits.maxStart, 2);\n }\n if (this.handleVal2 === this.limits.maxEnd) {\n this.handleValueAdjust(this.handleVal2, this.limits.maxEnd, 2);\n }\n }\n if (this.handleVal2 === this.max) {\n this.handleValueAdjust(this.handleVal2, this.max, 2);\n }\n if (this.handleVal1 === this.min) {\n this.handleValueAdjust(this.handleVal1, this.min, 1);\n }\n }\n this.activeHandle = 1;\n this.setHandlePosition();\n if (this.tooltip.isVisible) {\n if (this.isMaterial) {\n !this.firstTooltipElement.classList.contains(classNames.materialTooltipOpen) ? this.openMaterialTooltip() :\n this.refreshTooltipOnMove();\n }\n else {\n !this.firstTooltipElement ? this.openTooltip() : this.refreshTooltipOnMove();\n }\n }\n this.activeHandle = 2;\n this.setHandlePosition();\n if (this.tooltip.isVisible) {\n if (this.isMaterial) {\n !this.secondTooltipElement.classList.contains(classNames.materialTooltipOpen) ? this.openMaterialTooltip() :\n this.refreshTooltipOnMove();\n }\n else {\n !this.secondTooltipElement ? this.openTooltip() : this.refreshTooltipOnMove();\n }\n }\n this.setRangeBar();\n var _a, _b;\n };\n Slider.prototype.sliderBarUp = function () {\n this.changeEvent('changed');\n this.handleFocusOut();\n this.firstHandle.classList.remove(classNames.sliderActiveHandle);\n if (this.type === 'Range') {\n this.secondHandle.classList.remove(classNames.sliderActiveHandle);\n }\n if (this.tooltip.isVisible) {\n if (this.tooltip.showOn !== 'Always') {\n this.closeTooltip();\n }\n if (!this.isMaterial) {\n var tooltipObj = this.activeHandle === 1 ? this.firstTooltipObj : this.secondTooltipObj;\n tooltipObj.animation = { open: { effect: 'None' }, close: { effect: 'None' } };\n }\n }\n if (this.isMaterial) {\n this.getHandle().classList.remove('e-large-thumb-size');\n if (this.tooltip.isVisible) {\n var tooltipElement = this.activeHandle === 1 ? this.firstTooltipElement : this.secondTooltipElement;\n tooltipElement.classList.remove(classNames.materialTooltipActive);\n }\n }\n EventHandler.remove(document, 'mousemove touchmove', this.sliderBarMove);\n EventHandler.remove(document, 'mouseup touchend', this.sliderBarUp);\n };\n Slider.prototype.sliderBarMove = function (evt) {\n if (evt.type !== 'touchmove') {\n evt.preventDefault();\n }\n var pos;\n if (evt.type === 'mousemove') {\n pos = { x: evt.clientX, y: evt.clientY };\n }\n else {\n pos = { x: evt.changedTouches[0].clientX, y: evt.changedTouches[0].clientY };\n }\n var handlepos = this.xyToPosition(pos);\n var handleVal = this.positionToValue(handlepos);\n handlepos = Math.round(handlepos);\n if (this.type !== 'Range' && this.activeHandle === 1) {\n if (!(this.limits.enabled && this.limits.startHandleFixed)) {\n if (this.limits.enabled) {\n var valueAndPostion = this.getLimitValueAndPosition(handleVal, this.limits.minStart, this.limits.minEnd);\n handlepos = valueAndPostion[1];\n handleVal = valueAndPostion[0];\n }\n this.handlePos1 = handlepos;\n this.handleVal1 = handleVal;\n }\n this.firstHandle.classList.add(classNames.sliderActiveHandle);\n }\n if (this.type === 'Range') {\n if (this.activeHandle === 1) {\n this.firstHandle.classList.add(classNames.sliderActiveHandle);\n if (!(this.limits.enabled && this.limits.startHandleFixed)) {\n if (handlepos > this.handlePos2) {\n handlepos = this.handlePos2;\n handleVal = this.handleVal2;\n }\n if (handlepos !== this.preHandlePos1) {\n if (this.limits.enabled) {\n var value = this.getLimitValueAndPosition(handleVal, this.limits.minStart, this.limits.minEnd);\n handleVal = value[0];\n handlepos = value[1];\n }\n this.handlePos1 = this.preHandlePos1 = handlepos;\n this.handleVal1 = handleVal;\n this.activeHandle = 1;\n }\n }\n }\n else if (this.activeHandle === 2) {\n this.secondHandle.classList.add(classNames.sliderActiveHandle);\n if (!(this.limits.enabled && this.limits.endHandleFixed)) {\n if (handlepos < this.handlePos1) {\n handlepos = this.handlePos1;\n handleVal = this.handleVal1;\n }\n if (handlepos !== this.preHandlePos2) {\n if (this.limits.enabled) {\n var value = this.getLimitValueAndPosition(handleVal, this.limits.maxStart, this.limits.maxEnd);\n handleVal = value[0];\n handlepos = value[1];\n }\n this.handlePos2 = this.preHandlePos2 = handlepos;\n this.handleVal2 = handleVal;\n this.activeHandle = 2;\n }\n }\n }\n }\n if (!this.checkRepeatedValue(handleVal)) {\n return;\n }\n this.getHandle().style.transition = this.scaleTransform;\n if (this.type !== 'Default') {\n this.rangeBar.style.transition = 'none';\n }\n this.setHandlePosition();\n if (this.isMaterial && !this.tooltip.isVisible &&\n !this.getHandle().classList.contains(classNames.sliderTabHandle)) {\n this.materialChange();\n }\n var tooltipElement = this.activeHandle === 1 ? this.firstTooltipElement : this.secondTooltipElement;\n if (this.tooltip.isVisible) {\n if (this.isMaterial) {\n !tooltipElement.classList.contains(classNames.materialTooltipOpen) ? this.openMaterialTooltip() :\n this.refreshTooltipOnMove();\n }\n else {\n !tooltipElement ? this.openTooltip() : this.refreshTooltipOnMove();\n }\n }\n if (this.type !== 'Default') {\n this.setRangeBar();\n }\n };\n Slider.prototype.dragRangeBarUp = function (event) {\n this.changeEvent('changed');\n if (this.tooltip.isVisible) {\n if (this.tooltip.showOn !== 'Always' && !this.isMaterial) {\n this.activeHandle = 1;\n this.firstTooltipObj.animation = { open: { effect: 'None' }, close: { effect: 'FadeOut', duration: 500 } };\n this.closeTooltip();\n this.activeHandle = 2;\n this.secondTooltipObj.animation = { open: { effect: 'None' }, close: { effect: 'FadeOut', duration: 500 } };\n this.closeTooltip();\n }\n }\n EventHandler.remove(document, 'mousemove touchmove', this.dragRangeBarMove);\n EventHandler.remove(document, 'mouseup touchend', this.dragRangeBarUp);\n };\n Slider.prototype.checkRepeatedValue = function (currentValue) {\n if (this.type === 'Range') {\n var previousVal = this.enableRtl && this.orientation !== 'Vertical' ? (this.activeHandle === 1 ?\n this.previousVal[1] : this.previousVal[0]) :\n (this.activeHandle === 1 ? this.previousVal[0] : this.previousVal[1]);\n if (currentValue === previousVal) {\n return 0;\n }\n }\n else {\n if (currentValue === this.previousVal) {\n return 0;\n }\n }\n return 1;\n };\n Slider.prototype.refreshTooltip = function () {\n if (this.tooltip.isVisible && this.firstTooltipObj) {\n this.tooltipValue();\n this.firstTooltipObj.refresh(this.firstHandle);\n if (this.type === 'Range') {\n this.secondTooltipObj.refresh(this.secondHandle);\n }\n }\n };\n Slider.prototype.openTooltip = function () {\n if (this.tooltip.isVisible && this.firstTooltipObj) {\n this.tooltipValue();\n if (this.isMaterial) {\n this.openMaterialTooltip();\n }\n else {\n if (this.activeHandle === 1) {\n this.firstTooltipObj.open(this.firstHandle);\n }\n else {\n this.secondTooltipObj.open(this.secondHandle);\n }\n }\n }\n };\n Slider.prototype.keyDown = function (event) {\n switch (event.keyCode) {\n case 37:\n case 38:\n case 39:\n case 40:\n case 33:\n case 34:\n case 36:\n case 35:\n event.preventDefault();\n this.buttonClick(event);\n if (this.tooltip.isVisible && this.tooltip.showOn !== 'Always' && !this.isMaterial) {\n this.closeTooltip();\n }\n break;\n }\n };\n Slider.prototype.wireButtonEvt = function (destroy) {\n if (!destroy) {\n EventHandler.add(this.firstBtn, 'mouseleave touchleave', this.buttonFocusOut, this);\n EventHandler.add(this.secondBtn, 'mouseleave touchleave', this.buttonFocusOut, this);\n EventHandler.add(this.firstBtn, 'mousedown touchstart', this.repeatHandlerMouse, this);\n EventHandler.add(this.firstBtn, 'mouseup mouseleave touchup touchend', this.repeatHandlerUp, this);\n EventHandler.add(this.secondBtn, 'mousedown touchstart', this.repeatHandlerMouse, this);\n EventHandler.add(this.secondBtn, 'mouseup mouseleave touchup touchend', this.repeatHandlerUp, this);\n EventHandler.add(this.firstBtn, 'focusout', this.sliderFocusOut, this);\n EventHandler.add(this.secondBtn, 'focusout', this.sliderFocusOut, this);\n }\n else {\n EventHandler.remove(this.firstBtn, 'mouseleave touchleave', this.buttonFocusOut);\n EventHandler.remove(this.secondBtn, 'mouseleave touchleave', this.buttonFocusOut);\n EventHandler.remove(this.firstBtn, 'mousedown touchstart', this.repeatHandlerMouse);\n EventHandler.remove(this.firstBtn, 'mouseup mouseleave touchup touchend', this.repeatHandlerUp);\n EventHandler.remove(this.secondBtn, 'mousedown touchstart', this.repeatHandlerMouse);\n EventHandler.remove(this.secondBtn, 'mouseup mouseleave touchup touchend', this.repeatHandlerUp);\n EventHandler.remove(this.firstBtn, 'focusout', this.sliderFocusOut);\n EventHandler.remove(this.secondBtn, 'focusout', this.sliderFocusOut);\n }\n };\n Slider.prototype.wireEvents = function () {\n this.onresize = this.onResize.bind(this);\n window.addEventListener('resize', this.onresize);\n if (this.enabled && !this.readonly) {\n EventHandler.add(this.element, 'mousedown touchstart', this.sliderDown, this);\n EventHandler.add(this.sliderContainer, 'keydown', this.keyDown, this);\n EventHandler.add(this.sliderContainer, 'keyup', this.keyUp, this);\n EventHandler.add(this.element, 'focusout', this.sliderFocusOut, this);\n EventHandler.add(this.sliderContainer, 'mouseover mouseout touchstart touchend', this.hover, this);\n this.wireFirstHandleEvt(false);\n if (this.type === 'Range') {\n this.wireSecondHandleEvt(false);\n }\n if (this.showButtons) {\n this.wireButtonEvt(false);\n }\n this.wireMaterialTooltipEvent(false);\n }\n };\n Slider.prototype.unwireEvents = function () {\n EventHandler.remove(this.element, 'mousedown touchstart', this.sliderDown);\n EventHandler.remove(this.sliderContainer, 'keydown', this.keyDown);\n EventHandler.remove(this.sliderContainer, 'keyup', this.keyUp);\n EventHandler.remove(this.element, 'focusout', this.sliderFocusOut);\n EventHandler.remove(this.sliderContainer, 'mouseover mouseout touchstart touchend', this.hover);\n this.wireFirstHandleEvt(true);\n if (this.type === 'Range') {\n this.wireSecondHandleEvt(true);\n }\n if (this.showButtons) {\n this.wireButtonEvt(true);\n }\n this.wireMaterialTooltipEvent(true);\n };\n Slider.prototype.keyUp = function (event) {\n if (event.keyCode === 9 && event.target.classList.contains(classNames.sliderHandle)) {\n this.focusSliderElement();\n if (!event.target.classList.contains(classNames.sliderTabHandle)) {\n if (this.element.querySelector('.' + classNames.sliderTabHandle)) {\n this.element.querySelector('.' + classNames.sliderTabHandle).classList.remove(classNames.sliderTabHandle);\n }\n event.target.classList.add(classNames.sliderTabHandle);\n var parentElement = event.target.parentElement;\n if (parentElement === this.element) {\n parentElement.querySelector('.' + classNames.sliderTrack).classList.add(classNames.sliderTabTrack);\n if (this.type === 'Range' || this.type === 'MinRange') {\n parentElement.querySelector('.' + classNames.rangeBar).classList.add(classNames.sliderTabRange);\n }\n }\n if (this.type === 'Range') {\n (event.target.previousSibling).classList.contains(classNames.sliderHandle) ?\n this.activeHandle = 2 : this.activeHandle = 1;\n }\n this.getHandle().focus();\n this.tooltipAnimation();\n if (this.tooltip.isVisible && this.tooltip.showOn !== 'Always' && !this.isMaterial) {\n this.closeTooltip();\n }\n }\n }\n this.changeEvent('changed');\n };\n Slider.prototype.hover = function (event) {\n if (!isNullOrUndefined(event)) {\n if (event.type === 'mouseover' || event.type === 'touchmove' || event.type === 'mousemove' ||\n event.type === 'pointermove' || event.type === 'touchstart') {\n this.sliderContainer.classList.add(classNames.sliderHover);\n }\n else {\n this.sliderContainer.classList.remove(classNames.sliderHover);\n }\n }\n };\n Slider.prototype.sliderFocusOut = function (event) {\n var _this = this;\n if (event.relatedTarget !== this.secondHandle && event.relatedTarget !== this.firstHandle &&\n event.relatedTarget !== this.element && event.relatedTarget !== this.firstBtn && event.relatedTarget !== this.secondBtn) {\n if (this.isMaterial && this.tooltip.isVisible) {\n var transformProperties_1 = this.getTooltipTransformProperties(this.previousTooltipClass);\n var tooltipElement = this.type !== 'Range' ? [this.firstTooltipElement] :\n [this.firstTooltipElement, this.secondTooltipElement];\n var hiddenHandle_1 = this.type !== 'Range' ? [this.firstHandle] : [this.firstHandle, this.secondHandle];\n var handle_1 = this.type !== 'Range' ? [this.firstMaterialHandle] :\n [this.firstMaterialHandle, this.secondMaterialHandle];\n tooltipElement.forEach(function (tooltipElement, index) {\n if (tooltipElement) {\n tooltipElement.style.transition = _this.scaleTransform;\n tooltipElement.firstChild.classList.remove(classNames.materialTooltipShow);\n tooltipElement.firstChild.classList.add(classNames.materialTooltipHide);\n hiddenHandle_1[index].style.cursor = '-webkit-grab';\n hiddenHandle_1[index].style.cursor = 'grab';\n handle_1[index].style.transform = 'scale(1)';\n tooltipElement.classList.remove(classNames.materialTooltipOpen);\n if (tooltipElement.firstElementChild.innerText.length > 4) {\n tooltipElement.style.transform = transformProperties_1.translate + ' ' + 'scale(0.01)';\n }\n else {\n tooltipElement.style.transform = transformProperties_1.translate + ' ' +\n transformProperties_1.rotate + ' ' + 'scale(0.01)';\n }\n setTimeout(function () { tooltipElement.style.transition = 'none'; }, 2500);\n }\n });\n }\n if (this.element.querySelector('.' + classNames.sliderTabHandle)) {\n this.element.querySelector('.' + classNames.sliderTabHandle).classList.remove(classNames.sliderTabHandle);\n }\n if (this.element.querySelector('.' + classNames.sliderTabTrack)) {\n this.element.querySelector('.' + classNames.sliderTabTrack).classList.remove(classNames.sliderTabTrack);\n if ((this.type === 'Range' || this.type === 'MinRange') &&\n this.element.querySelector('.' + classNames.sliderTabRange)) {\n this.element.querySelector('.' + classNames.sliderTabRange).classList.remove(classNames.sliderTabRange);\n }\n }\n this.hiddenInput.focus();\n this.hiddenInput.blur();\n this.isElementFocused = false;\n }\n };\n Slider.prototype.closeTooltip = function () {\n if (this.tooltip.isVisible) {\n this.tooltipValue();\n if (this.activeHandle === 1) {\n this.firstTooltipObj.close();\n }\n else {\n this.secondTooltipObj.close();\n }\n }\n };\n Slider.prototype.removeElement = function (element) {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n }\n };\n Slider.prototype.changeSliderType = function (type) {\n if (this.isMaterial && this.firstMaterialHandle) {\n this.sliderContainer.classList.remove(classNames.materialSlider);\n this.removeElement(this.firstMaterialHandle);\n this.firstTooltipElement = undefined;\n this.firstHandleTooltipPosition = undefined;\n if (this.secondMaterialHandle) {\n this.removeElement(this.secondMaterialHandle);\n this.secondTooltipElement = undefined;\n this.secondHandleTooltipPosition = undefined;\n }\n }\n if (this.tooltip.isVisible && this.isMaterial) {\n this.sliderContainer.classList.add(classNames.materialSlider);\n }\n this.removeElement(this.firstHandle);\n if (type !== 'Default') {\n if (type === 'Range') {\n this.removeElement(this.secondHandle);\n }\n this.removeElement(this.rangeBar);\n }\n if (this.tooltip.isVisible && !isNullOrUndefined(this.firstTooltipObj)) {\n this.firstTooltipObj.destroy();\n if (type === 'Range' && !isNullOrUndefined(this.secondTooltipObj)) {\n this.secondTooltipObj.destroy();\n }\n }\n if (this.limits.enabled && type === 'MinRange' || type === 'Default') {\n if (!isNullOrUndefined(this.limitBarFirst)) {\n this.removeElement(this.limitBarFirst);\n }\n }\n if (type === 'Range') {\n if (this.limits.enabled) {\n if (!isNullOrUndefined(this.limitBarFirst) && !isNullOrUndefined(this.limitBarSecond)) {\n this.removeElement(this.limitBarFirst);\n this.removeElement(this.limitBarSecond);\n }\n }\n }\n this.createRangeBar();\n if (this.limits.enabled) {\n this.createLimitBar();\n }\n this.setHandler();\n this.setOrientClass();\n this.wireFirstHandleEvt(false);\n if (this.type === 'Range') {\n this.wireSecondHandleEvt(false);\n }\n this.setValue();\n if (this.tooltip.isVisible) {\n this.renderTooltip();\n this.wireMaterialTooltipEvent(false);\n }\n this.updateConfig();\n };\n Slider.prototype.changeRtl = function () {\n if (!this.enableRtl && this.type === 'Range') {\n this.value = [this.handleVal2, this.handleVal1];\n }\n this.updateConfig();\n if (this.tooltip.isVisible) {\n this.firstTooltipObj.refresh(this.firstHandle);\n if (this.type === 'Range') {\n this.secondTooltipObj.refresh(this.secondHandle);\n }\n }\n if (this.showButtons) {\n var enabledRTL = this.enableRtl && this.orientation !== 'Vertical';\n attributes(enabledRTL ? this.secondBtn : this.firstBtn, { 'aria-label': 'Decrease', title: 'Decrease' });\n attributes(enabledRTL ? this.firstBtn : this.secondBtn, { 'aria-label': 'Increase', title: 'Increase' });\n }\n };\n Slider.prototype.changeOrientation = function () {\n this.changeSliderType(this.type);\n };\n Slider.prototype.updateConfig = function () {\n this.setEnableRTL();\n this.setValue();\n if (this.tooltip.isVisible) {\n this.refreshTooltip();\n }\n if (this.ticks.placement !== 'None') {\n if (this.ul) {\n this.removeElement(this.ul);\n this.renderScale();\n }\n }\n this.limitsPropertyChange();\n };\n Slider.prototype.limitsPropertyChange = function () {\n if (this.limits.enabled) {\n if (isNullOrUndefined(this.limitBarFirst) && this.type !== 'Range') {\n this.createLimitBar();\n }\n if (isNullOrUndefined(this.limitBarFirst) && isNullOrUndefined(this.limitBarSecond) && this.type === 'Range') {\n this.createLimitBar();\n }\n this.setLimitBar();\n this.setValue();\n }\n else {\n if (!isNullOrUndefined(this.limitBarFirst)) {\n detach(this.limitBarFirst);\n }\n if (!isNullOrUndefined(this.limitBarSecond)) {\n detach(this.limitBarSecond);\n }\n }\n };\n /**\n * Get the properties to be maintained in the persisted state.\n * @private\n */\n Slider.prototype.getPersistData = function () {\n var keyEntity = ['value'];\n return this.addOnPersist(keyEntity);\n };\n /**\n * Prepares the slider for safe removal from the DOM.\n * Detaches all event handlers, attributes, and classes to avoid memory leaks.\n * @method destroy\n * @return {void}\n */\n Slider.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.unwireEvents();\n window.removeEventListener('resize', this.onresize);\n removeClass([this.sliderContainer], [classNames.sliderDisabled]);\n this.firstHandle.removeAttribute('aria-orientation');\n if (this.type === 'Range') {\n this.secondHandle.removeAttribute('aria-orientation');\n }\n this.sliderContainer.parentNode.insertBefore(this.element, this.sliderContainer);\n detach(this.sliderContainer);\n if (this.tooltip.isVisible) {\n this.firstTooltipObj.destroy();\n if (this.type === 'Range' && !isNullOrUndefined(this.secondTooltipObj)) {\n this.secondTooltipObj.destroy();\n }\n }\n this.element.innerHTML = '';\n };\n /**\n * Calls internally if any of the property value is changed.\n * @private\n */\n Slider.prototype.onPropertyChanged = function (newProp, oldProp) {\n var _this = this;\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'cssClass':\n this.setCSSClass(oldProp.cssClass);\n break;\n case 'value':\n if (!isNullOrUndefined(oldProp.value) && !isNullOrUndefined(newProp.value)) {\n if (oldProp.value.toString() !== newProp.value.toString()) {\n this.setValue();\n this.refreshTooltip();\n if (this.type === 'Range') {\n if (oldProp.value[0] === newProp.value[0]) {\n this.activeHandle = 2;\n }\n else {\n this.activeHandle = 1;\n }\n }\n }\n }\n break;\n case 'min':\n case 'step':\n case 'max':\n this.setMinMaxValue();\n break;\n case 'tooltip':\n if (!isNullOrUndefined(newProp.tooltip) && !isNullOrUndefined(oldProp.tooltip)) {\n this.setTooltip();\n }\n break;\n case 'type':\n this.changeSliderType(oldProp.type);\n this.setZindex();\n break;\n case 'enableRtl':\n if (oldProp.enableRtl !== newProp.enableRtl && this.orientation !== 'Vertical') {\n this.rtl = oldProp.enableRtl;\n this.changeRtl();\n }\n break;\n case 'limits':\n this.limitsPropertyChange();\n break;\n case 'orientation':\n this.changeOrientation();\n break;\n case 'ticks':\n if (!isNullOrUndefined(this.sliderContainer.querySelector('.' + classNames.scale))) {\n detach(this.ul);\n Array.prototype.forEach.call(this.sliderContainer.classList, function (className) {\n if (className.match(/e-scale-/)) {\n _this.sliderContainer.classList.remove(className);\n }\n });\n }\n if (this.ticks.placement !== 'None') {\n this.renderScale();\n this.setZindex();\n }\n break;\n case 'locale':\n if (this.showButtons) {\n this.buttonTitle();\n }\n break;\n case 'showButtons':\n if (newProp.showButtons) {\n this.setButtons();\n this.onResize();\n if (this.enabled && !this.readonly) {\n this.wireButtonEvt(false);\n }\n }\n else {\n if (this.firstBtn && this.secondBtn) {\n this.sliderContainer.removeChild(this.firstBtn);\n this.sliderContainer.removeChild(this.secondBtn);\n this.firstBtn = undefined;\n this.secondBtn = undefined;\n }\n }\n break;\n case 'enabled':\n this.setEnabled();\n break;\n case 'readonly':\n this.setReadOnly();\n break;\n case 'customValue':\n this.setValue();\n this.onResize();\n break;\n }\n }\n };\n Slider.prototype.setReadOnly = function () {\n if (this.readonly) {\n this.unwireEvents();\n this.sliderContainer.classList.add(classNames.readonly);\n }\n else {\n this.wireEvents();\n this.sliderContainer.classList.remove(classNames.readonly);\n }\n };\n Slider.prototype.setMinMaxValue = function () {\n var _this = this;\n this.setValue();\n this.refreshTooltip();\n if (!isNullOrUndefined(this.sliderContainer.querySelector('.' + classNames.scale))) {\n if (this.ul) {\n detach(this.ul);\n Array.prototype.forEach.call(this.sliderContainer.classList, function (className) {\n if (className.match(/e-scale-/)) {\n _this.sliderContainer.classList.remove(className);\n }\n });\n }\n }\n if (this.ticks.placement !== 'None') {\n this.renderScale();\n this.setZindex();\n }\n };\n Slider.prototype.setZindex = function () {\n this.zIndex = 6;\n if (!isNullOrUndefined(this.ticks) && this.ticks.placement !== 'None') {\n this.ul.style.zIndex = (this.zIndex + -7) + '';\n this.element.style.zIndex = (this.zIndex + 2) + '';\n }\n if (!this.isMaterial && !isNullOrUndefined(this.ticks) && this.ticks.placement === 'Both') {\n this.element.style.zIndex = (this.zIndex + 2) + '';\n }\n this.firstHandle.style.zIndex = (this.zIndex + 3) + '';\n if (this.type === 'Range') {\n this.secondHandle.style.zIndex = (this.zIndex + 4) + '';\n }\n };\n Slider.prototype.setTooltip = function () {\n this.changeSliderType(this.type);\n };\n /**\n * Gets the component name\n * @private\n */\n Slider.prototype.getModuleName = function () {\n return 'slider';\n };\n __decorate([\n Property(null)\n ], Slider.prototype, \"value\", void 0);\n __decorate([\n Property(null)\n ], Slider.prototype, \"customValues\", void 0);\n __decorate([\n Property(1)\n ], Slider.prototype, \"step\", void 0);\n __decorate([\n Property(0)\n ], Slider.prototype, \"min\", void 0);\n __decorate([\n Property(100)\n ], Slider.prototype, \"max\", void 0);\n __decorate([\n Property(false)\n ], Slider.prototype, \"readonly\", void 0);\n __decorate([\n Property('Default')\n ], Slider.prototype, \"type\", void 0);\n __decorate([\n Complex({}, TicksData)\n ], Slider.prototype, \"ticks\", void 0);\n __decorate([\n Complex({}, LimitData)\n ], Slider.prototype, \"limits\", void 0);\n __decorate([\n Property(true)\n ], Slider.prototype, \"enabled\", void 0);\n __decorate([\n Property(false)\n ], Slider.prototype, \"enableRtl\", void 0);\n __decorate([\n Complex({}, TooltipData)\n ], Slider.prototype, \"tooltip\", void 0);\n __decorate([\n Property(false)\n ], Slider.prototype, \"showButtons\", void 0);\n __decorate([\n Property(true)\n ], Slider.prototype, \"enableAnimation\", void 0);\n __decorate([\n Property('Horizontal')\n ], Slider.prototype, \"orientation\", void 0);\n __decorate([\n Property('')\n ], Slider.prototype, \"cssClass\", void 0);\n __decorate([\n Event()\n ], Slider.prototype, \"created\", void 0);\n __decorate([\n Event()\n ], Slider.prototype, \"change\", void 0);\n __decorate([\n Event()\n ], Slider.prototype, \"changed\", void 0);\n __decorate([\n Event()\n ], Slider.prototype, \"renderingTicks\", void 0);\n __decorate([\n Event()\n ], Slider.prototype, \"renderedTicks\", void 0);\n __decorate([\n Event()\n ], Slider.prototype, \"tooltipChange\", void 0);\n Slider = __decorate([\n NotifyPropertyChanges\n ], Slider);\n return Slider;\n}(Component));\nexport { Slider };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, Property, Event, EventHandler, L10n, compile, isNullOrUndefined } from '@syncfusion/ej2-base';\nimport { NotifyPropertyChanges, createElement, detach, append, Animation } from '@syncfusion/ej2-base';\nimport { addClass, removeClass, KeyboardEvents, setValue, getValue, ChildProperty } from '@syncfusion/ej2-base';\nimport { Collection, Complex, Browser, Ajax } from '@syncfusion/ej2-base';\nimport { createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';\nvar ROOT = 'e-uploader';\nvar CONTROL_WRAPPER = 'e-upload';\nvar INPUT_WRAPPER = 'e-file-select';\nvar DROP_AREA = 'e-file-drop';\nvar DROP_WRAPPER = 'e-file-select-wrap';\nvar LIST_PARENT = 'e-upload-files';\nvar FILE = 'e-upload-file-list';\nvar STATUS = 'e-file-status';\nvar ACTION_BUTTONS = 'e-upload-actions';\nvar UPLOAD_BUTTONS = 'e-file-upload-btn e-css e-btn e-flat e-primary';\nvar CLEAR_BUTTONS = 'e-file-clear-btn e-css e-btn e-flat';\nvar FILE_NAME = 'e-file-name';\nvar FILE_TYPE = 'e-file-type';\nvar FILE_SIZE = 'e-file-size';\nvar CLEAR_ICON = 'e-file-remove-btn';\nvar REMOVE_ICON = 'e-file-delete-btn';\nvar ABORT_ICON = 'e-file-abort-btn';\nvar RETRY_ICON = 'e-file-reload-btn';\nvar DRAG_HOVER = 'e-upload-drag-hover';\nvar PROGRESS_WRAPPER = 'e-upload-progress-wrap';\nvar PROGRESSBAR = 'e-upload-progress-bar';\nvar PROGRESSBAR_TEXT = 'e-progress-bar-text';\nvar UPLOAD_INPROGRESS = 'e-upload-progress';\nvar UPLOAD_SUCCESS = 'e-upload-success';\nvar UPLOAD_FAILED = 'e-upload-fails';\nvar TEXT_CONTAINER = 'e-file-container';\nvar VALIDATION_FAILS = 'e-validation-fails';\nvar RTL = 'e-rtl';\nvar DISABLED = 'e-disabled';\nvar RTL_CONTAINER = 'e-rtl-container';\nvar ICON_FOCUSED = 'e-clear-icon-focus';\nvar PROGRESS_INNER_WRAPPER = 'e-progress-inner-wrap';\nvar PAUSE_UPLOAD = 'e-file-pause-btn';\nvar RESUME_UPLOAD = 'e-file-play-btn';\nvar FilesProp = /** @class */ (function (_super) {\n __extends(FilesProp, _super);\n function FilesProp() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('')\n ], FilesProp.prototype, \"name\", void 0);\n __decorate([\n Property(null)\n ], FilesProp.prototype, \"size\", void 0);\n __decorate([\n Property('')\n ], FilesProp.prototype, \"type\", void 0);\n return FilesProp;\n}(ChildProperty));\nexport { FilesProp };\nvar ButtonsProps = /** @class */ (function (_super) {\n __extends(ButtonsProps, _super);\n function ButtonsProps() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('Browse...')\n ], ButtonsProps.prototype, \"browse\", void 0);\n __decorate([\n Property('Upload')\n ], ButtonsProps.prototype, \"upload\", void 0);\n __decorate([\n Property('Clear')\n ], ButtonsProps.prototype, \"clear\", void 0);\n return ButtonsProps;\n}(ChildProperty));\nexport { ButtonsProps };\nvar AsyncSettings = /** @class */ (function (_super) {\n __extends(AsyncSettings, _super);\n function AsyncSettings() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n __decorate([\n Property('')\n ], AsyncSettings.prototype, \"saveUrl\", void 0);\n __decorate([\n Property('')\n ], AsyncSettings.prototype, \"removeUrl\", void 0);\n __decorate([\n Property(0)\n ], AsyncSettings.prototype, \"chunkSize\", void 0);\n __decorate([\n Property(3)\n ], AsyncSettings.prototype, \"retryCount\", void 0);\n __decorate([\n Property(500)\n ], AsyncSettings.prototype, \"retryAfterDelay\", void 0);\n return AsyncSettings;\n}(ChildProperty));\nexport { AsyncSettings };\n/**\n * The uploader component allows to upload images, documents, and other files from local to server.\n * ```html\n * \n * ```\n * ```typescript\n * \n * ```\n */\nvar Uploader = /** @class */ (function (_super) {\n __extends(Uploader, _super);\n /**\n * Triggers when change the Uploader value.\n */\n function Uploader(options, element) {\n var _this = _super.call(this, options, element) || this;\n _this.initialAttr = { accept: null, multiple: false, disabled: false };\n _this.fileList = [];\n _this.filesData = [];\n _this.uploadedFilesData = [];\n _this.isForm = false;\n _this.allTypes = false;\n _this.pausedData = [];\n _this.uploadMetaData = [];\n return _this;\n }\n /**\n * Calls internally if any of the property value is changed.\n * @private\n */\n Uploader.prototype.onPropertyChanged = function (newProp, oldProp) {\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'allowedExtensions':\n this.setExtensions(this.allowedExtensions);\n this.clearAll();\n break;\n case 'enabled':\n this.setControlStatus();\n break;\n case 'multiple':\n this.setMultipleSelection();\n break;\n case 'enableRtl':\n this.setRTL();\n this.reRenderFileList();\n break;\n case 'buttons':\n this.buttons.browse = isNullOrUndefined(this.buttons.browse) ? '' : this.buttons.browse;\n this.buttons.clear = isNullOrUndefined(this.buttons.clear) ? '' : this.buttons.clear;\n this.buttons.upload = isNullOrUndefined(this.buttons.upload) ? '' : this.buttons.upload;\n this.renderButtonTemplates();\n break;\n case 'dropArea':\n this.unBindDropEvents();\n this.setDropArea();\n break;\n case 'files':\n this.renderPreLoadFiles();\n break;\n case 'minFileSize':\n case 'maxFileSize':\n case 'template':\n case 'autoUpload':\n this.clearAll();\n break;\n case 'locale':\n this.l10n.setLocale(this.locale);\n this.setLocalizedTexts();\n this.preLocaleObj = getValue('currentLocale', this.l10n);\n break;\n }\n }\n };\n Uploader.prototype.setLocalizedTexts = function () {\n if (isNullOrUndefined(this.template)) {\n if (typeof (this.buttons.browse) === 'string') {\n this.browseButton.innerText = (this.buttons.browse === 'Browse...') ?\n this.localizedTexts('Browse') : this.buttons.browse;\n this.browseButton.setAttribute('title', this.browseButton.innerText);\n this.uploadWrapper.querySelector('.' + DROP_AREA).innerHTML = this.localizedTexts('dropFilesHint');\n }\n this.updateFileList();\n }\n };\n Uploader.prototype.getKeyValue = function (val) {\n var keyValue;\n for (var _i = 0, _a = Object.keys(this.preLocaleObj); _i < _a.length; _i++) {\n var key = _a[_i];\n if (this.preLocaleObj[key] === val) {\n keyValue = key;\n }\n }\n return keyValue;\n };\n Uploader.prototype.updateFileList = function () {\n var element;\n if (this.fileList.length > 0 && !isNullOrUndefined(this.uploadWrapper.querySelector('.' + LIST_PARENT))) {\n for (var i = 0; i < this.fileList.length; i++) {\n element = this.fileList[i].querySelector('.e-file-status');\n element.innerHTML = this.localizedTexts(this.getKeyValue(this.filesData[i].status));\n this.filesData[i].status = this.localizedTexts(this.getKeyValue(this.filesData[i].status));\n /* istanbul ignore next */\n if (this.fileList[i].classList.contains(UPLOAD_SUCCESS)) {\n this.fileList[i].querySelector('.e-icons').setAttribute('title', this.localizedTexts('remove'));\n }\n else {\n this.fileList[i].querySelector('.e-icons').setAttribute('title', this.localizedTexts('delete'));\n }\n if (!this.autoUpload) {\n this.uploadButton.innerText = (this.buttons.upload === 'Upload') ?\n this.localizedTexts('Upload') : this.buttons.upload;\n this.clearButton.innerText = (this.buttons.clear === 'Clear') ?\n this.localizedTexts('Clear') : this.buttons.clear;\n }\n }\n }\n };\n Uploader.prototype.reRenderFileList = function () {\n if (this.listParent) {\n detach(this.listParent);\n this.listParent = null;\n this.fileList = [];\n this.createFileList(this.filesData);\n if (this.actionButtons) {\n this.removeActionButtons();\n this.renderActionButtons();\n this.checkActionButtonStatus();\n }\n }\n };\n Uploader.prototype.preRender = function () {\n this.cloneElement = this.element.cloneNode(true);\n this.localeText = { Browse: 'Browse...', Clear: 'Clear', Upload: 'Upload',\n dropFilesHint: 'Or drop files here', invalidMaxFileSize: 'File size is too large',\n invalidMinFileSize: 'File size is too small', invalidFileType: 'File type is not allowed',\n uploadFailedMessage: 'File failed to upload', uploadSuccessMessage: 'File uploaded successfully',\n removedSuccessMessage: 'File removed successfully', removedFailedMessage: 'Unable to remove file', inProgress: 'Uploading',\n readyToUploadMessage: 'Ready to upload', abort: 'Abort', remove: 'Remove', cancel: 'Cancel', delete: 'Delete file',\n pauseUpload: 'File upload paused', pause: 'Pause', resume: 'Resume', retry: 'Retry',\n fileUploadCancel: 'File upload canceled'\n };\n this.l10n = new L10n('uploader', this.localeText, this.locale);\n this.preLocaleObj = getValue('currentLocale', this.l10n);\n this.checkHTMLAttributes();\n if (this.asyncSettings.saveUrl === '' && this.asyncSettings.removeUrl === '' && !this.autoUpload) {\n var parentEle = this.element.parentElement;\n for (; parentEle && parentEle !== document.documentElement; parentEle = parentEle.parentElement) {\n if (parentEle.tagName === 'FORM') {\n this.isForm = true;\n this.formElement = parentEle;\n parentEle.setAttribute('enctype', 'multipart/form-data');\n parentEle.setAttribute('encoding', 'multipart/form-data');\n }\n }\n }\n // tslint:disable-next-line\n var ejInstance = getValue('ej2_instances', this.element);\n /* istanbul ignore next */\n if (this.element.tagName === 'EJS-UPLOADER') {\n var inputElement = createElement('input', { attrs: { type: 'file' } });\n var index = 0;\n for (index; index < this.element.attributes.length; index++) {\n inputElement.setAttribute(this.element.attributes[index].nodeName, this.element.attributes[index].nodeValue);\n inputElement.innerHTML = this.element.innerHTML;\n }\n if (!inputElement.hasAttribute('name')) {\n inputElement.setAttribute('name', 'UploadFiles');\n }\n this.element.appendChild(inputElement);\n this.element = inputElement;\n setValue('ej2_instances', ejInstance, this.element);\n }\n /* istanbul ignore next */\n if (ejInstance[0].isPureReactComponent) {\n if (!isNullOrUndefined(ejInstance[0].props.name)) {\n this.element.setAttribute('name', ejInstance[0].props.name);\n }\n else if (!isNullOrUndefined(ejInstance[0].props.id) && isNullOrUndefined(ejInstance[0].props.name)) {\n this.element.setAttribute('name', ejInstance[0].props.id);\n }\n else {\n this.element.setAttribute('name', 'UploadFiles');\n }\n }\n if (isNullOrUndefined(this.element.getAttribute('name'))) {\n this.element.setAttribute('name', this.element.getAttribute('id'));\n }\n if (!this.element.hasAttribute('type')) {\n this.element.setAttribute('type', 'file');\n }\n this.keyConfigs = {\n previous: 'shift+tab',\n enter: 'enter',\n next: 'tab'\n };\n };\n Uploader.prototype.getPersistData = function () {\n return this.addOnPersist([]);\n };\n /**\n * Return the module name of the component.\n */\n Uploader.prototype.getModuleName = function () {\n return 'uploader';\n };\n /**\n * To Initialize the control rendering\n * @private\n */\n Uploader.prototype.render = function () {\n this.renderBrowseButton();\n this.initializeUpload();\n this.wireEvents();\n this.setMultipleSelection();\n this.setExtensions(this.allowedExtensions);\n this.setRTL();\n this.renderPreLoadFiles();\n this.setControlStatus();\n };\n Uploader.prototype.renderBrowseButton = function () {\n this.browseButton = createElement('button', { className: 'e-css e-btn', attrs: { 'type': 'button' } });\n if (typeof (this.buttons.browse) === 'string') {\n this.browseButton.innerText = (this.buttons.browse === 'Browse...') ?\n this.localizedTexts('Browse') : this.buttons.browse;\n this.browseButton.setAttribute('title', this.browseButton.innerText);\n }\n else {\n this.browseButton.appendChild(this.buttons.browse);\n }\n this.element.setAttribute('aria-label', 'Uploader');\n };\n Uploader.prototype.renderActionButtons = function () {\n this.element.setAttribute('tabindex', '-1');\n this.actionButtons = createElement('div', { className: ACTION_BUTTONS });\n this.uploadButton = createElement('button', { className: UPLOAD_BUTTONS, attrs: { 'type': 'button', 'tabindex': '-1' } });\n this.clearButton = createElement('button', { className: CLEAR_BUTTONS, attrs: { 'type': 'button', 'tabindex': '-1' } });\n this.actionButtons.appendChild(this.clearButton);\n this.actionButtons.appendChild(this.uploadButton);\n this.renderButtonTemplates();\n this.uploadWrapper.appendChild(this.actionButtons);\n this.browseButton.blur();\n this.uploadButton.focus();\n this.wireActionButtonEvents();\n };\n Uploader.prototype.wireActionButtonEvents = function () {\n EventHandler.add(this.uploadButton, 'click', this.uploadButtonClick, this);\n EventHandler.add(this.clearButton, 'click', this.clearButtonClick, this);\n };\n Uploader.prototype.unwireActionButtonEvents = function () {\n EventHandler.remove(this.uploadButton, 'click', this.uploadButtonClick);\n EventHandler.remove(this.clearButton, 'click', this.clearButtonClick);\n };\n Uploader.prototype.removeActionButtons = function () {\n if (this.actionButtons) {\n this.unwireActionButtonEvents();\n detach(this.actionButtons);\n this.actionButtons = null;\n }\n };\n Uploader.prototype.renderButtonTemplates = function () {\n if (typeof (this.buttons.browse) === 'string') {\n this.browseButton.innerText = (this.buttons.browse === 'Browse...') ?\n this.localizedTexts('Browse') : this.buttons.browse;\n this.browseButton.setAttribute('title', this.browseButton.innerText);\n }\n else {\n this.browseButton.innerHTML = '';\n this.browseButton.appendChild(this.buttons.browse);\n }\n if (this.uploadButton) {\n var uploadText = void 0;\n uploadText = isNullOrUndefined(this.buttons.upload) ? 'Upload' : this.buttons.upload;\n this.buttons.upload = uploadText;\n if (typeof (this.buttons.upload) === 'string') {\n this.uploadButton.innerText = (this.buttons.upload === 'Upload') ?\n this.localizedTexts('Upload') : this.buttons.upload;\n this.uploadButton.setAttribute('title', this.uploadButton.innerText);\n }\n else {\n this.uploadButton.innerHTML = '';\n this.uploadButton.appendChild(this.buttons.upload);\n }\n }\n if (this.clearButton) {\n var clearText = void 0;\n clearText = isNullOrUndefined(this.buttons.clear) ? 'Clear' : this.buttons.clear;\n this.buttons.clear = clearText;\n if (typeof (this.buttons.clear) === 'string') {\n this.clearButton.innerText = (this.buttons.clear === 'Clear') ?\n this.localizedTexts('Clear') : this.buttons.clear;\n this.clearButton.setAttribute('title', this.clearButton.innerText);\n }\n else {\n this.clearButton.innerHTML = '';\n this.clearButton.appendChild(this.buttons.clear);\n }\n }\n };\n Uploader.prototype.initializeUpload = function () {\n this.element.setAttribute('tabindex', '-1');\n var inputWrapper = createElement('span', { className: INPUT_WRAPPER });\n this.element.parentElement.insertBefore(inputWrapper, this.element);\n this.dropAreaWrapper = createElement('div', { className: DROP_WRAPPER });\n this.element.parentElement.insertBefore(this.dropAreaWrapper, this.element);\n inputWrapper.appendChild(this.element);\n this.dropAreaWrapper.appendChild(this.browseButton);\n this.dropAreaWrapper.appendChild(inputWrapper);\n var fileDropArea = createElement('span', { className: DROP_AREA });\n fileDropArea.innerHTML = this.localizedTexts('dropFilesHint');\n this.dropAreaWrapper.appendChild(fileDropArea);\n this.uploadWrapper = createElement('div', { className: CONTROL_WRAPPER, attrs: { 'aria-activedescendant': 'li-focused' } });\n this.dropAreaWrapper.parentElement.insertBefore(this.uploadWrapper, this.dropAreaWrapper);\n this.uploadWrapper.appendChild(this.dropAreaWrapper);\n this.setDropArea();\n };\n Uploader.prototype.renderPreLoadFiles = function () {\n if (isNullOrUndefined(this.files[0].size) || !isNullOrUndefined(this.template)) {\n return;\n }\n var files = [].slice.call(this.files);\n var filesData = [];\n if (!this.multiple) {\n this.clearData();\n files = [files[0]];\n }\n for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {\n var data = files_1[_i];\n var fileData = {\n name: data.name + '.' + data.type.split('.')[data.type.split('.').length - 1],\n rawFile: '',\n size: data.size,\n status: this.localizedTexts('uploadSuccessMessage'),\n type: data.type,\n validationMessages: { minSize: '', maxSize: '' },\n statusCode: '2'\n };\n filesData.push(fileData);\n this.filesData.push(fileData);\n }\n this.createFileList(filesData);\n if (!this.autoUpload && this.listParent && !this.actionButtons && !this.isForm && this.showFileList) {\n this.renderActionButtons();\n }\n this.checkActionButtonStatus();\n };\n Uploader.prototype.checkActionButtonStatus = function () {\n if (this.actionButtons) {\n var length_1 = this.uploadWrapper.querySelectorAll('.' + VALIDATION_FAILS).length +\n this.uploadWrapper.querySelectorAll('.e-upload-fails:not(.e-upload-progress)').length +\n this.uploadWrapper.querySelectorAll('span.' + UPLOAD_SUCCESS).length +\n this.uploadWrapper.querySelectorAll('span.' + UPLOAD_INPROGRESS).length;\n if (length_1 > 0 && length_1 === this.uploadWrapper.querySelectorAll('li').length) {\n this.uploadButton.setAttribute('disabled', 'disabled');\n }\n else {\n this.uploadButton.removeAttribute('disabled');\n }\n }\n };\n Uploader.prototype.setDropArea = function () {\n var dropTextArea = this.dropAreaWrapper.querySelector('.e-file-drop');\n if (this.dropArea) {\n this.dropZoneElement = (typeof (this.dropArea) !== 'string') ? this.dropArea :\n document.querySelector(this.dropArea);\n var element = this.element;\n var enableDropText = false;\n while (element.parentNode) {\n element = element.parentNode;\n if (element === this.dropZoneElement) {\n enableDropText = true;\n dropTextArea.textContent = this.localizedTexts('dropFilesHint');\n }\n }\n if (!enableDropText) {\n dropTextArea.textContent = '';\n }\n }\n else {\n this.dropZoneElement = this.uploadWrapper;\n dropTextArea.textContent = this.localizedTexts('dropFilesHint');\n }\n this.bindDropEvents();\n };\n Uploader.prototype.setMultipleSelection = function () {\n if (this.multiple && !this.element.hasAttribute('multiple')) {\n var newAttr = document.createAttribute('multiple');\n this.element.setAttributeNode(newAttr);\n }\n else if (!this.multiple) {\n this.element.removeAttribute('multiple');\n }\n };\n Uploader.prototype.checkAutoUpload = function (fileData) {\n if (this.autoUpload) {\n this.upload(fileData);\n this.removeActionButtons();\n }\n else if (!this.actionButtons) {\n this.renderActionButtons();\n }\n this.checkActionButtonStatus();\n };\n Uploader.prototype.wireEvents = function () {\n EventHandler.add(this.browseButton, 'click', this.browseButtonClick, this);\n EventHandler.add(this.element, 'change', this.onSelectFiles, this);\n EventHandler.add(document, 'click', this.removeFocus, this);\n this.keyboardModule = new KeyboardEvents(this.uploadWrapper, {\n keyAction: this.keyActionHandler.bind(this),\n keyConfigs: this.keyConfigs,\n eventName: 'keydown',\n });\n if (this.isForm) {\n EventHandler.add(this.formElement, 'reset', this.resetForm, this);\n }\n };\n Uploader.prototype.unWireEvents = function () {\n EventHandler.remove(this.browseButton, 'click', this.browseButtonClick);\n EventHandler.remove(this.element, 'change', this.onSelectFiles);\n EventHandler.remove(document, 'click', this.removeFocus);\n this.keyboardModule.destroy();\n };\n Uploader.prototype.resetForm = function () {\n this.clearAll();\n };\n Uploader.prototype.keyActionHandler = function (e) {\n var targetElement = e.target;\n switch (e.action) {\n case 'next':\n if (e.target === this.browseButton && isNullOrUndefined(this.listParent)) {\n this.browseButton.blur();\n }\n else if (e.target === this.uploadButton) {\n this.uploadButton.blur();\n }\n else {\n this.setTabFocus(e);\n e.preventDefault();\n e.stopPropagation();\n if (e.target === this.clearButton && this.uploadButton.hasAttribute('disabled')) {\n this.clearButton.blur();\n }\n }\n break;\n case 'previous':\n if (e.target === this.browseButton) {\n this.browseButton.blur();\n }\n else {\n this.setReverseFocus(e);\n e.preventDefault();\n e.stopPropagation();\n }\n break;\n case 'enter':\n if (e.target === this.clearButton) {\n this.clearButtonClick();\n }\n else if (e.target === this.uploadButton) {\n this.uploadButtonClick();\n }\n else if (e.target === this.browseButton) {\n this.browseButtonClick();\n }\n else if (targetElement.classList.contains(PAUSE_UPLOAD)) {\n var metaData = this.getCurrentMetaData(null, e);\n metaData.file.statusCode = '4';\n metaData.file.status = this.localizedTexts('pauseUpload');\n this.abortUpload(metaData, false);\n }\n else if (targetElement.classList.contains(RESUME_UPLOAD)) {\n this.resumeUpload(this.getCurrentMetaData(null, e), e);\n }\n else if (targetElement.classList.contains(RETRY_ICON)) {\n var metaData = this.getCurrentMetaData(null, e);\n metaData.file.statusCode = '1';\n metaData.file.status = this.localizedTexts('readyToUploadMessage');\n this.chunkUpload(metaData.file);\n }\n else {\n this.removeFiles(e);\n if (!targetElement.classList.contains(ABORT_ICON)) {\n this.browseButton.focus();\n }\n }\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n };\n Uploader.prototype.getCurrentMetaData = function (fileInfo, e) {\n var fileData;\n var targetMetaData;\n if (isNullOrUndefined(fileInfo)) {\n var target = this.uploadWrapper.querySelector('.' + ICON_FOCUSED).parentElement;\n fileData = this.filesData[this.fileList.indexOf(target)];\n }\n else {\n fileData = fileInfo;\n }\n for (var i = 0; i < this.uploadMetaData.length; i++) {\n if (this.uploadMetaData[i].file.name === fileData.name) {\n targetMetaData = this.uploadMetaData[i];\n }\n }\n return targetMetaData;\n };\n Uploader.prototype.setReverseFocus = function (e) {\n var target = e.target;\n if (target === this.uploadButton) {\n this.uploadButton.blur();\n this.clearButton.focus();\n }\n else if (target === this.clearButton && this.listParent && this.listParent.querySelector('.e-icons')) {\n this.clearButton.blur();\n var items = [].slice.call(this.listParent.querySelectorAll('span.e-icons'));\n items[items.length - 1].classList.add(ICON_FOCUSED);\n items[items.length - 1].focus();\n }\n else {\n var iconElements = [].slice.call(this.listParent.querySelectorAll('span.e-icons'));\n var index = iconElements.indexOf(target);\n if (index > 0) {\n this.removeFocus();\n iconElements[index - 1].classList.add(ICON_FOCUSED);\n iconElements[index - 1].focus();\n }\n else {\n this.removeFocus();\n this.browseButton.focus();\n }\n }\n };\n Uploader.prototype.setTabFocus = function (e) {\n var target = e.target;\n if (target === this.clearButton) {\n this.removeFocus();\n if (this.uploadButton.hasAttribute('disabled')) {\n return;\n }\n this.uploadButton.focus();\n }\n else if (target.classList.contains('e-icons')) {\n var iconElements = [].slice.call(this.listParent.querySelectorAll('span.e-icons'));\n var index = iconElements.indexOf(target);\n if (index < (iconElements.length - 1)) {\n this.removeFocus();\n iconElements[index + 1].classList.add(ICON_FOCUSED);\n iconElements[index + 1].focus();\n }\n else {\n this.removeFocus();\n this.clearButton.focus();\n }\n }\n else {\n this.browseButton.blur();\n var iconElement = this.listParent.querySelectorAll('span.e-icons')[0];\n iconElement.focus();\n iconElement.classList.add(ICON_FOCUSED);\n }\n };\n Uploader.prototype.removeFocus = function () {\n if (this.uploadWrapper && this.listParent && this.listParent.querySelector('.' + ICON_FOCUSED)) {\n document.activeElement.blur();\n this.listParent.querySelector('.' + ICON_FOCUSED).classList.remove(ICON_FOCUSED);\n }\n };\n Uploader.prototype.browseButtonClick = function () {\n this.element.click();\n };\n Uploader.prototype.uploadButtonClick = function () {\n this.upload(this.filesData);\n };\n Uploader.prototype.clearButtonClick = function () {\n this.clearAll();\n };\n Uploader.prototype.bindDropEvents = function () {\n if (this.dropZoneElement) {\n EventHandler.add(this.dropZoneElement, 'drop', this.dropElement, this);\n EventHandler.add(this.dropZoneElement, 'dragover', this.dragHover, this);\n EventHandler.add(this.dropZoneElement, 'dragleave', this.onDragLeave, this);\n }\n };\n Uploader.prototype.unBindDropEvents = function () {\n if (this.dropZoneElement) {\n EventHandler.remove(this.dropZoneElement, 'drop', this.dropElement);\n EventHandler.remove(this.dropZoneElement, 'dragover', this.dragHover);\n EventHandler.remove(this.dropZoneElement, 'dragleave', this.onDragLeave);\n }\n };\n Uploader.prototype.onDragLeave = function (e) {\n this.dropZoneElement.classList.remove(DRAG_HOVER);\n };\n Uploader.prototype.dragHover = function (e) {\n if (!this.enabled) {\n return;\n }\n this.dropZoneElement.classList.add(DRAG_HOVER);\n e.preventDefault();\n e.stopPropagation();\n };\n Uploader.prototype.dropElement = function (e) {\n this.dropZoneElement.classList.remove(DRAG_HOVER);\n this.onSelectFiles(e);\n e.preventDefault();\n e.stopPropagation();\n };\n Uploader.prototype.removeFiles = function (args) {\n if (!this.enabled) {\n return;\n }\n var selectedElement = args.target.parentElement;\n var index = this.fileList.indexOf(selectedElement);\n var liElement = this.fileList[index];\n var fileData = this.filesData[index];\n if (args.target.classList.contains(ABORT_ICON)) {\n if (args.target.classList.contains(DISABLED)) {\n return;\n }\n fileData.statusCode = '5';\n if (!isNullOrUndefined(liElement)) {\n var spinnerTarget = liElement.querySelector('.' + ABORT_ICON);\n createSpinner({ target: spinnerTarget, width: '20px' });\n showSpinner(spinnerTarget);\n }\n }\n else {\n this.remove(fileData, false, false, args);\n }\n this.element.value = '';\n this.checkActionButtonStatus();\n };\n Uploader.prototype.removeFilesData = function (file, customTemplate) {\n if (customTemplate) {\n return;\n }\n var selectedElement = this.getLiElement(file);\n if (isNullOrUndefined(selectedElement)) {\n return;\n }\n detach(selectedElement);\n var index = this.fileList.indexOf(selectedElement);\n this.fileList.splice(index, 1);\n this.filesData.splice(index, 1);\n if (this.fileList.length === 0 && !isNullOrUndefined(this.listParent)) {\n detach(this.listParent);\n this.listParent = null;\n this.removeActionButtons();\n }\n };\n Uploader.prototype.removeUploadedFile = function (file, eventArgs, removeDirectly, custom) {\n var _this = this;\n var selectedFiles = file;\n var name = this.element.getAttribute('name');\n var ajax = new Ajax(this.asyncSettings.removeUrl, 'POST', true, null);\n var formData = new FormData();\n ajax.beforeSend = function (e) {\n eventArgs.currentRequest = ajax.httpRequest;\n if (!removeDirectly) {\n _this.trigger('removing', eventArgs);\n }\n if (eventArgs.cancel) {\n e.cancel = true;\n }\n if (eventArgs.postRawFile && !isNullOrUndefined(selectedFiles.rawFile) && selectedFiles.rawFile !== '') {\n formData.append(name, selectedFiles.rawFile);\n }\n else {\n formData.append(name, selectedFiles.name);\n }\n _this.updateFormData(formData, eventArgs.customFormData);\n };\n var liElement = this.getLiElement(file);\n ajax.onLoad = function (e) { _this.removeCompleted(e, selectedFiles, custom); return {}; };\n /* istanbul ignore next */\n ajax.onError = function (e) { _this.removeFailed(e, selectedFiles, custom); return {}; };\n ajax.send(formData);\n if (!isNullOrUndefined(liElement) && !isNullOrUndefined(liElement.querySelector('.' + REMOVE_ICON))) {\n var spinnerTarget = liElement.querySelector('.' + REMOVE_ICON);\n createSpinner({ target: spinnerTarget, width: '20px' });\n showSpinner(spinnerTarget);\n }\n };\n /* istanbul ignore next */\n Uploader.prototype.updateFormData = function (formData, customData) {\n if (customData.length > 0 && customData[0]) {\n for (var i = 0; i < customData.length; i++) {\n var data = customData[i];\n // tslint:disable-next-line\n formData.append(Object.keys(data)[0], Object.values(data)[0]);\n }\n }\n };\n Uploader.prototype.removeCompleted = function (e, files, customTemplate) {\n var args = {\n e: e, operation: 'remove', file: this.updateStatus(files, this.localizedTexts('removedSuccessMessage'), '2')\n };\n this.trigger('success', args);\n this.removeFilesData(files, customTemplate);\n var index = this.uploadedFilesData.indexOf(files);\n this.uploadedFilesData.splice(index, 1);\n this.trigger('change', { files: this.uploadedFilesData });\n };\n Uploader.prototype.removeFailed = function (e, files, customTemplate) {\n var args = {\n e: e, operation: 'remove', file: this.updateStatus(files, this.localizedTexts('removedFailedMessage'), '0')\n };\n if (!customTemplate) {\n var index = this.filesData.indexOf(files);\n var rootElement = this.fileList[index];\n if (rootElement) {\n var statusElement = rootElement.querySelector('.' + STATUS);\n rootElement.classList.remove(UPLOAD_SUCCESS);\n statusElement.classList.remove(UPLOAD_SUCCESS);\n rootElement.classList.add(UPLOAD_FAILED);\n statusElement.classList.add(UPLOAD_FAILED);\n }\n this.checkActionButtonStatus();\n }\n this.trigger('failure', args);\n var liElement = this.getLiElement(files);\n if (!isNullOrUndefined(liElement) && !isNullOrUndefined(liElement.querySelector('.' + REMOVE_ICON))) {\n var spinnerTarget = liElement.querySelector('.' + REMOVE_ICON);\n hideSpinner(spinnerTarget);\n detach(liElement.querySelector('.e-spinner-pane'));\n }\n };\n Uploader.prototype.onSelectFiles = function (args) {\n if (!this.enabled) {\n return;\n }\n var fileData = [];\n var targetFiles;\n if (args.type === 'drop') {\n var files = args.dataTransfer.files;\n targetFiles = this.multiple ? this.sortFileList(files) : [files[0]];\n }\n else {\n targetFiles = [].slice.call(args.target.files);\n }\n if (!this.multiple) {\n this.clearData(true);\n targetFiles = [targetFiles[0]];\n }\n for (var i = 0; i < targetFiles.length; i++) {\n var file = targetFiles[i];\n var eventArgs_1 = {\n name: file.name,\n rawFile: file,\n size: file.size,\n status: this.localizedTexts('readyToUploadMessage'),\n type: this.getFileType(file.name),\n validationMessages: this.validatedFileSize(file.size),\n statusCode: '1'\n };\n eventArgs_1.status = eventArgs_1.validationMessages.minSize !== '' ? this.localizedTexts('invalidMinFileSize') :\n eventArgs_1.validationMessages.maxSize !== '' ? this.localizedTexts('invalidMaxFileSize') : eventArgs_1.status;\n if (eventArgs_1.validationMessages.minSize !== '' || eventArgs_1.validationMessages.maxSize !== '') {\n eventArgs_1.statusCode = '0';\n }\n fileData.push(eventArgs_1);\n }\n var eventArgs = {\n event: args,\n cancel: false,\n filesData: fileData,\n isModified: false,\n modifiedFilesData: [],\n progressInterval: ''\n };\n if (this.allowedExtensions.indexOf('*') > -1) {\n this.allTypes = true;\n }\n if (args.type === 'drop' && !this.allTypes) {\n fileData = this.checkExtension(fileData);\n }\n this.trigger('selected', eventArgs);\n if (eventArgs.cancel) {\n return;\n }\n if (this.showFileList) {\n if (eventArgs.isModified && eventArgs.modifiedFilesData.length > 0) {\n var dataFiles = this.allTypes ? eventArgs.modifiedFilesData :\n this.checkExtension(eventArgs.modifiedFilesData);\n this.updateSortedFileList(dataFiles);\n this.filesData = dataFiles;\n if (!this.isForm) {\n this.checkAutoUpload(dataFiles);\n }\n }\n else {\n this.createFileList(fileData);\n this.filesData = this.filesData.concat(fileData);\n if (!this.isForm) {\n this.checkAutoUpload(fileData);\n }\n }\n if (!isNullOrUndefined(eventArgs.progressInterval) && eventArgs.progressInterval !== '') {\n this.progressInterval = eventArgs.progressInterval;\n }\n }\n };\n Uploader.prototype.clearData = function (singleUpload) {\n if (!isNullOrUndefined(this.listParent)) {\n detach(this.listParent);\n this.listParent = null;\n }\n if (Browser.info.name !== 'msie' && !singleUpload) {\n this.element.value = '';\n }\n this.fileList = [];\n this.filesData = [];\n this.removeActionButtons();\n };\n Uploader.prototype.updateSortedFileList = function (filesData) {\n var previousListClone = createElement('div', { id: 'clonewrapper' });\n var added = -1;\n var removedList;\n if (this.listParent) {\n for (var i = 0; i < this.listParent.querySelectorAll('li').length; i++) {\n var liElement = this.listParent.querySelectorAll('li')[i];\n previousListClone.appendChild(liElement.cloneNode(true));\n }\n removedList = this.listParent.querySelectorAll('li');\n for (var _i = 0, removedList_1 = removedList; _i < removedList_1.length; _i++) {\n var item = removedList_1[_i];\n detach(item);\n }\n this.removeActionButtons();\n var oldList = [].slice.call(previousListClone.childNodes);\n detach(this.listParent);\n this.listParent = null;\n this.fileList = [];\n this.createParentUL();\n for (var index = 0; index < filesData.length; index++) {\n for (var j = 0; j < this.filesData.length; j++) {\n if (this.filesData[j].name === filesData[index].name) {\n this.listParent.appendChild(oldList[j]);\n EventHandler.add(oldList[j].querySelector('.e-icons'), 'click', this.removeFiles, this);\n this.fileList.push(oldList[j]);\n added = index;\n }\n }\n if (added !== index) {\n this.createFileList([filesData[index]]);\n }\n }\n }\n else {\n this.createFileList(filesData);\n }\n };\n Uploader.prototype.checkExtension = function (files) {\n var dropFiles = files;\n if (this.allowedExtensions !== '') {\n var allowedExtensions = [];\n var extensions = this.allowedExtensions.split(',');\n for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) {\n var extension = extensions_1[_i];\n allowedExtensions.push(extension.trim().toLocaleLowerCase());\n }\n for (var i = 0; i < files.length; i++) {\n if (allowedExtensions.indexOf(('.' + files[i].type).toLocaleLowerCase()) === -1) {\n files[i].status = this.localizedTexts('invalidFileType');\n files[i].statusCode = '0';\n }\n }\n }\n return dropFiles;\n };\n Uploader.prototype.validatedFileSize = function (fileSize) {\n var minSizeError = '';\n var maxSizeError = '';\n if (fileSize < this.minFileSize) {\n minSizeError = this.localizedTexts('invalidMinFileSize');\n }\n else if (fileSize > this.maxFileSize) {\n maxSizeError = this.localizedTexts('invalidMaxFileSize');\n }\n else {\n minSizeError = '';\n maxSizeError = '';\n }\n var errorMessage = { minSize: minSizeError, maxSize: maxSizeError };\n return errorMessage;\n };\n Uploader.prototype.createCustomfileList = function (fileData) {\n this.createParentUL();\n for (var _i = 0, fileData_1 = fileData; _i < fileData_1.length; _i++) {\n var listItem = fileData_1[_i];\n var liElement = createElement('li', { className: FILE, attrs: { 'data-file-name': listItem.name } });\n this.uploadTemplateFn = this.templateComplier(this.template);\n this.listParent.appendChild(liElement);\n var fromElements = [].slice.call(this.uploadTemplateFn(listItem));\n append(fromElements, liElement);\n this.fileList.push(liElement);\n }\n };\n Uploader.prototype.createParentUL = function () {\n if (isNullOrUndefined(this.listParent)) {\n this.listParent = createElement('ul', { className: LIST_PARENT });\n this.uploadWrapper.appendChild(this.listParent);\n }\n };\n Uploader.prototype.createFileList = function (fileData) {\n this.createParentUL();\n if (this.template !== '' && !isNullOrUndefined(this.template)) {\n this.createCustomfileList(fileData);\n }\n else {\n for (var _i = 0, fileData_2 = fileData; _i < fileData_2.length; _i++) {\n var listItem = fileData_2[_i];\n var liElement = createElement('li', { className: FILE, attrs: { 'data-file-name': listItem.name } });\n var textContainer = createElement('span', { className: TEXT_CONTAINER });\n var textElement = createElement('span', { className: FILE_NAME, attrs: { 'title': listItem.name } });\n textElement.innerHTML = this.getFileNameOnly(listItem.name);\n var fileExtension = createElement('span', { className: FILE_TYPE });\n fileExtension.innerHTML = '.' + this.getFileType(listItem.name);\n if (!this.enableRtl) {\n textContainer.appendChild(textElement);\n textContainer.appendChild(fileExtension);\n }\n else {\n var rtlContainer = createElement('span', { className: RTL_CONTAINER });\n rtlContainer.appendChild(fileExtension);\n rtlContainer.appendChild(textElement);\n textContainer.appendChild(rtlContainer);\n }\n var fileSize = createElement('span', { className: FILE_SIZE });\n fileSize.innerHTML = this.bytesToSize(listItem.size);\n textContainer.appendChild(fileSize);\n var statusElement = createElement('span', { className: STATUS });\n textContainer.appendChild(statusElement);\n statusElement.innerHTML = listItem.status;\n liElement.appendChild(textContainer);\n var iconElement = createElement('span', { className: ' e-icons', attrs: { 'tabindex': '-1' } });\n /* istanbul ignore next */\n if (Browser.info.name === 'msie') {\n iconElement.classList.add('e-msie');\n }\n iconElement.setAttribute('title', this.localizedTexts('remove'));\n liElement.appendChild(iconElement);\n EventHandler.add(iconElement, 'click', this.removeFiles, this);\n if (listItem.statusCode === '2') {\n statusElement.classList.add(UPLOAD_SUCCESS);\n iconElement.classList.add(REMOVE_ICON);\n iconElement.setAttribute('title', this.localizedTexts('delete'));\n }\n else if (listItem.statusCode !== '1') {\n statusElement.classList.remove(UPLOAD_SUCCESS);\n statusElement.classList.add(VALIDATION_FAILS);\n }\n if (this.autoUpload && listItem.statusCode === '1' && this.asyncSettings.saveUrl !== '') {\n statusElement.innerHTML = '';\n }\n if (!iconElement.classList.contains(REMOVE_ICON)) {\n iconElement.classList.add(CLEAR_ICON);\n }\n this.listParent.appendChild(liElement);\n this.fileList.push(liElement);\n this.truncateName(textElement);\n }\n }\n };\n Uploader.prototype.truncateName = function (name) {\n var nameElement = name;\n var text;\n if (nameElement.offsetWidth < nameElement.scrollWidth) {\n text = nameElement.textContent;\n nameElement.dataset.tail = text.slice(text.length - 10);\n }\n };\n Uploader.prototype.getFileType = function (name) {\n var extension;\n var index = name.lastIndexOf('.');\n if (index >= 0) {\n extension = name.substring(index + 1);\n }\n return extension ? extension : '';\n };\n Uploader.prototype.getFileNameOnly = function (name) {\n var type = this.getFileType(name);\n var names = name.split('.' + type);\n return type = names[0];\n };\n Uploader.prototype.setInitialAttributes = function () {\n if (this.initialAttr.accept) {\n this.element.setAttribute('accept', this.initialAttr.accept);\n }\n if (this.initialAttr.disabled) {\n this.element.setAttribute('disabled', 'disabled');\n }\n if (this.initialAttr.multiple) {\n var newAttr = document.createAttribute('multiple');\n this.element.setAttributeNode(newAttr);\n }\n };\n Uploader.prototype.filterfileList = function (files) {\n var filterFiles = [];\n var li;\n for (var i = 0; i < files.length; i++) {\n li = this.getLiElement(files[i]);\n if (!li.classList.contains(UPLOAD_SUCCESS)) {\n filterFiles.push(files[i]);\n }\n }\n return filterFiles;\n };\n Uploader.prototype.updateStatus = function (files, status, statusCode) {\n if (!(status === '' || isNullOrUndefined(status)) && !(statusCode === '' || isNullOrUndefined(statusCode))) {\n files.status = status;\n files.statusCode = statusCode;\n }\n var li = this.getLiElement(files);\n if (!isNullOrUndefined(li)) {\n if (!isNullOrUndefined(li.querySelector('.' + STATUS)) && !((status === '' || isNullOrUndefined(status)))) {\n li.querySelector('.' + STATUS).textContent = status;\n }\n }\n return files;\n };\n Uploader.prototype.getLiElement = function (files) {\n var index = this.filesData.indexOf(files);\n return this.fileList[index];\n };\n Uploader.prototype.createProgressBar = function (liElement) {\n var progressbarWrapper = createElement('span', { className: PROGRESS_WRAPPER });\n var progressBar = createElement('progressbar', { className: PROGRESSBAR, attrs: { value: '0', max: '100' } });\n var progressbarInnerWrapper = createElement('span', { className: PROGRESS_INNER_WRAPPER });\n progressBar.setAttribute('style', 'width: 0%');\n var progressbarText = createElement('span', { className: PROGRESSBAR_TEXT });\n progressbarText.textContent = '0%';\n progressbarInnerWrapper.appendChild(progressBar);\n progressbarWrapper.appendChild(progressbarInnerWrapper);\n progressbarWrapper.appendChild(progressbarText);\n liElement.querySelector('.' + TEXT_CONTAINER).appendChild(progressbarWrapper);\n };\n /* istanbul ignore next */\n Uploader.prototype.updateProgressbar = function (e, li) {\n if (!isNaN(Math.round((e.loaded / e.total) * 100)) && !isNullOrUndefined(li.querySelector('.' + PROGRESSBAR))) {\n if (!isNullOrUndefined(this.progressInterval) && this.progressInterval !== '') {\n var value = (Math.round((e.loaded / e.total) * 100)) % parseInt(this.progressInterval, 10);\n if (value === 0 || value === 100) {\n this.changeProgressValue(li, Math.round((e.loaded / e.total) * 100).toString() + '%');\n }\n }\n else {\n this.changeProgressValue(li, Math.round((e.loaded / e.total) * 100).toString() + '%');\n }\n }\n };\n Uploader.prototype.changeProgressValue = function (li, progressValue) {\n li.querySelector('.' + PROGRESSBAR).setAttribute('style', 'width:' + progressValue);\n li.querySelector('.' + PROGRESSBAR_TEXT).textContent = progressValue;\n };\n Uploader.prototype.uploadInProgress = function (e, files, customUI, request) {\n var _this = this;\n var li = this.getLiElement(files);\n if (isNullOrUndefined(li) && (!customUI || isNullOrUndefined(customUI))) {\n return;\n }\n if (!isNullOrUndefined(li)) {\n /* istanbul ignore next */\n if (files.statusCode === '5') {\n var eventArgs = {\n event: e,\n fileData: files,\n cancel: false\n };\n this.trigger('canceling', eventArgs);\n if (eventArgs.cancel) {\n files.statusCode = '3';\n var spinnerTarget = li.querySelector('.' + ABORT_ICON);\n if (!isNullOrUndefined(li) && !isNullOrUndefined(spinnerTarget)) {\n hideSpinner(spinnerTarget);\n detach(li.querySelector('.e-spinner-pane'));\n }\n return;\n }\n request.emitError = false;\n request.httpRequest.abort();\n var formData = new FormData();\n if (files.statusCode === '5') {\n var name_1 = this.element.getAttribute('name');\n formData.append(name_1, files.name);\n formData.append('cancel-uploading', files.name);\n var ajax = new Ajax(this.asyncSettings.removeUrl, 'POST', true, null);\n ajax.onLoad = function (e) { _this.removecanceledFile(e, files); return {}; };\n ajax.send(formData);\n }\n }\n if (!(li.querySelectorAll('.' + PROGRESS_WRAPPER).length > 0) && li.querySelector('.' + STATUS)) {\n li.querySelector('.' + STATUS).classList.add(UPLOAD_INPROGRESS);\n this.createProgressBar(li);\n this.updateProgressBarClasses(li, UPLOAD_INPROGRESS);\n li.querySelector('.' + STATUS).classList.remove(UPLOAD_FAILED);\n }\n this.updateProgressbar(e, li);\n var iconEle = li.querySelector('.' + CLEAR_ICON);\n if (!isNullOrUndefined(iconEle)) {\n iconEle.classList.add(ABORT_ICON, UPLOAD_INPROGRESS);\n iconEle.setAttribute('title', this.localizedTexts('abort'));\n iconEle.classList.remove(CLEAR_ICON);\n }\n }\n var args = { e: e, operation: 'upload', file: this.updateStatus(files, this.localizedTexts('inProgress'), '3') };\n this.trigger('progress', args);\n };\n Uploader.prototype.removecanceledFile = function (e, file) {\n var liElement = this.getLiElement(file);\n if (liElement.querySelector('.' + RETRY_ICON) || isNullOrUndefined(liElement.querySelector('.' + ABORT_ICON))) {\n return;\n }\n this.updateStatus(file, this.localizedTexts('fileUploadCancel'), '5');\n this.renderFailureState(e, file, liElement);\n var spinnerTarget = liElement.querySelector('.' + CLEAR_ICON);\n if (!isNullOrUndefined(liElement)) {\n hideSpinner(spinnerTarget);\n detach(liElement.querySelector('.e-spinner-pane'));\n }\n var args = { event: e, operation: 'cancel', file: file };\n this.trigger('success', args);\n };\n Uploader.prototype.renderFailureState = function (e, file, liElement) {\n var _this = this;\n this.updateProgressBarClasses(liElement, UPLOAD_FAILED);\n this.removeProgressbar(liElement, 'failure');\n if (!isNullOrUndefined(liElement.querySelector('.e-file-status'))) {\n liElement.querySelector('.e-file-status').classList.add(UPLOAD_FAILED);\n }\n var deleteIcon = liElement.querySelector('.' + ABORT_ICON);\n if (isNullOrUndefined(deleteIcon)) {\n return;\n }\n deleteIcon.classList.remove(ABORT_ICON, UPLOAD_INPROGRESS);\n deleteIcon.classList.add(CLEAR_ICON);\n deleteIcon.setAttribute('title', this.localizedTexts('remove'));\n this.pauseButton = createElement('span', { className: 'e-icons e-file-reload-btn', attrs: { 'tabindex': '-1' } });\n liElement.insertBefore(this.pauseButton, deleteIcon);\n this.pauseButton.setAttribute('title', this.localizedTexts('retry'));\n var retryElement = liElement.querySelector('.' + RETRY_ICON);\n /* istanbul ignore next */\n retryElement.addEventListener('click', function (e) { _this.reloadcanceledFile(e, file, liElement); }, false);\n };\n Uploader.prototype.reloadcanceledFile = function (e, file, liElement) {\n file.statusCode = '1';\n file.status = this.localizedTexts('readyToUploadMessage');\n liElement.querySelector('.' + STATUS).classList.remove(UPLOAD_FAILED);\n detach(liElement.querySelector('.' + RETRY_ICON));\n this.pauseButton = null;\n this.upload([file]);\n };\n /* istanbul ignore next */\n Uploader.prototype.uploadComplete = function (e, file, customUI) {\n var status = e.target;\n if (status.readyState === 4 && status.status >= 200 && status.status <= 299) {\n var li = this.getLiElement(file);\n if (isNullOrUndefined(li) && (!customUI || isNullOrUndefined(customUI))) {\n return;\n }\n if (!isNullOrUndefined(li)) {\n this.updateProgressBarClasses(li, UPLOAD_SUCCESS);\n this.removeProgressbar(li, 'success');\n var iconEle = li.querySelector('.' + ABORT_ICON);\n if (!isNullOrUndefined(iconEle)) {\n iconEle.classList.add(REMOVE_ICON);\n iconEle.setAttribute('title', this.localizedTexts('delete'));\n iconEle.classList.remove(ABORT_ICON);\n iconEle.classList.remove(UPLOAD_INPROGRESS);\n }\n }\n this.raiseSuccessEvent(e, file);\n }\n else {\n this.uploadFailed(e, file);\n }\n };\n Uploader.prototype.raiseSuccessEvent = function (e, file) {\n var args = { e: e, operation: 'upload', file: this.updateStatus(file, this.localizedTexts('uploadSuccessMessage'), '2') };\n this.trigger('success', args);\n this.uploadedFilesData.push(file);\n this.trigger('change', { file: this.uploadedFilesData });\n this.checkActionButtonStatus();\n };\n Uploader.prototype.uploadFailed = function (e, file) {\n var li = this.getLiElement(file);\n var args = { e: e, operation: 'upload', file: this.updateStatus(file, this.localizedTexts('uploadFailedMessage'), '0') };\n if (!isNullOrUndefined(li)) {\n this.renderFailureState(e, file, li);\n }\n this.trigger('failure', args);\n this.checkActionButtonStatus();\n };\n Uploader.prototype.updateProgressBarClasses = function (li, className) {\n var progressBar = li.querySelector('.' + PROGRESSBAR);\n if (!isNullOrUndefined(progressBar)) {\n progressBar.classList.add(className);\n }\n };\n Uploader.prototype.removeProgressbar = function (li, callType) {\n var _this = this;\n if (!isNullOrUndefined(li.querySelector('.' + PROGRESS_WRAPPER))) {\n this.progressAnimation = new Animation({ duration: 1250 });\n this.progressAnimation.animate(li.querySelector('.' + PROGRESS_WRAPPER), { name: 'FadeOut' });\n this.progressAnimation.animate(li.querySelector('.' + PROGRESSBAR_TEXT), { name: 'FadeOut' });\n setTimeout(function () { _this.animateProgressBar(li, callType); }, 750);\n }\n };\n /* istanbul ignore next */\n Uploader.prototype.animateProgressBar = function (li, callType) {\n if (callType === 'success') {\n li.classList.add(UPLOAD_SUCCESS);\n if (!isNullOrUndefined(li.querySelector('.' + STATUS))) {\n li.querySelector('.' + STATUS).classList.remove(UPLOAD_INPROGRESS);\n this.progressAnimation.animate(li.querySelector('.' + STATUS), { name: 'FadeIn' });\n li.querySelector('.' + STATUS).classList.add(UPLOAD_SUCCESS);\n }\n }\n else {\n if (!isNullOrUndefined(li.querySelector('.' + STATUS))) {\n li.querySelector('.' + STATUS).classList.remove(UPLOAD_INPROGRESS);\n this.progressAnimation.animate(li.querySelector('.' + STATUS), { name: 'FadeIn' });\n li.querySelector('.' + STATUS).classList.add(UPLOAD_FAILED);\n }\n }\n if (li.querySelector('.' + PROGRESS_WRAPPER)) {\n detach(li.querySelector('.' + PROGRESS_WRAPPER));\n }\n };\n Uploader.prototype.setExtensions = function (extensions) {\n this.element.setAttribute('accept', extensions);\n };\n Uploader.prototype.templateComplier = function (uploadTemplate) {\n if (uploadTemplate) {\n var exception = void 0;\n try {\n if (document.querySelectorAll(uploadTemplate).length) {\n return compile(document.querySelector(uploadTemplate).innerHTML.trim());\n }\n }\n catch (exception) {\n return compile(uploadTemplate);\n }\n }\n return undefined;\n };\n Uploader.prototype.setRTL = function () {\n this.enableRtl ? addClass([this.uploadWrapper], RTL) : removeClass([this.uploadWrapper], RTL);\n };\n Uploader.prototype.localizedTexts = function (localeText) {\n this.l10n.setLocale(this.locale);\n return this.l10n.getConstant(localeText);\n };\n Uploader.prototype.setControlStatus = function () {\n if (!this.enabled) {\n this.uploadWrapper.classList.add(DISABLED);\n this.element.setAttribute('disabled', 'disabled');\n this.browseButton.setAttribute('disabled', 'disabled');\n if (!isNullOrUndefined(this.clearButton)) {\n this.clearButton.setAttribute('disabled', 'disabled');\n }\n if (!isNullOrUndefined(this.uploadButton)) {\n this.uploadButton.setAttribute('disabled', 'disabled');\n }\n }\n else {\n if (this.uploadWrapper.classList.contains(DISABLED)) {\n this.uploadWrapper.classList.remove(DISABLED);\n }\n if (!isNullOrUndefined(this.browseButton) && this.element.hasAttribute('disabled')) {\n this.element.removeAttribute('disabled');\n this.browseButton.removeAttribute('disabled');\n }\n if (!isNullOrUndefined(this.clearButton) && this.clearButton.hasAttribute('disabled')) {\n this.clearButton.removeAttribute('disabled');\n }\n if (!isNullOrUndefined(this.uploadButton) && this.uploadButton.hasAttribute('disabled')) {\n this.uploadButton.hasAttribute('disabled');\n }\n }\n };\n Uploader.prototype.checkHTMLAttributes = function () {\n if (this.element.hasAttribute('accept')) {\n this.allowedExtensions = this.element.getAttribute('accept');\n this.initialAttr.accept = this.allowedExtensions;\n }\n if (this.element.hasAttribute('multiple')) {\n this.multiple = true;\n this.initialAttr.multiple = true;\n }\n if (this.element.hasAttribute('disabled')) {\n this.enabled = false;\n this.initialAttr.disabled = true;\n }\n };\n Uploader.prototype.chunkUpload = function (file, custom) {\n var start = 0;\n var end = Math.min(this.asyncSettings.chunkSize, file.size);\n var index = 0;\n var blob = file.rawFile.slice(start, end);\n var metaData = { chunkIndex: index, blob: blob, file: file, start: start, end: end, retryCount: 0, request: null };\n this.sendRequest(file, metaData, custom);\n };\n Uploader.prototype.sendRequest = function (file, metaData, custom) {\n var _this = this;\n var formData = new FormData();\n var blob = file.rawFile.slice(metaData.start, metaData.end);\n formData.append('chunkFile', blob, file.name);\n formData.append('chunk-index', metaData.chunkIndex.toString());\n var totalChunk = Math.max(Math.ceil(file.size / this.asyncSettings.chunkSize), 1);\n formData.append('total-chunk', totalChunk.toString());\n var ajax = new Ajax({ url: this.asyncSettings.saveUrl, type: 'POST', async: true, contentType: null });\n ajax.onLoad = function (e) { _this.chunkUploadComplete(e, metaData, custom); return {}; };\n ajax.onUploadProgress = function (e) {\n _this.chunkUploadInProgress(e, metaData, custom);\n return {};\n };\n var eventArgs = {\n fileData: file,\n customFormData: [],\n cancel: false,\n chunkSize: this.asyncSettings.chunkSize === 0 ? null : this.asyncSettings.chunkSize\n };\n ajax.beforeSend = function (e) {\n if (metaData.chunkIndex !== 0) {\n return;\n }\n eventArgs.currentRequest = ajax.httpRequest;\n _this.trigger('uploading', eventArgs);\n if (eventArgs.cancel) {\n _this.eventCancelByArgs(e, eventArgs, file);\n }\n else {\n _this.updateFormData(formData, eventArgs.customFormData);\n }\n };\n /* istanbul ignore next */\n ajax.onError = function (e) { _this.chunkUploadFailed(e, metaData, custom); return {}; };\n ajax.send(formData);\n metaData.request = ajax;\n };\n Uploader.prototype.eventCancelByArgs = function (e, eventArgs, file) {\n var _this = this;\n e.cancel = true;\n if (eventArgs.fileData.statusCode === '5') {\n return;\n }\n var liElement = this.getLiElement(eventArgs.fileData);\n liElement.querySelector('.' + STATUS).innerHTML = this.localizedTexts('fileUploadCancel');\n liElement.querySelector('.' + STATUS).classList.add(UPLOAD_FAILED);\n eventArgs.fileData.statusCode = '5';\n eventArgs.fileData.status = this.localizedTexts('fileUploadCancel');\n this.pauseButton = createElement('span', { className: 'e-icons e-file-reload-btn', attrs: { 'tabindex': '-1' } });\n liElement.insertBefore(this.pauseButton, liElement.querySelector('.' + CLEAR_ICON));\n this.pauseButton.setAttribute('title', this.localizedTexts('retry'));\n /* istanbul ignore next */\n this.pauseButton.addEventListener('click', function (e) { _this.reloadcanceledFile(e, file, liElement); }, false);\n this.checkActionButtonStatus();\n };\n Uploader.prototype.checkChunkUpload = function () {\n return (this.asyncSettings.chunkSize <= 0 || isNullOrUndefined(this.asyncSettings.chunkSize)) ? false : true;\n };\n Uploader.prototype.chunkUploadComplete = function (e, metaData, custom) {\n var _this = this;\n var response = e.target;\n var liElement;\n if (response.readyState === 4 && response.status >= 200 && response.status < 300) {\n var totalChunk = Math.max(Math.ceil(metaData.file.size / this.asyncSettings.chunkSize), 1);\n var eventArgs = {\n event: e,\n file: metaData.file,\n chunkIndex: metaData.chunkIndex,\n totalChunk: totalChunk,\n chunkSize: this.asyncSettings.chunkSize\n };\n this.trigger('chunkSuccess', eventArgs);\n if (isNullOrUndefined(custom) || !custom) {\n liElement = this.getLiElement(metaData.file);\n }\n this.updateMetaData(metaData);\n if (metaData.end === metaData.file.size) {\n metaData.file.statusCode = '3';\n }\n if (metaData.file.statusCode === '5') {\n var eventArgs_2 = { event: e, fileData: metaData.file, cancel: false };\n this.trigger('canceling', eventArgs_2);\n if (eventArgs_2.cancel) {\n metaData.file.statusCode = '3';\n var spinnerTarget = liElement.querySelector('.' + ABORT_ICON);\n if (!isNullOrUndefined(liElement) && !isNullOrUndefined(spinnerTarget)) {\n hideSpinner(spinnerTarget);\n detach(liElement.querySelector('.e-spinner-pane'));\n }\n this.sendNextRequest(metaData);\n return;\n }\n metaData.request.emitError = false;\n response.abort();\n var formData = new FormData();\n var name_2 = this.element.getAttribute('name');\n formData.append(name_2, metaData.file.name);\n formData.append('cancel-uploading', metaData.file.name);\n var ajax = new Ajax(this.asyncSettings.removeUrl, 'POST', true, null);\n ajax.onLoad = function (e) { _this.removeChunkFile(e, metaData, custom); return {}; };\n ajax.send(formData);\n }\n else {\n if ((totalChunk - 1) === metaData.chunkIndex && totalChunk > metaData.chunkIndex) {\n var index = this.pausedData.indexOf(metaData);\n if (index >= 0) {\n this.pausedData.splice(index, 1);\n }\n if (isNullOrUndefined(this.template) && (isNullOrUndefined(custom) || !custom) && liElement) {\n if (liElement) {\n detach(liElement.querySelector('.' + PAUSE_UPLOAD));\n }\n this.removeChunkProgressBar(metaData);\n }\n this.raiseSuccessEvent(e, metaData.file);\n return;\n }\n this.sendNextRequest(metaData);\n }\n }\n else {\n this.chunkUploadFailed(e, metaData);\n }\n };\n Uploader.prototype.sendNextRequest = function (metaData) {\n metaData.start = metaData.end;\n metaData.end += this.asyncSettings.chunkSize;\n metaData.end = Math.min(metaData.end, metaData.file.size);\n metaData.chunkIndex += 1;\n this.sendRequest(metaData.file, metaData);\n };\n Uploader.prototype.removeChunkFile = function (e, metaData, custom) {\n if (isNullOrUndefined(this.template) && (isNullOrUndefined(custom) && !custom)) {\n var liElement = this.getLiElement(metaData.file);\n var deleteIcon = liElement.querySelector('.' + ABORT_ICON);\n var spinnerTarget = deleteIcon;\n this.updateStatus(metaData.file, this.localizedTexts('fileUploadCancel'), '5');\n this.updateProgressBarClasses(liElement, UPLOAD_FAILED);\n this.removeProgressbar(liElement, 'failure');\n deleteIcon.classList.remove(ABORT_ICON);\n deleteIcon.classList.add(CLEAR_ICON);\n deleteIcon.setAttribute('title', this.localizedTexts('remove'));\n var pauseIcon = liElement.querySelector('.' + PAUSE_UPLOAD);\n pauseIcon.classList.add(RETRY_ICON);\n pauseIcon.classList.remove(PAUSE_UPLOAD);\n pauseIcon.setAttribute('title', this.localizedTexts('retry'));\n if (!isNullOrUndefined(liElement) && !isNullOrUndefined(deleteIcon)) {\n hideSpinner(spinnerTarget);\n detach(liElement.querySelector('.e-spinner-pane'));\n }\n }\n };\n Uploader.prototype.pauseUpload = function (metaData, e, custom) {\n metaData.file.statusCode = '4';\n metaData.file.status = this.localizedTexts('pause');\n this.updateMetaData(metaData);\n var eventArgs = {\n event: e ? e : null,\n file: metaData.file,\n chunkIndex: metaData.chunkIndex,\n chunkCount: Math.round(metaData.file.size / this.asyncSettings.chunkSize),\n chunkSize: this.asyncSettings.chunkSize\n };\n this.abortUpload(metaData, custom, eventArgs);\n };\n Uploader.prototype.abortUpload = function (metaData, custom, eventArgs) {\n metaData.request.emitError = false;\n metaData.request.httpRequest.abort();\n var liElement = this.getLiElement(metaData.file);\n if (isNullOrUndefined(this.template) && (isNullOrUndefined(custom) || !custom)) {\n var targetElement = liElement.querySelector('.' + PAUSE_UPLOAD);\n targetElement.classList.remove(PAUSE_UPLOAD);\n targetElement.classList.add(RESUME_UPLOAD);\n targetElement.setAttribute('title', this.localizedTexts('resume'));\n }\n for (var i = 0; i < this.pausedData.length; i++) {\n if (this.pausedData[i].file.name === metaData.file.name) {\n this.pausedData.splice(i, 1);\n }\n }\n this.pausedData.push(metaData);\n this.trigger('pausing', eventArgs);\n };\n Uploader.prototype.resumeUpload = function (metaData, e, custom) {\n var liElement = this.getLiElement(metaData.file);\n var targetElement;\n if (!isNullOrUndefined(liElement)) {\n targetElement = liElement.querySelector('.' + RESUME_UPLOAD);\n }\n if (!isNullOrUndefined(targetElement) && (isNullOrUndefined(custom) || !custom)) {\n targetElement.classList.remove(RESUME_UPLOAD);\n targetElement.classList.add(PAUSE_UPLOAD);\n targetElement.setAttribute('title', this.localizedTexts('pause'));\n }\n metaData.file.status = this.localizedTexts('inProgress');\n metaData.file.statusCode = '3';\n this.updateMetaData(metaData);\n var eventArgs = {\n event: e ? e : null,\n file: metaData.file,\n chunkIndex: metaData.chunkIndex,\n chunkCount: Math.round(metaData.file.size / this.asyncSettings.chunkSize),\n chunkSize: this.asyncSettings.chunkSize\n };\n this.trigger('resuming', eventArgs);\n for (var i = 0; i < this.pausedData.length; i++) {\n if (this.pausedData[i].end === this.pausedData[i].file.size) {\n this.chunkUploadComplete(e, metaData, custom);\n }\n else {\n if (this.pausedData[i].file.name === metaData.file.name) {\n this.pausedData[i].start = this.pausedData[i].end;\n this.pausedData[i].end = this.pausedData[i].end + this.asyncSettings.chunkSize;\n this.pausedData[i].end = Math.min(this.pausedData[i].end, this.pausedData[i].file.size);\n this.pausedData[i].chunkIndex = this.pausedData[i].chunkIndex + 1;\n this.sendRequest(this.pausedData[i].file, this.pausedData[i], custom);\n }\n }\n }\n };\n Uploader.prototype.updateMetaData = function (metaData) {\n if (this.uploadMetaData.indexOf(metaData) === -1) {\n this.uploadMetaData.push(metaData);\n }\n else {\n this.uploadMetaData.splice(this.uploadMetaData.indexOf(metaData), 1);\n this.uploadMetaData.push(metaData);\n }\n };\n Uploader.prototype.removeChunkProgressBar = function (metaData) {\n var liElement = this.getLiElement(metaData.file);\n if (!isNullOrUndefined(liElement)) {\n this.updateProgressBarClasses(liElement, UPLOAD_SUCCESS);\n this.removeProgressbar(liElement, 'success');\n var cancelButton = liElement.querySelector('.' + ABORT_ICON);\n if (!isNullOrUndefined(cancelButton)) {\n cancelButton.classList.add(REMOVE_ICON);\n cancelButton.setAttribute('title', this.localizedTexts('delete'));\n cancelButton.classList.remove(ABORT_ICON, UPLOAD_INPROGRESS);\n }\n }\n };\n Uploader.prototype.chunkUploadFailed = function (e, metaData, custom) {\n var _this = this;\n var chunkCount = Math.max(Math.ceil(metaData.file.size / this.asyncSettings.chunkSize), 1);\n var liElement;\n if (isNullOrUndefined(this.template) && (isNullOrUndefined(custom) || !custom)) {\n liElement = this.getLiElement(metaData.file);\n }\n var eventArgs = {\n event: e,\n file: metaData.file,\n chunkIndex: metaData.chunkIndex,\n totalChunk: chunkCount,\n chunkSize: this.asyncSettings.chunkSize\n };\n this.trigger('chunkFailure', eventArgs);\n if (metaData.retryCount < this.asyncSettings.retryCount) {\n setTimeout(function () { _this.retryRequest(liElement, metaData, custom); }, this.asyncSettings.retryAfterDelay);\n }\n else {\n if (!isNullOrUndefined(liElement)) {\n var pauseButton = liElement.querySelector('.' + PAUSE_UPLOAD) ?\n liElement.querySelector('.' + PAUSE_UPLOAD) : liElement.querySelector('.' + RESUME_UPLOAD);\n if (!isNullOrUndefined(pauseButton)) {\n pauseButton.classList.add(RETRY_ICON);\n pauseButton.classList.remove(PAUSE_UPLOAD, RESUME_UPLOAD);\n }\n this.updateProgressBarClasses(liElement, UPLOAD_FAILED);\n this.removeProgressbar(liElement, 'failure');\n liElement.querySelector('.e-icons').classList.remove(UPLOAD_INPROGRESS);\n var iconElement = liElement.querySelector('.' + ABORT_ICON);\n iconElement.classList.remove(ABORT_ICON);\n if (!isNullOrUndefined(liElement.querySelector('.' + PAUSE_UPLOAD))) {\n detach(liElement.querySelector('.' + PAUSE_UPLOAD));\n }\n if (metaData.start > 0) {\n iconElement.classList.add(REMOVE_ICON);\n iconElement.setAttribute('title', this.localizedTexts('delete'));\n }\n else {\n iconElement.classList.add(CLEAR_ICON);\n iconElement.setAttribute('title', this.localizedTexts('remove'));\n }\n }\n metaData.retryCount = 0;\n var file = metaData.file;\n var args = { e: e, operation: 'upload', file: this.updateStatus(file, this.localizedTexts('uploadFailedMessage'), '0') };\n this.trigger('failure', args);\n }\n };\n Uploader.prototype.retryRequest = function (liElement, metaData, custom) {\n if (isNullOrUndefined(this.template) && (isNullOrUndefined(custom) || !custom) && liElement) {\n this.updateProgressBarClasses(liElement, UPLOAD_FAILED);\n }\n metaData.retryCount += 1;\n this.sendRequest(metaData.file, metaData);\n };\n Uploader.prototype.checkPausePlayAction = function (e) {\n var targetElement = e.target;\n var selectedElement = e.target.parentElement;\n var index = this.fileList.indexOf(selectedElement);\n var fileData = this.filesData[index];\n var metaData = this.getCurrentMetaData(fileData);\n if (targetElement.classList.contains(PAUSE_UPLOAD)) {\n this.pauseUpload(metaData, e);\n targetElement.nextElementSibling.classList.add(DISABLED);\n }\n else if (targetElement.classList.contains(RESUME_UPLOAD)) {\n this.resumeUpload(metaData, e);\n targetElement.nextElementSibling.classList.remove(DISABLED);\n }\n else if (targetElement.classList.contains(RETRY_ICON)) {\n if (metaData.file.status === this.localizedTexts('fileUploadCancel')) {\n this.retryUpload(metaData, false);\n }\n else {\n this.retryUpload(metaData, true);\n }\n }\n };\n Uploader.prototype.retryUpload = function (metaData, fromcanceledStage) {\n if (fromcanceledStage) {\n metaData.end = metaData.end + this.asyncSettings.chunkSize;\n metaData.start = metaData.start + this.asyncSettings.chunkSize;\n this.sendRequest(metaData.file, metaData);\n }\n else {\n metaData.file.statusCode = '1';\n metaData.file.status = this.localizedTexts('readyToUploadMessage');\n this.chunkUpload(metaData.file);\n }\n };\n Uploader.prototype.chunkUploadInProgress = function (e, metaData, custom) {\n var _this = this;\n if (metaData.file.statusCode === '4') {\n return;\n }\n if (metaData.file.statusCode !== '4' && metaData.file.statusCode !== '5') {\n metaData.file.statusCode = '3';\n metaData.file.status = this.localizedTexts('inProgress');\n }\n this.updateMetaData(metaData);\n var liElement = this.getLiElement(metaData.file);\n if (isNullOrUndefined(liElement)) {\n return;\n }\n var target;\n var retryElement = liElement.querySelector('.' + RETRY_ICON);\n if (!isNullOrUndefined(retryElement)) {\n retryElement.classList.add(PAUSE_UPLOAD);\n retryElement.setAttribute('title', this.localizedTexts('pause'));\n retryElement.classList.remove(RETRY_ICON);\n }\n if (!isNullOrUndefined(liElement)) {\n if (!(liElement.querySelectorAll('.' + PROGRESS_WRAPPER).length > 0)) {\n var statusElement = liElement.querySelector('.' + STATUS);\n if (isNullOrUndefined(this.template)) {\n statusElement.classList.add(UPLOAD_INPROGRESS);\n statusElement.classList.remove(UPLOAD_FAILED);\n this.createProgressBar(liElement);\n this.updateProgressBarClasses(liElement, UPLOAD_INPROGRESS);\n }\n var clearIcon = liElement.querySelector('.' + CLEAR_ICON) ? liElement.querySelector('.' + CLEAR_ICON) :\n liElement.querySelector('.' + REMOVE_ICON);\n if (!isNullOrUndefined(clearIcon)) {\n clearIcon.classList.add(ABORT_ICON);\n clearIcon.setAttribute('title', this.localizedTexts('abort'));\n clearIcon.classList.remove(CLEAR_ICON);\n }\n }\n if (!isNaN(Math.round((e.loaded / e.total) * 100)) && isNullOrUndefined(this.template) && metaData.file.statusCode !== '4') {\n var loadedSize = (metaData.chunkIndex * this.asyncSettings.chunkSize);\n var value = Math.min((((loadedSize + e.loaded) / metaData.file.size) * 100), 100);\n this.changeProgressValue(liElement, Math.round(value).toString() + '%');\n }\n if (metaData.chunkIndex === 0) {\n this.checkActionButtonStatus();\n }\n }\n if (isNullOrUndefined(liElement.querySelector('.' + PAUSE_UPLOAD)) && isNullOrUndefined(this.template)) {\n this.pauseButton = createElement('span', { className: 'e-icons e-file-pause-btn', attrs: { 'tabindex': '-1' } });\n if (Browser.info.name === 'msie') {\n this.pauseButton.classList.add('e-msie');\n }\n liElement.insertBefore(this.pauseButton, liElement.querySelector('.' + ABORT_ICON));\n this.pauseButton.setAttribute('title', this.localizedTexts('pause'));\n this.pauseButton.addEventListener('click', function (e) { _this.checkPausePlayAction(e); }, false);\n }\n };\n /**\n * It is used to convert bytes value into kilobytes or megabytes depending on the size based\n * on [binary prefix](https://en.wikipedia.org/wiki/Binary_prefix).\n * @param { number } bytes - specifies the file size in bytes.\n * @returns string\n */\n Uploader.prototype.bytesToSize = function (bytes) {\n var i = -1;\n var size;\n if (!bytes) {\n return '0.0 KB';\n }\n do {\n bytes = bytes / 1024;\n i++;\n } while (bytes > 99);\n if (i >= 2) {\n bytes = bytes * 1024;\n i = 1;\n }\n return Math.max(bytes, 0).toFixed(1) + ' ' + ['KB', 'MB'][i];\n };\n /**\n * Allows you to sort the file data alphabetically based on its file name clearly.\n * @param { FileList } filesData - specifies the files data for upload.\n * @returns File[]\n */\n Uploader.prototype.sortFileList = function (filesData) {\n var files = filesData;\n var fileNames = [];\n for (var i = 0; i < files.length; i++) {\n fileNames.push(files[i].name);\n }\n var sortedFileNames = fileNames.sort();\n var sortedFilesData = [];\n var index = 0;\n for (var _i = 0, sortedFileNames_1 = sortedFileNames; _i < sortedFileNames_1.length; _i++) {\n var name_3 = sortedFileNames_1[_i];\n for (var i = 0; i < files.length; i++) {\n if (name_3 === files[i].name) {\n sortedFilesData.push(files[i]);\n }\n }\n }\n return sortedFilesData;\n };\n /**\n * Removes the component from the DOM and detaches all its related event handlers. Also it removes the attributes and classes.\n * @method destroy\n * @return {void}.\n */\n Uploader.prototype.destroy = function () {\n this.element.value = null;\n this.clearAll();\n this.unWireEvents();\n this.unBindDropEvents();\n if (this.multiple) {\n this.element.removeAttribute('multiple');\n }\n if (!this.enabled) {\n this.element.removeAttribute('disabled');\n }\n this.element.removeAttribute('accept');\n this.setInitialAttributes();\n this.uploadWrapper.parentElement.appendChild(this.cloneElement);\n this.cloneElement.classList.remove('e-control', ROOT);\n detach(this.uploadWrapper);\n this.uploadWrapper = null;\n _super.prototype.destroy.call(this);\n };\n /**\n * Allows you to call the upload process manually by calling save URL action.\n * To process the selected files (added in upload queue), pass an empty argument otherwise\n * upload the specific file based on its argument.\n * @param { FileInfo | FileInfo[] } files - specifies the files data for upload.\n * @returns void\n */\n Uploader.prototype.upload = function (files, custom) {\n var uploadFiles = this.validateFileType(files);\n this.uploadFiles(uploadFiles, custom);\n };\n Uploader.prototype.validateFileType = function (files) {\n var uploadFiles = [];\n if (files instanceof Array) {\n uploadFiles = files;\n }\n else {\n uploadFiles.push(files);\n }\n return uploadFiles;\n };\n Uploader.prototype.uploadFiles = function (files, custom) {\n var _this = this;\n var selectedFiles = [];\n if (this.asyncSettings.saveUrl === '' || isNullOrUndefined(this.asyncSettings.saveUrl)) {\n return;\n }\n if (!custom || isNullOrUndefined(custom)) {\n if (!this.multiple) {\n var file = [];\n file.push(files[0]);\n selectedFiles = this.filterfileList(file);\n }\n else {\n selectedFiles = this.filterfileList(files);\n }\n }\n else {\n selectedFiles = files;\n }\n var chunkEnabled = this.checkChunkUpload();\n var _loop_1 = function (i) {\n var ajax = new Ajax(this_1.asyncSettings.saveUrl, 'POST', true, null);\n var eventArgs = {\n fileData: selectedFiles[i],\n customFormData: [],\n cancel: false\n };\n var formData = new FormData();\n ajax.beforeSend = function (e) {\n eventArgs.currentRequest = ajax.httpRequest;\n _this.trigger('uploading', eventArgs);\n if (eventArgs.cancel) {\n _this.eventCancelByArgs(e, eventArgs, selectedFiles[i]);\n }\n _this.updateFormData(formData, eventArgs.customFormData);\n };\n if (selectedFiles[i].statusCode === '1') {\n var name_4 = this_1.element.getAttribute('name');\n formData.append(name_4, selectedFiles[i].rawFile, selectedFiles[i].name);\n if (chunkEnabled && selectedFiles[i].size > this_1.asyncSettings.chunkSize) {\n this_1.chunkUpload(selectedFiles[i], custom);\n }\n else {\n ajax.onLoad = function (e) { _this.uploadComplete(e, selectedFiles[i], custom); return {}; };\n ajax.onUploadProgress = function (e) {\n _this.uploadInProgress(e, selectedFiles[i], custom, ajax);\n return {};\n };\n /* istanbul ignore next */\n ajax.onError = function (e) { _this.uploadFailed(e, selectedFiles[i]); return {}; };\n ajax.send(formData);\n }\n }\n };\n var this_1 = this;\n for (var i = 0; i < selectedFiles.length; i++) {\n _loop_1(i);\n }\n };\n /**\n * Remove the uploaded file from server manually by calling the remove URL action.\n * If you pass an empty argument to this method, the complete file list can be cleared,\n * otherwise remove the specific file based on its argument (“file_data”).\n * @param { FileInfo | FileInfo[] } fileData - specifies the files data to remove from file list/server.\n * @param { boolean } customTemplate - Set true if the component rendering with customize template.\n * @param { boolean } removeDirectly - Set true if files remove without removing event.\n * @returns void\n */\n Uploader.prototype.remove = function (fileData, customTemplate, removeDirectly, args) {\n var removeFiles = [];\n fileData = !isNullOrUndefined(fileData) ? fileData : this.filesData;\n if (fileData instanceof Array) {\n removeFiles = fileData;\n }\n else {\n removeFiles.push(fileData);\n }\n var eventArgs = {\n event: args,\n cancel: false,\n filesData: removeFiles,\n customFormData: [],\n postRawFile: true\n };\n var removeUrl = this.asyncSettings.removeUrl;\n var validUrl = (removeUrl === '' || isNullOrUndefined(removeUrl)) ? false : true;\n for (var _i = 0, removeFiles_1 = removeFiles; _i < removeFiles_1.length; _i++) {\n var files = removeFiles_1[_i];\n if (files.statusCode === '2' && validUrl) {\n this.removeUploadedFile(files, eventArgs, removeDirectly, customTemplate);\n }\n else {\n if (!removeDirectly) {\n this.trigger('removing', eventArgs);\n }\n if (eventArgs.cancel) {\n return;\n }\n this.removeFilesData(files, customTemplate);\n }\n }\n };\n /**\n * Clear all the file entries from list that can be uploaded files or added in upload queue.\n * @returns void\n */\n Uploader.prototype.clearAll = function () {\n if (isNullOrUndefined(this.listParent)) {\n return;\n }\n var eventArgs = {\n cancel: false,\n filesData: this.filesData\n };\n this.trigger('clearing', eventArgs);\n if (eventArgs.cancel) {\n return;\n }\n this.clearData();\n };\n /**\n * Get the data of files which are shown in file list.\n * @returns FileInfo[]\n */\n Uploader.prototype.getFilesData = function () {\n return this.filesData;\n };\n /**\n * Pauses the in-progress chunked upload based on the file data.\n * @param { FileInfo | FileInfo[] } fileData - specifies the files data to pause from uploading.\n * @param { boolean } custom - Set true if used custom UI.\n * @returns void\n */\n Uploader.prototype.pause = function (fileData, custom) {\n var fileDataFiles = this.validateFileType(fileData);\n this.pauseUploading(fileDataFiles, custom);\n };\n Uploader.prototype.pauseUploading = function (fileData, custom) {\n var files = this.getFiles(fileData);\n for (var i = 0; i < files.length; i++) {\n if (files[i].statusCode === '3') {\n this.pauseUpload(this.getCurrentMetaData(files[i], null), null, custom);\n }\n }\n };\n Uploader.prototype.getFiles = function (fileData) {\n var files = [];\n if (!isNullOrUndefined(fileData) && !(fileData instanceof Array)) {\n files.push(fileData);\n }\n else {\n files = fileData;\n }\n return files;\n };\n /**\n * Resumes the chunked upload that is previously paused based on the file data.\n * @param { FileInfo | FileInfo[] } fileData - specifies the files data to resume the paused file.\n * @param { boolean } custom - Set true if used custom UI.\n * @returns void\n */\n Uploader.prototype.resume = function (fileData, custom) {\n var fileDataFiles = this.validateFileType(fileData);\n this.resumeFiles(fileDataFiles, custom);\n };\n Uploader.prototype.resumeFiles = function (fileData, custom) {\n var files = this.getFiles(fileData);\n for (var i = 0; i < files.length; i++) {\n if (files[i].statusCode === '4') {\n this.resumeUpload(this.getCurrentMetaData(files[i], null), null, custom);\n }\n }\n };\n /**\n * Retries the canceled or failed file upload based on the file data.\n * @param { FileInfo | FileInfo[] } fileData - specifies the files data to retry the canceled or failed file.\n * @param { boolean } fromcanceledStage - Set true to retry from canceled stage and set false to retry from initial stage.\n * @returns void\n */\n Uploader.prototype.retry = function (fileData, fromcanceledStage) {\n var fileDataFiles = this.validateFileType(fileData);\n this.retryFailedFiles(fileDataFiles, fromcanceledStage);\n };\n Uploader.prototype.retryFailedFiles = function (fileData, fromcanceledStage) {\n var files = this.getFiles(fileData);\n for (var i = 0; i < files.length; i++) {\n if (files[i].statusCode === '5' || files[i].statusCode === '0') {\n if (this.asyncSettings.chunkSize > 0) {\n this.retryUpload(this.getCurrentMetaData(files[i], null), fromcanceledStage);\n }\n else {\n var liElement = this.fileList[this.filesData.indexOf(files[i])];\n this.reloadcanceledFile(null, files[i], liElement);\n }\n }\n }\n };\n /**\n * Stops the in-progress chunked upload based on the file data.\n * When the file upload is canceled, the partially uploaded file is removed from server.\n * @param { FileInfo | FileInfo[] } fileData - specifies the files data to cancel the progressing file.\n * @returns void\n */\n Uploader.prototype.cancel = function (fileData) {\n var fileDataFiles = this.validateFileType(fileData);\n this.cancelUpload(fileDataFiles);\n };\n Uploader.prototype.cancelUpload = function (fileData) {\n var files = this.getFiles(fileData);\n for (var i = 0; i < files.length; i++) {\n if (files[i].statusCode === '3') {\n var metaData = this.getCurrentMetaData(files[i], null);\n metaData.file.statusCode = '5';\n metaData.file.status = this.localizedTexts('fileUploadCancel');\n this.updateMetaData(metaData);\n var liElement = this.getLiElement(files[i]);\n if (!isNullOrUndefined(liElement) && isNullOrUndefined(this.template)) {\n var spinnerTarget = liElement.querySelector('.' + ABORT_ICON);\n createSpinner({ target: spinnerTarget, width: '20px' });\n showSpinner(spinnerTarget);\n }\n }\n }\n };\n __decorate([\n Complex({ saveUrl: '', removeUrl: '' }, AsyncSettings)\n ], Uploader.prototype, \"asyncSettings\", void 0);\n __decorate([\n Property(false)\n ], Uploader.prototype, \"enableRtl\", void 0);\n __decorate([\n Property(true)\n ], Uploader.prototype, \"enabled\", void 0);\n __decorate([\n Property(null)\n ], Uploader.prototype, \"template\", void 0);\n __decorate([\n Property(true)\n ], Uploader.prototype, \"multiple\", void 0);\n __decorate([\n Property(true)\n ], Uploader.prototype, \"autoUpload\", void 0);\n __decorate([\n Complex({}, ButtonsProps)\n ], Uploader.prototype, \"buttons\", void 0);\n __decorate([\n Property('')\n ], Uploader.prototype, \"allowedExtensions\", void 0);\n __decorate([\n Property(0)\n ], Uploader.prototype, \"minFileSize\", void 0);\n __decorate([\n Property(30000000)\n ], Uploader.prototype, \"maxFileSize\", void 0);\n __decorate([\n Property(null)\n ], Uploader.prototype, \"dropArea\", void 0);\n __decorate([\n Collection([{}], FilesProp)\n ], Uploader.prototype, \"files\", void 0);\n __decorate([\n Property(true)\n ], Uploader.prototype, \"showFileList\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"selected\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"uploading\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"success\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"failure\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"removing\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"clearing\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"progress\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"change\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"chunkSuccess\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"chunkFailure\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"canceling\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"pausing\", void 0);\n __decorate([\n Event()\n ], Uploader.prototype, \"resuming\", void 0);\n Uploader = __decorate([\n NotifyPropertyChanges\n ], Uploader);\n return Uploader;\n}(Component));\nexport { Uploader };\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Component, Event, NotifyPropertyChanges, Property } from '@syncfusion/ej2-base';\nimport { Browser, closest, createElement, detach, EventHandler, getInstance, select, selectAll, formatUnit } from '@syncfusion/ej2-base';\nimport { addClass, attributes, classList, isNullOrUndefined, L10n } from '@syncfusion/ej2-base';\nimport { remove, removeClass, rippleEffect } from '@syncfusion/ej2-base';\nimport { SplitButton, getModel } from '@syncfusion/ej2-splitbuttons';\nimport { Tooltip, getZindexPartial, Popup } from '@syncfusion/ej2-popups';\nimport { Input } from './../input/index';\nimport { NumericTextBox } from './../numerictextbox/index';\nimport { Slider } from './../slider/slider';\nvar APPLY = 'e-apply';\nvar CANCEL = 'e-cancel';\nvar CURRENT = 'e-current';\nvar CONTAINER = 'e-container';\nvar CTRLBTN = 'e-ctrl-btn';\nvar CTRLSWITCH = 'e-switch-ctrl-btn';\nvar DISABLED = 'e-disabled';\nvar FORMATSWITCH = 'e-value-switch-btn';\nvar HANDLER = 'e-handler';\nvar HEX = 'e-hex';\nvar HSVAREA = 'e-hsv-color';\nvar HSVCONTAINER = 'e-hsv-container';\nvar INPUTWRAPPER = 'e-selected-value';\nvar MODESWITCH = 'e-mode-switch-btn';\nvar NOCOLOR = 'e-nocolor-item';\nvar PALETTES = 'e-palette';\nvar PALETTECONTENT = 'e-color-palette';\nvar PICKERCONTENT = 'e-color-picker';\nvar PREVIEW = 'e-preview-container';\nvar PREVIOUS = 'e-previous';\nvar RTL = 'e-rtl';\nvar SELECT = 'e-selected';\nvar SPLITPREVIEW = 'e-split-preview';\nvar TILE = 'e-tile';\nvar TOHSV = 'e-to-hsv';\nvar presets = {\n default: ['#000000', '#f44336', '#e91e63', '#9c27b0', '#673ab7', '#2196f3', '#03a9f4', '#00bcd4', '#009688', '#ffeb3b',\n '#ffffff', '#ffebee', '#fce4ec', '#f3e5f5', '#ede7f6', '#e3f2fd', '#e1f5fe', '#e0f7fa', '#e0f2f1', '#fffde7',\n '#f2f2f2', '#ffcdd2', '#f8bbd0', '#e1bee7', '#d1c4e9', '#bbdefb', '#b3e5fc', '#b2ebf2', '#b2dfdb', '#fff9c4',\n '#e6e6e6', '#ef9a9a', '#f48fb1', '#ce93d8', '#b39ddb', '#90caf9', '#81d4fa', '#80deea', '#80cbc4', '#fff59d',\n '#cccccc', '#e57373', '#f06292', '#ba68c8', '#9575cd', '#64b5f6', '#4fc3f7', '#4dd0e1', '#4db6ac', '#fff176',\n '#b3b3b3', '#ef5350', '#ec407a', '#ab47bc', '#7e57c2', '#42a5f5', '#29b6f6', '#26c6da', '#26a69a', '#ffee58',\n '#999999', '#e53935', '#d81b60', '#8e24aa', '#5e35b1', '#1e88e5', '#039be5', '#00acc1', '#00897b', '#fdd835',\n '#808080', '#d32f2f', '#c2185b', '#7b1fa2', '#512da8', '#1976d2', '#0288d1', '#0097a7', '#00796b', '#fbc02d',\n '#666666', '#c62828', '#ad1457', '#6a1b9a', '#4527a0', '#1565c0', '#0277bd', '#00838f', '#00695c', '#f9a825',\n '#4d4d4d', '#b71c1c', '#880e4f', '#4a148c', '#311b92', '#0d47a1', '#01579b', '#006064', '#004d40', '#f57f17']\n};\n/**\n * ColorPicker component is a user interface to select and adjust color values. It provides supports for various\n * color specification like Red Green Blue, Hue Saturation Value and Hex codes.\n * ```html\n * \n * ```\n * ```typescript\n * \n * ```\n */\nvar ColorPicker = /** @class */ (function (_super) {\n __extends(ColorPicker, _super);\n function ColorPicker(options, element) {\n return _super.call(this, options, element) || this;\n }\n ColorPicker.prototype.preRender = function () {\n var localeText = { Apply: 'Apply', Cancel: 'Cancel', ModeSwitcher: 'Switch Mode' };\n this.l10n = new L10n('colorpicker', localeText, this.locale);\n };\n /**\n * To Initialize the component rendering\n * @private\n */\n ColorPicker.prototype.render = function () {\n this.initWrapper();\n if (this.inline) {\n this.createWidget();\n }\n else {\n this.createSplitBtn();\n }\n };\n ColorPicker.prototype.initWrapper = function () {\n var wrapper = createElement('div', { className: 'e-' + this.getModuleName() + '-wrapper' });\n this.element.parentNode.insertBefore(wrapper, this.element);\n wrapper.appendChild(this.element);\n attributes(this.element, { 'tabindex': '-1', 'spellcheck': 'false' });\n this.container = createElement('div', { className: CONTAINER });\n this.getWrapper().appendChild(this.container);\n var value = this.value;\n this.element.value = value.slice(0, 7);\n if (this.mode === 'Picker') {\n value = this.roundValue(value);\n }\n this.setProperties({ 'value': value }, true);\n if (this.enableRtl) {\n wrapper.classList.add(RTL);\n }\n if (this.cssClass) {\n addClass([wrapper], this.cssClass.split(' '));\n }\n this.tileRipple = rippleEffect(this.container, { selector: '.' + TILE });\n this.ctrlBtnRipple = rippleEffect(this.container, { selector: '.e-btn' });\n };\n ColorPicker.prototype.getWrapper = function () {\n return this.element.parentElement;\n };\n ColorPicker.prototype.createWidget = function () {\n if (this.mode === 'Palette') {\n this.createPalette();\n if (!this.inline) {\n this.firstPaletteFocus();\n }\n }\n else {\n this.createPicker();\n if (!this.inline) {\n this.getDragHandler().focus();\n }\n }\n var wrapper = this.getWrapper();\n if ((this.isPicker() && !wrapper.classList.contains('e-hide-value')) || wrapper.classList.contains('e-show-value')) {\n this.createInput();\n }\n this.createCtrlBtn();\n if (!this.disabled) {\n this.wireEvents();\n }\n if (this.inline && this.disabled) {\n this.toggleDisabled(true);\n }\n if (Browser.isDevice) {\n this.refreshPopupPos();\n }\n };\n ColorPicker.prototype.createSplitBtn = function () {\n var _this = this;\n var splitButton = createElement('button', { className: 'e-split-colorpicker' });\n this.getWrapper().appendChild(splitButton);\n this.splitBtn = new SplitButton({\n iconCss: 'e-selected-color',\n target: this.container,\n disabled: this.disabled,\n enableRtl: this.enableRtl,\n beforeOpen: this.beforeOpenFn.bind(this),\n open: this.onOpen.bind(this),\n beforeClose: this.popupClose.bind(this),\n click: function (args) {\n _this.trigger('change', {\n currentValue: { hex: _this.value.slice(0, 7), rgba: _this.convertToRgbString(_this.hexToRgb(_this.value)) },\n previousValue: { hex: null, rgba: null }\n });\n }\n }, splitButton);\n var preview = createElement('span', { className: SPLITPREVIEW });\n select('.e-selected-color', splitButton).appendChild(preview);\n preview.style.backgroundColor = this.convertToRgbString(this.hexToRgb(this.value));\n var popupEle = this.getPopupEle();\n addClass([popupEle], 'e-colorpicker-popup');\n if (this.cssClass) {\n addClass([popupEle], this.cssClass.split(' '));\n }\n if (Browser.isDevice) {\n var popupInst = this.getPopupInst();\n popupInst.relateTo = document.body;\n popupInst.position = { X: 'center', Y: 'center' };\n popupInst.targetType = 'container';\n popupInst.collision = { X: 'fit', Y: 'fit' };\n popupInst.offsetY = 4;\n }\n };\n ColorPicker.prototype.onOpen = function (args) {\n this.trigger('open', { element: this.container });\n };\n ColorPicker.prototype.getPopupInst = function () {\n return getInstance(this.getPopupEle(), Popup);\n };\n ColorPicker.prototype.beforeOpenFn = function (args) {\n var beforeOpenArgs = { element: this.container, event: args.event, cancel: false };\n this.trigger('beforeOpen', beforeOpenArgs);\n args.cancel = beforeOpenArgs.cancel;\n if (!beforeOpenArgs.cancel) {\n var popupEle = this.getPopupEle();\n popupEle.style.display = 'block';\n this.createWidget();\n popupEle.style.display = '';\n if (Browser.isDevice) {\n this.modal = createElement('div');\n this.modal.className = 'e-' + this.getModuleName() + ' e-modal';\n this.modal.style.display = 'none';\n document.body.insertBefore(this.modal, popupEle);\n document.body.className += ' e-colorpicker-overflow';\n this.modal.style.display = 'block';\n }\n }\n };\n ColorPicker.prototype.popupClose = function (args) {\n var beforeCloseArgs = { element: this.container, event: args.event, cancel: false };\n this.trigger('beforeClose', beforeCloseArgs);\n args.cancel = beforeCloseArgs.cancel;\n if (!beforeCloseArgs.cancel) {\n if (args.event && Browser.isDevice && args.event.target === this.modal) {\n args.cancel = true;\n }\n else {\n this.unWireEvents();\n this.destroyOtherComp();\n this.container.style.width = '';\n select('.' + SPLITPREVIEW, this.splitBtn.element).style.backgroundColor\n = this.convertToRgbString(this.hexToRgb(this.value));\n this.container.innerHTML = '';\n removeClass([this.container], [PICKERCONTENT, PALETTECONTENT]);\n if (Browser.isDevice && this.modal) {\n removeClass([document.body], 'e-colorpicker-overflow');\n this.modal.style.display = 'none';\n this.modal.outerHTML = '';\n this.modal = null;\n }\n }\n }\n };\n ColorPicker.prototype.createPalette = function () {\n classList(this.container, [PALETTECONTENT], [PICKERCONTENT]);\n if (this.presetColors) {\n var paletteGroup = createElement('div', { className: 'e-custom-palette' });\n this.appendElement(paletteGroup);\n var keys = Object.keys(this.presetColors);\n if (keys.length === 1) {\n this.appendPalette(this.presetColors[keys[0]], keys[0], paletteGroup);\n }\n else {\n for (var i = 0, len = keys.length; i < len; i++) {\n this.appendPalette(this.presetColors[keys[i]], keys[i], paletteGroup);\n }\n }\n if (selectAll('.e-row', paletteGroup).length > 10) {\n addClass([paletteGroup], 'e-palette-group');\n }\n }\n else {\n this.appendPalette(presets.default, 'default');\n }\n if (this.mode === 'Palette' && !this.modeSwitcher && this.noColor) {\n this.setNoColor();\n }\n var width = parseInt(getComputedStyle(this.container).borderBottomWidth, 10);\n this.container.style.width = formatUnit(this.container.children[0].offsetWidth + width + width);\n this.rgb = this.hexToRgb(this.roundValue(this.value));\n this.hsv = this.rgbToHsv.apply(this, this.rgb);\n };\n ColorPicker.prototype.firstPaletteFocus = function () {\n if (!select('.' + SELECT, this.container.children[0])) {\n selectAll('.' + PALETTES, this.container)[0].focus();\n }\n };\n ColorPicker.prototype.appendPalette = function (colors, key, refEle) {\n var palette = createElement('div', { className: PALETTES, attrs: { 'tabindex': '0' } });\n if (refEle) {\n refEle.appendChild(palette);\n }\n else {\n this.appendElement(palette);\n }\n var row;\n var tile;\n for (var i = 0, len = colors.length; i < len; i++) {\n if (i === 0 || i % this.columns === 0) {\n row = createElement('div', {\n className: 'e-row', attrs: { 'role': 'row' }\n });\n palette.appendChild(row);\n }\n tile = createElement('span', {\n className: TILE, attrs: { 'role': 'gridcell', 'aria-label': colors[i], 'aria-selected': 'false' }\n });\n this.trigger('beforeTileRender', { element: tile, presetName: key, value: colors[i] });\n row.appendChild(tile);\n if (this.value.slice(0, colors[i].length).toLowerCase() === colors[i].toLowerCase()) {\n this.addTileSelection(tile);\n palette.focus();\n }\n tile.style.backgroundColor = colors[i];\n }\n };\n ColorPicker.prototype.setNoColor = function () {\n var noColorEle = selectAll('.e-row')[0].children[0];\n noColorEle.classList.add(NOCOLOR);\n if (!this.value) {\n noColorEle.classList.add(SELECT);\n closest(noColorEle, '.' + PALETTES).focus();\n }\n ['aria-selected', 'aria-label'].forEach(function (attr) { noColorEle.removeAttribute(attr); });\n noColorEle.style.backgroundColor = '';\n };\n ColorPicker.prototype.appendElement = function (ele, insertPos) {\n if (insertPos === void 0) { insertPos = 0; }\n var refEle = this.container.children[insertPos];\n refEle ? this.container.insertBefore(ele, refEle) : this.container.appendChild(ele);\n };\n ColorPicker.prototype.addTileSelection = function (ele) {\n ele.classList.add(SELECT);\n ele.setAttribute('aria-selected', 'true');\n };\n ColorPicker.prototype.createPicker = function () {\n classList(this.container, [PICKERCONTENT], [PALETTECONTENT]);\n var hsvContainer = createElement('div', { className: HSVCONTAINER });\n this.appendElement(hsvContainer);\n hsvContainer.appendChild(createElement('div', { className: HSVAREA }));\n var dragHandler = createElement('span', { className: HANDLER, attrs: { 'tabindex': '0' } });\n hsvContainer.appendChild(dragHandler);\n this.rgb = this.hexToRgb(this.value);\n this.hsv = this.rgbToHsv.apply(this, this.rgb);\n this.setHsvContainerBg();\n this.setHandlerPosition();\n this.createSlider();\n this.createDragTooltip();\n };\n ColorPicker.prototype.setHsvContainerBg = function (h) {\n if (h === void 0) { h = this.hsv[0]; }\n this.getHsvContainer().style.backgroundColor = this.convertToRgbString(this.hsvToRgb(h, 100, 100, 1));\n };\n ColorPicker.prototype.getHsvContainer = function () {\n return select('.' + HSVCONTAINER, this.container);\n };\n ColorPicker.prototype.setHandlerPosition = function () {\n var dragHandler = this.getDragHandler();\n var hsvArea = select('.' + HSVAREA, this.container);\n if (this.enableRtl) {\n dragHandler.style.left = formatUnit(hsvArea.offsetWidth * Math.abs(100 - this.hsv[1]) / 100);\n }\n else {\n dragHandler.style.left = formatUnit(hsvArea.offsetWidth * this.hsv[1] / 100);\n }\n dragHandler.style.top = formatUnit(hsvArea.offsetHeight * (100 - this.hsv[2]) / 100);\n };\n ColorPicker.prototype.createSlider = function () {\n var sliderPreviewWrapper = createElement('div', { className: 'e-slider-preview' });\n this.appendElement(sliderPreviewWrapper, 1);\n this.createPreview(sliderPreviewWrapper);\n var sliderWrapper = createElement('div', { className: 'e-colorpicker-slider' });\n sliderPreviewWrapper.insertBefore(sliderWrapper, sliderPreviewWrapper.children[0]);\n var slider = createElement('div', { className: 'e-hue-slider' });\n sliderWrapper.appendChild(slider);\n this.hueSlider = new Slider({\n value: this.hsv[0],\n min: 0,\n max: 359,\n enableRtl: this.enableRtl,\n enabled: !this.disabled,\n change: this.hueChange.bind(this)\n }, slider);\n slider = createElement('div', { className: 'e-opacity-slider' });\n sliderWrapper.appendChild(slider);\n this.opacitySlider = new Slider({\n value: this.rgb[3] * 100,\n min: 0,\n max: 100,\n enableRtl: this.enableRtl,\n enabled: !this.disabled,\n change: this.opacityChange.bind(this)\n }, slider);\n var opacityBgTrack = createElement('div', { className: 'e-opacity-empty-track' });\n slider.appendChild(opacityBgTrack);\n this.updateOpacitySliderBg();\n };\n ColorPicker.prototype.updateOpacitySliderBg = function () {\n var direction = this.enableRtl ? 'to left' : 'to right';\n select('.e-slider-track', this.opacitySlider.element).style.background =\n 'linear-gradient(' + direction + ', rgba(' + this.rgb.slice(0, 3) + ', 0) 0%, ' +\n this.convertToRgbString(this.rgb.slice(0, 3)) + ' 100%)';\n };\n ColorPicker.prototype.hueChange = function (args) {\n this.hsv[0] = args.value;\n this.setHsvContainerBg();\n this.convertToOtherFormat();\n };\n ColorPicker.prototype.opacityChange = function (args) {\n var value = args.value;\n var pValue = this.rgbToHex(this.rgb);\n this.hsv[3] = value / 100;\n this.rgb[3] = value / 100;\n var cValue = this.rgbToHex(this.rgb);\n if (!this.getWrapper().classList.contains('e-hide-value')) {\n getInstance(select('.e-opacity-value', this.container), NumericTextBox).value = value;\n }\n var rgb = this.convertToRgbString(this.rgb);\n this.updatePreview(rgb);\n this.triggerEvent(cValue, pValue, rgb);\n };\n ColorPicker.prototype.createPreview = function (parentEle) {\n var previewContainer = createElement('div', { className: PREVIEW });\n parentEle.appendChild(previewContainer);\n var preview = createElement('span', { className: 'e-preview ' + CURRENT });\n previewContainer.appendChild(preview);\n var colorValue = this.convertToRgbString(this.rgb);\n preview.style.backgroundColor = colorValue;\n preview = createElement('span', { className: 'e-preview ' + PREVIOUS });\n previewContainer.appendChild(preview);\n preview.style.backgroundColor = colorValue;\n };\n ColorPicker.prototype.isPicker = function () {\n return !this.container.classList.contains(PALETTECONTENT);\n };\n ColorPicker.prototype.getPopupEle = function () {\n return this.container.parentElement;\n };\n ColorPicker.prototype.getNumericTextBoxModel = function (value, label, max) {\n var _this = this;\n return {\n value: value,\n placeholder: label,\n min: 0,\n max: max,\n format: '###.##',\n showSpinButton: false,\n floatLabelType: 'Always',\n enableRtl: this.enableRtl,\n enabled: !this.disabled,\n readonly: this.isPicker() ? false : true,\n change: function (args) {\n if (args.event) {\n _this.inputHandler(args.event);\n }\n }\n };\n };\n ColorPicker.prototype.createInput = function (child) {\n if (child === void 0) { child = 2; }\n var inputWrap = createElement('div', { className: INPUTWRAPPER });\n this.appendElement(inputWrap, child);\n var container = createElement('div', { className: 'e-input-container' });\n inputWrap.appendChild(container);\n inputWrap.appendChild(createElement('button', { className: 'e-icons e-btn e-flat e-icon-btn ' + FORMATSWITCH + ' ' + TOHSV }));\n var hexInput = createElement('input', {\n className: HEX,\n attrs: { 'maxlength': '7', 'spellcheck': 'false' }\n });\n if (!this.isPicker()) {\n Input.setReadonly(true, hexInput);\n }\n container.appendChild(hexInput);\n Input.createInput({\n element: hexInput,\n floatLabelType: 'Always',\n properties: {\n placeholder: 'HEX',\n enableRtl: this.enableRtl,\n enabled: !this.disabled\n }\n });\n Input.setValue(this.value.slice(0, 7), hexInput);\n var numericInput;\n var label = 'RGB';\n var clsName = ['rh', 'gs', 'bv'];\n for (var i = 0; i < 3; i++) {\n numericInput = new NumericTextBox(this.getNumericTextBoxModel(this.rgb[i], label[i], 255), container.appendChild(createElement('input', { className: 'e-' + clsName[i] + '-value' })));\n }\n numericInput = new NumericTextBox(this.getNumericTextBoxModel(this.rgb[3] * 100, 'A', 100), container.appendChild(createElement('input', { className: 'e-opacity-value' })));\n };\n ColorPicker.prototype.createCtrlBtn = function () {\n if (this.modeSwitcher || this.showButtons) {\n this.l10n.setLocale(this.locale);\n var btnWrapper = createElement('div', { className: CTRLSWITCH });\n this.container.appendChild(btnWrapper);\n if (this.showButtons) {\n var controlBtnWrapper = createElement('div', { className: CTRLBTN });\n btnWrapper.appendChild(controlBtnWrapper);\n var apply = this.l10n.getConstant('Apply');\n controlBtnWrapper.appendChild(createElement('button', {\n innerHTML: apply,\n className: 'e-btn e-flat e-primary e-small ' + APPLY,\n attrs: { 'title': apply }\n }));\n var cancel = this.l10n.getConstant('Cancel');\n controlBtnWrapper.appendChild(createElement('button', {\n innerHTML: cancel,\n className: 'e-btn e-flat e-small ' + CANCEL,\n attrs: { 'title': cancel }\n }));\n }\n if (this.modeSwitcher) {\n this.appendModeSwitchBtn();\n }\n }\n };\n ColorPicker.prototype.appendModeSwitchBtn = function () {\n var modeSwitcher = createElement('button', {\n className: 'e-icons e-btn e-flat e-icon-btn ' + MODESWITCH, attrs: { title: this.l10n.getConstant('ModeSwitcher') }\n });\n select('.' + CTRLSWITCH, this.container).insertBefore(modeSwitcher, select('.' + CTRLBTN, this.container));\n };\n ColorPicker.prototype.createDragTooltip = function () {\n var _this = this;\n var tooltip = new Tooltip({\n opensOn: 'Custom',\n showTipPointer: false,\n cssClass: 'e-color-picker-tooltip',\n beforeOpen: function (args) {\n _this.tooltipEle = args.element;\n },\n animation: { open: { effect: 'None' }, close: { effect: 'None' } }\n });\n tooltip.appendTo(this.container);\n tooltip.open(this.container);\n this.tooltipEle.style.zIndex = getZindexPartial(this.tooltipEle).toString();\n select('.e-tip-content', this.tooltipEle).appendChild(createElement('div', { className: 'e-tip-transparent' }));\n };\n ColorPicker.prototype.getTooltipInst = function () {\n return getInstance(this.container, Tooltip);\n };\n ColorPicker.prototype.setTooltipOffset = function (value) {\n this.getTooltipInst().offsetY = value;\n };\n ColorPicker.prototype.toggleDisabled = function (enable) {\n enable ? this.getWrapper().classList.add(DISABLED) : this.getWrapper().classList.remove(DISABLED);\n if (this.showButtons) {\n ([].slice.call(selectAll('.e-btn', this.container))).forEach(function (ele) {\n enable ? attributes(ele, { 'disabled': '' }) : ele.removeAttribute('disabled');\n });\n }\n };\n ColorPicker.prototype.convertToRgbString = function (rgb) {\n return rgb.length ? rgb.length === 4 ? 'rgba(' + rgb.join() + ')' : 'rgb(' + rgb.join() + ')' : '';\n };\n ColorPicker.prototype.convertToHsvString = function (hsv) {\n return hsv.length === 4 ? 'hsva(' + hsv.join() + ')' : 'hsv(' + hsv.join() + ')';\n };\n ColorPicker.prototype.updateHsv = function () {\n this.hsv[1] = this.hsv[1] > 100 ? 100 : this.hsv[1];\n this.hsv[2] = this.hsv[2] > 100 ? 100 : this.hsv[2];\n this.setHandlerPosition();\n };\n ColorPicker.prototype.convertToOtherFormat = function (isKey) {\n if (isKey === void 0) { isKey = false; }\n var pValue = this.rgbToHex(this.rgb);\n this.rgb = this.hsvToRgb.apply(this, this.hsv);\n var cValue = this.rgbToHex(this.rgb);\n var rgba = this.convertToRgbString(this.rgb);\n this.updatePreview(rgba);\n this.updateInput(cValue);\n this.triggerEvent(cValue, pValue, rgba, isKey);\n };\n ColorPicker.prototype.updateInput = function (value) {\n if (!this.getWrapper().classList.contains('e-hide-value')) {\n Input.setValue(value.substr(0, 7), select('.' + HEX, this.container));\n if (select('.' + FORMATSWITCH, this.container).classList.contains(TOHSV)) {\n this.updateValue(this.rgb, false);\n }\n else {\n this.updateValue(this.hsv, false);\n }\n }\n };\n ColorPicker.prototype.updatePreview = function (value) {\n this.updateOpacitySliderBg();\n select('.e-tip-transparent', this.tooltipEle).style.backgroundColor = value;\n select('.' + PREVIEW + ' .' + CURRENT, this.container).style.backgroundColor = value;\n select('.' + PREVIEW + ' .' + PREVIOUS, this.container).style.backgroundColor\n = this.convertToRgbString(this.hexToRgb(this.value));\n };\n ColorPicker.prototype.getDragHandler = function () {\n return select('.' + HANDLER, this.container);\n };\n ColorPicker.prototype.removeTileSelection = function () {\n var selectedEle = [].slice.call(selectAll('.' + SELECT, this.container.children[0]));\n selectedEle.forEach(function (ele) {\n ele.classList.remove(SELECT);\n ele.setAttribute('aria-selected', 'false');\n });\n };\n ColorPicker.prototype.convertRgbToNumberArray = function (value) {\n return (value.slice(value.indexOf('(') + 1, value.indexOf(')'))).split(',').map(function (n, i) {\n return (i !== 3) ? parseInt(n, 10) : parseFloat(n);\n });\n };\n /**\n * To get color value in specified type.\n * @param value - Specify the color value.\n * @param type - Specify the converted color value type.\n * @method getValue\n * @return {string}\n */\n ColorPicker.prototype.getValue = function (value, type) {\n if (!value) {\n value = this.value;\n }\n type = !type ? 'hex' : type.toLowerCase();\n if (value[0] === 'r') {\n var cValue = this.convertRgbToNumberArray(value);\n if (type === 'hex' || type === 'hexa') {\n var hex = this.rgbToHex(cValue);\n return type === 'hex' ? hex.slice(0, 7) : hex;\n }\n else {\n if (type === 'hsv') {\n return this.convertToHsvString(this.rgbToHsv.apply(this, cValue.slice(0, 3)));\n }\n else {\n if (type === 'hsva') {\n return this.convertToHsvString(this.rgbToHsv.apply(this, cValue));\n }\n else {\n return 'null';\n }\n }\n }\n }\n else {\n if (value[0] === 'h') {\n var cValue = this.hsvToRgb.apply(this, this.convertRgbToNumberArray(value));\n if (type === 'rgba') {\n return this.convertToRgbString(cValue);\n }\n else {\n if (type === 'hex' || type === 'hexa') {\n var hex = this.rgbToHex(cValue);\n return type === 'hex' ? hex.slice(0, 7) : hex;\n }\n else {\n if (type === 'rgb') {\n return this.convertToRgbString(cValue.slice(0, 3));\n }\n else {\n return 'null';\n }\n }\n }\n }\n else {\n value = this.roundValue(value);\n var rgb = this.hexToRgb(value);\n if (type === 'rgb' || type === 'hsv') {\n rgb = rgb.slice(0, 3);\n }\n if (type === 'rgba' || type === 'rgb') {\n return this.convertToRgbString(rgb);\n }\n else {\n if (type === 'hsva' || type === 'hsv') {\n return this.convertToHsvString(this.rgbToHsv.apply(this, rgb));\n }\n else {\n if (type === 'hex') {\n return value.slice(0, 7);\n }\n else {\n if (type === 'a') {\n return rgb[3].toString();\n }\n else {\n return 'null';\n }\n }\n }\n }\n }\n }\n };\n /**\n * To show/hide ColorPicker popup based on current state of the SplitButton.\n * @method toggle\n * @return {void}\n */\n ColorPicker.prototype.toggle = function () {\n this.splitBtn.toggle();\n };\n /**\n * Get component name.\n * @returns string\n * @private\n */\n ColorPicker.prototype.getModuleName = function () {\n return 'colorpicker';\n };\n /**\n * Gets the properties to be maintained in the persisted state.\n * @return {string}\n */\n ColorPicker.prototype.getPersistData = function () {\n return this.addOnPersist(['value']);\n };\n ColorPicker.prototype.wireEvents = function () {\n if (this.isPicker()) {\n var dragHandler = this.getDragHandler();\n EventHandler.add(dragHandler, 'keydown', this.pickerKeyDown, this);\n EventHandler.add(this.getHsvContainer(), 'mousedown touchstart', this.handlerDown, this);\n if (this.modeSwitcher || this.showButtons) {\n this.addCtrlSwitchEvent();\n }\n if (!this.getWrapper().classList.contains('e-hide-value')) {\n this.addvalueEventHandler();\n }\n EventHandler.add(select('.' + PREVIOUS, this.container), 'click', this.previewHandler, this);\n }\n else {\n EventHandler.add(this.container, 'click', this.paletteClickHandler, this);\n EventHandler.add(this.container, 'keydown', this.paletteKeyDown, this);\n }\n };\n ColorPicker.prototype.addCtrlSwitchEvent = function () {\n EventHandler.add(select('.' + CTRLSWITCH, this.container), 'click', this.btnClickHandler, this);\n };\n ColorPicker.prototype.addInputEvent = function () {\n EventHandler.add(select('.' + HEX, this.container), 'input', this.inputHandler, this);\n };\n ColorPicker.prototype.addvalueEventHandler = function () {\n this.addInputEvent();\n EventHandler.add(select('.' + FORMATSWITCH, this.container), 'click', this.formatSwitchHandler, this);\n };\n ColorPicker.prototype.pickerKeyDown = function (e) {\n switch (e.keyCode) {\n case 39:\n this.handlerDragPosition(1, this.enableRtl ? -1 : 1, e);\n break;\n case 37:\n this.handlerDragPosition(1, this.enableRtl ? 1 : -1, e);\n break;\n case 38:\n this.handlerDragPosition(2, 1, e);\n break;\n case 40:\n this.handlerDragPosition(2, -1, e);\n break;\n case 13:\n e.preventDefault();\n var cValue = this.rgbToHex(this.rgb);\n this.enterKeyHandler(cValue);\n }\n };\n ColorPicker.prototype.enterKeyHandler = function (value) {\n this.triggerChangeEvent(value);\n if (!this.inline) {\n this.toggle();\n this.splitBtn.element.focus();\n }\n };\n ColorPicker.prototype.triggerChangeEvent = function (value) {\n var hex = value.slice(0, 7);\n this.trigger('change', {\n currentValue: { hex: hex, rgba: this.convertToRgbString(this.rgb) },\n previousValue: { hex: this.value.slice(0, 7), rgba: this.convertToRgbString(this.hexToRgb(this.value)) }\n });\n this.setProperties({ 'value': value }, true);\n this.element.value = hex ? hex : '#000000';\n };\n ColorPicker.prototype.handlerDragPosition = function (prob, value, e) {\n e.preventDefault();\n this.hsv[prob] += value * (e.ctrlKey ? 1 : 3);\n if (this.hsv[prob] < 0) {\n this.hsv[prob] = 0;\n }\n this.updateHsv();\n this.convertToOtherFormat(true);\n };\n ColorPicker.prototype.handlerDown = function (e) {\n if (e.type !== 'touchstart') {\n e.preventDefault();\n }\n var x;\n var y;\n if (e.type === 'mousedown') {\n this.clientX = Math.abs(e.pageX - pageXOffset);\n this.clientY = Math.abs(e.pageY - pageYOffset);\n this.setTooltipOffset(8);\n }\n else {\n this.clientX = Math.abs(e.changedTouches[0].pageX - pageXOffset);\n this.clientY = Math.abs(e.changedTouches[0].pageY - pageYOffset);\n this.setTooltipOffset(-8);\n }\n this.setHsv(this.clientX, this.clientY);\n this.getDragHandler().style.transition = 'left .4s cubic-bezier(.25, .8, .25, 1), top .4s cubic-bezier(.25, .8, .25, 1)';\n this.updateHsv();\n this.convertToOtherFormat();\n this.getDragHandler().focus();\n EventHandler.add(document, 'mousemove touchmove', this.handlerMove, this);\n EventHandler.add(document, 'mouseup touchend', this.handlerEnd, this);\n };\n ColorPicker.prototype.handlerMove = function (e) {\n if (e.type !== 'touchmove') {\n e.preventDefault();\n }\n var x;\n var y;\n if (e.type === 'mousemove') {\n x = Math.abs(e.pageX - pageXOffset);\n y = Math.abs(e.pageY - pageYOffset);\n }\n else {\n x = Math.abs(e.changedTouches[0].pageX - pageXOffset);\n y = Math.abs(e.changedTouches[0].pageY - pageYOffset);\n }\n this.setHsv(x, y);\n var dragHandler = this.getDragHandler();\n var left = parseInt(dragHandler.style.left, 10);\n var top = parseInt(dragHandler.style.top, 10);\n this.updateHsv();\n this.convertToOtherFormat();\n this.getTooltipInst().refresh(dragHandler);\n if (!this.tooltipEle.style.transform) {\n if (Math.abs(this.clientX - x) > 8 || Math.abs(this.clientY - y) > 8) {\n select('.' + HSVAREA, this.container).style.cursor = 'pointer';\n dragHandler.style.transition = 'none';\n if (!this.inline) {\n this.tooltipEle.style.zIndex = (parseInt(this.getPopupEle().style.zIndex, 10) + 1).toString();\n }\n this.tooltipEle.style.transform = 'rotate(45deg)';\n dragHandler.classList.add('e-hide-handler');\n }\n }\n };\n ColorPicker.prototype.setHsv = function (clientX, clientY) {\n var ele = select('.' + HSVAREA, this.container);\n var position = ele.getBoundingClientRect();\n if (this.enableRtl) {\n clientX = clientX > position.right ? 0 : Math.abs(clientX - position.right);\n }\n else {\n clientX = clientX > position.left ? Math.abs(clientX - position.left) : 0;\n }\n clientY = clientY > position.top ? Math.abs(clientY - position.top) : 0;\n this.hsv[2] = Math.round(Number(100 * (ele.offsetHeight -\n Math.max(0, Math.min(ele.offsetHeight, (clientY - ele.offsetTop)))) / ele.offsetHeight) * 10) / 10;\n this.hsv[1] =\n Math.round(Number(100 * (Math.max(0, Math.min(ele.offsetWidth, (clientX - ele.offsetLeft)))) / ele.offsetWidth) * 10) / 10;\n };\n ColorPicker.prototype.handlerEnd = function (e) {\n if (e.type !== 'touchend') {\n e.preventDefault();\n }\n EventHandler.remove(document, 'mousemove touchmove', this.handlerMove);\n EventHandler.remove(document, 'mouseup touchend', this.handlerEnd);\n var dragHandler = this.getDragHandler();\n select('.' + HSVAREA, this.container).style.cursor = '';\n if (this.tooltipEle.style.transform) {\n this.tooltipEle.style.transform = '';\n dragHandler.classList.remove('e-hide-handler');\n }\n if (!this.inline && !this.showButtons) {\n this.toggle();\n }\n };\n ColorPicker.prototype.btnClickHandler = function (e) {\n var target = e.target;\n if (closest(target, '.' + MODESWITCH)) {\n e.stopPropagation();\n this.switchToPalette();\n }\n else {\n if (target.classList.contains(APPLY) || target.classList.contains(CANCEL)) {\n this.ctrlBtnClick(target);\n }\n }\n };\n ColorPicker.prototype.switchToPalette = function () {\n this.trigger('beforeModeSwitch', { element: this.container, mode: 'Palette' });\n this.unWireEvents();\n this.destroyOtherComp();\n detach(select('.e-slider-preview', this.container));\n if (!this.getWrapper().classList.contains('e-hide-value')) {\n detach(select('.' + INPUTWRAPPER, this.container));\n }\n detach(this.getHsvContainer());\n this.createPalette();\n this.firstPaletteFocus();\n if (this.getWrapper().classList.contains('e-show-value')) {\n this.createInput(1);\n }\n this.refreshPopupPos();\n this.wireEvents();\n };\n ColorPicker.prototype.refreshPopupPos = function () {\n if (!this.inline) {\n var popupEle = this.getPopupEle();\n popupEle.style.left = '0px';\n popupEle.style.top = '0px';\n this.getPopupInst().refreshPosition(this.splitBtn.element.parentElement);\n }\n };\n ColorPicker.prototype.formatSwitchHandler = function (e) {\n var target = e.target;\n if (target.classList.contains(TOHSV)) {\n this.updateValue(this.hsv, true, 3, [360, 100, 100]);\n target.classList.remove(TOHSV);\n }\n else {\n this.updateValue(this.rgb, true, 2);\n target.classList.add(TOHSV);\n }\n };\n ColorPicker.prototype.updateValue = function (value, format, idx, max) {\n var clsName = ['e-rh-value', 'e-gs-value', 'e-bv-value'];\n var inst;\n for (var i = 0, len = clsName.length; i < len; i++) {\n inst = getInstance(select('.' + clsName[i], this.container), NumericTextBox);\n inst.value = Math.round(value[i]);\n if (format) {\n inst.placeholder = clsName[i].substr(idx, 1).toUpperCase();\n inst.max = max ? max[i] : 255;\n }\n inst.dataBind();\n }\n };\n ColorPicker.prototype.previewHandler = function (e) {\n var target = e.target;\n var pValue = this.rgbToHex(this.rgb);\n this.rgb = this.convertRgbToNumberArray(target.style.backgroundColor);\n if (!this.rgb[3]) {\n this.rgb[3] = 1;\n }\n var cValue = this.rgbToHex(this.rgb);\n var hsv = this.rgbToHsv.apply(this, this.rgb);\n if (hsv[0] !== this.hsv[0]) {\n this.hueSlider.setProperties({ 'value': hsv[0] }, true);\n this.hueSlider.refresh();\n }\n this.setHsvContainerBg(hsv[0]);\n if (hsv[3] !== this.hsv[3]) {\n this.opacitySlider.setProperties({ 'value': hsv[3] * 100 }, true);\n this.opacitySlider.refresh();\n }\n this.updateOpacitySliderBg();\n this.hsv = hsv;\n this.setHandlerPosition();\n this.updateInput(cValue);\n select('.' + PREVIEW + ' .' + CURRENT, this.container).style.backgroundColor = this.convertToRgbString(this.rgb);\n this.triggerEvent(cValue, pValue, this.convertToRgbString(this.rgb));\n };\n ColorPicker.prototype.paletteClickHandler = function (e) {\n e.preventDefault();\n var target = e.target;\n if (target.classList.contains(TILE)) {\n this.removeTileSelection();\n this.addTileSelection(target);\n if (target.classList.contains(NOCOLOR)) {\n this.noColorTile();\n }\n else {\n var cValue = target.getAttribute('aria-label');\n var pValue = this.rgbToHex(this.rgb);\n this.rgb = this.hexToRgb(this.roundValue(cValue));\n this.hsv = this.rgbToHsv.apply(this, this.rgb);\n if (this.getWrapper().classList.contains('e-show-value')) {\n this.updateInput(cValue);\n }\n this.triggerEvent(cValue, pValue, this.convertToRgbString(this.rgb));\n }\n if (!this.inline && !this.showButtons) {\n this.toggle();\n }\n }\n else {\n if (closest(target, '.' + MODESWITCH)) {\n this.switchToPicker();\n }\n else {\n if (target.classList.contains(APPLY) || target.classList.contains(CANCEL)) {\n this.ctrlBtnClick(target);\n }\n else {\n if (this.getWrapper().classList.contains('e-show-value') && closest(target, '.' + FORMATSWITCH)) {\n this.formatSwitchHandler(e);\n }\n }\n }\n }\n };\n ColorPicker.prototype.noColorTile = function (isKey) {\n if (isKey === void 0) { isKey = false; }\n var pValue = this.rgbToHex(this.rgb);\n this.rgb = [];\n this.hsv = [];\n this.triggerEvent('', pValue, '', isKey);\n };\n ColorPicker.prototype.switchToPicker = function () {\n var wrapper = this.getWrapper();\n this.trigger('beforeModeSwitch', { element: this.container, mode: 'Picker' });\n this.unWireEvents();\n ([].slice.call(selectAll('.' + PALETTES, this.container))).forEach(function (ele) {\n detach(ele);\n });\n if (wrapper.classList.contains('e-show-value')) {\n detach(select('.' + INPUTWRAPPER, this.container));\n }\n this.container.style.width = '';\n var grpEle = select('.e-custom-palette', this.container);\n if (this.presetColors) {\n remove(grpEle);\n }\n this.createPicker();\n this.getDragHandler().focus();\n if (!wrapper.classList.contains('e-hide-value')) {\n this.createInput();\n }\n this.refreshPopupPos();\n this.wireEvents();\n };\n ColorPicker.prototype.ctrlBtnClick = function (ele) {\n if (ele.classList.contains(APPLY)) {\n var cValue = this.rgbToHex(this.rgb);\n this.triggerChangeEvent(cValue);\n }\n if (!this.inline) {\n this.toggle();\n this.splitBtn.element.focus();\n }\n };\n ColorPicker.prototype.paletteKeyDown = function (e) {\n var target = e.target;\n if (!target.classList.contains(PALETTES)) {\n return;\n }\n var selectedEle;\n var idx;\n var tiles = [].slice.call(selectAll('.' + TILE, target));\n var prevSelectedEle = (tiles.filter(function (tile) { return tile.classList.contains('e-selected'); })).pop();\n switch (!e.altKey && e.keyCode) {\n case 39:\n e.preventDefault();\n selectedEle = prevSelectedEle ? tiles[this.tilePosition(tiles, prevSelectedEle, this.enableRtl ? -1 : 1)]\n : tiles[this.enableRtl ? tiles.length - 1 : 0];\n this.keySelectionChanges(selectedEle);\n break;\n case 37:\n e.preventDefault();\n selectedEle = prevSelectedEle ? tiles[this.tilePosition(tiles, prevSelectedEle, this.enableRtl ? 1 : -1)]\n : tiles[this.enableRtl ? 0 : tiles.length - 1];\n this.keySelectionChanges(selectedEle);\n break;\n case 38:\n e.preventDefault();\n idx = prevSelectedEle ? this.tilePosition(tiles, prevSelectedEle, -this.columns) : 0;\n selectedEle = tiles[idx] ? tiles[idx] : tiles[idx - this.columns];\n this.keySelectionChanges(selectedEle);\n break;\n case 40:\n e.preventDefault();\n idx = prevSelectedEle ? this.tilePosition(tiles, prevSelectedEle, this.columns) : tiles.length - 1;\n if (tiles[idx]) {\n selectedEle = tiles[idx];\n }\n else {\n idx %= tiles.length;\n idx += tiles[tiles.length - 1].parentElement.childElementCount;\n selectedEle = tiles[idx];\n }\n this.keySelectionChanges(selectedEle);\n break;\n case 13:\n e.preventDefault();\n if (prevSelectedEle) {\n var cValue = prevSelectedEle.getAttribute('aria-label');\n this.enterKeyHandler(cValue ? cValue : '');\n }\n }\n };\n ColorPicker.prototype.keySelectionChanges = function (newEle) {\n this.removeTileSelection();\n this.addTileSelection(newEle);\n if (newEle.classList.contains(NOCOLOR)) {\n this.noColorTile(true);\n }\n else {\n var cValue = newEle.getAttribute('aria-label');\n var pValue = this.rgbToHex(this.rgb);\n this.rgb = this.hexToRgb(cValue);\n this.hsv = this.rgbToHsv.apply(this, this.rgb);\n if (this.getWrapper().classList.contains('e-show-value')) {\n this.updateInput(cValue);\n }\n this.triggerEvent(cValue, pValue, this.convertToRgbString(this.rgb), true);\n }\n };\n ColorPicker.prototype.tilePosition = function (items, element, cIdx) {\n items = Array.prototype.slice.call(items);\n var n = items.length;\n var emptyCount = this.columns - items[n - 1].parentElement.childElementCount;\n var idx = items.indexOf(element);\n idx += cIdx;\n idx < 0 ? idx += n + emptyCount : idx %= n + emptyCount;\n return idx;\n };\n ColorPicker.prototype.inputHandler = function (e) {\n var target = e.target;\n if (!target.value.length) {\n return;\n }\n var hsv;\n var pValue;\n var label = select('.e-float-text', target.parentElement).textContent;\n switch (label) {\n case 'HEX':\n var value = '';\n if ((target.value[0] === '#' && target.value.length !== 5) || (target.value[0] !== '#' && target.value.length !== 4)) {\n value = this.roundValue(target.value);\n }\n if (value.length === 9) {\n pValue = this.rgbToHex(this.rgb);\n this.rgb = this.hexToRgb(value + value.substr(-2));\n this.inputValueChange(this.rgbToHsv.apply(this, this.rgb), pValue, target.value);\n }\n else {\n return;\n }\n break;\n case 'R':\n if (this.rgb[0] !== Number(target.value)) {\n pValue = this.rgbToHex(this.rgb);\n this.rgb[0] = Number(target.value);\n hsv = this.rgbToHsv.apply(this, this.rgb);\n this.inputValueChange(hsv, pValue);\n }\n break;\n case 'G':\n if (this.rgb[1] !== Number(target.value)) {\n pValue = this.rgbToHex(this.rgb);\n this.rgb[1] = Number(target.value);\n hsv = this.rgbToHsv.apply(this, this.rgb);\n this.inputValueChange(hsv, pValue);\n }\n break;\n case 'B':\n if (this.rgb[2] !== Number(target.value)) {\n pValue = this.rgbToHex(this.rgb);\n this.rgb[2] = Number(target.value);\n hsv = this.rgbToHsv.apply(this, this.rgb);\n this.inputValueChange(hsv, pValue);\n }\n break;\n case 'H':\n this.hueSlider.value = Number(target.value);\n break;\n case 'S':\n if (this.hsv[1] !== Number(target.value)) {\n this.hsv[1] = Number(target.value);\n this.updateHsv();\n this.convertToOtherFormat();\n }\n break;\n case 'V':\n if (this.hsv[2] !== Number(target.value)) {\n this.hsv[2] = Number(target.value);\n this.updateHsv();\n this.convertToOtherFormat();\n }\n break;\n case 'A':\n this.opacitySlider.value = Number(target.value);\n break;\n }\n };\n ColorPicker.prototype.inputValueChange = function (hsv, pValue, value) {\n if (hsv[0] !== this.hsv[0]) {\n this.hueSlider.setProperties({ 'value': hsv[0] }, true);\n this.hueSlider.refresh();\n this.setHsvContainerBg(hsv[0]);\n }\n this.hsv = hsv;\n var cValue = this.rgbToHex(this.rgb);\n this.setHandlerPosition();\n this.updateInput(value ? value : cValue);\n var rgba = this.convertToRgbString(this.rgb);\n this.updatePreview(rgba);\n this.triggerEvent(cValue, pValue, rgba);\n };\n ColorPicker.prototype.triggerEvent = function (cValue, pValue, rgba, isKey) {\n if (isKey === void 0) { isKey = false; }\n var hex = cValue.slice(0, 7);\n var eventArgs = {\n currentValue: { hex: hex, rgba: rgba },\n previousValue: { hex: pValue.slice(0, 7), rgba: this.convertToRgbString(this.hexToRgb(pValue)) }\n };\n if (!this.showButtons && !isKey) {\n eventArgs.previousValue = { hex: this.value.slice(0, 7), rgba: this.convertToRgbString(this.hexToRgb(this.value)) };\n this.trigger('change', eventArgs);\n this.setProperties({ 'value': cValue }, true);\n this.element.value = hex ? hex : '#000000';\n }\n else {\n this.trigger('select', eventArgs);\n }\n };\n /**\n * Removes the component from the DOM and detaches all its related event handlers.\n * Also it maintains the initial input element from the DOM.\n * @method destroy\n * @return {void}\n */\n ColorPicker.prototype.destroy = function () {\n var _this = this;\n var wrapper = this.getWrapper();\n _super.prototype.destroy.call(this);\n ['tabindex', 'spellcheck'].forEach(function (attr) { _this.element.removeAttribute(attr); });\n if (this.inline) {\n this.unWireEvents();\n this.destroyOtherComp();\n }\n else {\n if (this.isPopupOpen()) {\n this.unWireEvents();\n this.destroyOtherComp();\n }\n this.splitBtn.destroy();\n this.splitBtn = null;\n }\n this.tileRipple();\n this.tileRipple = null;\n this.ctrlBtnRipple();\n this.ctrlBtnRipple = null;\n detach(this.element.nextElementSibling);\n wrapper.parentElement.insertBefore(this.element, wrapper);\n detach(wrapper);\n this.container = null;\n };\n ColorPicker.prototype.destroyOtherComp = function () {\n if (this.isPicker()) {\n this.hueSlider.destroy();\n this.opacitySlider.destroy();\n this.hueSlider = null;\n this.opacitySlider = null;\n var tooltipInst = this.getTooltipInst();\n tooltipInst.close();\n tooltipInst.destroy();\n this.tooltipEle = null;\n }\n };\n ColorPicker.prototype.isPopupOpen = function () {\n return this.getPopupEle().classList.contains('e-popup-open');\n };\n ColorPicker.prototype.unWireEvents = function () {\n if (this.isPicker()) {\n var dragHandler = this.getDragHandler();\n EventHandler.remove(dragHandler, 'keydown', this.pickerKeyDown);\n EventHandler.remove(this.getHsvContainer(), 'mousedown touchstart', this.handlerDown);\n if (this.modeSwitcher || this.showButtons) {\n EventHandler.remove(select('.' + CTRLSWITCH, this.container), 'click', this.btnClickHandler);\n }\n if (!this.getWrapper().classList.contains('e-hide-value')) {\n EventHandler.remove(select('.' + FORMATSWITCH, this.container), 'click', this.formatSwitchHandler);\n EventHandler.remove(select('.' + HEX, this.container), 'input', this.inputHandler);\n }\n EventHandler.remove(select('.' + PREVIOUS, this.container), 'click', this.previewHandler);\n }\n else {\n EventHandler.remove(this.container, 'click', this.paletteClickHandler);\n EventHandler.remove(this.container, 'keydown', this.paletteKeyDown);\n }\n };\n ColorPicker.prototype.roundValue = function (value) {\n if (!value) {\n return '';\n }\n if (value[0] !== '#') {\n value = '#' + value;\n }\n var len = value.length;\n if (len === 4) {\n value += 'f';\n len = 5;\n }\n if (len === 5) {\n var tempValue = '';\n for (var i = 1, len_1 = value.length; i < len_1; i++) {\n tempValue += (value.charAt(i) + value.charAt(i));\n }\n value = '#' + tempValue;\n len = 9;\n }\n if (len === 7) {\n value += 'ff';\n }\n return value;\n };\n ColorPicker.prototype.hexToRgb = function (hex) {\n if (!hex) {\n return [];\n }\n hex = hex.trim();\n if (hex.length !== 9) {\n hex = this.roundValue(hex);\n }\n var opacity = Number((parseInt(hex.slice(-2), 16) / 255).toFixed(2));\n hex = hex.slice(1, 7);\n var bigInt = parseInt(hex, 16);\n var h = [];\n h.push((bigInt >> 16) & 255);\n h.push((bigInt >> 8) & 255);\n h.push(bigInt & 255);\n h.push(opacity);\n return h;\n };\n ColorPicker.prototype.rgbToHsv = function (r, g, b, opacity) {\n if (this.rgb && !this.rgb.length) {\n return [];\n }\n r /= 255;\n g /= 255;\n b /= 255;\n var max = Math.max(r, g, b);\n var min = Math.min(r, g, b);\n var h;\n var s;\n var v = max;\n var d = max - min;\n s = max === 0 ? 0 : d / max;\n if (max === min) {\n h = 0;\n }\n else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n var hsv = [Math.round(h * 360), Math.round(s * 1000) / 10, Math.round(v * 1000) / 10];\n if (!isNullOrUndefined(opacity)) {\n hsv.push(opacity);\n }\n return hsv;\n };\n ColorPicker.prototype.hsvToRgb = function (h, s, v, opacity) {\n var r;\n var g;\n var b;\n var i;\n var f;\n var p;\n var q;\n var t;\n s /= 100;\n v /= 100;\n if (s === 0) {\n r = g = b = v;\n return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), opacity];\n }\n h /= 60;\n i = Math.floor(h);\n f = h - i;\n p = v * (1 - s);\n q = v * (1 - s * f);\n t = v * (1 - s * (1 - f));\n switch (i) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n default:\n r = v;\n g = p;\n b = q;\n }\n var rgb = [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n if (!isNullOrUndefined(opacity)) {\n rgb.push(opacity);\n }\n return rgb;\n };\n ColorPicker.prototype.rgbToHex = function (rgb) {\n return rgb.length ? ('#' + this.hex(rgb[0]) + this.hex(rgb[1]) + this.hex(rgb[2]) +\n (!isNullOrUndefined(rgb[3]) ? (rgb[3] !== 0 ? (Math.round(rgb[3] * 255) + 0x10000).toString(16).substr(-2) : '00') : '')) : '';\n };\n ColorPicker.prototype.hex = function (x) {\n return ('0' + x.toString(16)).slice(-2);\n };\n ColorPicker.prototype.changeModeSwitcherProp = function (prop) {\n var ctrlSwitchWrapper = select('.' + CTRLSWITCH, this.container);\n if (prop) {\n if (ctrlSwitchWrapper) {\n this.appendModeSwitchBtn();\n }\n else {\n this.createCtrlBtn();\n if (this.isPicker() && !this.disabled) {\n this.addCtrlSwitchEvent();\n }\n }\n }\n else {\n if (ctrlSwitchWrapper) {\n if (this.showButtons) {\n detach(select('.' + MODESWITCH, ctrlSwitchWrapper));\n }\n else {\n remove(ctrlSwitchWrapper);\n }\n }\n }\n };\n ColorPicker.prototype.changeShowBtnProps = function (prop) {\n var ctrlBtnWrapper = select('.' + CTRLSWITCH, this.container);\n if (prop) {\n if (ctrlBtnWrapper) {\n remove(ctrlBtnWrapper);\n }\n this.createCtrlBtn();\n if (this.isPicker() && !this.disabled) {\n this.addCtrlSwitchEvent();\n }\n }\n else {\n if (this.modeSwitcher) {\n detach(select('.' + CTRLBTN, ctrlBtnWrapper));\n }\n else {\n remove(ctrlBtnWrapper);\n }\n }\n };\n ColorPicker.prototype.changeValueProp = function (newProp) {\n if (this.isPicker()) {\n this.rgb = this.hexToRgb(newProp);\n this.hsv = this.rgbToHsv.apply(this, this.rgb);\n this.setHandlerPosition();\n detach(closest(this.hueSlider.element, '.e-slider-preview'));\n this.createSlider();\n this.setHsvContainerBg();\n this.updateOpacitySliderBg();\n this.updateInput(newProp);\n }\n else {\n this.removeTileSelection();\n this.addTileSelection(select('span[aria-label=\"' + newProp + '\"]', this.container));\n }\n this.element.value = newProp.slice(0, 7);\n };\n ColorPicker.prototype.setInputEleProps = function (prop) {\n remove(select('.' + INPUTWRAPPER, this.container));\n this.createInput();\n };\n ColorPicker.prototype.changeDisabledProp = function (newProp) {\n if (this.isPicker()) {\n this.hueSlider.enabled = !newProp;\n this.opacitySlider.enabled = !newProp;\n this.setInputEleProps(newProp);\n }\n if (newProp) {\n this.toggleDisabled(true);\n this.unWireEvents();\n }\n else {\n this.toggleDisabled(false);\n this.wireEvents();\n }\n };\n ColorPicker.prototype.changeCssClassProps = function (newProp, oldProp) {\n var wrapper = this.getWrapper();\n var popupWrapper = this.getPopupEle();\n if (oldProp) {\n removeClass([wrapper, popupWrapper], oldProp.split(' '));\n }\n if (newProp) {\n addClass([wrapper, popupWrapper], newProp.split(' '));\n }\n };\n ColorPicker.prototype.changeRtlProps = function (newProp) {\n if (newProp) {\n addClass([this.getWrapper()], 'e-rtl');\n }\n else {\n removeClass([this.getWrapper()], 'e-rtl');\n }\n };\n ColorPicker.prototype.changePaletteProps = function () {\n detach(this.container.children[0]);\n this.container.style.width = '';\n this.createPalette();\n };\n /**\n * Called internally if any of the property value changed.\n * @param {ColorPickerModel} newProp\n * @param {ColorPickerModel} oldProp\n * @returns void\n * @private\n */\n ColorPicker.prototype.onPropertyChanged = function (newProp, oldProp) {\n var _this = this;\n var wrapper = this.getWrapper();\n if (!this.inline && isNullOrUndefined(newProp.inline)) {\n var otherCompModel = ['disabled', 'enableRtl'];\n this.splitBtn.setProperties(getModel(newProp, otherCompModel));\n if (!this.isPopupOpen()) {\n if (newProp.value) {\n select('.' + SPLITPREVIEW, this.splitBtn.element).style.backgroundColor = newProp.value;\n }\n this.changeCssClassProps(newProp.cssClass, oldProp.cssClass);\n this.changeRtlProps(newProp.enableRtl);\n return;\n }\n }\n for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {\n var prop = _a[_i];\n switch (prop) {\n case 'inline':\n if (newProp.inline) {\n this.getWrapper().appendChild(this.container);\n this.splitBtn.destroy();\n detach(this.element.nextElementSibling);\n if (!this.container.children.length) {\n this.createWidget();\n }\n }\n else {\n this.destroyOtherComp();\n this.unWireEvents();\n this.container.innerHTML = '';\n this.createSplitBtn();\n }\n break;\n case 'cssClass':\n if (this.isPicker()) {\n if (wrapper.classList.contains('e-hide-value')) {\n this.createInput();\n this.addvalueEventHandler();\n }\n newProp.cssClass.split(' ').forEach(function (cls) {\n if (cls === 'e-hide-value') {\n remove(select('.' + INPUTWRAPPER, _this.container));\n }\n });\n }\n else {\n if (wrapper.classList.contains('e-show-value')) {\n remove(select('.' + INPUTWRAPPER, this.container));\n }\n newProp.cssClass.split(' ').forEach(function (cls) {\n if (cls === 'e-show-value') {\n _this.createInput(1);\n _this.addInputEvent();\n }\n });\n }\n this.changeCssClassProps(newProp.cssClass, oldProp.cssClass);\n break;\n case 'enableRtl':\n if (this.isPicker()) {\n this.hueSlider.enableRtl = newProp.enableRtl;\n this.opacitySlider.enableRtl = newProp.enableRtl;\n this.setInputEleProps(newProp.enableRtl);\n }\n this.changeRtlProps(newProp.enableRtl);\n break;\n case 'disabled':\n this.changeDisabledProp(newProp.disabled);\n break;\n case 'value':\n this.changeValueProp(newProp.value);\n break;\n case 'showButtons':\n this.changeShowBtnProps(newProp.showButtons);\n break;\n case 'mode':\n if (newProp.mode === 'Picker') {\n this.switchToPicker();\n }\n else {\n this.switchToPalette();\n }\n break;\n case 'modeSwitcher':\n this.changeModeSwitcherProp(newProp.modeSwitcher);\n break;\n case 'columns':\n case 'presetColors':\n if (!this.isPicker()) {\n this.changePaletteProps();\n }\n break;\n case 'noColor':\n if (newProp.noColor) {\n if (this.mode === 'Palette' && !this.modeSwitcher) {\n this.setNoColor();\n }\n }\n else {\n this.changePaletteProps();\n }\n break;\n }\n }\n };\n __decorate([\n Property('#008000')\n ], ColorPicker.prototype, \"value\", void 0);\n __decorate([\n Property('')\n ], ColorPicker.prototype, \"cssClass\", void 0);\n __decorate([\n Property(false)\n ], ColorPicker.prototype, \"disabled\", void 0);\n __decorate([\n Property(false)\n ], ColorPicker.prototype, \"enableRtl\", void 0);\n __decorate([\n Property('Picker')\n ], ColorPicker.prototype, \"mode\", void 0);\n __decorate([\n Property(true)\n ], ColorPicker.prototype, \"modeSwitcher\", void 0);\n __decorate([\n Property(null)\n ], ColorPicker.prototype, \"presetColors\", void 0);\n __decorate([\n Property(true)\n ], ColorPicker.prototype, \"showButtons\", void 0);\n __decorate([\n Property(10)\n ], ColorPicker.prototype, \"columns\", void 0);\n __decorate([\n Property(false)\n ], ColorPicker.prototype, \"inline\", void 0);\n __decorate([\n Property(false)\n ], ColorPicker.prototype, \"noColor\", void 0);\n __decorate([\n Property(false)\n ], ColorPicker.prototype, \"enablePersistence\", void 0);\n __decorate([\n Event()\n ], ColorPicker.prototype, \"select\", void 0);\n __decorate([\n Event()\n ], ColorPicker.prototype, \"change\", void 0);\n __decorate([\n Event()\n ], ColorPicker.prototype, \"beforeTileRender\", void 0);\n __decorate([\n Event()\n ], ColorPicker.prototype, \"beforeOpen\", void 0);\n __decorate([\n Event()\n ], ColorPicker.prototype, \"open\", void 0);\n __decorate([\n Event()\n ], ColorPicker.prototype, \"beforeClose\", void 0);\n __decorate([\n Event()\n ], ColorPicker.prototype, \"beforeModeSwitch\", void 0);\n ColorPicker = __decorate([\n NotifyPropertyChanges\n ], ColorPicker);\n return ColorPicker;\n}(Component));\nexport { ColorPicker };\n","import { DataUtil } from './util';\n/**\n * Query class is used to build query which is used by the DataManager to communicate with datasource.\n */\nvar Query = /** @class */ (function () {\n /**\n * Constructor for Query class.\n * @param {string|string[]} from?\n * @hidden\n */\n function Query(from) {\n /** @hidden */\n this.subQuery = null;\n /** @hidden */\n this.isChild = false;\n this.queries = [];\n this.key = '';\n this.fKey = '';\n if (typeof from === 'string') {\n this.fromTable = from;\n }\n else if (from && from instanceof Array) {\n this.lookups = from;\n }\n this.expands = [];\n this.sortedColumns = [];\n this.groupedColumns = [];\n this.subQuery = null;\n this.isChild = false;\n this.params = [];\n return this;\n }\n /**\n * Sets the primary key.\n * @param {string} field - Defines the column field.\n */\n Query.prototype.setKey = function (field) {\n this.key = field;\n return this;\n };\n /**\n * Sets default DataManager to execute query.\n * @param {DataManager} dataManager - Defines the DataManager.\n */\n Query.prototype.using = function (dataManager) {\n this.dataManager = dataManager;\n return this;\n };\n /**\n * Executes query with the given DataManager.\n * @param {DataManager} dataManager - Defines the DataManager.\n * @param {Function} done - Defines the success callback.\n * @param {Function} fail - Defines the failure callback.\n * @param {Function} always - Defines the callback which will be invoked on either success or failure.\n *\n *