wijmo 5.20261.45-nightly.d20260108.t163148 → 5.20261.45-nightly.d20260109.t183159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cultures/wijmo.culture.ar-AE.js +1 -1
- package/cultures/wijmo.culture.ar-SA.js +1 -1
- package/cultures/wijmo.culture.bg.js +1 -1
- package/cultures/wijmo.culture.ca.js +1 -1
- package/cultures/wijmo.culture.cs.js +1 -1
- package/cultures/wijmo.culture.da.js +1 -1
- package/cultures/wijmo.culture.de-CH.js +1 -1
- package/cultures/wijmo.culture.de.js +1 -1
- package/cultures/wijmo.culture.el.js +1 -1
- package/cultures/wijmo.culture.en-CA.js +1 -1
- package/cultures/wijmo.culture.en-GB.js +1 -1
- package/cultures/wijmo.culture.en.js +1 -1
- package/cultures/wijmo.culture.es-419.js +1 -1
- package/cultures/wijmo.culture.es-MX.js +1 -1
- package/cultures/wijmo.culture.es.js +1 -1
- package/cultures/wijmo.culture.et.js +1 -1
- package/cultures/wijmo.culture.eu.js +1 -1
- package/cultures/wijmo.culture.fi.js +1 -1
- package/cultures/wijmo.culture.fr-CA.js +1 -1
- package/cultures/wijmo.culture.fr.js +1 -1
- package/cultures/wijmo.culture.gl.js +1 -1
- package/cultures/wijmo.culture.he.js +1 -1
- package/cultures/wijmo.culture.hi.js +1 -1
- package/cultures/wijmo.culture.hr.js +1 -1
- package/cultures/wijmo.culture.hu.js +1 -1
- package/cultures/wijmo.culture.id.js +1 -1
- package/cultures/wijmo.culture.it.js +1 -1
- package/cultures/wijmo.culture.ja.js +1 -1
- package/cultures/wijmo.culture.kk.js +1 -1
- package/cultures/wijmo.culture.ko.js +1 -1
- package/cultures/wijmo.culture.lt.js +1 -1
- package/cultures/wijmo.culture.lv.js +1 -1
- package/cultures/wijmo.culture.mn-MN.js +1 -1
- package/cultures/wijmo.culture.nl.js +1 -1
- package/cultures/wijmo.culture.no.js +1 -1
- package/cultures/wijmo.culture.pl.js +1 -1
- package/cultures/wijmo.culture.pt.js +1 -1
- package/cultures/wijmo.culture.ro.js +1 -1
- package/cultures/wijmo.culture.ru.js +1 -1
- package/cultures/wijmo.culture.sk.js +1 -1
- package/cultures/wijmo.culture.sl.js +1 -1
- package/cultures/wijmo.culture.sr.js +1 -1
- package/cultures/wijmo.culture.sv.js +1 -1
- package/cultures/wijmo.culture.th.js +1 -1
- package/cultures/wijmo.culture.tr.js +1 -1
- package/cultures/wijmo.culture.uk.js +1 -1
- package/cultures/wijmo.culture.vi.js +1 -1
- package/cultures/wijmo.culture.zh-HK.js +1 -1
- package/cultures/wijmo.culture.zh-TW.js +1 -1
- package/cultures/wijmo.culture.zh.js +1 -1
- package/package.json +1 -1
- package/styles/misc/_constants.scss +1 -1
- package/styles/misc/_glyphs.scss +1 -1
- package/styles/misc/_mixins.scss +1 -1
- package/styles/misc/_variables.scss +1 -1
- package/styles/parts/_barcode.scss +1 -1
- package/styles/parts/_chart.scss +1 -1
- package/styles/parts/_chart_finance.scss +1 -1
- package/styles/parts/_chart_hierarchical.scss +1 -1
- package/styles/parts/_chart_interaction.scss +1 -1
- package/styles/parts/_chart_map.scss +1 -1
- package/styles/parts/_core.scss +1 -1
- package/styles/parts/_gauge.scss +1 -1
- package/styles/parts/_grid.scss +1 -1
- package/styles/parts/_grid_cellmaker.scss +1 -1
- package/styles/parts/_grid_filter.scss +1 -1
- package/styles/parts/_grid_grouppanel.scss +1 -1
- package/styles/parts/_grid_multirow.scss +1 -1
- package/styles/parts/_grid_search.scss +1 -1
- package/styles/parts/_grid_selector.scss +1 -1
- package/styles/parts/_grid_sheet.scss +1 -1
- package/styles/parts/_grid_transposed_multirow.scss +1 -1
- package/styles/parts/_input.scss +1 -1
- package/styles/parts/_labeled_input.scss +1 -1
- package/styles/parts/_nav.scss +1 -1
- package/styles/parts/_olap.scss +1 -1
- package/styles/parts/_viewer.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.amber-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.blue_grey-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.brown-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.cyan-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_orange-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.deep_purple-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.green-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.green-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.grey-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.indigo-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_blue-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.light_green-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.lime-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.orange-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.pink-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.purple-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-teal.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.red-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.red-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-yellow.css +1 -1
- package/styles/themes/material/wijmo.theme.material.teal-yellow.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-amber.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-amber.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-cyan.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-cyan.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-deep_orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-deep_orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-deep_purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-deep_purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-indigo.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-indigo.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-light_blue.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-light_blue.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-light_green.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-light_green.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-lime.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-lime.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-orange.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-orange.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-pink.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-pink.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-purple.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-purple.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-red.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-red.scss +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-teal.css +1 -1
- package/styles/themes/material/wijmo.theme.material.yellow-teal.scss +1 -1
- package/styles/themes/wijmo.theme.cerulean.css +1 -1
- package/styles/themes/wijmo.theme.cerulean.scss +1 -1
- package/styles/themes/wijmo.theme.cleandark.css +1 -1
- package/styles/themes/wijmo.theme.cleandark.scss +1 -1
- package/styles/themes/wijmo.theme.cleanlight.css +1 -1
- package/styles/themes/wijmo.theme.cleanlight.scss +1 -1
- package/styles/themes/wijmo.theme.cocoa.css +1 -1
- package/styles/themes/wijmo.theme.cocoa.scss +1 -1
- package/styles/themes/wijmo.theme.coral.css +1 -1
- package/styles/themes/wijmo.theme.coral.scss +1 -1
- package/styles/themes/wijmo.theme.cyborg.css +1 -1
- package/styles/themes/wijmo.theme.cyborg.scss +1 -1
- package/styles/themes/wijmo.theme.dark.css +1 -1
- package/styles/themes/wijmo.theme.dark.scss +1 -1
- package/styles/themes/wijmo.theme.darkly.css +1 -1
- package/styles/themes/wijmo.theme.darkly.scss +1 -1
- package/styles/themes/wijmo.theme.flatly.css +1 -1
- package/styles/themes/wijmo.theme.flatly.scss +1 -1
- package/styles/themes/wijmo.theme.grayscale.css +1 -1
- package/styles/themes/wijmo.theme.grayscale.scss +1 -1
- package/styles/themes/wijmo.theme.highcontrast.css +1 -1
- package/styles/themes/wijmo.theme.highcontrast.scss +1 -1
- package/styles/themes/wijmo.theme.light.css +1 -1
- package/styles/themes/wijmo.theme.light.scss +1 -1
- package/styles/themes/wijmo.theme.material.amber-indigo.css +1 -1
- package/styles/themes/wijmo.theme.material.amber-indigo.scss +1 -1
- package/styles/themes/wijmo.theme.material.css +1 -1
- package/styles/themes/wijmo.theme.material.indigo-orange.css +1 -1
- package/styles/themes/wijmo.theme.material.indigo-orange.scss +1 -1
- package/styles/themes/wijmo.theme.material.scss +1 -1
- package/styles/themes/wijmo.theme.material.vars.css +1 -1
- package/styles/themes/wijmo.theme.material.vars.scss +1 -1
- package/styles/themes/wijmo.theme.midnight.css +1 -1
- package/styles/themes/wijmo.theme.midnight.scss +1 -1
- package/styles/themes/wijmo.theme.minimal.css +1 -1
- package/styles/themes/wijmo.theme.minimal.scss +1 -1
- package/styles/themes/wijmo.theme.modern.css +1 -1
- package/styles/themes/wijmo.theme.modern.scss +1 -1
- package/styles/themes/wijmo.theme.office.css +1 -1
- package/styles/themes/wijmo.theme.office.scss +1 -1
- package/styles/themes/wijmo.theme.organic.css +1 -1
- package/styles/themes/wijmo.theme.organic.scss +1 -1
- package/styles/themes/wijmo.theme.paper.css +1 -1
- package/styles/themes/wijmo.theme.paper.scss +1 -1
- package/styles/themes/wijmo.theme.simplex.css +1 -1
- package/styles/themes/wijmo.theme.simplex.scss +1 -1
- package/styles/themes/wijmo.theme.slate.css +1 -1
- package/styles/themes/wijmo.theme.slate.scss +1 -1
- package/styles/themes/wijmo.theme.superhero.css +1 -1
- package/styles/themes/wijmo.theme.superhero.scss +1 -1
- package/styles/themes/wijmo.theme.trust.css +1 -1
- package/styles/themes/wijmo.theme.trust.scss +1 -1
- package/styles/themes/wijmo.theme.zen.css +1 -1
- package/styles/themes/wijmo.theme.zen.scss +1 -1
- package/styles/wijmo-core.css +1 -1
- package/styles/wijmo-core.scss +1 -1
- package/styles/wijmo.css +1 -1
- package/styles/wijmo.scss +1 -1
- package/wijmo.angular.base.d.ts +1 -1
- package/wijmo.angular.base.js +1 -1
- package/wijmo.angular.chart.analytics.d.ts +1 -1
- package/wijmo.angular.chart.analytics.js +1 -1
- package/wijmo.angular.chart.animation.d.ts +1 -1
- package/wijmo.angular.chart.animation.js +1 -1
- package/wijmo.angular.chart.annotation.d.ts +1 -1
- package/wijmo.angular.chart.annotation.js +1 -1
- package/wijmo.angular.chart.d.ts +1 -1
- package/wijmo.angular.chart.finance.analytics.d.ts +1 -1
- package/wijmo.angular.chart.finance.analytics.js +1 -1
- package/wijmo.angular.chart.finance.d.ts +1 -1
- package/wijmo.angular.chart.finance.js +1 -1
- package/wijmo.angular.chart.hierarchical.d.ts +1 -1
- package/wijmo.angular.chart.hierarchical.js +1 -1
- package/wijmo.angular.chart.interaction.d.ts +1 -1
- package/wijmo.angular.chart.interaction.js +1 -1
- package/wijmo.angular.chart.js +1 -1
- package/wijmo.angular.chart.radar.d.ts +1 -1
- package/wijmo.angular.chart.radar.js +1 -1
- package/wijmo.angular.core.d.ts +1 -1
- package/wijmo.angular.core.js +1 -1
- package/wijmo.angular.gauge.d.ts +1 -1
- package/wijmo.angular.gauge.js +1 -1
- package/wijmo.angular.grid.d.ts +1 -1
- package/wijmo.angular.grid.detail.d.ts +1 -1
- package/wijmo.angular.grid.detail.js +1 -1
- package/wijmo.angular.grid.filter.d.ts +1 -1
- package/wijmo.angular.grid.filter.js +1 -1
- package/wijmo.angular.grid.grouppanel.d.ts +1 -1
- package/wijmo.angular.grid.grouppanel.js +1 -1
- package/wijmo.angular.grid.js +1 -1
- package/wijmo.angular.grid.multirow.d.ts +1 -1
- package/wijmo.angular.grid.multirow.js +1 -1
- package/wijmo.angular.grid.sheet.d.ts +1 -1
- package/wijmo.angular.grid.sheet.js +1 -1
- package/wijmo.angular.input.d.ts +1 -1
- package/wijmo.angular.input.js +1 -1
- package/wijmo.angular.nav.d.ts +1 -1
- package/wijmo.angular.nav.js +1 -1
- package/wijmo.angular.olap.d.ts +1 -1
- package/wijmo.angular.olap.js +1 -1
- package/wijmo.angular.viewer.d.ts +1 -1
- package/wijmo.angular.viewer.js +1 -1
- package/wijmo.angular2.barcode.common.d.ts +1 -1
- package/wijmo.angular2.barcode.common.js +1 -1
- package/wijmo.angular2.barcode.composite.d.ts +1 -1
- package/wijmo.angular2.barcode.composite.js +1 -1
- package/wijmo.angular2.barcode.specialized.d.ts +1 -1
- package/wijmo.angular2.barcode.specialized.js +1 -1
- package/wijmo.angular2.chart.analytics.d.ts +1 -1
- package/wijmo.angular2.chart.analytics.js +1 -1
- package/wijmo.angular2.chart.animation.d.ts +1 -1
- package/wijmo.angular2.chart.animation.js +1 -1
- package/wijmo.angular2.chart.annotation.d.ts +1 -1
- package/wijmo.angular2.chart.annotation.js +1 -1
- package/wijmo.angular2.chart.d.ts +1 -1
- package/wijmo.angular2.chart.finance.analytics.d.ts +1 -1
- package/wijmo.angular2.chart.finance.analytics.js +1 -1
- package/wijmo.angular2.chart.finance.d.ts +1 -1
- package/wijmo.angular2.chart.finance.js +1 -1
- package/wijmo.angular2.chart.hierarchical.d.ts +1 -1
- package/wijmo.angular2.chart.hierarchical.js +1 -1
- package/wijmo.angular2.chart.interaction.d.ts +1 -1
- package/wijmo.angular2.chart.interaction.js +1 -1
- package/wijmo.angular2.chart.js +1 -1
- package/wijmo.angular2.chart.map.d.ts +1 -1
- package/wijmo.angular2.chart.map.js +1 -1
- package/wijmo.angular2.chart.radar.d.ts +1 -1
- package/wijmo.angular2.chart.radar.js +1 -1
- package/wijmo.angular2.core.d.ts +1 -1
- package/wijmo.angular2.core.js +1 -1
- package/wijmo.angular2.directiveBase.d.ts +1 -1
- package/wijmo.angular2.directiveBase.js +1 -1
- package/wijmo.angular2.gauge.d.ts +1 -1
- package/wijmo.angular2.gauge.js +1 -1
- package/wijmo.angular2.grid.d.ts +1 -1
- package/wijmo.angular2.grid.detail.d.ts +1 -1
- package/wijmo.angular2.grid.detail.js +1 -1
- package/wijmo.angular2.grid.filter.d.ts +1 -1
- package/wijmo.angular2.grid.filter.js +1 -1
- package/wijmo.angular2.grid.grouppanel.d.ts +1 -1
- package/wijmo.angular2.grid.grouppanel.js +1 -1
- package/wijmo.angular2.grid.js +1 -1
- package/wijmo.angular2.grid.multirow.d.ts +1 -1
- package/wijmo.angular2.grid.multirow.js +1 -1
- package/wijmo.angular2.grid.search.d.ts +1 -1
- package/wijmo.angular2.grid.search.js +1 -1
- package/wijmo.angular2.grid.sheet.d.ts +1 -1
- package/wijmo.angular2.grid.sheet.js +1 -1
- package/wijmo.angular2.grid.transposed.d.ts +1 -1
- package/wijmo.angular2.grid.transposed.js +1 -1
- package/wijmo.angular2.grid.transposedmultirow.d.ts +1 -1
- package/wijmo.angular2.grid.transposedmultirow.js +1 -1
- package/wijmo.angular2.input.d.ts +1 -1
- package/wijmo.angular2.input.js +1 -1
- package/wijmo.angular2.nav.d.ts +1 -1
- package/wijmo.angular2.nav.js +1 -1
- package/wijmo.angular2.olap.d.ts +1 -1
- package/wijmo.angular2.olap.js +1 -1
- package/wijmo.angular2.viewer.d.ts +1 -1
- package/wijmo.angular2.viewer.js +1 -1
- package/wijmo.barcode.common.d.ts +1 -1
- package/wijmo.barcode.common.js +1 -1
- package/wijmo.barcode.composite.d.ts +1 -1
- package/wijmo.barcode.composite.js +1 -1
- package/wijmo.barcode.d.ts +1 -1
- package/wijmo.barcode.js +1 -1
- package/wijmo.barcode.specialized.d.ts +1 -1
- package/wijmo.barcode.specialized.js +1 -1
- package/wijmo.chart.analytics.d.ts +1 -1
- package/wijmo.chart.analytics.js +1 -1
- package/wijmo.chart.animation.d.ts +1 -1
- package/wijmo.chart.animation.js +1 -1
- package/wijmo.chart.annotation.d.ts +1 -1
- package/wijmo.chart.annotation.js +1 -1
- package/wijmo.chart.d.ts +1 -1
- package/wijmo.chart.finance.analytics.d.ts +1 -1
- package/wijmo.chart.finance.analytics.js +1 -1
- package/wijmo.chart.finance.d.ts +1 -1
- package/wijmo.chart.finance.js +1 -1
- package/wijmo.chart.hierarchical.d.ts +1 -1
- package/wijmo.chart.hierarchical.js +1 -1
- package/wijmo.chart.interaction.d.ts +1 -1
- package/wijmo.chart.interaction.js +1 -1
- package/wijmo.chart.js +1 -1
- package/wijmo.chart.map.d.ts +1 -1
- package/wijmo.chart.map.js +1 -1
- package/wijmo.chart.radar.d.ts +1 -1
- package/wijmo.chart.radar.js +1 -1
- package/wijmo.chart.render.d.ts +1 -1
- package/wijmo.chart.render.js +1 -1
- package/wijmo.chart.webgl.d.ts +1 -1
- package/wijmo.chart.webgl.js +1 -1
- package/wijmo.cloud.d.ts +1 -1
- package/wijmo.cloud.js +1 -1
- package/wijmo.d.ts +1 -1
- package/wijmo.gauge.d.ts +1 -1
- package/wijmo.gauge.js +1 -1
- package/wijmo.grid.cellmaker.d.ts +1 -1
- package/wijmo.grid.cellmaker.js +1 -1
- package/wijmo.grid.d.ts +1 -1
- package/wijmo.grid.detail.d.ts +5 -1
- package/wijmo.grid.detail.js +2 -2
- package/wijmo.grid.filter.d.ts +1 -1
- package/wijmo.grid.filter.js +2 -2
- package/wijmo.grid.grouppanel.d.ts +1 -1
- package/wijmo.grid.grouppanel.js +1 -1
- package/wijmo.grid.immutable.d.ts +1 -1
- package/wijmo.grid.immutable.js +1 -1
- package/wijmo.grid.js +1 -1
- package/wijmo.grid.multirow.d.ts +6 -1
- package/wijmo.grid.multirow.js +2 -2
- package/wijmo.grid.pdf.d.ts +1 -1
- package/wijmo.grid.pdf.js +1 -1
- package/wijmo.grid.search.d.ts +1 -1
- package/wijmo.grid.search.js +1 -1
- package/wijmo.grid.selector.d.ts +1 -1
- package/wijmo.grid.selector.js +1 -1
- package/wijmo.grid.sheet.d.ts +1 -1
- package/wijmo.grid.sheet.js +2 -2
- package/wijmo.grid.style.d.ts +1 -1
- package/wijmo.grid.style.js +1 -1
- package/wijmo.grid.transposed.d.ts +1 -1
- package/wijmo.grid.transposed.js +1 -1
- package/wijmo.grid.transposedmultirow.d.ts +1 -1
- package/wijmo.grid.transposedmultirow.js +1 -1
- package/wijmo.grid.xlsx.d.ts +1 -1
- package/wijmo.grid.xlsx.js +1 -1
- package/wijmo.input.d.ts +1 -1
- package/wijmo.input.js +1 -1
- package/wijmo.interop.grid.d.ts +1 -1
- package/wijmo.interop.grid.js +1 -1
- package/wijmo.js +1 -1
- package/wijmo.knockout.base.d.ts +1 -1
- package/wijmo.knockout.base.js +1 -1
- package/wijmo.knockout.chart.analytics.d.ts +1 -1
- package/wijmo.knockout.chart.analytics.js +1 -1
- package/wijmo.knockout.chart.animation.d.ts +1 -1
- package/wijmo.knockout.chart.animation.js +1 -1
- package/wijmo.knockout.chart.annotation.d.ts +1 -1
- package/wijmo.knockout.chart.annotation.js +1 -1
- package/wijmo.knockout.chart.d.ts +1 -1
- package/wijmo.knockout.chart.finance.analytics.d.ts +1 -1
- package/wijmo.knockout.chart.finance.analytics.js +1 -1
- package/wijmo.knockout.chart.finance.d.ts +1 -1
- package/wijmo.knockout.chart.finance.js +1 -1
- package/wijmo.knockout.chart.interaction.d.ts +1 -1
- package/wijmo.knockout.chart.interaction.js +1 -1
- package/wijmo.knockout.chart.js +1 -1
- package/wijmo.knockout.core.d.ts +1 -1
- package/wijmo.knockout.core.js +1 -1
- package/wijmo.knockout.gauge.d.ts +1 -1
- package/wijmo.knockout.gauge.js +1 -1
- package/wijmo.knockout.grid.d.ts +1 -1
- package/wijmo.knockout.grid.filter.d.ts +1 -1
- package/wijmo.knockout.grid.filter.js +1 -1
- package/wijmo.knockout.grid.grouppanel.d.ts +1 -1
- package/wijmo.knockout.grid.grouppanel.js +1 -1
- package/wijmo.knockout.grid.js +1 -1
- package/wijmo.knockout.grid.multirow.d.ts +1 -1
- package/wijmo.knockout.grid.multirow.js +1 -1
- package/wijmo.knockout.grid.sheet.d.ts +1 -1
- package/wijmo.knockout.grid.sheet.js +1 -1
- package/wijmo.knockout.input.d.ts +1 -1
- package/wijmo.knockout.input.js +1 -1
- package/wijmo.knockout.nav.d.ts +1 -1
- package/wijmo.knockout.nav.js +1 -1
- package/wijmo.knockout.olap.d.ts +1 -1
- package/wijmo.knockout.olap.js +1 -1
- package/wijmo.meta.d.ts +1 -1
- package/wijmo.meta.js +1 -1
- package/wijmo.nav.d.ts +1 -1
- package/wijmo.nav.js +1 -1
- package/wijmo.odata.d.ts +1 -1
- package/wijmo.odata.js +1 -1
- package/wijmo.olap.d.ts +1 -1
- package/wijmo.olap.js +1 -1
- package/wijmo.pdf.d.ts +1 -1
- package/wijmo.pdf.js +1 -1
- package/wijmo.pdf.security.d.ts +1 -1
- package/wijmo.pdf.security.js +1 -1
- package/wijmo.react.barcode.base.d.ts +1 -1
- package/wijmo.react.barcode.base.js +1 -1
- package/wijmo.react.barcode.common.d.ts +1 -1
- package/wijmo.react.barcode.common.js +1 -1
- package/wijmo.react.barcode.composite.d.ts +1 -1
- package/wijmo.react.barcode.composite.js +1 -1
- package/wijmo.react.barcode.specialized.d.ts +1 -1
- package/wijmo.react.barcode.specialized.js +1 -1
- package/wijmo.react.base.d.ts +1 -1
- package/wijmo.react.base.js +1 -1
- package/wijmo.react.chart.analytics.d.ts +1 -1
- package/wijmo.react.chart.analytics.js +1 -1
- package/wijmo.react.chart.animation.d.ts +1 -1
- package/wijmo.react.chart.animation.js +1 -1
- package/wijmo.react.chart.annotation.d.ts +1 -1
- package/wijmo.react.chart.annotation.js +1 -1
- package/wijmo.react.chart.d.ts +1 -1
- package/wijmo.react.chart.finance.analytics.d.ts +1 -1
- package/wijmo.react.chart.finance.analytics.js +1 -1
- package/wijmo.react.chart.finance.d.ts +1 -1
- package/wijmo.react.chart.finance.js +1 -1
- package/wijmo.react.chart.hierarchical.d.ts +1 -1
- package/wijmo.react.chart.hierarchical.js +1 -1
- package/wijmo.react.chart.interaction.d.ts +1 -1
- package/wijmo.react.chart.interaction.js +1 -1
- package/wijmo.react.chart.js +1 -1
- package/wijmo.react.chart.map.d.ts +1 -1
- package/wijmo.react.chart.map.js +1 -1
- package/wijmo.react.chart.radar.d.ts +1 -1
- package/wijmo.react.chart.radar.js +1 -1
- package/wijmo.react.gauge.d.ts +1 -1
- package/wijmo.react.gauge.js +1 -1
- package/wijmo.react.grid.d.ts +1 -1
- package/wijmo.react.grid.detail.d.ts +1 -1
- package/wijmo.react.grid.detail.js +1 -1
- package/wijmo.react.grid.filter.d.ts +1 -1
- package/wijmo.react.grid.filter.js +1 -1
- package/wijmo.react.grid.grouppanel.d.ts +1 -1
- package/wijmo.react.grid.grouppanel.js +1 -1
- package/wijmo.react.grid.immutable.d.ts +1 -1
- package/wijmo.react.grid.immutable.js +1 -1
- package/wijmo.react.grid.js +1 -1
- package/wijmo.react.grid.multirow.d.ts +1 -1
- package/wijmo.react.grid.multirow.js +1 -1
- package/wijmo.react.grid.search.d.ts +1 -1
- package/wijmo.react.grid.search.js +1 -1
- package/wijmo.react.grid.sheet.d.ts +1 -1
- package/wijmo.react.grid.sheet.js +1 -1
- package/wijmo.react.grid.transposed.d.ts +1 -1
- package/wijmo.react.grid.transposed.js +1 -1
- package/wijmo.react.grid.transposedmultirow.d.ts +1 -1
- package/wijmo.react.grid.transposedmultirow.js +1 -1
- package/wijmo.react.input.d.ts +1 -1
- package/wijmo.react.input.js +1 -1
- package/wijmo.react.nav.d.ts +1 -1
- package/wijmo.react.nav.js +1 -1
- package/wijmo.react.olap.d.ts +1 -1
- package/wijmo.react.olap.js +1 -1
- package/wijmo.react.viewer.d.ts +1 -1
- package/wijmo.react.viewer.js +1 -1
- package/wijmo.rest.d.ts +1 -1
- package/wijmo.rest.js +1 -1
- package/wijmo.touch.d.ts +1 -1
- package/wijmo.touch.js +1 -1
- package/wijmo.undo.d.ts +1 -1
- package/wijmo.undo.js +1 -1
- package/wijmo.viewer.d.ts +1 -1
- package/wijmo.viewer.js +1 -1
- package/wijmo.vue2.barcode.common.d.ts +1 -1
- package/wijmo.vue2.barcode.common.js +1 -1
- package/wijmo.vue2.barcode.composite.d.ts +1 -1
- package/wijmo.vue2.barcode.composite.js +1 -1
- package/wijmo.vue2.barcode.specialized.d.ts +1 -1
- package/wijmo.vue2.barcode.specialized.js +1 -1
- package/wijmo.vue2.base.d.ts +1 -1
- package/wijmo.vue2.base.js +1 -1
- package/wijmo.vue2.chart.analytics.d.ts +1 -1
- package/wijmo.vue2.chart.analytics.js +1 -1
- package/wijmo.vue2.chart.animation.d.ts +1 -1
- package/wijmo.vue2.chart.animation.js +1 -1
- package/wijmo.vue2.chart.annotation.d.ts +1 -1
- package/wijmo.vue2.chart.annotation.js +1 -1
- package/wijmo.vue2.chart.d.ts +1 -1
- package/wijmo.vue2.chart.finance.analytics.d.ts +1 -1
- package/wijmo.vue2.chart.finance.analytics.js +1 -1
- package/wijmo.vue2.chart.finance.d.ts +1 -1
- package/wijmo.vue2.chart.finance.js +1 -1
- package/wijmo.vue2.chart.hierarchical.d.ts +1 -1
- package/wijmo.vue2.chart.hierarchical.js +1 -1
- package/wijmo.vue2.chart.interaction.d.ts +1 -1
- package/wijmo.vue2.chart.interaction.js +1 -1
- package/wijmo.vue2.chart.js +1 -1
- package/wijmo.vue2.chart.map.d.ts +1 -1
- package/wijmo.vue2.chart.map.js +1 -1
- package/wijmo.vue2.chart.radar.d.ts +1 -1
- package/wijmo.vue2.chart.radar.js +1 -1
- package/wijmo.vue2.core.d.ts +1 -1
- package/wijmo.vue2.core.js +1 -1
- package/wijmo.vue2.gauge.d.ts +1 -1
- package/wijmo.vue2.gauge.js +1 -1
- package/wijmo.vue2.grid.d.ts +1 -1
- package/wijmo.vue2.grid.detail.d.ts +1 -1
- package/wijmo.vue2.grid.detail.js +1 -1
- package/wijmo.vue2.grid.filter.d.ts +1 -1
- package/wijmo.vue2.grid.filter.js +1 -1
- package/wijmo.vue2.grid.grouppanel.d.ts +1 -1
- package/wijmo.vue2.grid.grouppanel.js +1 -1
- package/wijmo.vue2.grid.js +1 -1
- package/wijmo.vue2.grid.multirow.d.ts +1 -1
- package/wijmo.vue2.grid.multirow.js +1 -1
- package/wijmo.vue2.grid.search.d.ts +1 -1
- package/wijmo.vue2.grid.search.js +1 -1
- package/wijmo.vue2.grid.sheet.d.ts +1 -1
- package/wijmo.vue2.grid.sheet.js +1 -1
- package/wijmo.vue2.grid.transposed.d.ts +1 -1
- package/wijmo.vue2.grid.transposed.js +1 -1
- package/wijmo.vue2.grid.transposedmultirow.d.ts +1 -1
- package/wijmo.vue2.grid.transposedmultirow.js +1 -1
- package/wijmo.vue2.input.d.ts +1 -1
- package/wijmo.vue2.input.js +1 -1
- package/wijmo.vue2.nav.d.ts +1 -1
- package/wijmo.vue2.nav.js +1 -1
- package/wijmo.vue2.olap.d.ts +1 -1
- package/wijmo.vue2.olap.js +1 -1
- package/wijmo.vue2.viewer.d.ts +1 -1
- package/wijmo.vue2.viewer.js +1 -1
- package/wijmo.webcomponents.barcode.common.d.ts +1 -1
- package/wijmo.webcomponents.barcode.common.js +1 -1
- package/wijmo.webcomponents.barcode.composite.d.ts +1 -1
- package/wijmo.webcomponents.barcode.composite.js +1 -1
- package/wijmo.webcomponents.barcode.specialized.d.ts +1 -1
- package/wijmo.webcomponents.barcode.specialized.js +1 -1
- package/wijmo.webcomponents.base.d.ts +1 -1
- package/wijmo.webcomponents.base.js +1 -1
- package/wijmo.webcomponents.chart.analytics.d.ts +1 -1
- package/wijmo.webcomponents.chart.analytics.js +1 -1
- package/wijmo.webcomponents.chart.animation.d.ts +1 -1
- package/wijmo.webcomponents.chart.animation.js +1 -1
- package/wijmo.webcomponents.chart.d.ts +1 -1
- package/wijmo.webcomponents.chart.finance.analytics.d.ts +1 -1
- package/wijmo.webcomponents.chart.finance.analytics.js +1 -1
- package/wijmo.webcomponents.chart.finance.d.ts +1 -1
- package/wijmo.webcomponents.chart.finance.js +1 -1
- package/wijmo.webcomponents.chart.hierarchical.d.ts +1 -1
- package/wijmo.webcomponents.chart.hierarchical.js +1 -1
- package/wijmo.webcomponents.chart.interaction.d.ts +1 -1
- package/wijmo.webcomponents.chart.interaction.js +1 -1
- package/wijmo.webcomponents.chart.js +1 -1
- package/wijmo.webcomponents.chart.map.d.ts +1 -1
- package/wijmo.webcomponents.chart.map.js +1 -1
- package/wijmo.webcomponents.chart.radar.d.ts +1 -1
- package/wijmo.webcomponents.chart.radar.js +1 -1
- package/wijmo.webcomponents.gauge.d.ts +1 -1
- package/wijmo.webcomponents.gauge.js +1 -1
- package/wijmo.webcomponents.grid.d.ts +1 -1
- package/wijmo.webcomponents.grid.filter.d.ts +1 -1
- package/wijmo.webcomponents.grid.filter.js +1 -1
- package/wijmo.webcomponents.grid.grouppanel.d.ts +1 -1
- package/wijmo.webcomponents.grid.grouppanel.js +1 -1
- package/wijmo.webcomponents.grid.js +1 -1
- package/wijmo.webcomponents.grid.multirow.d.ts +1 -1
- package/wijmo.webcomponents.grid.multirow.js +1 -1
- package/wijmo.webcomponents.grid.search.d.ts +1 -1
- package/wijmo.webcomponents.grid.search.js +1 -1
- package/wijmo.webcomponents.grid.sheet.d.ts +1 -1
- package/wijmo.webcomponents.grid.sheet.js +1 -1
- package/wijmo.webcomponents.grid.transposed.d.ts +1 -1
- package/wijmo.webcomponents.grid.transposed.js +1 -1
- package/wijmo.webcomponents.grid.transposedmultirow.d.ts +1 -1
- package/wijmo.webcomponents.grid.transposedmultirow.js +1 -1
- package/wijmo.webcomponents.input.d.ts +1 -1
- package/wijmo.webcomponents.input.js +1 -1
- package/wijmo.webcomponents.nav.d.ts +1 -1
- package/wijmo.webcomponents.nav.js +1 -1
- package/wijmo.webcomponents.olap.d.ts +1 -1
- package/wijmo.webcomponents.olap.js +1 -1
- package/wijmo.webcomponents.viewer.d.ts +1 -1
- package/wijmo.webcomponents.viewer.js +1 -1
- package/wijmo.xlsx.d.ts +1 -1
- package/wijmo.xlsx.js +1 -1
package/wijmo.grid.sheet.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20261.45-nightly.
|
|
3
|
+
* Wijmo Library 5.20261.45-nightly.d20260109.t183159
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
"use strict";var _a,__extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.hasOwnProperty.call(e,o)&&(t[o]=e[o]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});var _KnownErrors,wijmo_1=require("wijmo/wijmo"),wijmo_grid_1=require("wijmo/wijmo.grid"),wijmo_grid_filter_1=require("wijmo/wijmo.grid.filter"),wijmo_input_1=require("wijmo/wijmo.input"),wijmo_xlsx_1=require("wijmo/wijmo.xlsx"),wijmo_grid_xlsx_1=require("wijmo/wijmo.grid.xlsx"),mInput=__importStar(require("wijmo/wijmo.input")),mXlsx=__importStar(require("wijmo/wijmo.xlsx")),selfModule=__importStar(require("wijmo/wijmo.grid.sheet"));function softInput(){return wijmo_1._getModule("wijmo.input")}exports.softInput=softInput;function softXlsx(){return wijmo_1._getModule("wijmo.xlsx")}exports.softXlsx=softXlsx;exports._ErrorMessages={InvalidCellRef:"Invalid cell reference.",InvalidSheetRef:"Invalid sheet reference.",InvalidTableRef:"Invalid table reference.",InvalidTableColRef:"Invalid table column reference.",InvalidParameters:"Invalid parameters.",BadExpression:"Bad expression.",CircRef:"Circular reference.",InvalidParameter:function(e){return'Invalid parameter: "'+e+'".'},ParameterIsOutOfRange:function(e){return'Parameter is out of range: "'+e+'".'},RowIsOutOfTableRange:function(e){return"The row is out of the table ("+e+") range."},UnkFuncName:function(e){return'The function "'+e+'" has not supported in FlexSheet yet.'},DefNameInvalidSheet:function(e){return'The defined name item works in "'+e+'". It does not work in current sheet.'},InvalidTable:function(e){return"The Table("+e+") is not located in any sheet."},InvalidExpression:function(e){return"Invalid Expression: "+e},Atan2ArgsLessThanZero:"The x number and y number can't both be zero for the atan2 function.",RateCriteriaFails:"It is not able to calculate the rate with current parameters.",RangesMustBeTheSame:"The row span and column span of each cell range has to be same with each other.",TooFewParameters:"Too few parameters.",TooManyParameters:"Too many parameters.",ExpressionExpected:"Expression expected.",UnbalancedParenthesis:"Unbalanced parenthesis.",UnbalancedSquareBrackets:"Unbalanced square brackets.",TableReferencesExpected:"Table references expected.",IdentifierExpected:"Identifier expected.",CantFindFinalQuote:"Can't find final quote.",IllegalCrossSheetReference:"Illegal cross sheet reference.",CantFindFinalDateDelimiter:'Can\'t find final date delimiter ("#").',CellRefMustBeInSameSheet:"The cell reference must be in the same sheet.",SyntaxError:"Syntax error."};!function(e){e.Div="#DIV/0!";e.Name="#NAME?";e.Ref="#REF!";e.Num="#NUM!";e.Val="#VALUE!";e.Null="#NULL!";e.NA="#N/A"}(_KnownErrors||(_KnownErrors={}));var FormulaError=function(){function FormulaError(e,t){this._error=e;this._data=t}Object.defineProperty(FormulaError.prototype,"error",{get:function(){return this._error},enumerable:!0,configurable:!0});Object.defineProperty(FormulaError.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0});FormulaError.prototype.toString=function(){return this._error||(this._data||"").toString()};return FormulaError}();exports.FormulaError=FormulaError;var DivideByZeroError=function(e){__extends(DivideByZeroError,e);function DivideByZeroError(t){return e.call(this,_KnownErrors.Div,t)||this}return DivideByZeroError}(FormulaError);exports.DivideByZeroError=DivideByZeroError;var NameError=function(e){__extends(NameError,e);function NameError(t){return e.call(this,_KnownErrors.Name,t)||this}return NameError}(FormulaError);exports.NameError=NameError;var ReferenceError=function(e){__extends(ReferenceError,e);function ReferenceError(t){return e.call(this,_KnownErrors.Ref,t)||this}return ReferenceError}(FormulaError);exports.ReferenceError=ReferenceError;var NumericError=function(e){__extends(NumericError,e);function NumericError(t){return e.call(this,_KnownErrors.Num,t)||this}return NumericError}(FormulaError);exports.NumericError=NumericError;var ValueError=function(e){__extends(ValueError,e);function ValueError(t){return e.call(this,_KnownErrors.Val,t)||this}return ValueError}(FormulaError);exports.ValueError=ValueError;var NotAvailableError=function(e){__extends(NotAvailableError,e);function NotAvailableError(t){return e.call(this,_KnownErrors.NA,t)||this}return NotAvailableError}(FormulaError);exports.NotAvailableError=NotAvailableError;var NullError=function(e){__extends(NullError,e);function NullError(t){return e.call(this,_KnownErrors.Null,t)||this}return NullError}(FormulaError);exports.NullError=NullError;var UnknownError=function(e){__extends(UnknownError,e);function UnknownError(t){return e.call(this,"",t)||this}return UnknownError}(FormulaError);exports.UnknownError=UnknownError;var SyntaxError=function(e){__extends(SyntaxError,e);function SyntaxError(t){return e.call(this,"#SYNTAX",t)||this}return SyntaxError}(FormulaError);exports.SyntaxError=SyntaxError;var _FormulaErrorHelper=function(){function _FormulaErrorHelper(){}_FormulaErrorHelper.asError=function(e){return e instanceof FormulaError?e:"string"==typeof e?_FormulaErrorHelper.fromString(e):null};_FormulaErrorHelper.fromString=function(e){e=e.toUpperCase();if(_FormulaErrorHelper._errTypeMap[e])switch(e){case _KnownErrors.Div:return new DivideByZeroError;case _KnownErrors.Name:return new NameError;case _KnownErrors.NA:return new NotAvailableError;case _KnownErrors.Null:return new NullError;case _KnownErrors.Num:return new NumericError;case _KnownErrors.Ref:return new ReferenceError;case _KnownErrors.Val:return new ValueError}return null};_FormulaErrorHelper._errTypeMap=function(){var e={};Object.keys(_KnownErrors).forEach((function(t){e[_KnownErrors[t]]=1}));return e}();return _FormulaErrorHelper}();exports._FormulaErrorHelper=_FormulaErrorHelper;exports.FlexSheetClsNames={flexSheetFormulaDescription:"wj-flexsheet-formula-description",flexSheetFormulaList:"wj-flexsheet-formula-list",flexSheetFormulaName:"wj-flexsheet-formula-name",headerRow:"wj-header-row",hostElement:"wj-flexsheet",tabHolder:"wj-tabholder"};exports.SheetClsNames={hostElement:"wj-sheet",newSheet:"wj-new-sheet",sheetIcon:"wj-sheet-icon",sheetNameEditor:"wj-sheet-name-editor",sheetPage:"wj-sheet-page",sheetTab:"wj-sheet-tab"};exports._ContextMenuClsNames={contextMenuItem:"wj-context-menu-item",contextMenuItemSelected:"wj-context-menu-item-selected",flexSheetContextMenu:"wj-flexsheet-context-menu",hostElement:"wj-context-menu"};exports._SmartTagClsNames={flexSheetFillMenu:"wj-flexsheet-fill-menu",hostElement:"wj-flexsheet-smart-tag"};var Table=function(){function Table(e,t,o,i,n){this._showHeaderRow=!0;this._showTotalRow=!1;this._showBandedColumns=!1;this._showBandedRows=!0;this._alterFirstColumn=!1;this._alterLastColumn=!1;this._orgHeaderCellsContent=[];if(!t.isValid)throw"The range of this table is invalid.";this._name=e;this._range=t.clone();this._style=o;null!=i&&i.length>0&&this._pushTableColumns(i);if(null!=n){null!=n.showHeaderRow&&(this._showHeaderRow=n.showHeaderRow);null!=n.showTotalRow&&(this._showTotalRow=n.showTotalRow);null!=n.showBandedColumns&&(this._showBandedColumns=n.showBandedColumns);null!=n.showBandedRows&&(this._showBandedRows=n.showBandedRows);null!=n.alterFirstColumn&&(this._alterFirstColumn=n.alterFirstColumn);null!=n.alterLastColumn&&(this._alterLastColumn=n.alterLastColumn)}}Object.defineProperty(Table.prototype,"name",{get:function(){return this._name},set:function(e){if(null==e||""===e)throw"The name of the Table should not be empty.";if(this._name.toLowerCase()!==e.toLowerCase()){var t=this._name;this._name=e;if(this._owner){var o=void 0;!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(o=new _TableSettingAction(this._owner,this));this._owner._updateFormulasWithNameUpdating(t,e,!0);if(o){o.saveNewState();this._owner.undoStack._addAction(o);o=null}}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"sheet",{get:function(){return this._sheet},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"style",{get:function(){return this._style},set:function(e){if(e.name!==this._style.name){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._style=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"showHeaderRow",{get:function(){return this._showHeaderRow},set:function(e){if(e!==this._showHeaderRow){var t=void 0,o=this._showHeaderRow;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._showHeaderRow=e;if(this._owner)try{this._owner.beginUpdate();this._adjustTableRangeWithHeaderRow();if(t){t.saveNewState();this._owner.undoStack._addAction(t)}}catch(e){this._showHeaderRow=o;throw e}finally{t=null;this._owner.endUpdate()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"showTotalRow",{get:function(){return this._showTotalRow},set:function(e){if(e!==this._showTotalRow){var t=void 0,o=this._showTotalRow;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._showTotalRow=e;if(this._owner)try{this._owner.beginUpdate();this._adjustTableRangeWithTotalRow();if(t){t.saveNewState();this._owner.undoStack._addAction(t)}}catch(e){this._showTotalRow=o;throw e}finally{t=null;this._owner.endUpdate()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"showBandedColumns",{get:function(){return this._showBandedColumns},set:function(e){if(e!==this._showBandedColumns){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._showBandedColumns=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"showBandedRows",{get:function(){return this._showBandedRows},set:function(e){if(e!==this._showBandedRows){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._showBandedRows=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"alterFirstColumn",{get:function(){return this._alterFirstColumn},set:function(e){if(e!==this._alterFirstColumn){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._alterFirstColumn=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"alterLastColumn",{get:function(){return this._alterLastColumn},set:function(e){if(e!==this._alterLastColumn){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._alterLastColumn=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Table.prototype._isHeaderRow=function(e){return this._showHeaderRow&&e===this._range.topRow};Table.prototype._getTableRange=function(){return this._range};Table.prototype._getColumns=function(){return this._columns||[]};Table.prototype.getRange=function(e,t){void 0===e&&(e=TableSection.All);var o;switch(e){case TableSection.Data:o=this._getDataRange();break;case TableSection.Header:o=this._getHeaderRange();break;case TableSection.Footer:o=this._getFooterRange();break;default:o=this._range.clone()}if(null!=t&&o){var i=this._getColumnIndex(t);if(null==i)return null;o.col=o.col2=o.leftCol+i}return o};Table.prototype.getColumns=function(){return this._columns?this._columns.slice():[]};Table.prototype.insertRows=function(e,t,o){void 0===o&&(o=!0);var i=!1;null==t&&(t=1);if(!wijmo_1.isInt(t)||t<1)return!1;if(0===e&&this._showHeaderRow||e===this._range.rowSpan-1&&this._showTotalRow||e<0||e>=this._range.rowSpan)return!1;if(this._owner){var n=this.getRange(),l=this._flex;this._owner.beginUpdate();if(o){var r=new wijmo_grid_1.CellRange(n.bottomRow+1,n.col,n.bottomRow+1,n.col2);if(this._sheet._canShiftCells(r)){var s=this._sheet._needAddRowCountForInsertTableRows(t,n);if(l.collectionView){var a=l.itemsSource instanceof wijmo_1.CollectionView;l.collectionView.beginUpdate();for(var h=0;h<s;h++)a?l.itemsSource.sourceCollection.push({}):l.itemsSource.push({});l.collectionView.endUpdate(!0)}else for(h=0;h<s;h++)l.rows.push(new wijmo_grid_1.Row);this._sheet._moveDownCells(t,r);i=!0}}else this._canInsertRowsWithoutShift(t)&&(i=!0);if(i){this._sheet._moveDownCellsWithinTable(e,t,n);this._updateTableRange(0,t,0,0)}this._owner.endUpdate()}else{this._updateTableRange(0,t,0,0);i=!0}return i};Table.prototype.deleteRows=function(e,t,o){void 0===o&&(o=!0);null==t&&(t=1);if(wijmo_1.isInt(t)&&!(t<1)&&!(0===e&&this._showHeaderRow||e===this._range.rowSpan-1&&this._showTotalRow||e<0||e>=this._range.rowSpan||e+t>this._range.rowSpan-(this._showTotalRow?1:0)))if(this._owner){var i=!1,n=this.getRange(),l=void 0;this._owner.beginUpdate();if(o){l=new wijmo_grid_1.CellRange(n.bottomRow+1,n.col,n.bottomRow+1,n.col2);this._sheet._canShiftCells(l)&&(i=!0)}else i=!0;if(i){this._sheet._moveUpCellsWithinTable(e,t,n);o&&this._sheet._moveUpCells(t,l);this._updateTableRange(0,-t,0,0)}this._owner.endUpdate()}else this._updateTableRange(0,-t,0,0)};Table.prototype._addColumn=function(e,t){if(e<=0||e>this._columns.length)throw"The column index is out of range.";t=this._getUniqueColumnName(e,t);var o=new TableColumn(t);o._attach(this);this._columns.splice(e,0,o);if(this.showHeaderRow&&this._owner&&this._sheet){var i=this.getRange();this._flex.setCellData(i.topRow,i.leftCol+e,t)}};Table.prototype._updateCell=function(e,t,o){if(null!=this._style){var i=e-this._range.topRow,n=t-this._range.leftCol,l=this._getTableCellAppliedStyles(i,n);this._applyStylesForCell(l,o)}};Table.prototype._updateTableRange=function(e,t,o,i){if(this._range.row<=this._range.row2){this._range.row+=e;this._range.row2+=t}else{this._range.row2+=e;this._range.row+=t}if(this._range.col<=this._range.col2){this._range.col+=o;this._range.col2+=i}else{this._range.col2+=o;this._range.col+=i}};Table.prototype._setTableRange=function(e,t){this._range=e;if(null!=t){this._columns.splice(0,this._columns.length);for(var o=0;o<t.length;o++)this._columns.push(t[o])}};Table.prototype._updateColumnName=function(e,t,o){void 0===o&&(o=!0);var i=this._columns[e];if(!i||!i.name||i.name!==t){t=this._getUniqueColumnName(null,t);i.name=t;if(this._showHeaderRow&&this._owner&&this._sheet&&o){this._flex.setCellData(this._range.topRow,this._range.leftCol+e,t)}}};Table.prototype._updateColumnTotalRowContent=function(e,t){null==t&&(t=this._columns.indexOf(e));if(!(t<0)){var o;if(e.totalRowFunction){var i=this._getSubtotalFunction(e.totalRowFunction.toLowerCase());o=null!=i?"=subtotal("+i+",["+e.name+"])":"="===e.totalRowFunction[0]?e.totalRowFunction:"="+e.totalRowFunction}else if(0===t){e.totalRowLabel||(e.totalRowLabel="Total");o=e.totalRowLabel}else o=e.totalRowLabel;if(this._owner&&this._sheet){this._flex.setCellData(this._range.bottomRow,this._range.leftCol+t,o,!1)}}};Table.prototype._attachSheet=function(e){if(!this._sheet||!this._owner){this._sheet=e;this._owner=e._owner;if(null!=this._owner){if(this._owner._containsMergedCells(this._range,e))throw"Table does not allow the merged cell within the table.";var t=this.getRange();null==this._style&&(this._style=this._owner.getBuiltInTableStyle("TableStyleMedium9"));null!=this._columns&&0!==this._columns.length||this._generateColumns(this._showHeaderRow);try{this._owner.beginUpdate();this._showHeaderRow&&1===t.rowSpan&&this._adjustTableRangeWithHeaderRow();this._showTotalRow&&this._updateTotalRow()}finally{this._attached=!0;this._owner.endUpdate()}}}};Table.prototype._detachSheet=function(){this._attached=!1;this._sheet=null;this._owner=null};Object.defineProperty(Table.prototype,"_flex",{get:function(){return this._sheet===this._owner.selectedSheet?this._owner:this._sheet.grid},enumerable:!0,configurable:!0});Table.prototype._pushTableColumns=function(e){this._columns=[];for(var t=0;t<e.length;t++){var o=e[t];o._attach(this);this._columns.push(o)}};Table.prototype._generateColumns=function(e){if(!this._range.isValid)throw"The range of the table is invalid.";this._columns=[];for(var t=0;t<this._range.columnSpan;t++){var o=null,i=this._sheet.grid.columns[this._range.leftCol+t],n=this._range.topRow*this._sheet.grid.columns.length+this._range.leftCol+t,l=void 0,r=void 0,s=this._flex;if(1===this._range.rowSpan)l=this._getUniqueColumnName(t+1);else{null==(l=o=this._sheet.grid.getCellData(this._range.topRow,this._range.leftCol+t,!1))&&(l="");_isFormula(l)&&(l=this._owner.evaluate(l,"",this._sheet,!1));r=this._sheet._styledCells[n];var a=this._owner._formatEvaluatedResult(l,i,r?r.format:"");null!=l&&""==a||(l=a);l=this._getUniqueColumnName(t+1,l.toString())}if(e&&this._range.rowSpan>1){this._orgHeaderCellsContent[t]=this._sheet.grid.getCellData(this._range.topRow,this._range.leftCol+t,!1);isNaN(+l)||i.format||r&&r.format||(r?r.format="@":this._sheet._styledCells[n]={format:"@"});s.setCellData(this._range.topRow,this._range.leftCol+t,i.dataType===wijmo_1.DataType.Boolean&&wijmo_1.isBoolean(o)?o:l,!1)}var h=new TableColumn(l);h._attach(this);0===t?h._totalRowLabel="Total":t===this._range.columnSpan-1&&(h._totalRowFunction="Sum");this._columns.push(h)}};Table.prototype._getTableCellAppliedStyles=function(e,t){var o={},i=0,n=!1,l=!1;this._showHeaderRow&&(i=1);this._showHeaderRow&&0===e?n=!0:this._showTotalRow&&e===this._range.rowSpan-1&&(l=!0);this._extendStyle(o,this._style.wholeTableStyle,e,t,n,l);if(!n&&!l){if(this._showBandedColumns&&(null!=this._style.firstBandedColumnStyle||null!=this._style.secondBandedColumnStyle)){var r=void 0;t%((r=this._style.firstBandedColumnStyle?null==this._style.firstBandedColumnStyle.size?1:this._style.firstBandedColumnStyle.size:1)+(this._style.secondBandedColumnStyle?null==this._style.secondBandedColumnStyle.size?1:this._style.secondBandedColumnStyle.size:1))>=r?this._style.secondBandedColumnStyle&&this._extendStyle(o,this._style.secondBandedRowStyle,e,t,n,l):this._style.firstBandedColumnStyle&&this._extendStyle(o,this._style.firstBandedColumnStyle,e,t,n,l)}if(this._showBandedRows&&(null!=this._style.firstBandedRowStyle||null!=this._style.secondBandedRowStyle)){r=void 0;(e-i)%((r=this._style.firstBandedRowStyle?null==this._style.firstBandedRowStyle.size?1:this._style.firstBandedRowStyle.size:1)+(this._style.secondBandedRowStyle?null==this._style.secondBandedRowStyle.size?1:this._style.secondBandedRowStyle.size:1))>=r?this._style.secondBandedRowStyle&&this._extendStyle(o,this._style.secondBandedRowStyle,e,t,n,l):this._style.firstBandedRowStyle&&this._extendStyle(o,this._style.firstBandedRowStyle,e,t,n,l)}}this._alterLastColumn&&t===this._range.columnSpan-1&&this._style.lastColumnStyle&&this._extendStyle(o,this._style.lastColumnStyle,e,t,n,l);this._alterFirstColumn&&0===t&&this._style.firstColumnStyle&&this._extendStyle(o,this._style.firstColumnStyle,e,t,n,l);if(n){this._style.headerRowStyle&&this._extendStyle(o,this._style.headerRowStyle,e,t,n,l);t===this._range.columnSpan-1&&this._style.lastHeaderCellStyle&&this._extendStyle(o,this._style.lastHeaderCellStyle,e,t,n,l);0===t&&this._style.firstHeaderCellStyle&&this._extendStyle(o,this._style.firstHeaderCellStyle,e,t,n,l)}else if(l){this._style.totalRowStyle&&this._extendStyle(o,this._style.totalRowStyle,e,t,n,l);t===this._range.columnSpan-1&&this._style.lastTotalCellStyle&&this._extendStyle(o,this._style.lastTotalCellStyle,e,t,n,l);0===t&&this._style.firstTotalCellStyle&&this._extendStyle(o,this._style.firstTotalCellStyle,e,t,n,l)}return o};Table.prototype._applyStylesForCell=function(e,t){var o=t.style;for(var i in e){var n=e[i];n&&("className"==i?wijmo_1.addClass(t,n):o[i]=n)}};Table.prototype._extendStyle=function(e,t,o,i,n,l){for(var r in t){var s=t[r];null!==s&&(r.indexOf("borderTop")>-1?(0===o||l)&&(e[r]=s):r.indexOf("borderBottom")>-1?(o===this._range.rowSpan-1||n)&&(e[r]=s):r.indexOf("borderLeft")>-1?0===i&&(e[r]=s):r.indexOf("borderRight")>-1?i===this._range.columnSpan-1&&(e[r]=s):r.indexOf("borderHorizontal")>-1?o<this._range.rowSpan-1&&("borderHorizontalStyle"===r?e.borderBottomStyle=s:"borderHorizontalWidth"===r?e.borderBottomWidth=s:e.borderBottomColor=s):r.indexOf("borderVertical")>-1?i<this._range.columnSpan-1&&("borderVerticalStyle"===r?e.borderRightStyle=s:"borderVerticalWidth"===r?e.borderRightWidth=s:e.borderRightColor=s):e[r]=s)}};Table.prototype._getSubtotalFunction=function(e){switch(e){case"average":return"101";case"countnums":return"102";case"count":return"103";case"max":return"104";case"min":return"105";case"stddev":return"107";case"sum":return"109";case"var":return"110"}return null};Table.prototype._checkColumnNameExist=function(e){for(var t=this.getColumns(),o=0;o<t.length;o++){if(t[o].name.toLowerCase()===e.toLowerCase())return!0}return!1};Table.prototype._adjustTableRangeWithHeaderRow=function(){var e=this._flex;if(this._showHeaderRow){if(this._sheet._needMoveDownTable(this)){var t=this.getRange(),o=new wijmo_grid_1.CellRange(t.bottomRow+1,t.col,t.bottomRow+1,t.col2);if(!this._sheet._canShiftCells(o))throw"The operation is not allowed. The operation is attempting to shift the cells in a table or a merged cell on the current sheet.";if(1===this._sheet._needAddRowCountForInsertTableRows(1,t))if(e.collectionView){e.collectionView.beginUpdate();e.itemsSource instanceof wijmo_1.CollectionView?e.itemsSource.sourceCollection.push({}):e.itemsSource.push({});e.collectionView.endUpdate(!0)}else e.rows.push(new wijmo_grid_1.Row);this._sheet._moveDownCells(1,o);this._sheet._moveDownTable(this)}this._range.row<=this._range.row2?this._range.row-=1:this._range.row2-=1;for(var i=0;i<this._columns.length;i++){var n=this._columns[i];this._orgHeaderCellsContent[i]=e.getCellData(this._range.topRow,this._range.leftCol+i,!1);e.setCellData(this._range.topRow,this._range.leftCol+i,n.name)}}else{for(i=this._range.leftCol;i<=this._range.rightCol;i++)e.setCellData(this._range.topRow,i,"");this._range.row<=this._range.row2?this._range.row+=1:this._range.row2+=1}};Table.prototype._adjustTableRangeWithTotalRow=function(){var e=this._sheet===this._owner.selectedSheet?this._owner:this._sheet.grid,t=this.getRange(),o=new wijmo_grid_1.CellRange(t.bottomRow+1,t.col,t.bottomRow+1,t.col2);if(this._showTotalRow){if(this._sheet._canShiftCells(o)){if(1===this._sheet._needAddRowCountForInsertTableRows(1,t))if(e.collectionView){e.collectionView.beginUpdate();e.itemsSource instanceof wijmo_1.CollectionView?e.itemsSource.sourceCollection.push({}):e.itemsSource.push({});e.collectionView.endUpdate(!0)}else e.rows.push(new wijmo_grid_1.Row);this._sheet._moveDownCells(1,o);this._owner._updateAffectedFormula(this._range.bottomRow+1,1,!0,!0,this.getRange())}else if(!this._beneathRowIsEmpty())throw"The operation is not allowed. The operation is attempting to shift the cells in a table or a merged cell on the current sheet.";this._range.row<=this._range.row2?this._range.row2+=1:this._range.row+=1;this._updateTotalRow()}else{for(var i=this._range.leftCol;i<=this._range.rightCol;i++)e.setCellData(this._range.bottomRow,i,"");if(this._sheet._canShiftCells(o)){this._owner._updateAffectedFormula(this._range.bottomRow,1,!1,!0,this.getRange());this._sheet._moveUpCells(1,o)}this._range.row<=this._range.row2?this._range.row2-=1:this._range.row-=1}};Table.prototype._updateTotalRow=function(){if(this.showTotalRow)for(var e=0;e<this._columns.length;e++){var t=this._columns[e];this._updateColumnTotalRowContent(t,e)}};Table.prototype._getUniqueColumnName=function(e,t){null!=t&&""!==t||(t="Column"+e);if(this._checkColumnNameExist(t)){for(var o=1,i=t+o;this._checkColumnNameExist(i);)i=t+ ++o;t=i}return t};Table.prototype._moveColumns=function(e,t){if(this._columns){var o=this._columns[e];this._columns.splice(e,1);t<0&&(t=this._columns.length);this._columns.splice(t,0,o)}};Table.prototype._canInsertRowsWithoutShift=function(e){var t=this._flex;if(this._range.bottomRow+e>=t.rows.length)return!1;for(var o=1;o<=e;o++)for(var i=this._range.bottomRow+o,n=this._range.leftCol;n<=this._range.rightCol;n++){var l=t.getCellData(i,n,!1),r=this._sheet.getCellStyle(i,n);if(null!=l&&""!==l||null!=r)return!1}return!0};Table.prototype._beneathRowIsEmpty=function(){var e=this._range.bottomRow+1,t=this._flex;if(e>=t.rows.length)return!1;for(var o=this._range.leftCol;o<=this._range.rightCol;o++){var i=t.getCellData(this._range.bottomRow+1,o,!1);if(null!=i&&""!==i)return!1;if(null!=this._sheet.getCellStyle(this._range.bottomRow+1,o))return!1;if(this._sheet.findTable(e,o))return null;var n=e*t.columns.length+o;if(null!=this._sheet._mergedRanges[n])return!1}return!0};Table.prototype._getDataRange=function(){var e=this._range.topRow,t=this._range.bottomRow;this._showHeaderRow&&(e+=1);this._showTotalRow&&(t-=1);return new wijmo_grid_1.CellRange(e,this._range.leftCol,t,this._range.rightCol)};Table.prototype._getHeaderRange=function(){return this._showHeaderRow?new wijmo_grid_1.CellRange(this._range.topRow,this._range.leftCol,this._range.topRow,this._range.rightCol):null};Table.prototype._getFooterRange=function(){return this._showTotalRow?new wijmo_grid_1.CellRange(this._range.bottomRow,this._range.leftCol,this._range.bottomRow,this._range.rightCol):null};Table.prototype._getColumnIndex=function(e){var t;if(wijmo_1.isInt(e)&&e>=0&&e<this._columns.length)t=e;else{var o=void 0;e instanceof TableColumn?o=e.name.toLowerCase():wijmo_1.isString(e)&&""!==e&&(o=e.toLowerCase());for(var i=this.getColumns(),n=0;n<i.length;n++)if(i[n].name.toLowerCase()===o){t=n;break}}return t};return Table}();exports.Table=Table;var TableColumn=function(){function TableColumn(e,t,o,i){void 0===i&&(i=!0);this._name=e;this._totalRowLabel=t;this._totalRowFunction=o;null!=i&&(this._showFilterButton=i)}Object.defineProperty(TableColumn.prototype,"table",{get:function(){return this._table},enumerable:!0,configurable:!0});Object.defineProperty(TableColumn.prototype,"name",{get:function(){return this._name},set:function(e){e!==this._name&&(this._name=e)},enumerable:!0,configurable:!0});Object.defineProperty(TableColumn.prototype,"totalRowLabel",{get:function(){return this._totalRowLabel},set:function(e){if(e!==this._totalRowLabel){this._totalRowLabel=e;this._updateTableTotalInfo()}},enumerable:!0,configurable:!0});Object.defineProperty(TableColumn.prototype,"totalRowFunction",{get:function(){return this._totalRowFunction},set:function(e){if(e!==this._totalRowFunction){this._totalRowFunction=e;this._updateTableTotalInfo()}},enumerable:!0,configurable:!0});Object.defineProperty(TableColumn.prototype,"showFilterButton",{get:function(){return this._showFilterButton},set:function(e){this._showFilterButton!==e&&(this._showFilterButton=e)},enumerable:!0,configurable:!0});TableColumn.prototype._attach=function(e){this._table=e};TableColumn.prototype._updateTableTotalInfo=function(){if(this._table&&this._table.showTotalRow){this._table._updateColumnTotalRowContent(this);this._table._owner&&this._table._owner.refresh()}};return TableColumn}();exports.TableColumn=TableColumn;var TableSection,TableStyle=function(){function TableStyle(e,t){void 0===t&&(t=!1);this._name=e;this._isBuiltIn=t}Object.defineProperty(TableStyle.prototype,"name",{get:function(){return this._name},set:function(e){e!==this._name&&(this._name=e)},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"wholeTableStyle",{get:function(){return this._wholeTableStyle},set:function(e){this._wholeTableStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstBandedColumnStyle",{get:function(){return this._firstBandedColumnStyle},set:function(e){this._firstBandedColumnStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"secondBandedColumnStyle",{get:function(){return this._secondBandedColumnStyle},set:function(e){this._secondBandedColumnStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstBandedRowStyle",{get:function(){return this._firstBandedRowStyle},set:function(e){this._firstBandedRowStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"secondBandedRowStyle",{get:function(){return this._secondBandedRowStyle},set:function(e){this._secondBandedRowStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstColumnStyle",{get:function(){return this._firstColumnStyle},set:function(e){this._firstColumnStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"lastColumnStyle",{get:function(){return this._lastColumnStyle},set:function(e){this._lastColumnStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"headerRowStyle",{get:function(){return this._headerRowStyle},set:function(e){this._headerRowStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"totalRowStyle",{get:function(){return this._totalRowStyle},set:function(e){this._totalRowStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstHeaderCellStyle",{get:function(){return this._firstHeaderCellStyle},set:function(e){this._firstHeaderCellStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"lastHeaderCellStyle",{get:function(){return this._lastHeaderCellStyle},set:function(e){this._lastHeaderCellStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstTotalCellStyle",{get:function(){return this._firstTotalCellStyle},set:function(e){this._firstTotalCellStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"lastTotalCellStyle",{get:function(){return this._lastTotalCellStyle},set:function(e){this._lastTotalCellStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"isBuiltIn",{get:function(){return this._isBuiltIn},enumerable:!0,configurable:!0});return TableStyle}();exports.TableStyle=TableStyle;!function(e){e[e.All=0]="All";e[e.Data=1]="Data";e[e.Header=2]="Header";e[e.Footer=3]="Footer"}(TableSection=exports.TableSection||(exports.TableSection={}));var _UndoAction=function(){function _UndoAction(e){this._owner=e;this._sheetUuid=e.selectedSheet?e.selectedSheet._uid:-1}Object.defineProperty(_UndoAction.prototype,"sheetUid",{get:function(){return this._sheetUuid},enumerable:!0,configurable:!0});_UndoAction.prototype.undo=function(){throw"This abstract method must be overridden."};_UndoAction.prototype.redo=function(){throw"This abstract method must be overridden."};_UndoAction.prototype.saveNewState=function(){throw"This abstract method must be overridden."};return _UndoAction}();exports._UndoAction=_UndoAction;var _EditAction=function(e){__extends(_EditAction,e);function _EditAction(t,o){var i=e.call(this,t)||this;i._isPaste=!1;i._selections=o?[o]:t.selectedSheet.selectionRanges.length>0?t.selectedSheet.selectionRanges.slice():[t.selection.clone()];i._mergeAction=new _CellMergeAction(t);i._cellStyleAction=new _CellStyleAction(t);i._saveValues(!0);return i}Object.defineProperty(_EditAction.prototype,"isPaste",{get:function(){return this._isPaste},enumerable:!0,configurable:!0});_EditAction.prototype.undo=function(){this._handleUndoRedo(!0)};_EditAction.prototype.redo=function(){this._handleUndoRedo(!1)};_EditAction.prototype.saveNewState=function(){if(!this._saveValues(!1))return!1;this._mergeAction.saveNewState();this._cellStyleAction.saveNewState();return this._checkActionState()};_EditAction.prototype.markIsPaste=function(){this._isPaste=!0};_EditAction.prototype.updateForPasting=function(e){var t=this._selections[this._selections.length-1],o=this._owner.getCellData(e.row,e.col,!!this._owner.columns[e.col].dataMap);if(!t){t=this._owner.selection;this._selections=[t]}o=null==o?"":o;this._oldValues["r"+e.row+"_c"+e.col]={row:e.row,col:e.col,value:o};t.row=Math.min(t.topRow,e.topRow);t.row2=Math.max(t.bottomRow,e.bottomRow);t.col=Math.min(t.leftCol,e.leftCol);t.col2=Math.max(t.rightCol,e.rightCol)};_EditAction.prototype._storeDeletedTables=function(e){null==this._deletedTables&&(this._deletedTables=[]);this._deletedTables.push(e)};_EditAction.prototype._checkActionState=function(){var e=this,t=!1;Object.keys(this._oldValues).forEach((function(o){var i,n;if(!t){i=e._oldValues[o];n=e._newValues[o];i&&n&&i.value!==n.value&&(t=!0)}}));return t||this._mergeAction._checkActionState()||this._cellStyleAction._checkActionState()};_EditAction.prototype._saveValues=function(e){for(var t={},o=0;o<this._selections.length;o++)for(var i=this._selections[o],n=i.topRow;n<=i.bottomRow;n++)if(!(n<0))for(var l=i.leftCol;l<=i.rightCol;l++){var r=this._owner.columns[l];if(!r)return!1;var s=this._owner.getCellData(n,l,!!r.dataMap);s=null==s?"":s;t["r"+n+"_c"+l]={row:n,col:l,value:s}}e?this._oldValues=t:this._newValues=t;return!0};_EditAction.prototype._handleUndoRedo=function(e){var t=this;this._owner._clearCalcEngine();this._owner.selectedSheet.selectionRanges.clear();this._owner.deferUpdate((function(){var o,i=e?t._oldValues:t._newValues;if(t._deletedTables&&t._deletedTables.length>0)for(var n=0;n<t._deletedTables.length;n++){var l=t._deletedTables[n];e?t._owner.selectedSheet.tables.push(l):t._owner.selectedSheet.tables.remove(l)}for(n=0;n<t._selections.length;n++){var r=t._selections[n];t._owner.selectedSheet.selectionRanges.push(r)}Object.keys(i).forEach((function(e){var o=i[e];t._owner.setCellData(o.row,o.col,o.value)}));t._affectedFormulas&&(o=e?t._affectedFormulas.oldFormulas:t._affectedFormulas.newFormulas);if(o&&o.length>0)for(n=0;n<o.length;n++){var s=o[n];t._owner.setCellData(s.point.x,s.point.y,s.formula)}if(e){t._mergeAction.undo();t._cellStyleAction.undo()}else{t._mergeAction.redo();t._cellStyleAction.redo()}t._owner.refresh(!1)}))};return _EditAction}(_UndoAction);exports._EditAction=_EditAction;var _ColumnResizeAction=function(e){__extends(_ColumnResizeAction,e);function _ColumnResizeAction(t,o,i){var n=e.call(this,t)||this;n._panel=o;n._colIndex=i;n._oldColWidth=o.columns[i].width;return n}_ColumnResizeAction.prototype.undo=function(){this._handleUndoRedo(!0)};_ColumnResizeAction.prototype.redo=function(){this._handleUndoRedo(!1)};_ColumnResizeAction.prototype.saveNewState=function(){this._newColWidth=this._panel.columns[this._colIndex].width;return this._oldColWidth!==this._newColWidth};_ColumnResizeAction.prototype._handleUndoRedo=function(e){var t=this._panel.columns[this._colIndex];t&&(t.width=e?this._oldColWidth:this._newColWidth)};return _ColumnResizeAction}(_UndoAction);exports._ColumnResizeAction=_ColumnResizeAction;var _RowResizeAction=function(e){__extends(_RowResizeAction,e);function _RowResizeAction(t,o,i){var n=e.call(this,t)||this;n._panel=o;n._rowIndex=i;n._oldRowHeight=o.rows[i].height;return n}_RowResizeAction.prototype.undo=function(){this._handleUndoRedo(!0)};_RowResizeAction.prototype.redo=function(){this._handleUndoRedo(!1)};_RowResizeAction.prototype.saveNewState=function(){this._newRowHeight=this._panel.rows[this._rowIndex].height;return this._oldRowHeight!==this._newRowHeight};_RowResizeAction.prototype._handleUndoRedo=function(e){var t=this._panel.rows[this._rowIndex];t&&(t.height=e?this._oldRowHeight:this._newRowHeight)};return _RowResizeAction}(_UndoAction);exports._RowResizeAction=_RowResizeAction;var _ColumnsChangedAction=function(e){__extends(_ColumnsChangedAction,e);function _ColumnsChangedAction(t,o,i,n){var l=e.call(this,t)||this;l._delSubActions=[];l._columnIndex=o;l._count=i;l._isAdding=n;l._saveValues(!0);return l}_ColumnsChangedAction.prototype.undo=function(){this._handleUndoRedo(!0)};_ColumnsChangedAction.prototype.redo=function(){this._handleUndoRedo(!1)};_ColumnsChangedAction.prototype.saveNewState=function(){this._saveValues(!1);return!0};_ColumnsChangedAction.prototype._saveValues=function(e){var t=[],o=[];if(null==this._isAdding)for(var i=0;i<this._owner.columns.length;i++)t.push(this._owner.columns[i]);else if(e&&!this._isAdding||!e&&this._isAdding)for(i=this._columnIndex;i<this._columnIndex+this._count&&i<this._owner.columns.length;i++)t.push(this._owner.columns[i]);if(this._owner.selectedSheet.tables&&this._owner.selectedSheet.tables.length>0)for(i=0;i<this._owner.selectedSheet.tables.length;i++){var n=this._owner.selectedSheet.tables[i];n&&n.sheet.name===this._owner.selectedSheet.name&&o.push({name:n.name,range:n.getRange(),columns:n.getColumns()})}var l={columns:t,sortList:this._owner.sortManager._cloneSortList(this._owner.sortManager._committedList),styledCells:this._owner.selectedSheet?this._owner._cloneObject(this._owner.selectedSheet._styledCells):null,mergedCells:this._owner.selectedSheet?this._owner.selectedSheet._cloneMergedCells():null,tableRanges:o,selection:this._owner.selection,filterDef:this._owner.selectedSheet._filterDefinition};e?this._oldValue=l:this._newValue=l};_ColumnsChangedAction.prototype._handleUndoRedo=function(e,t){var o=this;void 0===t&&(t=!0);var i=e?this._oldValue:this._newValue;if(this._owner.selectedSheet)if(this._delSubActions.length)this._owner.deferUpdate((function(){if(e)for(var t=o._delSubActions.length-1;t>=0;t--){o._delSubActions[t]._handleUndoRedo(e,!1)}else for(t=0;t<o._delSubActions.length;t++){o._delSubActions[t]._handleUndoRedo(e,!1)}}));else{try{t&&this._owner.beginUpdate();var n=void 0;this._owner._isUndoing=!0;this._owner._clearCalcEngine();this._owner.finishEditing();if(null==this._isAdding){this._owner.columns.clear();this._columnIndex=0}this._owner.selectedSheet._styledCells=null;this._owner.selectedSheet._mergedRanges.length=0;this._owner.columns.beginUpdate();if(i.columns&&i.columns.length>0)for(var l=0;l<i.columns.length;l++){if((r=i.columns[l])&&r.isVisible){this._owner.columns.insert(this._columnIndex+l,r);if(this._owner.itemsSource&&(n=this._owner.rows[this._owner._getDataRowsOffset()-1])){n._ubv||(n._ubv={});n._ubv[r._hash]=r.header}}}else for(l=this._columnIndex+this._count-1;l>=this._columnIndex;l--){var r;(r=this._owner.columns[l])&&r.isVisible&&this._owner.columns.removeAt(l)}this._owner.columns.endUpdate();this._owner.selectedSheet._styledCells=this._owner._cloneObject(i.styledCells);for(var s=0;s<i.mergedCells.length;s++)this._owner.selectedSheet._mergedRanges[s]=i.mergedCells[s];for(s=0;s<i.tableRanges.length;s++){var a=i.tableRanges[s];(d=this._owner._getTable(a.name))&&d._setTableRange(a.range,a.columns)}var h=void 0;this._affectedFormulas&&(h=e?this._affectedFormulas.oldFormulas:this._affectedFormulas.newFormulas);if(h&&h.length>0)for(s=0;s<h.length;s++){var u=h[s];null!=u.point?u.sheet.name===this._owner.selectedSheet.name?this._owner.setCellData(u.point.x,u.point.y,u.formula):u.sheet.grid.setCellData(u.point.x,u.point.y,u.formula):u.row._ubv[u.column._hash]=u.formula}if(this._deletedTables&&this._deletedTables.length>0)for(s=0;s<this._deletedTables.length;s++){var d=this._deletedTables[s];e?this._owner.selectedSheet.tables.push(d):this._owner.selectedSheet.tables.remove(d)}var _=void 0;this._affectedDefinedNameVals&&(_=e?this._affectedDefinedNameVals.oldDefinedNameVals:this._affectedDefinedNameVals.newDefinedNameVals);if(_&&_.length>0)for(s=0;s<_.length;s++){var c=_[s],g=this._owner.definedNames._getIndexByName(c.name);g>-1&&(this._owner.definedNames[g].value=c.value)}this._owner.selectedSheet.grid.wj_sheetInfo.styledCells=this._owner.selectedSheet._styledCells;this._owner.selectedSheet.grid.wj_sheetInfo.mergedRanges=this._owner.selectedSheet._mergedRanges}finally{t&&this._owner.endUpdate()}this._owner._copyColumnsToSelectedSheet();this._owner.sortManager.sortDescriptions.sourceCollection=i.sortList.slice();if(this._owner.selectedSheet._filterDefinition!==i.filterDef){this._owner._isUndoing=!0;this._owner.selectedSheet._filterDefinition=i.filterDef;this._owner.selectedSheet._applyFilterSetting();this._owner._isUndoing=!1;this._owner.filter.apply()}this._owner.sortManager.commitSort(!1);this._owner.selection=i.selection;this._owner._isUndoing=!1}};return _ColumnsChangedAction}(_UndoAction);exports._ColumnsChangedAction=_ColumnsChangedAction;var _RowsChangedAction=function(e){__extends(_RowsChangedAction,e);function _RowsChangedAction(t,o,i,n){var l=e.call(this,t)||this;l._delSubActions=[];l._headerRowIndex=-1;if(t.itemsSource){l._headerRowAtTop=t._headerRowAtTop();if(!l._headerRowAtTop)for(var r=0;r<t.rows.length;r++)if(t.rows[r]instanceof HeaderRow){l._headerRowIndex=r;break}}l._rowIndex=o;l._count=i;l._isAdding=n;l._saveValues(!0);return l}_RowsChangedAction.prototype.undo=function(){this._handleUndoRedo(!0)};_RowsChangedAction.prototype.redo=function(){this._handleUndoRedo(!1)};_RowsChangedAction.prototype.saveNewState=function(){this._saveValues(!1);return!0};_RowsChangedAction.prototype.addDeleteSubAction=function(e){this._delSubActions.push(e)};_RowsChangedAction.prototype._saveValues=function(e){var t,o,i=[],n=[],l=[];if(null==this._isAdding)if(this._owner.itemsSource){t=this._owner.itemsSource instanceof wijmo_1.CollectionView?this._owner.itemsSource.sourceCollection.slice():this._owner.itemsSource.slice();for(var r=0;r<this._owner.columns.length;r++)n.push(this._owner.columns[r])}else for(r=0;r<this._owner.rows.length;r++)i.push(this._owner.rows[r]);else{if(e&&!this._isAdding||!e&&this._isAdding)for(r=this._rowIndex;r<this._rowIndex+this._count&&r<this._owner.rows.length;r++){var s=this._owner.rows[r];s.isVisible||this._isAdding?i.push(s):i.push(null)}this._owner.collectionView&&this._owner.collectionView.sortDescriptions.length>0&&(o=this._owner.collectionView._view.slice())}if(this._owner.selectedSheet.tables&&this._owner.selectedSheet.tables.length>0)for(r=0;r<this._owner.selectedSheet.tables.length;r++){var a=this._owner.selectedSheet.tables[r];a&&a.sheet.name===this._owner.selectedSheet.name&&l.push({name:a.name,range:a.getRange(),setting:{showHeaderRow:a.showHeaderRow,showTotalRow:a.showTotalRow}})}var h={rows:i,columns:n,itemsSource:t,styledCells:this._owner.selectedSheet?this._owner._cloneObject(this._owner.selectedSheet._styledCells):null,mergedCells:this._owner.selectedSheet?this._owner.selectedSheet._cloneMergedCells():null,tableSettings:l,selection:this._owner.selection,dataView:o,scrollPosition:this._owner.scrollPosition};e?this._oldValue=h:this._newValue=h};_RowsChangedAction.prototype._handleUndoRedo=function(e,t){var o=this;void 0===t&&(t=!0);var i,n=!!this._owner.itemsSource,l=e?this._oldValue:this._newValue;if(this._owner.selectedSheet)if(this._delSubActions.length)this._owner.deferUpdate((function(){if(e)for(var t=o._delSubActions.length-1;t>=0;t--){o._delSubActions[t]._handleUndoRedo(e,!1)}else{for(t=0;t<o._delSubActions.length;t++){o._delSubActions[t]._handleUndoRedo(e,!1)}o._owner.selection=o._newValue.selection}}));else{try{t&&this._owner.beginUpdate();this._owner._isUndoing=!0;this._owner._clearCalcEngine();this._owner.finishEditing();if(null==this._isAdding){this._owner.itemsSource&&this._owner.columns.clear();this._owner.rows.clear();this._rowIndex=0}this._owner.selectedSheet._styledCells=null;this._owner.selectedSheet._mergedRanges.length=0;if(null==this._isAdding&&n){i=this._owner.autoGenerateColumns;this._owner.autoGenerateColumns=!1;this._owner.collectionView.beginUpdate();if(this._owner.itemsSource instanceof wijmo_1.CollectionView){var r=[0,this._owner.itemsSource.sourceCollection.length].concat(l.itemsSource);Array.prototype.splice.apply(this._owner.itemsSource.sourceCollection,r)}else this._owner.itemsSource=l.itemsSource.slice();this._owner.columns.beginUpdate();for(var s=0;s<l.columns.length;s++)this._owner.columns.push(l.columns[s]);this._owner.columns.endUpdate();this._owner.collectionView.endUpdate(!0);this._owner.autoGenerateColumns=i}else{this._owner.rows.beginUpdate();if(n){i=this._owner.autoGenerateColumns;this._owner.autoGenerateColumns=!1;this._owner.collectionView.beginUpdate()}var a=this._owner.collectionView,h=a instanceof wijmo_1.CollectionView?a:null;if(l.rows&&l.rows.length>0){var u=void 0;if(n){var d=this._owner._getDataRowsOffset();u=Math.max(this._rowIndex-d,0);!this._isAdding&&!this._headerRowAtTop&&this._owner._headerRowAtTop()&&this._rowIndex>=d&&u<this._headerRowIndex&&u++}for(s=0;s<l.rows.length;s++){if(p=l.rows[s])if(n&&p.dataItem){var _=null!=p.dataItem._itemIdx?p.dataItem._itemIdx:u+s;this._owner._updateItemIndexForInsertingRow(a.sourceCollection,_,1);a.sourceCollection.splice(_,0,p.dataItem);if(h&&h.trackChanges){var c=h.itemsRemoved.indexOf(p.dataItem)>=0;c&&h.itemsRemoved.remove(p.dataItem);!c&&h.itemsAdded.indexOf(p.dataItem)<=0&&h.itemsAdded.push(p.dataItem)}}else this._owner.rows.insert(this._rowIndex+s,p)}}else{var g=this._rowIndex;!this._isAdding&&!this._headerRowAtTop&&this._owner._headerRowAtTop()&&g<this._headerRowIndex&&g++;for(var f=g+this._count-1;f>=g;f--){var p;if(p=this._owner.rows[f])if(n&&p.dataItem){_=null!=p.dataItem._itemIdx?p.dataItem._itemIdx:f-this._owner._getDataRowsOffset();a.sourceCollection.splice(_,1);this._owner._updateItemIndexForRemovingRow(a.sourceCollection,_);if(h&&h.trackChanges){var m=h.itemsAdded.indexOf(p.dataItem)>=0;m&&h.itemsAdded.remove(p.dataItem);!m&&h.itemsRemoved.indexOf(p.dataItem)<0&&h.itemsRemoved.push(p.dataItem)}}else this._owner.rows.removeAt(f)}}if(n){this._owner._lastCount=this._owner.collectionView.itemCount;this._owner.collectionView.endUpdate(!0);this._owner.selectedSheet._dataView=this._owner.collectionView._view.slice();if(l.dataView&&l.dataView.length>0){this._owner.collectionView._view=l.dataView;this._owner.collectionView._pgView=this._owner.collectionView._getPageView();if(!(this._owner.itemsSource instanceof wijmo_1.CollectionView)){this._owner.selectedSheet.grid.collectionView._view=l.dataView;this._owner.selectedSheet.grid.collectionView._pgView=this._owner.selectedSheet.grid.collectionView._getPageView()}this._owner._bindGrid(!1);this._owner.selectedSheet.grid._bindGrid(!1)}this._owner.autoGenerateColumns=i}this._owner.rows.endUpdate()}this._owner.selectedSheet._styledCells=this._owner._cloneObject(l.styledCells);for(s=0;s<l.mergedCells.length;s++)this._owner.selectedSheet._mergedRanges[s]=l.mergedCells[s];for(s=0;s<l.tableSettings.length;s++){var w=l.tableSettings[s];if(b=this._owner._getTable(w.name)){b._showHeaderRow=w.setting.showHeaderRow;b._showTotalRow=w.setting.showTotalRow;b._setTableRange(w.range)}}var C=void 0;this._affectedFormulas&&(C=e?this._affectedFormulas.oldFormulas:this._affectedFormulas.newFormulas);if(C&&C.length>0)for(s=0;s<C.length;s++){var S=C[s];null!=S.point?S.sheet.name===this._owner.selectedSheet.name?this._owner.setCellData(S.point.x,S.point.y,S.formula):S.sheet.grid.setCellData(S.point.x,S.point.y,S.formula):S.row._ubv[S.column._hash]=S.formula}if(this._deletedTables&&this._deletedTables.length>0)for(s=0;s<this._deletedTables.length;s++){var b=this._deletedTables[s];e?this._owner.selectedSheet.tables.push(b):this._owner.selectedSheet.tables.remove(b)}var v=void 0;this._affectedDefinedNameVals&&(v=e?this._affectedDefinedNameVals.oldDefinedNameVals:this._affectedDefinedNameVals.newDefinedNameVals);if(v&&v.length>0)for(s=0;s<v.length;s++){var y=v[s],x=this._owner.definedNames._getIndexByName(y.name);x>-1&&(this._owner.definedNames[x].value=y.value)}this._owner.selectedSheet.grid.wj_sheetInfo.styledCells=this._owner.selectedSheet._styledCells;this._owner.selectedSheet.grid.wj_sheetInfo.mergedRanges=this._owner.selectedSheet._mergedRanges;this._owner.selection=l.selection;this._owner.scrollPosition=l.scrollPosition;this._owner._isUndoing=!1}finally{t&&this._owner.endUpdate()}this._owner._copyRowsToSelectedSheet()}};return _RowsChangedAction}(_UndoAction);exports._RowsChangedAction=_RowsChangedAction;var _CellStyleAction=function(e){__extends(_CellStyleAction,e);function _CellStyleAction(t,o){var i=e.call(this,t)||this;i._oldStyledCells=o?t._cloneObject(o):t.selectedSheet?t._cloneObject(t.selectedSheet._styledCells):null;return i}_CellStyleAction.prototype.undo=function(){this._handleUndoRedo(!0)};_CellStyleAction.prototype.redo=function(){this._handleUndoRedo(!1)};_CellStyleAction.prototype.saveNewState=function(){this._newStyledCells=this._owner.selectedSheet?this._owner._cloneObject(this._owner.selectedSheet._styledCells):null;return!0};_CellStyleAction.prototype._checkActionState=function(){return null!=this._oldStyledCells&&null==this._newStyledCells||null==this._oldStyledCells&&null!=this._newStyledCells||null!=this._oldStyledCells&&null!=this._newStyledCells&&this._oldStyledCells.length!==this._newStyledCells.length};_CellStyleAction.prototype._handleUndoRedo=function(e){var t;if(this._owner.selectedSheet){t=e?this._oldStyledCells:this._newStyledCells;this._owner.selectedSheet._styledCells=this._owner._cloneObject(t);this._owner.selectedSheet.grid.wj_sheetInfo.styledCells=this._owner.selectedSheet._styledCells;this._owner.refresh(!1)}};return _CellStyleAction}(_UndoAction);exports._CellStyleAction=_CellStyleAction;var _CellMergeAction=function(e){__extends(_CellMergeAction,e);function _CellMergeAction(t){var o=e.call(this,t)||this;o._oldMergedCells=t.selectedSheet?t.selectedSheet._cloneMergedCells():null;return o}_CellMergeAction.prototype.undo=function(){this._handleUndoRedo(!0)};_CellMergeAction.prototype.redo=function(){this._handleUndoRedo(!1)};_CellMergeAction.prototype.saveNewState=function(){this._newMergedCells=this._owner.selectedSheet?this._owner.selectedSheet._cloneMergedCells():null;return!0};_CellMergeAction.prototype._handleUndoRedo=function(e){var t,o;if(this._owner.selectedSheet){t=e?this._oldMergedCells:this._newMergedCells;this._owner._clearCalcEngine();if(t){this._owner.selectedSheet._mergedRanges.length=0;for(o=0;o<t.length;o++)this._owner.selectedSheet._mergedRanges[o]=t[o]}this._owner.selectedSheet.grid.wj_sheetInfo.mergedRanges=this._owner.selectedSheet._mergedRanges;this._owner.refresh(!0)}};_CellMergeAction.prototype._checkActionState=function(){var e,t,o;if(null!=this._oldMergedCells&&null==this._newMergedCells||null==this._oldMergedCells&&null!=this._newMergedCells)return!0;if(null!=this._oldMergedCells&&null!=this._newMergedCells&&this._oldMergedCells.length!==this._newMergedCells.length)return!0;if(null!=this._oldMergedCells&&null!=this._newMergedCells&&this._oldMergedCells.length===this._newMergedCells.length)for(e=0;e<this._oldMergedCells.length;e++){o=this._oldMergedCells[e];t=this._oldMergedCells[e];if(!o.equals(t))return!0}return!1};return _CellMergeAction}(_UndoAction);exports._CellMergeAction=_CellMergeAction;var _SortColumnAction=function(e){__extends(_SortColumnAction,e);function _SortColumnAction(t){var o=e.call(this,t)||this;o._saveValues(!0);return o}_SortColumnAction.prototype.undo=function(){this._handleUndoRedo(!0)};_SortColumnAction.prototype.redo=function(){this._handleUndoRedo(!1)};_SortColumnAction.prototype.saveNewState=function(){this._saveValues(!1);return!0};_SortColumnAction.prototype._saveValues=function(e){for(var t,o,i,n=[],l=0;l<this._owner.columns.length;l++)n.push(this._owner.columns[l]);if(this._owner.itemsSource){var r=this._owner._getDataRowsOffset();o=[];for(var s=0;s<this._owner.rows.length-r;s++){var a=this._owner.rows[s+r],h=a.dataItem;if(h){o[null!=h._itemIdx?h._itemIdx:s]=a.visible}}e&&(i=this._owner.collectionView._view.slice())}else{t=[];for(s=0;s<this._owner.rows.length;s++)t.push(this._owner.rows[s])}var u={sortList:this._owner.sortManager._committedList.slice(),rows:t,columns:n,selection:this._owner.selection.clone(),formulas:this._owner._scanFormulas(),styledCells:this._owner.selectedSheet?this._owner._cloneObject(this._owner.selectedSheet._styledCells):null,rowsVisible:o,dataView:i};e?this._oldValue=u:this._newValue=u};_SortColumnAction.prototype._handleUndoRedo=function(e){var t=this,o=e?this._oldValue:this._newValue,i=!!this._owner.itemsSource,n=this._owner.itemsSource instanceof wijmo_1.CollectionView;if(this._owner.selectedSheet){this._owner._isUndoing=!0;this._owner.deferUpdate((function(){t._owner._clearCalcEngine();t._owner.sortManager.sortDescriptions.sourceCollection=o.sortList.slice();t._owner.sortManager.commitSort(!1);t._owner.selectedSheet._styledCells=t._owner._cloneObject(o.styledCells);if(i){if(o.dataView&&o.dataView.length>0){t._owner.collectionView._view=o.dataView;t._owner.collectionView._pgView=t._owner.collectionView._getPageView();if(!n){t._owner.selectedSheet.grid.collectionView._view=o.dataView;t._owner.selectedSheet.grid.collectionView._pgView=t._owner.selectedSheet.grid.collectionView._getPageView()}t._owner._bindGrid(!1);t._owner.selectedSheet.grid._bindGrid(!1)}}else{t._owner.rows.clear();t._owner.selectedSheet.grid.rows.clear();for(var e=0;e<o.rows.length;e++){var l=o.rows[e];t._owner.selectedSheet.grid.rows.push(l);t._owner.rows.push(l)}t._owner.columns.clear();for(e=0;e<o.columns.length;e++){var r=o.columns[e];t._owner.columns.push(r)}t._owner._resetFormulas(o.formulas)}t._owner._isUndoing=!1}))}};return _SortColumnAction}(_UndoAction);exports._SortColumnAction=_SortColumnAction;var _MoveCellsAction=function(e){__extends(_MoveCellsAction,e);function _MoveCellsAction(t,o,i,n){var l=e.call(this,t)||this;if(!t.selectedSheet)return l;0===o.topRow&&o.bottomRow===t.rows.length-1?l._isDraggingColumns=!0:l._isDraggingColumns=!1;l._isCopyCells=n;l._dragRange=o;l._dropRange=i;l._saveValues(!0);return l}_MoveCellsAction.prototype.undo=function(){this._handleUndoRedo(!0)};_MoveCellsAction.prototype.redo=function(){this._handleUndoRedo(!1)};_MoveCellsAction.prototype.saveNewState=function(){if(!this._owner.selectedSheet)return!1;if(this._dropRange){this._saveValues(!1);return!0}return!1};_MoveCellsAction.prototype._saveValues=function(e){for(var t=[],o={},i=this._dropRange.topRow;i<=this._dropRange.bottomRow;i++)for(var n=this._dropRange.leftCol;n<=this._dropRange.rightCol;n++){this._isDraggingColumns&&(o[n]||(o[n]={dataType:this._owner.columns[n].dataType,align:this._owner.columns[n].align,format:this._owner.columns[n].format}));var l=i*this._owner.columns.length+n,r=this._owner.selectedSheet._styledCells[l]?this._owner._cloneObject(this._owner.selectedSheet._styledCells[l]):null,s=this._owner.getCellData(i,n,!1);t.push({rowIndex:i,columnIndex:n,cellContent:s,cellStyle:r})}if(e){this._oldDroppingCells=t;this._oldDroppingColumnSetting=o}else{this._newDroppingCells=t;this._newDroppingColumnSetting=o}if(this._isCopyCells){if(this._isDraggingColumns)if(e)for(i=this._dragRange.topRow;i<=this._dragRange.bottomRow;i++)for(n=this._dragRange.leftCol;n<=this._dragRange.rightCol;n++){if((_=this._owner.selectedSheet.findTable(i,n))&&_._isHeaderRow(i)){var a=_._getTableRange(),h=_._getColumns();this._draggingTableColumns||(this._draggingTableColumns=[]);this._draggingTableColumns.push({rowIndex:i,columnIndex:n,cellContent:h[n-a.leftCol].name})}}else if(this._draggingTableColumns&&this._draggingTableColumns.length>0&&this._draggingTableColumns&&this._draggingTableColumns.length>0)for(var u=0;u<this._draggingTableColumns.length;u++){var d=this._draggingTableColumns[u];if((_=this._owner.selectedSheet.findTable(d.rowIndex,d.columnIndex))&&_._isHeaderRow(d.rowIndex)){a=_._getTableRange(),h=_._getColumns();d.updatedCellContent=h[d.columnIndex-a.leftCol].name}}}else if(e){this._draggingCells=[];this._draggingColumnSetting={};for(i=this._dragRange.topRow;i<=this._dragRange.bottomRow;i++)for(n=this._dragRange.leftCol;n<=this._dragRange.rightCol;n++){this._isDraggingColumns&&(this._draggingColumnSetting[n]||(this._draggingColumnSetting[n]={dataType:this._owner.columns[n].dataType,align:this._owner.columns[n].align,format:this._owner.columns[n].format}));l=i*this._owner.columns.length+n,r=this._owner.selectedSheet._styledCells[l]?this._owner._cloneObject(this._owner.selectedSheet._styledCells[l]):null,s=this._owner.getCellData(i,n,!1);this._draggingCells.push({rowIndex:i,columnIndex:n,cellContent:s,cellStyle:r})}}else if(this._isDraggingColumns&&this._draggingCells&&this._draggingCells.length>0)for(u=0;u<this._draggingCells.length;u++){var _;d=this._draggingCells[u];if((_=this._owner.selectedSheet.findTable(d.rowIndex,d.columnIndex))&&_._isHeaderRow(d.rowIndex)){a=_._getTableRange(),h=_._getColumns();d.updatedCellContent=h[d.columnIndex-a.leftCol].name}}};_MoveCellsAction.prototype._handleUndoRedo=function(e){var t=this,o=e?this._oldDroppingCells:this._newDroppingCells,i=e?this._oldDroppingColumnSetting:this._newDroppingColumnSetting;if(this._owner.selectedSheet){this._owner._clearCalcEngine();this._owner.deferUpdate((function(){var n,l;t._affectedFormulas&&(n=e?t._affectedFormulas.oldFormulas:t._affectedFormulas.newFormulas);if(n&&n.length>0)for(var r=0;r<n.length;r++){var s=n[r];s.sheet.name===t._owner.selectedSheet.name?t._owner.setCellData(s.point.x,s.point.y,s.formula):s.sheet.grid.setCellData(s.point.x,s.point.y,s.formula)}t._affectedDefinedNameVals&&(l=e?t._affectedDefinedNameVals.oldDefinedNameVals:t._affectedDefinedNameVals.newDefinedNameVals);if(l&&l.length>0)for(r=0;r<l.length;r++){var a=l[r],h=t._owner.definedNames._getIndexByName(a.name);h>-1&&(t._owner.definedNames[h].value=a.value)}for(r=0;r<o.length;r++){var u=o[r];t._owner.setCellData(u.rowIndex,u.columnIndex,u.cellContent);if((g=t._owner.selectedSheet.findTable(u.rowIndex,u.columnIndex))&&g._isHeaderRow(u.rowIndex)){var d=g._getTableRange();(c=g._getColumns())[u.columnIndex-d.leftCol].name=u.cellContent}var _=u.rowIndex*t._owner.columns.length+u.columnIndex;u.cellStyle?t._owner.selectedSheet._styledCells[_]=u.cellStyle:delete t._owner.selectedSheet._styledCells[_]}t._isDraggingColumns&&i&&Object.keys(i).forEach((function(e){t._owner.columns[+e].dataType=i[+e].dataType?i[+e].dataType:wijmo_1.DataType.Object;t._owner.columns[+e].align=i[+e].align;t._owner.columns[+e].format=i[+e].format}));if(t._isCopyCells){if(t._draggingTableColumns&&t._draggingTableColumns.length>0)for(r=0;r<t._draggingTableColumns.length;r++){u=t._draggingTableColumns[r];if((g=t._owner.selectedSheet.findTable(u.rowIndex,u.columnIndex))&&g._isHeaderRow(u.rowIndex)){d=g._getTableRange();var c=g._getColumns();t._owner.setCellData(u.rowIndex,u.columnIndex,e?u.cellContent:u.updatedCellContent);c[u.columnIndex-d.leftCol].name=e?u.cellContent:u.updatedCellContent}}}else{for(r=0;r<t._draggingCells.length;r++){var g;u=t._draggingCells[r];if(g=t._owner.selectedSheet.findTable(u.rowIndex,u.columnIndex)){d=g._getTableRange(),c=g._getColumns();if(g._isHeaderRow(u.rowIndex)){t._owner.setCellData(u.rowIndex,u.columnIndex,e?u.cellContent:u.updatedCellContent);c[u.columnIndex-d.leftCol].name=e?u.cellContent:u.updatedCellContent}else t._owner.setCellData(u.rowIndex,u.columnIndex,e?u.cellContent:null)}else t._owner.setCellData(u.rowIndex,u.columnIndex,e?u.cellContent:null);_=u.rowIndex*t._owner.columns.length+u.columnIndex;e?u.cellStyle&&(t._owner.selectedSheet._styledCells[_]=u.cellStyle):t._owner.selectedSheet._styledCells[_]&&delete t._owner.selectedSheet._styledCells[_]}t._isDraggingColumns&&t._draggingColumnSetting&&Object.keys(t._draggingColumnSetting).forEach((function(o){t._owner.columns[+o].dataType=e&&t._draggingColumnSetting[+o].dataType?t._draggingColumnSetting[+o].dataType:wijmo_1.DataType.Object;t._owner.columns[+o].align=e?t._draggingColumnSetting[+o].align:null;t._owner.columns[+o].format=e?t._draggingColumnSetting[+o].format:null}));if(e){if(t._isDraggingColumns)if(t._dragRange.leftCol<t._dropRange.leftCol)for(var f=t._dragRange.leftCol,p=t._dropRange.leftCol;p<=t._dropRange.rightCol;p++){t._owner._updateColumnFiler(p,f);f++}else for(f=t._dragRange.rightCol,p=t._dropRange.rightCol;p>=t._dropRange.leftCol;p--){t._owner._updateColumnFiler(p,f);f--}}else if(t._isDraggingColumns)if(t._dragRange.leftCol>t._dropRange.leftCol)for(f=t._dropRange.leftCol,p=t._dragRange.leftCol;p<=t._dragRange.rightCol;p++){t._owner._updateColumnFiler(p,f);f++}else for(f=t._dropRange.rightCol,p=t._dragRange.rightCol;p>=t._dragRange.leftCol;p--){t._owner._updateColumnFiler(p,f);f--}}}))}};return _MoveCellsAction}(_UndoAction);exports._MoveCellsAction=_MoveCellsAction;var _CutAction=function(e){__extends(_CutAction,e);function _CutAction(t){var o=e.call(this,t)||this;o._oldValues=[];o._mergeAction=new _CellMergeAction(t);o._celltyleAction=new _CellStyleAction(t);o._cutSheet=t._copiedSheet;o._selection=t.selection;o._cutSelection=t.selectionMode===wijmo_grid_1.SelectionMode.ListBox?t._getSelectionForListBoxMode(o._cutSheet.grid):t._copiedRanges[0];o._saveCutValues(!0);return o}_CutAction.prototype.undo=function(){this._handleUndoRedo(!0)};_CutAction.prototype.redo=function(){this._handleUndoRedo(!1)};_CutAction.prototype.saveNewState=function(){this._cutSheet===this._owner.selectedSheet?this._owner:this._cutSheet.grid;this._saveCutValues(!1);this._newValues=[];for(var e=this._selection.topRow;e<=this._selection.bottomRow;e++)for(var t=this._selection.leftCol;t<=this._selection.rightCol;t++){if(!this._owner.columns[t])return!1;var o=this._owner.getCellData(e,t,!!this._owner.columns[t].dataMap);o=null==o?"":o;this._newValues.push({row:e,col:t,value:o})}this._mergeAction.saveNewState();this._celltyleAction.saveNewState();return!0};_CutAction.prototype.updateForPasting=function(e){var t=this._owner.getCellData(e.row,e.col,!!this._owner.columns[e.col].dataMap);t=null==t?"":t;this._oldValues.push({row:e.row,col:e.col,value:t});this._selection.row=Math.min(this._selection.topRow,e.topRow);this._selection.row2=Math.max(this._selection.bottomRow,e.bottomRow);this._selection.col=Math.min(this._selection.leftCol,e.leftCol);this._selection.col2=Math.max(this._selection.rightCol,e.rightCol)};_CutAction.prototype._saveCutValues=function(e){for(var t=this._cutSheet===this._owner.selectedSheet?this._owner:this._cutSheet.grid,o=[],i=this._cutSelection.topRow;i<=this._cutSelection.bottomRow;i++)if(null!=t.rows[i])for(var n=this._cutSelection.leftCol;n<=this._cutSelection.rightCol;n++){var l=t.getCellData(i,n,!!t.columns[n].dataMap);""===(l=null==l?"":l)&&t.columns[n].dataMap&&(l=null);o.push({row:i,col:n,value:l})}e?this._oldCutValues=o:this._newCutValues=o};_CutAction.prototype._handleUndoRedo=function(e){var t=this,o=e?this._oldCutValues:this._newCutValues,i=e?this._oldValues:this._newValues;this._owner._clearCalcEngine();this._owner.selectedSheet.selectionRanges.clear();this._owner.deferUpdate((function(){var n,l,r=t._cutSheet===t._owner.selectedSheet?t._owner:t._cutSheet.grid;t._owner.selectedSheet.selectionRanges.push(t._selection);for(n=0;n<o.length;n++){l=o[n];r.setCellData(l.row,l.col,l.value)}for(n=0;n<i.length;n++){l=i[n];t._owner.setCellData(l.row,l.col,l.value)}if(e){t._mergeAction.undo();t._celltyleAction.undo()}else{t._mergeAction.redo();t._celltyleAction.redo()}t._owner.refresh(!1)}))};return _CutAction}(_UndoAction);exports._CutAction=_CutAction;var _TableSettingAction=function(e){__extends(_TableSettingAction,e);function _TableSettingAction(t,o){var i=e.call(this,t)||this;i._table=o;i._saveValues(!0);return i}_TableSettingAction.prototype.undo=function(){this._handleUndoRedo(!0)};_TableSettingAction.prototype.redo=function(){this._handleUndoRedo(!1)};_TableSettingAction.prototype.saveNewState=function(){this._saveValues(!1);return!0};_TableSettingAction.prototype._saveValues=function(e){var t={name:this._table.name,style:this._table.style,showHeaderRow:this._table.showHeaderRow,showTotalRow:this._table.showTotalRow,showbandedRows:this._table.showBandedRows,showBandedColumns:this._table.showBandedColumns,alterFirstColumn:this._table.alterFirstColumn,alterLastColumn:this._table.alterLastColumn};e?this._oldTableSetting=t:this._newTableSetting=t};_TableSettingAction.prototype._handleUndoRedo=function(e){var t=e?this._oldTableSetting:this._newTableSetting;this._owner.beginUpdate();this._owner._isUndoing=!0;this._table.name=t.name;this._table.style=t.style;this._table.showHeaderRow=t.showHeaderRow;this._table.showTotalRow=t.showTotalRow;this._table.showBandedRows=t.showbandedRows;this._table.showBandedColumns=t.showBandedColumns;this._table.alterFirstColumn=t.alterFirstColumn;this._table.alterLastColumn=t.alterLastColumn;this._owner._isUndoing=!1;this._owner.endUpdate()};return _TableSettingAction}(_UndoAction);exports._TableSettingAction=_TableSettingAction;var _TableAction=function(e){__extends(_TableAction,e);function _TableAction(t,o){var i=e.call(this,t)||this;i._addedTable=o;o.showHeaderRow&&(i._orgHeaderCellsContent=o._orgHeaderCellsContent.slice());return i}_TableAction.prototype.undo=function(){this._handleUndoRedo(!0)};_TableAction.prototype.redo=function(){this._handleUndoRedo(!1)};_TableAction.prototype._handleUndoRedo=function(e){e?this._owner.selectedSheet.tables.remove(this._addedTable):this._owner.selectedSheet.tables.push(this._addedTable);if(this._addedTable.showHeaderRow)for(var t=this._addedTable.getRange(),o=this._addedTable.getColumns(),i=0;i<t.columnSpan;i++)this._owner.setCellData(t.topRow,t.leftCol+i,e?this._orgHeaderCellsContent[i]:o[i].name);this._owner.refresh()};return _TableAction}(_UndoAction);exports._TableAction=_TableAction;var _FilteringAction=function(e){__extends(_FilteringAction,e);function _FilteringAction(t){var o=e.call(this,t)||this;o._oldFilterDefinition=t.filter.filterDefinition;o._oldRowsVisible=o._getRowsVisible();return o}_FilteringAction.prototype.undo=function(){this._handleUndoRedo(!0)};_FilteringAction.prototype.redo=function(){this._handleUndoRedo(!1)};_FilteringAction.prototype.saveNewState=function(){this._newFilterDefinition=this._owner.filter.filterDefinition;this._newRowsVisible=this._getRowsVisible();return!0};_FilteringAction.prototype._handleUndoRedo=function(e){var t=e?this._oldFilterDefinition:this._newFilterDefinition;if(this._owner.filter.filterDefinition!==t){this._owner._isUndoing=!0;this._owner.selectedSheet._filterDefinition=t;this._owner.selectedSheet._applyFilterSetting();this._owner._isUndoing=!1;this._owner.filter.apply()}else this._setRowVisible(e)};_FilteringAction.prototype._getRowsVisible=function(){for(var e,t=[],o=0;o<this._owner.rows.length;o++)(e=this._owner.rows[o])&&t.push(e.visible);return t};_FilteringAction.prototype._setRowVisible=function(e){for(var t,o=e?this._oldRowsVisible:this._newRowsVisible,i=0;i<o.length;i++)(t=this._owner.rows[i])&&(t.visible=o[i])};return _FilteringAction}(_UndoAction);exports._FilteringAction=_FilteringAction;var _FillAction=function(e){__extends(_FillAction,e);function _FillAction(t,o){var i=e.call(this,t)||this;i._fillSource=o.clone();i._oldCellSettings=t._orgCellSettings;return i}_FillAction.prototype.undo=function(){this._handleUndoRedo(!0)};_FillAction.prototype.redo=function(){this._handleUndoRedo(!1)};_FillAction.prototype.saveNewState=function(){this._fillRange=this._owner.selection.clone();this._newCellSettings=this._owner._getCellSettingsForFill(this._fillSource,this._fillRange);return!0};_FillAction.prototype._handleUndoRedo=function(e){var t,o,i,n,l,r,s=e?this._oldCellSettings:this._newCellSettings,a=e?this._fillSource:this._fillRange;this._owner.beginUpdate();r=this._fillRange.topRow<this._fillSource.topRow?new wijmo_grid_1.CellRange(this._fillRange.topRow,this._fillRange.col,this._fillSource.topRow-1,this._fillRange.col2):this._fillRange.leftCol===this._fillSource.leftCol&&this._fillRange.rightCol===this._fillSource.rightCol?new wijmo_grid_1.CellRange(this._fillSource.bottomRow+1,this._fillRange.col,this._fillRange.bottomRow,this._fillRange.col2):this._fillRange.leftCol<this._fillSource.leftCol?new wijmo_grid_1.CellRange(this._fillRange.row,this._fillRange.leftCol,this._fillRange.row2,this._fillSource.leftCol-1):new wijmo_grid_1.CellRange(this._fillRange.row,this._fillSource.rightCol+1,this._fillRange.row2,this._fillRange.rightCol);this._owner._resetMergedRange(r);if(s&&s.length>0)for(t=0;t<s.length;t++){i=(o=s[t]).row;n=o.col;l=i*this._owner.columns.length+n;this._owner.selectedSheet._styledCells[l]=o.style;this._owner.setCellData(i,n,o.value);o.mergedCell&&this._owner.mergeRange(o.mergedCell)}this._owner.selection=a;this._owner.endUpdate()};return _FillAction}(_UndoAction);exports._FillAction=_FillAction;var SortManager=function(){function SortManager(e){this._owner=e;this._sortDescriptions=new wijmo_1.CollectionView;this._committedList=[new ColumnSortDescription(-1,!0)];this._sortDescriptions.newItemCreator=function(){return new ColumnSortDescription(-1,!0)}}Object.defineProperty(SortManager.prototype,"sortDescriptions",{get:function(){return this._sortDescriptions},set:function(e){this._sortDescriptions=e;this.commitSort()},enumerable:!0,configurable:!0});SortManager.prototype.addSortLevel=function(e,t){void 0===t&&(t=!0);var o=this._sortDescriptions.addNew();null!=e&&!isNaN(e)&&wijmo_1.isInt(e)&&(o.columnIndex=e);o.ascending=t;this._sortDescriptions.commitNew()};SortManager.prototype.deleteSortLevel=function(e){var t;(t=null!=e?this._getSortItem(e):this._sortDescriptions.currentItem)&&this._sortDescriptions.remove(t)};SortManager.prototype.copySortLevel=function(){var e=this._sortDescriptions.currentItem;if(e){var t=this._sortDescriptions.addNew();t.columnIndex=parseInt(e.columnIndex);t.ascending=e.ascending;this._sortDescriptions.commitNew()}};SortManager.prototype.editSortLevel=function(e,t){null!=e&&(this._sortDescriptions.currentItem.columnIndex=e);null!=t&&(this._sortDescriptions.currentItem.ascending=t)};SortManager.prototype.moveSortLevel=function(e){var t=this._sortDescriptions.currentItem;if(t){var o=this._sortDescriptions.sourceCollection,i=o.indexOf(t),n=i+e;if(i>-1&&n>-1){o.splice(i,1);o.splice(n,0,t);this._sortDescriptions.refresh();this._sortDescriptions.moveCurrentTo(t)}}};SortManager.prototype.checkSortItemExists=function(e){for(var t=0,o=this._sortDescriptions.itemCount;t<o;t++)if(+this._sortDescriptions.items[t].columnIndex===e)return t;return-1};SortManager.prototype.commitSort=function(e){void 0===e&&(e=!0);var t,o,i,n,l,r,s,a,h,u,d,_,c,g,f,p=this._owner,m=this._owner.itemsSource instanceof wijmo_1.CollectionView,w={};if(this._owner.selectedSheet&&0!==this._owner.columns.length){var C=null==this._owner.selectedSheet.grid.collectionView;p._needCopyToSheet=!1;r=p.selectedSheet._unboundSortDesc;e&&p.undoStack.stackSize>0&&(s=new _SortColumnAction(p));this._sortDescriptions.itemCount>0?this._committedList=this._cloneSortList(this._sortDescriptions.items):this._committedList=[new ColumnSortDescription(-1,!0)];p._isSorting=!0;if(p.collectionView){p.beginUpdate();(a=p.editableCollectionView)&&a.currentEditItem&&-1!==a.items.indexOf(a.currentEditItem)&&!this._isEmpty(a.currentEditItem)&&a.commitEdit();p.collectionView.beginUpdate();C||p.selectedSheet.grid.collectionView.beginUpdate();(i=p.collectionView.sortDescriptions).clear();h=p.selection.clone();u=p.scrollPosition;f=p._getDataRowsOffset();var S=[];if(!p._isUndoing&&!p._isDeletingColumns)for(l=0;l<p.rows.length-f;l++)(g=(c=p.rows[l+f]).dataItem)&&(S[_=null!=g._itemIdx?g._itemIdx:l]=c.visible);m||(n=C?p.collectionView.sortDescriptions:p.selectedSheet.grid.collectionView.sortDescriptions).clear();p.collectionView.sourceCollection.forEach((function(e,t){null==e._itemIdx&&(e._itemIdx=t)}));p.select(h,!1);p.scrollPosition=u;if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){p.collectionView.useStableSort=!0;m||C||(p.selectedSheet.grid.collectionView.useStableSort=!0)}for(l=0;l<this._sortDescriptions.itemCount;l++)if((t=this._sortDescriptions.items[l]).columnIndex>-1&&t.columnIndex<p.columns.length){o=new wijmo_1.SortDescription(p.columns[t.columnIndex].binding,t.ascending);i.push(o);m||n.push(o)}p.selectedSheet.selectionRanges.clear();p.collectionView.endUpdate(!1);C||p.selectedSheet.grid.collectionView.endUpdate(!1);h=p.selection.clone();u=p.scrollPosition;d=p.collectionView._view.slice();var b=Array(d.length);for(l=0;l<d.length;l++){l!==(g=d[l])._itemIdx&&p._updateFormulaForReorderingRows(g._itemIdx+f,l+f);p._updateCellStyleForReorderingRows(g._itemIdx+f,l+f,w);b[l+f]=p._heights[g._itemIdx+f]}p.setHeights(b);p.updateRowHeights();if(S.length)for(l=0;l<p.rows.length-f;l++)if(g=(c=p.rows[l+f]).dataItem){_=null!=g._itemIdx?g._itemIdx:l;c.visible=S[_]}d.forEach((function(e,t){e._itemIdx=t}));p.selectedSheet._styledCells=w;p.select(h,!1);p.scrollPosition=u;p.endUpdate();p._copyColumnsToSelectedSheet();p._isSorting=!1}else{r.clear();for(l=0;l<this._sortDescriptions.itemCount;l++)(t=this._sortDescriptions.items[l]).columnIndex>-1&&r.push(new _UnboundSortDescription(p.columns[t.columnIndex],t.ascending));!p.filter||!p._isUndoing&&p.filter._isActive()?p._isSorting=!1:setTimeout((function(){p._checkCollectionOwner(p.columns,!1);p.filter.apply();p._isSorting=!1}),10)}if(s){s.saveNewState();p.undoStack._addAction(s)}p._copiedRanges=null;p._needCopyToSheet=!0}};SortManager.prototype.cancelSort=function(){this._sortDescriptions.sourceCollection=this._committedList.slice()};SortManager.prototype.clearSort=function(){this._sortDescriptions.sourceCollection=[];this.commitSort()};SortManager.prototype._getSortItem=function(e){var t=this.checkSortItemExists(e);if(t>-1)return this._sortDescriptions.items[t]};SortManager.prototype._cloneSortList=function(e){for(var t=[],o=0;o<e.length;o++)t[o]=e[o].clone();return t};SortManager.prototype._updateSortDescriptions=function(e,t,o){void 0===o&&(o=!0);var i,n;for(i=this._sortDescriptions.items.length-1;i>=0;i--){n=this._sortDescriptions.items[i];o?n.columnIndex>e&&(n.columnIndex+=t):n.columnIndex>=e+t?n.columnIndex-=t:n.columnIndex>=e&&this._sortDescriptions.remove(n)}};SortManager.prototype._handleColumnMoving=function(e,t){this._sortDescriptions.items.forEach((function(o){if(!(o.columnIndex<0))if(o.columnIndex===e)o.columnIndex=t;else{o.columnIndex>e&&o.columnIndex--;o.columnIndex>=t&&o.columnIndex++}}))};SortManager.prototype._isEmpty=function(e){var t=Object.prototype.hasOwnProperty;if(null==e)return!0;if(e.length>0)return!1;if(0===e.length)return!0;for(var o in e)if(t.call(e,o))return!1;return!0};return SortManager}();exports.SortManager=SortManager;var ColumnSortDescription=function(){function ColumnSortDescription(e,t){this._columnIndex=e;this._ascending=t}Object.defineProperty(ColumnSortDescription.prototype,"columnIndex",{get:function(){return this._columnIndex},set:function(e){this._columnIndex=+e},enumerable:!0,configurable:!0});Object.defineProperty(ColumnSortDescription.prototype,"ascending",{get:function(){return this._ascending},set:function(e){this._ascending=e},enumerable:!0,configurable:!0});ColumnSortDescription.prototype.clone=function(){return new ColumnSortDescription(this._columnIndex,this._ascending)};return ColumnSortDescription}();exports.ColumnSortDescription=ColumnSortDescription;wijmo_1._addCultureInfo("FlexSheet",{insertRow:"Insert Row",deleteRow:"Delete Rows",insertCol:"Insert Column",deleteCol:"Delete Columns",convertTable:"Convert To Table",insertSheet:"Insert",deleteSheet:"Delete",renameSheet:"Rename",copyCells:"Copy Cells",fillSeries:"Fill Series",fillFormat:"Fill Formatting Only",fillWithoutFormat:"Fill Without Formatting"});var FlexSheetFunctions=[{name:"abs",description:"Returns the absolute value of a number."},{name:"acos",description:"Returns the arccosine of a number."},{name:"address",description:"Obtains the address of a cell in a worksheet by given specified row and column numbers."},{name:"and",description:"Returns TRUE if all of its arguments are TRUE."},{name:"asin",description:"Returns the arcsine of a number."},{name:"atan",description:"Returns the arctangent of a number."},{name:"atan2",description:"Returns the arctangent from x- and y-coordinates."},{name:"average",description:"Returns the average of its arguments."},{name:"ceiling",description:"Rounds a number to the nearest integer or to the nearest multiple of significance."},{name:"char",description:"Returns the character specified by the code number."},{name:"choose",description:"Chooses a value from a list of values."},{name:"code",description:"Returns a numeric code for the first character in a text string."},{name:"column",description:"Returns the column number of a reference."},{name:"columns",description:"Returns the number of columns in a reference."},{name:"concat",description:"Joins several text items into one text item."},{name:"concatenate",description:"Joins several text items into one text item."},{name:"cos",description:"Returns the cosine of a number."},{name:"count",description:"Counts how many numbers are in the list of arguments."},{name:"counta",description:"Counts how many values are in the list of arguments."},{name:"countblank",description:"Counts the number of blank cells within a range."},{name:"countif",description:"Counts the number of cells within a range that meet the given criteria."},{name:"countifs",description:"Counts the number of cells within a range that meet multiple criteria."},{name:"date",description:"Returns the serial number of a particular date."},{name:"datedif",description:"Calculates the number of days, months, or years between two dates."},{name:"day",description:"Converts a serial number to a day of the month."},{name:"dcount",description:"Counts the cells that contain numbers in a database."},{name:"exp",description:"Returns e raised to the power of a given number."},{name:"exact",description:"Compares two text strings and returns TRUE if they are exactly the same, FALSE otherwise."},{name:"false",description:"Returns the logical value FALSE."},{name:"find",description:"Finds one text value within another (case-sensitive)."},{name:"floor",description:"Rounds a number down, toward zero."},{name:"hlookup",description:"Looks in the top row of an array and returns the value of the indicated cell."},{name:"hour",description:"Converts a serial number to an hour."},{name:"if",description:"Specifies a logical test to perform."},{name:"iferror",description:"Returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula."},{name:"index",description:"Uses an index to choose a value from a reference."},{name:"indirect",description:"Returns the reference specified by a text string. References are immediately evaluated to display their contents."},{name:"isblank",description:"Checks if value refers to an empty cell."},{name:"iserr",description:"Checks if value is an error (#VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!) excluding #N/A, and returns TRUE or FALSE."},{name:"iserror",description:"Checks if value is an error (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!), and returns TRUE or FALSE."},{name:"left",description:"Returns the leftmost characters from a text value."},{name:"len",description:"Returns the number of characters in a text string."},{name:"ln",description:"Returns the natural logarithm of a number."},{name:"lower",description:"Converts text to lowercase."},{name:"max",description:"Returns the maximum value in a list of arguments."},{name:"mid",description:"Returns a specific number of characters from a text string starting at the position you specify."},{name:"min",description:"Returns the minimum value in a list of arguments."},{name:"mod",description:"Returns the remainder from division."},{name:"month",description:"Converts a serial number to a month."},{name:"not",description:"Reverses the logic of its argument."},{name:"now",description:"Returns the current date and time formatted as a date and time."},{name:"or",description:"Returns TRUE if any argument is TRUE."},{name:"pi",description:"Returns the value of pi."},{name:"power",description:"Returns the result of a number raised to a power."},{name:"product",description:"Multiplies its arguments."},{name:"proper",description:"Capitalizes the first letter in each word of a text value."},{name:"rand",description:"Returns a random number between 0 and 1."},{name:"rank",description:"Returns the rank of a number in a list of numbers."},{name:"rate",description:"Returns the interest rate per period of an annuity."},{name:"replace",description:"Replaces characters within text."},{name:"rept",description:"Repeats text a given number of times."},{name:"right",description:"Returns the rightmost characters from a text value."},{name:"round",description:"Rounds a number to a specified number of digits."},{name:"rounddown",description:"Rounds a number down, toward zero."},{name:"roundup",description:"Rounds a number up, away from zero."},{name:"row",description:"Returns the row number of a reference."},{name:"rows",description:"Returns the number of rows in a reference."},{name:"search",description:"Finds one text value within another (not case-sensitive)."},{name:"sin",description:"Returns the sine of the given angle."},{name:"sqrt",description:"Returns a positive square root."},{name:"stdev",description:"Estimates standard deviation based on a sample."},{name:"stdevp",description:"Calculates standard deviation based on the entire population."},{name:"substitute",description:"Substitutes new text for old text in a text string."},{name:"subtotal",description:"Returns a subtotal in a list or database."},{name:"sum",description:"Adds its arguments."},{name:"sumif",description:"Adds the cells specified by a given criteria."},{name:"sumifs",description:"Adds the cells in a range that meet multiple criteria."},{name:"sumproduct",description:"Multiplies corresponding components in the given arrays, and returns the sum of those products."},{name:"tan",description:"Returns the tangent of a number."},{name:"text",description:"Formats a number and converts it to text."},{name:"time",description:"Returns the serial number of a particular time."},{name:"today",description:"Returns the current date formatted as a date."},{name:"trim",description:"Removes spaces from text."},{name:"true",description:"Returns the logical value TRUE."},{name:"trunc",description:"Truncates a number to an integer."},{name:"upper",description:"Converts text to uppercase."},{name:"value",description:"Converts a text argument to a number."},{name:"var",description:"Estimates variance based on a sample."},{name:"varp",description:"Calculates variance based on the entire population."},{name:"vlookup",description:"Looks in the first column of an array and returns the value of the indicated cell."},{name:"year",description:"Converts a serial number to a year."}],FlexSheet=function(e){__extends(FlexSheet,e);function FlexSheet(t,o){var i=e.call(this,t,o)||this;i._heights=[];i._selectedSheetIndex=-1;i._columnHeaderClicked=!1;i._addingSheet=!1;i._mouseMoveHdl=i._mouseMove.bind(i);i._clickHdl=i._click.bind(i);i._touchStartHdl=i._touchStart.bind(i);i._touchEndHdl=i._touchEnd.bind(i);i._keydownHdl=i._keydown.bind(i);i._isContextMenuKeyDown=!1;i._isClicking=!1;i._builtInTableStylesCache=null;i._needCopyToSheet=!0;i._isSorting=!1;i._fillingData=!1;i._enableDragDrop=!0;i._enableFormulas=!0;i._headerRowRemoved=!1;i._clearCalcCacheOnRefresh=!0;i._copyingTo=!1;i._ignoreBindGrid=!1;i._loadingFromWorkbook=!1;i.insertedColumnIndex=0;i.dropzonePrevHit=-1;i.selectedSheetChanged=new wijmo_1.Event;i.draggingRowColumn=new wijmo_1.Event;i.droppingRowColumn=new wijmo_1.Event;i.beginDroppingRowColumn=new wijmo_1.Event;i.endDroppingRowColumn=new wijmo_1.Event;i.loaded=new wijmo_1.Event;i.unknownFunction=new wijmo_1.Event;i.sheetCleared=new wijmo_1.Event;i.prepareChangingRow=new wijmo_1.Event;i.prepareChangingColumn=new wijmo_1.Event;i.rowChanged=new wijmo_1.Event;i.columnChanged=new wijmo_1.Event;i.autoFilling=new wijmo_1.Event;i.autoFilled=new wijmo_1.Event;i._updateScrollPos=!1;o&&null!=o.allowAutoFill||(i._allowAutoFill=!0);i._needCopyToSheet=!1;i._colorThemes=["FFFFFF","000000","EEECE1","1F497D","4F818D","C0504D","9BBB59","8064A2","4BACC6","F79646"];i._eCt.style.backgroundColor="white";wijmo_1.addClass(i.hostElement,exports.FlexSheetClsNames.hostElement);wijmo_1.setCss(i.hostElement,{fontFamily:"Arial"});i._cf=new _FlexSheetCellFactory;i._bndSortConverter=i._sheetSortConverter.bind(i);i._selHdl=new _FlexSheetSelectionHandler(i);i.quickAutoSize=!1;i._canOverRuleCtrlPress=!0;i._init();i.showSort=!1;i.allowSorting=wijmo_grid_1.AllowSorting.None;i.showGroups=!1;i.showMarquee=!0;i.showSelectedHeaders=wijmo_grid_1.HeadersVisibility.All;i.allowResizing=wijmo_grid_1.AllowResizing.Both;i.allowDragging=wijmo_grid_1.AllowDragging.None;i.keyActionTab=wijmo_grid_1.KeyAction.CycleOut;i._needCopyToSheet=!0;return i}Object.defineProperty(FlexSheet,"controlTemplate",{get:function(){FlexSheet._ctrlTemplate||(FlexSheet._ctrlTemplate='<div style="width:100%;height:100%"><div wj-part="container" style="width:100%; max-width: 100vw;">'+wijmo_grid_1.FlexGrid.controlTemplate+'</div><div wj-part="tab-holder" class="'+exports.FlexSheetClsNames.tabHolder+'" style="width:100%; min-width:100px"></div><div wj-part="context-menu" style="display:none;z-index:100"></div></div>');return FlexSheet._ctrlTemplate},set:function(e){FlexSheet._ctrlTemplate=e},enumerable:!0,configurable:!0});FlexSheet.prototype._getProductInfo=function(){return"R20I,FlexSheet"};Object.defineProperty(FlexSheet.prototype,"sheets",{get:function(){this._sheets||(this._sheets=new SheetCollection);return this._sheets},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"selectedSheetIndex",{get:function(){return this._selectedSheetIndex},set:function(e){if(e!==this._selectedSheetIndex){this._showSheet(e);this._sheets.selectedIndex=e}},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"selectedSheet",{get:function(){return this._selectedSheetIndex>=0?this._sheets[this._selectedSheetIndex]:null},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"isFunctionListOpen",{get:function(){return this._functionListHost&&"none"!==this._functionListHost.style.display},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"isTabHolderVisible",{get:function(){return this._tabHolder?this._tabHolder.visible:void 0===this._isTabHolderVisibleCache||this._isTabHolderVisibleCache},set:function(e){if(this._tabHolder){if(e!==this._tabHolder.visible){this._updateDivContainerHeight(e);e?this._eFocus.removeAttribute("tabindex"):this._eFocus.tabIndex=this._orgTabIndex;this._tabHolder.visible=e;this.invalidate()}}else this._isTabHolderVisibleCache=e},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"undoStack",{get:function(){return this._undoStack},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"sortManager",{get:function(){return this._sortManager},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"showFilterIcons",{get:function(){return!!this._filter&&this._filter.showFilterIcons},set:function(e){this._filter&&this._filter.showFilterIcons!==e&&(this._filter.showFilterIcons=e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"calculationPrecision",{get:function(){var e=this._precision;return null==e?14:e},set:function(e){if(e!==this._precision){this._precision=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"definedNames",{get:function(){this._defNames||(this._defNames=new DefinedNameCollection(this));return this._defNames},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"enableDragDrop",{get:function(){return this._enableDragDrop},set:function(e){this._enableDragDrop=e},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"enableFormulas",{get:function(){return this._enableFormulas},set:function(e){if(this._enableFormulas!==e){this._enableFormulas=e;this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"allowAutoFill",{get:function(){return this._allowAutoFill},set:function(e){this._allowAutoFill=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"_lastSelMovePos",{get:function(){return this._lsmPos},set:function(e){this._lsmPos=e?e.clone():null},enumerable:!0,configurable:!0});FlexSheet.prototype._setvalidateEdits=function(t){e.prototype._setvalidateEdits.call(this,t);for(var o=0;o<this.sheets.length;o++)this.sheets[o].grid&&(this.sheets[o].grid.validateEdits=t)};FlexSheet.prototype.onSelectedSheetChanged=function(e){this.selectedSheetChanged.raise(this,e)};FlexSheet.prototype.onDraggingRowColumn=function(e){this.draggingRowColumn.raise(this,e)};FlexSheet.prototype.onDroppingRowColumn=function(e){wijmo_1._deprecated("droppingRowColumn","beginDroppingRowColumn and endDroppingRowColumn");this.droppingRowColumn.raise(this,new wijmo_1.EventArgs)};FlexSheet.prototype.onBeginDroppingRowColumn=function(e){this.beginDroppingRowColumn.raise(this,e)};FlexSheet.prototype.onEndDroppingRowColumn=function(e){this.endDroppingRowColumn.raise(this,e)};FlexSheet.prototype.onLoaded=function(e){var t=this;if(this._toRefresh){clearTimeout(this._toRefresh);this._toRefresh=null}this._toRefresh=setTimeout((function(){t._setFlexSheetToDirty();t.invalidate()}),10);this.loaded.raise(this,new wijmo_1.EventArgs)};FlexSheet.prototype.onUnknownFunction=function(e){this.unknownFunction.raise(this,e)};FlexSheet.prototype.onSheetCleared=function(e){this.sheetCleared.raise(this,e)};FlexSheet.prototype.onPrepareChangingRow=function(e){this.prepareChangingRow.raise(this,e)};FlexSheet.prototype.onPrepareChangingColumn=function(e){this.prepareChangingColumn.raise(this,e)};FlexSheet.prototype.onRowChanged=function(e){this.rowChanged.raise(this,e)};FlexSheet.prototype.onColumnChanged=function(e){this.columnChanged.raise(this,e)};FlexSheet.prototype.onAutoFilling=function(e){this.autoFilling.raise(this,e)};FlexSheet.prototype.onAutoFilled=function(e){this.autoFilled.raise(this,e)};FlexSheet.prototype.refresh=function(t){void 0===t&&(t=!0);if(this.selectedSheet&&this.selectedSheet.grid.rows&&this._items&&this.selectedSheet.grid.rows.length<this._items.length)for(var o=this._items.length-this.selectedSheet.grid.rows.length,i=0;i<=o;i++)this.selectedSheet.grid.rows.push(new wijmo_grid_1.Row);this.hostElement&&!this.isUpdating&&this._updateDivContainerHeight(this.isTabHolderVisible);if(!this.preserveSelectedState&&this.selectedSheet){this.selectedSheet.selectionRanges.clear();this.selectedSheet.selectionRanges.push(this.selection)}if(t){this._clearCalcCacheOnRefresh&&this._clearCalcEngine();this._clearCalcCacheOnRefresh=!0}this._lastVisibleFrozenRow=-1;if(this.rows._frozenInternal>0)for(i=this.rows._frozenInternal-1;i>=0;i--)if(this.rows[i]&&this.rows[i].isVisible){this._lastVisibleFrozenRow=i;break}this._lastVisibleFrozenColumn=-1;if(this.columns._frozenInternal>0)for(i=this.columns._frozenInternal-1;i>=0;i--)if(this.columns[i]&&this.columns[i].isVisible){this._lastVisibleFrozenColumn=i;break}if(this.selectedSheet){if(this.selectedSheet._freezeHiddenRows&&this.selectedSheet._freezeHiddenRows.length>0)for(i=0;i<this.selectedSheet._freezeHiddenRows.length;i++){var n=this.rows[i];n instanceof HeaderRow||!this.selectedSheet._freezeHiddenRows[i]||(n.visible=!1)}if(this.selectedSheet._freezeHiddenCols&&this.selectedSheet._freezeHiddenCols.length>0)for(i=0;i<this.selectedSheet._freezeHiddenCols.length;i++)this.selectedSheet._freezeHiddenCols[i]&&(this.columns[i].visible=!1)}e.prototype.refresh.call(this,t);if(this.hostElement&&!this.isUpdating){this._tabHolder.adjustSize();this._tabHolder.isDisabled=this.isDisabled;this._tabHolder.sheetControl.isDisabled=this.isDisabled}};FlexSheet.prototype.setCellData=function(e,t,o,i,n,l){void 0===i&&(i=!1);void 0===n&&(n=!0);void 0===l&&(l=!1);var r=_isFormula(o),s=this.getCellData(e,t,!1);r&&s&&s!==o&&this.evaluate(o,null,this.sheets[this.selectedSheetIndex]);this._clearCalcEngine();return this.cells.setCellData(e,t,o,i&&!r,n,l)||this._getHasValidation()};FlexSheet.prototype.containsFocus=function(){return this.isFunctionListOpen||e.prototype.containsFocus.call(this)};FlexSheet.prototype.addUnboundSheet=function(e,t,o,i,n){var l=this._addSheet(e,t,o,i,n);0===l.selectionRanges.length&&l.selectionRanges.push(this.selection);return l};FlexSheet.prototype.addBoundSheet=function(e,t,o,i){var n=this._addSheet(e,0,0,o,i);if(t){n.itemsSource=t;this.childItemsPath&&(n.grid.childItemsPath=this.childItemsPath)}0===n.selectionRanges.length&&n.selectionRanges.push(this.selection);return n};FlexSheet.prototype.applyCellsStyle=function(e,t,o){void 0===o&&(o=!1);var i,n,l,r,s,a=null!=t&&t.length>0,h=t||[this.selection];if(this.selectedSheet)if(e||!this._cloneStyle){if(h){if(t||o)o&&!this._cloneStyle&&(this._cloneStyle=this._cloneObject(this.selectedSheet._styledCells));else{this.undoStack.stackSize>0&&(s=new _CellStyleAction(this,this._cloneStyle));this._cloneStyle=null}for(r=0;r<h.length;r++)for(i=(l=h[r]).topRow;i<=l.bottomRow;i++)for(n=l.leftCol;n<=l.rightCol;n++)this._applyStyleForCell(i,n,e,a);if(s){s.saveNewState();this._undoStack._addAction(s)}}t||this.refresh(!1)}else{this.selectedSheet._styledCells=this._cloneObject(this._cloneStyle);this._cloneStyle=null;this.refresh(!1)}};FlexSheet.prototype.freezeAtCursor=function(){var e,t,o=this;if(this.selectedSheet){this.selectedSheet._freezeHiddenRows=null;this.selectedSheet._freezeHiddenCols=null;if(this.selection&&0===this.rows._frozenInternal&&0===this.columns._frozenInternal){if(this._ptScrl.y<0){this.selectedSheet._freezeHiddenRows=[];for(var i=0;i<this.selection.topRow-1;i++){var n=this.rows[i];if(!(n instanceof HeaderRow)){if(!(n._pos+this._ptScrl.y<0&&n.visible))break;n.visible=!1;this.selectedSheet._freezeHiddenRows[i]=!0}}}if(this._ptScrl.x<0){this.selectedSheet._freezeHiddenCols=[];for(i=0;i<this.selection.leftCol-1;i++){var l=this.columns[i];if(!(l._pos+this._ptScrl.x<0&&l.visible))break;l.visible=!1;this.selectedSheet._freezeHiddenCols[i]=!0}}e=this.selection.leftCol>0?this.selection.leftCol:0;t=this.selection.topRow>0?this.selection.topRow:0}else{for(i=0;i<this.rows._frozenInternal-1&&i<this.rows.length;i++)this.rows[i].visible=!0;for(i=0;i<this.columns._frozenInternal-1&&i<this.columns.length;i++)this.columns[i].visible=!0;this._filter.apply();e=0;t=0}this.rows._frozenInternal=this.selectedSheet.grid.rows._frozenInternal=t;this.columns._frozenInternal=this.selectedSheet.grid.columns._frozenInternal=e;setTimeout((function(){o._setFlexSheetToDirty();o.invalidate();o.scrollIntoView(o.selection.topRow,o.selection.leftCol)}),10)}};FlexSheet.prototype.showColumnFilter=function(){var e=this.selection.col>0?this.selection.col:0;this.columns.length>0&&this._filter.editColumnFilter(this.columns[e])};FlexSheet.prototype.clear=function(){this.beginUpdate();this.selection=new wijmo_grid_1.CellRange;this.sheets.clear();this._selectedSheetIndex=-1;this.columns.clear();this.rows.clear();this.columnHeaders.columns.clear();this.rowHeaders.rows.clear();this._undoStack.clear();this._ptScrl=new wijmo_1.Point;this._clearCalcEngine();this._defNames&&this._defNames.clear();this._builtInTableStylesCache=null;this._copiedRanges=null;this._copiedSheet=null;this._isCutting=!1;this._cutValue=null;this._reservedContent=null;this._lastVisibleFrozenRow=-1;this._lastVisibleFrozenColumn=-1;this._loadingFromWorkbook||this.addUnboundSheet();this.endUpdate()};FlexSheet.prototype.getSelectionFormatState=function(){var e,t,o=this.rows.length,i=this.columns.length,n={isBold:!1,isItalic:!1,isUnderline:!1,isStrikethrough:!1,textAlign:"left",isMergedCell:!1,verticalAlign:"top"};if(0===o||0===i)return n;if(this.selection){if(this.selection.row>=o||this.selection.row2>=o||this.selection.col>=i||this.selection.col2>=i)return n;for(e=this.selection.topRow;e<=this.selection.bottomRow;e++)for(t=this.selection.leftCol;t<=this.selection.rightCol;t++)this._checkCellFormat(e,t,n)}return n};FlexSheet.prototype.insertRows=function(e,t){var o,i,n,l,r,s=this,a=wijmo_1.isNumber(e)&&e>=0?e:this.selection&&this.selection.topRow>-1?this.selection.topRow:0,h=wijmo_1.isNumber(t)?t:1,u=this.rows[a];if(this.selectedSheet){this.rows.length>0?a>=this.rows.length&&(a=this.rows.length-1):a=0;var d=this.collectionView,_=this.editableCollectionView,c=d instanceof wijmo_1.CollectionView?d:null;this._clearCalcEngine();this.finishEditing();_&&_.currentEditItem&&_.commitEdit();0===a&&u&&u.constructor===HeaderRow&&(a=1);this.onPrepareChangingRow(new RowColumnChangedEventArgs(a,h,!0,!1));this.undoStack.stackSize>0&&(n=new _RowsChangedAction(this,a,h,!0));this._updateCellsForUpdatingRow(this.rows.length,a,h);if(!this.collectionView||0===this.collectionView.sortDescriptions.length){l=this._updateAffectedFormula(a,h,!0,!0);r=this._updateAffectedNamedRanges(a,h,!0,!0)}if(n){n._affectedFormulas=l;n._affectedDefinedNameVals=r}var g=null==this.selectedSheet.grid.collectionView;this.beginUpdate();if(d){var f=this.itemsSource instanceof wijmo_1.CollectionView,p=this.autoGenerateColumns,m=void 0;this.selectedSheet._dataView=this.collectionView._view.slice();this.autoGenerateColumns=!1;this.collectionView.beginUpdate();this.rows[0]instanceof wijmo_grid_1._NewRowTemplate&&this.rows[1]instanceof HeaderRow?(o=this._heights).splice.apply(o,[2,0].concat(Array(h).map((function(){return null})))):(i=this._heights).splice.apply(i,[a,0].concat(Array(h).map((function(){return null}))));if(!f){m=this.selectedSheet.grid.autoGenerateColumns;this.selectedSheet.grid.autoGenerateColumns=!1;g||this.selectedSheet.grid.collectionView.beginUpdate()}var w=Math.max(a-this._getDataRowsOffset(),0);this.collectionView.moveCurrentToPosition(w);for(var C=0;C<h;C++){var S=c&&c.newItemCreator?c.newItemCreator():{};d.sourceCollection.splice(w,0,S);c&&c.trackChanges&&c.itemsAdded.push(S);if(!f){var b=this.selectedSheet.grid.itemsSource;b&&this.itemsSource!==b&&b.splice(w,0,S)}this.selectedSheet._dataView.splice(w,0,S)}this._updateItemIndexForInsertingRow(this.collectionView.sourceCollection,w,h);if(!f){g||this.selectedSheet.grid.collectionView.endUpdate(!0);this.selectedSheet.grid.autoGenerateColumns=m}var v=this.collectionView._idx;this.collectionView.endUpdate(!0);this.updateRowHeights();if(this.collectionView.sortDescriptions.length>0){this.collectionView._view=this.selectedSheet._dataView;this.collectionView._pgView=this.collectionView._getPageView();this.collectionView._idx=v;if(!f&&!g){this.selectedSheet.grid.collectionView._view=this.selectedSheet._dataView;this.selectedSheet.grid.collectionView._pgView=this.selectedSheet.grid.collectionView._getPageView();this.collectionView._idx=v}this._bindGrid(!1);this.selectedSheet.grid._bindGrid(!1)}setTimeout((function(){s._filter.apply()}));this.autoGenerateColumns=p}else{this.rows.beginUpdate();for(C=0;C<h;C++)this.rows.insert(a,new wijmo_grid_1.Row);var y=this.selectedSheet._freezeHiddenRows;if(y&&y.length)for(C=a+h;C<this.rows.length;C++)y[C]||(this.rows[C].visible=!0);this.rows.endUpdate()}this._updateTablesForUpdatingRow(a,h);this.selection&&-1!==this.selection.row&&-1!==this.selection.col||this.select(new wijmo_grid_1.CellRange(0,0),!1);if(n){n.saveNewState();this._undoStack._addAction(n)}this.onRowChanged(new RowColumnChangedEventArgs(a,h,!0,!1));this.endUpdate()}};FlexSheet.prototype.deleteRows=function(e,t){var o=this;if(this.selectedSheet&&!(this.rows.length<1)){var i=e,n=wijmo_1.isArray(e);if(!n)if(wijmo_1.isNumber(e)){if((t=wijmo_1.isNumber(t)?t:1)<1)return;i=[new wijmo_grid_1.CellRange(e,-1,e+t-1,-1)]}else n=(i=this._selections()).length>1;var l=!!this.collectionView;if(l){var r=[];i.forEach((function(e){if(e.row>=0&&e.row2>=0)for(var t=e.topRow,i=e.bottomRow;t<=i;t++)(o.rows[t]instanceof HeaderRow||o.rows[t]instanceof wijmo_grid_1._NewRowTemplate)&&r.push(t)}));r.forEach((function(e){_RangesHelper.excludeRow(i,e)}))}if((i=_RangesHelper.validateRowRanges(i,this.rows.length)).length){i.forEach((function(e){e.col=e.col2=-1}));this._clearCalcEngine();this.finishEditing();var s,a=this.selection.topRow,h=n?new RowColumnChangedEventArgs(i,!1,!1):new RowColumnChangedEventArgs(i[0].topRow,i[0].rowSpan,!1,!1);this.onPrepareChangingRow(h);this.undoStack.stackSize>0&&(s=new _RowsChangedAction(this,null,null,!1));var u,d,_=l&&this.itemsSource instanceof wijmo_1.CollectionView,c=null==this.selectedSheet.grid.collectionView,g=0;this.beginUpdate();this._isDeletingRows=!0;if(l){this.selectedSheet._dataView=this.collectionView._view.slice();u=this.autoGenerateColumns;this.autoGenerateColumns=!1;this.collectionView.beginUpdate();if(!_){d=this.selectedSheet.grid.autoGenerateColumns;this.selectedSheet.grid.autoGenerateColumns=!1;c||this.selectedSheet.grid.collectionView.beginUpdate()}}else this.rows.beginUpdate();for(var f=i.length-1;f>=0;f--){var p=i[f],m=void 0,w=new wijmo_grid_1.CellRangeEventArgs(this.cells,p);if(this.onDeletingRow(w)){if(s){(m=new _RowsChangedAction(this,p.topRow,p.rowSpan,!1))._affectedFormulas=this._updateAffectedFormula(p.bottomRow,p.rowSpan,!1,!0);m._affectedDefinedNameVals=this._updateAffectedNamedRanges(p.bottomRow,p.rowSpan,!1,!0);m._deletedTables=this._updateTablesForUpdatingRow(p.topRow,p.rowSpan,!0);s.addDeleteSubAction(m)}this._updateCellsForUpdatingRow(this.rows.length,p.topRow,p.rowSpan,!0);for(var C=p.bottomRow;C>=p.topRow;C--){var S=this.rows[C];if(!S||S.isVisible){g++;if(S.dataItem&&this.editableCollectionView){var b=void 0;this.editableCollectionView.remove(S.dataItem);var v=this.selectedSheet._dataView.indexOf(S.dataItem);this.selectedSheet._dataView.splice(v,1);var y=Array.from(this.rows).map((function(e){return e.height}));y.splice(C,1);this.setHeights(y);_||(b=this.itemsSource.indexOf(S.dataItem));this._updateItemIndexForRemovingRow(this.collectionView.sourceCollection,b)}else this.rows.removeAt(C)}}m&&m.saveNewState();this.onDeletedRow(w)}}if(l){if(!_){c||this.selectedSheet.grid.collectionView.endUpdate(g>0);this.selectedSheet.grid.autoGenerateColumns=d}this.collectionView.endUpdate(g>0);this.updateRowHeights();if(this.collectionView.sortDescriptions.length>0){this.collectionView._view=this.selectedSheet._dataView;this.collectionView._pgView=this.collectionView._getPageView();if(!_&&!c){this.selectedSheet.grid.collectionView._view=this.selectedSheet._dataView;this.selectedSheet.grid.collectionView._pgView=this.selectedSheet.grid.collectionView._getPageView()}this._bindGrid(!1);this.selectedSheet.grid._bindGrid(!1)}this.autoGenerateColumns=u}else this.rows.endUpdate();this.selectedSheet.selectionRanges.clear();var x,R=this.rows.length;if(0===R)x=new wijmo_grid_1.CellRange;else if(this.selection.topRow>=R)x=new wijmo_grid_1.CellRange(R-1,0,R-1,this.columns.length-1);else{var T=a;this.selection.topRow>=0&&(T=Math.min(T,this.selection.topRow));x=new wijmo_grid_1.CellRange(T,0,T,this.columns.length-1)}this.select(x,!1);0===R&&"move"===this.hostElement.style.cursor&&(this.hostElement.style.cursor="default");if(s){s.saveNewState();this._undoStack._addAction(s)}this.onRowChanged(h);this._isDeletingRows=!1;this.endUpdate()}}};FlexSheet.prototype.insertColumns=function(e,t){var o,i,n,l=this,r=wijmo_1.isNumber(e)&&e>=0?e:this.selection&&this.selection.leftCol>-1?this.selection.leftCol:0,s=wijmo_1.isNumber(t)?t:1;if(this.selectedSheet){this.columns.length>0?r>=this.columns.length&&(r=this.columns.length-1):r=0;this._clearCalcEngine();this.finishEditing();this.onPrepareChangingColumn(new RowColumnChangedEventArgs(r,s,!0,!0));this.undoStack.stackSize>0&&(o=new _ColumnsChangedAction(this,r,s,!0));this._updateCellsForUpdatingColumn(this.columns.length,r,s);i=this._updateAffectedFormula(r,s,!0,!1);n=this._updateAffectedNamedRanges(r,s,!0,!1);if(o){o._affectedFormulas=i;o._affectedDefinedNameVals=n}this.deferUpdate((function(){l.columns.beginUpdate();for(var e=0;e<s;e++){var t=new wijmo_grid_1.Column;t.isRequired=!1;if(l.itemsSource){t.binding=l._getUniqueColumnName();var i=l.rows[l._getDataRowsOffset()-1];if(i){i._ubv||(i._ubv={});i._ubv[t._hash]=FlexSheet._getHeaderRowText(t)}}l.columns.insert(r,t)}l.columns.endUpdate();l.selectedSheet._filterDefinition=l._filter.filterDefinition;l.selectedSheet.grid.columns._dirty=!1;l._sortManager._updateSortDescriptions(r,s);l._sortManager.commitSort(!1);l._updateTablesForUpdatingColumn(r,s);l.selection&&-1!==l.selection.row&&-1!==l.selection.col||l.select(new wijmo_grid_1.CellRange(0,0),!1);if(o){o.saveNewState();l._undoStack._addAction(o)}l.onColumnChanged(new RowColumnChangedEventArgs(r,s,!0,!0))}));this.updateRowHeights()}};FlexSheet.prototype.deleteColumns=function(e,t){if(this.selectedSheet){var o=e,i=wijmo_1.isArray(e);if(!i)if(wijmo_1.isNumber(e)){if((t=wijmo_1.isNumber(t)?t:1)<1)return;o=[new wijmo_grid_1.CellRange(-1,e,-1,e+t-1)]}else i=(o=this._selections()).length>1;if((o=_RangesHelper.validateColumnRanges(o,this.columns.length)).length){var n=this.selection.leftCol,l=0;o.forEach((function(e){l+=e.columnSpan;e.row=e.row2=-1}));this._clearCalcEngine();this.finishEditing();var r,s=i?new RowColumnChangedEventArgs(o,!1,!0):new RowColumnChangedEventArgs(o[0].leftCol,o[0].columnSpan,!1,!0);this.onPrepareChangingColumn(s);this.undoStack.stackSize>0&&(r=new _ColumnsChangedAction(this,null,null,!1));this.beginUpdate();this._isDeletingColumns=!0;var a=this.filter?this.filter._filters:null,h=!1;this.columns.beginUpdate();for(var u=o.length-1;u>=0;u--){var d=o[u],_=void 0;if(r){(_=new _ColumnsChangedAction(this,d.leftCol,d.columnSpan,!1))._affectedFormulas=this._updateAffectedFormula(d.rightCol,d.columnSpan,!1,!1);_._affectedDefinedNameVals=this._updateAffectedNamedRanges(d.rightCol,d.columnSpan,!1,!1);_._deletedTables=this._updateTablesForUpdatingColumn(d.leftCol,d.columnSpan,!0);r._delSubActions.push(_)}this._updateCellsForUpdatingColumn(this.columns.length,d.leftCol,d.columnSpan,!0);for(var c=d.rightCol;c>=d.leftCol;c--){var g=this.columns[c];if(g.isVisible){if(a)for(var f=0;f<a.length;f++)if(a[f].column===g){a.splice(f,1);h=!0;break}this.columns.removeAt(c);this._sortManager.deleteSortLevel(c)}}this._sortManager._updateSortDescriptions(d.leftCol,d.columnSpan,!1)}this.columns.endUpdate();if(h){for(c=0;c<this.columns.length;c++)this.columns[c].isVisible&&this.filter._updateColumnFilter(this.columns[c]);this.filter.apply()}this.selectedSheet._filterDefinition=this._filter.filterDefinition;this.selectedSheet.grid.columns._dirty=!1;this._sortManager.commitSort(!1);this.selectedSheet.selectionRanges.clear();var p,m=this.columns.length;if(0===m){p=new wijmo_grid_1.CellRange;"move"===this.hostElement.style.cursor&&(this.hostElement.style.cursor="default")}else if(this.selection.leftCol>=m)p=new wijmo_grid_1.CellRange(0,m-1,this.rows.length-1,m-1);else{var w=n-l+1;w=Math.max(w,o[0].leftCol);w=Math.min(w,this.selection.leftCol);p=new wijmo_grid_1.CellRange(this.selection.row,w,this.selection.row2,w)}this.select(p,!1);if(r){this._undoStack._addAction(r);r._delSubActions.forEach((function(e){e.saveNewState()}))}this.onColumnChanged(s);this._isDeletingColumns=!1;this.endUpdate();this.updateRowHeights()}}};FlexSheet.prototype.mergeRange=function(e,t){void 0===t&&(t=!1);var o,i,n,l,r,s=e||this.selection,a=-1,h=-1;if(this.selectedSheet){if(s){if(1===s.rowSpan&&1===s.columnSpan)return;for(o=s.topRow;o<=s.bottomRow;o++)for(i=s.leftCol;i<=s.rightCol;i++)if(this.selectedSheet.findTable(o,i))return;if(!e&&!t){this.undoStack.stackSize>0&&(r=new _CellMergeAction(this));this.hostElement.focus()}if(!this._resetMergedRange(s)){for(o=s.topRow;o<=s.bottomRow;o++)if((n=this.rows[o])&&n.isVisible){a=o;break}for(i=s.leftCol;i<=s.rightCol;i++)if((l=this.columns[i])&&l.isVisible){h=i;break}a>-1&&h>-1&&this.selectedSheet._mergedRanges.push(new wijmo_grid_1.CellRange(a,h,s.bottomRow,s.rightCol))}if(r){r.saveNewState();this._undoStack._addAction(r)}}e||this.refresh()}};FlexSheet.prototype.getMergedRange=function(t,o,i,n){void 0===n&&(n=!0);var l,r,s,a,h=this.selectedSheet?this.selectedSheet._getMergedRange(o,i):null;if(t===this.cells&&h){if(!h.isSingleCell&&(this.rows._frozenInternal>0||this.columns._frozenInternal>0)&&(h.topRow<this.rows._frozenInternal&&h.bottomRow>=this.rows._frozenInternal||h.leftCol<this.columns._frozenInternal&&h.rightCol>=this.columns._frozenInternal)){l=h.topRow;r=h.bottomRow;s=h.leftCol;a=h.rightCol;o>=this.rows._frozenInternal&&h.topRow<this.rows._frozenInternal&&(l=this.rows._frozenInternal);o<this.rows._frozenInternal&&h.bottomRow>=this.rows._frozenInternal&&(r=this.rows._frozenInternal-1);r>=this.rows.length&&(r=this.rows.length-1);i>=this.columns._frozenInternal&&h.leftCol<this.columns._frozenInternal&&(s=this.columns._frozenInternal);i<this.columns._frozenInternal&&h.rightCol>=this.columns._frozenInternal&&(a=this.columns._frozenInternal-1);a>=this.columns.length&&(a=this.columns.length-1);return new wijmo_grid_1.CellRange(l,s,r,a)}return h.bottomRow>=this.rows.length?new wijmo_grid_1.CellRange(h.topRow,h.leftCol,this.rows.length-1,h.rightCol):h.rightCol>=this.columns.length?new wijmo_grid_1.CellRange(h.topRow,h.leftCol,h.bottomRow,this.columns.length-1):h.clone()}return e.prototype.getMergedRange.call(this,t,o,i,n)};FlexSheet.prototype.evaluate=function(e,t,o,i){void 0===i&&(i=!0);var n=this._evaluate(e,t,o);return i&&null!=n&&!wijmo_1.isPrimitive(n)?n instanceof FormulaError?n.error:n.value:n};FlexSheet.prototype.getCellValue=function(e,t,o,i){void 0===o&&(o=!1);var n=i&&i!==this.selectedSheet?i.grid.columns[t]:this.columns[t],l=this._getCellStyle(e,t,i),r=l&&l.format||null,s=i&&i!==this.selectedSheet?i.grid.getCellData(e,t,!1):this.getCellData(e,t,!1);if(wijmo_1.isString(s)){var a=i||this.selectedSheet;if(a){var h=a.findTable(e,t);if(h&&h._isHeaderRow(e))return s}var u=_FormulaErrorHelper.asError(s);if(u)return u;if(_isFormula(s)){null==i&&(i=this.selectedSheet);if((s=this._evaluate(s,null,i,e,t))instanceof FormulaError)return s}}if(o){r||null==s||wijmo_1.isPrimitive(s)||(r=s.format);s=this._formatEvaluatedResult(s,n,r)}else null==s||wijmo_1.isPrimitive(s)||(s=s.value);return 0===o?s:null==s?"":s};FlexSheet.prototype.showFunctionList=function(e){var t=this;if(this._enableFormulas){this._functionTarget=wijmo_1.tryCast(e,HTMLInputElement);if(this._functionTarget&&this._functionTarget.value&&"="===this._functionTarget.value[0]){this._functionList._cv.filter=function(e){var o,i=e.actualvalue.toLowerCase(),n=t._getCurrentFormulaIndex(t._functionTarget.value);-1===n&&(n=0);return(o=t._functionTarget.value.substr(n+1).trim().toLowerCase()).length>0&&0===i.indexOf(o)||"="===t._functionTarget.value};this._functionList.selectedIndex=0;var o=e.getBoundingClientRect(),i=this._root.getBoundingClientRect(),n=FlexSheet._EDITOR_PADDING_BELOW+FlexSheet._MIN_DIALOG_GAP,l=Math.floor(o.bottom)+n+window.scrollY,r=o.left+window.scrollX;wijmo_1.setCss(this._functionListHost,{height:this._functionList._cv.items.length>5?"218px":"auto",display:this._functionList._cv.items.length>0?"block":"none",top:"",left:""});this._functionListHost.scrollTop=0;var s=this._functionListHost.offsetHeight,a=this._functionListHost.offsetWidth;n=FlexSheet._EDITOR_PADDING_BELOW+FlexSheet._MIN_DIALOG_GAP+FlexSheet._EDITOR_PADDING_ABOVE;var h=l-o.height-n-s;h>=0&&s+l>i.bottom&&(l=h);a+r>i.right+window.scrollX&&(r=i.right+window.scrollX-a);wijmo_1.setCss(this._functionListHost,{top:l,left:r})}else this.hideFunctionList()}};FlexSheet.prototype.hideFunctionList=function(){this._functionListHost.style.display="none"};FlexSheet.prototype.selectPreviousFunction=function(){this._functionList.selectedIndex>0&&this._functionList.selectedIndex--};FlexSheet.prototype.selectNextFunction=function(){this._functionList.selectedIndex<this._functionList.itemsSource.length&&this._functionList.selectedIndex++};FlexSheet.prototype.applyFunctionToCell=function(){if(this._functionTarget){var e=this._getCurrentFormulaIndex(this._functionTarget.value);-1===e?e=this._functionTarget.value.indexOf("="):e+=1;this._functionTarget.value=this._functionTarget.value.substring(0,e)+this._functionList.selectedValue+"(";"="!==this._functionTarget.value[0]&&(this._functionTarget.value="="+this._functionTarget.value);this._functionTarget.focus();this.hideFunctionList()}};FlexSheet.prototype.save=function(e,t){var o=this._saveToWorkbook(t);e&&o.save(e);return o};FlexSheet.prototype.saveAsync=function(e,t,o,i){var n=this._saveToWorkbook(i);n.saveAsync(e,t,o);return n};FlexSheet.prototype.saveToWorkbookOM=function(e){return this._saveToWorkbook(e)._serialize()};FlexSheet.prototype.load=function(e){var t=this;if(e instanceof Blob)wijmo_grid_xlsx_1._blobToBuffer(e,(function(o){e=null;var i=new mXlsx.Workbook;i.load(o);o=null;t._loadFromWorkbook(i);i=null}));else if(e instanceof mXlsx.Workbook){this._loadFromWorkbook(e);e=null}else{if(!(e instanceof ArrayBuffer||wijmo_1.isString(e)))throw"Invalid workbook.";var o=new mXlsx.Workbook;o.load(e);e=null;this._loadFromWorkbook(o);o=null}};FlexSheet.prototype.loadAsync=function(e,t,o){var i=this;if(e instanceof Blob)wijmo_grid_xlsx_1._blobToBuffer(e,(function(n){e=null;var l=new mXlsx.Workbook;l.loadAsync(n,(function(){i._loadFromWorkbook(l);t&&t(l);n=null;l=null}),o)}));else if(e instanceof mXlsx.Workbook){this._loadFromWorkbook(e);t&&t(e);e=null}else{if(!(e instanceof ArrayBuffer||wijmo_1.isString(e)))throw"Invalid workbook.";var n=new mXlsx.Workbook;n.loadAsync(e,(function(){e=null;i._loadFromWorkbook(n);t&&t(n);n=null}),o)}};FlexSheet.prototype.loadFromWorkbookOM=function(e){var t;e instanceof mXlsx.Workbook?t=e:(t=new mXlsx.Workbook)._deserialize(e);this._loadFromWorkbook(t)};FlexSheet.prototype.undo=function(){var e=this;setTimeout((function(){e._undoStack.undo()}),100)};FlexSheet.prototype.redo=function(){var e=this;setTimeout((function(){e._undoStack.redo()}),100)};FlexSheet.prototype.select=function(t,o,i){void 0===o&&(o=!0);var n,l,r;if(wijmo_1.isNumber(t)&&wijmo_1.isNumber(o)){t=new wijmo_grid_1.CellRange(t,o);this._lastSelMovePos=t;o=!0}else this._lastSelMovePos=null;if(t.rowSpan!==this.rows.length&&t.columnSpan!==this.columns.length)for(l=t.topRow;l<=t.bottomRow;l++)for(r=t.leftCol;r<=t.rightCol;r++)if((n=this.getMergedRange(this.cells,l,r))&&!t.equals(n)){if(t.row<=t.row2){t.row=Math.min(t.topRow,n.topRow);t.row2=Math.max(t.bottomRow,n.bottomRow)}else{t.row=Math.max(t.bottomRow,n.bottomRow);t.row2=Math.min(t.topRow,n.topRow)}if(t.col<=t.col2){t.col=Math.min(t.leftCol,n.leftCol);t.col2=Math.max(t.rightCol,n.rightCol)}else{t.col=Math.max(t.rightCol,n.rightCol);t.col2=Math.min(t.leftCol,n.leftCol)}}this._isPasting&&this.collectionView&&(this.collectionView._pendingRefresh=!1);!this._enableMulSel&&this.selectedSheet&&this.selectedSheet.selectionRanges.clear();return e.prototype.select.call(this,t,o,i)};FlexSheet.prototype.addCustomFunction=function(e,t,o,i,n){wijmo_1._deprecated("addCustomFunction","addFunction");this._calcEngine.addCustomFunction(e,t,i,n);this._addCustomFunctionDescription(e,o)};FlexSheet.prototype.addFunction=function(e,t,o,i,n){this._calcEngine.addFunction(e,t,i,n);this._addCustomFunctionDescription(e,o)};FlexSheet.prototype.dispose=function(){var t=window.navigator.userAgent;this._needCopyToSheet=!1;this.removeEventListener(document.body,"mousemove",this._mouseMoveHdl);this.removeEventListener(document.body,"keydown",this._keydownHdl);this.removeEventListener(document.body,"click",this._clickHdl);if(t.match(/iPad/i)||t.match(/iPhone/i)){this.removeEventListener(document.body,"touchstart",this._touchStartHdl);this.removeEventListener(document.body,"touchend",this._touchEndHdl)}this._filter&&this._filter.filterApplied.removeAllHandlers();this.hideFunctionList();if(!this.itemsSource){var o=this._selHdl.selection;o.row=o.row2=-1}this._sheets.clear();this._tabHolder.dispose();this._contextMenu.dispose();this._functionList.dispose();e.prototype.dispose.call(this)};FlexSheet.prototype.getClipString=function(t){var o,i,n,l,r,s,a,h="",u=!0;if(!this.selectedSheet)return e.prototype.getClipString.call(this,t);this._isCutting=!1;if(!t)if(this.selectedSheet.selectionRanges.length>1){if(this._isMultipleRowsSelected()){h="";(o=this._selections()).sort(this._sortByRow);for(n=0;n<o.length;n++){h&&(h+="\n");h+=this.getClipString(o[n])}return h}if(this._isMultipleColumnsSelected()){h="";(o=this._selections()).sort(this._sortByColumn);for(i=(r=o[0]).topRow,u=!0;i<=r.bottomRow;i++){u||(h+="\n");u=!1;for(n=0,l=!0;n<o.length;n++){s=o[n];l||(h+="\t");l=!1;h+=this.getClipString(new wijmo_grid_1.CellRange(i,s.col,i,s.col2))}}return h}wijmo_1.assert(!1,"Copy or Cut operation cannot be used on multiple selections.")}else{var d=this.selectionMode;if(d!=wijmo_grid_1.SelectionMode.ListBox)for(var _=this.rows,c=0;c<_.length;c++)if(_[c].isSelected){d=wijmo_grid_1.SelectionMode.ListBox;break}t=this.selection;switch(d){case wijmo_grid_1.SelectionMode.Row:case wijmo_grid_1.SelectionMode.RowRange:t.col=0;t.col2=this.columns.length-1;break;case wijmo_grid_1.SelectionMode.ListBox:t.col=0;t.col2=this.columns.length-1;for(var g=0;g<this.rows.length;g++)if(this.rows[g].isSelected&&this.rows[g].isVisible){t.row=t.row2=g;h&&(h+="\n");h+=this.getClipString(t)}return h}}if(!(t=wijmo_1.asType(t,wijmo_grid_1.CellRange)).isValid)return"";c=t.topRow;for(var f=!0;c<=t.bottomRow;c++){var p=this.rows[c];if(p.isVisible){f||(h+="\n");f=!1;for(var m=p instanceof wijmo_grid_1.GroupRow?p:null,w=this.activePanel.grid,C=m&&(w.groupSummaryPosition===wijmo_grid_1.GroupSummaryPosition.Bottom||w.groupSummaryPosition===wijmo_grid_1.GroupSummaryPosition.Auto&&!m.isCollapsed),S=m&&!m.isSummary&&C,b=t.leftCol,v=!0;b<=t.rightCol;b++)if(this.columns[b].isVisible){v||(h+="\t");v=!1;a=this.getCellValue(c,b,!0).toString();S&&b!=this.columns.firstVisibleIndex&&(a="");var y=new wijmo_grid_1.CellRangeEventArgs(this.activePanel,new wijmo_grid_1.CellRange(c,b,c,b),a);this.onGettingCellClipString(y);(a=(a=y.data).replace(/\t/g," ")).indexOf("\n")>-1&&(a='"'+a.replace(/"/g,'""')+'"');h+=a}}}return h};FlexSheet.prototype.setClipString=function(t,o){var i=null==o,n=!1;if(this.selectedSheet){o=o?wijmo_1.asType(o,wijmo_grid_1.CellRange):this.selection;var l=t=wijmo_1.asString(t).replace(/\r\n/g,"\n").replace(/\r/g,"\n"),r=this._edtHdl._parseClipString(wijmo_1.asString(t));i&&!o.isSingleCell&&r.length&&this._edtHdl._expandClipRows(r,o);var s=this._containsMultiLineText(r);if(this._copiedRanges&&0!==this._copiedRanges.length&&(l.trim()===this._getRangeString(this._copiedRanges,this._copiedSheet).trim()||this._containsRandFormula(this._copiedRanges,this._copiedSheet))&&!this._cutValue||s){0===o.topRow&&this.allowAddNew&&this.newRowAtTop&&this.rows[0].isVisible&&o.rowSpan>1&&this.select(new wijmo_grid_1.CellRange(o.topRow,o.leftCol,o.topRow,o.rightCol));if(this._copiedRanges){var a=this._getRangeString(this._copiedRanges,this._copiedSheet,!1)+"\r\n";a=wijmo_1.asString(a).replace(/\r\n/g,"\n").replace(/\r/g,"\n");r=this._edtHdl._parseClipString(wijmo_1.asString(a));i&&!o.isSingleCell&&r.length&&this._edtHdl._expandClipRows(r,o)}var h=o.topRow+r.length-1;h>=this.rows.length&&(h=this.rows.length-1);var u=o.leftCol;if(r.length)for(var d=u,_=0;d<this.columns.length&&_<r[0].length;d++){this.columns[d].visible&&_++;u=d}var c=new wijmo_grid_1.CellRange(o.topRow,o.leftCol,h,u);if(this.onPasting(new wijmo_grid_1.CellRangeEventArgs(this.cells,c,t))){this.beginUpdate();var g=r.length>1,f=this.editableCollectionView;f&&g&&f.beginUpdate();if(s||!this._copiedRanges||this._copiedRanges.length>1||0===this._copiedRanges.length)for(var p=0,m=(I=this._copiedRanges&&this._copiedRanges.length>1?this._copiedRanges[0]:new wijmo_grid_1.CellRange).topRow,w=(d=0,o.topRow);d<r.length&&w<this.rows.length;d++,w++){if((D=this.rows[w]).isVisible){if(!D.isReadOnly){var C=r[d],S=I.leftCol,b=D.dataItem;if(D instanceof wijmo_grid_1._NewRowTemplate){g&&(D.dataItem=f.addNew());var v=this.newRowAtTop?g?0:d:w,y=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(v,-1));if(!this.onRowEditStarting(y)){w--;g&&f.cancelNew();continue}this.onRowEditStarted(y)}for(var x=0,R=o.leftCol;x<C.length&&R<this.columns.length;x++,R++)if(this.columns[R].isVisible){if(!this.columns[R].isReadOnly){var T=C[x];if(!this.columns[R].isReadOnly&&!D.isReadOnly){var E=T.length;E>1&&'"'==T[0]&&'"'==T[E-1]&&T.indexOf("\n")>-1&&(T=T.substr(1,E-2));n=this._postSetClipStringProcess(b,T,w,R,p,m,S,f)||n;c.row2=Math.max(c.row2,w+p);c.col2=Math.max(c.col2,R)}S>=0&&S++}}else x--;m>=0&&m++;if(g&&D instanceof wijmo_grid_1._NewRowTemplate){D.dataItem=null;w--;p++;y=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(this.newRowAtTop?0:w,-1));this.onRowEditEnding(y);this.onRowEditEnded(y);f.commitNew()}}}else d--}else if(this._copiedRanges&&1===this._copiedRanges.length){var F=this.selectedSheet===this._copiedSheet?this:this._copiedSheet.grid,A=(p=0,0),I=this.selectionMode===wijmo_grid_1.SelectionMode.ListBox?this._getSelectionForListBoxMode(F):this._copiedRanges[0];for(d=0,w=o.topRow;d<r.length&&w<this.rows.length;d++,w++){var D,k=0;if((D=this.rows[w]).isVisible){if(!D.isReadOnly){for(;F.rows[I.topRow+A]&&!F.rows[I.topRow+A].isVisible;)A++;A>=I.rowSpan&&(A%=I.rowSpan);if(!F.rows[I.topRow+A])break;var j=w-I.topRow-A;C=r[d],b=D.dataItem;if(D instanceof wijmo_grid_1._NewRowTemplate){g&&(D.dataItem=f.addNew());v=this.newRowAtTop?g?0:d:w,y=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(v,-1));if(!this.onRowEditStarting(y)){w--;g&&f.cancelNew();continue}this.onRowEditStarted(y)}for(x=0,R=o.leftCol;x<C.length&&R<this.columns.length;x++,R++)if(this.columns[R]&&this.columns[R].isVisible){if(!this.columns[R].isReadOnly){k>=I.columnSpan&&(k%=I.columnSpan);if(!F.columns[I.leftCol+k])break;var M=R-I.leftCol-k;if(!this.columns[R].isReadOnly&&!D.isReadOnly){T=C[x];var N=this._getCellStyle(I.topRow+A,I.leftCol+k,this._copiedSheet);if(_isFormula(T)&&(0!==j||0!==M))try{var V=this._calcEngine.parse(T),B=new wijmo_grid_1.CellRange(I.topRow+A,I.leftCol+k),H=new wijmo_grid_1.CellRange(I.topRow+A+j,I.leftCol+k+M),L=!(this._isCutting&&!V._refersTo(I));V._moveCellRangeExp(this.selectedSheetIndex,B,H,!1,L)&&(T="="+V._getStringExpression())}catch(e){}F.columns[I.leftCol+k].format&&!this.columns[R].format&&(N?N.format||(N.format=F.columns[I.leftCol+k].format):N={format:F.columns[I.leftCol+k].format});n=this._postSetClipStringProcess(b,T,w,R,p,I.topRow+A,I.leftCol+k,f,N)||n;c.row2=Math.max(c.row2,w+p);c.col2=Math.max(c.col2,R)}k++}}else x--;A++;if(g&&D instanceof wijmo_grid_1._NewRowTemplate){D.dataItem=null;w--;p++;y=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(this.newRowAtTop?0:w,-1));this.onRowEditEnding(y);this.onRowEditEnded(y);f.commitNew()}}}else d--}}if(this._isCutting){this._delCutData(r.length,r[0].length);this._isCutting=!1;this._cutValue=l;this._copiedRanges=null;this._copiedSheet=null}if(f&&g){f.currentEditItem&&f.commitEdit();f.endUpdate(!0)}else if(f&&n){var P=f.currentAddItem;!P&&0===o.topRow&&this.newRowAtTop&&this.rows[0]instanceof wijmo_grid_1._NewRowTemplate&&(P=this.rows[0].dataItem);if(P){f.editItem(P);this._edtHdl._edItem=P}f.refresh()}this.endUpdate();this.select(c);this.onPasted(new wijmo_grid_1.CellRangeEventArgs(this.cells,c))}else{this._cutValue=null;this._copiedRanges=null;this._copiedSheet=null}}else{if(l!==this._cutValue){this._cutValue=null;e.prototype.setClipString.call(this,t,o)}this._copiedRanges=null;this._copiedSheet=null}}else e.prototype.setClipString.call(this,t,o)};FlexSheet.prototype.getBuiltInTableStyle=function(e){var t;null==this._builtInTableStylesCache&&(this._builtInTableStylesCache={});if(null==(t=this._builtInTableStylesCache[e.toLowerCase()])){t=this._createBuiltInTableStyle(e);Object.freeze(t);this._builtInTableStylesCache[e.toLowerCase()]=t}return t};FlexSheet.prototype.onSortingColumn=function(e){if(e.data.srcElement instanceof HTMLButtonElement&&wijmo_1.hasClass(e.data.srcElement,"wj-btn")){this.sortingColumn.raise(this,e);return!e.cancel}return!1};FlexSheet.prototype._getCvIndex=function(t){return t>-1&&this.collectionView?this.rows[t]instanceof HeaderRow?t:e.prototype._getCvIndex.call(this,t):-1};FlexSheet.prototype._headerRowAtTop=function(){var e=this._getDataRowsOffset();return e>0&&this.rows[e-1]instanceof HeaderRow};FlexSheet.prototype._getDataRowsOffset=function(){var e=0;this.allowAddNew&&this.newRowAtTop&&e++;this.rows[e]instanceof HeaderRow&&e++;return e};FlexSheet.prototype._bindGrid=function(t){if(!this._ignoreBindGrid)if(this.itemsSource)e.prototype._bindGrid.call(this,t);else if(!this.rows.length){var o=this._selHdl.selection;o.row=o.row2=-1}};FlexSheet.prototype._init=function(){var e=this,t=window.navigator.userAgent,mouseUp=function(t){document.removeEventListener("mouseup",mouseUp);e._mouseUp(t)};this.hostElement.setAttribute("tabindex","-1");this._divContainer=this.hostElement.querySelector('[wj-part="container"]');this._tabHolder=new _TabHolder(this.hostElement.querySelector('[wj-part="tab-holder"]'),this);if(void 0!==this._isTabHolderVisibleCache){this._tabHolder.visible=this._isTabHolderVisibleCache;this._isTabHolderVisibleCache||(this._eFocus.tabIndex=this._orgTabIndex);this._isTabHolderVisibleCache=void 0}this._sheets.selectedSheetChanged.addHandler(this._selectedSheetChange,this);this._sheets.collectionChanged.addHandler(this._sourceChange,this);this._sheets.sheetVisibleChanged.addHandler(this._sheetVisibleChange,this);this._sheets.sheetCleared.addHandler(this.onSheetCleared,this);this._contextMenu=new _SheetContextMenu(this.hostElement.querySelector('[wj-part="context-menu"]'),this);this._tabHolder.addEventListener(this._tabHolder.hostElement,"mousedown",(function(){t.match(/iPad/i)||t.match(/iPhone/i)||e._hideContextMenu()}));this._gpCells=new FlexSheetPanel(this,wijmo_grid_1.CellType.Cell,this.rows,this.columns,this._eCt);this._gpCHdr=new FlexSheetPanel(this,wijmo_grid_1.CellType.ColumnHeader,this._hdrRows,this.columns,this._eCHdrCt);this._gpRHdr=new FlexSheetPanel(this,wijmo_grid_1.CellType.RowHeader,this.rows,this._hdrCols,this._eRHdrCt);this._gpTL=new FlexSheetPanel(this,wijmo_grid_1.CellType.TopLeft,this._hdrRows,this._hdrCols,this._eTLCt);this._syncSelection=this._flexSheetSyncSelection.bind(this);this._sortManager=new SortManager(this);this._filter=new FlexSheetFilter(this);this._filter.filterApplied.addHandler((function(){if(e.selectedSheet){e.selectedSheet._filterDefinition=e._filter.filterDefinition;if(e.selectedSheet.itemsSource){e.selectedSheet._storeRowSettings();e.selectedSheet._setRowSettings()}}}));this._calcEngine=new _CalcEngine(this);this._calcEngine.unknownFunction.addHandler((function(t,o){e.onUnknownFunction(o)}),this);this._initFuncsList();this._undoStack=new UndoStack(this);this.loadedRows.addHandler((function(){if(e.collectionView&&!(e.rows[0]instanceof HeaderRow)&&!e._headerRowRemoved){var t=new HeaderRow;t.isReadOnly=!0;for(var o=0;o<e.columns.length;o++){var i=e.columns[o];t._ubv||(t._ubv={});t._ubv[i._hash]=FlexSheet._getHeaderRowText(i)}e.rows[0]instanceof wijmo_grid_1._NewRowTemplate&&e.newRowAtTop?e.rows.insert(1,t):e.rows.insert(0,t)}e._filter&&e._filter.apply()}));this.itemsSourceChanged.addHandler((function(){var t;for(t=0;t<e.columns.length;t++)e.columns[t].isRequired=!1;e.collectionView&&e.collectionView.currentChanged.removeHandler(null,e)}));this.copied.addHandler((function(t,o){var i;if(e.selectedSheet){e._copiedSheet=e.selectedSheet;e._needCopyToSheet=!0;if(e.selectedSheet.selectionRanges.length>1)if(e._isMultipleRowsSelected()){(i=e.selectedSheet.selectionRanges.slice(0)).sort(e._sortByRow);e._copiedRanges=i}else if(e._isMultipleColumnsSelected()){(i=e.selectedSheet.selectionRanges.slice(0)).sort(e._sortByColumn);e._copiedRanges=i}else wijmo_1.assert(!1,"Copy operation cannot be used on multiple selections.");else e._copiedRanges=[o.range]}}));this.rows.collectionChanged.addHandler((function(t,o){e._clearForEmptySheet("rows");e.itemsSource||!e.selectedSheet||!e._needCopyToSheet||e._isCopying||e._isUndoing||o.item instanceof wijmo_grid_1._NewRowTemplate||e._copyRowsToSelectedSheet();e.itemsSource&&e.selectedSheet&&o.action===wijmo_1.NotifyCollectionChangedAction.Remove&&o.item instanceof HeaderRow&&!e._draggingSingleRow&&(e._headerRowRemoved=!0)}),this);this.columns.collectionChanged.addHandler((function(t){e._clearForEmptySheet("columns");e.selectedSheet&&e._needCopyToSheet&&!e._isCopying&&!e._isUndoing&&e._copyColumnsToSelectedSheet()}),this);this.addEventListener(this.hostElement,"mousedown",(function(t){document.addEventListener("mouseup",mouseUp);e._isDescendant(e._divContainer,t.target)&&e._mouseDown(t)}),!0);this.addEventListener(this.hostElement,"dragend",(function(){e._columnHeaderClicked=!1;e._htDown=null;e._enableMulSel=!1;e.selectedSheet._addSelection(e.selection)}));this.addEventListener(this.hostElement,"contextmenu",(function(t){if(!t.defaultPrevented&&e.selectedSheet){if(!e.activeEditor){var o=void 0,i=void 0,n=e.selection;if(e._isContextMenuKeyDown&&n.row>-1&&n.col>-1&&e.rows.length>0&&e.columns.length>0){var l=e.columns[n.col],r=e.rows[n.row],s=e._cumulativeOffset(e.hostElement),a=e._cumulativeScrollOffset(e.hostElement),h=l.pos+e._eCt.offsetLeft+s.x+l.renderSize/2+e._ptScrl.x,u=r.pos+e._eCt.offsetTop+s.y+r.renderSize/2+e._ptScrl.y;i=new wijmo_1.Point(h-a.x,u-a.y);o=e.hitTest(h,u)}else o=e.hitTest(t);t.preventDefault();if(o&&o.cellType!==wijmo_grid_1.CellType.None){var d=e.columns.length-1,_=e.rows.length-1,c=void 0;switch(o.cellType){case wijmo_grid_1.CellType.TopLeft:c=new wijmo_grid_1.CellRange(Math.min(0,_),Math.min(0,d),_,d);break;case wijmo_grid_1.CellType.RowHeader:c=new wijmo_grid_1.CellRange(o.row,Math.min(0,d),o.row,d);break;case wijmo_grid_1.CellType.ColumnHeader:c=new wijmo_grid_1.CellRange(e.itemsSource&&e.rows[0]&&!e.rows[0].isVisible?1:Math.min(0,_),o.col,_,o.col);break;case wijmo_grid_1.CellType.Cell:c=new wijmo_grid_1.CellRange(o.row,o.col)}(c&&e.selection.contains(c)||o.cellType===wijmo_grid_1.CellType.RowHeader&&e._isRowSelected(o.row)||o.cellType===wijmo_grid_1.CellType.ColumnHeader&&e._isColumnSelected(o.col)||o.cellType===wijmo_grid_1.CellType.Cell&&e._isCellSelected(o.row,o.col))&&(c=null);if(c){if(e.selectedSheet){e.selectedSheet.selectionRanges.clear();e.selectedSheet.selectionRanges.push(c)}e.selection=c}e._contextMenu.show(t,i)}}e._isContextMenuKeyDown=!1}}));this.prepareCellForEdit.addHandler(this._prepareCellForEditHandler,this);this.cellEditEnded.addHandler((function(t,o){(!o.data||46!==o.data.keyCode&&8!==o.data.keyCode)&&setTimeout((function(){e.hideFunctionList()}),200)}));this.cellEditEnding.addHandler((function(t,o){if(!o.cancel&&(!o.data||46!==o.data.keyCode&&8!==o.data.keyCode)){var i=e.getCellData(o.row,o.col,!1),n=e.cellFactory.getEditorValue(e);if((null==i||""===i)&&null!=n&&""!==n&&!isNaN(+n)){var l=e._updateFormulaBoundaryForEditingCell(o.row,o.col);e._undoStack._pendingAction&&e._undoStack._pendingAction instanceof _EditAction&&(e._undoStack._pendingAction._affectedFormulas=l)}e._clearCalcEngine();e._clearCalcCacheOnRefresh=!1}}));this.rowEditEnding.addHandler((function(t){var o=e.collectionView;if(o&&e.selectedSheet){var i=o.sortDescriptions.length>0,n=e._filter&&e._filter._isActive();(i||e.selectedSheet._dataView||n)&&(e.selectedSheet._dataView=o._view.slice());i&&(e.selectedSheet._scrollPosition=e.scrollPosition)}}));this.rowEditEnded.addHandler((function(t){var o=e.collectionView;if(o&&e.selectedSheet){e.selectedSheet._dataView&&(e.selectedSheet._dataView=o._view.slice());var i=o.sortDescriptions.length>0,n=e._filter&&e._filter._isActive();if(i||n){o._view=e.selectedSheet._dataView;o._pgView=o._getPageView();if(!(e.itemsSource instanceof wijmo_1.CollectionView)&&null!=e.selectedSheet.grid.collectionView){e.selectedSheet.grid.collectionView._view=e.selectedSheet._dataView;e.selectedSheet.grid.collectionView._pgView=e.selectedSheet.grid.collectionView._getPageView()}if(e.refreshOnEdit){e._isPasting||e._bindGrid(!1);e.selectedSheet.grid._bindGrid(!1)}}i&&(e.scrollPosition=e.selectedSheet._scrollPosition)}}));this.pasting.addHandler((function(){e._needCopyToSheet=!1;e._isPasting=!0}));this.pasted.addHandler((function(){var t=e.collectionView,o=e.selectedSheet;t&&o&&o._dataView&&o._dataView.length!==t._view.length&&(o._dataView=t._view.slice());e._needCopyToSheet=!0;e._isPasting=!1;e._clearCalcEngine()}));this.resizingColumn.addHandler((function(){e._resizing=!0}));this.resizingRow.addHandler((function(){e._resizing=!0}));this.resizedColumn.addHandler((function(){e._resizing=!1}));this.resizedRow.addHandler((function(){e._resizing=!1}));this.selectionChanged.addHandler((function(){var t=e.selection;t.rightCol>=e.columns.length&&(e.selection=new wijmo_grid_1.CellRange(t.row,Math.min(t.col,e.columns.length-1),t.row2,Math.min(e.selection.col2,e.columns.length-1)));e._enableMulSel||e._isCopying||!e.selectedSheet||e.selectedSheet.selectionRanges.clear()}));this.draggingRow.addHandler((function(){e._draggingSingleRow=!0}));this.draggedRow.addHandler((function(){e._draggingSingleRow=!1}));this.addEventListener(this.hostElement,"keydown",(function(t){var o,i,n=!1,l=!1;if(t.ctrlKey){if(89===t.keyCode){e.finishEditing();e.redo();t.preventDefault()}if(90===t.keyCode){e.finishEditing();e.undo();t.preventDefault()}if(e.selectedSheet&&65===t.keyCode){e._isClicking=!0;e.selectedSheet.selectionRanges.clear();e.selectedSheet.selectionRanges.push(e.selection);e._isClicking=!1}if(67===t.keyCode||45==t.keyCode){if(e.activeEditor){e._copiedRanges=null;e._copiedSheet=null}e._cutValue=null}if(88===t.keyCode&&!e.activeEditor){t.stopPropagation();if(e.selectionMode===wijmo_grid_1.SelectionMode.ListBox)for(var r=0;r<e.rows.length;r++)if(e.rows[r].isSelected)if(n)l||wijmo_1.assert(!1,"Cut operation cannot be used on multiple selections.");else{n=!0;l=!0}else l&&(l=!1);if(e.selectedSheet.selectionRanges.length>1)wijmo_1.assert(!1,"Cut operation cannot be used on multiple selections.");else{e.finishEditing();o=new wijmo_grid_1.CellRangeEventArgs(e.cells,e.selection);if(e.onCopying(o)){e._cutValue=null;i=e.getClipString();e._isCutting=!0;wijmo_1.Clipboard.copy(i);e.onCopied(o)}}}t.keyCode!==wijmo_1.Key.Space||!e.selection.isValid||e.selectionMode!==wijmo_grid_1.SelectionMode.CellRange&&e.selectionMode!==wijmo_grid_1.SelectionMode.MultiRange||e.select(new wijmo_grid_1.CellRange(0,e.selection.col,e.rows.length-1,e.selection.col))}t.keyCode===wijmo_1.Key.Escape&&e._hideContextMenu();(93===t.keyCode||t.shiftKey&&121===t.keyCode)&&(e._contextMenu.visible&&!wijmo_1.isFirefox()?e._isContextMenuKeyDown=!1:e._isContextMenuKeyDown=!0)}));this.addEventListener(document.body,"keydown",this._keydownHdl,!0);this.addEventListener(document.body,"click",this._clickHdl);this.addEventListener(document.body,"mousemove",this._mouseMoveHdl);this.draggedColumn.addHandler((function(t,o){e.sortManager._handleColumnMoving(o.data.col,o.col)}));if(t.match(/iPad/i)||t.match(/iPhone/i)){this.addEventListener(document.body,"touchstart",this._touchStartHdl);this.addEventListener(document.body,"touchend",this._touchEndHdl)}};FlexSheet.prototype._flexSheetSyncSelection=function(e){if(this.collectionView&&this.selectionMode!=wijmo_grid_1.SelectionMode.None){var t=this.selection,o=t.row>-1&&t.row<this.rows.length?this.rows[t.row]:null,i=o?o.dataItem:null;if(this.collectionView instanceof wijmo_1.CollectionView&&this.collectionView.isUpdating)return;(o instanceof HeaderRow||this.newRowAtTop&&o instanceof wijmo_grid_1._NewRowTemplate||i instanceof wijmo_1.CollectionViewGroup)&&(i=null);if((i!=this.collectionView.currentItem||e)&&(!this.editableCollectionView||!this.editableCollectionView.currentAddItem)){var n=this._getRowIndex(this.collectionView.currentPosition);if(n>-1&&n!=t.row){t.row=t.row2=n;this.select(t,!1);this.selectionMode&&!this._copyingTo&&this.scrollIntoView(t.row,-1)}}}};FlexSheet.prototype._initFuncsList=function(){var e=this;this._functionListHost=document.createElement("div");wijmo_1.addClass(this._functionListHost,exports.FlexSheetClsNames.flexSheetFormulaList);document.querySelector("body").appendChild(this._functionListHost);this._functionListHost.style.display="none";this._functionListHost.style.position="absolute";this._functionList=new mInput.ListBox(this._functionListHost);this._functionList.isContentHtml=!0;this._functionList.itemsSource=this._getFunctions();this._functionList.displayMemberPath="displayValue";this._functionList.selectedValuePath="actualvalue";this.addEventListener(this._functionListHost,"click",this.applyFunctionToCell.bind(this));this.addEventListener(this._functionListHost,"keydown",(function(t){if(t.keyCode===wijmo_1.Key.Escape){e.hideFunctionList();e.hostElement.focus();t.preventDefault()}if(t.keyCode===wijmo_1.Key.Enter){e.applyFunctionToCell();e.hostElement.focus();t.preventDefault();t.stopPropagation()}}))};FlexSheet.prototype._getFunctions=function(){for(var e,t=[],o=0;o<FlexSheetFunctions.length;o++){e=FlexSheetFunctions[o];t.push({displayValue:'<div class="'+exports.FlexSheetClsNames.flexSheetFormulaName+'">'+e.name+'</div><div class="'+exports.FlexSheetClsNames.flexSheetFormulaDescription+'">'+e.description+"</div>",actualvalue:e.name})}return t};FlexSheet.prototype._addCustomFunctionDescription=function(e,t){for(var o={displayValue:'<div class="'+exports.FlexSheetClsNames.flexSheetFormulaName+'">'+e+"</div>"+(t?'<div class="'+exports.FlexSheetClsNames.flexSheetFormulaDescription+'">'+t+"</div>":""),actualvalue:e},i=this._functionList.itemsSource,n=-1,l=0;l<i.length;l++)if(i[l].actualvalue===e){n=l;break}n>-1?i.splice(n,1,o):i.push(o)};FlexSheet.prototype._getCurrentFormulaIndex=function(e){var t=-1;["+","-","*","/","^","(","&"].forEach((function(o){var i=e.lastIndexOf(o);"/"===o&&(i>=2&&"#N"===e.substr(i-2,2)||i>=4&&"#DIV"===e.substr(i-4,4))||i>t&&(t=i)}));return t};FlexSheet.prototype._prepareCellForEditHandler=function(){var e=this,t=this._edtHdl._edt;if(t){this.addEventListener(t,"keydown",(function(t){if(e.isFunctionListOpen)switch(t.keyCode){case wijmo_1.Key.Up:e.selectPreviousFunction();t.preventDefault();t.stopPropagation();break;case wijmo_1.Key.Down:e.selectNextFunction();t.preventDefault();t.stopPropagation();break;case wijmo_1.Key.Tab:case wijmo_1.Key.Enter:e.applyFunctionToCell();t.preventDefault();t.stopPropagation();break;case wijmo_1.Key.Escape:e.hideFunctionList();t.preventDefault();t.stopPropagation()}}));this.addEventListener(t,"keyup",(function(o){(o.keyCode>40||o.keyCode<32)&&o.keyCode!==wijmo_1.Key.Tab&&o.keyCode!==wijmo_1.Key.Escape&&setTimeout((function(){e.showFunctionList(t)}),0)}))}};FlexSheet.prototype._addSheet=function(e,t,o,i,n){var l=new Sheet(this,n,e,t,o);l.name||l._setValidName(this.sheets.getUniqueNameOnInit());if("number"==typeof i){i<0&&(i=0);i>=this.sheets.length&&(i=this.sheets.length)}else i=this.sheets.length;this.sheets.insert(i,l);return l};FlexSheet.prototype._showSheet=function(e){if(!(!this.sheets||!this.sheets.length||e>=this.sheets.length||e<0||e===this.selectedSheetIndex||this.sheets[e]&&!this.sheets[e].visible)){this.beginUpdate();this.finishEditing();this._clearCalcEngine();this._isCopying=!0;if(this.selectedSheetIndex>-1&&this.selectedSheetIndex<this.sheets.length&&!this._sheets._exchangingPosition){this._copyingTo=!0;try{this._copyTo(this.sheets[this.selectedSheetIndex])}finally{this._copyingTo=!1}}if(this.sheets[e]){this._selectedSheetIndex=e;this._copyFrom(this.sheets[e])}this._isCopying=!1;this.endUpdate();this._filter.closeEditor()}};FlexSheet.prototype._selectedSheetChange=function(e,t){this.beginUpdate();this._showSheet(t.newValue);this._clearCalcCacheOnRefresh=!1;this.endUpdate();this.onSelectedSheetChanged(t)};FlexSheet.prototype._sourceChange=function(e,t){if(!this.sheets._exchangingPosition){this.beginUpdate();if(t.action===wijmo_1.NotifyCollectionChangedAction.Add||t.action===wijmo_1.NotifyCollectionChangedAction.Change){t.item._attachOwner(this);if(t.action===wijmo_1.NotifyCollectionChangedAction.Add){this._addingSheet=!0;t.index<=this.selectedSheetIndex&&(this._selectedSheetIndex+=1)}else t.index===this.selectedSheetIndex&&this._copyFrom(t.item);this.selectedSheetIndex=t.index}else if(t.action===wijmo_1.NotifyCollectionChangedAction.Reset){for(var o=0;o<this.sheets.length;o++)this.sheets[o]._attachOwner(this);if(this.sheets.length>0){0===this.selectedSheetIndex&&this._copyFrom(this.selectedSheet);this.selectedSheetIndex=0}else{this.rows.clear();this.columns.clear();this._selectedSheetIndex=-1}}else if(this.sheets.length>0){if(this.selectedSheetIndex===t.index){this._selectedSheetIndex=-1;this.sheets._setCurrentIdx(-1);this.selectedSheetIndex=t.index>this.sheets.length-1?this.sheets.length-1:t.index}else if(this.selectedSheetIndex>t.index){this._selectedSheetIndex--;this.sheets._setCurrentIdx(this._selectedSheetIndex)}}else{this.rows.clear();this.columns.clear();this._selectedSheetIndex=-1}this._updateDivContainerHeight(this.isTabHolderVisible);this.endUpdate()}};FlexSheet.prototype._sheetVisibleChange=function(e,t){t.item.visible||this._loadingFromWorkbook||t.index===this.selectedSheetIndex&&(this.selectedSheetIndex===this.sheets.length-1?this.selectedSheetIndex=t.index-1:this.selectedSheetIndex=t.index+1)};FlexSheet.prototype._applyStyleForCell=function(e,t,o,i){void 0===i&&(i=!1);var n=this.rows[e];if(!(null==n||n instanceof HeaderRow||!n.isVisible&&!i)){var l,r=this.selectedSheet._styledCells,s=e*this.columns.length+t,a=this.selectedSheet._getMergedRange(e,t);a&&(l=a.topRow*this.columns.length+a.leftCol);Object.keys(o).forEach((function(i){var n=o[i];("className"===i&&"normal"===n||("fontStyle"===i||"fontWeight"===i||"textDecoration"===i)&&"none"===n)&&(n="");if(a){var h={top:e===a.topRow,bottom:e===a.bottomRow,left:t===a.leftCol,right:t===a.rightCol},u="border"===i||i.startsWith("borderTop")&&h.top||i.startsWith("borderBottom")&&h.bottom||i.startsWith("borderLeft")&&h.left||i.startsWith("borderRight")&&h.right;applyStyleImp(r,u?s:l,i,n)}else applyStyleImp(r,s,i,n)}))}};FlexSheet.prototype._checkCellFormat=function(e,t,o){var i,n,l=e*this.columns.length+t;if(this.selectedSheet){if(i=this.selectedSheet._getMergedRange(e,t)){o.isMergedCell=!0;l=i.topRow*this.columns.length+i.leftCol}if(n=this.selectedSheet._styledCells[l]){o.isBold=o.isBold||"bold"===n.fontWeight;o.isItalic=o.isItalic||"italic"===n.fontStyle;o.isUnderline=o.isUnderline||n.textDecoration&&n.textDecoration.indexOf("underline")>=0;o.isStrikethrough=o.isStrikethrough||n.textDecoration&&n.textDecoration.indexOf("line-through")>=0;o.verticalAlign=n.verticalAlign||"top"}e===this.selection.row&&t===this.selection.col&&(n&&n.textAlign?o.textAlign=n.textAlign:t>-1&&(o.textAlign=this.columns[t].getAlignment()||o.textAlign))}};FlexSheet.prototype._resetMergedRange=function(e){var t,o,i,n,l=!1;for(t=e.topRow;t<=e.bottomRow;t++)for(o=e.leftCol;o<=e.rightCol;o++)if(n=this.selectedSheet._getMergedRange(t,o)){l=!0;i=this.selectedSheet._mergedRanges.indexOf(n);this.selectedSheet._mergedRanges.splice(i,1)}return l};FlexSheet.prototype._updateCellsForUpdatingRow=function(e,t,o,i){var n,l,r,s,a,h,u,d=e*this.columns.length;if(i)for(l=n=t*this.columns.length;l<d;l++){r=l-o*this.columns.length;if(s=this.selectedSheet._styledCells[l]){l>=(t+o)*this.columns.length&&(this.selectedSheet._styledCells[r]=s);delete this.selectedSheet._styledCells[l]}}else{n=t*this.columns.length-1;for(l=d-1;l>n;l--){r=l+this.columns.length*o;if(s=this.selectedSheet._styledCells[l]){this.selectedSheet._styledCells[r]=s;delete this.selectedSheet._styledCells[l]}}}if(this.selectedSheet._mergedRanges.length>0)for(h=this.selectedSheet._mergedRanges.length-1;h>=0;h--){a=this.selectedSheet._mergedRanges[h];if(i)if((u=t+o-1)<a.topRow){a.row-=o;a.row2-=o}else if(u>=a.topRow&&u<=a.bottomRow)if(t<=a.topRow&&u>=a.bottomRow)this.selectedSheet._mergedRanges.splice(h,1);else if(t<a.topRow)if(a.row<=a.row2){a.row+=t-a.topRow;a.row2-=o}else{a.row2+=t-a.topRow;a.row-=o}else t===a.topRow&&o===a.rowSpan?this.selectedSheet._mergedRanges.splice(h,1):a.row<=a.row2?a.row2-=o:a.row-=o;else t<=a.topRow?this.selectedSheet._mergedRanges.splice(h,1):t<=a.bottomRow&&(a.row<=a.row2?a.row2+=t-a.bottomRow-1:a.row+=t-a.bottomRow-1);else if(t<=a.topRow){a.row+=o;a.row2+=o}else t>a.topRow&&t<=a.bottomRow&&(a.row<=a.row2?a.row2+=o:a.row+=o)}};FlexSheet.prototype._updateCellsForUpdatingColumn=function(e,t,o,i){var n,l,r,s,a,h,u,d=this.rows.length*e;if(i)for(n=t;n<d;n++){l=n-o*(Math.floor(n/e)+((s=n%e)>=t?1:0));if(r=this.selectedSheet._styledCells[n]){(s<t||s>=t+o)&&(this.selectedSheet._styledCells[l]=r);delete this.selectedSheet._styledCells[n]}}else for(n=d-1;n>=t;n--){l=Math.floor(n/e)*o+n+((s=n%e)>=t?o:0);if(r=this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[l]=r;delete this.selectedSheet._styledCells[n]}}if(this.selectedSheet._mergedRanges.length>0)for(h=this.selectedSheet._mergedRanges.length-1;h>=0;h--){a=this.selectedSheet._mergedRanges[h];if(i)if((u=t+o-1)<a.leftCol){a.col-=o;a.col2-=o}else if(u>=a.leftCol&&u<=a.rightCol)if(t<=a.leftCol&&u>=a.rightCol)this.selectedSheet._mergedRanges.splice(h,1);else if(t<a.leftCol)if(a.col<=a.col2){a.col+=t-a.leftCol;a.col2-=o}else{a.col2+=t-a.leftCol;a.col-=o}else t===a.leftCol&&o===a.columnSpan?this.selectedSheet._mergedRanges.splice(h,1):a.col<=a.col2?a.col2-=o:a.col-=o;else t<=a.leftCol?this.selectedSheet._mergedRanges.splice(h,1):t<=a.rightCol&&(a.col<=a.col2?a.col2-=a.rightCol-t+1:a.col-=a.rightCol-t+1);else if(t<=a.leftCol){a.col+=o;a.col2+=o}else t>a.leftCol&&t<=a.rightCol&&(a.col<=a.col2?a.col2+=o:a.col+=o)}};FlexSheet.prototype._cloneObject=function(e){var t;if(null==e||!wijmo_1.isObject(e))return e;t={};for(var o in e)e.hasOwnProperty(o)&&null!=e[o]&&(e[o].clone?t[o]=e[o].clone():t[o]=this._cloneObject(e[o]));return t};FlexSheet.prototype._evaluate=function(e,t,o,i,n){if(e&&e.length>1&&this._enableFormulas){e="="===e[0]?e:"="+e;var l=this._calcEngine.evaluate(e,t,o,i,n);wijmo_1.isPrimitive(l)?wijmo_1.isNumber(l)&&(l=this._calcEngine.round(l)):l&&wijmo_1.isNumber(l.value)&&(l.value=this._calcEngine.round(l.value));return l}return e};FlexSheet.prototype._clearAndCheckItemsOwner=function(e){if(e&&e.length){var t=e[0]._list;e.clear();this._checkCollectionOwner(t)}};FlexSheet.prototype._checkCollectionOwner=function(e,t){void 0===t&&(t=!0);if(e&&e.length&&(!e[0]._list||!t&&e[0]._list!=e))for(var o=0,i=e.length;o<i;o++)e[o]._setList(e)};FlexSheet.prototype._checkCollectionsOwner=function(){this._checkCollectionOwner(this.columns,!1);this._checkCollectionOwner(this.rows,!1);this._checkCollectionOwner(this.columnFooters.columns,!1);this._checkCollectionOwner(this.columnFooters.rows,!1);this._checkCollectionOwner(this.columnHeaders.columns,!1);this._checkCollectionOwner(this.columnHeaders.rows,!1);this._checkCollectionOwner(this.rowHeaders.columns,!1);this._checkCollectionOwner(this.rowHeaders.rows,!1)};FlexSheet.prototype._copyTo=function(e){var t,o=e.grid.autoGenerateColumns;this.beginUpdate();e._storeRowSettings();this._selHdl.extendedSelection.clear();t=this.selection.clone();e.grid.select(new wijmo_grid_1.CellRange,!1);this._clearAndCheckItemsOwner(e.grid.rows);this._clearAndCheckItemsOwner(e.grid.columns);this._clearAndCheckItemsOwner(e.grid.columnHeaders.columns);this._clearAndCheckItemsOwner(e.grid.rowHeaders.rows);e._ownerHeaderRowRemoved=this._headerRowRemoved;if(this.itemsSource){e.grid.autoGenerateColumns=!1;e.itemsSource=this.itemsSource;this.collectionView.sortDescriptions.length>0&&(e._dataView=this.collectionView._view.slice());e.grid.collectionView.beginUpdate()}else{e.itemsSource=null;for(var i=0;i<this.rows.length;i++)e.grid.rows.push(this.rows[i])}e._sortList=this.sortManager._committedList.slice();e._getFilterSetting();for(var n=0;n<this.columns.length;n++)e.grid.columns.push(this.columns[n]);if(e.grid.collectionView){this._resetMappedColumns(e.grid);e.grid.collectionView.endUpdate(!0)}e.grid.autoGenerateColumns=o;e.grid.rows._frozenInternal=this.rows._frozenInternal;e.grid.columns._frozenInternal=this.columns._frozenInternal;e.grid.allowAddNew=this.allowAddNew;null!=this.newRowAtTop&&(e.grid.newRowAtTop=this.newRowAtTop);e.grid.select(t,!1);e._scrollPosition=this.scrollPosition;this._setFlexSheetToDirty();this.endUpdate()};FlexSheet.prototype._copyFrom=function(e,t){var o=this;void 0===t&&(t=!0);var i,n=this.autoGenerateColumns;this._isCopying=!0;this._dragable=!1;t&&this.beginUpdate();this.itemsSource=null;this._clearAndCheckItemsOwner(this.rows);this._clearAndCheckItemsOwner(this.columns);this._clearAndCheckItemsOwner(this.columnHeaders.columns);this._clearAndCheckItemsOwner(this.rowHeaders.rows);i=e.grid.selection.clone();this._selHdl.select(new wijmo_grid_1.CellRange,!1);e.selectionRanges.length>1&&(this.selectionMode===wijmo_grid_1.SelectionMode.CellRange||this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange)&&(this._enableMulSel=!0);this._headerRowRemoved=e._ownerHeaderRowRemoved;if(e.itemsSource){this.autoGenerateColumns=!1;this._ignoreBindGrid=wijmo_1.isArray(e.itemsSource)||e.itemsSource instanceof wijmo_1.CollectionView;this.itemsSource=e.itemsSource;this._ignoreBindGrid=!1;this.collectionView.beginUpdate()}else for(var l=0;l<e.grid.rows.length;l++)this.rows.push(e.grid.rows[l]);for(var r=0;r<e.grid.columns.length;r++){var s=e.grid.columns[r];s.isRequired=!1;this.columns.push(s)}this.sortManager.sortDescriptions.sourceCollection=e._sortList.slice();this.sortManager._committedList=e._sortList.slice();if(this.collectionView){if(e.grid.collectionView){this.collectionView.sortDescriptions.clear();e.grid.collectionView.sortDescriptions.forEach((function(e){o.collectionView.sortDescriptions.push(e)}))}this.collectionView.moveCurrentToPosition(this._getCvIndex(i.row));this._resetMappedColumns(this);this.collectionView.endUpdate(!0);if(e._dataView){this.collectionView._view=e._dataView;this.collectionView._pgView=this.collectionView._getPageView();if(!(this.itemsSource instanceof wijmo_1.CollectionView)){e.grid.collectionView._view=e._dataView;e.grid.collectionView._pgView=e.grid.collectionView._getPageView()}this._bindGrid(!1);e.grid._bindGrid(!1)}this.collectionView.collectionChanged.addHandler((function(e,t){t.action===wijmo_1.NotifyCollectionChangedAction.Reset&&setTimeout((function(){o.invalidate()}),10)}),this)}if(this.rows.length&&this.columns.length){this._selHdl.select(i,!1);if(this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange){this._selHdl.extendedSelection.beginUpdate();for(var a=0;a<e.selectionRanges.length;a++)this.selection.equals(e.selectionRanges[a])||this._selHdl.extendedSelection.push(e.selectionRanges[a]);this._selHdl.extendedSelection.endUpdate()}}e._applyFilterSetting();for(l=0;l<this.rows.length;l++){var h=e._rowSettings[l];if(h){var u=this.rows[l],d=u instanceof HeaderRow;u.height=h.height;u.allowMerging=h.allowMerging;u.visible=h.visible;u instanceof wijmo_grid_1.GroupRow&&(u.isCollapsed=!!h.isCollapsed);u.isSelected=!!h.isSelected;u.isReadOnly=d||!!h.readOnly}}this.autoGenerateColumns=n;this.rows._frozenInternal=e.grid.rows._frozenInternal;this.columns._frozenInternal=e.grid.columns._frozenInternal;this._isCopying=!1;if(t){this.cells.hostElement.style.overflow="hidden";this._setFlexSheetToDirty();this.endUpdate();if(this._addingSheet){clearTimeout(this._toRefresh);this._toRefresh=setTimeout((function(){o._setFlexSheetToDirty();o.invalidate()}),wijmo_1.Control._REFRESH_INTERVAL);this._addingSheet=!1}}this._updateScrollPos=!0};FlexSheet.prototype.onUpdatedLayout=function(t){if(this._updateScrollPos){this.cells.hostElement.style.overflow="";this._updateScrollPos=!1;var o=this.selectedSheet;if(o){this.scrollPosition=o._scrollPosition;this._ptScrl=o._scrollPosition}}e.prototype.onUpdatedLayout.call(this,t)};FlexSheet.prototype._resetMappedColumns=function(e){var t,o,i=0;e._mappedColumns=null;if(e.collectionView){o=e.collectionView.sortDescriptions;for(;i<o.length;i++)if((t=e.columns.getColumn(o[i].property))&&t.dataMap){e._mappedColumns||(e._mappedColumns={});e._mappedColumns[t.binding]=t.dataMap}}};FlexSheet.prototype._loadFromWorkbook=function(e){var t=this;if(null!=e.sheets&&0!==e.sheets.length){this._loadingFromWorkbook=!0;this.beginUpdate();this.clear();this._reservedContent=e.reservedContent;if(e.colorThemes&&e.colorThemes.length>0)for(var o=0;o<this._colorThemes.length;o++)this._colorThemes[o]=e.colorThemes[o];o=0;for(var i=e.sheets.length;o<i;o++){this.addUnboundSheet("",0,0);var n=this.selectedSheet,l=n.grid;l.wj_sheetInfo={};var r=l.wj_sheetInfo;wijmo_grid_xlsx_1.FlexGridXlsxConverter.load(l,e,{sheetIndex:o,includeColumnHeaders:!1});n.name=r.name;n.visible=r.visible;n._styledCells=r.styledCells;if(r.mergedRanges){for(var s=0;s<r.mergedRanges.length;s++)n._mergedRanges[s]=r.mergedRanges[s];r.mergedRanges=n._mergedRanges}this._copyFrom(n);if(r.tables&&r.tables.length>0)for(var a=0;a<r.tables.length;a++)this._parseFromWorkbookTable(r.tables[a],n)}null!=e.activeWorksheet&&e.activeWorksheet>-1&&e.activeWorksheet<this.sheets.length?this.selectedSheetIndex=e.activeWorksheet:this.selectedSheetIndex=0;e.definedNames&&e.definedNames.forEach((function(e){t.definedNames.push(new DefinedName(t,e.name,e.value,e.sheetName))}));this.endUpdate();this._loadingFromWorkbook=!1;this.onLoaded()}};FlexSheet.prototype._saveToWorkbook=function(e){var t=this;if(0===this.sheets.length)throw"The flexsheet is empty.";for(var o=!(!e||!e.includeFormulaValues),i=e&&e.convertHtmlEntities,n=this._saveSheetToWorkbook(0,o,i),l=1;l<this.sheets.length;l++){var r=this._saveSheetToWorkbook(l,o,i);n._addWorkSheet(r.sheets[0],l)}n.sheets.forEach((function(e){e.rightToLeft=t.rightToLeft}));n.activeWorksheet=this.selectedSheetIndex;n.reservedContent=this._reservedContent;for(l=0;l<this.definedNames.length;l++){var s=this.definedNames[l],a=new mXlsx.DefinedName;a.name=s.name;a.value=s.value;a.sheetName=s.sheetName;n.definedNames.push(a)}var h=this._colorThemes;if(h&&h.length>0)for(l=0;l<h.length;l++)n.colorThemes[l]=h[l];return n};FlexSheet.prototype._saveSheetToWorkbook=function(e,t,o){var i=this,n=this.sheets[e],l=n.grid.wj_sheetInfo;t&&(l.evaluateFormula=function(e){return i.evaluate(e,null,n)});if(this.selectedSheetIndex===e){n._storeRowSettings();this._copyRowsToSelectedSheet()}n._setRowSettings();if(n.tables.length>0){l.tables=[];for(var r=0;r<n.tables.length;r++)l.tables.push(this._parseToWorkbookTable(n.tables[r]))}n.grid.groupSummaryPosition=this.groupSummaryPosition;var s=wijmo_grid_xlsx_1.FlexGridXlsxConverter.save(n.grid,{sheetName:n.name,sheetVisible:n.visible,includeColumnHeaders:!1,convertHtmlEntities:o});this._checkTableHeaderRow(n.tables,s);l.evaluateFormula=null;return s};FlexSheet.prototype._mouseDown=function(e){var t,o,i=window.navigator.userAgent,n=this.hitTest(e);this.selectedSheet&&(this.selectedSheet._scrollPosition=this.scrollPosition);n.cellType!==wijmo_grid_1.CellType.None&&(this._isClicking=!0);if(this._dragable){this._isDragging=!0;this.createDropzone(e);this.onDraggingRowColumn(new DraggingRowColumnEventArgs(this.selection.clone(),this._draggingRow,e.shiftKey));e.preventDefault()}else if("crosshair"!==this.hostElement.style.cursor||null!=this._fillingMarker){if(this.selectionMode===wijmo_grid_1.SelectionMode.CellRange||this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange){if(e.ctrlKey){if(!this._enableMulSel){this._enableMulSel=!0;0===this.selectedSheet.selectionRanges.length&&this.selectedSheet.selectionRanges.push(this.selection)}}else if(n.cellType!==wijmo_grid_1.CellType.None){if(this.selectedSheet)if(n.cellType===wijmo_grid_1.CellType.TopLeft){this.selectedSheet.selectionRanges.clear();this.selectedSheet._addSelection(new wijmo_grid_1.CellRange(0,0,this.rows.length-1,this.columns.length-1))}else if(3===e.which&&this._isCellSelected(n.row,n.col));else{var l=n.edgeRight&&n.getColumn().allowResizing,r=n.edgeBottom&&n.getRow().allowResizing;l||r||this.selectedSheet.selectionRanges.clear()}this._enableMulSel&&this.refresh(!1);this._enableMulSel=!1}}else{this._enableMulSel=!1;this.selectedSheet&&this.selectedSheet.selectionRanges.clear()}this._htDown=n;if(0!==this.rows.length&&0!==this.columns.length){i.match(/iPad/i)||i.match(/iPhone/i)||this._hideContextMenu();if(3!==e.which&&(this.selectionMode===wijmo_grid_1.SelectionMode.CellRange||this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange)&&(n.cellType===wijmo_grid_1.CellType.ColumnHeader||n.cellType===wijmo_grid_1.CellType.None)&&!(n.col>-1&&this.columns[n.col].isSelected)&&wijmo_1.hasClass(e.target,wijmo_grid_1.FlexGridClsNames.cell)&&!n.edgeRight){this._columnHeaderClicked=!0;o=this.itemsSource&&this.rows[0]&&!this.rows[0].isVisible?1:0;e.target.focus();if(e.shiftKey)this._multiSelectColumns(n);else{t=new wijmo_grid_1.CellRange(o,n.col,this.rows.length-1,n.col);if(3===e.which&&this.selection.contains(t))return;this.select(t)}this._eCt.children[o]&&this._eCt.children[o].children[n.col]&&this._eCt.children[o].children[n.col].focus()}}}else{this.finishEditing();this._fillingData=!0;this._fillingPoint=new wijmo_1.Point(e.clientX-this.scrollPosition.x,e.clientY-this.scrollPosition.y);this._fillingSource=this.selection.clone();this._fillingMarker=document.createElement("div");wijmo_1.setCss(this._fillingMarker,{position:"absolute",display:"none",border:"2px dashed"});this._root.appendChild(this._fillingMarker);this._fillingTooltip=new wijmo_1.Tooltip;e.preventDefault()}};FlexSheet.prototype._mouseMove=function(e){var t,o=this.hitTest(e),i=this.selection.clone(),n=this.rows.length,l=this.columns.length,r=this.hostElement.style.cursor;if(0!==this.rows.length&&0!==this.columns.length)if(this._isDragging){this.hostElement.style.cursor="move";this.updateDropzone(e)}else if(!this._isClicking&&o.edgeBottom&&o.edgeRight&&o.row===i.bottomRow&&o.col===i.rightCol&&this.allowAutoFill)this.hostElement.style.cursor="crosshair";else if(this._fillingData){this.hostElement.style.cursor="crosshair";this._showFillMarker(e)}else{"crosshair"!=r||o.edgeBottom&&o.edgeRight||(this.hostElement.style.cursor="default");t=this.itemsSource?0===i.topRow||1===i.topRow:0===i.topRow;if(!this._isClicking&&i&&o.cellType!==wijmo_grid_1.CellType.None&&!this.itemsSource&&!this.isReadOnly&&this._enableDragDrop&&(!this._filter||!this._filter._isEditorOpened())){this._draggingColumn=t&&i.bottomRow===n-1;this._draggingRow=0===i.leftCol&&i.rightCol===l-1;if(o.cellType===wijmo_grid_1.CellType.Cell){this._draggingColumn&&((o.col===i.leftCol-1||o.col===i.rightCol)&&o.edgeRight||o.row===n-1&&o.edgeBottom)&&(r="move");this._draggingRow&&!this._containsGroupRows(i)&&((o.row===i.topRow-1||o.row===i.bottomRow)&&o.edgeBottom||o.col===l-1&&o.edgeRight)&&(r="move")}else o.cellType===wijmo_grid_1.CellType.ColumnHeader?o.edgeBottom&&(this._draggingColumn&&o.col>=i.leftCol&&o.col<=i.rightCol||this._draggingRow&&0===i.topRow)&&(r="move"):o.cellType===wijmo_grid_1.CellType.RowHeader&&o.edgeRight&&(this._draggingColumn&&0===i.leftCol||this._draggingRow&&o.row>=i.topRow&&o.row<=i.bottomRow&&!this._containsGroupRows(i))&&(r="move");this._dragable="move"===r;this.hostElement.style.cursor=r}if(this._htDown&&this._htDown.panel){o=new wijmo_grid_1.HitTestInfo(this._htDown.panel,e);this._multiSelectColumns(o);o.cellType===wijmo_grid_1.CellType.Cell&&this.scrollIntoView(o.row,o.col)}}else{this._dragable=!1;o.cellType===wijmo_grid_1.CellType.Cell&&(this.hostElement.style.cursor="default")}};FlexSheet.prototype._mouseUp=function(e){var t=this;try{if(this._isDragging){if(this._dropRange&&!this._draggingCells.equals(this._dropRange)){var o=new DroppingRowColumnEventArgs(this._dropRange.clone(),this._draggingRow),i=new wijmo_1.CancelEventArgs;this.onBeginDroppingRowColumn(o);i.cancel=o.cancel;o.cancel||this._handleDropping(e);this.onEndDroppingRowColumn(i)}}else if(this._fillingData){var n=AutoFillOperation.CopyContent,l=this._fillingRange,r=this._fillingSource;this._orgCellSettings=null;if(this._fillingRange&&this._fillingRange.isValid){wijmo_1.assert(this._canDoFillOperation(),"To do this, all the merged cells need be the same size.");r.leftCol===l.leftCol&&r.rightCol===l.rightCol?r.row!==r.row2&&(n=AutoFillOperation.FillSeries):r.col!==r.col2&&(n=AutoFillOperation.FillSeries);this._orgCellSettings=this._getCellSettingsForFill();var s=new _FillAction(this,this._fillingSource);this._undoStack._addAction(s);n=AutoFillOperation.CopyFormat|n;if(this._fillData(n))var a=this._root.appendChild(document.createElement("div")),h=new _SmartTag(a,this,n,{operationSelected:function(e){t._fillData(e.operation)},cancelled:function(){a.parentElement.removeChild(a);h.dispose();h=null;s.saveNewState();t.focus()}})}}}finally{this._draggingSingleRow=!1;if(this._isDragging){this._draggingCells=null;this._dropRange=null;this.destroyDropzone(e);this._isDragging=!1;this._draggingColumn=!1;this._draggingRow=!1}if(this._htDown&&this._htDown.cellType!==wijmo_grid_1.CellType.None&&this.selectedSheet){this.selection.isValid&&this.selectedSheet._addSelection(this.selection);this._enableMulSel=!1}if(this._fillingData){this._fillingData=!1;this._fillingPoint=null;this._fillingRange=null;this._root.removeChild(this._fillingMarker);this._fillingMarker=null;this._fillingTooltip.hide();this._fillingTooltip=null;this.hostElement.style.cursor="default"}this._isClicking=!1;this._columnHeaderClicked=!1;this._htDown=null}};FlexSheet.prototype._click=function(){var e=this,t=window.navigator.userAgent;t.match(/iPad/i)||t.match(/iPhone/i)||this._hideContextMenu();setTimeout((function(){e.hideFunctionList()}),200)};FlexSheet.prototype._touchStart=function(e){var t=this;wijmo_1.hasClass(e.target,exports._ContextMenuClsNames.contextMenuItem)||this._hideContextMenu();this._longClickTimer=setTimeout((function(){var o;if(t._isDescendant(t._divContainer,e.target)&&(o=t.hitTest(e))&&o.cellType!==wijmo_grid_1.CellType.None&&!t._resizing){if(o.cellType===wijmo_grid_1.CellType.TopLeft){t.selection=new wijmo_grid_1.CellRange(0,0,t.rows.length-1,t.columns.length-1);if(t.selectedSheet){t.selectedSheet.selectionRanges.clear();t.selectedSheet.selectionRanges.push(t.selection)}}t._contextMenu.show(null,new wijmo_1.Point(e.pageX+10,e.pageY+10))}}),500)};FlexSheet.prototype._touchEnd=function(){clearTimeout(this._longClickTimer)};FlexSheet.prototype._keydown=function(e){if(!e.defaultPrevented){if((this._isDescendant(this.hostElement,e.target)||this.hostElement===e.target)&&!this._edtHdl.activeEditor&&!(e.target instanceof HTMLInputElement)&&this.selectedSheet&&(e.keyCode===wijmo_1.Key.Delete||e.keyCode===wijmo_1.Key.Back)){this._delSeletionContent(e);e.preventDefault()}var t=this._contextMenu.visible?this._contextMenu:this._tabHolder.sheetControl._contextMenu.visible?this._tabHolder.sheetControl._contextMenu:null;if(t){e.keyCode===wijmo_1.Key.Down&&t.moveToNext();e.keyCode===wijmo_1.Key.Up&&t.moveToPrev();e.keyCode===wijmo_1.Key.Home&&t.moveToFirst();e.keyCode===wijmo_1.Key.End&&t.moveToLast();e.keyCode===wijmo_1.Key.Enter&&t.handleContextMenu();e.preventDefault()}}};FlexSheet.prototype.createDropzone=function(e){var t=new wijmo_1.Tooltip({gap:0}),o=document.createElement("div");o.style.position="absolute";o.style.display="block";o.style.borderStyle="dotted";o.style.cursor="move";o.style.zIndex="1";o.style.opacity="0.5";this.dropzoneMarker=o;this._draggingTooltip=t;this._draggingCells=this.selection;this._root.appendChild(o);this.selectedSheet&&this.selectedSheet.selectionRanges.clear()};FlexSheet.prototype.updateDropzoneArea=function(e){var t=this._draggingColumn,o=this._root,i=this.dropzoneMarker,n={col:0,row:0};t?n.col=e.hit<this.dropzonePrevHit?e.start:e.end:n.row=e.hit<this.dropzonePrevHit?e.start:e.end;this.scrollIntoView(n.row,n.col);var l,r=t?{start:this.cells.getCellBoundingRect(0,e.start),hit:this.cells.getCellBoundingRect(0,e.hit),end:this.cells.getCellBoundingRect(0,e.end)}:{start:this.cells.getCellBoundingRect(e.start,0),hit:this.cells.getCellBoundingRect(e.hit,0),end:this.cells.getCellBoundingRect(e.end,0)},s={};if(t){l=FlexSheet.convertNumberToAlpha(e.start)+" : "+FlexSheet.convertNumberToAlpha(e.end);s={top:this._eCHdr.offsetHeight,left:o.scrollLeft,height:this.cells.height};r.hit.top=r.hit.bottom+o.scrollTop+8;if(this.rightToLeft){s.left=r.end.left-this.controlRect.left+o.scrollLeft;s.width=r.start.right-r.end.left}else{s.left+=r.start.left-this.controlRect.left;s.width=r.end.right-r.start.left}}else{l=e.start+1+" : "+(e.end+1);s={top:r.start.top-this.controlRect.top+o.scrollTop,width:this.cells.width,height:r.end.bottom-r.start.top};r.hit.top=r.hit.bottom;this.rightToLeft?s.right=this._eRHdr.offsetWidth:s.left=this._eRHdr.offsetWidth}if(this._dropRange)if(t){this._dropRange.col=e.start;this._dropRange.col2=e.end}else{this._dropRange.row=e.start;this._dropRange.row2=e.end}else this._dropRange=t?new wijmo_grid_1.CellRange(0,e.start,this.rows.length-1,e.end):new wijmo_grid_1.CellRange(e.start,0,e.end,this.columns.length-1);wijmo_1.setCss(i,s);this._draggingTooltip.show(this.hostElement,l,r.hit);this.dropzonePrevHit=e.hit};FlexSheet.prototype.updateDropzone=function(e){var t=this,o=new wijmo_grid_1.HitTestInfo(this.cells,e),i=this.rightToLeft,n=this._draggingColumn,l=n?o.col:o.row,r=this.dropzonePrevHit,s=this.selection,a=n?this.columns.length:this.rows.length;if(-1!==l&&l!==r){this.dropzone||(this.dropzone=n?{left:l-s.leftCol,right:s.rightCol-l}:{left:l-s.topRow,right:s.bottomRow-l});var h={start:l-this.dropzone.left,hit:l,end:l+this.dropzone.right};if(!(h.start<0||h.end>a-1)){var u,d=n?i?{start:this.cells.getCellBoundingRect(0,h.end),end:this.cells.getCellBoundingRect(0,h.start)}:{start:this.cells.getCellBoundingRect(0,h.start),end:this.cells.getCellBoundingRect(0,h.end)}:{start:this.cells.getCellBoundingRect(h.start,0),end:this.cells.getCellBoundingRect(h.end,0)},_={top:this.controlRect.top+this._eCHdr.offsetHeight,right:this.controlRect.right,bottom:this.controlRect.bottom,left:this.controlRect.left};if(n){i?_.right-=this._eRHdr.offsetWidth:_.left+=this._eRHdr.offsetWidth;(_.left>=d.start.right||_.right<=d.end.left)&&(u=!0)}else(_.top>=d.start.bottom||_.bottom<=d.end.top)&&(u=!0);clearTimeout(this.dropzoneTimeout);u?this.dropzoneTimeout=setTimeout((function(){t.updateDropzoneArea(h);t.updateDropzone(e)}),100):this.updateDropzoneArea(h)}}};FlexSheet.prototype.destroyDropzone=function(e){if(this.dropzoneMarker){this._root.removeChild(this.dropzoneMarker);this.dropzoneMarker=null}if(this.dropzoneTimeout){clearTimeout(this.dropzoneTimeout);this.dropzoneTimeout=null}if(this._draggingTooltip){this._draggingTooltip.hide();this._draggingTooltip=null}this.dropzone=null;this.dropzonePrevHit=-1};FlexSheet.prototype._showFillMarker=function(e){var t=new wijmo_grid_1.HitTestInfo(this.cells,e);if(t.row>-1&&t.col>-1){var o=e.clientX-this.scrollPosition.x-this._fillingPoint.x,i=e.clientY-this.scrollPosition.y-this._fillingPoint.y,n=void 0,l=void 0,r=void 0,s=void 0;if(Math.abs(o)>=Math.abs(i)){n=this._fillingSource.topRow;r=this._fillingSource.bottomRow;l=o>=0?this._fillingSource.leftCol:t.col;s=o>=0?t.col:this._fillingSource.rightCol}else{n=i>=0?this._fillingSource.topRow:t.row;r=i>=0?t.row:this._fillingSource.bottomRow;l=this._fillingSource.leftCol;s=this._fillingSource.rightCol}this._fillingRange=new wijmo_grid_1.CellRange(n,l,r,s);this._updateFillingMarquee();this.scrollIntoView(t.row,t.col);this._showFillTooltip()}};FlexSheet.prototype._updateMarquee=function(){e.prototype._updateMarquee.call(this);this._updateFillingMarquee()};FlexSheet.prototype._updateFillingMarquee=function(){var e=this._fillingMarker,t=this._fillingRange;if(e&&t){var o=this.cells.getCellBoundingRect(t.row,t.col,!0),i=this.cells.getCellBoundingRect(t.row2,t.col2,!0);if(this.rows._frozenInternal){var n=Math.min(this.rows.length,this.rows._frozenInternal),l=this.cells.getCellBoundingRect(n-1,0,!0);t.topRow>=n&&o.top<l.bottom&&(o.top=l.bottom);t.bottomRow>=n&&i.bottom<l.bottom&&(i.height=l.bottom-i.top)}if(this.columns._frozenInternal){var r=Math.min(this.columns.length,this.columns._frozenInternal);l=this.cells.getCellBoundingRect(0,r-1,!0);if(this.rightToLeft){t.leftCol>=r&&o.right>l.left&&(o.left=l.left-o.width);t.rightCol>=r&&i.left>l.left&&(i.left=l.left)}else{t.leftCol>=r&&o.left<l.right&&(o.left=l.right);t.rightCol>=r&&i.right<l.right&&(i.width=l.right-i.left)}}var s=this.cells.hostElement;wijmo_1.setCss(e,{left:o.left+s.offsetLeft,top:o.top+s.offsetTop,width:i.right-o.left,height:i.bottom-o.top,display:"",zIndex:this.rows._frozenInternal||this.columns._frozenInternal?"3":""})}};FlexSheet.prototype._showFillTooltip=function(){var e,t,o,i,n,l,r,s,a,h,u,d,_=this._fillingSource,c=this._fillingRange;this._fillingTooltip.hide();if(!c.equals(_)&&!_.contains(c)){if(t=_.leftCol===c.leftCol&&_.rightCol===c.rightCol){if(c.bottomRow>_.bottomRow){(e=this.cells.getCellBoundingRect(c.bottomRow,c.rightCol)).top=e.bottom+10;o=c.bottomRow-_.topRow}else{(e=this.cells.getCellBoundingRect(c.topRow,c.rightCol)).top+=10;o=c.topRow-_.topRow}e.left=e.right;(i=o%_.rowSpan)<0&&(i+=_.rowSpan);_.row===_.row2&&(n=!0);a=this.selectedSheet.getCellStyle(_.topRow+i,_.leftCol);h=this.getMergedRange(this.cells,_.topRow+i,_.leftCol);u=this.columns[_.leftCol];d=a&&a.format?a.format:u.format;if(n)s=_isFormula(s=this.getCellData(h?h.topRow:_.topRow+i,_.leftCol,!1))?"":wijmo_1.Globalize.format(s,d);else{l=this.getCellData(_.topRow+i,_.leftCol,!1);if(wijmo_1.isNumber(l)||wijmo_1.isDate(l))if(r=this._getFillSeries(t,0,i)){s=this._getFillData(i,o,_,t,r,!0);s=wijmo_1.Globalize.format(s,d)}else s="";else _isFormula(s=l)&&(s="")}}else{if(c.rightCol>_.rightCol){e=this.cells.getCellBoundingRect(c.bottomRow,c.rightCol);o=c.rightCol-_.leftCol}else{e=this.cells.getCellBoundingRect(c.bottomRow,c.leftCol);o=c.leftCol-_.leftCol}e.top=e.bottom+10;(i=o%_.columnSpan)<0&&(i+=_.columnSpan);_.col===_.col2&&(n=!0);a=this.selectedSheet.getCellStyle(_.topRow,_.leftCol+i);h=this.getMergedRange(this.cells,_.topRow,_.leftCol+i);u=this.columns[_.leftCol+i];d=a&&a.format?a.format:u.format;if(n)s=_isFormula(s=this.getCellData(_.topRow,h?h.leftCol:_.leftCol+i,!1))?"":wijmo_1.Globalize.format(s,d);else{l=this.getCellData(_.topRow,_.leftCol+i,!1);if(wijmo_1.isNumber(l)||wijmo_1.isDate(l))if(r=this._getFillSeries(t,0,i)){s=this._getFillData(i,o,_,t,r,!0);s=wijmo_1.Globalize.format(s,d)}else s="";else _isFormula(s=l)&&(s="")}}e.top+=this.cells.hostElement.offsetTop;this._fillingTooltip.show(this.hostElement,s,e)}};FlexSheet.prototype._selections=function(){var e=[];if(!this.selectedSheet)return e;if(this.selectionMode==wijmo_grid_1.SelectionMode.ListBox)for(var t=0,o=this.rows.length,i=this.columns.length-1;t<o;t++)this.rows[t].isSelected&&e.push(new wijmo_grid_1.CellRange(t,0,t,i));else e=this.selectedSheet.selectionRanges.slice();return e.length?e:[this.selection]};FlexSheet.prototype._isCellSelected=function(e,t){return this._selections().some((function(o){return o.contains(e,t)}))};FlexSheet.prototype._isColumnSelected=function(e){var t=this;return this._selections().some((function(o){return o.containsColumn(e)&&0===o.topRow&&o.bottomRow===t.rows.length-1}))};FlexSheet.prototype._isRowSelected=function(e){var t=this;return this._selections().some((function(o){return o.containsRow(e)&&0===o.leftCol&&o.rightCol===t.columns.length-1}))};FlexSheet.prototype._handleDropping=function(e){var t,o,i,n,l,r,s;if(this.selectedSheet&&this._draggingCells&&this._dropRange&&!this._containsMergedCells(this._draggingCells)&&!this._containsMergedCells(this._dropRange)){this._clearCalcEngine();if(this._draggingColumn&&this._draggingCells.leftCol>this._dropRange.leftCol||this._draggingRow&&this._draggingCells.topRow>this._dropRange.topRow)if(e.shiftKey){if(!this._allowExchangeCells(this._draggingRow,!0)){console.warn("Can not complete operation: You are attempting to change a position of table row or column in a way that is not allowed.");return}if(this._draggingColumn){n=this._dropRange.leftCol;for(o=this._draggingCells.leftCol;o<=this._draggingCells.rightCol;o++){this.columns.moveElement(o,n);n++}this._exchangeTableColumns(!0)}else if(this._draggingRow){i=this._dropRange.topRow;for(t=this._draggingCells.topRow;t<=this._draggingCells.bottomRow;t++){this.rows.moveElement(t,i);i++}}this._exchangeCellStyle(!0)}else{this.undoStack.stackSize>0&&(l=new _MoveCellsAction(this,this._draggingCells,this._dropRange,e.ctrlKey));i=this._dropRange.topRow;for(t=this._draggingCells.topRow;t<=this._draggingCells.bottomRow;t++){n=this._dropRange.leftCol;for(o=this._draggingCells.leftCol;o<=this._draggingCells.rightCol;o++){this._moveCellContent(t,o,i,n,e.ctrlKey);if(this._draggingColumn&&i===this._dropRange.topRow){this.columns[n].dataType=this.columns[o].dataType?this.columns[o].dataType:wijmo_1.DataType.Object;this.columns[n].align=this.columns[o].align;this.columns[n].format=this.columns[o].format;if(!e.ctrlKey){this.columns[o].dataType=wijmo_1.DataType.Object;this.columns[o].align=null;this.columns[o].format=null}}n++}i++}if(this._draggingColumn&&!e.ctrlKey){n=this._dropRange.leftCol;for(o=this._draggingCells.leftCol;o<=this._draggingCells.rightCol;o++){this._updateColumnFiler(o,n);n++}}}else if(this._draggingColumn&&this._draggingCells.leftCol<this._dropRange.leftCol||this._draggingRow&&this._draggingCells.topRow<this._dropRange.topRow)if(e.shiftKey){if(!this._allowExchangeCells(this._draggingRow,!1)){console.warn("Can not complete operation: You are attempting to change a position of table row or column in a way that is not allowed.");return}if(this._draggingColumn){n=this._dropRange.rightCol;for(o=this._draggingCells.rightCol;o>=this._draggingCells.leftCol;o--){this.columns.moveElement(o,n);n--}this._exchangeTableColumns(!1)}else if(this._draggingRow){i=this._dropRange.bottomRow;for(t=this._draggingCells.bottomRow;t>=this._draggingCells.topRow;t--){this.rows.moveElement(t,i);i--}}this._exchangeCellStyle(!1)}else{this.undoStack.stackSize>0&&(l=new _MoveCellsAction(this,this._draggingCells,this._dropRange,e.ctrlKey));i=this._dropRange.bottomRow;for(t=this._draggingCells.bottomRow;t>=this._draggingCells.topRow;t--){n=this._dropRange.rightCol;for(o=this._draggingCells.rightCol;o>=this._draggingCells.leftCol;o--){this._moveCellContent(t,o,i,n,e.ctrlKey);if(this._draggingColumn&&i===this._dropRange.bottomRow){this.columns[n].dataType=this.columns[o].dataType?this.columns[o].dataType:wijmo_1.DataType.Object;this.columns[n].align=this.columns[o].align;this.columns[n].format=this.columns[o].format;if(!e.ctrlKey){this.columns[o].dataType=wijmo_1.DataType.Object;this.columns[o].align=null;this.columns[o].format=null}}n--}i--}if(this._draggingColumn&&!e.ctrlKey){n=this._dropRange.rightCol;for(o=this._draggingCells.rightCol;o>=this._draggingCells.leftCol;o--){this._updateColumnFiler(o,n);n--}}}if(!e.ctrlKey){r=this._updateFormulaForDropping(e.shiftKey);s=this._updateNamedRangesForDropping(e.shiftKey)}if(l&&l.saveNewState()){l._affectedFormulas=r;l._affectedDefinedNameVals=s;this._undoStack._addAction(l)}if(this._undoStack._pendingAction){this._undoStack._pendingAction._affectedFormulas=r;this._undoStack._pendingAction._affectedDefinedNameVals=s}this.select(this._dropRange);this.selectedSheet._addSelection(this.selection);this.hostElement.focus()}};FlexSheet.prototype._moveCellContent=function(e,t,o,i,n){var l,r=this.getCellData(e,t,!1),s=e*this.columns.length+t,a=o*this.columns.length+i,h=this.selectedSheet._styledCells[s],u=!0,d=this.selectedSheet.findTable(o,i);if(d&&d._isHeaderRow(o)){var _=d.getRange(),c=d.getColumns(),g=i-_.leftCol;l=c[g].name;null==r||""===r?u=!1:c[g].name=""+r}if(u){if(n&&_isFormula(r)&&a-s!=0)try{var f=this._calcEngine.parse(r);f._moveCellRangeExp(this.selectedSheetIndex,new wijmo_grid_1.CellRange(e,t),new wijmo_grid_1.CellRange(o,i),!1,!0)&&(r="="+f._getStringExpression())}catch(e){}this.setCellData(o,i,r)}else u=!0;h?this.selectedSheet._styledCells[a]=this._cloneObject(h):delete this.selectedSheet._styledCells[a];if(n){if(p=this.selectedSheet.findTable(e,t)){m=p._getTableRange();if(p===d&&e===o&&p._isHeaderRow(e)){w=t-m.leftCol;p._updateColumnName(w,r)}}}else{delete this.selectedSheet._styledCells[s];var p;if(p=this.selectedSheet.findTable(e,t)){var m=p._getTableRange();if(p===d&&e===o&&p._isHeaderRow(e)){var w=t-m.leftCol;p._updateColumnName(w,l);return}if(p.showHeaderRow&&e===m.topRow)return}this.setCellData(e,t,null)}};FlexSheet.prototype._allowExchangeCells=function(e,t){for(var o=this.selectedSheet.tables,i=0;i<o.length;i++){var n=o[i],l=void 0,r=void 0,s=void 0;if(e){l=n.getRange(TableSection.Data);r=new wijmo_grid_1.CellRange(this._draggingCells.topRow,l.leftCol,this._draggingCells.bottomRow,l.rightCol);s=new wijmo_grid_1.CellRange(this._dropRange.topRow,l.leftCol,this._dropRange.bottomRow,l.rightCol)}else{l=n.getRange();r=new wijmo_grid_1.CellRange(l.topRow,this._draggingCells.leftCol,l.bottomRow,this._draggingCells.rightCol);s=new wijmo_grid_1.CellRange(l.topRow,this._dropRange.leftCol,l.bottomRow,this._dropRange.rightCol)}if(l.intersects(r)&&!l.contains(r)||l.intersects(s)&&!l.contains(s)||l.contains(r)&&!l.contains(s)||!l.contains(r)&&l.contains(s))return!1}return!0};FlexSheet.prototype._exchangeTableColumns=function(e){for(var t=this.selectedSheet.tables,o=0;o<t.length;o++){var i=t[o],n=i.getRange();if(n.leftCol<=this._draggingCells.leftCol&&n.rightCol>=this._draggingCells.rightCol)for(var l=(e?this._draggingCells.leftCol:this._draggingCells.rightCol)-n.leftCol,r=(e?this._dropRange.leftCol:this._dropRange.rightCol)-n.leftCol,s=0;s<this._draggingCells.columnSpan;s++){i._moveColumns(l,r);if(e){l++;r++}else{l--;r--}}}};FlexSheet.prototype._exchangeCellStyle=function(e){for(var t=[],o=this._draggingCells.topRow;o<=this._draggingCells.bottomRow;o++)for(var i=this._draggingCells.leftCol;i<=this._draggingCells.rightCol;i++){var n=o*this.columns.length+i;if(this.selectedSheet._styledCells[n]){t.push(this._cloneObject(this.selectedSheet._styledCells[n]));delete this.selectedSheet._styledCells[n]}else t.push(void 0)}if(e){if(this._draggingColumn){var l=this._draggingCells.rightCol-this._draggingCells.leftCol+1;for(i=this._draggingCells.leftCol-1;i>=this._dropRange.leftCol;i--)for(o=0;o<this.rows.length;o++){n=o*this.columns.length+i;var r=o*this.columns.length+i+l;if(this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[r]=this._cloneObject(this.selectedSheet._styledCells[n]);delete this.selectedSheet._styledCells[n]}else delete this.selectedSheet._styledCells[r]}}else if(this._draggingRow)for(l=this._draggingCells.bottomRow-this._draggingCells.topRow+1,o=this._draggingCells.topRow-1;o>=this._dropRange.topRow;o--)for(i=0;i<this.columns.length;i++){n=o*this.columns.length+i,r=(o+l)*this.columns.length+i;if(this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[r]=this._cloneObject(this.selectedSheet._styledCells[n]);delete this.selectedSheet._styledCells[n]}else delete this.selectedSheet._styledCells[r]}}else if(this._draggingColumn)for(l=this._draggingCells.rightCol-this._draggingCells.leftCol+1,i=this._draggingCells.rightCol+1;i<=this._dropRange.rightCol;i++)for(o=0;o<this.rows.length;o++){n=o*this.columns.length+i,r=o*this.columns.length+i-l;if(this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[r]=this._cloneObject(this.selectedSheet._styledCells[n]);delete this.selectedSheet._styledCells[n]}else delete this.selectedSheet._styledCells[r]}else if(this._draggingRow)for(l=this._draggingCells.bottomRow-this._draggingCells.topRow+1,o=this._draggingCells.bottomRow+1;o<=this._dropRange.bottomRow;o++)for(i=0;i<this.columns.length;i++){n=o*this.columns.length+i,r=(o-l)*this.columns.length+i;if(this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[r]=this._cloneObject(this.selectedSheet._styledCells[n]);delete this.selectedSheet._styledCells[n]}else delete this.selectedSheet._styledCells[r]}o=this._dropRange.topRow;for(var s=0;o<=this._dropRange.bottomRow;o++)for(i=this._dropRange.leftCol;i<=this._dropRange.rightCol;i++){n=o*this.columns.length+i;t[s]?this.selectedSheet._styledCells[n]=t[s]:delete this.selectedSheet._styledCells[n];s++}};FlexSheet.prototype._containsMergedCells=function(e,t){if(!(t=t||this.selectedSheet))return!1;for(var o=0;o<t._mergedRanges.length;o++){var i=t._mergedRanges[o];if(e.intersects(i))return!0}return!1};FlexSheet.prototype._multiSelectColumns=function(e){if(e&&this._columnHeaderClicked){var t=e.col;t<0&&this.selection.col2>-1&&(t=this.selection.col);var o=new wijmo_grid_1.CellRange(e.row,t);o.row=this.itemsSource&&this.rows[0]&&!this.rows[0].isVisible?1:0;o.row2=this.rows.length-1;o.col2=this.selection.col2;this.select(o)}};FlexSheet.prototype._cumulativeOffset=function(e){var t=0,o=0;do{t+=e.offsetTop||0;o+=e.offsetLeft||0;e=e.offsetParent}while(e);return new wijmo_1.Point(o,t)};FlexSheet.prototype._cumulativeScrollOffset=function(e){var t=0,o=0;do{t+=e.scrollTop||0;o+=e.scrollLeft||0;e=e.offsetParent}while(e&&!(e instanceof HTMLBodyElement));t+=document.body.scrollTop||document.documentElement.scrollTop;o+=document.body.scrollLeft||document.documentElement.scrollLeft;return new wijmo_1.Point(o,t)};FlexSheet.prototype._checkHitWithinSelection=function(e){if(null!=e&&e.cellType===wijmo_grid_1.CellType.Cell){var t=this.getMergedRange(this.cells,e.row,e.col);if(t&&t.contains(this.selection))return!0;if(this.selection.row===e.row&&this.selection.col===e.col)return!0}return!1};FlexSheet.prototype._clearForEmptySheet=function(e){if(this.selectedSheet&&0===this[e].length&&!0!==this._isCopying&&!0!==this._isUndoing&&!0!==this._isSorting){this.selectedSheet._mergedRanges.length=0;this.selectedSheet._styledCells=null;this._isDeletingRows||this.select(new wijmo_grid_1.CellRange)}};FlexSheet.prototype._containsGroupRows=function(e){for(var t=e.topRow;t<=e.bottomRow;t++){if(this.rows[t]instanceof wijmo_grid_1.GroupRow)return!0}return!1};FlexSheet.prototype._delSeletionContent=function(e){if(!this.isReadOnly)if(this.allowDelete&&this.selection.isValid&&0===this.selection.leftCol&&this.selection.rightCol===this.columns.length-1)this.deleteRows(this._selections());else{var t,o=this.editableCollectionView,i=!1,n=!1,l=this.scrollPosition;this.beginUpdate();var r=new _EditAction(this);this.undoStack.stackSize>0&&(r=new _EditAction(this));for(var s=this._selections(),a=0;a<s.length;a++){t=s[a];var h=new wijmo_grid_1.CellRange,u=new wijmo_grid_1.CellEditEndingEventArgs(this.cells,h,e),d=this.selectedSheet.tables.length;if(d>0)for(var _=d-1;_>=0;_--){var c=this.selectedSheet.tables[_];if(t.contains(c.getRange())){r&&r._storeDeletedTables(c);this.selectedSheet.tables.remove(c)}}this._imeHdl&&this._imeHdl._suspendIME();for(var g=t.topRow;g<=t.bottomRow;g++){var f=this.rows[g];if(f&&!f.isReadOnly&&(f.visible||this.selectedSheet._freezeHiddenRows&&this.selectedSheet._freezeHiddenRows[g]))for(var p=t.leftCol;p<=t.rightCol;p++){var m=this._getBindingColumn(this.cells,g,this.columns[p]);if(m&&!m.isReadOnly&&(!1===m.isRequired||null==m.isRequired&&m.dataType==wijmo_1.DataType.String)&&(m.visible||this.selectedSheet._freezeHiddenCols&&this.selectedSheet._freezeHiddenCols[p])){var w=this.getCellData(g,p,!1);if(null!=w){h.setRange(g,p);u.cancel=!1;u.previousData=w;if(this.onBeginningEdit(u)){if(o){if(!i){i=!0;o.beginUpdate()}o.editItem(f.dataItem);this._edtHdl._edItem=o.currentEditItem}this.setCellData(g,p,void 0,!1);n=!0;this.onCellEditEnding(u);this.onCellEditEnded(u)}}}}}this._imeHdl&&this._imeHdl._resumeIME();if(i){o.endUpdate(!0);o._pendingRefresh=!1;t.rowSpan>1&&o.commitEdit()}}if(n&&r){r.saveNewState();this._undoStack._addAction(r)}this.selection=t;this.scrollPosition=l;this.endUpdate()}};FlexSheet.prototype._updateAffectedFormula=function(e,t,o,i,n){var l=[],r=[],s=this.selection.clone();this.selectedSheet._storeRowSettings();this.beginUpdate();for(var a=0;a<this.sheets.length;a++)for(var h=this.sheets[a],u=h.grid,d=u.rows.length,_=u.columns.length,c=0;c<d;c++){var g=u._getRowData(c);if(!(null==g||g.length<_))for(var f=0;f<_;f++){var p=g[f];if(_isFormula(p)){var m=this._updateCellRef(p,a,e,t,o,i,n);if(m){l.push({sheet:h,point:new wijmo_1.Point(c,f),formula:p});var w=c,C=f;if(a===this.selectedSheetIndex){i?c>=e&&(o?w+=t:w-=t):f>=e&&(o?C+=t:C-=t);if(!o&&(i&&c<=e&&c>=e-t+1||!i&&f<=e&&f>=e-t+1))continue}u.setCellData(c,f,m,!1);r.push({sheet:h,point:new wijmo_1.Point(w,C),formula:m})}}}}this.select(s,!1);this.endUpdate();return{oldFormulas:l,newFormulas:r}};FlexSheet.prototype._updateAffectedNamedRanges=function(e,t,o,i){for(var n=this,l=[],r=[],s=[],a=0;a<this.definedNames.length;a++){var h=this.definedNames[a],u=h.value;if(u&&wijmo_1.isString(u)){var d=this._updateCellRef(u,this.selectedSheetIndex,e,t,o,i);if("object"==typeof d&&null!==d)s.push(d.name);else if(d){l.push({name:h.name,value:u});h.value=d;r.push({name:h.name,value:d})}}}s.forEach((function(e){n.definedNames.remove(n.definedNames.find((function(t){return t.name==e})))}));return{oldDefinedNameVals:l,newDefinedNameVals:r}};FlexSheet.prototype._updateFormulaBoundaryForEditingCell=function(e,t){var o=[],i=[];this.beginUpdate();for(var n=e;n<this.rows.length;n++){if(_isFormula(r=this.getCellData(n,t,!1))){if(s=this._updateCellBoundary(r,e,t)){o.push({point:new wijmo_1.Point(n,t),formula:r});this.setCellData(n,t,s,!1);i.push({point:new wijmo_1.Point(n,t),formula:s})}}}for(var l=t;l<this.columns.length;l++){var r;if(_isFormula(r=this.getCellData(e,l,!1))){var s;if(s=this._updateCellBoundary(r,e,t)){o.push({point:new wijmo_1.Point(e,l),formula:r});this.setCellData(e,l,s,!1);i.push({point:new wijmo_1.Point(e,l),formula:s})}}}this.endUpdate();return{oldFormulas:o,newFormulas:i}};FlexSheet.prototype._updateColumnFiler=function(e,t){for(var o=JSON.parse(this._filter.filterDefinition),i=0;i<o.filters.length;i++){var n=o.filters[i];if(n.columnIndex===e){n.columnIndex=t;break}}this._filter.filterDefinition=JSON.stringify(o)};FlexSheet.prototype._isDescendant=function(e,t){for(var o=t.parentNode;null!=o;){if(o===e)return!0;o=o.parentNode}return!1};FlexSheet.prototype._clearCalcEngine=function(){this._calcEngine.clearExpressionCache()};FlexSheet.prototype._getRangeString=function(e,t,o){void 0===o&&(o=!0);var i,n,l,r,s,a,h="",u=!0,d=t&&t!==this.selectedSheet?t.grid:this;if(wijmo_1.isArray(e))if(e.length>1){if(this._isMultipleRowsSelected(e,t)){h="";for(n=0;n<e.length;n++){h&&(h+="\n");h+=this._getRangeString(e[n],t)}return h}if(!this._isMultipleColumnsSelected(e,t))return"";h="";for(i=0,u=!0;i<d.rows.length;i++){u||(h+="\n");u=!1;for(n=0,l=!0;n<e.length;n++){(r=e[n].clone()).row=r.row2=i;l||(h+="\t");l=!1;h+=this._getRangeString(e[n],t)}return h}}else{a=e[0];switch(this.selectionMode){case wijmo_grid_1.SelectionMode.Row:case wijmo_grid_1.SelectionMode.RowRange:a.col=0;a.col2=t.grid.columns.length-1;break;case wijmo_grid_1.SelectionMode.ListBox:a.col=0;a.col2=t.grid.columns.length-1;for(var _=0;_<t.grid.rows.length;_++)if(t.grid.rows[_].isSelected&&t.grid.rows[_].isVisible){a.row=a.row2=_;h&&(h+="\n");h+=this._getRangeString(a,t)}return h}}for(var c=(a=wijmo_1.asType(wijmo_1.isArray(e)?e[0]:e,wijmo_grid_1.CellRange)).topRow;c<=a.bottomRow;c++)if(d.rows[c]&&d.rows[c].isVisible){u||(h+="\n");u=!1;for(var g=a.leftCol,f=!0;g<=a.rightCol;g++)if(d.columns[g]&&d.columns[g].isVisible){f||(h+="\t");f=!1;var p=this._getCellStyle(c,g,t),m=p?p.format:"",w=d.columns[g];if(o){_isFormula(s=d.getCellData(c,g,!1))&&(s=this._evaluate(s,null,t,c,g));s=this._formatEvaluatedResult(s,w,m)}else{s=d.getCellData(c,g,!1);wijmo_1.isDate(s)&&(s=wijmo_1.Globalize.format(s,m||w.format));w.dataMap&&(s=w.dataMap.getDisplayValue(s))}(s=(s=null==s?"":s.toString()).replace(/\t/g," ")).indexOf("\n")>-1&&(s='"'+s.replace(/"/g,'""')+'"');h+=s}}return h};FlexSheet.prototype._getSelectionForListBoxMode=function(e){for(var t,o=0;o<e.rows.length;o++)e.rows[o].isSelected&&(t?t.row2=o:t=new wijmo_grid_1.CellRange(o,0,o,e.columns.length-1));return t};FlexSheet.prototype._containsRandFormula=function(e,t){for(var o=0;o<e.length;o++)for(var i=e[o],n=i.topRow;n<=i.bottomRow&&n<t.grid.rows.length;n++)for(var l=i.leftCol;l<=i.rightCol&&l<t.grid.columns.length;l++){var r=t.grid.getCellData(n,l,!1);if(_isFormula(r)&&-1!==r.search(/rand/i))return!0}return!1};FlexSheet.prototype._isMultipleRowsSelected=function(e,t){var o,i,n;e&&e.length>1?n=e:this.selectedSheet.selectionRanges.length>1&&(n=this.selectedSheet.selectionRanges);o=n[0];for(var l=1;l<n.length;l++)if((i=n[l]).leftCol!==o.leftCol||i.rightCol!==o.rightCol)return!1;return!0};FlexSheet.prototype._isMultipleColumnsSelected=function(e,t){var o,i,n;e&&e.length>1?n=e:this.selectedSheet.selectionRanges.length>1&&(n=this.selectedSheet.selectionRanges);o=n[0];for(var l=0;l<n.length;l++)if((i=n[l]).topRow!==o.topRow||i.bottomRow!==o.bottomRow)return!1;return!0};FlexSheet.prototype._postSetClipStringProcess=function(e,t,o,i,n,l,r,s,a){var h,u,d=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(o+n,i),t);if(this.onPastingCell(d)){if(l>=0&&r>=0&&this._copiedSheet&&(h=this._copiedSheet._getMergedRange(l,r))&&h.topRow===l&&h.leftCol===r){var _=o+h.rowSpan-1;_=_<this.rows.length?_:this.rows.length-1;var c=i+h.columnSpan-1;c=c<this.columns.length?c:this.columns.length-1;for(var g=new wijmo_grid_1.CellRange(o,i,_,c),f=g.topRow;f<=g.bottomRow;f++)for(var p=g.leftCol;p<=g.rightCol;p++){var m=this.getMergedRange(this.cells,f,p);if(null!=m&&!m.equals(g)){console.error("We can't paste the merged cell to another merged cell.");return!1}}this.mergeRange(new wijmo_grid_1.CellRange(o,i,_,c),!0)}s&&s.editItem(e);if(u=this.cells.setCellData(o,i,a&&a.format?new _ValWithFormat(d.data,a.format):d.data)){if(wijmo_1.isString(d.data)&&"\n"!==d.data){var w=d.data.match(/\n/g);w&&w.length>0&&(a?a.whiteSpace="pre":a={whiteSpace:"pre"})}var C=o*this.columns.length+i;this.selectedSheet._styledCells[C]=a?this._cloneObject(a):void 0;this.onPastedCell(d)}}return u};FlexSheet.prototype._delCutData=function(e,t){for(var o,i=this._copiedSheet===this.selectedSheet?this:this._copiedSheet.grid,n=this.selection,l=(o=this.selectionMode===wijmo_grid_1.SelectionMode.ListBox?this._getSelectionForListBoxMode(i):this._copiedRanges[0]).topRow;l<=o.bottomRow;l++)if(null!=i.rows[l]&&!i.rows[l].isReadOnly)for(var r=o.leftCol;r<=o.rightCol;r++)if(this._copiedSheet!==this.selectedSheet||l<n.topRow||l>n.topRow+e-1||r<n.leftCol||r>n.leftCol+t-1||i.rows[n.topRow]instanceof wijmo_grid_1._NewRowTemplate){var s=i._getBindingColumn(i.cells,l,i.columns[r]);s.isReadOnly||0!=s.isRequired&&(null!=s.isRequired||s.dataType!=wijmo_1.DataType.String)||i.getCellData(l,r,!0)&&(s.dataMap||i.rows[l].dataMap?i.setCellData(l,r,null,!0):i.setCellData(l,r,"",!0))}};FlexSheet.prototype._containsMultiLineText=function(e){for(var t=0;t<e.length;t++)for(var o=e[t],i=0;i<o.length;i++)if(o[i].indexOf("\n")>0)return!0;return!1};FlexSheet.prototype._sortByRow=function(e,t){return e.topRow>t.topRow?1:e.topRow<t.topRow?-1:0};FlexSheet.prototype._sortByColumn=function(e,t){return e.leftCol>t.leftCol?1:e.leftCol<t.leftCol?-1:0};FlexSheet.prototype._setFlexSheetToDirty=function(){this.columns._dirty=!0;this.rows._dirty=!0;this.rowHeaders.columns._dirty=!0;this.rowHeaders.rows._dirty=!0;this.columnHeaders.columns._dirty=!0;this.columnHeaders.rows._dirty=!0};FlexSheet.convertNumberToAlpha=function(e){var t,o,i="";if(e>=0)do{t=Math.floor(e/26);o=e%26;i=String.fromCharCode(o+65)+i;e=t-1}while(t);return i};FlexSheet.prototype._updateFormulaForReorderingRows=function(e,t,o){void 0===o&&(o=!1);var i,n,l=o?e-t:t-e;this.beginUpdate();for(var r=0;r<this.columns.length;r++)if(_isFormula(i=this.getCellData(t,r,!1))&&0!==l){try{n=this._calcEngine.parse(i)}catch(e){continue}n._updateCellRangeExpForReorderingRows(l)&&this.setCellData(t,r,"="+n._getStringExpression())}this.endUpdate()};FlexSheet.prototype._updateFormulaForDropping=function(e){var t,o,i,n,l,r,s,a,h,u=[],d=[];this.beginUpdate();for(i=0;i<this.sheets.length;i++){o=(t=this.sheets[i]).grid;for(n=0;n<o.rows.length;n++)for(r=0;r<o.columns.length;r++)if(_isFormula(a=o.getCellData(n,r,!1))&&(h=this._updateCellRefForDropping(a,i,e))){o.setCellData(n,r,h,!1);if(e&&i===this.selectedSheetIndex){l=o.rows[n];s=o.columns[r];u.push({sheet:t,row:l,column:s,formula:a});d.push({sheet:t,row:l,column:s,formula:h})}else{u.push({sheet:t,point:new wijmo_1.Point(n,r),formula:a});d.push({sheet:t,point:new wijmo_1.Point(n,r),formula:h})}}}this.endUpdate();return{oldFormulas:u,newFormulas:d}};FlexSheet.prototype._updateNamedRangesForDropping=function(e){var t,o,i,n,l=[],r=[];for(t=0;t<this.definedNames.length;t++)if((i=(o=this.definedNames[t]).value)&&wijmo_1.isString(i)&&(n=this._updateCellRefForDropping(i,this.selectedSheetIndex,e))){l.push({name:o.name,value:i});o.value=n;r.push({name:o.name,value:n})}return{oldDefinedNameVals:l,newDefinedNameVals:r}};FlexSheet.prototype._updateCellRefForDropping=function(e,t,o){void 0===o&&(o=!1);var i;try{i=this._calcEngine.parse(e)}catch(e){return null}return i._moveCellRangeExp(t,this._draggingCells,this._dropRange,o)?"="+i._getStringExpression():null};FlexSheet.prototype._updateCellStyleForReorderingRows=function(e,t,o){var i,n,l=this.columns.length;for(i=0;i<l;i++)(n=this._getCellStyle(e,i))&&(o[t*l+i]=n)};FlexSheet.prototype._scanFormulas=function(){for(var e=[],t=0;t<this.rows.length;t++)for(var o=0;o<this.columns.length;o++){var i=this.getCellData(t,o,!1);_isFormula(i)&&e.push({row:t,column:o,formula:i})}return e};FlexSheet.prototype._resetFormulas=function(e){var t=this;e&&this.deferUpdate((function(){for(var o=0;o<e.length;o++){var i=e[o];t.setCellData(i.row,i.column,i.formula)}}))};FlexSheet.prototype._getCellStyle=function(e,t,o){var i=o||this.selectedSheet;return i?i.getCellStyle(e,t):null};FlexSheet.prototype._getSheet=function(e){if(null==e)return null;e=e.toLowerCase();for(var t=0;t<this.sheets.length;t++){var o=this.sheets[t];if(o.name.toLowerCase()===e)return o}return null};FlexSheet.prototype._validateSheetName=function(e){return!!this._getSheet(e)};FlexSheet.prototype._sheetNameChanged=function(e,t){if(!this._loadingFromWorkbook){this.definedNames._updateSheetName(e,t);this._updateFormulasWithNameUpdating(e,t)}};FlexSheet.prototype._updateFormulasTableColumn=function(e,t,o,i){if(o!==i){this.beginUpdate();for(var n=new RegExp(e.name+"\\["+o+"\\]","g"),l=e.name+"["+i+"]",r=new RegExp("\\["+o+"\\]","g"),s="["+o+"]",a="["+i+"]",h=0;h<this.sheets.length;h++)for(var u=this.sheets[h],d=u.grid,_=0;_<d.rows.length;_++)for(var c=0;c<d.columns.length;c++){var g=d.getCellData(_,c,!1);if(_isFormula(g)&&g.indexOf("[")>=0){if((g=g.replace(n,l)).indexOf(s)>=0){var f=u.findTable(_,c);f&&f.name===e.name&&(g=g.replace(r,a))}d.setCellData(_,c,g,!1)}}e._updateColumnName(t-e._getTableRange().leftCol,i,!1);this.endUpdate()}};FlexSheet.prototype._updateFormulasWithNameUpdating=function(e,t,o){void 0===o&&(o=!1);if(this.sheets.length){var i=o?/\[/:/\w/,n=this.selection.clone();this.selectedSheet._storeRowSettings();this.beginUpdate();for(var l=0;l<this.sheets.length;l++)for(var r=this.sheets[l].grid,s=0;s<r.rows.length;s++)for(var _loop_1=function(n){var l=r.getCellData(s,n,!1);if(_isFormula(l)){for(var a=!1,h=l.indexOf(e),u=new RegExp(e,"g");h>-1;){var d="",_="";h>0&&(d=l[h-1]);h+e.length<l.length&&(_=l[h+e.length]);if(!/\w/.test(d)&&(o&&i.test(_)||!o&&!i.test(_))){l=l.replace(u,(function(o,i){return i===h?t:e}));a=!0}h=l.indexOf(e,h+e.length)}a&&r.setCellData(s,n,l,!1)}},a=0;a<r.columns.length;a++)_loop_1(a);this.selection=n;this.endUpdate()}};FlexSheet.prototype._updateTablesForUpdatingRow=function(e,t,o){var i,n,l,r,s;if(this.selectedSheet.tables.length>0)for(i=this.selectedSheet.tables.length-1;i>=0;i--){l=(n=this.selectedSheet.tables[i]).getRange();if(o){if((r=e+t-1)<l.topRow)n._updateTableRange(-t,-t,0,0);else if(r>=l.topRow&&r<=l.bottomRow)if(e<=l.topRow&&r===l.bottomRow){null==s&&(s=[]);s.push(n);this.selectedSheet.tables.remove(n)}else if(e<l.topRow){n.showHeaderRow&&(n._showHeaderRow=!1);n._updateTableRange(e-l.topRow,-t,0,0)}else{e===l.topRow&&n.showHeaderRow&&(n._showHeaderRow=!1);r===l.bottomRow&&n.showTotalRow&&(n._showTotalRow=!1);n._updateTableRange(0,-t,0,0)}else if(e<=l.topRow){null==s&&(s=[]);s.push(n);this.selectedSheet.tables.remove(n)}else if(e<=l.bottomRow){n.showTotalRow&&(n._showTotalRow=!1);n._updateTableRange(0,e-l.bottomRow-1,0,0)}}else e<=l.topRow?n._updateTableRange(t,t,0,0):e>l.topRow&&e<=l.bottomRow&&n._updateTableRange(0,t,0,0)}return s};FlexSheet.prototype._updateTablesForUpdatingColumn=function(e,t,o){var i,n,l,r,s,a,h,u;if(this.selectedSheet.tables.length>0)for(i=this.selectedSheet.tables.length-1;i>=0;i--){l=(n=this.selectedSheet.tables[i]).getRange();if(o){if((r=e+t-1)<l.leftCol)n._updateTableRange(0,0,-t,-t);else if(r>=l.leftCol&&r<=l.rightCol){if(e<=l.leftCol&&r===l.rightCol){null==u&&(u=[]);u.push(n);this.selectedSheet.tables.remove(n);continue}if(e<l.leftCol){s=t-l.leftCol+e;a=l.leftCol;n._updateTableRange(0,0,e-l.leftCol,-t)}else{s=t;a=e;n._updateTableRange(0,0,0,-s)}n._columns.splice(a-l.leftCol,s)}else if(e<=l.leftCol){null==u&&(u=[]);u.push(n);this.selectedSheet.tables.remove(n)}else if(e<=l.rightCol){s=l.rightCol-e+1;n._updateTableRange(0,0,0,-s);n._columns.splice(e,s)}}else if(e<=l.leftCol)n._updateTableRange(0,0,t,t);else if(e>l.leftCol&&e<=l.rightCol){n._updateTableRange(0,0,0,t);a=e-l.leftCol;for(h=0;h<t;h++)n._addColumn(a+h)}}return u};FlexSheet.prototype._updateDivContainerHeight=function(e){var t=this._divContainer.parentElement.clientHeight;e&&(t-=this._tabHolder.getSheetBlanketSize());t=t<0?0:t;this._divContainer.style.height=t+"px"};FlexSheet.prototype._isDisableDeleteRow=function(e,t){var o,i,n;if(this.selectedSheet.tables.length>0)for(o=0;o<this.selectedSheet.tables.length;o++){n=(i=this.selectedSheet.tables[o]).getRange();if(i.showHeaderRow&&n.topRow>=e&&n.topRow<=t)return!0}return!1};FlexSheet.prototype._copy=function(t,o){var i,n;if("columns"==t){e.prototype._copy.call(this,t,o);if(this.itemsSource&&(i=this.rows[0])instanceof HeaderRow){i._ubv=null;i._ubv={};for(var l=0;l<this.columns.length;l++){n=this.columns[l];i._ubv[n._hash]=FlexSheet._getHeaderRowText(n)}}return!0}return!1};FlexSheet.prototype._getTableSheetIndex=function(e,t){for(var o=0;o<e.length;o++)if(e[o].indexOf(t)>-1)return o;return-1};FlexSheet.prototype._sheetSortConverter=function(t,o,i,n){_isFormula(i=e.prototype._sortConverter.call(this,t,o,i,n))&&(i=this.evaluate(i));return i};FlexSheet.prototype._formatEvaluatedResult=function(e,t,o){if(wijmo_1.isPrimitive(e)){t.dataMap&&(e=t.dataMap.getDisplayValue(e));var i=o||t.format;if(!wijmo_1.isInt(e)||i||t.dataMap){wijmo_1.isDate(e)&&_isExclusiveNumericFormat(i)?e=FlexSheet._toOADate(e):i&&"@"!==i&&wijmo_1.isString(e)&&(+e).toString()===e&&(e=+e);e=null!=e?wijmo_1.Globalize.format(e,i):""}else e=e.toString()}else if(e){if(e instanceof FormulaError)return e.error;i=o||e.format||t.format;if(wijmo_1.isArray(e))return wijmo_1.Globalize.format(e,i);if(!wijmo_1.isInt(e.value)||i||t.dataMap){wijmo_1.isDate(e.value)&&_isExclusiveNumericFormat(i)?e.value=FlexSheet._toOADate(e.value):wijmo_1.isString(e.value)&&(+e.value).toString()===e.value&&(e.value=+e.value);e=null!=e.value?wijmo_1.Globalize.format(e.value,i):""}else e=e.value.toString()}return e};FlexSheet.prototype._updateCellRef=function(e,t,o,i,n,l,r){var s;try{s=this._calcEngine.parse(e)}catch(e){return null}var a=s;if(!n&&this._isDeletingColumns&&this.definedNames&&this.definedNames.length&&a._cells){var h=this.selection,u=(h._col,h._col2,a._cells),d=u._col,_=u._col2,c=[o,o-i+1],g=c[0],f=c[1],p=[Math.max(d,_),Math.min(d,_)];if(p[1]>=f&&p[0]<=g){var m=this.definedNames.find((function(t){return t.value==e}));if(m){var w=this.sheets[this.selectedSheetIndex].name,C=m.sheetName;if(C&&C===w||null==C&&m.value.includes(w))return{name:m.name}}}}return s._updateCellRangeExp(t,o,i,n,l,r)?"="+s._getStringExpression():null};FlexSheet.prototype._updateCellBoundary=function(e,t,o){var i;try{i=this._calcEngine.parse(e)}catch(e){return null}return i instanceof _FunctionExpression&&i._updateCellBoundary(t,o)?"="+i._getStringExpression():null};FlexSheet.prototype._fillData=function(e){void 0===e&&(e=AutoFillOperation.CopyFormat|AutoFillOperation.FillSeries);var t=this._fillingRange||this.selection,o=this._fillingSource,i=0!=(e&AutoFillOperation.CopyFormat),n=0!=(e&AutoFillOperation.CopyContent),l=0!=(e&AutoFillOperation.FillSeries),r=o.leftCol===t.leftCol&&o.rightCol===t.rightCol,s=[],a=new AutoFillingEventArgs(t,e);this.onAutoFilling(a);if(a.cancel)return!1;this.beginUpdate();this._resetCellsForFillRange(e);for(var h=0;h<t.rowSpan;h++){var u=t.topRow+h,d=u-o.topRow,_=d%o.rowSpan;if(this.rows[u].visible){_<0&&(_+=o.rowSpan);for(var c=0;c<t.columnSpan;c++){var g=t.leftCol+c,f=g-o.leftCol;if(!(d>=0&&d<o.rowSpan&&f>=0&&f<o.columnSpan)){var p=f%o.columnSpan;p<0&&(p+=o.columnSpan);var m=!1,w=this.getMergedRange(this.cells,o.topRow+_,o.leftCol+p);if(w&&(m=w.topRow===o.topRow+_&&w.leftCol===o.leftCol+p)){this.getMergedRange(this.cells,u,g)||this.mergeRange(new wijmo_grid_1.CellRange(u,g,u+w.rowSpan-1,g+w.columnSpan-1))}if(i){var C=this.selectedSheet.getCellStyle(o.topRow+_,o.leftCol+p),S=C?this._cloneObject(C):null,b=u*this.columns.length+g;this.selectedSheet._styledCells[b]=S}if((!w||m)&&!this.isReadOnly&&!this.rows[u].isReadOnly&&!this.columns[g].isReadOnly){var v=void 0;if(n)_isFormula(v=this.getCellData(o.topRow+_,o.leftCol+p,!1))?this._fillFormula(v,o.topRow+_,o.leftCol+p,u,g):this.setCellData(u,g,v);else if(l){var y=void 0,x=void 0;if(r){y=c;x=_}else{y=h;x=p}if(null==(v=this.getCellData(o.topRow+_,o.leftCol+p,!1))||wijmo_1.isString(v)){_isFormula(v)?this._fillFormula(v,o.topRow+_,o.leftCol+p,u,g):this.setCellData(u,g,v);s[y]=null}else{s[y]||(s[y]=this._getFillSeries(r,y,x));var R=s[y];if(R){if(r){v=this._getFillData(_,d,o,r,R,null!=e||0===y);R.endIndex===o.topRow+_&&(s[y]=null)}else{v=this._getFillData(p,f,o,r,R,null!=e||0===y);R.endIndex===o.leftCol+p&&(s[y]=null)}this.setCellData(u,g,v)}}}}}}}}this._fillingRange&&this.select(this._fillingRange,!1);this.endUpdate();this.onAutoFilled(a);return!0};FlexSheet.prototype._getFillData=function(e,t,o,i,n,l){var r,s,a=n.items;if(1===a.length&&!l)return a[0];r=i?Math.floor(t/o.rowSpan)*n.itemIndexes[n.itemIndexes.length-1]+o.topRow+e-n.startIndex+1:Math.floor(t/o.columnSpan)*n.itemIndexes[n.itemIndexes.length-1]+o.leftCol+e-n.startIndex+1;s=this._getLinearBestFitTrendData(a,n.itemIndexes,r);"date"===n.type&&(s=FlexSheet._fromOADate(s));return s};FlexSheet.prototype._fillFormula=function(e,t,o,i,n){var l,r,s;try{l=this._calcEngine.parse(e);r=new wijmo_grid_1.CellRange(t,o);s=new wijmo_grid_1.CellRange(i,n);l._moveCellRangeExp(this.selectedSheetIndex,r,s,!1,!0)&&(e="="+l._getStringExpression())}catch(e){}finally{this.setCellData(i,n,e)}};FlexSheet.prototype._getFillSeries=function(e,t,o){var i,n,l,r,s,a,h,u,d=this._fillingSource,_=[],c=[];if(e){o=d.topRow+o;r=0;for(s=d.topRow;s<=d.bottomRow;s++){if(a=this.getMergedRange(this.cells,s,d.leftCol+t))if(h&&!a.equals(h)){r+=h.rowSpan;h=a;if(a.leftCol!==d.leftCol+t)continue}else{if(a.topRow!==s||a.leftCol!==d.leftCol+t)continue;r+=1;h=a}else if(h){r+=h.rowSpan;h=null}else r+=1;if(null!=(u=this.getCellData(s,d.leftCol+t,!1))&&""!==u)if(wijmo_1.isNumber(u)||wijmo_1.isDate(u)){i=wijmo_1.isNumber(u)?"number":"date";wijmo_1.isDate(u)&&(u=FlexSheet._toOADate(u));if(0===_.length){l=s;n=i;_.push(u);c.push(r)}else if(i===n){_.push(u);c.push(r)}else{if(o>=l&&o<=s)return{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c};_.splice(0,_.length);c.splice(0,c.length)}}else if(_.length>0){if(o>=l&&o<=s)return{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c};_.splice(0,_.length);c.splice(0,c.length)}}}else{o=d.leftCol+o;r=0;for(s=d.leftCol;s<=d.rightCol;s++){if(a=this.getMergedRange(this.cells,d.topRow+t,s))if(h&&!a.equals(h)){r+=h.columnSpan;h=a;if(a.topRow!==d.topRow+t)continue}else{if(a.leftCol!==s||a.topRow!==d.topRow+t)continue;r+=1;h=a}else if(h){r+=h.columnSpan;h=null}else r+=1;if(null!=(u=this.getCellData(d.topRow+t,s,!1))&&""!==u)if(wijmo_1.isNumber(u)||wijmo_1.isDate(u)){i=wijmo_1.isNumber(u)?"number":"date";wijmo_1.isDate(u)&&(u=FlexSheet._toOADate(u));if(0===_.length){l=s;n=i;_.push(u);c.push(r)}else if(i===n){_.push(u);c.push(r)}else{if(o>=l&&o<=s)return{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c};_.splice(0,_.length);c.splice(0,c.length)}}else if(_.length>0){if(o>=l&&o<=s)return{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c};_.splice(0,_.length);c.splice(0,c.length)}}}return _.length>0?{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c}:null};FlexSheet.prototype._getLinearBestFitTrendData=function(e,t,o){var i,n,l,r,s=0,a=0,h=0,u=0;if(1===(r=e.length))return e[0]+o-1;for(i=0;i<t.length;i++){s+=n=t[i];h+=n*n;a+=l=e[i];u+=n*l}return o*((r*u-s*a)/(r*h-s*s))+(a*h-s*u)/(r*h-s*s)};FlexSheet.prototype._getCellSettingsForFill=function(e,t){var o,i,n,l,r,s;e||(e=this._fillingSource);t||(t=this._fillingRange);r=[];for(o=t.topRow;o<=t.bottomRow;o++)for(i=t.leftCol;i<=t.rightCol;i++)if(!(o>=e.topRow&&o<=e.bottomRow&&i>=e.leftCol&&i<=e.rightCol)){n=this.getCellData(o,i,!1);l=this._cloneObject(this.selectedSheet.getCellStyle(o,i));(s=this.getMergedRange(this.cells,o,i))&&s.topRow===o&&s.leftCol===i||(s=null);r.push({row:o,col:i,value:n,style:l,mergedCell:s?s.clone():null})}return r};FlexSheet.prototype._resetCellsForFillRange=function(e){var t=0!=(e&AutoFillOperation.CopyFormat),o=0!=(e&AutoFillOperation.CopyContent),i=0!=(e&AutoFillOperation.FillSeries);if(this._orgCellSettings&&this._orgCellSettings.length>0)for(var n=0;n<this._orgCellSettings.length;n++){var l=this._orgCellSettings[n],r=l.row,s=l.col;if(!t){var a=r*this.columns.length+s;this.selectedSheet._styledCells[a]=l.style}o||i||this.setCellData(r,s,l.value)}};FlexSheet.prototype._canDoFillOperation=function(){var e,t,o,i,n,l,r,s,a,h,u,d,_,c,g,f=this._fillingSource,p=this._fillingRange,m=!1;for(e=f.topRow;e<=f.bottomRow;e++)for(t=f.leftCol;t<=f.rightCol;t++){h=this.getMergedRange(this.cells,e,t);if(u){if(!h||!u.equals(h)){m=!0;break}}else u=h}for(o=p.topRow;o<=p.bottomRow;o++){(i=(n=o-f.topRow)%f.rowSpan)<0&&(i+=f.rowSpan);i+=f.topRow;for(l=p.leftCol;l<=p.rightCol;l++){s=l-f.leftCol;if(!(n>=0&&n<f.rowSpan&&s>=0&&s<f.columnSpan)){(r=s%f.columnSpan)<0&&(r+=f.columnSpan);r+=f.leftCol;h=this.getMergedRange(this.cells,i,r);if(a=this.getMergedRange(this.cells,o,l)){if(m||!h)return!1;d=a?o-a.topRow:NaN;_=a?l-a.leftCol:NaN;c=h?i-h.topRow:NaN;g=h?r-h.leftCol:NaN;if(d!==c||_!==g)return!1}}}}return!0};FlexSheet.prototype._updateItemIndexForInsertingRow=function(e,t,o){for(var i=0;i<e.length;i++){var n=e[i];n&&null!=n._itemIdx&&n._itemIdx>=t&&(n._itemIdx+=o)}};FlexSheet.prototype._updateItemIndexForRemovingRow=function(e,t){for(var o=0;o<e.length;o++){var i=e[o];i&&null!=i._itemIdx&&i._itemIdx>=t&&(i._itemIdx-=1)}};FlexSheet.prototype._copyRowsToSelectedSheet=function(){var e=this;if(this.selectedSheet){this.selectedSheet.grid.rows.clear();for(var t=0;t<this.rows.length;t++){var o=this.rows[t];this.selectedSheet.grid.rows.push(o);o._list=this.rows}setTimeout((function(){e._setFlexSheetToDirty();e.invalidate()}),10)}};FlexSheet.prototype._copyColumnsToSelectedSheet=function(){var e=this;if(this.selectedSheet){this.selectedSheet.grid.columns.clear();for(var t=0;t<this.columns.length;t++){var o=this.columns[t];this.selectedSheet.grid.columns.push(o);o._setList(this.columns)}setTimeout((function(){e._setFlexSheetToDirty();e.invalidate()}),10)}};FlexSheet.prototype._getUniqueColumnName=function(){for(var e=this.insertedColumnIndex+1;null!=this.columns.getColumn("col"+e);)e++;this.insertedColumnIndex=e;return"col"+this.insertedColumnIndex};FlexSheet.prototype._hideContextMenu=function(){this._contextMenu.hide();this._tabHolder.sheetControl._contextMenu.hide()};FlexSheet.prototype._parseFromWorkbookTable=function(e,t){var o,i,n,l,r,s,a,h,u,d,_,c,g=t===this.selectedSheet?this:t.grid;n=(i=e.range.split(":"))[0];l=i[1];r=mXlsx.Workbook.tableAddress(n);o=new wijmo_grid_1.CellRange(r.row,r.col);s=mXlsx.Workbook.tableAddress(l);o.row2=s.row;o.col2=s.col;if(o.bottomRow>=t.rowCount){_=o.bottomRow-t.rowCount+1;for(c=0;c<_;c++)g.rows.push(new wijmo_grid_1.Row)}if(o.rightCol>=t.columnCount){_=o.rightCol-t.columnCount+1;for(c=0;c<_;c++)g.columns.push(new wijmo_grid_1.Column)}if(e.columns&&e.columns.length>0){a=[];for(var f=0;f<e.columns.length;f++){h=e.columns[f];a[f]=new TableColumn(h.name,h.totalRowLabel,h.totalRowFunction,h.showFilterButton)}}null!=e.style&&(u=this._isBuiltInStyleName(e.style.name)?this.getBuiltInTableStyle(e.style.name):this._parseFromWorkbookTableStyle(e.style));d=new Table(e.name,o,u,a,{showHeaderRow:e.showHeaderRow,showTotalRow:e.showTotalRow,showBandedColumns:e.showBandedColumns,showBandedRows:e.showBandedRows,alterFirstColumn:e.alterFirstColumn,alterLastColumn:e.alterLastColumn});t.tables.push(d);return d};FlexSheet.prototype._parseFromWorkbookTableStyle=function(e){var t=new TableStyle(e.name);null!=e.firstBandedColumnStyle&&(t.firstBandedColumnStyle=this._parseFromWorkbookTableStyleElement(e.firstBandedColumnStyle));null!=e.firstBandedRowStyle&&(t.firstBandedRowStyle=this._parseFromWorkbookTableStyleElement(e.firstBandedRowStyle));null!=e.firstColumnStyle&&(t.firstColumnStyle=this._parseFromWorkbookTableStyleElement(e.firstColumnStyle));null!=e.firstHeaderCellStyle&&(t.firstHeaderCellStyle=this._parseFromWorkbookTableStyleElement(e.firstHeaderCellStyle));null!=e.firstTotalCellStyle&&(t.firstTotalCellStyle=this._parseFromWorkbookTableStyleElement(e.firstTotalCellStyle));null!=e.headerRowStyle&&(t.headerRowStyle=this._parseFromWorkbookTableStyleElement(e.headerRowStyle));null!=e.lastColumnStyle&&(t.lastColumnStyle=this._parseFromWorkbookTableStyleElement(e.lastColumnStyle));null!=e.lastHeaderCellStyle&&(t.lastHeaderCellStyle=this._parseFromWorkbookTableStyleElement(e.lastHeaderCellStyle));null!=e.lastTotalCellStyle&&(t.lastTotalCellStyle=this._parseFromWorkbookTableStyleElement(e.lastTotalCellStyle));null!=e.secondBandedColumnStyle&&(t.secondBandedColumnStyle=this._parseFromWorkbookTableStyleElement(e.secondBandedColumnStyle));null!=e.secondBandedRowStyle&&(t.secondBandedRowStyle=this._parseFromWorkbookTableStyleElement(e.secondBandedRowStyle));null!=e.totalRowStyle&&(t.totalRowStyle=this._parseFromWorkbookTableStyleElement(e.totalRowStyle));null!=e.wholeTableStyle&&(t.wholeTableStyle=this._parseFromWorkbookTableStyleElement(e.wholeTableStyle));return t};FlexSheet.prototype._parseFromWorkbookTableStyleElement=function(e){var t;t={fontWeight:e.font&&e.font.bold?"bold":"none",fontStyle:e.font&&e.font.italic?"italic":"none",textDecoration:wijmo_1._getTextDecorations(e.font),fontFamily:e.font&&e.font.family?e.font.family:"",fontSize:e.font&&e.font.size?e.font.size+"px":"",color:e.font&&e.font.color?e.font.color:"",backgroundColor:e.fill&&e.fill.color?e.fill.color:""};if(e.borders){if(e.borders.left){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.left.style,"Left",t);t.borderLeftColor=e.borders.left.color}if(e.borders.right){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.right.style,"Right",t);t.borderRightColor=e.borders.right.color}if(e.borders.top){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.top.style,"Top",t);t.borderTopColor=e.borders.top.color}if(e.borders.bottom){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.bottom.style,"Bottom",t);t.borderBottomColor=e.borders.bottom.color}if(e.borders.vertical){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.vertical.style,"Vertical",t);t.borderVerticalColor=e.borders.vertical.color}if(e.borders.horizontal){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.horizontal.style,"Horizontal",t);t.borderHorizontalColor=e.borders.horizontal.color}}null!=e.size&&(t.size=e.size);return t};FlexSheet.prototype._parseToWorkbookTable=function(e){var t,o,i=new mXlsx.WorkbookTable,n=e.getRange(),l=e.getColumns();i.name=e.name;t=mXlsx.Workbook.xlsxAddress(n.topRow,n.leftCol);o=mXlsx.Workbook.xlsxAddress(n.bottomRow,n.rightCol);i.range=t+":"+o;if(null!=e.style)if(e.style.isBuiltIn){i.style=new mXlsx.WorkbookTableStyle;i.style.name=e.style.name}else i.style=this._parseToWorkbookTableStyle(e.style);i.showBandedColumns=e.showBandedColumns;i.showBandedRows=e.showBandedRows;i.showHeaderRow=e.showHeaderRow;i.showTotalRow=e.showTotalRow;i.alterFirstColumn=e.alterFirstColumn;i.alterLastColumn=e.alterLastColumn;for(var r=0;r<l.length;r++){var s=l[r],a=new mXlsx.WorkbookTableColumn;a.name=s.name;a.totalRowLabel=s.totalRowLabel;a.totalRowFunction=s.totalRowFunction;a.showFilterButton=s.showFilterButton;i.columns.push(a)}return i};FlexSheet.prototype._parseToWorkbookTableStyle=function(e){var t=new mXlsx.WorkbookTableStyle;t.name=e.name;null!=e.firstBandedColumnStyle&&(t.firstBandedColumnStyle=this._parseToWorkbookTableStyleElement(e.firstBandedColumnStyle,!0));null!=e.firstBandedRowStyle&&(t.firstBandedRowStyle=this._parseToWorkbookTableStyleElement(e.firstBandedRowStyle,!0));null!=e.firstColumnStyle&&(t.firstColumnStyle=this._parseToWorkbookTableStyleElement(e.firstColumnStyle));null!=e.firstHeaderCellStyle&&(t.firstHeaderCellStyle=this._parseToWorkbookTableStyleElement(e.firstHeaderCellStyle));null!=e.firstTotalCellStyle&&(t.firstTotalCellStyle=this._parseToWorkbookTableStyleElement(e.firstTotalCellStyle));null!=e.headerRowStyle&&(t.headerRowStyle=this._parseToWorkbookTableStyleElement(e.headerRowStyle));null!=e.lastColumnStyle&&(t.lastColumnStyle=this._parseToWorkbookTableStyleElement(e.lastColumnStyle));null!=e.lastHeaderCellStyle&&(t.lastHeaderCellStyle=this._parseToWorkbookTableStyleElement(e.lastHeaderCellStyle));null!=e.lastTotalCellStyle&&(t.lastTotalCellStyle=this._parseToWorkbookTableStyleElement(e.lastTotalCellStyle));null!=e.secondBandedColumnStyle&&(t.secondBandedColumnStyle=this._parseToWorkbookTableStyleElement(e.secondBandedColumnStyle,!0));null!=e.secondBandedRowStyle&&(t.secondBandedRowStyle=this._parseToWorkbookTableStyleElement(e.secondBandedRowStyle,!0));null!=e.totalRowStyle&&(t.totalRowStyle=this._parseToWorkbookTableStyleElement(e.totalRowStyle));null!=e.wholeTableStyle&&(t.wholeTableStyle=this._parseToWorkbookTableStyleElement(e.wholeTableStyle));return t};FlexSheet.prototype._parseToWorkbookTableStyleElement=function(e,t){void 0===t&&(t=!1);var o,i=wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseCellStyle(e,!0);t?(o=new mXlsx.WorkbookTableBandedStyle).size=e.size:o=new mXlsx.WorkbookTableCommonStyle;o._deserialize(i);return o};FlexSheet.prototype._isBuiltInStyleName=function(e){var t;if(0===e.search(/TableStyleLight/i)){t=+e.substring(15);if(!isNaN(t)&&t>=1&&t<=21)return!0}else if(0===e.search(/TableStyleMedium/i)){t=+e.substring(16);if(!isNaN(t)&&t>=1&&t<=28)return!0}else if(0===e.search(/TableStyleDark/i)){t=+e.substring(14);if(!isNaN(t)&&t>=1&&t<=11)return!0}return!1};FlexSheet.prototype._getTable=function(e){e=e.substr(e.lastIndexOf("!")+1);for(var t=0;t<this.sheets.length;t++)for(var o=this.sheets[t].tables,i=0;i<o.length;i++){var n=o[i];if(n.name.toLowerCase()===e.toLowerCase())return n}return null};FlexSheet.prototype._checkTableHeaderRow=function(e,t){e.forEach((function(e){if(e.showHeaderRow)for(var o=e.getRange(TableSection.Header),i=o.row,n=o.leftCol;n<=o.rightCol;n++){var l=t.sheets[0].rows[i].cells[n];l.isDate=!1;if(null==l.value||""===l.value){var r=n-o.leftCol;l.value=e._getColumns()[r].name}}}))};FlexSheet.prototype._getThemeColor=function(e,t){var o,i=this._colorThemes[e];if(null!=t){(o=new wijmo_1.Color("#"+i).getHsl())[2]=t<0?o[2]*(1+t):o[2]*(1-t)+(1-1*(1-t));return wijmo_1.Color.fromHsl(o[0],o[1],o[2]).toString()}return"#"+i};FlexSheet.prototype._createBuiltInTableStyle=function(e){var t;if(0===e.search(/TableStyleLight/i)){t=+e.substring(15);if(!isNaN(t)&&t>=1&&t<=21)return t<=7?this._generateTableLightStyle1(t-1,e,!0):t<=14?this._generateTableLightStyle2(t-8,e):this._generateTableLightStyle1(t-15,e,!1)}else if(0===e.search(/TableStyleMedium/i)){t=+e.substring(16);if(!isNaN(t)&&t>=1&&t<=28)return t<=7?this._generateTableMediumStyle1(t-1,e):t<=14?this._generateTableMediumStyle2(t-8,e):t<=21?this._generateTableMediumStyle3(t-15,e):this._generateTableMediumStyle4(t-22,e)}else if(0===e.search(/TableStyleDark/i)){t=+e.substring(14);if(!isNaN(t)&&t>=1&&t<=11)return t<=7?this._generateTableDarkStyle1(t-1,e):this._generateTableDarkStyle2(t-8,e)}return null};FlexSheet.prototype._generateTableLightStyle1=function(e,t,o){var i=new TableStyle(t,!0),n=0===e?1:e+3,l=o?"1px":"2px",r=o?"solid":"double",s=o?"1px":"3px";i.wholeTableStyle={borderTopColor:this._getThemeColor(n),borderTopStyle:"solid",borderTopWidth:"1px",borderBottomColor:this._getThemeColor(n),borderBottomStyle:"solid",borderBottomWidth:"1px"};i.firstColumnStyle={fontWeight:"bold"};i.lastColumnStyle={fontWeight:"bold"};i.headerRowStyle={borderBottomColor:this._getThemeColor(n),borderBottomStyle:"solid",borderBottomWidth:l,fontWeight:"bold"};i.totalRowStyle={borderTopColor:this._getThemeColor(n),borderTopStyle:r,borderTopWidth:s,fontWeight:"bold"};if(0===e){i.wholeTableStyle.color=this._getThemeColor(n);i.firstColumnStyle.color=this._getThemeColor(n);i.lastColumnStyle.color=this._getThemeColor(n);i.headerRowStyle.color=this._getThemeColor(n);i.totalRowStyle.color=this._getThemeColor(n);i.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.15)};i.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.15)}}else{if(o){i.wholeTableStyle.color=this._getThemeColor(n,-.25);i.firstColumnStyle.color=this._getThemeColor(n,-.25);i.lastColumnStyle.color=this._getThemeColor(n,-.25);i.headerRowStyle.color=this._getThemeColor(n,-.25);i.totalRowStyle.color=this._getThemeColor(n,-.25)}else{i.wholeTableStyle.color=this._getThemeColor(1);i.firstColumnStyle.color=this._getThemeColor(1);i.lastColumnStyle.color=this._getThemeColor(1);i.headerRowStyle.color=this._getThemeColor(1);i.totalRowStyle.color=this._getThemeColor(1)}i.firstBandedRowStyle={backgroundColor:this._getThemeColor(n,.8)};i.firstBandedColumnStyle={backgroundColor:this._getThemeColor(n,.8)}}if(!o){i.wholeTableStyle.borderLeftColor=this._getThemeColor(n);i.wholeTableStyle.borderLeftStyle="solid";i.wholeTableStyle.borderLeftWidth="1px";i.wholeTableStyle.borderRightColor=this._getThemeColor(n);i.wholeTableStyle.borderRightStyle="solid";i.wholeTableStyle.borderRightWidth="1px";i.wholeTableStyle.borderHorizontalColor=this._getThemeColor(n);i.wholeTableStyle.borderHorizontalStyle="solid";i.wholeTableStyle.borderHorizontalWidth="1px";i.wholeTableStyle.borderVerticalColor=this._getThemeColor(n);i.wholeTableStyle.borderVerticalStyle="solid";i.wholeTableStyle.borderVerticalWidth="1px"}return i};FlexSheet.prototype._generateTableLightStyle2=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"solid",borderTopWidth:"1px",borderBottomColor:this._getThemeColor(i),borderBottomStyle:"solid",borderBottomWidth:"1px",borderLeftColor:this._getThemeColor(i),borderLeftStyle:"solid",borderLeftWidth:"1px",borderRightColor:this._getThemeColor(i),borderRightStyle:"solid",borderRightWidth:"1px",color:this._getThemeColor(1)};o.firstBandedRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"solid",borderTopWidth:"1px"};o.secondBandedRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"solid",borderTopWidth:"1px"};o.firstBandedColumnStyle={borderLeftColor:this._getThemeColor(i),borderLeftStyle:"solid",borderLeftWidth:"1px"};o.secondBandedColumnStyle={borderLeftColor:this._getThemeColor(i),borderLeftStyle:"solid",borderLeftWidth:"1px"};o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.headerRowStyle={backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};o.totalRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"double",borderTopWidth:"3px",fontWeight:"bold",color:this._getThemeColor(1)};return o};FlexSheet.prototype._generateTableMediumStyle1=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderTopStyle:"solid",borderTopWidth:"1px",borderBottomStyle:"solid",borderBottomWidth:"1px",borderLeftStyle:"solid",borderLeftWidth:"1px",borderRightStyle:"solid",borderRightWidth:"1px",borderHorizontalStyle:"solid",borderHorizontalWidth:"1px",color:this._getThemeColor(1)};if(0===e){o.wholeTableStyle.borderTopColor=this._getThemeColor(i);o.wholeTableStyle.borderBottomColor=this._getThemeColor(i);o.wholeTableStyle.borderLeftColor=this._getThemeColor(i);o.wholeTableStyle.borderRightColor=this._getThemeColor(i);o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(i);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.15)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.15)}}else{o.wholeTableStyle.borderTopColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderBottomColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderLeftColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderRightColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(i,.4);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,.8)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,.8)}}o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.headerRowStyle={backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};o.totalRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"double",borderTopWidth:"3px",fontWeight:"bold",color:this._getThemeColor(1)};return o};FlexSheet.prototype._generateTableMediumStyle2=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderVerticalStyle:"solid",borderVerticalWidth:"1px",borderVerticalColor:this._getThemeColor(0),borderHorizontalStyle:"solid",borderHorizontalWidth:"1px",borderHorizontalColor:this._getThemeColor(0),color:this._getThemeColor(1)};if(0===e){o.wholeTableStyle.backgroundColor=this._getThemeColor(0,-.15);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.35)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.35)}}else{o.wholeTableStyle.backgroundColor=this._getThemeColor(i,.8);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,.6)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,.6)}}o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i)};o.headerRowStyle={borderBottomColor:this._getThemeColor(0),borderBottomStyle:"solid",borderBottomWidth:"3px",backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};o.totalRowStyle={borderTopColor:this._getThemeColor(0),borderTopStyle:"solid",borderTopWidth:"3px",backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};return o};FlexSheet.prototype._generateTableMediumStyle3=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderTopStyle:"solid",borderTopWidth:"2px",borderTopColor:this._getThemeColor(1),borderBottomStyle:"solid",borderBottomWidth:"2px",borderBottomColor:this._getThemeColor(1),color:this._getThemeColor(1)};if(0===e){o.wholeTableStyle.borderLeftColor=this._getThemeColor(1);o.wholeTableStyle.borderLeftStyle="solid";o.wholeTableStyle.borderLeftWidth="1px";o.wholeTableStyle.borderRightColor=this._getThemeColor(1);o.wholeTableStyle.borderRightStyle="solid";o.wholeTableStyle.borderRightWidth="1px";o.wholeTableStyle.borderVerticalColor=this._getThemeColor(1);o.wholeTableStyle.borderVerticalStyle="solid";o.wholeTableStyle.borderVerticalWidth="1px";o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(1);o.wholeTableStyle.borderHorizontalStyle="solid";o.wholeTableStyle.borderHorizontalWidth="1px"}o.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.35)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.35)};o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i)};o.headerRowStyle={borderBottomColor:this._getThemeColor(1),borderBottomStyle:"solid",borderBottomWidth:"2px",backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};o.totalRowStyle={borderTopColor:this._getThemeColor(1),borderTopStyle:"double",borderTopWidth:"3px"};return o};FlexSheet.prototype._generateTableMediumStyle4=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderTopStyle:"solid",borderTopWidth:"1px",borderBottomStyle:"solid",borderBottomWidth:"1px",borderLeftStyle:"solid",borderLeftWidth:"1px",borderRightStyle:"solid",borderRightWidth:"1px",borderVerticalStyle:"solid",borderVerticalWidth:"1px",borderHorizontalStyle:"solid",borderHorizontalWidth:"1px",color:this._getThemeColor(1)};if(0===e){o.wholeTableStyle.borderTopColor=this._getThemeColor(i);o.wholeTableStyle.borderBottomColor=this._getThemeColor(i);o.wholeTableStyle.borderLeftColor=this._getThemeColor(i);o.wholeTableStyle.borderRightColor=this._getThemeColor(i);o.wholeTableStyle.borderVerticalColor=this._getThemeColor(i);o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(i);o.wholeTableStyle.backgroundColor=this._getThemeColor(0,-.15);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.35)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.35)}}else{o.wholeTableStyle.borderTopColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderBottomColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderLeftColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderRightColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderVerticalColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(i,.4);o.wholeTableStyle.backgroundColor=this._getThemeColor(i,.8);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,.6)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,.6)}}o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.headerRowStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.totalRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"solid",borderTopWidth:"2px",fontWeight:"bold",color:this._getThemeColor(1)};return o};FlexSheet.prototype._generateTableDarkStyle1=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3,n=0===e?.25:-.25;o.wholeTableStyle={color:this._getThemeColor(0)};o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,n)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,n)};o.firstColumnStyle={borderRightColor:this._getThemeColor(0),borderRightStyle:"solid",borderRightWidth:"2px",fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i,n)};o.lastColumnStyle={borderLeftColor:this._getThemeColor(0),borderLeftStyle:"solid",borderLeftWidth:"2px",fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i,n)};o.headerRowStyle={borderBottomColor:this._getThemeColor(0),borderBottomStyle:"solid",borderBottomWidth:"2px",fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(1)};o.totalRowStyle={borderTopColor:this._getThemeColor(0),borderTopStyle:"solid",borderTopWidth:"2px",fontWeight:"bold",color:this._getThemeColor(0)};if(0===e){o.wholeTableStyle.backgroundColor=this._getThemeColor(i,.5);o.totalRowStyle.backgroundColor=this._getThemeColor(i,.15)}else{o.wholeTableStyle.backgroundColor=this._getThemeColor(i);o.totalRowStyle.backgroundColor=this._getThemeColor(i,-.5)}return o};FlexSheet.prototype._generateTableDarkStyle2=function(e,t){var o=new TableStyle(t,!0),i=0===e?0:2*e+2,n=0===e?1:2*e+3,l=0===e?-.15:.8;o.wholeTableStyle={backgroundColor:this._getThemeColor(i,l)};o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,l-.2)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,l-.2)};o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.headerRowStyle={color:this._getThemeColor(0),backgroundColor:this._getThemeColor(n)};o.totalRowStyle={borderTopColor:this._getThemeColor(1),borderTopStyle:"double",borderTopWidth:"3px",fontWeight:"bold",color:this._getThemeColor(1)};return o};FlexSheet._getHeaderRowText=function(e){var t=e.binding,o=e._hdr;null!=o&&""!=o.trim()||(o=wijmo_1.toHeaderCase(t||""));return o};FlexSheet._toOADate=function(e){var t,o=new Date(1900,0,0),i=Date.UTC(1900,0,0),n=o.getTime()-i-6e4*o.getTimezoneOffset(),l=6e4*(e.getTimezoneOffset()-o.getTimezoneOffset());t=(e.getTime()-o.getTime()-(0!==l?l-n:0))/864e5;return t+=t>59?1:0};FlexSheet._fromOADate=function(e){var t,o,i,n=new Date(1900,0,0),l=Date.UTC(1900,0,0),r=n.getTime()-l-6e4*n.getTimezoneOffset();o=e>59?1:0;return 0!==(t=6e4*((i=new Date(n.getTime()+864e5*(e-o))).getTimezoneOffset()-n.getTimezoneOffset()))?new Date(n.getTime()+t-r+864e5*(e-o)):i};FlexSheet.prototype.setHeights=function(e){this._heights=e};FlexSheet.prototype.updateRowHeights=function(){if(this.collectionView)for(var e=0;e<this._heights.length;e++)this._heights[e]&&this.rows[e]&&(this.rows[e].height=this._heights[e])};FlexSheet.prototype._getRangesToResize=function(e,t,o){var i=null,n=this._getResizingInfo(t,e),l=n.isRowResizing,r=n.isColResizing,s=n.rangeBeingResized;if(this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange){i=this._selections();this._removeNegativeRange(i);if(!this._isAllCellsSelected()){var a=null;r?a=this._checkSelectedRangesForResizingCol(i,s):l&&(a=this._checkSelectedRangesForResizingRow(i,s));a&&(i=a)}}else(r&&!this.selection.containsColumn(s.col)||l&&!this.selection.containsRow(s.row))&&(i=[s]);return i};FlexSheet.prototype._checkSelectedRangesForResizingCol=function(e,t){for(var o=e,i=!1,n=0;n<o.length;n++){var l=o[n];!i&&l.containsColumn(t.rightCol)&&(i=!0);if(l.bottomRow-l.topRow+1!==this.rows.length)return[t]}return i?o:[t]};FlexSheet.prototype._checkSelectedRangesForResizingRow=function(e,t){for(var o=e,i=!1,n=0;n<o.length;n++){var l=o[n];!i&&l.containsRow(t.bottomRow)&&(i=!0);if(l.rightCol-l.leftCol+1!==this.columns.length)return[t]}return i?o:[t]};FlexSheet.prototype._removeNegativeRange=function(e){e&&e.length&&-1===e[0].row&&-1===e[0].col&&-1===e[0].row2&&-1===e[0].col2&&e.splice(0,1)};FlexSheet._EDITOR_PADDING_BELOW=2;FlexSheet._EDITOR_PADDING_ABOVE=3;FlexSheet._MIN_DIALOG_GAP=6;FlexSheet._ctrlTemplate="";return FlexSheet}(wijmo_grid_1.FlexGrid);exports.FlexSheet=FlexSheet;var DraggingRowColumnEventArgs=function(e){__extends(DraggingRowColumnEventArgs,e);function DraggingRowColumnEventArgs(t,o,i){var n=e.call(this)||this;n._draggingRange=t;n._isDraggingRows=o;n._isShiftKey=i;return n}Object.defineProperty(DraggingRowColumnEventArgs.prototype,"draggingRange",{get:function(){return this._draggingRange},enumerable:!0,configurable:!0});Object.defineProperty(DraggingRowColumnEventArgs.prototype,"isDraggingRows",{get:function(){return this._isDraggingRows},enumerable:!0,configurable:!0});Object.defineProperty(DraggingRowColumnEventArgs.prototype,"isShiftKey",{get:function(){return this._isShiftKey},enumerable:!0,configurable:!0});return DraggingRowColumnEventArgs}(wijmo_1.EventArgs);exports.DraggingRowColumnEventArgs=DraggingRowColumnEventArgs;var DroppingRowColumnEventArgs=function(e){__extends(DroppingRowColumnEventArgs,e);function DroppingRowColumnEventArgs(t,o){var i=e.call(this)||this;i._droppingRange=t;i._isDroppingRows=o;return i}Object.defineProperty(DroppingRowColumnEventArgs.prototype,"droppingRange",{get:function(){return this._droppingRange},enumerable:!0,configurable:!0});Object.defineProperty(DroppingRowColumnEventArgs.prototype,"isDroppingRows",{get:function(){return this._isDroppingRows},enumerable:!0,configurable:!0});return DroppingRowColumnEventArgs}(wijmo_1.CancelEventArgs);exports.DroppingRowColumnEventArgs=DroppingRowColumnEventArgs;var UnknownFunctionEventArgs=function(e){__extends(UnknownFunctionEventArgs,e);function UnknownFunctionEventArgs(t,o){var i=e.call(this)||this;i._funcName=t;i._params=o;return i}Object.defineProperty(UnknownFunctionEventArgs.prototype,"funcName",{get:function(){return this._funcName},enumerable:!0,configurable:!0});Object.defineProperty(UnknownFunctionEventArgs.prototype,"params",{get:function(){return this._params},enumerable:!0,configurable:!0});return UnknownFunctionEventArgs}(wijmo_1.EventArgs);exports.UnknownFunctionEventArgs=UnknownFunctionEventArgs;var RowColumnChangedEventArgs=function(e){__extends(RowColumnChangedEventArgs,e);function RowColumnChangedEventArgs(t,o,i,n){var l=e.call(this)||this;if(wijmo_1.isArray(t)){l._ranges=t;l._added=o;if(1===t.length){var r=t[0];if(i){l._index=r.leftCol;l._count=r.columnSpan}else{l._index=r.topRow;l._count=r.rowSpan}}else{l._index=-1;l._count=-1}}else{l._index=t;l._count=o;l._added=i;l._ranges=n?[new wijmo_grid_1.CellRange(-1,l._index,-1,l._index+l._count-1)]:[new wijmo_grid_1.CellRange(l._index,-1,l._index+l._count-1,-1)]}return l}Object.defineProperty(RowColumnChangedEventArgs.prototype,"ranges",{get:function(){return this._ranges},enumerable:!0,configurable:!0});Object.defineProperty(RowColumnChangedEventArgs.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0});Object.defineProperty(RowColumnChangedEventArgs.prototype,"count",{get:function(){return this._count},enumerable:!0,configurable:!0});Object.defineProperty(RowColumnChangedEventArgs.prototype,"added",{get:function(){return this._added},enumerable:!0,configurable:!0});Object.defineProperty(RowColumnChangedEventArgs.prototype,"isAdd",{get:function(){wijmo_1._deprecated("RowColumnChangedEventArgs.isAdd","RowColumnChangedEventArgs.added");return this._added},enumerable:!0,configurable:!0});return RowColumnChangedEventArgs}(wijmo_1.EventArgs);exports.RowColumnChangedEventArgs=RowColumnChangedEventArgs;var AutoFillingEventArgs=function(e){__extends(AutoFillingEventArgs,e);function AutoFillingEventArgs(t,o){var i=e.call(this)||this;i._range=t;i._op=o;return i}Object.defineProperty(AutoFillingEventArgs.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(AutoFillingEventArgs.prototype,"operation",{get:function(){return this._op},enumerable:!0,configurable:!0});return AutoFillingEventArgs}(wijmo_1.CancelEventArgs);exports.AutoFillingEventArgs=AutoFillingEventArgs;var AutoFilledEventArgs=function(e){__extends(AutoFilledEventArgs,e);function AutoFilledEventArgs(t,o){var i=e.call(this)||this;i._range=t;i._op=o;return i}Object.defineProperty(AutoFilledEventArgs.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(AutoFilledEventArgs.prototype,"operation",{get:function(){return this._op},enumerable:!0,configurable:!0});return AutoFilledEventArgs}(wijmo_1.EventArgs);exports.AutoFilledEventArgs=AutoFilledEventArgs;var FlexSheetPanel=function(e){__extends(FlexSheetPanel,e);function FlexSheetPanel(t,o,i,n,l){var r=e.call(this,t,o,i,n,l)||this;r._drkColors={};return r}FlexSheetPanel.prototype.getSelectedState=function(t,o,i){if(this.grid){var n=this.grid.selectedSheet,l=n?n.selectionRanges:null,r=l?l.length:0,s=e.prototype.getSelectedState.call(this,t,o,i);if(s===wijmo_grid_1.SelectedState.None&&r>0)for(var a=this.grid.getMergedRange(this,t,o),h=this.columns.length-1,u=this.rows.length-1,d=0;d<l.length;d++){var _=l[d];if(_&&_ instanceof wijmo_grid_1.CellRange){if(this.cellType===wijmo_grid_1.CellType.Cell){if(a){if(a.contains(_.row,_.col))return d!==r-1||this.grid._isClicking?wijmo_grid_1.SelectedState.Selected:this.grid.showMarquee?wijmo_grid_1.SelectedState.None:wijmo_grid_1.SelectedState.Cursor;if(a.intersects(_))return wijmo_grid_1.SelectedState.Selected}if(_.row===t&&_.col===o)return d!==r-1||this.grid._isClicking?wijmo_grid_1.SelectedState.Selected:this.grid.showMarquee?wijmo_grid_1.SelectedState.None:wijmo_grid_1.SelectedState.Cursor;if(_.contains(t,o))return wijmo_grid_1.SelectedState.Selected}if(this.cellType===wijmo_grid_1.CellType.RowHeader&&this.grid.showSelectedHeaders&wijmo_grid_1.HeadersVisibility.Row&&o===h&&_.containsRow(t))return wijmo_grid_1.SelectedState.Selected;if(this.cellType===wijmo_grid_1.CellType.ColumnHeader&&this.grid.showSelectedHeaders&wijmo_grid_1.HeadersVisibility.Column&&t===u&&_.containsColumn(o))return wijmo_grid_1.SelectedState.Selected}}return s}};FlexSheetPanel.prototype.getCellData=function(t,o,i){if(wijmo_1.isString(o)&&(o=this.columns.indexOf(o))<0)throw"Invalid column name or binding.";if(t>=this.rows.length||wijmo_1.asNumber(o,!1,!0)>=this.columns.length)return null;if(this.cellType===wijmo_grid_1.CellType.RowHeader)return""+(t+1);var n=this.columns[wijmo_1.asNumber(o,!1,!0)],l=this.grid?this.grid._getBindingColumn(this,t,n):n,r=this.grid;if(this.cellType===wijmo_grid_1.CellType.ColumnHeader){var s=this.rows[t];if(s&&s._ubv&&null!=s._ubv[n._hash])return e.prototype.getCellData.call(this,t,o,i);var a=l.header;return null==l._hdr||l._hdr==l._orgHdr||a===l.binding||a===wijmo_1.toHeaderCase(l.binding)?FlexSheet.convertNumberToAlpha(o):a}if(i&&(!l||!l.dataMap))if(_isEditingCell(this.grid,t,o)){var h=e.prototype.getCellData.call(this,t,o,!1);if(!wijmo_1.isDate(h)||!l.format)return wijmo_1.Globalize.format(h,null)}else{var u=r&&r._getCellStyle(t,o);if(u&&u.format){h=e.prototype.getCellData.call(this,t,o,!1);if(wijmo_1.isDate(h)||wijmo_1.isNumber(h))return wijmo_1.Globalize.format(h,u.format)}}return e.prototype.getCellData.call(this,t,o,i)};FlexSheetPanel.prototype.setCellData=function(t,o,i,n,l,r){void 0===n&&(n=!0);void 0===l&&(l=!0);void 0===r&&(r=!1);if(t>=this.rows.length||o>=this.columns.length)return!1;var s,a=this.grid,h=a?a._getBindingColumn(this,t,this.columns[o]):this.columns[o],u=this.rows[t];if(i instanceof _ValWithFormat){s=i.format;i=i.value}a&&a._isPasting&&(n=!0);var d=wijmo_1.isString(i);if(a&&a.selectedSheet){var _=a.selectedSheet.findTable(t,o);if(_&&_._isHeaderRow(t)){if(null==i||d&&wijmo_1.isNullOrWhiteSpace(i)&&!h.dataMap)return;if(!(u instanceof HeaderRow)){i=h.dataType===wijmo_1.DataType.Boolean&&wijmo_1.isBoolean(i)?i:i.toString();_._attached&&a._updateFormulasTableColumn(_,o,""+this.getCellData(t,o,!1),""+i);return e.prototype.setCellData.call(this,t,o,i,!1,l,r)}u._ubv[h._hash]=i.toString()}}var c=d&&"'"===i[0],g=d&&_isFormula(i);if(n&&i&&h.dataType!==wijmo_1.DataType.String&&d&&!c&&!g){var f=wijmo_1.culture.Globalize;if(this.getCellData(t,o,!0)===i)return!0;var p=a?a._getCellStyle(t,o):null,m=s||p&&p.format||h.format,w=null;m&&/[yYMhsmt:-]/.test(m)&&!/[pc]/.test(m)&&(w=wijmo_1.Globalize.parseDate(i,m));null==w&&i.indexOf(f.calendar["/"])>=0&&(w=wijmo_1.Globalize.parseDate(i,null));if(w)i=w;else if(h.dataType===wijmo_1.DataType.Array)i=wijmo_1.changeType(i,wijmo_1.DataType.Array,null);else if(wijmo_1.isNullOrWhiteSpace(i))h.dataType===wijmo_1.DataType.Boolean&&(i=wijmo_1.changeType(i,wijmo_1.DataType.Boolean,null));else{var C="%"===i[i.length-1],S=i.indexOf(f.numberFormat.currency.symbol)>=0;if(C||S||!/[^-\d,.]/.test(i)){var b=wijmo_1.changeType(i,wijmo_1.DataType.Number,"");if(wijmo_1.isNumber(b)){i=b;m||h.dataType&&h.dataType!==wijmo_1.DataType.Number||(S?a.applyCellsStyle({format:"C"+(wijmo_1.isInt(i)?"0":"")},[new wijmo_grid_1.CellRange(t,o)]):C&&a.applyCellsStyle({format:"P"+(wijmo_1.isInt(100*i)?"0":"")},[new wijmo_grid_1.CellRange(t,o)]))}else n=!1}}}(g||c||!h.dataType&&i)&&(n=!1);if(""===i&&n&&h.dataType!==wijmo_1.DataType.String&&!h.dataMap&&!u.dataMap){i=null;n=!1}if(!(u instanceof HeaderRow))return e.prototype.setCellData.call(this,t,o,i,n,l,r);u._ubv[h._hash]=i};FlexSheetPanel.prototype._renderCell=function(t,o,i,n,l,r){var s=o*this.grid.columns.length+i,a=this.grid.getMergedRange(this,o,i),h=e.prototype._renderCell.call(this,t,o,i,n,l,r);if(this.cellType!==wijmo_grid_1.CellType.Cell)return h;if(a&&s>a.topRow*this.grid.columns.length+a.leftCol)return h;if(this.columns[i].renderSize<=0&&(!a||a.getRenderSize(this).width<=0))return h;var u=t.childNodes[r];if(u){var d=this.grid.selectedSheet;if(d&&!_isEditingCell(this.grid,o,i)){var _=d.findTable(o,i);_&&_._updateCell(o,i,u)}var c,g=d?d._styledCells[s]:null;c=wijmo_1.hasClass(u,wijmo_1.ControlStateClsNames.multiSelected);if(wijmo_1.hasClass(u,wijmo_1.ControlStateClsNames.selected)||c){g&&g.backgroundColor&&(u.style.backgroundColor="");g&&g.color&&(u.style.color="");c&&g&&g.backgroundColor&&(u.style.backgroundColor=this._darker(g.backgroundColor))}else if(g){""!==g.backgroundColor&&(u.style.backgroundColor=g.backgroundColor);""!==g.color&&(u.style.color=g.color)}}return h};FlexSheetPanel.prototype._darker=function(e){var t=this._drkColors[e];if(!t){var o=new wijmo_1.Color(e).getHsl();this._drkColors[e]=t=wijmo_1.Color.fromHsl(o[0],o[1],.75*o[2]).toString()}return t};return FlexSheetPanel}(wijmo_grid_1.GridPanel);exports.FlexSheetPanel=FlexSheetPanel;var AutoFillOperation,HeaderRow=function(e){__extends(HeaderRow,e);function HeaderRow(){var t=e.call(this)||this;t.isReadOnly=!0;return t}return HeaderRow}(wijmo_grid_1.Row);exports.HeaderRow=HeaderRow;function _isFormula(e){return e&&"string"==typeof e&&e.length>1&&"="===e[0]&&"="!==e[1]}exports._isFormula=_isFormula;function _isEditingCell(e,t,o){var i=e.editRange;return i&&i.contains(t,o)}exports._isEditingCell=_isEditingCell;function _isExclusiveNumericFormat(e){if(e){var t=e.match(/^[cdefgnprx](\d?)/i);if(t){var o=t[0][0].toLowerCase();return"d"!==o&&"e"!==o&&"f"!==o&&"g"!==o||!!t[1]}}return!1}function applyStyleImp(e,t,o,i){e[t]||(e[t]={});e[t][o]=null===i||""===i?void 0:i||e[t][o]}!function(e){e[e.CopyFormat=1]="CopyFormat";e[e.CopyContent=2]="CopyContent";e[e.FillSeries=4]="FillSeries"}(AutoFillOperation=exports.AutoFillOperation||(exports.AutoFillOperation={}));var _RangesHelper=function(){function _RangesHelper(){}_RangesHelper.validateRowRanges=function(e,t){return _RangesHelper._validateCellRanges(e,t,"topRow","bottomRow","row2")};_RangesHelper.excludeRow=function(e,t){if(e&&e.length)for(var o=0;o<e.length;o++){var i=e[o];if(i.containsRow(t))if(1===i.rowSpan){e.splice(o);o--}else if(i.topRow===t)i.setRange(i.topRow+1,i.col,i.bottomRow,i.col2);else if(i.bottomRow===t)i.setRange(i.topRow,i.col,i.bottomRow-1,i.col2);else{e.splice(o,1,new wijmo_grid_1.CellRange(i.topRow,i.col,t-1,i.col2),new wijmo_grid_1.CellRange(t+1,i.col,i.bottomRow,i.col2));o++}}};_RangesHelper.validateColumnRanges=function(e,t){return _RangesHelper._validateCellRanges(e,t,"leftCol","rightCol","col2")};_RangesHelper._validateCellRanges=function(e,t,o,i,n){var l=(e=e.filter((function(e){return e&&e[o]>=0&&e[i]>=0&&e[o]<t&&e[i]<t}))).length;if(l>1){for(var r=[],s=(e=e.sort((function(e,t){return t[o]>=e[o]&&t[i]<=e[i]?-1:e[o]-t[o]})))[0].clone(),a=1;a<l;a++){var h=e[a];if(h[o]>=s[o]&&h[i]<=s[i]);else if(h[o]<=s[i]+1)s[n]=h[i];else{r.push(s);s=h.clone()}a===l-1&&r.push(s)}e=r}return e};return _RangesHelper}(),_ValWithFormat=function _ValWithFormat(e,t){this.value=e;this.format=t},UndoStack=function(){function UndoStack(e){var t=this;this.MAX_STACK_SIZE=500;this._stack=[];this._pointer=-1;this._resizingTriggered=!1;this.undoStackChanged=new wijmo_1.Event;this._owner=e;this._owner.prepareCellForEdit.addHandler(this._initCellEditAction,this);this._owner.cellEditEnded.addHandler((function(e,o){t._pendingAction&&(!o.data||46!==o.data.keyCode&&8!==o.data.keyCode)&&t._pendingAction instanceof _EditAction&&!t._pendingAction.isPaste&&t._afterProcessCellEditAction(t)}),this);this._owner.pasting.addHandler(this._initCellEditActionForPasting,this);this._owner.pastingCell.addHandler((function(e,o){t._pendingAction&&(t._pendingAction instanceof _EditAction||t._pendingAction instanceof _CutAction)&&t._pendingAction.updateForPasting(o.range)}),this);this._owner.pasted.addHandler((function(){if(t._pendingAction)if(t._pendingAction instanceof _EditAction&&t._pendingAction.isPaste)t._afterProcessCellEditAction(t);else if(t._pendingAction instanceof _CutAction){t._pendingAction.saveNewState();t._addAction(t._pendingAction);t._pendingAction=null}}),this);this._owner.resizingColumn.addHandler((function(e,o){if(0!==t.stackSize&&t._owner.selectedSheet&&!t._resizingTriggered){t._pendingAction=new _ColumnResizeAction(t._owner,o.panel,o.col);t._resizingTriggered=!0}}),this);this._owner.resizedColumn.addHandler((function(e){t._pendingAction instanceof _ColumnResizeAction&&t._pendingAction.saveNewState()&&t._addAction(t._pendingAction);t._pendingAction=null;t._resizingTriggered=!1}),this);this._owner.resizingRow.addHandler((function(e,o){if(0!==t.stackSize&&t._owner.selectedSheet&&!t._resizingTriggered){t._pendingAction=new _RowResizeAction(t._owner,o.panel,o.row);t._resizingTriggered=!0}}),this);this._owner.resizedRow.addHandler((function(e){t._pendingAction instanceof _RowResizeAction&&t._pendingAction.saveNewState()&&t._addAction(t._pendingAction);t._pendingAction=null;t._resizingTriggered=!1}),this);this._owner.draggingRowColumn.addHandler((function(e,o){0!==t.stackSize&&t._owner.selectedSheet&&o.isShiftKey&&(o.isDraggingRows?t._pendingAction=new _RowsChangedAction(t._owner):t._pendingAction=new _ColumnsChangedAction(t._owner))}),this);this._owner.endDroppingRowColumn.addHandler((function(e,o){!o.cancel&&t._pendingAction&&t._pendingAction.saveNewState()&&t._addAction(t._pendingAction);t._pendingAction=null}),this);this._owner.sheets.collectionChanged.addHandler((function(e,o){if(o.action===wijmo_1.NotifyCollectionChangedAction.Remove){for(var i=0;i<t._stack.length;i++)if(t._stack[i].sheetUid===o.item._uid){t._stack.splice(i,1);i--}t._pointer=Math.min(t._pointer,t._stack.length-1)}}));this._owner.sheets.sheetCleared.addHandler((function(){return t.clear()}))}Object.defineProperty(UndoStack.prototype,"stackSize",{get:function(){return null==this._stackSize?this.MAX_STACK_SIZE:this._stackSize},set:function(e){wijmo_1.isNumber(e)&&(e<0?this._stackSize=0:e>this.MAX_STACK_SIZE?this._stackSize=this.MAX_STACK_SIZE:this._stackSize=Math.floor(e))},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canUndo",{get:function(){return this._pointer>-1&&this._pointer<this._stack.length},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canRedo",{get:function(){return this._pointer+1>-1&&this._pointer+1<this._stack.length},enumerable:!0,configurable:!0});UndoStack.prototype.onUndoStackChanged=function(e){this.undoStackChanged.raise(this,e)};UndoStack.prototype.undo=function(){if(this.canUndo){var e=this._stack[this._pointer];this._beforeUndoRedo(e);e.undo();this._pointer--;this.onUndoStackChanged()}};UndoStack.prototype.redo=function(){if(this.canRedo){this._pointer++;var e=this._stack[this._pointer];this._beforeUndoRedo(e);e.redo();this.onUndoStackChanged()}};UndoStack.prototype.clear=function(){this._stack.length=0;this._pointer=-1};UndoStack.prototype._addAction=function(e){this._stack.length>0&&this._stack.length>this._pointer+1&&this._stack.splice(this._pointer+1,this._stack.length-this._pointer-1);this._stack.length>=this.stackSize&&this._stack.splice(0,this._stack.length-this.stackSize+1);this._pointer=this._stack.length;this._stack.push(e);this.onUndoStackChanged()};UndoStack.prototype._pop=function(){if(this._pointer<0)return null;var e=this._stack[this._pointer];this._pointer--;return e};UndoStack.prototype._initCellEditAction=function(e,t){0!==this.stackSize&&this._owner.selectedSheet&&(this._pendingAction=new _EditAction(this._owner,t.range))};UndoStack.prototype._initCellEditActionForPasting=function(e,t){if(0!==this.stackSize&&this._owner.selectedSheet)if(this._owner._isCutting)this._pendingAction=new _CutAction(this._owner);else{this._pendingAction=new _EditAction(this._owner,t?t._rng:null);this._pendingAction.markIsPaste()}};UndoStack.prototype._afterProcessCellEditAction=function(e){if(e._pendingAction){e._pendingAction instanceof _EditAction&&e._pendingAction.saveNewState()&&e._addAction(this._pendingAction);e._pendingAction=null}};UndoStack.prototype._beforeUndoRedo=function(e){for(var t=this._owner.sheets,o=0;o<t.length;o++)if(t[o]._uid===e.sheetUid){this._owner.selectedSheetIndex=o;break}};return UndoStack}();exports.UndoStack=UndoStack;var FlexSheetValueFilterEditor=function(e){__extends(FlexSheetValueFilterEditor,e);function FlexSheetValueFilterEditor(){return null!==e&&e.apply(this,arguments)||this}Object.defineProperty(FlexSheetValueFilterEditor,"controlTemplate",{get:function(){FlexSheetValueFilterEditor._ctrlTemplate||(FlexSheetValueFilterEditor._ctrlTemplate=wijmo_grid_filter_1.ValueFilterEditor.controlTemplate);return FlexSheetValueFilterEditor._ctrlTemplate},set:function(e){FlexSheetValueFilterEditor._ctrlTemplate=e},enumerable:!0,configurable:!0});FlexSheetValueFilterEditor.prototype.updateEditor=function(){var t=this,o=this.filter.column,i=o.grid;if(this.filter.uniqueValues||null!=i.itemsSource&&null!=i.childItemsPath)e.prototype.updateEditor.call(this);else{this.filter.showIncludeSelection&&!this.hostElement.contains(this._lblIncludeSel)?this._divOptions.appendChild(this._lblIncludeSel):this.filter.showIncludeSelection||this._lblIncludeSel.remove();var n=i.filter._getValueFilters(o),l=this.filter.showValues;if(!l||0==Object.keys(l).length&&this._isSingleFilterMode())for(var r=0;r<n.length;r++)n[r].show=!0;else for(var s in l)for(var a=0;a<n.length;a++)if(l[s]&&""!==n[a].cellRef&&n[a].cellRef===l[s].cellRef){l[n[a].text]={show:!0,cellRef:n[a].cellRef};n[a].show=!0;n[a].text!=s&&delete l[s]}else if(n[a].text==s){n[a].show=!0;break}this._lbValues.isContentHtml=o.isContentHtml;this._cmbFilter.text=this.filter.filterText;var h=this._cmbFilter.text.toLowerCase();this._filterText=h;this._rxFilter=this._getSearchExp(h,this._getCaseSensitive());this._view.pageSize=this.filter.maxValues;this._view.sourceCollection=n;setTimeout((function(){t._adjustWidths()}),0)}};FlexSheetValueFilterEditor.prototype.updateFilter=function(){var e,t=null;e=this._isSingleFilterMode()?this._getItems():this._filter._allValues=wijmo_1.replaceItems(this._filter._allValues,this._view.sourceCollection);t=this._shouldIncludeSelection&&this.filter.showValues||null;if(!this._isSingleFilterMode()||this._filterText||this._cbSelectAll.indeterminate){t=t||{};for(var o=0;o<e.length;o++){var i=e[o];i.show&&(t[i.text]={show:!0,cellRef:i.cellRef})}}this._filter.showValues=t;this._filter.filterText=this._filterText};FlexSheetValueFilterEditor._ctrlTemplate="";return FlexSheetValueFilterEditor}(wijmo_grid_filter_1.ValueFilterEditor);exports.FlexSheetValueFilterEditor=FlexSheetValueFilterEditor;var FlexSheetConditionFilter=function(e){__extends(FlexSheetConditionFilter,e);function FlexSheetConditionFilter(t){return e.call(this,t)||this}FlexSheetConditionFilter.prototype.apply=function(e){var t,o,i,n,l=this.column,r=l.grid,s=this.condition1,a=this.condition2;if(!(r instanceof FlexSheet))return!0;if(!this.isActive)return!0;if(r.rows[e]instanceof wijmo_grid_1._NewRowTemplate)return!0;""===(t=r.getCellValue(e,l.index))&&l.dataType!==wijmo_1.DataType.String&&(t=null);o=i=t;if(n=this.dataMap||l.dataMap)o=i=t=n.getDisplayValue(t);else if(wijmo_1.isDate(t))(wijmo_1.isString(s.value)||wijmo_1.isString(a.value))&&(o=i=t=r.getCellValue(e,l.index,!0));else if(wijmo_1.isNumber(t)){o=i=t=wijmo_1.Globalize.parseFloat(r.getCellValue(e,l.index,!0));if(0===t&&!l.dataType){s.isActive&&""===s.value&&(o=t.toString());a.isActive&&""===a.value&&(i=i.toString())}}else if(null==t){s.isActive&&wijmo_1.isNumber(s.value)&&(o=NaN);a.isActive&&wijmo_1.isNumber(a.value)&&(i=NaN)}var h=s.apply(o),u=a.apply(i);return s.isActive&&a.isActive?this.and?h&&u:h||u:s.isActive?h:!a.isActive||u};return FlexSheetConditionFilter}(wijmo_grid_filter_1.ConditionFilter);exports.FlexSheetConditionFilter=FlexSheetConditionFilter;var FlexSheetValueFilter=function(e){__extends(FlexSheetValueFilter,e);function FlexSheetValueFilter(t){return e.call(this,t)||this}FlexSheetValueFilter.prototype.apply=function(e){var t,o=this.column.grid;if(!(o instanceof FlexSheet))return!0;if(!this.isActive)return!0;if(o.rows[e]instanceof wijmo_grid_1._NewRowTemplate)return!0;e=(t=this.dataMap||this.column.dataMap)?t.getDisplayValue(o.getCellValue(e,this.column.index)):o.getCellValue(e,this.column.index,!0);return null!=this.showValues[e]};FlexSheetValueFilter.prototype.setInitialAllValues=function(){var e=this.column.grid.filter._getValueFilters(this.column,!1);this._allValues=this.updateShowStatus(e)};return FlexSheetValueFilter}(wijmo_grid_filter_1.ValueFilter);exports.FlexSheetValueFilter=FlexSheetValueFilter;var FlexSheetColumnFilter=function(e){__extends(FlexSheetColumnFilter,e);function FlexSheetColumnFilter(t,o){var i=e.call(this,t,o)||this;i._valueFilter=new FlexSheetValueFilter(o);i._valueFilter.setColumnFilter(i);i._valueFilter.exclusiveValueSearch=t.exclusiveValueSearch;i._valueFilter.showIncludeSelection=t.showIncludeSelection;i._conditionFilter=new FlexSheetConditionFilter(o);i._conditionFilter.setColumnFilter(i);t._showIncludeSelectionChanged.addHandler((function(e){i._valueFilter.showIncludeSelection=e.showIncludeSelection}));return i}return FlexSheetColumnFilter}(wijmo_grid_filter_1.ColumnFilter);exports.FlexSheetColumnFilter=FlexSheetColumnFilter;var FlexSheetColumnFilterEditor=function(e){__extends(FlexSheetColumnFilterEditor,e);function FlexSheetColumnFilterEditor(t,o,i){void 0===i&&(i=!0);var n=this;wijmo_grid_filter_1.ColumnFilterEditor.isCustomedTemplate(FlexSheetColumnFilterEditor.controlTemplate)&&(o.filterMode===wijmo_grid_filter_1.FilterMode.MultiFilter?FlexSheetColumnFilterEditor.controlTemplate=wijmo_grid_filter_1.ColumnFilterEditor._multiFilterTemplate:FlexSheetColumnFilterEditor.controlTemplate=wijmo_grid_filter_1.ColumnFilterEditor._singleFilterTemplate);n=e.call(this,t,o,i)||this;i&&(n._divSort.style.display="");n._btnSortAsc=n.cloneElement(n._btnAsc);n._btnSortDsc=n.cloneElement(n._btnDsc);n._btnAsc.parentNode.replaceChild(n._btnSortAsc,n._btnAsc);n._btnDsc.parentNode.replaceChild(n._btnSortDsc,n._btnDsc);n._btnSortAsc.addEventListener("click",(function(e){n._sortBtnClick(e,!0)}));n._btnSortDsc.addEventListener("click",(function(e){n._sortBtnClick(e,!1)}));n._updateSortButtonStateUnbound();return n}Object.defineProperty(FlexSheetColumnFilterEditor,"controlTemplate",{get:function(){FlexSheetColumnFilterEditor._ctrlTemplate||(FlexSheetColumnFilterEditor._ctrlTemplate=wijmo_grid_filter_1.ColumnFilterEditor.controlTemplate);return FlexSheetColumnFilterEditor._ctrlTemplate},set:function(e){FlexSheetColumnFilterEditor._ctrlTemplate=e},enumerable:!0,configurable:!0});FlexSheetColumnFilterEditor.prototype._showFilter=function(t){var o=this;if(t==wijmo_grid_filter_1.FilterType.Value&&null==this._edtVal||this.filter.filterMode===wijmo_grid_filter_1.FilterMode.MultiFilter){this._edtVal=new FlexSheetValueFilterEditor(this._divEdtVal,this.filter.valueFilter);this.filter.filterMode!==wijmo_grid_filter_1.FilterMode.MultiFilter&&this._edtVal.canApplyChanged.addHandler((function(){wijmo_1.enable(o._btnApply,o._edtVal.canApply)}))}e.prototype._showFilter.call(this,t)};FlexSheetColumnFilterEditor.prototype._sortBtnClick=function(e,t){var o,i,n=this.filter.column,l=n.grid.sortManager,r=this.filter.column.grid,s=this.hostElement["$WJ-OWNR"]&&this.hostElement["$WJ-OWNR"]["wj-cell-index"];e.preventDefault();e.stopPropagation();if(s){var a=s.panel,h=s.rng;null===h&&(h=new wijmo_grid_1.CellRange(s.row,s.col,s.row,s.col));var u=new wijmo_grid_1.CellRangeEventArgs(a,h,e);if(r.onSortingColumn(u)){if((o=l.checkSortItemExists(n.index))>-1){l.sortDescriptions.moveCurrentToPosition(o);l.sortDescriptions.currentItem.ascending=t;i=-o}else{l.addSortLevel(n.index,t);i=-(l.sortDescriptions.items.length-1)}l.moveSortLevel(i);l.commitSort();r.onSortedColumn(u)}}this.onButtonClicked()};FlexSheetColumnFilterEditor.prototype.cloneElement=function(e){for(var t=e.cloneNode();e.firstChild;)t.appendChild(e.lastChild);return t};FlexSheetColumnFilterEditor.prototype._updateSortButtonStateUnbound=function(){var e=this.filter.column;if(e&&e.grid&&e.grid.selectedSheet)for(var t=e.grid.selectedSheet._unboundSortDesc,o=0;o<t.length;o++)if(t[o].column===e){wijmo_1.toggleClass(this._btnSortAsc,wijmo_1.ControlStateClsNames.active,!0===t[o].ascending);wijmo_1.toggleClass(this._btnSortDsc,wijmo_1.ControlStateClsNames.active,!1===t[o].ascending);break}};FlexSheetColumnFilterEditor._ctrlTemplate="";return FlexSheetColumnFilterEditor}(wijmo_grid_filter_1.ColumnFilterEditor);exports.FlexSheetColumnFilterEditor=FlexSheetColumnFilterEditor;var FlexSheetFilter=function(e){__extends(FlexSheetFilter,e);function FlexSheetFilter(){return null!==e&&e.apply(this,arguments)||this}Object.defineProperty(FlexSheetFilter.prototype,"filterDefinition",{get:function(){for(var e={filters:[]},t=0;t<this._filters.length;t++){var o=this._filters[t];if(o&&o.column&&this.grid.columns.indexOf(o.column)>-1)if(o.conditionFilter.isActive){var i=o.conditionFilter;e.filters.push({columnIndex:o.column.index,type:"condition",condition1:{operator:i.condition1.operator,value:i.condition1.value},and:i.and,condition2:{operator:i.condition2.operator,value:i.condition2.value}})}else if(o.valueFilter.isActive){var n=o.valueFilter;e.filters.push({columnIndex:o.column.index,type:"value",filterText:n.filterText,showValues:n.showValues})}}return JSON.stringify(e)},set:function(e){var t=JSON.parse(wijmo_1.asString(e));this.clear();for(var o=0;o<t.filters.length;o++){var i=t.filters[o],n=this.grid.columns[i.columnIndex],l=this.getColumnFilter(n,!0);if(l)switch(i.type){case"condition":var r=l.conditionFilter;r.condition1.value=n.dataType==wijmo_1.DataType.Date?wijmo_1.changeType(i.condition1.value,n.dataType,null):i.condition1.value;r.condition1.operator=i.condition1.operator;r.and=i.and;r.condition2.value=n.dataType==wijmo_1.DataType.Date?wijmo_1.changeType(i.condition2.value,n.dataType,null):i.condition2.value;r.condition2.operator=i.condition2.operator;break;case"value":var s=l.valueFilter;s.filterText=i.filterText;s.showValues=i.showValues}}this.apply()},enumerable:!0,configurable:!0});FlexSheetFilter.prototype.apply=function(){var e=this;this.grid.deferUpdate((function(){for(var t,o,i,n=-1,l=0;l<e.grid.rows.length;l++){var r=!1;if(!((t=e.grid.rows[l])instanceof HeaderRow||l<=n)){n=-1;var s=e.excludedRowsSet;if(!e.reApplyFilterOnUpdate&&s.has(t.dataItem||t)){o=!0;r=!0}r||(o=e._filter(l));if(t instanceof wijmo_grid_1.GroupRow&&!t.isSummary){i=t.getCellRange();e.grid.groupSummaryPosition===wijmo_grid_1.GroupSummaryPosition.Auto&&i.row2--;if(null==t.dataItem||t.dataItem instanceof wijmo_1.CollectionViewGroup)t.visible=e._checkGroupVisible(i);else{t.visible=o;n=i.bottomRow;if(i.isValid)for(var a=i.topRow;a<=i.bottomRow;a++)e.grid.rows[a].visible=o}}else if(t instanceof wijmo_grid_1.GroupRow&&t.isSummary){a=l-1;for(var h=t.dataItem;a>=0;a--){var u=e.grid.rows[a],d=u.dataItem;if(u instanceof wijmo_grid_1.GroupRow&&!u.isSummary&&d.groupDescription==h.groupDescription&&d.name==h.name)break}a>=0&&(t.visible=e.grid.rows[a].visible)}else t.visible=o}}e.grid._isCopying||e.grid._isUndoing||e.grid._isSorting||e.onFilterApplied()}))};FlexSheetFilter.prototype.editColumnFilter=function(e,t){var o=this,i=this.grid;this.closeEditor();e=this._asColumn(e);var n=document.createElement("div"),l=this.getColumnFilter(e),r=new FlexSheetColumnFilterEditor(n,l,this.showSortButtons);wijmo_1.addClass(n,wijmo_input_1.DropDownClsNames.dropDownPanel);this._divEdt=n;this._edtCol=e;var s=new wijmo_grid_1.CellRangeEventArgs(i.cells,new wijmo_grid_1.CellRange(-1,e.index));this.onFilterChanging(s);if(s.cancel){this._divEdt=null;this._edtCol=null}else{s.cancel=!0;i.undoStack.stackSize>0&&(this._undoAcion=new _FilteringAction(i));i.rightToLeft&&(n.dir="rtl");r.filterChanged.addHandler((function(){s.cancel=!1;o._filterChanged=!0;setTimeout((function(){if(!s.cancel){o.excludedRowsSet=null;o.apply();if(o._undoAcion){o._undoAcion.saveNewState();i.undoStack._addAction(o._undoAcion);o._undoAcion=null}}}))}));r.buttonClicked.addHandler((function(){o.closeEditor();i.focus();o.onFilterChanged(s)}));r.lostFocus.addHandler((function(){setTimeout((function(){var e=wijmo_1.Control.getControl(o._divEdt);e&&!e.containsFocus()&&o.closeEditor()}),10)}));i._edtHdl._commitRowEdits();i.scrollIntoView(-1,e.index,!0);var a=this.grid.columnHeaders,h=t?t.row:a.rows.length-1,u=t?t.col:e.index,d=a.getCellBoundingRect(h,u),_=wijmo_1.deepElementFromPoint(d.left+d.width/2,d.top+d.height/2);(_=wijmo_1.closest(_,"."+wijmo_grid_1.FlexGridClsNames.cell))?wijmo_1.showPopup(n,_,!1,!1,!1):wijmo_1.showPopup(n,d);this._setAriaExpanded(_,!0);this._setAriaExpanded(i.cells.getCellElement(-1,u),!0);for(var c=r.hostElement.querySelectorAll("input"),g=0;g<c.length;g++){var f=c[g];if(f.offsetHeight>0&&f.tabIndex>-1&&!f.disabled){f.focus();break}}r.containsFocus()||r.focus()}};FlexSheetFilter.prototype._updateColumnFilter=function(e){e=this._asColumn(e);var t=this.getColumnFilter(e,!1),o=null!=t?t.valueFilter:null;if(o&&o.isActive){var i=this._getValueFilters(e),n=o.showValues;if(i&&i.length>0){for(var l in n)for(var r=0;r<i.length;r++){if(n[l]&&isSameRow(i[r].cellRef,n[l].cellRef)){n[i[r].text]={show:!0,cellRef:i[r].cellRef};i[r].text!=l&&delete n[l];break}if(i[r].text==l){n[l].show=!0;break}}o.showValues=n}}function isSameRow(e,t){return!(!e||!t)&&e.split("_")[0]===t.split("_")[0]}};FlexSheetFilter.prototype._getValueFilters=function(e,t){void 0===t&&(t=!0);var o=this.getColumnFilter(e,!1),i=o.valueFilter,n=e.grid,l=e.index,r=[],s={};if(i.uniqueValues||null!=n.itemsSource&&null!=n.childItemsPath)r=i.getUniqueValues(!0);else for(var a=0;a<n.rows.length;a++){var h=n.rows[a];if(!(h instanceof HeaderRow||h instanceof wijmo_grid_1.GroupRow||h instanceof wijmo_grid_1._NewRowTemplate)){if(t){var u=i.showValues,d=o.conditionFilter,_=d.condition1.operator,c=d.condition2.operator;i.showValues=null;if(o.filterMode===wijmo_grid_filter_1.FilterMode.SingleFilter){d.condition1.operator=null;d.condition2.operator=null}var g=n.filter._filter(a);i.showValues=u;if(o.filterMode===wijmo_grid_filter_1.FilterMode.SingleFilter){d.condition1.operator=_;d.condition2.operator=c}if(!h.visible&&!g)continue;if(!h.visible&&i.apply(a)&&d.apply(a))continue}var f=a,p=l,m=n.getMergedRange(n.cells,f,p);if(m){if(m.leftCol!==l)continue;f=m.topRow;p=m.leftCol}var w=n.getCellValue(f,p),C=void 0;C=i.dataMap?i.dataMap.getDisplayValue(w):n.getCellValue(f,p,!0);w=""===w?null:w;var S=n.getCellData(f,p,!0),b=void 0;if(!s[C]){s[C]=!0;b=S&&"="===S[0]?a+"_"+l:"";r.push({value:w,text:C,cellRef:b})}}}return r};FlexSheetFilter.prototype.closeEditor=function(){this._undoAcion&&!this._filterChanged&&(this._undoAcion=null);e.prototype.closeEditor.call(this)};FlexSheetFilter.prototype.getColumnFilter=function(e,t){void 0===t&&(t=!0);if(e=this._asColumn(e)){for(var o=0;o<this._filters.length;o++)if(this._filters[o].column==e)return this._filters[o];if(t){var i=new FlexSheetColumnFilter(this,e);this._filters.push(i);return i}}return null};FlexSheetFilter.prototype._isActive=function(){var e=this;return this._filters.some((function(t){return t.column&&(t.conditionFilter.isActive||t.valueFilter.isActive)&&e.grid.columns.indexOf(t.column)>=0}))};FlexSheetFilter.prototype._isEditorOpened=function(){return!!this._divEdt};FlexSheetFilter.prototype._checkGroupVisible=function(e){for(var t,o=!0,i=e.topRow+1;i<=e.bottomRow;i++)if(t=this.grid.rows[i])if(t instanceof wijmo_grid_1.GroupRow&&!t.isSummary)o=this._checkGroupVisible(t.getCellRange());else if(o=this._filter(i))break;return o};return FlexSheetFilter}(wijmo_grid_filter_1.FlexGridFilter);exports.FlexSheetFilter=FlexSheetFilter;var _SmartTag=function(e){__extends(_SmartTag,e);function _SmartTag(t,o,i,n){var l=e.call(this,t)||this;l.CopyCells=AutoFillOperation.CopyFormat|AutoFillOperation.CopyContent;l.FillSeries=AutoFillOperation.CopyFormat|AutoFillOperation.FillSeries;l.FillFormat=AutoFillOperation.CopyFormat;l.FillWithoutFormat=AutoFillOperation.FillSeries;l.FullWidth=32;l.CompactWidth=18;l._uiEventHdl=l._onUIEvent.bind(l);l.operationSelected=new wijmo_1.Event;l.cancelled=new wijmo_1.Event;l._owner=o;l._op=i;var r=l.getTemplate();l.applyTemplate(exports._SmartTagClsNames.hostElement,r,{_icon:"icon",_btnMenu:"btn-menu"});var s=l._getPos();wijmo_1.setCss(l.hostElement,{left:s.x,top:s.y});l.addEventListener(l.hostElement,"mouseover",(function(){l.hostElement.style.width=l.FullWidth+"px";l._btnMenu.style.display=""}));l.addEventListener(l.hostElement,"mouseleave",(function(){if(!l._menu){l.hostElement.style.width=l.CompactWidth+"px";l._btnMenu.style.display="none"}}));l.addEventListener(l.hostElement,"mousedown",(function(e){e.preventDefault();l._showFillOpMenu()}),!0);l.addEventListener(document.body,"mousedown",l._uiEventHdl,!0);l.addEventListener(document.body,"keydown",l._uiEventHdl,!0);l.initialize(n);return l}Object.defineProperty(_SmartTag,"controlTemplate",{get:function(){_SmartTag._ctrlTemplate||(_SmartTag._ctrlTemplate='<img wj-part="icon" style="float:left; height: 18; margin: 0" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAFJJREFUeNrclEEKACAIBOfp/Xy7i4WSRnRYBIVRVhFJVIhyEAxllQa5E/wBSnsU6Rza2nugqNmASi57C/KKNg/Iqn+iVWzx6M4bOdUEAAD//wMAAYRMfiNaiqEAAAAASUVORK5CYII=" /><img wj-part="btn-menu" style="float:left; height: 18; margin: 0; display: none" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAASCAYAAACXScT7AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAGCSURBVHjafNFPKKRxHAbw5/v7GYdBYUQjLm5SkoNykCQHtcx431/KgdKumJvSrAO7Nwc3RQ5kd3OkHJC/hUJREluonVcToqRh3sRFPA6M1Mbhc3z6Pj1fkMRHQNJL0uPeul731lU37o1y49cqHr8GvvgWQRLBsmpM/P0j4XAXiooKcXl1CZDEzl4EJBEwAZBUwWAQsVgsFSRR11gmM8trimSa3WypzZ31l5v2/vfk/4oAcv9aSGyUSz4gg/AIAOET0YQswIQWaNrnH+2OeSaY0BJN2+wDTi/OpCrwkxX1vW8q63p5cnaaB+Z/09u7x0nFJTVMiEajPsNCQaC6Ryb8THKcw/Tikho6zj//0RGUNV6gMZ1H8fmpH5iTHDlwsiOhO7FrN5RdP6aBIUj/pvJ2bkFbkxAzBzELELNCQQqgrJ5ST1/jqmYOJcHa7dYYGV5TrQ3d+vfUU+b7IfrOIRCGBYD0o1VGmaHaB6DZkqvMD2hUfF1UAISkvE/+yqbCZ89+HgBtwgFOrBUzJgAAAABJRU5ErkJggg==" />');return _SmartTag._ctrlTemplate},set:function(e){_SmartTag._ctrlTemplate=e},enumerable:!0,configurable:!0});_SmartTag.prototype.dispose=function(){this.removeEventListener(document.body,"mousedown",this._uiEventHdl,!0);this.removeEventListener(document.body,"keydown",this._uiEventHdl,!0);e.prototype.dispose.call(this)};Object.defineProperty(_SmartTag.prototype,"operation",{get:function(){return this._op},enumerable:!0,configurable:!0});_SmartTag.prototype.onOperationSelected=function(e){this.operationSelected.raise(this,e)};_SmartTag.prototype.onCancelled=function(e){this.cancelled.raise(this,e)};_SmartTag.prototype._getPos=function(){var e=this._owner,t=e._root,o=e.selection,i=e.cells.getCellBoundingRect(o.bottomRow,o.rightCol,!0),n=e.cells.hostElement,l=i.right+n.offsetLeft,r=i.bottom+n.offsetTop;l+e._ptScrl.x+32+(n.offsetHeight>t.offsetHeight?17:0)>t.offsetWidth&&(l-=32);r+e._ptScrl.y+18+(n.offsetWidth>t.offsetWidth?17:0)>t.offsetHeight&&(r-=18);return new wijmo_1.Point(l,r)};_SmartTag.prototype._showFillOpMenu=function(){var e=this,t=wijmo_1.culture.FlexSheet;this._menu=new wijmo_input_1.Menu(document.createElement("div"),{displayMemberPath:"item",selectedValuePath:"op",dropDownCssClass:exports._SmartTagClsNames.flexSheetFillMenu,openOnHover:!1,closeOnLeave:!1,itemsSource:[{item:t.copyCells,op:this.CopyCells,checked:this._op===this.CopyCells},{item:t.fillSeries,op:this.FillSeries,checked:this._op===this.FillSeries},{item:t.fillFormat,op:this.FillFormat,checked:this._op===this.FillFormat},{item:t.fillWithoutFormat,op:this.FillWithoutFormat,checked:this._op===this.FillWithoutFormat}],selectedValue:this._op,itemClicked:function(t){e._op=t.selectedValue;e.onOperationSelected()}});this._menu.listBox.checkedMemberPath="checked";this._menu.show(this.hostElement);this._menu.selectedValue=this._op};_SmartTag.prototype._onUIEvent=function(e){var t=e.target,o=wijmo_1.contains(this.hostElement,t),i=this._menu&&wijmo_1.contains(this._menu.listBox.hostElement,t),n=o||i;n&&e instanceof KeyboardEvent&&(n=i&&(e.keyCode==wijmo_1.Key.Down||e.keyCode==wijmo_1.Key.Up||e.keyCode==wijmo_1.Key.Enter||e.keyCode==wijmo_1.Key.Escape));n||this.onCancelled()};_SmartTag._ctrlTemplate="";return _SmartTag}(wijmo_1.Control);exports._SmartTag=_SmartTag;var _FlexSheetSelectionHandler=function(e){__extends(_FlexSheetSelectionHandler,e);function _FlexSheetSelectionHandler(t){var o=this,i=t.selectionMode;(o=e.call(this,t)||this)._mode=i;o._fs=t;return o}_FlexSheetSelectionHandler.prototype.moveSelection=function(t,o,i){var n=this._fs;!i&&n._lastSelMovePos&&this.selection.copy(n._lastSelMovePos);n._lastSelMovePos=null;e.prototype.moveSelection.call(this,t,o,i)};return _FlexSheetSelectionHandler}(wijmo_grid_1._SelectionHandler);exports._FlexSheetSelectionHandler=_FlexSheetSelectionHandler;var DefinedName=function(){function DefinedName(e,t,o,i){this._owner=e;this._name=t;this._value=o;if(null!=i){if(!e._validateSheetName(i))throw"The sheet name:("+i+") does not exist in FlexSheet.";this._sheetName=i}}Object.defineProperty(DefinedName.prototype,"name",{get:function(){return this._name},set:function(e){if(this._name!==e){if(this._owner.definedNames._find(e,this._sheetName,-1,!0))throw"The "+e+" already existed in definedNames.";var t=this._name;this._name=e;this._owner._updateFormulasWithNameUpdating(t,this._name)}},enumerable:!0,configurable:!0});Object.defineProperty(DefinedName.prototype,"value",{get:function(){return this._value},set:function(e){this._value!==e&&(this._value=e)},enumerable:!0,configurable:!0});Object.defineProperty(DefinedName.prototype,"sheetName",{get:function(){return this._sheetName},enumerable:!0,configurable:!0});return DefinedName}();exports.DefinedName=DefinedName;var DefinedNameCollection=function(e){__extends(DefinedNameCollection,e);function DefinedNameCollection(t){var o=e.call(this)||this;o._owner=t;o.collectionChanged.addHandler((function(e,t){if(t.action===wijmo_1.NotifyCollectionChangedAction.Add||t.action===wijmo_1.NotifyCollectionChangedAction.Change){var i=t.action===wijmo_1.NotifyCollectionChangedAction.Add?"inserted":"updated";if(!(t.item instanceof DefinedName)){o.remove(t.item);throw"Invalid defined name item object was "+i+". The DefinedName instance should be "+i+" in the definedNames array."}if(!t.item||!t.item.name||null==t.item.value){o.remove(t.item);throw"Invalid defined name was "+i+"."}if(null!=t.item.sheetName&&!o._owner._validateSheetName(t.item.sheetName)){o.remove(t.item);throw"The sheet name ("+t.item.sheetName+") does not exist in FlexSheet."}if(o._find(t.item.name,t.item.sheetName,t.index,!0)){o.remove(t.item);throw"The "+t.item.name+" already existed in definedNames."}}}));return o}DefinedNameCollection.prototype._find=function(e,t,o,i){void 0===o&&(o=-1);void 0===i&&(i=!1);var n=null;t=t?t.toLowerCase():t;e=e?e.toLowerCase():e;for(var l=0;l<this.length;l++){var r=this[l];if(r.name.toLowerCase()===e&&l!==o)if(r.sheetName){if(r.sheetName.toLowerCase()===t)return r}else{if(i&&t)continue;n=r}}return n};DefinedNameCollection.prototype._getIndexByName=function(e){for(var t=0;t<this.length;t++)if(this[t].name===e)return t;return-1};DefinedNameCollection.prototype._updateSheetName=function(e,t){for(var o=e.toLowerCase(),i=0;i<this.length;i++){var n=this[i];if(null!=n.sheetName&&n.sheetName.toLowerCase()===o){n._sheetName=t;n.value=n.value.replaceAll(e,t)}var l=n.value.match(/(\w+)!\$?[A-Za-z]+\$?\d+/g);if(l&&l.length>0)for(var r=0;r<l.length;r++){var s=l[r];s.substring(0,s.indexOf("!"))===e&&(n.value=n.value.replace(s,s.replace(e,t)))}}};return DefinedNameCollection}(wijmo_1.ObservableArray);exports.DefinedNameCollection=DefinedNameCollection;var _ContextMenu=function(e){__extends(_ContextMenu,e);function _ContextMenu(t,o){var i=e.call(this,t)||this;i._idx=-1;i._owner=o;return i}Object.defineProperty(_ContextMenu.prototype,"visible",{get:function(){return"none"!==this.hostElement.style.display},enumerable:!0,configurable:!0});_ContextMenu.prototype.show=function(e,t){if(this._owner.selectedSheet){this._owner.finishEditing();var o=(t?t.x:e.clientX)+(e?window.pageXOffset:0),i=(t?t.y:e.clientY)+(e?window.pageYOffset:0);this.hostElement.style.position="absolute";this.hostElement.style.display="inline";i+this.hostElement.clientHeight>window.innerHeight+(e?window.pageYOffset:0)&&(i-=this.hostElement.clientHeight);o+this.hostElement.clientWidth>window.innerWidth+(e?window.pageXOffset:0)&&(o-=this.hostElement.clientWidth);this.hostElement.style.top=i+"px";this.hostElement.style.left=o+"px"}};_ContextMenu.prototype.hide=function(){this._idx=-1;var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this.hostElement.style.display="none"};_ContextMenu.prototype.moveToNext=function(){var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this._idx++;for(;e[this._idx]&&("none"===e[this._idx].style.display||wijmo_1.hasClass(e[this._idx],wijmo_1.ControlStateClsNames.disabled));)this._idx++;this._idx>=e.length&&(this._idx=0);wijmo_1.addClass(e[this._idx],exports._ContextMenuClsNames.contextMenuItemSelected)};_ContextMenu.prototype.moveToPrev=function(){var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this._idx--;this._idx<0&&(this._idx=e.length-1);for(;this._idx>0&&("none"===e[this._idx].style.display||wijmo_1.hasClass(e[this._idx],wijmo_1.ControlStateClsNames.disabled));)this._idx--;wijmo_1.addClass(e[this._idx],exports._ContextMenuClsNames.contextMenuItemSelected)};_ContextMenu.prototype.moveToFirst=function(){var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this._idx=0;wijmo_1.addClass(e[this._idx],exports._ContextMenuClsNames.contextMenuItemSelected)};_ContextMenu.prototype.moveToLast=function(){var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this._idx=e.length-1;e[this._idx]&&"none"===e[this._idx].style.display&&this._idx--;wijmo_1.addClass(e[this._idx],exports._ContextMenuClsNames.contextMenuItemSelected)};_ContextMenu.prototype.handleContextMenu=function(){if(-1===this._idx)this.moveToNext();else{var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._handleMenuItemOperation(e);this.hide();this._owner.hostElement.focus()}};_ContextMenu.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this._localize()};_ContextMenu.prototype._init=function(){var e=this,t=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this.hostElement.style.zIndex="9999";document.body.appendChild(this.hostElement);this.addEventListener(document.body,"mousemove",(function(){e._removeSelectedState(t)}));this.addEventListener(this.hostElement,"contextmenu",(function(e){e.preventDefault()}));this._localize()};_ContextMenu.prototype._handleMenuItemOperation=function(e){};_ContextMenu.prototype._localize=function(){};_ContextMenu.prototype._removeSelectedState=function(e){for(var t=0;t<e.length;t++)wijmo_1.removeClass(e[t],exports._ContextMenuClsNames.contextMenuItemSelected)};return _ContextMenu}(wijmo_1.Control);exports._ContextMenu=_ContextMenu;var _SheetContextMenu=function(e){__extends(_SheetContextMenu,e);function _SheetContextMenu(t,o){var i=e.call(this,t,o)||this;i._isDisableDelRow=!1;i._isDisableConvertTable=!1;i.applyTemplate("",i.getTemplate(),{_insRows:"insert-rows",_delRows:"delete-rows",_insCols:"insert-columns",_delCols:"delete-columns",_splitter:"splitter",_convertTable:"convert-table"});i._init();return i}Object.defineProperty(_SheetContextMenu,"controlTemplate",{get:function(){_SheetContextMenu._ctrlTemplate||(_SheetContextMenu._ctrlTemplate='<div class="'+exports._ContextMenuClsNames.hostElement+" "+wijmo_1.ControlClsNames.hostElement+" "+exports._ContextMenuClsNames.flexSheetContextMenu+'" width="150px"><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="insert-rows"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="delete-rows"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="insert-columns"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="delete-columns"></div><div class='+wijmo_1.ControlStateClsNames.disabled+' wj-part="splitter" style="width:100%;height:1px;background-color:lightgray;"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="convert-table"></div></div>');return _SheetContextMenu._ctrlTemplate},set:function(e){_SheetContextMenu._ctrlTemplate=e},enumerable:!0,configurable:!0});_SheetContextMenu.prototype.show=function(t,o){if(this._owner.selectedSheet){if(this._owner._isDisableDeleteRow(this._owner.selection.topRow,this._owner.selection.bottomRow)){this._isDisableDelRow=!0;wijmo_1.addClass(this._delRows,wijmo_1.ControlStateClsNames.disabled)}this._showTableOperation();if(!this._owner.selection.isValid){this._isDisableConvertTable=!0;wijmo_1.addClass(this._convertTable,wijmo_1.ControlStateClsNames.disabled)}e.prototype.show.call(this,t,o)}};_SheetContextMenu.prototype.hide=function(){e.prototype.hide.call(this);this._isDisableDelRow=!1;this._isDisableConvertTable=!1;wijmo_1.removeClass(this._delRows,wijmo_1.ControlStateClsNames.disabled);wijmo_1.removeClass(this._convertTable,wijmo_1.ControlStateClsNames.disabled)};_SheetContextMenu.prototype._init=function(){var t=this;e.prototype._init.call(this);this.addEventListener(this._insRows,"click",(function(e){t._owner.insertRows();t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._delRows,"click",(function(e){t._isDisableDelRow||t._owner.deleteRows();t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._insCols,"click",(function(e){t._owner.insertColumns();t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._delCols,"click",(function(e){t._owner.deleteColumns();t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._convertTable,"click",(function(e){t._isDisableConvertTable||t._addTable();t.hide();t._owner.hostElement.focus()}))};_SheetContextMenu.prototype._handleMenuItemOperation=function(e){switch(e[this._idx]){case this._insCols:this._owner.insertColumns();break;case this._insRows:this._owner.insertRows();break;case this._delCols:this._owner.deleteColumns();break;case this._delRows:this._isDisableDelRow||this._owner.deleteRows();break;case this._convertTable:this._addTable()}};_SheetContextMenu.prototype._localize=function(){e.prototype._localize.call(this);var t=wijmo_1.culture.FlexSheet;this._insRows.textContent=t.insertRow;this._delRows.textContent=t.deleteRow;this._insCols.textContent=t.insertCol;this._delCols.textContent=t.deleteCol;this._convertTable.textContent=t.convertTable};_SheetContextMenu.prototype._showTableOperation=function(){for(var e=this._owner.selection,t=e.topRow;t<=e.bottomRow;t++)for(var o=e.leftCol;o<=e.rightCol;o++){if(null!=this._owner.selectedSheet.findTable(t,o)){this._convertTable.style.display="none";this._splitter.style.display="none";return}}if(e.isSingleCell||this._owner._containsMergedCells(e)){this._convertTable.style.display="none";this._splitter.style.display="none"}else{this._convertTable.style.display="";this._splitter.style.display=""}};_SheetContextMenu.prototype._addTable=function(){var e=this._owner.selectedSheet._addTable(this._owner.selection);if(e){if(0===this._owner.undoStack.stackSize)return;var t=new _TableAction(this._owner,e);this._owner.undoStack._addAction(t)}};_SheetContextMenu._ctrlTemplate="";return _SheetContextMenu}(_ContextMenu);exports._SheetContextMenu=_SheetContextMenu;var _SheetTabContextMenu=function(e){__extends(_SheetTabContextMenu,e);function _SheetTabContextMenu(t,o){var i=e.call(this,t,o)||this;i.applyTemplate("",i.getTemplate(),{_insSheet:"insert-sheet",_delSheet:"delete-sheet",_renameSheet:"rename-sheet"});i._init();return i}Object.defineProperty(_SheetTabContextMenu,"controlTemplate",{get:function(){_SheetTabContextMenu._ctrlTemplate||(_SheetTabContextMenu._ctrlTemplate='<div class="'+exports._ContextMenuClsNames.hostElement+" "+wijmo_1.ControlClsNames.hostElement+" "+exports._ContextMenuClsNames.flexSheetContextMenu+'" width="150px"><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="insert-sheet"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="delete-sheet"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="rename-sheet"></div><div>');return _SheetTabContextMenu._ctrlTemplate},set:function(e){_SheetTabContextMenu._ctrlTemplate=e},enumerable:!0,configurable:!0});_SheetTabContextMenu.prototype._init=function(){var t=this,o=wijmo_1.culture.FlexSheet;this._insSheet.textContent=o.insertSheet;this._delSheet.textContent=o.deleteSheet;this._renameSheet.textContent=o.renameSheet;e.prototype._init.call(this);this.addEventListener(this._insSheet,"click",(function(e){t._owner.addUnboundSheet(null,null,null,t._owner.selectedSheetIndex);t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._delSheet,"click",(function(e){t._owner.sheets.removeAt(t._owner.selectedSheetIndex);t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._renameSheet,"click",(function(e){t._owner._tabHolder.sheetControl._startEditingSheetName(t._owner.selectedSheetIndex);t.hide()}))};_SheetTabContextMenu.prototype._handleMenuItemOperation=function(e){switch(e[this._idx]){case this._insSheet:this._owner.addUnboundSheet(null,null,null,this._owner.selectedSheetIndex);break;case this._delSheet:this._owner.sheets.removeAt(this._owner.selectedSheetIndex);break;case this._renameSheet:this._owner._tabHolder.sheetControl._startEditingSheetName(this._owner.selectedSheetIndex)}};_SheetTabContextMenu.prototype._localize=function(){e.prototype._localize.call(this);var t=wijmo_1.culture.FlexSheet;this._insSheet.textContent=t.insertSheet;this._delSheet.textContent=t.deleteSheet;this._renameSheet.textContent=t.renameSheet};_SheetTabContextMenu._ctrlTemplate="";return _SheetTabContextMenu}(_ContextMenu);exports._SheetTabContextMenu=_SheetTabContextMenu;var Sheet=function(){function Sheet(e,t,o,i,n){var l=this;this._visible=!0;this._unboundSortDesc=new wijmo_1.ObservableArray;this._currentStyledCells={};this._currentMergedRanges=[];this._isEmptyGrid=!1;this._rowSettings=[];this._scrollPosition=new wijmo_1.Point;this._ownerHeaderRowRemoved=!1;this.workingAs="";this.nameChanged=new wijmo_1.Event;this.visibleChanged=new wijmo_1.Event;this._uuid=Sheet.GenId++;this._owner=e;this._name=o;this._sortList=[new ColumnSortDescription(-1,!0)];i=wijmo_1.isNumber(i)&&!isNaN(i)&&i>=0?i:200;n=wijmo_1.isNumber(n)&&!isNaN(n)&&n>=0?n:20;if(t){t.columns.forEach((function(e){e._orgHdr=e._hdr}));this._grid=t;this._addHeaderRow(!0)}else{this._grid=this._createGrid(i,n);this._owner&&(this._grid.validateEdits=this._owner.validateEdits)}this._grid.loadedRows.addHandler((function(){l._owner&&l._owner._checkCollectionsOwner();l._addHeaderRow();l._setRowSettings()}));this._grid.refreshed.addHandler((function(){l._owner&&l._owner._checkCollectionsOwner()}));this._grid.itemsSourceChanged.addHandler(this._gridItemsSourceChanged,this);this._unboundSortDesc.collectionChanged.addHandler((function(){for(var e=l._unboundSortDesc,t={},o=0;o<e.length;o++){if(!wijmo_1.tryCast(e[o],_UnboundSortDescription))throw"sortDescriptions array must contain SortDescription objects."}if(l._owner){l._owner.rows.beginUpdate();l._owner.rows.sort(l._compareRows());if(!l._owner._isUndoing){for(o=0;o<l._owner.rows.length;o++){var i=l._owner.rows[o];o!==i._idx&&l._owner._updateFormulaForReorderingRows(i._idx,o);l._owner._updateCellStyleForReorderingRows(i._idx,o,t)}l._currentStyledCells=t}l._owner.rows.endUpdate();l._owner.rows._dirty=!0;l._owner.rows._update();if(l._owner.selectedSheet){l._owner._copyTo(l._owner.selectedSheet);l._owner._copyFrom(l._owner.selectedSheet)}}}));this.tables.collectionChanged.addHandler((function(e,t){if(null!=t.item&&!(t.item instanceof Table))throw"The tables only allows to handle Table instance.";if(l._owner)if(t.action===wijmo_1.NotifyCollectionChangedAction.Add||t.action===wijmo_1.NotifyCollectionChangedAction.Change){if(t.item){var o=t.item,i=o._getTableRange(),n=l===l._owner.selectedSheet?l._owner:l.grid;try{if(i.topRow>=n.rows.length||i.leftCol>=n.columns.length)throw"";if(i.leftCol+i.columnSpan>n.columns.length)throw"";if(i.topRow+i.rowSpan>n.rows.length)throw"";for(var r=i.topRow;r<=i.bottomRow;r++)for(var s=i.leftCol;s<=i.rightCol;s++){if(l.findTable(r,s)!==o)throw""}o._attachSheet(l)}catch(e){l.tables.removeAt(t.index)}}}else t.action===wijmo_1.NotifyCollectionChangedAction.Remove&&t.item&&t.item._detachSheet()}))}Object.defineProperty(Sheet.prototype,"grid",{get:function(){null==this._grid.wj_sheetInfo&&(this._grid.wj_sheetInfo={});return this._grid},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"name",{get:function(){return this._name},set:function(e){if(!wijmo_1.isNullOrWhiteSpace(e)&&(this._name&&this._name.toLowerCase()!==e.toLowerCase()||!this._name)){var t=new wijmo_1.PropertyChangedEventArgs("sheetName",this._name,e);this._name=e;this.grid.wj_sheetInfo.name=e;this.onNameChanged(t)}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"visible",{get:function(){return this._visible},set:function(e){if(this._visible!==e){this._visible=e;this.grid.wj_sheetInfo.visible=e;this.onVisibleChanged(new wijmo_1.EventArgs)}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"rowCount",{get:function(){return null!=this._grid?this._grid.rows.length:0},set:function(e){if(!this.itemsSource){var t=this.grid.rows.length;if(wijmo_1.isNumber(e)&&!isNaN(e)&&e>=0&&t!==e){if(t<e)for(var o=0;o<e-t;o++)this.grid.rows.push(new wijmo_grid_1.Row);else this.grid.rows.splice(e,t-e);this._currentStyledCells=this._adjustStylesDict(this._currentStyledCells);this._owner&&this._owner.selectedSheet&&this._name===this._owner.selectedSheet.name&&this._owner._copyFrom(this)}}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"columnCount",{get:function(){return null!=this._grid?this._grid.columns.length:0},set:function(e){if(!this.itemsSource){var t=this.grid.columns.length;if(wijmo_1.isNumber(e)&&!isNaN(e)&&e>=0&&t!==e){if(t<e)for(var o=0;o<e-t;o++)this._grid.columns.push(new wijmo_grid_1.Column);else this._grid.columns.splice(e,t-e);this._currentStyledCells=this._adjustStylesDict(this._currentStyledCells);this._owner&&this._owner.selectedSheet&&this._name===this._owner.selectedSheet.name&&this._owner._copyFrom(this)}}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"selectionRanges",{get:function(){var e=this;if(!this._selectionRanges){this._selectionRanges=new wijmo_1.ObservableArray;this._selectionRanges.collectionChanged.addHandler((function(){if(e._owner&&!e._owner._isClicking){var t=e._selectionRanges.length;if(t>0){var o=e._selectionRanges[t-1];o&&o instanceof wijmo_grid_1.CellRange&&(e._owner.selection=o)}if(t>1){e._owner._enableMulSel=!0;e._owner.refresh(!1)}e._owner._enableMulSel=!1}}),this)}return this._selectionRanges},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"itemsSource",{get:function(){return null!=this._grid?this._grid.itemsSource:null},set:function(e){if(!this._grid||this._grid.itemsSource!=e){this._owner&&this._owner._isCopying||(this._dataView=null);this._isEmptyGrid&&this._clearGrid();this._grid.itemsSource=e}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"filterSetting",{get:function(){this._owner&&this===this._owner.selectedSheet&&this._getFilterSetting();return this._filterSetting},set:function(e){this._filterSetting=e;this._owner&&this===this._owner.selectedSheet&&this._applyFilterSetting()},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"tables",{get:function(){null==this._tables&&(this._tables=new wijmo_1.ObservableArray);return this._tables},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"_styledCells",{get:function(){this._currentStyledCells||(this._currentStyledCells={});this._currentStyledCells.columnCount=this.columnCount;this._currentStyledCells.rowCount=this.rowCount;return this._currentStyledCells},set:function(e){this._currentStyledCells=e},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"_uid",{get:function(){return this._uuid},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"_mergedRanges",{get:function(){this._currentMergedRanges||(this._currentMergedRanges=[]);return this._currentMergedRanges},enumerable:!0,configurable:!0});Sheet.prototype.onNameChanged=function(e){this.nameChanged.raise(this,e)};Sheet.prototype.onVisibleChanged=function(e){this.visibleChanged.raise(this,e)};Sheet.prototype.dispose=function(){this._clearGrid();this._grid.wj_sheetInfo=null;this._grid.dispose();this._grid=null;if(null!=this._tables){for(var e=0;e<this._tables.length;e++)this._tables[e]=null;this._tables=null}};Sheet.prototype.getCellStyle=function(e,t){var o=this._grid.rows.length,i=this._grid.columns.length;if(e>=o||t>=i)return null;var n=e*i+t;return this._styledCells[n]};Sheet.prototype.addTableFromArray=function(e,t,o,i,n,l,r,s){void 0===s&&(s=!0);var a=!1;if(this._owner){if(null==o||0===o.length)throw"Invalid array to load.";if(!(null!=i&&0!==i.length||null!=(i=Object.keys(o[0]))&&0!==i.length))throw"Invalid array to load.";if(e>=this.rowCount||t>=this.columnCount)return null;for(var h=null==(r&&r.showHeaderRow)||r.showHeaderRow,u=!(!r||!r.showTotalRow),d=e+(h?1:0),_=d+o.length-1+(u?1:0),c=[],g=this._flex,f=0;f<i.length;f++){var p=i[f],m=new TableColumn(p);0===f?m._totalRowLabel="Total":f===i.length-1&&(m._totalRowFunction="Sum");c.push(m)}var w=new wijmo_grid_1.CellRange(e,t,_,t+i.length-1),C=this._needShiftForTable(w);if(0!==C){if(!s)return null;if(!this._canShiftCells(w))return null;var S=this._needAddRowCountForAddTable(C,w);if(g.collectionView){var b=g.itemsSource instanceof wijmo_1.CollectionView;g.collectionView.beginUpdate();for(var v=0;v<S;v++)b?g.itemsSource.sourceCollection.push({}):g.itemsSource.push({});g.collectionView.endUpdate(!0)}else for(v=0;v<S;v++)g.rows.push(new wijmo_grid_1.Row);a=!0}if(t+i.length>=g.columns.length){if(!s)return null;var y=t+i.length-g.columns.length+1;if(this.itemsSource&&y>0)return null;g.columns.beginUpdate();for(v=0;v<y;v++)g.columns.push(new wijmo_grid_1.Column);g.columns.endUpdate()}g.beginUpdate();a&&this._moveDownCells(C,w);if(h)for(f=0;f<i.length;f++){p=i[f];g.setCellData(e,t+f,p)}for(var x=0;x<o.length;x++)for(f=0;f<i.length;f++){p=i[f];g.setCellData(d+x,t+f,o[x][p])}g.endUpdate();return this._addTable(w,n,l,c,r)}};Sheet.prototype.findTable=function(e,t){var o=this._tables;if(o&&o.length>0)for(var i=o.length,n=0;n<i;n++){var l=o[n],r=l._getTableRange();if(e>=r.topRow&&e<=r.bottomRow&&t>=r.leftCol&&t<=r.rightCol)return l}return null};Sheet.prototype._attachOwner=function(e){var t=this;if(this._owner!==e){this._owner=e;if(this._owner){var o=!1;this._owner.loadedRows.addHandler((function(){if(!o){o=!0;t._addHeaderRow()}}))}}};Sheet.prototype._setValidName=function(e){this._name=e;this.grid.wj_sheetInfo.name=e};Sheet.prototype._storeRowSettings=function(){if(this._owner){this._rowSettings=[];for(var e=0;e<this._grid.rows.length;e++){var t=this._owner.rows[e];t&&(this._rowSettings[e]={height:t.height,allowMerging:t.allowMerging,isCollapsed:t instanceof wijmo_grid_1.GroupRow?t.isCollapsed:null,visible:t.visible,isSelected:t.isSelected,readOnly:t.isReadOnly&&!(t instanceof HeaderRow)})}}};Sheet.prototype._setRowSettings=function(){for(var e=0;e<this._rowSettings.length;e++){var t=this._rowSettings[e];if(t){var o=this._grid.rows[e];if(o){var i=o instanceof HeaderRow;o.height=t.height;o.allowMerging=t.allowMerging;o.visible=t.visible;o instanceof wijmo_grid_1.GroupRow&&(o.isCollapsed=!!t.isCollapsed);o.isSelected=!!t.isSelected;o.isReadOnly=i||!!t.readOnly}}}};Sheet.prototype._addTable=function(e,t,o,i,n){if(!e.isValid||!this._owner)return null;null!=t&&null==this._owner._getTable(t)||(t=this._getUniqueTableName());var l=new Table(t,e,o,i,n);this.tables.push(l);return l};Sheet.prototype._addSelection=function(e){var t=this.selectionRanges;t.beginUpdate();for(var o=t.length-1;o>=0;o--)e.contains(t[o])&&t.removeAt(o);e.isValid&&t.push(e);t.endUpdate()};Object.defineProperty(Sheet.prototype,"_flex",{get:function(){return this===this._owner.selectedSheet?this._owner:this.grid},enumerable:!0,configurable:!0});Sheet.prototype._compareRows=function(){var e=this,t=this._unboundSortDesc;return function(o,i){for(var n=0;n<t.length;n++){var l=t[n],r=o._ubv&&l.column?o._ubv[l.column._hash]:"",s=i._ubv&&l.column?i._ubv[l.column._hash]:"";_isFormula(r)&&(r=e._owner.evaluate(r));_isFormula(s)&&(s=e._owner.evaluate(s));r!=r&&(r=null);s!=s&&(s=null);wijmo_1.isString(r)&&(r=r.toLowerCase()+r);wijmo_1.isString(s)&&(s=s.toLowerCase()+s);if(""===r||null==r)return 1;if(""===s||null==s)return-1;var a=r<s?-1:r>s?1:0;wijmo_1.isString(r)&&wijmo_1.isNumber(s)&&(a=1);wijmo_1.isString(s)&&wijmo_1.isNumber(r)&&(a=-1);if(0!==a)return l.ascending?+a:-a}return 0}};Sheet.prototype._createGrid=function(e,t){var o=document.createElement("div");this._isEmptyGrid=!0;o.style.visibility="hidden";document.body.appendChild(o);var i=new wijmo_grid_1.FlexGrid(o);document.body.removeChild(o);for(var n=0;n<e;n++)i.rows.push(new wijmo_grid_1.Row);for(var l=0;l<t;l++){var r=new wijmo_grid_1.Column;r.isRequired=!1;i.columns.push(r)}i.wj_sheetInfo={name:this.name,visible:this.visible,styledCells:this._styledCells,mergedRanges:this._mergedRanges};return i};Sheet.prototype._clearGrid=function(){this._grid.rows.clear();this._grid.columns.clear();this._grid.columnHeaders.columns.clear();this._grid.rowHeaders.rows.clear()};Sheet.prototype._gridItemsSourceChanged=function(){var e=this;if(this._owner&&!this._owner._isCopying&&this._owner.selectedSheet&&this._name===this._owner.selectedSheet.name){this._owner.filter.clear();this._owner._copyFrom(this,!1);setTimeout((function(){e._owner._setFlexSheetToDirty();e._owner.invalidate()}),10)}};Sheet.prototype._addHeaderRow=function(e){void 0===e&&(e=!1);if(this._needAddHeaderRow()||e){var t=new HeaderRow;t.isReadOnly=!0;for(var o=0;o<this._grid.columns.length;o++){var i=this._grid.columns[o];t._ubv||(t._ubv={});t._ubv[i._hash]=FlexSheet._getHeaderRowText(i)}this._grid.rows.insert(0,t)}};Sheet.prototype._needAddHeaderRow=function(){var e=this._grid.allowAddNew&&this._grid.newRowAtTop?this._grid.rows[1]:this._grid.rows[0];return!(!this._grid.collectionView||e instanceof HeaderRow)&&(null==this._owner||!this._owner.rows.length||((this._owner.allowAddNew&&this._owner.newRowAtTop?this._owner.rows[1]:this._owner.rows[0])instanceof HeaderRow||!this._ownerHeaderRowRemoved))};Sheet.prototype._getUniqueTableName=function(){for(var e="Table1",t=2;;){if(null==this._owner._getTable(e))break;e="Table"+t;t++}return e};Sheet.prototype._needShiftForTable=function(e){for(var t=0,o=0,i=this._flex,n=e.topRow;n<=e.bottomRow;n++){if(n>=i.rows.length)return t=e.rowSpan-o;for(var l=e.leftCol;l<=e.rightCol&&l<i.columns.length;l++){var r=i.getCellData(n,l,!1);if(null!=r&&""!==r)return t=e.rowSpan-o}o++}return t};Sheet.prototype._needAddRowCountForAddTable=function(e,t){for(var o=this._flex,i=1;i<=e;i++)for(var n=o.rows.length-i,l=t.leftCol;l<=t.rightCol&&l<o.columns.length;l++){var r=o.getCellData(n,l,!1),s=this.getCellStyle(n,l);if(null!=r&&""!==r||null!=s)return e-i+1}return 0};Sheet.prototype._moveDownTable=function(e){for(var t=e._getTableRange(),o=this._flex,i=t.bottomRow;i>=t.topRow;i--)for(var n=t.leftCol;n<=t.rightCol;n++){var l=null!=o.columns[n].dataMap,r=o.getCellData(i,n,l);o.setCellData(i+1,n,r);o.setCellData(i,n,"")}e._updateTableRange(1,1,0,0)};Sheet.prototype._moveDownCells=function(e,t){for(var o=this._flex,i=o.rows.length-1-e;i>=t.topRow;i--)for(var n=t.leftCol;n<=t.rightCol&&n<o.columns.length;n++){var l=null!=o.columns[n].dataMap,r=o.getCellData(i,n,l);o.setCellData(i+e,n,r);o.setCellData(i,n,"");var s=this.getCellStyle(i,n),a=(i+e)*o.columns.length+n,h=i*o.columns.length+n;if(s){this._styledCells[a]=s;this._styledCells[h]=null}var u=this._mergedRanges[h];if(u){u.row+=e;u.row2+=e;this._mergedRanges[a]=u;this._mergedRanges[h]=null}var d=this.findTable(i,n);if(d){var _=d._getTableRange();_.topRow===i&&_.leftCol===n&&d._updateTableRange(e,e,0,0)}}};Sheet.prototype._moveUpCells=function(e,t){for(var o=this._flex,i=t.topRow;i<o.rows.length;i++)for(var n=t.leftCol;n<=t.rightCol&&n<o.columns.length;n++){var l=null!=o.columns[n].dataMap,r=o.getCellData(i,n,l);o.setCellData(i-e,n,r);o.setCellData(i,n,"");var s=this.getCellStyle(i,n),a=(i-e)*o.columns.length+n,h=i*o.columns.length+n;if(s){this._styledCells[a]=s;this._styledCells[h]=null}var u=this._mergedRanges[h];if(u){u.row-=e;u.row2-=e;this._mergedRanges[a]=u;this._mergedRanges[h]=null}var d=this.findTable(i,n);if(d){var _=d._getTableRange();_.topRow===i&&_.leftCol===n&&d._updateTableRange(-e,-e,0,0)}}};Sheet.prototype._moveDownCellsWithinTable=function(e,t,o){for(var i=this._flex,n=o.bottomRow;n>o.topRow+e;n--)for(var l=o.leftCol;l<=o.rightCol;l++){var r=null!=i.columns[l].dataMap,s=i.getCellData(n,l,r);i.setCellData(n+t,l,s);i.setCellData(n,l,"")}};Sheet.prototype._moveUpCellsWithinTable=function(e,t,o){for(var i=o.topRow+e,n=this._flex,l=i;l<=o.bottomRow;l++)for(var r=o.leftCol;r<=o.rightCol;r++){if(l>=i+t){var s=null!=n.columns[r].dataMap,a=n.getCellData(l,r,s);n.setCellData(l-t,r,a)}n.setCellData(l,r,"")}};Sheet.prototype._canShiftCells=function(e){for(var t=this._flex,o=e.topRow;o<t.rows.length;o++)for(var i=e.leftCol;i<=e.rightCol&&i<t.columns.length;i++){var n=this.findTable(o,i);if(n){var l=n._getTableRange();if(l.leftCol<e.leftCol||l.rightCol>e.rightCol)return!1}var r=o*t.columns.length+i,s=this._mergedRanges[r];if(s&&(s.leftCol<e.leftCol||s.rightCol>e.rightCol))return!1}return!0};Sheet.prototype._needMoveDownTable=function(e){var t=e.getRange();if(0===t.topRow)return!0;for(var o=e.getColumns(),i=this._flex,n=0;n<o.length;n++){var l=i.getCellData(t.topRow-1,t.leftCol+n,!1);if(null!=l&&""!==l)return!0}return!1};Sheet.prototype._needAddRowCountForInsertTableRows=function(e,t){for(var o=this._flex,i=1;i<=e;i++){var n=o.rows.length-i;if(n<=t.bottomRow)return e;for(var l=t.leftCol;l<=t.rightCol&&l<o.columns.length;l++){var r=o.getCellData(n,l,!1),s=this.getCellStyle(n,l);if(null!=r&&""!==r||null!=s)return e-i+1}}return 0};Sheet.prototype._getFilterSetting=function(){this._filterDefinition=this._owner.filter.filterDefinition;this._filterSetting={};this._filterSetting.filterColumns=this._owner.filter.filterColumns;this._filterSetting.columnFilterSettings||(this._filterSetting.columnFilterSettings=[]);for(var e=0;e<this._owner.filter._filters.length;e++){var t=this._owner.filter._filters[e];t&&this._filterSetting.columnFilterSettings.push({column:t.column,filterType:t.filterType,dataMap:t.dataMap,valueFilterSetting:{maxValues:t.valueFilter.maxValues,uniqueValues:t.valueFilter.uniqueValues,sortValues:t.valueFilter.sortValues,dataMap:t.valueFilter.dataMap,exclusiveValueSearch:t.valueFilter.exclusiveValueSearch},conditionFilterSetting:{dataMap:t.conditionFilter.dataMap}})}};Sheet.prototype._applyFilterSetting=function(){if(null==this._filterSetting)this._clearFilterSetting();else{this._owner.filter.filterColumns=this._filterSetting.filterColumns;this._filterDefinition&&(this._owner.filter.filterDefinition=this._filterDefinition);var e=this._filterSetting.columnFilterSettings;if(!e||!e.length)return;for(var t=0;t<e.length;t++){var o=e[t];if(o&&null!=o.column){var i=this._owner.filter.getColumnFilter(o.column);if(i){var n=i.valueFilter.showValues,l=i.valueFilter.filterText,r={operator:i.conditionFilter.condition1.operator,value:i.conditionFilter.condition1.value},s={operator:i.conditionFilter.condition2.operator,value:i.conditionFilter.condition2.value},a=i.conditionFilter.and;null!=o.dataMap&&(i.dataMap=o.dataMap);null!=o.filterType&&(i.filterType=o.filterType);var h=o.valueFilterSetting;if(h){h.dataMap&&(i.valueFilter.dataMap=h.dataMap);null!=h.maxValues&&(i.valueFilter.maxValues=h.maxValues);null!=h.sortValues&&(i.valueFilter.sortValues=h.sortValues);h.uniqueValues&&(i.valueFilter.uniqueValues=h.uniqueValues);i.valueFilter.exclusiveValueSearch=h.exclusiveValueSearch}var u=o.conditionFilterSetting;u&&u.dataMap&&(i.conditionFilter.dataMap=u.dataMap);i.valueFilter.showValues=n;i.valueFilter.filterText=l;i.conditionFilter.condition1.operator=r.operator;i.conditionFilter.condition1.value=r.value;i.conditionFilter.condition2.operator=s.operator;i.conditionFilter.condition2.value=s.value;i.conditionFilter.and=a}}}}};Sheet.prototype._cloneMergedCells=function(){for(var e=[],t=0;t<this._mergedRanges.length;t++){var o=this._mergedRanges[t];e.push(o.clone())}return e};Sheet.prototype._getMergedRange=function(e,t){for(var o=0;o<this._mergedRanges.length;o++){var i=this._mergedRanges[o];if(e>=i.topRow&&e<=i.bottomRow&&t>=i.leftCol&&t<=i.rightCol)return i}return null};Sheet.prototype._clearFilterSetting=function(){this._owner.filter._filters=[];this._owner.filter.filterColumns=null;this._filterDefinition&&(this._owner.filter.filterDefinition=this._filterDefinition)};Sheet.prototype._adjustStylesDict=function(e){if(e){var t=e.columnCount,o=e.rowCount,i=this.columnCount,n=this.rowCount;if(t&&t!=i||o&&o!=n){var l={};Object.keys(e).forEach((function(o){var r=+o;if(!isNaN(r)){var s=Math.floor(r/t),a=r%t;s<n&&a<i&&(l[s*i+a]=e[o]);delete e[o]}}));e=l}e.columnCount=i;e.rowCount=n;return e}};Sheet.GenId=0;return Sheet}();exports.Sheet=Sheet;var SheetCollection=function(e){__extends(SheetCollection,e);function SheetCollection(){var t=null!==e&&e.apply(this,arguments)||this;t._current=-1;t.sheetCleared=new wijmo_1.Event;t.selectedSheetChanged=new wijmo_1.Event;t.sheetNameChanged=new wijmo_1.Event;t.sheetVisibleChanged=new wijmo_1.Event;return t}SheetCollection.prototype.onSheetCleared=function(){this.sheetCleared.raise(this)};Object.defineProperty(SheetCollection.prototype,"selectedIndex",{get:function(){return this._current},set:function(e){this._moveCurrentTo(+e)},enumerable:!0,configurable:!0});SheetCollection.prototype.onSelectedSheetChanged=function(e){this.selectedSheetChanged.raise(this,e)};SheetCollection.prototype.push=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];for(var i=0;i<t.length;i++){var n=t[i].name?this.getValidSheetName(t[i]):this._getUniqueName();n!==t[i].name&&(t[i].name=n);e.prototype.push.call(this,t[i]);this._postprocessSheet(t[i])}return this.length};SheetCollection.prototype.splice=function(t,o){for(var i=this,n=[],l=2;l<arguments.length;l++)n[l-2]=arguments[l];n.forEach((function(e){if(e instanceof Sheet&&"Angular"===e.workingAs)requestAnimationFrame((function(){e.name=e.name?i.getValidSheetName(e):i._getUniqueName();i._postprocessSheet(e)}));else{e.name=e.name?i.getValidSheetName(e):i._getUniqueName();i._postprocessSheet(e)}}));return e.prototype.splice.apply(this,[t,o].concat(n))};SheetCollection.prototype.onCollectionChanged=function(t){this._current>=this.length&&(this._current=this.length-1);e.prototype.onCollectionChanged.call(this,t)};SheetCollection.prototype.onSheetNameChanged=function(e){this.sheetNameChanged.raise(this,e)};SheetCollection.prototype.onSheetVisibleChanged=function(e){this.sheetVisibleChanged.raise(this,e)};SheetCollection.prototype.selectFirst=function(){return this._moveCurrentTo(0)};SheetCollection.prototype.selectLast=function(){return this._moveCurrentTo(this.length-1)};SheetCollection.prototype.selectPrevious=function(){return this._moveCurrentTo(this._current-1)};SheetCollection.prototype.selectNext=function(){return this._moveCurrentTo(this._current+1)};SheetCollection.prototype.hide=function(e){if(e<0&&e>=this.length)return!1;if(!this[e].visible)return!1;this[e].visible=!1;return!0};SheetCollection.prototype.show=function(e){if(e<0&&e>=this.length)return!1;this[e].visible=!0;this._moveCurrentTo(e);return!0};SheetCollection.prototype.clear=function(){for(var t=0;t<this.length;t++){var o=this[t];o.dispose();o=null}e.prototype.clear.call(this);this._current=-1;this.onSheetCleared()};SheetCollection.prototype.isValidSheetName=function(e){var t=this._getSheetIndexFrom(e.name),o=this.indexOf(e);return-1===t||t===o};SheetCollection.prototype.getValidSheetName=function(e){for(var t=e.name,o=1,i=this.indexOf(e);;){var n=this._getSheetIndexFrom(t);if(-1===n||n===i)break;t=e.name.concat((o+1).toString());o++}return t};SheetCollection.prototype.getUniqueNameOnInit=function(){for(var e="Sheet1",t=1;;){if(-1===this._getSheetIndexFrom(e))break;e="Sheet"+t;t++}return e};SheetCollection.prototype._setCurrentIdx=function(e){this._current=e};SheetCollection.prototype._moveCurrentTo=function(e){var t=e;if(e<0||e>=this.length)return!1;if(this._current<t||0===t)for(;t<this.length&&!this[t].visible;)t++;else if(this._current>t)for(;t>=0&&!this[t].visible;)t--;if(t===this.length){t=e;for(;t>=0&&!this[t].visible;)t--}if(t<0)return!1;if(t!==this._current){var o=new wijmo_1.PropertyChangedEventArgs("sheetIndex",this._current,t);this._current=t;this.onSelectedSheetChanged(o)}return!0};SheetCollection.prototype._getSheetIndexFrom=function(e){if(!e)return-1;e=e.toLowerCase();for(var t=0;t<this.length;t++){var o=this[t];if((o.name?o.name.toLowerCase():"")===e)return t}return-1};SheetCollection.prototype._postprocessSheet=function(e){e.nameChanged.removeHandler(this._shNameChanged,this);e.nameChanged.addHandler(this._shNameChanged,this);e.visibleChanged.removeHandler(this._shVisibleChanged,this);e.visibleChanged.addHandler(this._shVisibleChanged,this)};SheetCollection.prototype._shNameChanged=function(e,t){this.isValidSheetName(e)||e._setValidName(this.getValidSheetName(e));e._owner&&e._owner._sheetNameChanged(t.oldValue,e.name);var o=this._getSheetIndexFrom(e.name),i=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e,wijmo_1.isNumber(o)?o:this.length-1);this.onSheetNameChanged(i)};SheetCollection.prototype._shVisibleChanged=function(e,t){var o=this._getSheetIndexFrom(e.name),i=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e,wijmo_1.isNumber(o)?o:this.length-1);this.onSheetVisibleChanged(i)};SheetCollection.prototype._getUniqueName=function(){for(var e="Sheet1",t=2;;){if(-1===this._getSheetIndexFrom(e))break;e="Sheet"+t;t++}return e};return SheetCollection}(wijmo_1.ObservableArray);exports.SheetCollection=SheetCollection;var _SheetTabs=function(e){__extends(_SheetTabs,e);function _SheetTabs(t,o,i){var n=e.call(this,t,i)||this;n._rtl=!1;n._sheetTabClicked=!1;n._owner=o;n._sheets=o.sheets;n._rtl="rtl"==getComputedStyle(o.hostElement).direction;n._initControl();n.deferUpdate((function(){n.initialize(i)}));return n}Object.defineProperty(_SheetTabs,"controlTemplate",{get:function(){_SheetTabs._ctrlTemplate||(_SheetTabs._ctrlTemplate='<div wj-part="sheet-container" class="'+exports.SheetClsNames.hostElement+'" style="height:100%;position:relative"><div wj-part="sheet-page" class="'+wijmo_1.InputFormElementsClsNames.btnGroup+" "+exports.SheetClsNames.sheetPage+'"><button type="button" class="'+wijmo_1.InputFormElementsClsNames.btn+" "+wijmo_1.InputFormElementsClsNames.btnDefault+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.stepBackward+'"></span></button><button type="button" class="'+wijmo_1.InputFormElementsClsNames.btn+" "+wijmo_1.InputFormElementsClsNames.btnDefault+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.left+'"></span></button><button type="button" class="'+wijmo_1.InputFormElementsClsNames.btn+" "+wijmo_1.InputFormElementsClsNames.btnDefault+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.right+'"></span></button><button type="button" class="'+wijmo_1.InputFormElementsClsNames.btn+" "+wijmo_1.InputFormElementsClsNames.btnDefault+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.stepForward+'"></span></button></div><div class="'+exports.SheetClsNames.sheetTab+'" style="height:100%;overflow:hidden"><ul wj-part="container"></ul></div><div wj-part="new-sheet" class="'+exports.SheetClsNames.newSheet+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.file+'"></span></div><div wj-part="context-menu" style="display:none;z-index:100"></div></div>');return _SheetTabs._ctrlTemplate},set:function(e){_SheetTabs._ctrlTemplate=e},enumerable:!0,configurable:!0});_SheetTabs.prototype.refresh=function(e){this._tabContainer.innerHTML="";this._tabContainer.innerHTML=this._getSheetTabs();this._rtl&&this._adjustSheetsPosition();this._adjustSize()};_SheetTabs.prototype._sourceChanged=function(e,t){void 0===t&&(t=wijmo_1.NotifyCollectionChangedEventArgs.reset);var o=t;switch(o.action){case wijmo_1.NotifyCollectionChangedAction.Add:var i=o.index-1;i<0&&(i=0);this._tabContainer.innerHTML="";this._tabContainer.innerHTML=this._getSheetTabs();this._rtl&&this._adjustSheetsPosition();this._adjustSize();break;case wijmo_1.NotifyCollectionChangedAction.Remove:this._tabContainer.removeChild(this._tabContainer.children[o.index]);this._adjustSize();break;default:this.invalidate()}};_SheetTabs.prototype._selectedSheetChanged=function(e,t){this._updateTabActive(t.oldValue,!1);this._updateTabActive(t.newValue,!0);this._sheetTabClicked?this._sheetTabClicked=!1:this._scrollToActiveSheet(t.newValue,t.oldValue);this._adjustSize()};_SheetTabs.prototype._initControl=function(){var e=this,t=this.hostElement;this.applyTemplate("",this.getTemplate(),{_sheetContainer:"sheet-container",_tabContainer:"container",_sheetPage:"sheet-page",_newSheet:"new-sheet",_contextMenuHost:"context-menu"});this._contextMenu=new _SheetTabContextMenu(this._contextMenuHost,this._owner);if(this._rtl){this._sheetPage.style.right="0px";this._tabContainer.parentElement.style.right=this._sheetPage.clientWidth+"px";this._tabContainer.style.right="0px";this._tabContainer.style.cssFloat="right";this._newSheet.style.right=this._sheetPage.clientWidth+this._tabContainer.parentElement.clientWidth+"px"}this._adjustNavigationButtons(this._rtl);this.addEventListener(t,"mousedown",(function(){e._owner._mouseHdl._htDown=null}));this.addEventListener(t,"dragstart",(function(t){t.dataTransfer.setData("text","foo");t.target instanceof HTMLLIElement&&e._owner._isDescendant(e._tabContainer,t.target)?e._dragSrcIdx=e._getItemIndex(e._tabContainer,t.target):e._dragSrcIdx=-1}));this.addEventListener(t,"dragover",(function(e){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}));this.addEventListener(t,"drop",(function(t){if(e._dragSrcIdx>-1){var o;if(t.target instanceof HTMLLIElement&&e._owner._isDescendant(e._tabContainer,t.target))o=e._getItemIndex(e._tabContainer,t.target);else{var i=e._tabContainer.getBoundingClientRect();o=t.clientX<i.left?0:t.clientX>i.right?e._sheets.length-1:-1}if(o!==e._dragSrcIdx){var n=e._sheets[e._dragSrcIdx],l=e._owner.selection.clone();e._sheets._exchangingPosition=!0;e._sheets.deferUpdate((function(){n.grid._selHdl.select(l,!1,!1);e._sheets.splice(e._dragSrcIdx,1);e._sheets.splice(o,0,n)}));e._owner.selectedSheetIndex=o;e._sheets._exchangingPosition=!1}}e._dragSrcIdx=-1;t.preventDefault();t.stopPropagation()}));this.addEventListener(this._newSheet,"click",(function(){var t=e._owner.selectedSheetIndex;e._owner.addUnboundSheet();e._scrollToActiveSheet(e._owner.selectedSheetIndex,t)}));this._sheets.collectionChanged.addHandler(this._sourceChanged,this);this._sheets.selectedSheetChanged.addHandler(this._selectedSheetChanged,this);this._sheets.sheetNameChanged.addHandler(this._updateSheetName,this);this._sheets.sheetVisibleChanged.addHandler(this._updateTabShown,this);this._initSheetPage();this._initSheetTab()};_SheetTabs.prototype._initSheetTab=function(){var e=this;this.addEventListener(this._tabContainer,"mousedown",(function(t){var o,i=t.target;if(i instanceof HTMLLIElement){e._sheetTabClicked=!0;o=e._getItemIndex(e._tabContainer,i);e._scrollSheetTabContainer(i);o>-1&&(e._sheets.selectedIndex=o)}}));this.addEventListener(this._tabContainer,"dblclick",(function(t){var o,i=t.target;if(i instanceof HTMLLIElement){o=e._getItemIndex(e._tabContainer,i);e._scrollSheetTabContainer(i);o>-1&&e._startEditingSheetName(o)}}));this.addEventListener(this._tabContainer,"contextmenu",(function(t){t.preventDefault();e._contextMenu.show(t)}))};_SheetTabs.prototype._initSheetPage=function(){var e=this;this.hostElement.querySelector("div."+exports.SheetClsNames.sheetPage).addEventListener("click",(function(t){var o="[object HTMLButtonElement]"===t.target.toString()?t.target:t.target.parentElement,i=e._getItemIndex(e._sheetPage,o);if(0!==e._sheets.length)switch(i){case 0:e._sheets.selectFirst();break;case 1:e._sheets.selectPrevious();break;case 2:e._sheets.selectNext();break;case 3:e._sheets.selectLast()}}))};_SheetTabs.prototype._getSheetTabs=function(){for(var e="",t=0;t<this._sheets.length;t++)e+=this._getSheetElement(this._sheets[t],this._sheets.selectedIndex===t);return e};_SheetTabs.prototype._getSheetElement=function(e,t){void 0===t&&(t=!1);var o="<li";e.visible?t&&(o+=' class="active"'):o+=' class="hidden"';return o+=' draggable="true">'+e.name+"</li>"};_SheetTabs.prototype._updateTabActive=function(e,t){e>=0&&e<this._tabContainer.children.length&&wijmo_1.toggleClass(this._tabContainer.children[e],"active",t)};_SheetTabs.prototype._updateTabShown=function(e,t){if(!(t.index<0||t.index>=this._tabContainer.children.length)){t.item.visible?wijmo_1.removeClass(this._tabContainer.children[t.index],"hidden"):wijmo_1.addClass(this._tabContainer.children[t.index],"hidden");this._adjustSize()}};_SheetTabs.prototype._adjustSize=function(){var e,t=0;if(null!=this.hostElement&&"none"!==this.hostElement.style.display){e=this._tabContainer.parentElement.scrollLeft;this._tabContainer.parentElement.style.width="";this._tabContainer.style.width="";this._sheetPage.parentElement.style.width="";for(var o=0,i=this._tabContainer.childElementCount;o<i;o++)t+=this._tabContainer.children[o].offsetWidth+1;var n=this.hostElement.offsetWidth-this._sheetPage.offsetWidth-this._newSheet.offsetWidth-2;this._tabContainer.parentElement.style.width=(t>n?n:t)+"px";this._tabContainer.style.width=t+"px";this._sheetPage.parentElement.style.width=this._sheetPage.offsetWidth+this._newSheet.offsetWidth+this._tabContainer.parentElement.offsetWidth+3+"px";this._tabContainer.parentElement.scrollLeft=e}};_SheetTabs.prototype._getItemIndex=function(e,t){for(var o=0;o<e.children.length;o++)if(e.children[o]===t)return o;return-1};_SheetTabs.prototype._updateSheetName=function(e,t){this._tabContainer.querySelectorAll("li")[t.index].textContent=t.item.name;this._adjustSize()};_SheetTabs.prototype._scrollSheetTabContainer=function(e){var t=this._tabContainer.parentElement.scrollLeft,o=this._tabContainer.parentElement.offsetWidth;if(this._rtl)switch(wijmo_grid_1.FlexGrid._getRtlMode()){case"rev":var i=-this._tabContainer.offsetLeft;i+e.offsetLeft+e.offsetWidth>o+t?this._tabContainer.parentElement.scrollLeft+=e.offsetWidth:i+e.offsetLeft<t&&(this._tabContainer.parentElement.scrollLeft-=e.offsetWidth);break;case"neg":e.offsetLeft<t?this._tabContainer.parentElement.scrollLeft-=e.offsetWidth:e.offsetLeft+e.offsetWidth>o+t&&(this._tabContainer.parentElement.scrollLeft+=e.offsetWidth);break;default:var n=this._newSheet.offsetWidth;e.offsetLeft-n+t<0?this._tabContainer.parentElement.scrollLeft+=e.offsetWidth:e.offsetLeft+e.offsetWidth-n+t>o&&(this._tabContainer.parentElement.scrollLeft-=e.offsetWidth)}else{var l=this._sheetPage.offsetWidth;e.offsetLeft+e.offsetWidth-l>o+t?this._tabContainer.parentElement.scrollLeft+=e.offsetWidth:e.offsetLeft-l<t&&(this._tabContainer.parentElement.scrollLeft-=e.offsetWidth)}};_SheetTabs.prototype._adjustSheetsPosition=function(){for(var e=this._tabContainer.querySelectorAll("li"),t=0,o=0;o<e.length;o++){var i=e[o];i.style.cssFloat="right";i.style.right=t+"px";t+=e[o].clientWidth}};_SheetTabs.prototype._scrollToActiveSheet=function(e,t){var o=this._tabContainer.querySelectorAll("li"),i=0;this._tabContainer.clientWidth>this._tabContainer.parentElement.clientWidth&&(i=this._tabContainer.clientWidth-this._tabContainer.parentElement.clientWidth);if(o.length>0&&e<o.length&&t<o.length){if(0===e&&!this._rtl||e===o.length-1&&this._rtl){if(this._rtl)switch(wijmo_grid_1.FlexGrid._getRtlMode()){case"rev":this._tabContainer.parentElement.scrollLeft=0;break;case"neg":this._tabContainer.parentElement.scrollLeft=-i;break;default:this._tabContainer.parentElement.scrollLeft=i}else this._tabContainer.parentElement.scrollLeft=0;return}if(0===e&&this._rtl||e===o.length-1&&!this._rtl){if(this._rtl)switch(wijmo_grid_1.FlexGrid._getRtlMode()){case"rev":this._tabContainer.parentElement.scrollLeft=i;break;case"neg":default:this._tabContainer.parentElement.scrollLeft=0}else this._tabContainer.parentElement.scrollLeft=i;return}if(e>=t)for(var n=t+1;n<=e;n++){var l=o[n];this._scrollSheetTabContainer(l)}else for(n=t-1;n>=e;n--){l=o[n];this._scrollSheetTabContainer(l)}}};_SheetTabs.prototype._adjustNavigationButtons=function(e){var t=this.hostElement.querySelectorAll("."+exports.SheetClsNames.sheetPage+" button");if(t&&4===t.length){var o=void 0;if(e){o=t[0].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.stepBackward);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.stepForward);o=t[1].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.left);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.right);o=t[2].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.right);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.left);o=t[3].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.stepForward);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.stepBackward)}else{o=t[0].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.stepForward);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.stepBackward);o=t[1].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.right);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.left);o=t[2].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.left);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.right);o=t[3].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.stepBackward);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.stepForward)}}};_SheetTabs.prototype._startEditingSheetName=function(e){var t=this,o=this._tabContainer.children[e],i=o.textContent;this._editingSheetTab=o;this._measureEle=document.createElement("span");this._measureEle.setAttribute(wijmo_grid_1.FlexGrid._WJS_MEASURE,"true");this._measureEle.style.visibility="hidden";this.hostElement.appendChild(this._measureEle);var n=document.createElement("input");n.type="text";n.style.width=o.offsetWidth-40+"px";o.textContent="";o.appendChild(n);wijmo_1.addClass(n,exports.SheetClsNames.sheetNameEditor+" "+wijmo_1.InputFormElementsClsNames.formControl);n.value=i;wijmo_1.setSelectionRange(n,0,i.length);this.addEventListener(n,"keydown",(function(e){e.keyCode===wijmo_1.Key.Enter?t._commitSheetName():t._measureInputWidth(e.key)}));this.addEventListener(n,"blur",this._commitSheetName.bind(this))};_SheetTabs.prototype._commitSheetName=function(){if(this._editingSheetTab){var e=this._editingSheetTab.children[0];this.removeEventListener(e);var t=e.value,o=this._getItemIndex(this._tabContainer,this._editingSheetTab);if(null!=t&&""!==t&&-1===this._sheets._getSheetIndexFrom(t)){this._sheets[o].name=t;this._editingSheetTab.textContent=t}else this._editingSheetTab.textContent=this._sheets[o].name;this._editingSheetTab=null;wijmo_1.removeChild(this._measureEle);this._measureEle=null;this._adjustSize()}};_SheetTabs.prototype._measureInputWidth=function(e){if(this._editingSheetTab&&!(e.length>1)){var t=this._editingSheetTab.children[0],o=t.selectionStart,i=t.selectionEnd,n=t.value;if(null!=(n=n.substring(0,o)+e+n.substring(i))&&""!==n){this._measureEle.textContent=n;t.style.width=this._measureEle.offsetWidth+"px";this._adjustSize()}}};_SheetTabs.prototype.dispose=function(){this._contextMenu.dispose();e.prototype.dispose.call(this)};_SheetTabs._ctrlTemplate="";return _SheetTabs}(wijmo_1.Control);exports._SheetTabs=_SheetTabs;var _UnboundSortDescription=function(){function _UnboundSortDescription(e,t){this._column=e;this._ascending=t}Object.defineProperty(_UnboundSortDescription.prototype,"column",{get:function(){return this._column},enumerable:!0,configurable:!0});Object.defineProperty(_UnboundSortDescription.prototype,"ascending",{get:function(){return this._ascending},enumerable:!0,configurable:!0});return _UnboundSortDescription}();exports._UnboundSortDescription=_UnboundSortDescription;var _TabHolder=function(e){__extends(_TabHolder,e);function _TabHolder(t,o){var i=e.call(this,t)||this;i._splitterMousedownHdl=i._splitterMousedownHandler.bind(i);i._owner=o;i.applyTemplate("",i.getTemplate(),{_divSheet:"left",_divSplitter:"splitter",_divRight:"right"});i._init();return i}Object.defineProperty(_TabHolder,"controlTemplate",{get:function(){_TabHolder._ctrlTemplate||(_TabHolder._ctrlTemplate='<div><div wj-part="left" style="float:left;height:100%;overflow:hidden"></div><div wj-part="splitter" style="float:left;height:100%;width:6px;background-color:#e9eaee;padding:2px;cursor:e-resize"><div style="background-color:#8a9eb2;height:100%"></div></div><div wj-part="right" style="float:left;height:100%;background-color:#e9eaee"></div></div>');return _TabHolder._ctrlTemplate},set:function(e){_TabHolder._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(_TabHolder.prototype,"sheetControl",{get:function(){return this._sheetControl},enumerable:!0,configurable:!0});Object.defineProperty(_TabHolder.prototype,"visible",{get:function(){return null!=this.hostElement&&"none"!==this.hostElement.style.display},set:function(e){this.hostElement.style.display=e?"block":"none";this._divSheet.style.display=e?"block":"none"},enumerable:!0,configurable:!0});_TabHolder.prototype.getSheetBlanketSize=function(){return 20};_TabHolder.prototype.adjustSize=function(){var e=this._owner.scrollSize.width-this._owner.clientSize.width,t=(this._owner.scrollSize.height,this._owner.clientSize.height,this._divSplitter.parentElement);if(e<=0){t.style.minWidth="100px";this._divSplitter.style.display="none";this._divRight.style.display="none";this._divSheet.style.width="100%";this._divSplitter.removeEventListener("mousedown",this._splitterMousedownHdl,!0)}else{t.style.minWidth="300px";this._divSplitter.style.display="none";this._divRight.style.display="none";this._divSheet.style.width="100%";this._divSplitter.removeEventListener("mousedown",this._splitterMousedownHdl,!0);this._divSplitter.addEventListener("mousedown",this._splitterMousedownHdl,!0)}this._sheetControl._adjustSize()};_TabHolder.prototype._init=function(){var e=this;this._funSplitterMousedown=function(t){e._splitterMouseupHandler(t)};this._divSplitter.parentElement.style.height=this.getSheetBlanketSize()+"px";this._sheetControl=new _SheetTabs(this._divSheet,this._owner)};_TabHolder.prototype._splitterMousedownHandler=function(e){this._startPos=e.pageX;document.addEventListener("mousemove",this._splitterMousemoveHandler.bind(this),!0);document.addEventListener("mouseup",this._funSplitterMousedown,!0);e.preventDefault()};_TabHolder.prototype._splitterMousemoveHandler=function(e){null!==this._startPos&&void 0!==this._startPos&&this._adjustDis(e.pageX-this._startPos)};_TabHolder.prototype._splitterMouseupHandler=function(e){document.removeEventListener("mousemove",this._splitterMousemoveHandler,!0);document.removeEventListener("mouseup",this._funSplitterMousedown,!0);this._adjustDis(e.pageX-this._startPos);this._startPos=null};_TabHolder.prototype._adjustDis=function(e){var t=this._divRight.offsetWidth-e,o=this._divSheet.offsetWidth+e;if(t<=100){t=100;e=this._divRight.offsetWidth-t;o=this._divSheet.offsetWidth+e}else if(o<=100){e=(o=100)-this._divSheet.offsetWidth;t=this._divRight.offsetWidth-e}if(0!=e){this._divRight.style.width=t+"px";this._divSheet.style.width=o+"px";this._startPos=this._startPos+e}};_TabHolder.prototype.dispose=function(){this.sheetControl.dispose();e.prototype.dispose.call(this)};_TabHolder._ctrlTemplate="";return _TabHolder}(wijmo_1.Control);exports._TabHolder=_TabHolder;var _Expression=function(){function _Expression(e,t){this._evaluated=!1;this._rounder=e;this._token=t?t instanceof _Token?t:new _Token(t,_TokenID.ATOM,_TokenType.LITERAL):new _Token(null,_TokenID.ATOM,_TokenType.IDENTIFIER)}Object.defineProperty(_Expression.prototype,"token",{get:function(){return this._token},enumerable:!0,configurable:!0});Object.defineProperty(_Expression.prototype,"evaluated",{get:function(){return this._evaluated},enumerable:!0,configurable:!0});Object.defineProperty(_Expression.prototype,"evaluatedValue",{get:function(){return this._evaluated?this._evaluatedValue:void 0},set:function(e){this._evaluatedValue=e;this._evaluated=!0},enumerable:!0,configurable:!0});_Expression.prototype.evaluate=function(e,t,o,i,n,l){void 0===i&&(i=!0);void 0===n&&(n=!1);void 0===l&&(l=!0);if(this._token.tokenType===_TokenType.ERROR){if(l)throw this._token.value;return this._token.value}if(this._token.tokenType!==_TokenType.LITERAL)throw new SyntaxError(exports._ErrorMessages.BadExpression);return this._token.value};_Expression.toString=function(e,t,o,i){var n=e.evaluate(t,o,i);if(n instanceof FormulaError)throw n;(null==n||e instanceof _CellRangeExpression&&e._isEmpty)&&(n="");n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isString(n)&&"'"===n[0]){var l=n.substring(1);""!=l.trim()&&(n=l)}wijmo_1.isDate(n)&&(n=n.valueOf());return null!=n?n.toString():""};_Expression.toNumber=function(e,t,o,i){var n=e.evaluate(t,o,i);(null==n||e instanceof _CellRangeExpression&&e._isEmpty)&&(n=0);if(n instanceof FormulaError)throw n;n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isNumber(n))return n;if(wijmo_1.isBoolean(n))return n?1:0;if(wijmo_1.isDate(n))return FlexSheet._toOADate(n);if(wijmo_1.isString(n)){"'"===n[0]&&(n=n.substr(1));if(n=n.trim()){if(!isNaN(+n))return+n;if(_Expression.isDateValue(n))return FlexSheet._toOADate(new Date(n))}}return wijmo_1.changeType(n,wijmo_1.DataType.Number)};_Expression.toBoolean=function(e,t,o,i){var n=e.evaluate(t,o,i);(null==n||e instanceof _CellRangeExpression&&e._isEmpty)&&(n=0);if(n instanceof FormulaError)throw n;n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isBoolean(n))return n;if(wijmo_1.isNumber(n))return 0!==n;wijmo_1.isString(n)&&"'"===n[0]&&(n=n.substr(1));return wijmo_1.changeType(n,wijmo_1.DataType.Boolean,"")};_Expression.toDate=function(e,t,o,i){var n=e.evaluate(t,o,i);(null==n||e instanceof _CellRangeExpression&&e._isEmpty)&&(n=0);if(n instanceof FormulaError)throw n;n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isDate(n))return n;if(wijmo_1.isNumber(n))return FlexSheet._fromOADate(n);wijmo_1.isString(n)&&"'"===n[0]&&(n=n.substr(1));return wijmo_1.changeType(n,wijmo_1.DataType.Date,"")};_Expression.isDateValue=function(e){var t,o=["January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];!e||e instanceof FormulaError||wijmo_1.isPrimitive(e)||(e=e.value);if(!(t=wijmo_1.isDate(e))&&wijmo_1.isString(e)){"'"===e[0]&&(e=e.substr(1));if(!wijmo_1.isNullOrWhiteSpace(e)&&isNaN(e)&&(e.indexOf("/")>0||e.indexOf("-")>0)&&!(t=!isNaN(Date.parse(e))))for(var i in o)if(e.indexOf(o[i])>-1){t=!0;break}}return t};_Expression.prototype._refersTo=function(e){return!1};_Expression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){return!1};_Expression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);return!1};_Expression.prototype._updateCellRangeExpForReorderingRows=function(e){return!1};_Expression.prototype._updateCellBoundary=function(e,t){return!1};_Expression.prototype._getStringExpression=function(){return null==this._token.value?"":wijmo_1.isString(this._token.value)?'"'+this._token.value+'"':this._token.value.toString()};return _Expression}();exports._Expression=_Expression;var _UnaryExpression=function(e){__extends(_UnaryExpression,e);function _UnaryExpression(t,o,i){var n=e.call(this,t,o)||this;n._expr=i;return n}_UnaryExpression.prototype.evaluate=function(e,t,o,i,n,l){void 0===i&&(i=!0);void 0===n&&(n=!1);void 0===l&&(l=!0);if(this._expr.token.tokenType===_TokenType.ERROR){if(l)throw this._expr.token.value;return this._expr.token.value}if(this.token.tokenID===_TokenID.SUB){if(!this.evaluated){var r=_Expression.toNumber(this._expr,e,t,o);this.evaluatedValue=wijmo_1.isString(r)?NaN:-r}return this.evaluatedValue}if(this.token.tokenID===_TokenID.ADD){if(!this.evaluated){r=_Expression.toNumber(this._expr,e,t,o);this.evaluatedValue=wijmo_1.isString(r)?NaN:+r}return this.evaluatedValue}throw new SyntaxError(exports._ErrorMessages.BadExpression)};_UnaryExpression.prototype._refersTo=function(e){return this._expr._refersTo(e)};_UnaryExpression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){return this._expr._updateCellRangeExp(e,t,o,i,n,l)};_UnaryExpression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);return this._expr._moveCellRangeExp(e,t,o,i,n)};_UnaryExpression.prototype._updateCellRangeExpForReorderingRows=function(e){return this._expr._updateCellRangeExpForReorderingRows(e)};_UnaryExpression.prototype._getStringExpression=function(){return this.token.tokenID===_TokenID.SUB?(this._inGroup?"(":"")+"-"+this._expr._getStringExpression()+(this._inGroup?")":""):this.token.tokenID===_TokenID.ADD?(this._inGroup?"(":"")+"+"+this._expr._getStringExpression()+(this._inGroup?")":""):""};return _UnaryExpression}(_Expression);exports._UnaryExpression=_UnaryExpression;var _BinaryExpression=function(e){__extends(_BinaryExpression,e);function _BinaryExpression(t,o,i,n){var l=e.call(this,t,o)||this;l._leftExpr=i;l._rightExpr=n;return l}_BinaryExpression.prototype.evaluate=function(e,t,o,i,n,l){void 0===i&&(i=!0);void 0===n&&(n=!1);void 0===l&&(l=!0);var r,s,a,h;if(this.evaluated)return this.evaluatedValue;if(this._leftExpr.token.tokenType===_TokenType.ERROR){if(l)throw this._leftExpr.token.value;return this._leftExpr.token.value}if(this._rightExpr.token.tokenType===_TokenType.ERROR){if(l)throw this._rightExpr.token.value;return this._rightExpr.token.value}var u=_Expression.toString(this._leftExpr,e,t,o),d=_Expression.toString(this._rightExpr,e,t,o);if(this.token.tokenType===_TokenType.CONCAT){this.evaluatedValue=u+d;return this.evaluatedValue}var _=this._leftExpr.evaluate(e,t,o),c=this._rightExpr.evaluate(e,t,o);if(_&&!wijmo_1.isPrimitive(_)){r=_.format;_=_.value}if(c&&!wijmo_1.isPrimitive(c)){s=c.format;c=c.value}var g=_Expression.isDateValue(_),f=_Expression.isDateValue(c),p=g||f;if(p){a=wijmo_1.isDate(_)?FlexSheet._toOADate(_):wijmo_1.isNumber(_)?_:FlexSheet._toOADate(new Date(_));h=wijmo_1.isDate(c)?FlexSheet._toOADate(c):wijmo_1.isNumber(c)?c:FlexSheet._toOADate(new Date(c))}else{a=_Expression.toNumber(this._leftExpr,e,t,o);h=_Expression.toNumber(this._rightExpr,e,t,o)}if(this.token.tokenType===_TokenType.COMPARE){var m=void 0;this._leftExpr instanceof _CellRangeExpression&&this._leftExpr._isEmpty&&(_=null);this._rightExpr instanceof _CellRangeExpression&&this._rightExpr._isEmpty&&(c=null);var w=null==_,C=null==c;if(w!==C)m=w&&!c||C&&!_?0:w?-1:1;else{var S=typeof _,b=typeof c;if(n&&S!==b){if(this.token.tokenID===_TokenID.NE){this.evaluatedValue=!0;return this.evaluatedValue}if(this.token.tokenID!==_TokenID.EQ||"number"!==b&&!f){this.evaluatedValue=!1;return this.evaluatedValue}}var v="boolean"===S;if(v!==("boolean"===b))m=v?1:-1;else{var y="string"===S;if(i&&y!==("string"===b))m=y?1:-1;else if(0!==_&&wijmo_1.isNullOrWhiteSpace(_)||0!==c&&wijmo_1.isNullOrWhiteSpace(c))m=_===c?0:_<=c?-1:1;else{wijmo_1.isNumber(a)&&(a=this._rounder.round(a));wijmo_1.isNumber(h)&&(h=this._rounder.round(h));m=a-h}}}switch(this.token.tokenID){case _TokenID.GT:this.evaluatedValue=m>0;return this.evaluatedValue;case _TokenID.LT:this.evaluatedValue=m<0;return this.evaluatedValue;case _TokenID.GE:this.evaluatedValue=m>=0;return this.evaluatedValue;case _TokenID.LE:this.evaluatedValue=m<=0;return this.evaluatedValue;case _TokenID.EQ:if(isNaN(m)){this.evaluatedValue=u.toLowerCase()===d.toLowerCase();return this.evaluatedValue}this.evaluatedValue=0===m;return this.evaluatedValue;case _TokenID.NE:if(isNaN(m)){this.evaluatedValue=u.toLowerCase()!==d.toLowerCase();return this.evaluatedValue}this.evaluatedValue=0!==m;return this.evaluatedValue}}if(wijmo_1.isString(a)||wijmo_1.isString(h))throw new ValueError;switch(this.token.tokenID){case _TokenID.ADD:this.evaluatedValue=a+h;break;case _TokenID.SUB:this.evaluatedValue=a-h;break;case _TokenID.MUL:this.evaluatedValue=a*h;break;case _TokenID.DIV:case _TokenID.PERCENT:if(0===h){this.evaluatedValue=new DivideByZeroError;throw this.evaluatedValue}this.evaluatedValue=a/h;break;case _TokenID.DIVINT:if(0===h){this.evaluatedValue=new DivideByZeroError;throw this.evaluatedValue}this.evaluatedValue=Math.floor(a/h);break;case _TokenID.MOD:if(0===h){this.evaluatedValue=new DivideByZeroError;throw this.evaluatedValue}this.evaluatedValue=Math.floor(a%h);break;case _TokenID.POWER:switch(h){case 0:this.evaluatedValue=1;break;case.5:this.evaluatedValue=Math.sqrt(a);break;case 1:this.evaluatedValue=a;break;case 2:this.evaluatedValue=a*a;break;case 3:this.evaluatedValue=a*a*a;break;case 4:this.evaluatedValue=a*a*a*a;break;default:this.evaluatedValue=Math.pow(a,h)}break;default:this.evaluatedValue=NaN}if(!isNaN(this.evaluatedValue)){p&&(this.evaluatedValue={value:FlexSheet._fromOADate(this.evaluatedValue),format:r||s});return this.evaluatedValue}throw new SyntaxError(exports._ErrorMessages.BadExpression)};_BinaryExpression.prototype._refersTo=function(e){return this._leftExpr._refersTo(e)||this._rightExpr._refersTo(e)};_BinaryExpression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){var r,s=!1;r=this._leftExpr._updateCellRangeExp(e,t,o,i,n,l);s=s||r;r=this._rightExpr._updateCellRangeExp(e,t,o,i,n,l);return s||r};_BinaryExpression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);var l,r=!1;l=this._leftExpr._moveCellRangeExp(e,t,o,i,n);r=r||l;l=this._rightExpr._moveCellRangeExp(e,t,o,i,n);return r||l};_BinaryExpression.prototype._updateCellRangeExpForReorderingRows=function(e){var t,o=!1;t=this._leftExpr._updateCellRangeExpForReorderingRows(e);o=o||t;t=this._rightExpr._updateCellRangeExpForReorderingRows(e);return o||t};_BinaryExpression.prototype._getStringExpression=function(){var e=exports._OpMap[this.token.tokenID]||"",t=this._leftExpr._getStringExpression(),o=this.token.tokenID!==_TokenID.PERCENT?this._rightExpr._getStringExpression():"";return(this._inGroup?"(":"")+t+e+o+(this._inGroup?")":"")};return _BinaryExpression}(_Expression);exports._BinaryExpression=_BinaryExpression;var _CellRangeExpression=function(e){__extends(_CellRangeExpression,e);function _CellRangeExpression(t,o,i,n,l,r,s,a,h,u){void 0===l&&(l=!0);void 0===r&&(r=!1);void 0===s&&(s=!1);void 0===a&&(a=!1);void 0===h&&(h=!1);var d=e.call(this,t)||this;d._cells=new wijmo_grid_1.CellRange(o.topRow,o.leftCol,o.bottomRow,o.rightCol);d._sheetRef=i;d._flex=n;d._evalutingRange={};d._isCellRange=l;d._absRow=r;d._absCol=s;d._absRow2=a;d._absCol2=h;d._isWholeRow=u;return d}_CellRangeExpression.prototype.evaluate=function(e,t,o,i,n,l){void 0===i&&(i=!0);void 0===n&&(n=!1);void 0===l&&(l=!0);if(!this.evaluated){var r=this._extendRange(o),s=this._getCellValue(r,o,e,t,l,!0);this._isEmpty=null==s;this.evaluatedValue=s}return null==this.evaluatedValue?0:this.evaluatedValue};_CellRangeExpression.prototype.getValues=function(e,t,o,i){void 0===e&&(e=!0);void 0===i&&(i=!0);var n=[];if(!(o=this._getSheet()||o||this._flex.selectedSheet))return null;for(var l=this._extendRange(o),r=null==t||isNaN(+t)?l.leftCol:t,s=null==t||isNaN(+t)?l.rightCol:t,a=new wijmo_grid_1.CellRange,h=l.topRow;h<=l.bottomRow&&h<o.grid.rows.length;h++)if(e||!1!==o.grid.rows[h].isVisible)for(var u=r;u<=s&&u<o.grid.columns.length;u++){a.setRange(h,u);var d=this._getCellValue(a,o,void 0,void 0,i);!d||d instanceof FormulaError||wijmo_1.isPrimitive(d)||(d=d.value);n.push(d)}return n};_CellRangeExpression.prototype.getValuesWithTwoDimensions=function(e,t){void 0===e&&(e=!0);var o,i,n,l,r,s=[],a=0,h=0;if(!(t=this._getSheet()||t||this._flex.selectedSheet))return null;for(n=(r=this._extendRange(t)).topRow;n<=r.bottomRow&&n<t.grid.rows.length;n++)if(e||!1!==t.grid.rows[n].isVisible){i=[];h=0;for(l=r.leftCol;l<=r.rightCol&&l<t.grid.columns.length;l++)if(e||!1!==t.grid.columns[l].isVisible){!(o=this._getCellValue(new wijmo_grid_1.CellRange(n,l),t))||o instanceof FormulaError||wijmo_1.isPrimitive(o)||(o=o.value);i[h]=o;h++}else h++;s[a]=i;a++}else a++;return s};Object.defineProperty(_CellRangeExpression.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});Object.defineProperty(_CellRangeExpression.prototype,"sheetRef",{get:function(){return this._sheetRef},enumerable:!0,configurable:!0});_CellRangeExpression.prototype._getCellValue=function(e,t,o,i,n,l){void 0===n&&(n=!0);var r,s,a,h;if(!(r=this._getSheet()||t||this._flex.selectedSheet))return null;for(var u=0,d=r._currentMergedRanges;u<d.length;u++){var _=d[u];if(e._row>=_._row&&e._row2<=_._row2&&e._col>=_._col&&e._col2<=_._col2&&(e._row!==_._row||e._col!==_._col))return null}if(e.isSingleCell){a=e.row;h=e.col}else{if(null!=o&&o>=e.topRow&&o<=e.bottomRow&&e.col===e.col2){a=o;h=e.col}if(null!=i&&i>=e.leftCol&&i<=e.rightCol&&e.row===e.row2){a=e.row;h=i}}if(null==a||null==h)throw new ReferenceError(exports._ErrorMessages.InvalidCellRef);s=r.name+":"+a+","+h+"-"+a+","+h;if(this._evalutingRange[s])throw new SyntaxError(exports._ErrorMessages.CircRef);try{if(this._flex){this._evalutingRange[s]=!0;var c=r===this._flex.selectedSheet?this._flex:r.grid;if(a<c.rows.length&&h<c.columns.length){var g=r.grid.columns[h],f=this._flex.getCellValue(a,h,!!l&&0,r);if(f instanceof FormulaError){if(n)throw f;return f}g.dataMap&&!l&&(f=g.dataMap.getDisplayValue(f));return f}return}}finally{delete this._evalutingRange[s]}};_CellRangeExpression.prototype._getSheet=function(){if(!this._sheetRef)return null;var e=this._flex._getSheet(this._sheetRef);if(!e)throw new ReferenceError(exports._ErrorMessages.InvalidSheetRef);return e};_CellRangeExpression.prototype._refersTo=function(e){return e.contains(this.cells)};_CellRangeExpression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){var r=this._cells,s=!1;if(this._tableParams&&this._tableParams.length>0)return!1;if(e===this._flex.selectedSheetIndex){if(this._sheetRef&&this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase())return!1}else if(!this._sheetRef||this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase())return!1;if(n){if(null==this._isWholeRow||this._isWholeRow){if(l&&(r.leftCol>l.rightCol||r.rightCol<l.leftCol))return!1;if(i){if(r.topRow>=t){r.row+=o;r.row2+=o;s=!0}else if(r.topRow<t&&r.bottomRow>=t){r.row2+=o;s=!0}}else if(r.topRow>t){r.row-=o;r.row2-=o;s=!0}else if(r.isSingleCell){if(r.row>=t-o+1){r.row=t-o+1;r.row2=t-o+1;s=!0}}else if(r.topRow>=t-o+1){r.row=t-o+1;r.row2-=o;s=!0}else if(r.topRow<t-o+1&&r.bottomRow>=t-o+1){r.bottomRow>t?r.row2-=o:r.row2=t-o;s=!0}}}else if(null==this._isWholeRow||!this._isWholeRow){if(l&&(r.topRow>l.bottomRow||r.bottomRow<l.topRow))return!1;if(i){if(r.leftCol>=t){r.col+=o;r.col2+=o;s=!0}else if(r.leftCol<t&&r.rightCol>=t){r.col2+=o;s=!0}}else if(r.leftCol>t){r.col-=o;r.col2-=o;s=!0}else if(r.isSingleCell){if(r.col>=t-o+1){r.col=t-o+1;r.col2=t-o+1;s=!0}}else if(r.leftCol>=t-o+1){r.col=t-o+1;r.col2-=o;s=!0}else if(r.leftCol<t-o+1&&r.rightCol>=t-o+1){r.rightCol>t?r.col2-=o:r.col2=t-o;s=!0}}return s};_CellRangeExpression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);var l,r,s=this._cells,a=!1;if(this._tableParams&&this._tableParams.length>0)return!1;if(this._flex.selectedSheetIndex!=e&&(!this._sheetRef||this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase()))return!1;if(!n&&this._flex.selectedSheetIndex==e&&this._sheetRef&&this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase())return!1;l=o.topRow-t.topRow;r=o.leftCol-t.leftCol;if(n){if(0!==l&&(null==this._isWholeRow||this._isWholeRow)){s.row+=n&&this._absRow?0:l;s.row2+=this._isCellRange?n&&this._absRow2?0:l:n&&this._absRow?0:l;a=!0}if(0!==r&&(null==this._isWholeRow||!this._isWholeRow)){s.col+=n&&this._absCol?0:r;s.col2+=this._isCellRange?n&&this._absCol2?0:r:n&&this._absCol?0:r;a=!0}return a}if(t.contains(s)){if(0!==l&&(null==this._isWholeRow||this._isWholeRow)){s.row+=l;s.row2+=l;a=!0}if(0!==r&&(null==this._isWholeRow||!this._isWholeRow)){s.col+=r;s.col2+=r;a=!0}}else if(t.intersects(s)){if(t.intersectsRow(s)){var h=t.topRow>=s.topRow&&t.bottomRow<=s.bottomRow;if(0!==l&&(null==this._isWholeRow||this._isWholeRow))if(t.topRow<=s.topRow){if(l<0){s.row+=l;a=!0}else if(l>0){var u=h&&o.bottomRow<s.bottomRow;if(i&&!u){t.topRow<s.topRow&&(s.row-=s.topRow-t.topRow);s.row2-=t.rowSpan;a=!0}}}else if(t.bottomRow>=s.bottomRow){if(l>0){s.row2+=l;a=!0}else if(l<0){var d=h&&o.topRow>s.topRow;if(i&&!d){t.bottomRow>s.bottomRow&&(s.row2+=t.bottomRow-s.bottomRow);s.row+=t.rowSpan;a=!0}}}else if(i){l<0&&o.topRow<=s.topRow&&(s.row+=t.rowSpan);l>0&&o.bottomRow>=s.bottomRow&&(s.row2-=t.rowSpan);a=!0}}if(t.intersectsColumn(s)&&0!==r&&(null==this._isWholeRow||!this._isWholeRow))if(t.leftCol<=s.leftCol){if(r<0){s.col+=r;a=!0}else if(r>0&&i){t.leftCol<s.leftCol&&(s.col-=s.leftCol-t.leftCol);s.col2-=t.columnSpan;a=!0}}else if(t.rightCol>=s.rightCol){if(r>0){s.col2+=r;a=!0}else if(r<0&&i){t.rightCol>s.rightCol&&(s.col2+=t.rightCol-s.rightCol);s.col+=t.columnSpan;a=!0}}else if(i){r<0?s.col+=t.columnSpan:s.col2-=t.columnSpan;a=!0}}else if(i){if(null==this._isWholeRow||this._isWholeRow)if(s.row!==s.row2&&s.containsRow(o.topRow)){l<0?s.row2+=o.rowSpan:s.row=Math.max(0,s.row-o.rowSpan);a=!0}else{if(s.topRow>=o.topRow&&s.topRow<t.topRow&&l<0){s.row+=o.rowSpan;s.row2+=o.rowSpan;a=!0}if(s.topRow>t.bottomRow&&s.bottomRow<=o.bottomRow&&l>0){s.row-=o.rowSpan;s.row2-=o.rowSpan;a=!0}}if(null==this._isWholeRow||!this._isWholeRow)if(s.col!==s.col2&&s.containsColumn(o.leftCol)){r<0?s.col2+=o.columnSpan:s.col=Math.max(0,s.col-o.columnSpan);a=!0}else{if(s.leftCol>=o.leftCol&&s.leftCol<t.leftCol&&r<0){s.col+=o.columnSpan;s.col2+=o.columnSpan;a=!0}if(s.leftCol>t.rightCol&&s.rightCol<=o.rightCol&&r>0){s.col-=o.columnSpan;s.col2-=o.columnSpan;a=!0}}}return a};_CellRangeExpression.prototype._updateCellRangeExpForReorderingRows=function(e){var t,o=this._cells;if(null==this._isWholeRow||this._isWholeRow){(t=this._cells.row+e)<0?t=0:t>=this._flex.rows.length&&(t=this._flex.rows.length-1);o.row=t;this._isCellRange&&((t=this._cells.row2+e)<0?t=0:t>=this._flex.rows.length&&(t=this._flex.rows.length-1));o.row2=t}return!0};_CellRangeExpression.prototype._updateCellBoundary=function(e,t){var o=this._cells;if(this._sheetRef&&this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase())return!1;if(o.row===o.row2&&o.row===e&&t===o.col2+1){o.col2+=1;return!0}if(o.col===o.col2&&o.col===t&&e===o.row2+1){o.row2+=1;return!0}return!1};_CellRangeExpression.prototype._getStringExpression=function(){if(this._tableParams&&this._tableParams.length>0)return this._getTableParamsStringExpression();var e=this._quoteName(this._sheetRef);return this._definedName?this._definedName:(e?e+"!":"")+wijmo_xlsx_1.Workbook.xlsxAddress(this._cells.row,this._cells.col,this._absRow,this._absCol,this._isWholeRow)+(this._isCellRange?":"+wijmo_xlsx_1.Workbook.xlsxAddress(this._cells.row2,this._cells.col2,this._absRow2,this._absCol2,this._isWholeRow):"")};_CellRangeExpression.prototype._quoteName=function(e){e&&(/[\s\-!$]/.test(e)||/^\d/.test(e))&&(e="'"+e+"'");return e};_CellRangeExpression.prototype._getTableParamsStringExpression=function(){var e,t=0,o="",i=this._tableParams.length,n=!1;if(!this._defTableParameterProvided){for(;t<i;t++)if("#"===(e=this._tableParams[t])[0]){o+="["+e+"]";t<i-1&&(o+=", ")}else if(n)o+=": ["+e+"]";else{o+="["+e+"]";n=!0}i>1&&(o="["+o+"]")}this._tableName&&(o=this._tableName+o);return o};_CellRangeExpression.prototype._extendRange=function(e){var t=this._cells.clone();if(null!=this._isWholeRow)if(this._isWholeRow){t.col=0;t.col2=e?e.grid.columns.length-1:this._flex.columns.length-1}else{t.row=0;t.row2=e?e.grid.rows.length-1:this._flex.rows.length-1}return t};return _CellRangeExpression}(_Expression);exports._CellRangeExpression=_CellRangeExpression;var _FunctionExpression=function(e){__extends(_FunctionExpression,e);function _FunctionExpression(t,o,i,n,l){void 0===l&&(l=!0);var r=e.call(this,t)||this;r._funcId=o;r._funcDefinition=i;r._params=n;r._needCacheEvaluatedVal=l;return r}_FunctionExpression.prototype.evaluate=function(e,t,o){if(!this._needCacheEvaluatedVal)return this._funcDefinition.func(this._params,o,e,t);this.evaluated||(this.evaluatedValue=this._funcDefinition.func(this._params,o,e,t));return this.evaluatedValue};_FunctionExpression.prototype._refersTo=function(e){if(this._params)for(var t=0;t<this._params.length;t++)if(this._params[t]._refersTo(e))return!0;return!1};_FunctionExpression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){var r,s,a=!1;if(this._params&&this._params.length>0)for(r=0;r<this._params.length;r++){s=this._params[r]._updateCellRangeExp(e,t,o,i,n,l);a||(a=a||s)}return a};_FunctionExpression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);var l,r,s=!1;if(this._params&&this._params.length>0)for(l=0;l<this._params.length;l++){r=this._params[l]._moveCellRangeExp(e,t,o,i,n);s||(s=s||r)}return s};_FunctionExpression.prototype._updateCellRangeExpForReorderingRows=function(e){var t,o,i=!1;if(this._params&&this._params.length>0)for(t=0;t<this._params.length;t++){o=this._params[t]._updateCellRangeExpForReorderingRows(e);i||(i=i||o)}return i};_FunctionExpression.prototype._updateCellBoundary=function(e,t){var o;return!!(this._params&&1===this._params.length&&(o=this._params[0])instanceof _CellRangeExpression)&&o._updateCellBoundary(e,t)};_FunctionExpression.prototype._getStringExpression=function(){return"true"===this._funcId||"false"===this._funcId?this._funcId.toUpperCase():this._funcId+this._parseParamsExpToString()};_FunctionExpression.prototype._parseParamsExpToString=function(){var e,t;if(this._params&&this._params.length>0){t="";for(e=0;e<this._params.length;e++){0===e&&(t+="(");t+=this._params[e]._getStringExpression();e<this._params.length-1?t+=", ":t+=")"}return t}return"()"};return _FunctionExpression}(_Expression);exports._FunctionExpression=_FunctionExpression;var _CalcEngine=function(){function _CalcEngine(e){this._expressionCache={};this._idChars="_$:!";this._functionTable={};this._cacheSize=0;this._tableRefStart=!1;this.unknownFunction=new wijmo_1.Event;this._owner=e;this._buildSymbolTable();this._registerAggregateFunction();this._registerMathFunction();this._registerLogicalFunction();this._registerTextFunction();this._registerDateFunction();this._registLookUpReferenceFunction();this._registFinacialFunction();this._registAddressRelatedFunction();this._registerIsFunctions()}_CalcEngine.prototype.onUnknownFunction=function(e,t){var o,i;if(t&&t.length>0){o=[];for(var n=0;n<t.length;n++)o[n]=t[n].evaluate(this._rowIndex,this._columnIndex)}i=new UnknownFunctionEventArgs(e,o);this.unknownFunction.raise(this,i);if(null!=i.value)return new _Expression(this,i.value);throw new NameError(exports._ErrorMessages.UnkFuncName(e))};_CalcEngine.prototype.evaluate=function(e,t,o,i,n,l,r){void 0===l&&(l=!0);void 0===r&&(r=!1);var s,a;if(!this._owner.enableFormulas)return e;try{if(_isFormula(e)){this._containsCellRef=!1;this._rowIndex=i;this._columnIndex=n;this._sheet=o||this._owner.selectedSheet;e=this._filterUnwantedCommas(e);a=(s=this._checkCache(e,l,r)).evaluate(i,n,o,l,r);for(;a instanceof _Expression;)a=a.evaluate(i,n,o,l,r);return t&&wijmo_1.isPrimitive(a)?wijmo_1.Globalize.format(a,t):a}return e||""}catch(e){var h=e instanceof FormulaError?e:new UnknownError(e);s&&(s.evaluatedValue=h);return h}};_CalcEngine.prototype.addCustomFunction=function(e,t,o,i){var n=this;e=e.toLowerCase();this._functionTable[e]=new _FunctionDefinition((function(e){var o,i=[];if(e&&e.length>0)for(var l=0;l<e.length;l++){o=e[l];i[l]=o instanceof _CellRangeExpression?o.cells:o.evaluate(n._rowIndex,n._columnIndex)}return t.apply(n,i)}),i,o)};_CalcEngine.prototype.addFunction=function(e,t,o,i){var n=this;e=e.toLowerCase();this._functionTable[e]=new _FunctionDefinition((function(e,o){var i,l=[];if(e&&e.length>0)for(var r=o||n._sheet,s=0;s<e.length;s++){i=e[s];l[s]=i instanceof _CellRangeExpression?i.getValuesWithTwoDimensions(void 0,r):[[i.evaluate(n._rowIndex,n._columnIndex,r)]]}return t.apply(n,l)}),i,o)};_CalcEngine.prototype.clearExpressionCache=function(){this._expressionCache=null;this._expressionCache={};this._cacheSize=0};_CalcEngine.prototype.round=function(e){var t=this._owner.calculationPrecision;if(e.toString().indexOf(".")<0)return e;if(t<0)return e;t>20&&(t=20);var o=_CalcEngine.PowOf10[t];return e>=0?Math.round(e*o)/o:-Math.round(Math.abs(e)*o)/o};_CalcEngine.prototype.parse=function(e){if(wijmo_1.isNumber(e)){this._token=new _Token(e,_TokenID.END,_TokenType.GROUP);return new _Expression(this,new _Token(e,_TokenID.ATOM,_TokenType.LITERAL))}this._expression=e;this._expressLength=e?e.length:0;this._pointer=0;this._expressLength>0&&"="===this._expression[0]&&this._pointer++;return this._parseExpression()};_CalcEngine.prototype._buildSymbolTable=function(){if(!this._tokenTable){this._tokenTable={};this._addToken("+",_TokenID.ADD,_TokenType.ADDSUB);this._addToken("-",_TokenID.SUB,_TokenType.ADDSUB);this._addToken("(",_TokenID.OPEN,_TokenType.GROUP);this._addToken(")",_TokenID.CLOSE,_TokenType.GROUP);this._addToken("*",_TokenID.MUL,_TokenType.MULDIV);this._addToken(",",_TokenID.COMMA,_TokenType.GROUP);this._addToken(".",_TokenID.PERIOD,_TokenType.GROUP);this._addToken("/",_TokenID.DIV,_TokenType.MULDIV);this._addToken("\\",_TokenID.DIVINT,_TokenType.MULDIV);this._addToken("%",_TokenID.PERCENT,_TokenType.MULDIV);this._addToken("=",_TokenID.EQ,_TokenType.COMPARE);this._addToken(">",_TokenID.GT,_TokenType.COMPARE);this._addToken("<",_TokenID.LT,_TokenType.COMPARE);this._addToken("^",_TokenID.POWER,_TokenType.POWER);this._addToken("<>",_TokenID.NE,_TokenType.COMPARE);this._addToken(">=",_TokenID.GE,_TokenType.COMPARE);this._addToken("<=",_TokenID.LE,_TokenType.COMPARE);this._addToken("&",_TokenID.CONCAT,_TokenType.CONCAT);this._addToken("[",_TokenID.OPEN,_TokenType.SQUAREBRACKETS);this._addToken("]",_TokenID.CLOSE,_TokenType.SQUAREBRACKETS)}};_CalcEngine.prototype._registerAggregateFunction=function(){var e=this;this._functionTable.sum=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Sum,t,o)}));this._functionTable.average=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Avg,t,o)}));this._functionTable.max=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Max,t,o)}));this._functionTable.min=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Min,t,o)}));this._functionTable.var=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Var,t,o)}));this._functionTable.varp=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.VarPop,t,o)}));this._functionTable.stdev=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Std,t,o)}));this._functionTable.stdevp=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.StdPop,t,o)}));this._functionTable.count=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.Count,t,o)}));this._functionTable.counta=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.CountA,t,o)}));this._functionTable.countblank=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.CountBlank,t,o)}));this._functionTable.countif=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.CountIf,t,o)}),2,2);this._functionTable.countifs=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.CountIfs,t,o)}),254,2);this._functionTable.sumif=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.SumIf,t,o)}),3,2);this._functionTable.sumifs=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.SumIfs,t,o)}),255,2);this._functionTable.rank=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.Rank,t,o)}),3,2);this._functionTable.product=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.Product,t,o)}),255,1);this._functionTable.subtotal=new _FunctionDefinition((function(t,o){return e._handleSubtotal(t,o)}),255,2);this._functionTable.dcount=new _FunctionDefinition((function(t,o){return e._handleDCount(t,o)}),3,3);this._functionTable.sumproduct=new _FunctionDefinition((function(t,o){return e._getSumProduct(t,o)}),255,1)};_CalcEngine.prototype._registerMathFunction=function(){var e=this;this._functionTable.pi=new _FunctionDefinition((function(){return Math.PI}),0,0);this._functionTable.rand=new _FunctionDefinition((function(){return Math.random()}),0,0);this._functionTable.power=new _FunctionDefinition((function(t,o){return Math.pow(_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o))}),2,2);this._functionTable.atan2=new _FunctionDefinition((function(t,o){var i=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),n=_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o);if(0===i&&0===n)throw new DivideByZeroError(exports._ErrorMessages.Atan2ArgsLessThanZero);return Math.atan2(n,i)}),2,2);this._functionTable.mod=new _FunctionDefinition((function(t,o){var i=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),n=_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o),l=Math.abs(n);if(0===l)throw new DivideByZeroError;var r=Math.abs(i)%l;n<0&&(r=-r);return r}),2,2);this._functionTable.trunc=new _FunctionDefinition((function(t,o){var i,n,l,r=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),s=2===t.length?_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o):0;if(0===s){l="n0";n=r>=0?Math.floor(r):Math.ceil(r)}else{l="n"+((s=s>0?Math.floor(s):Math.ceil(s))>0?s:0);i=Math.pow(10,s);n=r>=0?Math.floor(r*i)/i:Math.ceil(r*i)/i}if(null!=n)return{value:n,format:l}}),2,1);["ceiling","floor"].forEach((function(t){e._functionTable[t]=new _FunctionDefinition((function(o,i){var n,l,r=_Expression.toNumber(o[0],e._rowIndex,e._columnIndex,i),s=2===o.length?_Expression.toNumber(o[1],e._rowIndex,e._columnIndex,i):1;if(isNaN(r))throw new ValueError(exports._ErrorMessages.InvalidParameter("number"));if(isNaN(s))throw new ValueError(exports._ErrorMessages.InvalidParameter("significance"));if(r>0&&s<0)throw new NumericError(exports._ErrorMessages.InvalidParameter("significance"));if(0===r||0===s)return 0;l=1;if(0!==(n=s-Math.floor(s)))for(;n<1;){l*=10;n*=10}return s*l*("ceiling"===t?Math.ceil(r/s):Math.floor(r/s))/l}),2,1)}));["round","rounddown","roundup"].forEach((function(t){e._functionTable[t]=new _FunctionDefinition((function(o,i){var n,l,r,s=_Expression.toNumber(o[0],e._rowIndex,e._columnIndex,i),a=_Expression.toNumber(o[1],e._rowIndex,e._columnIndex,i);if(0===a){switch(t){case"rounddown":n=s>=0?Math.floor(s):Math.ceil(s);break;case"roundup":n=s>=0?Math.ceil(s):Math.floor(s);break;case"round":n=(s>=0?1:-1)*Math.round(Math.abs(s));break;default:n=Math.floor(s)}l="n0"}else{a=a>0?Math.floor(a):Math.ceil(a);r=Math.pow(10,a);switch(t){case"rounddown":n=s>=0?Math.floor(s*r)/r:Math.ceil(s*r)/r;break;case"roundup":n=s>=0?Math.ceil(s*r)/r:Math.floor(s*r)/r;break;case"round":n=(s>=0?1:-1)*Math.round(Math.abs(s)*r)/r}l="n"+(a>0?a:0)}if(null!=n)return{value:n,format:l}}),2,2)}));["abs","acos","asin","atan","cos","exp","ln","sin","sqrt","tan"].forEach((function(t){e._functionTable[t]=new _FunctionDefinition((function(o,i){return"ln"===t?Math.log(_Expression.toNumber(o[0],e._rowIndex,e._columnIndex,i)):Math[t](_Expression.toNumber(o[0],e._rowIndex,e._columnIndex,i))}),1,1)}))};_CalcEngine.prototype._registerLogicalFunction=function(){var e=this;this._functionTable.and=new _FunctionDefinition((function(t,o){var i,n=!0;for(i=0;i<t.length&&(n=n&&_Expression.toBoolean(t[i],e._rowIndex,e._columnIndex,o));i++);return n}),Number.MAX_VALUE,1);this._functionTable.or=new _FunctionDefinition((function(t,o){var i,n=!1;for(i=0;i<t.length&&!(n=n||_Expression.toBoolean(t[i],e._rowIndex,e._columnIndex,o));i++);return n}),Number.MAX_VALUE,1);this._functionTable.not=new _FunctionDefinition((function(t,o){return!_Expression.toBoolean(t[0],e._rowIndex,e._columnIndex,o)}),1,1);this._functionTable.if=new _FunctionDefinition((function(t,o){return 3===t.length?_Expression.toBoolean(t[0],e._rowIndex,e._columnIndex,o)?t[1].evaluate(e._rowIndex,e._columnIndex,o):t[2].evaluate(e._rowIndex,e._columnIndex,o):!!_Expression.toBoolean(t[0],e._rowIndex,e._columnIndex,o)&&t[1].evaluate(e._rowIndex,e._columnIndex,o)}),3,2);this._functionTable.true=new _FunctionDefinition((function(){return!0}),0,0);this._functionTable.false=new _FunctionDefinition((function(){return!1}),0,0)};_CalcEngine.prototype._registerTextFunction=function(){var e=this;this._functionTable.char=new _FunctionDefinition((function(t,o){var i,n="";for(i=0;i<t.length;i++)n+=String.fromCharCode(_Expression.toNumber(t[i],e._rowIndex,e._columnIndex,o));return n}),Number.MAX_VALUE,1);this._functionTable.code=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return i&&i.length>0?i.charCodeAt(0):-1}),1,1);var t=new _FunctionDefinition((function(t,o){var i="";t.forEach((function(t){if(t instanceof _CellRangeExpression){var n=t.getValues(!0,void 0,o);i=i.concat(n.reduce((function(e,t){return""+e+t}),""))}else i=i.concat(_Expression.toString(t,e._rowIndex,e._columnIndex,o))}));return i}),Number.MAX_VALUE,1);this._functionTable.concat=t;this._functionTable.concatenate=t;this._functionTable.left=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),n=null==t[1]?1:Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o));return i&&i.length>0?i.slice(0,n):null}),2,1);this._functionTable.right=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),n=null==t[1]?1:Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o));return i&&i.length>0?n?i.slice(-n):"":null}),2,1);this._functionTable.find=new _FunctionDefinition((function(t,o){var i,n=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),l=_Expression.toString(t[1],e._rowIndex,e._columnIndex,o),r=null!=t[2]?wijmo_1.asInt(_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o)):0;return null!=l&&null!=n&&(i=!isNaN(r)&&r>0&&r<=l.length?l.indexOf(n,r-1):l.indexOf(n))>-1?i+1:-1}),3,2);this._functionTable.search=new _FunctionDefinition((function(t,o){var i,n,l,r=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),s=_Expression.toString(t[1],e._rowIndex,e._columnIndex,o),a=null!=t[2]?wijmo_1.asInt(_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o)):0;if(null!=s&&null!=r){n=new RegExp(r,"i");if(!isNaN(a)&&a>0&&a<s.length){s=s.substring(a-1);i=a}else i=1;if((l=s.search(n))>-1)return l+i}return-1}),3,2);this._functionTable.len=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return null!=i?i.length:-1}),1,1);this._functionTable.mid=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),n=Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o)),l=Math.floor(_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o));return i&&i.length>0&&n>0?i.substr(n-1,l):null}),3,3);this._functionTable.lower=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return i&&i.length>0?i.toLowerCase():null}),1,1);this._functionTable.upper=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return i&&i.length>0?i.toUpperCase():null}),1,1);this._functionTable.proper=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);if(i&&i.length>0){i=(i=i.toLowerCase())[0].toUpperCase()+i.substring(1);for(var n=1;n<i.length;n++)if(rgLetter.test(i[n])&&!rgLetter.test(i[n-1])){i=i.substr(0,n)+i[n].toUpperCase()+i.substring(n+1);n++}return i}return null}),1,1);this._functionTable.trim=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return i&&i.length>0?i.trim().replace(/\s+/gm," "):null}),1,1);this._functionTable.replace=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),n=Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o)),l=Math.floor(_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o)),r=_Expression.toString(t[3],e._rowIndex,e._columnIndex,o);return i&&i.length>0&&n>0?i.substring(0,n-1)+r+i.slice(n-1+l):null}),4,4);this._functionTable.substitute=new _FunctionDefinition((function(t,o){var i,n=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),l=_Expression.toString(t[1],e._rowIndex,e._columnIndex,o),r=_Expression.toString(t[2],e._rowIndex,e._columnIndex,o),s=4===t.length?_Expression.toNumber(t[3],e._rowIndex,e._columnIndex,o):null,a=0;if(null!=s&&s<1||isNaN(s))throw new ValueError(exports._ErrorMessages.InvalidParameter("instance_num"));if(n&&n.length>0&&l&&l.length>0){i=new RegExp(l,"g");return n.replace(i,(function(e){a++;if(null!=s){s=Math.floor(s);return a===s?r:e}return r}))}return null}),4,3);this._functionTable.rept=new _FunctionDefinition((function(t,o){var i,n=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),l=Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o)),r="";if(n&&n.length>0&&l>0)for(i=0;i<l;i++)r=r.concat(n);return r}),2,2);this._functionTable.text=new _FunctionDefinition((function(t,o){var i,n=t[0].evaluate(e._rowIndex,e._columnIndex,o),l=_Expression.toString(t[1],e._rowIndex,e._columnIndex,o);n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isDate(n))l=wijmo_xlsx_1.Workbook._fromXlsxDateFormat(l);else{var r=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o);if(!wijmo_1.isNumber(r)||isNaN(r))return n;if((i=l.match(/^(\d+)(\.\d+)?E\+(\d+)(\.\d+)?$/))&&5===i.length)return e._parseToScientificValue(r,i[1],i[2],i[3],i[4]);if(/M{1,4}|d{1,4}|y{1,4}/i.test(l)){l=wijmo_xlsx_1.Workbook._fromXlsxDateFormat(l);n=FlexSheet._fromOADate(r)}else l&&!/[ncpfdg]\d?/i.test(l)&&(l=wijmo_xlsx_1.Workbook.fromXlsxFormat(l)[0])}if(wijmo_1.isDate(n))switch(l){case"d":return n.getDate();case"M":return n.getMonth()+1;case"y":l="yy";break;case"yyy":l="yyyy"}return wijmo_1.Globalize.format(n,l)}),2,2);this._functionTable.value=new _FunctionDefinition((function(t,o){var i,n=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);if((n=n.replace(/(,\d{3})/g,(function(e){return e.substring(1)}))).length>0){if(n[0]===wijmo_1.culture.Globalize.numberFormat.currency.symbol)return+(n=n.substring(1));if("%"===n[n.length-1])return+(n=n.substring(0,n.length-1))/100}i=+n;return isNaN(i)?_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o):i}),1,1);this._functionTable.exact=new _FunctionDefinition((function(t,o){return _Expression.toString(t[0],e._rowIndex,e._columnIndex,o)==_Expression.toString(t[1],e._rowIndex,e._columnIndex,o)}),2,2)};_CalcEngine.prototype._registerDateFunction=function(){var e=this;this._functionTable.now=new _FunctionDefinition((function(){return{value:new Date,format:"M/d/yyyy h:mm"}}),0,0);this._functionTable.today=new _FunctionDefinition((function(){var e=new Date;return{value:new Date(e.getFullYear(),e.getMonth(),e.getDate()),format:"M/d/yyyy"}}),0,0);this._functionTable.year=new _FunctionDefinition((function(t,o){if(!_Expression.toString(t[0],e._rowIndex,e._columnIndex,o).trim())return 1900;var i=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o);return i&&!wijmo_1.isPrimitive(i)?i.value:wijmo_1.isDate(i)?i.getFullYear():1900}),1,1);this._functionTable.month=new _FunctionDefinition((function(t,o){if(!_Expression.toString(t[0],e._rowIndex,e._columnIndex,o).trim())return 1;var i=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o);return!wijmo_1.isPrimitive(i)&&i?i.value:wijmo_1.isDate(i)?i.getMonth()+1:1}),1,1);this._functionTable.day=new _FunctionDefinition((function(t,o){if(!_Expression.toString(t[0],e._rowIndex,e._columnIndex,o))return 0;var i=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o);return i&&!wijmo_1.isPrimitive(i)?i.value:wijmo_1.isDate(i)?i.getDate():0}),1,1);this._functionTable.hour=new _FunctionDefinition((function(t,o){var i=t[0].evaluate(e._rowIndex,e._columnIndex,o);if(wijmo_1.isNumber(i)&&!isNaN(i))return Math.floor(24*(i-Math.floor(i)));if(wijmo_1.isDate(i))return i.getHours();(i=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o))&&!wijmo_1.isPrimitive(i)&&(i=i.value);if(wijmo_1.isDate(i))return i.getHours();throw new ValueError(exports._ErrorMessages.InvalidParameter("serial_number"))}),1,1);this._functionTable.time=new _FunctionDefinition((function(t,o){var i=t[0].evaluate(e._rowIndex,e._columnIndex,o),n=t[1].evaluate(e._rowIndex,e._columnIndex,o),l=t[2].evaluate(e._rowIndex,e._columnIndex,o);if(wijmo_1.isNumber(i)&&wijmo_1.isNumber(n)&&wijmo_1.isNumber(l)){i%=24;n%=60;l%=60;return{value:new Date(0,0,0,i,n,l),format:"h:mm tt"}}throw new ValueError(exports._ErrorMessages.InvalidParameters)}),3,3);this._functionTable.date=new _FunctionDefinition((function(t,o){var i=t[0].evaluate(e._rowIndex,e._columnIndex,o),n=t[1].evaluate(e._rowIndex,e._columnIndex,o),l=t[2].evaluate(e._rowIndex,e._columnIndex,o);if(wijmo_1.isNumber(i)&&wijmo_1.isNumber(n)&&wijmo_1.isNumber(l))return{value:new Date(i,n-1,l),format:"M/d/yyyy"};throw new ValueError(exports._ErrorMessages.InvalidParameters)}),3,3);this._functionTable.datedif=new _FunctionDefinition((function(t,o){var i,n,l,r,s,a=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o),h=_Expression.toDate(t[1],e._rowIndex,e._columnIndex,o),u=t[2].evaluate(e._rowIndex,e._columnIndex,o);a&&!wijmo_1.isPrimitive(a)&&(a=a.value);h&&!wijmo_1.isPrimitive(h)&&(h=h.value);if(wijmo_1.isDate(a)&&wijmo_1.isDate(h)&&wijmo_1.isString(u)){if((i=a.getTime())>(n=h.getTime()))throw new NumericError(exports._ErrorMessages.InvalidParameter("start_date"));l=h.getDate()-a.getDate();r=h.getMonth()-a.getMonth();s=h.getFullYear()-a.getFullYear();switch(u.toUpperCase()){case"Y":return r>0?s:r<0?s-1:l>=0?s:s-1;case"M":return l>=0?12*s+r:12*s+r-1;case"D":return(n-i)/864e5;case"YM":return(r=l>=0?12*s+r:12*s+r-1)%12;case"YD":return r>0?(new Date(a.getFullYear(),h.getMonth(),h.getDate()).getTime()-a.getTime())/864e5:r<0?(new Date(a.getFullYear()+1,h.getMonth(),h.getDate()).getTime()-a.getTime())/864e5:l>=0?l:(new Date(a.getFullYear()+1,h.getMonth(),h.getDate()).getTime()-a.getTime())/864e5;case"MD":return l>=0?l:l=new Date(h.getFullYear(),h.getMonth(),0).getDate()-new Date(h.getFullYear(),h.getMonth()-1,1).getDate()+1+l;default:throw new NumericError(exports._ErrorMessages.InvalidParameter("unit"))}}throw new ValueError(exports._ErrorMessages.InvalidParameters)}),3,3)};_CalcEngine.prototype._registLookUpReferenceFunction=function(){var e=this;this._functionTable.column=new _FunctionDefinition((function(t,o,i,n){var l;if(null==t)return n+1;l=t[0];if((l=e._ensureNonFunctionExpression(l,o))instanceof _CellRangeExpression)return l.cells.col+1;throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),1,0);this._functionTable.columns=new _FunctionDefinition((function(t,o){var i=t[0];if((i=e._ensureNonFunctionExpression(i,o))instanceof _CellRangeExpression)return i.cells.columnSpan;throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),1,1);this._functionTable.row=new _FunctionDefinition((function(t,o,i,n){var l;if(null==t)return i+1;l=t[0];if((l=e._ensureNonFunctionExpression(l,o))instanceof _CellRangeExpression)return l.cells.row+1;throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),1,0);this._functionTable.rows=new _FunctionDefinition((function(t,o){var i=t[0];if((i=e._ensureNonFunctionExpression(i,o))instanceof _CellRangeExpression)return i.cells.rowSpan;throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),1,1);this._functionTable.choose=new _FunctionDefinition((function(t,o){var i=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o);if(isNaN(i))throw new ValueError(exports._ErrorMessages.InvalidParameter("index_num"));if(i<1||i>=t.length)throw new ValueError(exports._ErrorMessages.ParameterIsOutOfRange("index_num"));return t[i=Math.floor(i)].evaluate(e._rowIndex,e._columnIndex,o)}),255,2);this._functionTable.index=new _FunctionDefinition((function(t,o){var i,n=t[0],l=_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o),r=null!=t[2]?_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o):0;if(isNaN(l)||l<0)throw new ValueError(exports._ErrorMessages.InvalidParameter("row_num"));if(isNaN(r)||r<0)throw new ValueError(exports._ErrorMessages.InvalidParameter("column_num"));if((n=e._ensureNonFunctionExpression(n,o))instanceof _CellRangeExpression){if(l>(i=n.cells).rowSpan)throw new ReferenceError(exports._ErrorMessages.ParameterIsOutOfRange("row_num"));if(r>i.columnSpan)throw new ReferenceError(exports._ErrorMessages.ParameterIsOutOfRange("column_num"));if(l>0&&r>0)return e._owner.getCellValue(i.topRow+l-1,i.leftCol+r-1,!0,o);if(0===l&&0===r)return n;if(0===l)return new _CellRangeExpression(e,new wijmo_grid_1.CellRange(i.topRow,i.leftCol+r-1,i.bottomRow,i.leftCol+r-1),n.sheetRef,e._owner);if(0===r)return new _CellRangeExpression(e,new wijmo_grid_1.CellRange(i.topRow+l-1,i.leftCol,i.topRow+l-1,i.rightCol),n.sheetRef,e._owner)}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),4,2);this._functionTable.hlookup=new _FunctionDefinition((function(t,o){return e._handleHLookup(t,o)}),4,3);this._functionTable.vlookup=new _FunctionDefinition((function(t,o){return e._handleVLookup(t,o)}),4,3)};_CalcEngine.prototype._registFinacialFunction=function(){var e=this;this._functionTable.rate=new _FunctionDefinition((function(t,o){return{value:e._calculateRate(t,o),format:"p2"}}),6,3)};_CalcEngine.prototype._registAddressRelatedFunction=function(){var e=this;this._functionTable.indirect=new _FunctionDefinition((function(t,o){var i,n,l,r,s,a,h,u=e._ensureNonFunctionExpression(t[0],o);if(u instanceof _CellRangeExpression){i=u.cells;n=u.evaluate(i.row,i.col,o)}else n=u instanceof _Expression?u.evaluate(e._rowIndex,e._columnIndex,o):u;if(wijmo_1.isString(n)){if(2===(l=n.split("!")).length){r=l[0].toLowerCase();s=l[1].toLowerCase()}else s=l[0].toLowerCase();var d=e._owner.definedNames._find(s,r||e._sheet.name);o=o||e._owner.selectedSheet;if(d){if(d.sheetName&&d.sheetName.toLowerCase()!==o.name.toLowerCase())throw new ReferenceError(exports._ErrorMessages.InvalidCellRef);n=d.value}if(a=e._getCellRange(n)){if(a.sheetRef){for(var _=0;_<e._owner.sheets.length;_++)if(e._owner.sheets[_].name.toLowerCase()===a.sheetRef.toLowerCase()){h=e._owner.sheets[_];break}}else h=e._owner.selectedSheet;if(h)return e._owner.getCellValue(a.cellRef.cellRange.row,a.cellRef.cellRange.col,!0,o)}}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),2,1);this._functionTable.address=new _FunctionDefinition((function(t,o){var i,n,l=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),r=_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o),s=!1,a=!1;if(isNaN(l)||!wijmo_1.isInt(l)||l<1||l>1048576)throw new ValueError(exports._ErrorMessages.InvalidParameter("row_num"));if(isNaN(r)||!wijmo_1.isInt(r)||r<1||r>16384)throw new ValueError(exports._ErrorMessages.InvalidParameter("column_num"));if(null!=t[2]){i=_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o);if(isNaN(i)||!wijmo_1.isInt(i)||i<1||i>4)throw new ValueError(exports._ErrorMessages.InvalidParameter("abs_num"))}null!=t[4]&&(n=_Expression.toString(t[4],e._rowIndex,e._columnIndex,o));if(null==i||1===i){s=!0;a=!0}else 2===i?s=!0:3===i&&(a=!0);return(null!=n?n+"!":"")+(a?"$":"")+e._numAlpha(r)+(s?"$":"")+l}),5,2)};_CalcEngine.prototype._registerIsFunctions=function(){var e=this,getError=function(t,o){var i;try{i=t.evaluate(e._rowIndex,e._columnIndex,o)}catch(e){e instanceof FormulaError&&(i=e)}return i};this._functionTable.isblank=new _FunctionDefinition((function(t,o){var i=!1,n=t[0];if(n instanceof _CellRangeExpression){n.evaluate(e._rowIndex,e._columnIndex,o);i=!!n._isEmpty}return i}),1,1);this._functionTable.iserror=new _FunctionDefinition((function(e,t){return getError(e[0],t)instanceof FormulaError}),1,1);this._functionTable.iserr=new _FunctionDefinition((function(e,t){var o=getError(e[0],t);return o instanceof FormulaError&&!(o instanceof NotAvailableError)}),1,1);this._functionTable.iferror=new _FunctionDefinition((function(t,o){var i=getError(t[0],o);return i instanceof FormulaError?t[1].evaluate(e._rowIndex,e._columnIndex,o):i}),2,2)};_CalcEngine.prototype._addToken=function(e,t,o){var i=new _Token(e,t,o);this._tokenTable[e]=i};_CalcEngine.prototype._parseExpression=function(){this._getToken();return this._parseCompareOrConcat()};_CalcEngine.prototype._parseCompareOrConcat=function(){for(var e,t,o=this._parseAddSub();this._token.tokenType===_TokenType.COMPARE||this._token.tokenType===_TokenType.CONCAT;){e=this._token;this._getToken();t=this._parseAddSub();o=new _BinaryExpression(this,e,o,t)}return o};_CalcEngine.prototype._parseAddSub=function(){for(var e,t,o=this._parseMulDiv();this._token.tokenType===_TokenType.ADDSUB;){e=this._token;this._getToken();t=this._parseMulDiv();o=new _BinaryExpression(this,e,o,t)}return o};_CalcEngine.prototype._parseMulDiv=function(){for(var e,t,o=this._parsePower();this._token.tokenType===_TokenType.MULDIV;){if(this._token.tokenID===_TokenID.PERCENT){e=new _Token("%",_TokenID.PERCENT,_TokenType.MULDIV);this._token=new _Token(100,_TokenID.ATOM,_TokenType.LITERAL)}else{e=this._token;this._getToken()}t=this._parsePower();o=new _BinaryExpression(this,e,o,t)}return o};_CalcEngine.prototype._parsePower=function(){for(var e,t,o=this._parseUnary();this._token.tokenType===_TokenType.POWER;){e=this._token;this._getToken();t=this._parseUnary();o=new _BinaryExpression(this,e,o,t)}return o};_CalcEngine.prototype._parseUnary=function(){var e,t;if(this._token.tokenID===_TokenID.ADD||this._token.tokenID===_TokenID.SUB){e=this._token;this._getToken();t=this._parseAtom();return new _UnaryExpression(this,e,t)}return this._parseAtom()};_CalcEngine.prototype._parseAtom=function(){var e=null;switch(this._token.tokenType){case _TokenType.LITERAL:case _TokenType.ERROR:e=new _Expression(this,this._token);break;case _TokenType.IDENTIFIER:var t=this._token.value.toString(),o=t.toLowerCase(),i=this._functionTable[0===o.indexOf("_xlfn.")?o.substr(6):o];if(i){var n=this._getParameters();if(this._token.tokenType===_TokenType.GROUP&&this._token.tokenID===_TokenID.CLOSE){var l=n?n.length:0;if(-1!==i.paramMin&&l<i.paramMin)throw new SyntaxError(exports._ErrorMessages.TooFewParameters);if(-1!==i.paramMax&&l>i.paramMax)throw new SyntaxError(exports._ErrorMessages.TooManyParameters);"rand"!==o&&("column"!==o&&"row"!==o||0!==l)||(this._containsCellRef=!0);e=new _FunctionExpression(this,o,i,n);break}if("true"===o||"false"===o){e=new _FunctionExpression(this,o,i,n,!1);break}}var r=o.split("!"),s=void 0,a=void 0;if(2===r.length){a=r[0];s=r[1]}else s=r[0];var h=this._owner.definedNames._find(s,a||this._sheet.name);if(h){if(h.sheetName&&h.sheetName.toLowerCase()!==this._sheet.name.toLowerCase()&&h.sheetName.toLowerCase()!==a)throw new NameError(exports._ErrorMessages.DefNameInvalidSheet(h.sheetName));var u=this._pointer,d=this._expressLength,_=this._expression;this._pointer=0;(e=this._checkCache(h.value))._definedName=h.name;this._pointer=u;this._expressLength=d;this._expression=_;break}a="";if(null!=(p=this._owner._getTable(o))){if(""===(a=p.sheet.name))throw new NameError(exports._ErrorMessages.InvalidTable(o));var c=this._pointer,g=this._token;this._getToken();if(this._token.tokenType===_TokenType.SQUAREBRACKETS&&this._token.tokenID===_TokenID.OPEN){this._tableRefStart=!0;e=this._getTableReference(p,a,!0)}else{e=this._getTableReference(p,a,!1);this._pointer=c;this._token=g}break}var f=this._getCellRange(t);if(f){this._containsCellRef=!0;e=new _CellRangeExpression(this,f.cellRef.cellRange,f.sheetRef,this._owner,t.indexOf(":")>-1,f.cellRef.absRow,f.cellRef.absCol,f.cellRef.absRow2,f.cellRef.absCol2,f.isWholeRow);break}e=this.onUnknownFunction(o,this._getParameters());break;case _TokenType.GROUP:if(this._token.tokenID!==_TokenID.OPEN)throw new SyntaxError(exports._ErrorMessages.ExpressionExpected);this._getToken();e=this._parseCompareOrConcat();if(this._token.tokenID!==_TokenID.CLOSE)throw new SyntaxError(exports._ErrorMessages.UnbalancedParenthesis);e._inGroup=!0;break;case _TokenType.SQUAREBRACKETS:if(this._token.tokenID!==_TokenID.OPEN)throw new ValueError(exports._ErrorMessages.TableReferencesExpected);var p;if(null!=(p=this._sheet.findTable(this._rowIndex,this._columnIndex))){a=p.sheet.name;this._tableRefStart=!0;e=this._getTableReference(p,a,!0,!1)}}if(null==e)throw new SyntaxError(exports._ErrorMessages.BadExpression);this._getToken();return e};_CalcEngine.prototype._getToken=function(){for(var e,t,o,i,n,l,r="",s="",a=new RegExp("[ -〿-ゟ゠-ヿ-゚一-龯㐀-䶿]");this._pointer<this._expressLength&&" "===this._expression[this._pointer];)this._pointer++;if(this._pointer>=this._expressLength)this._token=new _Token(null,_TokenID.END,_TokenType.GROUP);else{l=(t=this._expression[this._pointer])>="0"&&t<="9"||"."==t;if(!(n=t>="a"&&t<="z"||t>="A"&&t<="Z"||a.test(t))&&!l){var h=this._tokenTable[t];if(h){this._token=h;this._pointer++;if(this._pointer<this._expressLength&&(">"===t||"<"===t)&&(h=this._tokenTable[this._expression.substring(this._pointer-1,this._pointer+1)])){this._token=h;this._pointer++}return}}if(l){i=this._pointer;this._parseDigit();if(":"!==this._expression[this._pointer])return;this._pointer=i}if('"'!==t){if(("'"!==t||(s=this._parseSheetRef()))&&("#"!==t||!this._parseError()))if("#"!==t){if(!n&&!l&&this._idChars.indexOf(t)<0&&!s)throw new SyntaxError(exports._ErrorMessages.IdentifierExpected);for(e=1;e+this._pointer<this._expressLength;e++){n=(t=this._expression[this._pointer+e])>="a"&&t<="z"||t>="A"&&t<="Z"||a.test(t);l=t>="0"&&t<="9";if("'"!==t||":"!==o){o=t;if(!n&&!l&&"."!==t&&this._idChars.indexOf(t)<0)break}else{r=s+this._expression.substring(this._pointer,this._pointer+e);this._pointer+=e;s=this._parseSheetRef();e=0}}r+=s+this._expression.substring(this._pointer,this._pointer+e);this._pointer+=e;this._token=new _Token(r,_TokenID.ATOM,_TokenType.IDENTIFIER)}else this._parseDate()}else this._parseString()}};_CalcEngine.prototype._getTableToken=function(){for(var e,t,o,i="",n=!1;this._pointer<this._expressLength&&" "===this._expression[this._pointer];)this._pointer++;if("@"===(t=this._expression[this._pointer])){i=t;this._pointer++}"["===(t=this._expression[this._pointer])&&(n=!0);for(e=1;e+this._pointer<this._expressLength;e++){t=this._expression[this._pointer+e];if(n&&","===t)throw new SyntaxError(exports._ErrorMessages.InvalidTableRef);if("]"===t)break}o=i+this._expression.substring(this._pointer+(n?1:0),this._pointer+e);this._pointer+=e+(n?1:0);this._token=new _Token(o,_TokenID.ATOM,_TokenType.IDENTIFIER)};_CalcEngine.prototype._parseDigit=function(){var e,t,o=-1,i=!1,n=0;for(e=0;e+this._pointer<this._expressLength;e++)if((t=this._expression[this._pointer+e])>="0"&&t<="9"){n=10*n+(+t-0);o>-1&&(o*=10)}else if("."===t&&o<0)o=1;else{if("E"!==t&&"e"!==t||i)break;i=!0;"+"!==(t=this._expression[this._pointer+e+1])&&"-"!==t||e++}i?n=+this._expression.substring(this._pointer,this._pointer+e):o>1&&(n/=o);this._token=new _Token(n,_TokenID.ATOM,_TokenType.LITERAL);this._pointer+=e};_CalcEngine.prototype._parseString=function(){var e,t,o;for(e=1;e+this._pointer<this._expressLength;e++)if('"'===(t=this._expression[this._pointer+e])){if('"'!==(e+this._pointer<this._expressLength-1?this._expression[this._pointer+e+1]:" "))break;e++}if('"'!==t)throw new SyntaxError(exports._ErrorMessages.CantFindFinalQuote);o=this._expression.substring(this._pointer+1,this._pointer+e);this._pointer+=e+1;if("!"===this._expression[this._pointer])throw new SyntaxError(exports._ErrorMessages.IllegalCrossSheetReference);this._token=new _Token(o.replace('""','"'),_TokenID.ATOM,_TokenType.LITERAL)};_CalcEngine.prototype._parseDate=function(){var e,t,o;for(e=1;e+this._pointer<this._expressLength&&"#"!==(t=this._expression[this._pointer+e]);e++);if("#"!==t)throw new SyntaxError(exports._ErrorMessages.CantFindFinalDateDelimiter);o=this._expression.substring(this._pointer+1,this._pointer+e);this._pointer+=e+1;this._token=new _Token(Date.parse(o),_TokenID.ATOM,_TokenType.LITERAL)};_CalcEngine.prototype._parseError=function(){var e,t=this._pointer;for(e=t+1;e<this._expressLength;e++){var o=this._expression[e],i=this._expression[e-1];if(!(o>="a"&&o<="z"||o>="A"&&o<="Z"||("0"===o||"?"===o||"!"===o||"/"===o)&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||"/"===i||"0"===i)))break}var n=e-t;if(n>3){var l=this._expression.substring(t,t+n),r=_FormulaErrorHelper.asError(l);if(r){this._token=new _Token(r,_TokenID.ATOM,_TokenType.ERROR);this._pointer+=n;return!0}}return!1};_CalcEngine.prototype._parseSheetRef=function(){var e,t,o;for(e=1;e+this._pointer<this._expressLength;e++)if("'"===(t=this._expression[this._pointer+e])){if("'"!==(e+this._pointer<this._expressLength-1?this._expression[this._pointer+e+1]:" "))break;e++}if("'"!==t)throw new SyntaxError(exports._ErrorMessages.CantFindFinalQuote);o=this._expression.substring(this._pointer+1,this._pointer+e);this._pointer+=e+1;return"!"===this._expression[this._pointer]?o.replace(/''/g,"'"):""};_CalcEngine.prototype._getCellRange=function(e){var t,o,i,n,l;if(e&&(t=e.split(":")).length>0&&t.length<3){if(null==(o=this._parseCell(t[0])).cellRef)return null;n=o.cellRef.cellRange;if(null!=o.cellRef.isWholeRow&&1===t.length)return null;if(n&&2===t.length){l=(i=this._parseCell(t[1])).cellRef.cellRange;if(null!=o.cellRef.isWholeRow&&o.cellRef.isWholeRow!==i.cellRef.isWholeRow)return null;o.sheetRef&&!i.sheetRef&&(i.sheetRef=o.sheetRef);if(o.sheetRef!==i.sheetRef)throw new ReferenceError(exports._ErrorMessages.CellRefMustBeInSameSheet);if(l){n.col2=l.col;n.row2=l.row}else n=null}}return null==n?null:{cellRef:{cellRange:n,absRow:o.cellRef.absRow,absCol:o.cellRef.absCol,absRow2:i?i.cellRef.absRow:null,absCol2:i?i.cellRef.absCol:null},sheetRef:o.sheetRef,isWholeRow:o.cellRef.isWholeRow}};_CalcEngine.prototype._parseCellRange=function(e){var t,o,i,n,l=-1,r=-1,s=!1,a=!1;for(t=0;t<e.length;t++)if("$"===(i=e[t])&&!s&&l<0)s=!0;else{if(!(i>="a"&&i<="z"||i>="A"&&i<="Z"))break;l<0&&(l=0);l=26*l+(i.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1)}for(;t<e.length;t++)if("$"===(i=e[t])&&!a&&r<0)a=!0;else{if(!(i>="0"&&i<="9"))break;r<0&&(r=0);r=10*r+(+i-0)}if(t<e.length)return null;if(r>-1&&l>-1){if(0===r)throw new NameError(exports._ErrorMessages.InvalidCellRef);o=new wijmo_grid_1.CellRange(r-1,l-1)}else if(-1===l){n=!0;o=new wijmo_grid_1.CellRange(r-1,0)}else if(-1===r){n=!1;o=new wijmo_grid_1.CellRange(0,l-1)}return{cellRange:o,absRow:a,absCol:s,isWholeRow:n}};_CalcEngine.prototype._parseCell=function(e){var t,o,i;if((t=e.lastIndexOf("!"))>0&&t<e.length-1){i=e.substring(0,t);o=e.substring(t+1)}else{if(!(t<=0))return null;o=e}return{cellRef:this._parseCellRange(o),sheetRef:i}};_CalcEngine.prototype._getParameters=function(){var e,t,o=this._pointer,i=this._token;this._getToken();if(this._token.tokenType!==_TokenType.SQUAREBRACKETS||this._token.tokenID!==_TokenID.OPEN){if(this._token.tokenID!==_TokenID.OPEN){this._pointer=o;this._token=i;return null}o=this._pointer;this._getToken();if(this._token.tokenID===_TokenID.CLOSE)return null;this._pointer=o;e=[];t=this._parseExpression();e.push(t);for(;this._token.tokenID===_TokenID.COMMA;){t=this._parseExpression();e.push(t)}if(this._token.tokenID!==_TokenID.CLOSE)throw new SyntaxError(exports._ErrorMessages.SyntaxError);return e}};_CalcEngine.prototype._getTableReference=function(e,t,o,i){void 0===i&&(i=!0);var n=[],l=o?this._getTableParameter():null,r=!1,s=!1;if(null==l){n.push("#Data");s=!0}else{n.push(l);for(;this._tableRefStart&&(this._token.tokenID===_TokenID.COMMA||":"===this._token.value);){":"===this._token.value&&(r=!0);if(null==(l=this._getTableParameter()))throw new SyntaxError(exports._ErrorMessages.InvalidTableRef);if(r){n[n.length-1]+=":"+l;r=!1}else n.push(l)}if(this._token.tokenType!==_TokenType.SQUAREBRACKETS||this._token.tokenID!==_TokenID.CLOSE)throw new SyntaxError(exports._ErrorMessages.UnbalancedSquareBrackets);this._tableRefStart=!1}var a=this._getTableRange(e,n);this._containsCellRef=!0;var h=new _CellRangeExpression(this,a,t.toLowerCase(),this._owner);h._tableParams=n;i&&(h._tableName=e.name);s&&(h._defTableParameterProvided=!0);return h};_CalcEngine.prototype._getTableParameter=function(){var e;for(this._pointer;this._pointer<this._expressLength&&" "===this._expression[this._pointer];)this._pointer++;if("]"===this._expression[this._pointer]){this._getToken();this._tableRefStart=!1;return null}this._getTableToken();e=this._token.value;this._getToken();return e};_CalcEngine.prototype._getTableRange=function(e,t){for(var o,i,n,l,r,s,a=0;a<t.length;a++){if(i)throw new ValueError(exports._ErrorMessages.InvalidTableRef);r=null;if("#"===(o=t[a].toLowerCase())[0]){switch(o){case"#all":r=e.getRange();break;case"#data":r=e.getRange(TableSection.Data);break;case"#headers":r=e.getRange(TableSection.Header);break;case"#totals":r=e.getRange(TableSection.Footer);break;case"#this row":l=e.getRange();if(!(this._rowIndex>=l.topRow&&this._rowIndex<=l.bottomRow))throw new ValueError(exports._ErrorMessages.RowIsOutOfTableRange(e.name));r=new wijmo_grid_1.CellRange(this._rowIndex,l.leftCol,this._rowIndex,l.rightCol);break;default:throw new ValueError(exports._ErrorMessages.InvalidTableRef)}if(null==r)throw new ValueError(exports._ErrorMessages.InvalidTableRef);if(null==n)n=r;else{n.row=n.topRow<r.topRow?n.topRow:r.topRow;n.row2=n.bottomRow>r.bottomRow?n.bottomRow:r.bottomRow}}else{i=!0;s=o.split(":");for(var h=0;h<s.length;h++){if(s.length>2)throw new ValueError(exports._ErrorMessages.InvalidTableColRef);if("@"===(o=s[h])[0]){if(null==(r=e.getRange(TableSection.Data,o.substring(1))))throw new ValueError(exports._ErrorMessages.InvalidTableRef);if(!(this._rowIndex>=r.topRow&&this._rowIndex<=r.bottomRow))throw new ValueError(exports._ErrorMessages.RowIsOutOfTableRange(e.name));r.row=this._rowIndex;r.row2=this._rowIndex}else if(null==(r=e.getRange(TableSection.Data,o)))throw new ValueError(exports._ErrorMessages.InvalidTableRef);0===h&&(null==n?n=r:n.col=r.col);n.col2=r.col;r=null}}}return n};_CalcEngine.prototype._getAggregate=function(e,t){for(var o=0,i=0,n=0,l=null,r=null,s=0;s<t.length;s++){var a=t[s];if(null!=a&&"number"==typeof a&&!isNaN(a)){(null==l||a<l)&&(l=a);(null==r||a>r)&&(r=a);o++;i+=a;n+=a*a}}var h=0==o?0:i/o;switch(e){case wijmo_1.Aggregate.Avg:return h;case wijmo_1.Aggregate.Max:return r;case wijmo_1.Aggregate.Min:return l;case wijmo_1.Aggregate.Sum:return i;case wijmo_1.Aggregate.VarPop:return o<=1?0:n/o-h*h;case wijmo_1.Aggregate.StdPop:return o<=1?0:Math.sqrt(n/o-h*h);case wijmo_1.Aggregate.Var:return o<=1?0:(n/o-h*h)*o/(o-1);case wijmo_1.Aggregate.Std:return o<=1?0:Math.sqrt((n/o-h*h)*o/(o-1))}throw"Invalid aggregate type."};_CalcEngine.prototype._getAggregateResult=function(e,t,o){var i,n=this._getItemList(t,o);i=this._getAggregate(e,n.items);n.isDate&&(i={value:i=new Date(i),format:n.format||"M/d/yyyy"});return i};_CalcEngine.prototype._getFlexSheetAggregateResult=function(e,t,o){var i,n;switch(e){case _FlexSheetAggregate.Count:i=this._getItemList(t,o,!1,void 0,void 0,!1);return this._countNumberCells(i.items);case _FlexSheetAggregate.CountA:return(i=this._getItemList(t,o,!1,void 0,void 0,!1)).items.length;case _FlexSheetAggregate.CountBlank:i=this._getItemList(t,o,!0,void 0,void 0,!1);return this._countBlankCells(i.items);case _FlexSheetAggregate.Rank:var l=_Expression.toNumber(t[0],this._rowIndex,this._columnIndex,o),r=t[2]?_Expression.toNumber(t[2],this._rowIndex,this._columnIndex,o):0;if(isNaN(l))throw new ValueError(exports._ErrorMessages.InvalidParameter("number"));if(isNaN(r))throw new ValueError(exports._ErrorMessages.InvalidParameter("order"));t[1]=this._ensureNonFunctionExpression(t[1],o);if(t[1]instanceof _CellRangeExpression){i=this._getItemList([t[1]],o);return this._getRankOfCellRange(l,i.items,r)}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);case _FlexSheetAggregate.CountIf:t[0]=this._ensureNonFunctionExpression(t[0],o);if(t[0]instanceof _CellRangeExpression){i=this._getItemList([t[0]],o,void 0,void 0,void 0,!1);return this._countCellsByCriteria([i.items],[t[1]],o)}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);case _FlexSheetAggregate.CountIfs:return this._handleCountIfs(t,o);case _FlexSheetAggregate.SumIf:t[0]=this._ensureNonFunctionExpression(t[0],o);if(t[0]instanceof _CellRangeExpression){var s=!1;t[2]=this._ensureNonFunctionExpression(t[2],o);null!=t[2]&&t[2]instanceof _CellRangeExpression&&(n=this._getItemList([t[2]],o,s=!0));i=this._getItemList([t[0]],o,s);return this._sumCellsByCriteria([i.items],[t[1]],n?n.items:null,o)}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);case _FlexSheetAggregate.SumIfs:return this._handleSumIfs(t,o);case _FlexSheetAggregate.Product:i=this._getItemList(t,o);return this._getProductOfNumbers(i.items)}throw"Invalid aggregate type."};_CalcEngine.prototype._getItemList=function(e,t,o,i,n,l){void 0===o&&(o=!1);void 0===i&&(i=!0);void 0===l&&(l=!0);var r,s,a,h,u,d,_,c,g,f,p=[];for(s=0;s<e.length;s++){u=e[s];if((u=this._ensureNonFunctionExpression(u,t))instanceof _CellRangeExpression){c=u._getSheet()||t||this._sheet;h=u.getValues(i,n,c,l);if(0===s){(g=c.getCellStyle(u.cells.topRow,u.cells.leftCol))&&(_=g.format);_||(f=c.grid.columns[u.cells.leftCol])&&(_=f.format)}for(a=0;a<h.length;a++){r=h[a];if(null==d&&null!=r&&!wijmo_1.isString(r)){d=wijmo_1.isDate(r);break}}for(a=0;a<h.length;a++){r=h[a];(o||null!=r&&""!==r)&&(wijmo_1.isDate(r)?p.push(+r):p.push(r))}}else{!(r=u instanceof _Expression?u.evaluate(this._rowIndex,this._columnIndex,t,void 0,void 0,l):u)||r instanceof FormulaError||wijmo_1.isPrimitive(r)||(r=r.value);if(!o&&(null==r||""===r))continue;var m=+r;isNaN(m)||(r=m);p.push(r);null==d&&p.length>0&&(d=r instanceof Date)}}0===p.length&&(d=!1);return{isDate:d,items:p,format:_}};_CalcEngine.prototype._countBlankCells=function(e){for(var t,o=0,i=0;o<e.length;o++)(null==(t=e[o])||wijmo_1.isString(t)&&""===t||wijmo_1.isNumber(t)&&isNaN(t))&&i++;return i};_CalcEngine.prototype._countNumberCells=function(e){for(var t,o=0,i=0;o<e.length;o++)null!=(t=e[o])&&wijmo_1.isNumber(t)&&!isNaN(t)&&i++;return i};_CalcEngine.prototype._getRankOfCellRange=function(e,t,o){void 0===o&&(o=0);var i,n=0,l=0;o?t.sort((function(e,t){return isNaN(e)||isNaN(t)?-1:e-t})):t.sort((function(e,t){return isNaN(e)||isNaN(t)?1:t-e}));for(;n<t.length;n++){i=t[n];if(!isNaN(i)&&wijmo_1.isNumber(i)){l++;if(e===i)return l}}throw new ValueError(exports._ErrorMessages.ParameterIsOutOfRange("number"))};_CalcEngine.prototype._handleCountIfs=function(e,t){var o,i,n,l,r=0,s=[],a=[];if(e.length%2!=0)throw new ValueError(exports._ErrorMessages.InvalidParameters);for(;r<e.length/2;r++){i=e[2*r];if(!((i=this._ensureNonFunctionExpression(i,t))instanceof _CellRangeExpression))throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);if(0===r){if(!i.cells)throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);n=i.cells.rowSpan;l=i.cells.columnSpan}else{if(!i.cells)throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);if(i.cells.rowSpan!==n||i.cells.columnSpan!==l)throw new ValueError(exports._ErrorMessages.RangesMustBeTheSame)}o=this._getItemList([i],t,void 0,void 0,void 0,!1);s[r]=o.items;a[r]=e[2*r+1]}return this._countCellsByCriteria(s,a,t)};_CalcEngine.prototype._countCellsByCriteria=function(e,t,o,i){for(var n,l=0,r=e[0].length,s=[],a=0;a<t.length;a++){"*"===(u=_Expression.toString(t[a],this._rowIndex,this._columnIndex,o))?s.push(u):s.push(this._parseRightExpr(u))}for(var h=0;h<r;h++){n=!1;for(a=0;a<e.length;a++){var u,d=e[a][h];if("string"==typeof(u=s[a])){if("*"!==u&&(null==d||""===d)){n=!1;break}if((n="*"===u||this.evaluate(this._combineExpr(d,u),null,o,this._rowIndex,this._columnIndex,!1,!0))instanceof FormulaError||!n)break}else if(!(n=n=u.reg.test(d.toString())===u.checkMathces))break}if(n&&!(n instanceof FormulaError))if(i){var _=i[h];null!=_&&wijmo_1.isNumber(_)&&!isNaN(_)&&l++}else l++}return l};_CalcEngine.prototype._handleSumIfs=function(e,t){var o,i,n,l,r,s,a=1,h=[],u=[],d=!1;if(e.length%2!=1)throw new ValueError(exports._ErrorMessages.InvalidParameters);n=e[0];if(!((n=this._ensureNonFunctionExpression(n,t))instanceof _CellRangeExpression))throw new ValueError(exports._ErrorMessages.InvalidParameter("Sum_range"));if(!n.cells)throw new ValueError(exports._ErrorMessages.InvalidParameter("Sum_range"));r=n.cells.rowSpan;s=n.cells.columnSpan;i=this._getItemList([n],t,d=!0);for(;a<(e.length+1)/2;a++){l=e[2*a-1];if(!((l=this._ensureNonFunctionExpression(l,t))instanceof _CellRangeExpression))throw new ValueError(exports._ErrorMessages.InvalidParameter("Criteria_range"+a));if(!l.cells)throw new ValueError(exports._ErrorMessages.InvalidParameter("Criteria_range"+a));if(l.cells.rowSpan!==r||l.cells.columnSpan!==s)throw new ValueError(exports._ErrorMessages.RangesMustBeTheSame);o=this._getItemList([l],t,d);h[a-1]=o.items;u[a-1]=e[2*a]}return this._sumCellsByCriteria(h,u,i.items,t)};_CalcEngine.prototype._sumCellsByCriteria=function(e,t,o,i){var n,l,r,s,a=0,h=0,u=0,d=e[0].length,_=[];null==o&&(o=e[0]);for(;h<t.length;h++)"*"===(s=_Expression.toString(t[h],this._rowIndex,this._columnIndex,i))?_.push(s):_.push(this._parseRightExpr(s));for(;a<d;a++){l=!1;n=o[a];for(h=0;h<e.length;h++){r=e[h][a];if("string"==typeof(s=_[h])){if("*"!==s&&null==r){l=!1;break}if((l="*"===s||this.evaluate(this._combineExpr(r,s),null,i,this._rowIndex,this._columnIndex,!1))instanceof FormulaError||!l)break}else if(!(l=s.reg.test(r.toString())===s.checkMathces))break}l&&wijmo_1.isNumber(n)&&!isNaN(n)&&(u+=n)}return u};_CalcEngine.prototype._getProductOfNumbers=function(e){var t,o=0,i=1,n=!1;if(e)for(;o<e.length;o++){t=e[o];if(wijmo_1.isNumber(t)&&!isNaN(t)){i*=t;n=!0}}return n?i:0};_CalcEngine.prototype._handleSubtotal=function(e,t){var o,i,n,l,r=!0,s=!0;if((o=_Expression.toNumber(e[0],this._rowIndex,this._columnIndex,t))>=1&&o<=11||o>=101&&o<=111){o>=101&&o<=111&&(r=!1);(o=wijmo_1.asEnum(o,_SubtotalFunction))!==_SubtotalFunction.CountA&&o!==_SubtotalFunction.CountAWithoutHidden||(s=!1);i=this._getItemList(e.slice(1),t,s,r);switch(o){case _SubtotalFunction.Count:case _SubtotalFunction.CountWithoutHidden:return this._countNumberCells(i.items);case _SubtotalFunction.CountA:case _SubtotalFunction.CountAWithoutHidden:return i.items.length;case _SubtotalFunction.Product:case _SubtotalFunction.ProductWithoutHidden:return this._getProductOfNumbers(i.items);case _SubtotalFunction.Average:case _SubtotalFunction.AverageWithoutHidden:n=wijmo_1.Aggregate.Avg;break;case _SubtotalFunction.Max:case _SubtotalFunction.MaxWithoutHidden:n=wijmo_1.Aggregate.Max;break;case _SubtotalFunction.Min:case _SubtotalFunction.MinWithoutHidden:n=wijmo_1.Aggregate.Min;break;case _SubtotalFunction.Std:case _SubtotalFunction.StdWithoutHidden:n=wijmo_1.Aggregate.Std;break;case _SubtotalFunction.StdPop:case _SubtotalFunction.StdPopWithoutHidden:n=wijmo_1.Aggregate.StdPop;break;case _SubtotalFunction.Sum:case _SubtotalFunction.SumWithoutHidden:n=wijmo_1.Aggregate.Sum;break;case _SubtotalFunction.Var:case _SubtotalFunction.VarWithoutHidden:n=wijmo_1.Aggregate.Var;break;case _SubtotalFunction.VarPop:case _SubtotalFunction.VarPopWithoutHidden:n=wijmo_1.Aggregate.VarPop}l=this._getAggregate(n,i.items);i.isDate&&(l=new Date(l));return l}throw new ValueError(exports._ErrorMessages.InvalidParameter("Function_num"))};_CalcEngine.prototype._handleDCount=function(e,t){var o,i,n,l=e[0],r=e[2];l=this._ensureNonFunctionExpression(l,t);r=this._ensureNonFunctionExpression(r,t);if(l instanceof _CellRangeExpression&&r instanceof _CellRangeExpression){o=e[1].evaluate(this._rowIndex,this._columnIndex,t);i=this._getColumnIndexByField(l,o);return(n=this._getItemList([l],t,!1,!0,i,!1)).items&&n.items.length>1?this._DCountWithCriteria(n.items.slice(1),l,r):0}throw new ValueError(exports._ErrorMessages.InvalidParameter("Database"))};_CalcEngine.prototype._DCountWithCriteria=function(e,t,o){var i,n,l,r,s,a,h,u,d,_,c,g=o.cells,f=0;i=this._owner._getSheet(t.sheetRef);n=this._owner._getSheet(o.sheetRef);if(g.rowSpan>1){l=g.topRow;for(r=g.bottomRow;r>g.topRow;r--){_=[];c=[];for(s=g.leftCol;s<=g.rightCol;s++)if(null!=(h=this._owner.getCellValue(r,s,!1,n))&&""!==h){c.push(new _Expression(this,h));u=this._owner.getCellValue(l,s,!1,n);a=this._getColumnIndexByField(t,u);if(!(null!=(d=this._getItemList([t],i,!1,!0,a,!1)).items&&d.items.length>1))throw new ValueError("Criteria");_.push(d.items.slice(1))}f+=this._countCellsByCriteria(_,c,i,e)}return f}throw new ValueError("Criteria")};_CalcEngine.prototype._getColumnIndexByField=function(e,t){var o,i,n,l,r;if(-1===(r=(o=e.cells).topRow))throw new ValueError(exports._ErrorMessages.InvalidParameter("Database"));if(wijmo_1.isInt(t)&&!isNaN(t)){if(t>=1&&t<=o.columnSpan)return n=o.leftCol+t-1}else{i=this._owner._getSheet(e.sheetRef);for(n=o.leftCol;n<=o.rightCol;n++){l=this._owner.getCellValue(r,n,!1,i);if((t=wijmo_1.isString(t)?t.toLowerCase():t)===(l=wijmo_1.isString(l)?l.toLowerCase():l))return n}}throw new ValueError(exports._ErrorMessages.InvalidParameter("Field"))};_CalcEngine.prototype._getSumProduct=function(e,t){var o,i,n,l=0,r=this._getItemListForSumProduct(e,t);if(r.length>0){i=r[0].length;n=r.length;for(var s=0;s<i;s++){o=1;for(var a=0;a<n;a++)o*=r[a][s];l+=o}}return l};_CalcEngine.prototype._getItemListForSumProduct=function(e,t){var o,i,n,l,r,s,a=[[]];for(n=0;n<e.length;n++){s=e[n];o=[];if((s=this._ensureNonFunctionExpression(s,t))instanceof _CellRangeExpression){r=s.getValues(!0,null,t);for(l=0;l<r.length;l++){i=r[l];o.push(+i)}}else{i=s instanceof _Expression?s.evaluate(this._rowIndex,this._columnIndex,t):s;o.push(+i)}if(n>0&&o.length!==a[0].length)throw new ValueError(exports._ErrorMessages.RangesMustBeTheSame);a[n]=o}return a};_CalcEngine.prototype._parseRightExpr=function(e){var t,o,i=!1;if(e.indexOf("?")>-1||e.indexOf("*")>-1){if(null==(t=e.match(/=?([?*]*)(\w*)([?*]*)(\w*)([?*]*)/))||6!==t.length)throw new ValueError(exports._ErrorMessages.InvalidParameter("Criteria"));o=new RegExp("^"+(t[1].length>0?this._parseRegCriteria(t[1]):"")+t[2]+(t[3].length>0?this._parseRegCriteria(t[3]):"")+t[4]+(t[5].length>0?this._parseRegCriteria(t[5]):"")+"$","i");/^[<>=]/.test(e)?"="===e.trim()[0]&&(i=!0):i=!0;return{reg:o,checkMathces:i}}var n=e.toLowerCase();if(isNaN(+e))if("true"===n||"false"===n)e="="+e;else if(/^\w/.test(e))e='="'+e+'"';else{if(!/^[<>=]{1,2}\s*-?.+$/.test(e))throw new ValueError(exports._ErrorMessages.InvalidParameter("Criteria"));e=e.replace(/([<>=]{1,2})\s*(-?.+)/,(function(e,t,o){var i=o.toLowerCase();return t+(isNaN(+o)&&"true"!==i&&"false"!==i?'"'+o+'"':o)}))}else e="="+ +e;return e};_CalcEngine.prototype._combineExpr=function(e,t){(wijmo_1.isString(e)||wijmo_1.isDate(e))&&(e='"'+e+'"');return(e="="+e)+t};_CalcEngine.prototype._parseRegCriteria=function(e){for(var t=0,o=0,i="";t<e.length;t++)if("*"===e[t]){if(o>0){i+="\\w{"+o+"}";o=0}i+="\\w*"}else"?"===e[t]&&o++;o>0&&(i+="\\w{"+o+"}");return i};_CalcEngine.prototype._calculateRate=function(e,t){var o,i,n,l,r,s,a,h,u,d,_=0,c=0;n=_Expression.toNumber(e[0],this._rowIndex,this._columnIndex,t);l=_Expression.toNumber(e[1],this._rowIndex,this._columnIndex,t);r=_Expression.toNumber(e[2],this._rowIndex,this._columnIndex,t);s=null!=e[3]?_Expression.toNumber(e[3],this._rowIndex,this._columnIndex,t):0;a=null!=e[4]?_Expression.toNumber(e[4],this._rowIndex,this._columnIndex,t):0;i=null!=e[5]?_Expression.toNumber(e[5],this._rowIndex,this._columnIndex,t):.1;Math.abs(i)<1e-7?r*(1+n*i)+l*(1+i*a)*n+s:r*(h=Math.exp(n*Math.log(1+i)))+l*(1/i+a)*(h-1)+s;u=r+l*n+s;d=r*h+l*(1/i+a)*(h-1)+s;o=i;for(;Math.abs(u-d)>1e-7&&_<20;){i=(d*c-u*o)/(d-u);c=o;o=i;u=d;d=Math.abs(i)<1e-7?r*(1+n*i)+l*(1+i*a)*n+s:r*(h=Math.exp(n*Math.log(1+i)))+l*(1/i+a)*(h-1)+s;++_}if(Math.abs(u-d)>1e-7&&20===_)throw new NumericError(exports._ErrorMessages.RateCriteriaFails);return i};_CalcEngine.prototype._handleHLookup=function(e,t){var o=this;return this._handleLookup(e,t,{base:function(e){return e.topRow},span:function(e){return e.rowSpan},iterStart:function(e){return e.leftCol},iterEnd:function(e){return e.rightCol},getValue:function(e,t,i){return o._owner.getCellValue(e,t,0,i)}})};_CalcEngine.prototype._handleVLookup=function(e,t){var o=this;return this._handleLookup(e,t,{base:function(e){return e.leftCol},span:function(e){return e.columnSpan},iterStart:function(e){return e.topRow},iterEnd:function(e){return e.bottomRow},getValue:function(e,t,i){return o._owner.getCellValue(t,e,0,i)}})};_CalcEngine.prototype._handleLookup=function(e,t,o){var i=e[0].evaluate(this._rowIndex,this._columnIndex,t),n=e[1],l=_Expression.toNumber(e[2],this._rowIndex,this._columnIndex,t),r=null==e[3]||_Expression.toBoolean(e[3],this._rowIndex,this._columnIndex,t);if(null==i||""===i)throw new NotAvailableError(exports._ErrorMessages.InvalidParameter("Lookup_value"));if(isNaN(l)||l<0)throw new ValueError(exports._ErrorMessages.InvalidParameter("index_num"));if((n=this._ensureNonFunctionExpression(n,t))instanceof _CellRangeExpression){t=n._getSheet()||t||this._sheet;var s=n.cells;if(l>o.span(s))throw new ReferenceError(exports._ErrorMessages.ParameterIsOutOfRange("index_num"));var a=void 0;r?-1===(a=this._exactMatch(i,s,!1,o,t))&&(a=this._approximateMatch(i,s,o,t)):a=this._exactMatch(i,s,!0,o,t);if(-1===a)throw new NotAvailableError;var h=o.getValue(o.base(s)+l-1,a,t);if(null==h)throw new NotAvailableError;return h}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)};_CalcEngine.prototype._exactMatch=function(e,t,o,i,n){var l,r=i.base(t);wijmo_1.isString(e)&&(e=e.toLowerCase());if(o&&wijmo_1.isString(e)&&(e.indexOf("?")>-1||e.indexOf("*")>-1)){var s=e.match(/([?*]*)(\w+)([?*]*)(\w+)([?*]*)/);if(null==s||6!==s.length)throw new ValueError(exports._ErrorMessages.InvalidParameter("Lookup_value"));l=new RegExp("^"+(s[1].length>0?this._parseRegCriteria(s[1]):"")+s[2]+(s[3].length>0?this._parseRegCriteria(s[3]):"")+s[4]+(s[5].length>0?this._parseRegCriteria(s[5]):"")+"$","i")}for(var a=i.iterStart(t);a<=i.iterEnd(t);a++){var h=i.getValue(r,a,n);if(null!=l){if(l.test(h))return a}else{wijmo_1.isString(h)&&(h=h.toLowerCase());if(e===h)return a}}return-1};_CalcEngine.prototype._approximateMatch=function(e,t,o,i){var n=o.base(t),l=[];wijmo_1.isString(e)&&(e=e.toLowerCase());for(var r=o.iterStart(t);r<=o.iterEnd(t);r++){var s=o.getValue(n,r,i);s=isNaN(+s)?s:+s;l.push({value:s,index:r})}l.sort((function(e,t){wijmo_1.isString(e.value)&&(e.value=e.value.toLowerCase());wijmo_1.isString(t.value)&&(t.value=t.value.toLowerCase());return e.value>t.value?-1:e.value===t.value?t.index-e.index:1}));for(var a=0;a<l.length;a++){s=l[a];wijmo_1.isString(s.value)&&(s.value=s.value.toLowerCase());if(e>s.value)return s.index}throw new NotAvailableError};_CalcEngine.prototype._parseToScientificValue=function(e,t,o,i,n){var l,r,s,a,h=0;if(Math.abs(e)>=1){r="+";l=Math.pow(10,t.length);for(;e>l;){e/=l;h+=t.length}}else{r="-";l=Math.pow(10,t.length);for(;e*l<l;){e*=l;h+=t.length}}s=wijmo_1.Globalize.format(e,"D"+t.length);if(o){if((s+=wijmo_1.Globalize.format(e-Math.floor(e),t+o).substring(1)).indexOf(".")>-1)a=s.length-1-s.indexOf(".");else{s+=".";a=0}for(;a<o.length-1;){s+="0";a++}}s+="E"+r+wijmo_1.Globalize.format(h,"D"+i.length);if(n){s+=".";for(var u=1;u<n.length;u++)s+="0"}return s};_CalcEngine.prototype._checkCache=function(e,t,o,i,n,l){void 0===t&&(t=!0);void 0===o&&(o=!1);null!=i&&(this._sheet=this._owner.sheets[i]);null!=n&&(this._rowIndex=n);null!=l&&(this._columnIndex=l);var r=this._sheet?this._sheet.name:"",s=this._expressionCache[r+":"+t+":"+o+":"+e]||this._expressionCache[r+"_"+this._rowIndex+"_"+this._columnIndex+":"+t+":"+o+":"+e];if(s){if(s.token.tokenType===_TokenType.ERROR)throw s.token.value;return s}s=this.parse(e);if(this._token.tokenID!==_TokenID.END||this._token.tokenType!==_TokenType.GROUP)throw new SyntaxError(exports._ErrorMessages.InvalidExpression(e));this._cacheSize>1e4&&this.clearExpressionCache();this._expressionCache[r+(this._containsCellRef?"_"+this._rowIndex+"_"+this._columnIndex:"")+":"+t+":"+o+":"+e]=s;this._cacheSize++;return s};_CalcEngine.prototype._ensureNonFunctionExpression=function(e,t){for(;e instanceof _FunctionExpression;)e=e.evaluate(this._rowIndex,this._columnIndex,t);return e};_CalcEngine.prototype._numAlpha=function(e){var t=Math.floor((e-1)/26);return(t>0?this._numAlpha(t):"")+String.fromCharCode((e-1)%26+65)};_CalcEngine.prototype._filterUnwantedCommas=function(e){return e.replace(/,+\s*(?=\))/g,"")};_CalcEngine.PowOf10=Array.apply(null,{length:21}).map((function(e,t){return Math.pow(10,t)}));return _CalcEngine}();exports._CalcEngine=_CalcEngine;var _Token=function(){function _Token(e,t,o){this._value=e;this._tokenID=t;this._tokenType=o}Object.defineProperty(_Token.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0});Object.defineProperty(_Token.prototype,"tokenID",{get:function(){return this._tokenID},enumerable:!0,configurable:!0});Object.defineProperty(_Token.prototype,"tokenType",{get:function(){return this._tokenType},enumerable:!0,configurable:!0});return _Token}();exports._Token=_Token;var _TokenType,_TokenID,_FlexSheetAggregate,_SubtotalFunction,_FunctionDefinition=function(){function _FunctionDefinition(e,t,o){this._paramMax=Number.MAX_VALUE;this._paramMin=Number.MIN_VALUE;this._func=e;wijmo_1.isNumber(t)&&!isNaN(t)&&(this._paramMax=t);wijmo_1.isNumber(o)&&!isNaN(o)&&(this._paramMin=o)}Object.defineProperty(_FunctionDefinition.prototype,"paramMax",{get:function(){return this._paramMax},enumerable:!0,configurable:!0});Object.defineProperty(_FunctionDefinition.prototype,"paramMin",{get:function(){return this._paramMin},enumerable:!0,configurable:!0});Object.defineProperty(_FunctionDefinition.prototype,"func",{get:function(){return this._func},enumerable:!0,configurable:!0});return _FunctionDefinition}();exports._FunctionDefinition=_FunctionDefinition;!function(e){e[e.COMPARE=0]="COMPARE";e[e.ADDSUB=1]="ADDSUB";e[e.MULDIV=2]="MULDIV";e[e.POWER=3]="POWER";e[e.CONCAT=4]="CONCAT";e[e.GROUP=5]="GROUP";e[e.LITERAL=6]="LITERAL";e[e.IDENTIFIER=7]="IDENTIFIER";e[e.ERROR=8]="ERROR";e[e.SQUAREBRACKETS=9]="SQUAREBRACKETS"}(_TokenType=exports._TokenType||(exports._TokenType={}));!function(e){e[e.GT=0]="GT";e[e.LT=1]="LT";e[e.GE=2]="GE";e[e.LE=3]="LE";e[e.EQ=4]="EQ";e[e.NE=5]="NE";e[e.ADD=6]="ADD";e[e.SUB=7]="SUB";e[e.MUL=8]="MUL";e[e.DIV=9]="DIV";e[e.DIVINT=10]="DIVINT";e[e.MOD=11]="MOD";e[e.POWER=12]="POWER";e[e.CONCAT=13]="CONCAT";e[e.OPEN=14]="OPEN";e[e.CLOSE=15]="CLOSE";e[e.END=16]="END";e[e.COMMA=17]="COMMA";e[e.PERIOD=18]="PERIOD";e[e.ATOM=19]="ATOM";e[e.PERCENT=20]="PERCENT"}(_TokenID=exports._TokenID||(exports._TokenID={}));exports._OpMap=((_a={})[_TokenID.GT]=">",_a[_TokenID.LT]="<",_a[_TokenID.GE]=">=",_a[_TokenID.LE]="<=",_a[_TokenID.EQ]="=",_a[_TokenID.NE]="<>",_a[_TokenID.ADD]="+",_a[_TokenID.SUB]="-",_a[_TokenID.MUL]="*",_a[_TokenID.DIV]="/",_a[_TokenID.PERCENT]="%",_a[_TokenID.DIVINT]="\\",_a[_TokenID.POWER]="^",_a[_TokenID.CONCAT]="&",_a);!function(e){e[e.Count=0]="Count";e[e.CountA=1]="CountA";e[e.CountBlank=2]="CountBlank";e[e.CountIf=3]="CountIf";e[e.CountIfs=4]="CountIfs";e[e.Rank=5]="Rank";e[e.SumIf=6]="SumIf";e[e.SumIfs=7]="SumIfs";e[e.Product=8]="Product"}(_FlexSheetAggregate||(_FlexSheetAggregate={}));!function(e){e[e.Average=1]="Average";e[e.Count=2]="Count";e[e.CountA=3]="CountA";e[e.Max=4]="Max";e[e.Min=5]="Min";e[e.Product=6]="Product";e[e.Std=7]="Std";e[e.StdPop=8]="StdPop";e[e.Sum=9]="Sum";e[e.Var=10]="Var";e[e.VarPop=11]="VarPop";e[e.AverageWithoutHidden=101]="AverageWithoutHidden";e[e.CountWithoutHidden=102]="CountWithoutHidden";e[e.CountAWithoutHidden=103]="CountAWithoutHidden";e[e.MaxWithoutHidden=104]="MaxWithoutHidden";e[e.MinWithoutHidden=105]="MinWithoutHidden";e[e.ProductWithoutHidden=106]="ProductWithoutHidden";e[e.StdWithoutHidden=107]="StdWithoutHidden";e[e.StdPopWithoutHidden=108]="StdPopWithoutHidden";e[e.SumWithoutHidden=109]="SumWithoutHidden";e[e.VarWithoutHidden=110]="VarWithoutHidden";e[e.VarPopWithoutHidden=111]="VarPopWithoutHidden"}(_SubtotalFunction||(_SubtotalFunction={}));var rgLetter=/[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,_FlexSheetCellFactory=function(e){__extends(_FlexSheetCellFactory,e);function _FlexSheetCellFactory(){return null!==e&&e.apply(this,arguments)||this}_FlexSheetCellFactory.prototype.updateCell=function(t,o,i,n,l){var r,s,a,h=t.grid,u=/^border/;t.cellType===wijmo_grid_1.CellType.Cell&&(n.style.cssText="");if(t.cellType===wijmo_grid_1.CellType.Cell){var d=o*h.columns.length+i,_=h.selectedSheet;l&&!l.isSingleCell&&(d=l.row*h.columns.length+l.col);s=_&&_._styledCells?_._styledCells[d]:null;a=_isEditingCell(h,o,i);if(s&&"pre-wrap"==s.whiteSpace&&a){r=t.rows[o]._getFlag(wijmo_grid_1.RowColFlags.MultiLine);t.rows[o]._setFlag(wijmo_grid_1.RowColFlags.MultiLine,!0,!0)}}e.prototype.updateCell.call(this,t,o,i,n,l);null!=r&&t.rows[o]._setFlag(wijmo_grid_1.RowColFlags.MultiLine,r,!0);if(l&&!l.isSingleCell){o=l.row;i=l.col}switch(t.cellType){case wijmo_grid_1.CellType.ColumnHeader:var c=t.getCellData(o,i,!0),g=null,f=null;if(y=n.querySelector('[type="checkbox"]')){g=y.checked;f=y.indeterminate}n.textContent?n.innerHTML=n.innerHTML.replace(wijmo_1.escapeHtml(n.textContent),c).replace(n.textContent,c):n.innerHTML+=c;if(g||f){var p=n.querySelectorAll('[type="checkbox"]');if(p)for(var m=0;m<p.length;m++){var w=p[m];w.checked=g;w.indeterminate=f}}n.style.textAlign="center";break;case wijmo_grid_1.CellType.Cell:var C=h._getBindingColumn(t,o,t.columns[i]);if(l&&!l.isSingleCell){var S=this._getFirstVisibleCell(h,l);o=S.row;i=S.col}if(t.rows[o]instanceof HeaderRow){(t.columns[i].dataMapEditor===wijmo_grid_1.DataMapEditor.RadioButtons&&n.firstElementChild instanceof HTMLLabelElement||t.columns[i].dataType===wijmo_1.DataType.Boolean&&1===n.childElementCount&&n.firstElementChild instanceof HTMLLabelElement&&n.firstElementChild.firstElementChild instanceof HTMLInputElement&&"checkbox"===n.firstElementChild.firstElementChild.type||t.columns[i].dataType!==wijmo_1.DataType.Boolean&&!n.innerHTML)&&(n.innerHTML=wijmo_1.escapeHtml(h.getCellValue(o,i)));wijmo_1.addClass(n,exports.FlexSheetClsNames.headerRow)}else{if(a){var b=n.querySelector("input");b&&s&&s.textAlign&&(b.style.textAlign=s.textAlign)}else{var v=t.rows[o]instanceof wijmo_grid_1.GroupRow;if(t.columns[i].dataType===wijmo_1.DataType.Boolean){var y;if((y=n.querySelector('[type="checkbox"]'))&&!wijmo_1.hasClass(y,"wj-column-selector")){y.checked=h.getCellValue(o,i);y.disabled=y.disabled||!h.canEditCell(o,i)}}else if(C.dataMap&&!v){var x=h.getCellValue(o,i,!0),R=n.firstChild;R&&3===R.nodeType&&R.nodeValue!==x&&(R.nodeValue=x)}else if(0===n.childElementCount&&n.textContent===h.getCellData(o,i,!0)){x=h.getCellValue(o,i,!0);var T=(s?s.format:null)||(v?null:C.format);if(""!==x&&wijmo_1.isNumber(+x)&&!isNaN(+x)&&/[hsmy:]/i.test(T)){var E=wijmo_1.Globalize.parseDate(x,T);if(!E){E=FlexSheet._fromOADate(+x);isNaN(E.getTime())||(x=wijmo_1.Globalize.formatDate(E,T))}}if(T||!v){x=wijmo_1.isString(x)?x.replace(/^(')(\s*[\w|=])/,"$2"):x;wijmo_1.isString(x)?x&&this._isURL(x)?n.innerHTML='<a href="'+x+'" target="_blank">'+wijmo_1.escapeHtml(x)+"</a>":n.innerHTML=wijmo_1.escapeHtml(x):n.innerHTML=x}}}if(s){var F=n.style,A=void 0;for(var I in s)if("className"===I)s.className&&wijmo_1.addClass(n,s.className);else if("format"!==I&&(A=s[I]))if(!wijmo_1.hasClass(n,wijmo_1.ControlStateClsNames.selected)&&!wijmo_1.hasClass(n,wijmo_1.ControlStateClsNames.multiSelected)||"color"!==I&&"backgroundColor"!==I)if("whiteSpace"===I&&"normal"===A)F[I]="";else{if(u.test(I))continue;F[I]=A}else F[I]=""}var D=this._getCellBorders(h,h.selectedSheet,l||new wijmo_grid_1.CellRange(o,i));if(D)for(var k in D)n.style[k]=D[k]}if(n.style.backgroundColor||n.style.color){s||(s={});n.style.backgroundColor&&(s.backgroundColor=n.style.backgroundColor);n.style.color&&(s.color=n.style.color)}}if(t.cellType===wijmo_grid_1.CellType.Cell){o!==h._lastVisibleFrozenRow||wijmo_1.hasClass(n,wijmo_grid_1.FlexGridClsNames.frozenRow)||wijmo_1.addClass(n,wijmo_grid_1.FlexGridClsNames.frozenRow);i!==h._lastVisibleFrozenColumn||wijmo_1.hasClass(n,wijmo_grid_1.FlexGridClsNames.frozenCol)||wijmo_1.addClass(n,wijmo_grid_1.FlexGridClsNames.frozenCol)}};_FlexSheetCellFactory.prototype._getFirstVisibleCell=function(e,t){var o,i;for(o=t.topRow;o<=t.bottomRow&&!e.rows[o].isVisible;o++);for(i=t.leftCol;i<=t.rightCol&&!e.columns[i].isVisible;i++);return new wijmo_grid_1.CellRange(o,i)};_FlexSheetCellFactory.prototype._isURL=function(e){return new RegExp("^(https|http|ftp|rtsp|mms)://(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})(:[0-9]{1,4})?(/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*").test(e)};_FlexSheetCellFactory.prototype._getCellBorders=function(e,t,o){var i=t&&t._styledCells;if(!i)return null;var n=o.topRow,l=o.leftCol,r=o.bottomRow,s=o.rightCol,a=e.columns.length;if((r>n||s>l)&&!i[r*a+s]){r=n;s=l}var h=i[n*a+l],u=i[r*a+s],d=l>0?i[n*a+l-1]:null,_=s+1<a?i[n*a+s+1]:null,c=n>0?i[(n-1)*a+l]:null,g=i[(r+1)*a+l];if(!(h||u||d||_||c||g))return null;var f={},p=h&&h.borderLeftStyle&&"none"!==h.borderLeftStyle&&!(!h.borderLeftColor&&!h.borderLeftWidth),m=d&&d.borderRightStyle&&"none"!==d.borderRightStyle&&!(!d.borderRightColor&&!d.borderRightWidth);if(!p&&m||p&&m&&parseInt(d.borderRightWidth||1)>parseInt(h.borderLeftWidth||1)){if("double"!==d.borderRightStyle){f.borderLeftColor=d.borderRightColor;f.borderLeftStyle=d.borderRightStyle;f.borderLeftWidth=Math.floor(parseInt(d.borderRightWidth||1)/2)+"px"}}else if(p){f.borderLeftColor=h.borderLeftColor;f.borderLeftStyle=h.borderLeftStyle;f.borderLeftWidth="double"!==h.borderLeftStyle?Math.ceil(parseInt(h.borderLeftWidth||1)/2)+"px":h.borderLeftWidth}var w=h&&h.borderTopStyle&&"none"!==h.borderTopStyle&&!(!h.borderTopColor&&!h.borderTopWidth),C=c&&c.borderBottomStyle&&"none"!==c.borderBottomStyle&&!(!c.borderBottomColor&&!c.borderBottomWidth);if(!w&&C||w&&C&&parseInt(c.borderBottomWidth||1)>parseInt(h.borderTopWidth||1)){if("double"!==c.borderBottomStyle){f.borderTopColor=c.borderBottomColor;f.borderTopStyle=c.borderBottomStyle;f.borderTopWidth=Math.floor(parseInt(c.borderBottomWidth||1)/2)+"px"}}else if(w){f.borderTopColor=h.borderTopColor;f.borderTopStyle=h.borderTopStyle;f.borderTopWidth="double"!==h.borderTopStyle?Math.ceil(parseInt(h.borderTopWidth||1)/2)+"px":h.borderTopStyle}var S=u&&u.borderRightStyle&&"none"!==u.borderRightStyle&&!(!u.borderRightColor&&!u.borderRightWidth),b=_&&_.borderLeftStyle&&"none"!==_.borderLeftStyle&&!(!_.borderLeftColor&&!_.borderLeftWidth);if(!S&&b||S&&b&&parseInt(_.borderLeftWidth||1)>=parseInt(u.borderRightWidth||1)){if("double"!==_.borderLeftStyle){f.borderRightColor=_.borderLeftColor;f.borderRightStyle=_.borderLeftStyle;f.borderRightWidth=Math.floor(parseInt(_.borderLeftWidth||1)/2)+"px"}}else if(S){f.borderRightColor=u.borderRightColor;f.borderRightStyle=u.borderRightStyle;f.borderRightWidth="double"!==u.borderRightStyle?Math.ceil(parseInt(u.borderRightWidth||1)/2)+"px":u.borderRightWidth}var v=u&&u.borderBottomStyle&&"none"!==u.borderBottomStyle&&!(!u.borderBottomColor&&!u.borderBottomWidth),y=g&&g.borderTopStyle&&"none"!==g.borderTopStyle&&!(!g.borderTopColor&&!g.borderTopWidth);if(!v&&y||v&&y&&parseInt(g.borderTopWidth||1)>=parseInt(u.borderBottomWidth||1)){if("double"!==g.borderTopStyle){f.borderBottomColor=g.borderTopColor;f.borderBottomStyle=g.borderTopStyle;f.borderBottomWidth=Math.floor(parseInt(g.borderTopWidth||1)/2)+"px"}}else if(v){f.borderBottomColor=u.borderBottomColor;f.borderBottomStyle=u.borderBottomStyle;f.borderBottomWidth="double"!==u.borderBottomStyle?Math.ceil(parseInt(u.borderBottomWidth||1)/2)+"px":u.borderBottomWidth}return f};return _FlexSheetCellFactory}(wijmo_grid_1.CellFactory);exports._FlexSheetCellFactory=_FlexSheetCellFactory;wijmo_1._registerModule("wijmo.grid.sheet",selfModule);
|
|
14
|
+
"use strict";var _a,__extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)Object.hasOwnProperty.call(e,o)&&(t[o]=e[o]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});var _KnownErrors,wijmo_1=require("wijmo/wijmo"),wijmo_grid_1=require("wijmo/wijmo.grid"),wijmo_grid_filter_1=require("wijmo/wijmo.grid.filter"),wijmo_input_1=require("wijmo/wijmo.input"),wijmo_xlsx_1=require("wijmo/wijmo.xlsx"),wijmo_grid_xlsx_1=require("wijmo/wijmo.grid.xlsx"),mInput=__importStar(require("wijmo/wijmo.input")),mXlsx=__importStar(require("wijmo/wijmo.xlsx")),selfModule=__importStar(require("wijmo/wijmo.grid.sheet"));function softInput(){return wijmo_1._getModule("wijmo.input")}exports.softInput=softInput;function softXlsx(){return wijmo_1._getModule("wijmo.xlsx")}exports.softXlsx=softXlsx;exports._ErrorMessages={InvalidCellRef:"Invalid cell reference.",InvalidSheetRef:"Invalid sheet reference.",InvalidTableRef:"Invalid table reference.",InvalidTableColRef:"Invalid table column reference.",InvalidParameters:"Invalid parameters.",BadExpression:"Bad expression.",CircRef:"Circular reference.",InvalidParameter:function(e){return'Invalid parameter: "'+e+'".'},ParameterIsOutOfRange:function(e){return'Parameter is out of range: "'+e+'".'},RowIsOutOfTableRange:function(e){return"The row is out of the table ("+e+") range."},UnkFuncName:function(e){return'The function "'+e+'" has not supported in FlexSheet yet.'},DefNameInvalidSheet:function(e){return'The defined name item works in "'+e+'". It does not work in current sheet.'},InvalidTable:function(e){return"The Table("+e+") is not located in any sheet."},InvalidExpression:function(e){return"Invalid Expression: "+e},Atan2ArgsLessThanZero:"The x number and y number can't both be zero for the atan2 function.",RateCriteriaFails:"It is not able to calculate the rate with current parameters.",RangesMustBeTheSame:"The row span and column span of each cell range has to be same with each other.",TooFewParameters:"Too few parameters.",TooManyParameters:"Too many parameters.",ExpressionExpected:"Expression expected.",UnbalancedParenthesis:"Unbalanced parenthesis.",UnbalancedSquareBrackets:"Unbalanced square brackets.",TableReferencesExpected:"Table references expected.",IdentifierExpected:"Identifier expected.",CantFindFinalQuote:"Can't find final quote.",IllegalCrossSheetReference:"Illegal cross sheet reference.",CantFindFinalDateDelimiter:'Can\'t find final date delimiter ("#").',CellRefMustBeInSameSheet:"The cell reference must be in the same sheet.",SyntaxError:"Syntax error."};!function(e){e.Div="#DIV/0!";e.Name="#NAME?";e.Ref="#REF!";e.Num="#NUM!";e.Val="#VALUE!";e.Null="#NULL!";e.NA="#N/A"}(_KnownErrors||(_KnownErrors={}));var FormulaError=function(){function FormulaError(e,t){this._error=e;this._data=t}Object.defineProperty(FormulaError.prototype,"error",{get:function(){return this._error},enumerable:!0,configurable:!0});Object.defineProperty(FormulaError.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0});FormulaError.prototype.toString=function(){return this._error||(this._data||"").toString()};return FormulaError}();exports.FormulaError=FormulaError;var DivideByZeroError=function(e){__extends(DivideByZeroError,e);function DivideByZeroError(t){return e.call(this,_KnownErrors.Div,t)||this}return DivideByZeroError}(FormulaError);exports.DivideByZeroError=DivideByZeroError;var NameError=function(e){__extends(NameError,e);function NameError(t){return e.call(this,_KnownErrors.Name,t)||this}return NameError}(FormulaError);exports.NameError=NameError;var ReferenceError=function(e){__extends(ReferenceError,e);function ReferenceError(t){return e.call(this,_KnownErrors.Ref,t)||this}return ReferenceError}(FormulaError);exports.ReferenceError=ReferenceError;var NumericError=function(e){__extends(NumericError,e);function NumericError(t){return e.call(this,_KnownErrors.Num,t)||this}return NumericError}(FormulaError);exports.NumericError=NumericError;var ValueError=function(e){__extends(ValueError,e);function ValueError(t){return e.call(this,_KnownErrors.Val,t)||this}return ValueError}(FormulaError);exports.ValueError=ValueError;var NotAvailableError=function(e){__extends(NotAvailableError,e);function NotAvailableError(t){return e.call(this,_KnownErrors.NA,t)||this}return NotAvailableError}(FormulaError);exports.NotAvailableError=NotAvailableError;var NullError=function(e){__extends(NullError,e);function NullError(t){return e.call(this,_KnownErrors.Null,t)||this}return NullError}(FormulaError);exports.NullError=NullError;var UnknownError=function(e){__extends(UnknownError,e);function UnknownError(t){return e.call(this,"",t)||this}return UnknownError}(FormulaError);exports.UnknownError=UnknownError;var SyntaxError=function(e){__extends(SyntaxError,e);function SyntaxError(t){return e.call(this,"#SYNTAX",t)||this}return SyntaxError}(FormulaError);exports.SyntaxError=SyntaxError;var _FormulaErrorHelper=function(){function _FormulaErrorHelper(){}_FormulaErrorHelper.asError=function(e){return e instanceof FormulaError?e:"string"==typeof e?_FormulaErrorHelper.fromString(e):null};_FormulaErrorHelper.fromString=function(e){e=e.toUpperCase();if(_FormulaErrorHelper._errTypeMap[e])switch(e){case _KnownErrors.Div:return new DivideByZeroError;case _KnownErrors.Name:return new NameError;case _KnownErrors.NA:return new NotAvailableError;case _KnownErrors.Null:return new NullError;case _KnownErrors.Num:return new NumericError;case _KnownErrors.Ref:return new ReferenceError;case _KnownErrors.Val:return new ValueError}return null};_FormulaErrorHelper._errTypeMap=function(){var e={};Object.keys(_KnownErrors).forEach((function(t){e[_KnownErrors[t]]=1}));return e}();return _FormulaErrorHelper}();exports._FormulaErrorHelper=_FormulaErrorHelper;exports.FlexSheetClsNames={flexSheetFormulaDescription:"wj-flexsheet-formula-description",flexSheetFormulaList:"wj-flexsheet-formula-list",flexSheetFormulaName:"wj-flexsheet-formula-name",headerRow:"wj-header-row",hostElement:"wj-flexsheet",tabHolder:"wj-tabholder"};exports.SheetClsNames={hostElement:"wj-sheet",newSheet:"wj-new-sheet",sheetIcon:"wj-sheet-icon",sheetNameEditor:"wj-sheet-name-editor",sheetPage:"wj-sheet-page",sheetTab:"wj-sheet-tab"};exports._ContextMenuClsNames={contextMenuItem:"wj-context-menu-item",contextMenuItemSelected:"wj-context-menu-item-selected",flexSheetContextMenu:"wj-flexsheet-context-menu",hostElement:"wj-context-menu"};exports._SmartTagClsNames={flexSheetFillMenu:"wj-flexsheet-fill-menu",hostElement:"wj-flexsheet-smart-tag"};var Table=function(){function Table(e,t,o,i,n){this._showHeaderRow=!0;this._showTotalRow=!1;this._showBandedColumns=!1;this._showBandedRows=!0;this._alterFirstColumn=!1;this._alterLastColumn=!1;this._orgHeaderCellsContent=[];if(!t.isValid)throw"The range of this table is invalid.";this._name=e;this._range=t.clone();this._style=o;null!=i&&i.length>0&&this._pushTableColumns(i);if(null!=n){null!=n.showHeaderRow&&(this._showHeaderRow=n.showHeaderRow);null!=n.showTotalRow&&(this._showTotalRow=n.showTotalRow);null!=n.showBandedColumns&&(this._showBandedColumns=n.showBandedColumns);null!=n.showBandedRows&&(this._showBandedRows=n.showBandedRows);null!=n.alterFirstColumn&&(this._alterFirstColumn=n.alterFirstColumn);null!=n.alterLastColumn&&(this._alterLastColumn=n.alterLastColumn)}}Object.defineProperty(Table.prototype,"name",{get:function(){return this._name},set:function(e){if(null==e||""===e)throw"The name of the Table should not be empty.";if(this._name.toLowerCase()!==e.toLowerCase()){var t=this._name;this._name=e;if(this._owner){var o=void 0;!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(o=new _TableSettingAction(this._owner,this));this._owner._updateFormulasWithNameUpdating(t,e,!0);if(o){o.saveNewState();this._owner.undoStack._addAction(o);o=null}}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"sheet",{get:function(){return this._sheet},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"style",{get:function(){return this._style},set:function(e){if(e.name!==this._style.name){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._style=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"showHeaderRow",{get:function(){return this._showHeaderRow},set:function(e){if(e!==this._showHeaderRow){var t=void 0,o=this._showHeaderRow;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._showHeaderRow=e;if(this._owner)try{this._owner.beginUpdate();this._adjustTableRangeWithHeaderRow();if(t){t.saveNewState();this._owner.undoStack._addAction(t)}}catch(e){this._showHeaderRow=o;throw e}finally{t=null;this._owner.endUpdate()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"showTotalRow",{get:function(){return this._showTotalRow},set:function(e){if(e!==this._showTotalRow){var t=void 0,o=this._showTotalRow;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._showTotalRow=e;if(this._owner)try{this._owner.beginUpdate();this._adjustTableRangeWithTotalRow();if(t){t.saveNewState();this._owner.undoStack._addAction(t)}}catch(e){this._showTotalRow=o;throw e}finally{t=null;this._owner.endUpdate()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"showBandedColumns",{get:function(){return this._showBandedColumns},set:function(e){if(e!==this._showBandedColumns){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._showBandedColumns=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"showBandedRows",{get:function(){return this._showBandedRows},set:function(e){if(e!==this._showBandedRows){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._showBandedRows=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"alterFirstColumn",{get:function(){return this._alterFirstColumn},set:function(e){if(e!==this._alterFirstColumn){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._alterFirstColumn=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Object.defineProperty(Table.prototype,"alterLastColumn",{get:function(){return this._alterLastColumn},set:function(e){if(e!==this._alterLastColumn){var t=void 0;this._owner&&!this._owner._isUndoing&&this._owner.undoStack.stackSize>0&&(t=new _TableSettingAction(this._owner,this));this._alterLastColumn=e;if(this._owner){if(t){t.saveNewState();this._owner.undoStack._addAction(t);t=null}this._owner.refresh()}}},enumerable:!0,configurable:!0});Table.prototype._isHeaderRow=function(e){return this._showHeaderRow&&e===this._range.topRow};Table.prototype._getTableRange=function(){return this._range};Table.prototype._getColumns=function(){return this._columns||[]};Table.prototype.getRange=function(e,t){void 0===e&&(e=TableSection.All);var o;switch(e){case TableSection.Data:o=this._getDataRange();break;case TableSection.Header:o=this._getHeaderRange();break;case TableSection.Footer:o=this._getFooterRange();break;default:o=this._range.clone()}if(null!=t&&o){var i=this._getColumnIndex(t);if(null==i)return null;o.col=o.col2=o.leftCol+i}return o};Table.prototype.getColumns=function(){return this._columns?this._columns.slice():[]};Table.prototype.insertRows=function(e,t,o){void 0===o&&(o=!0);var i=!1;null==t&&(t=1);if(!wijmo_1.isInt(t)||t<1)return!1;if(0===e&&this._showHeaderRow||e===this._range.rowSpan-1&&this._showTotalRow||e<0||e>=this._range.rowSpan)return!1;if(this._owner){var n=this.getRange(),l=this._flex;this._owner.beginUpdate();if(o){var r=new wijmo_grid_1.CellRange(n.bottomRow+1,n.col,n.bottomRow+1,n.col2);if(this._sheet._canShiftCells(r)){var s=this._sheet._needAddRowCountForInsertTableRows(t,n);if(l.collectionView){var a=l.itemsSource instanceof wijmo_1.CollectionView;l.collectionView.beginUpdate();for(var h=0;h<s;h++)a?l.itemsSource.sourceCollection.push({}):l.itemsSource.push({});l.collectionView.endUpdate(!0)}else for(h=0;h<s;h++)l.rows.push(new wijmo_grid_1.Row);this._sheet._moveDownCells(t,r);i=!0}}else this._canInsertRowsWithoutShift(t)&&(i=!0);if(i){this._sheet._moveDownCellsWithinTable(e,t,n);this._updateTableRange(0,t,0,0)}this._owner.endUpdate()}else{this._updateTableRange(0,t,0,0);i=!0}return i};Table.prototype.deleteRows=function(e,t,o){void 0===o&&(o=!0);null==t&&(t=1);if(wijmo_1.isInt(t)&&!(t<1)&&!(0===e&&this._showHeaderRow||e===this._range.rowSpan-1&&this._showTotalRow||e<0||e>=this._range.rowSpan||e+t>this._range.rowSpan-(this._showTotalRow?1:0)))if(this._owner){var i=!1,n=this.getRange(),l=void 0;this._owner.beginUpdate();if(o){l=new wijmo_grid_1.CellRange(n.bottomRow+1,n.col,n.bottomRow+1,n.col2);this._sheet._canShiftCells(l)&&(i=!0)}else i=!0;if(i){this._sheet._moveUpCellsWithinTable(e,t,n);o&&this._sheet._moveUpCells(t,l);this._updateTableRange(0,-t,0,0)}this._owner.endUpdate()}else this._updateTableRange(0,-t,0,0)};Table.prototype._addColumn=function(e,t){if(e<=0||e>this._columns.length)throw"The column index is out of range.";t=this._getUniqueColumnName(e,t);var o=new TableColumn(t);o._attach(this);this._columns.splice(e,0,o);if(this.showHeaderRow&&this._owner&&this._sheet){var i=this.getRange();this._flex.setCellData(i.topRow,i.leftCol+e,t)}};Table.prototype._updateCell=function(e,t,o){if(null!=this._style){var i=e-this._range.topRow,n=t-this._range.leftCol,l=this._getTableCellAppliedStyles(i,n);this._applyStylesForCell(l,o)}};Table.prototype._updateTableRange=function(e,t,o,i){if(this._range.row<=this._range.row2){this._range.row+=e;this._range.row2+=t}else{this._range.row2+=e;this._range.row+=t}if(this._range.col<=this._range.col2){this._range.col+=o;this._range.col2+=i}else{this._range.col2+=o;this._range.col+=i}};Table.prototype._setTableRange=function(e,t){this._range=e;if(null!=t){this._columns.splice(0,this._columns.length);for(var o=0;o<t.length;o++)this._columns.push(t[o])}};Table.prototype._updateColumnName=function(e,t,o){void 0===o&&(o=!0);var i=this._columns[e];if(!i||!i.name||i.name!==t){t=this._getUniqueColumnName(null,t);i.name=t;if(this._showHeaderRow&&this._owner&&this._sheet&&o){this._flex.setCellData(this._range.topRow,this._range.leftCol+e,t)}}};Table.prototype._updateColumnTotalRowContent=function(e,t){null==t&&(t=this._columns.indexOf(e));if(!(t<0)){var o;if(e.totalRowFunction){var i=this._getSubtotalFunction(e.totalRowFunction.toLowerCase());o=null!=i?"=subtotal("+i+",["+e.name+"])":"="===e.totalRowFunction[0]?e.totalRowFunction:"="+e.totalRowFunction}else if(0===t){e.totalRowLabel||(e.totalRowLabel="Total");o=e.totalRowLabel}else o=e.totalRowLabel;if(this._owner&&this._sheet){this._flex.setCellData(this._range.bottomRow,this._range.leftCol+t,o,!1)}}};Table.prototype._attachSheet=function(e){if(!this._sheet||!this._owner){this._sheet=e;this._owner=e._owner;if(null!=this._owner){if(this._owner._containsMergedCells(this._range,e))throw"Table does not allow the merged cell within the table.";var t=this.getRange();null==this._style&&(this._style=this._owner.getBuiltInTableStyle("TableStyleMedium9"));null!=this._columns&&0!==this._columns.length||this._generateColumns(this._showHeaderRow);try{this._owner.beginUpdate();this._showHeaderRow&&1===t.rowSpan&&this._adjustTableRangeWithHeaderRow();this._showTotalRow&&this._updateTotalRow()}finally{this._attached=!0;this._owner.endUpdate()}}}};Table.prototype._detachSheet=function(){this._attached=!1;this._sheet=null;this._owner=null};Object.defineProperty(Table.prototype,"_flex",{get:function(){return this._sheet===this._owner.selectedSheet?this._owner:this._sheet.grid},enumerable:!0,configurable:!0});Table.prototype._pushTableColumns=function(e){this._columns=[];for(var t=0;t<e.length;t++){var o=e[t];o._attach(this);this._columns.push(o)}};Table.prototype._generateColumns=function(e){if(!this._range.isValid)throw"The range of the table is invalid.";this._columns=[];for(var t=0;t<this._range.columnSpan;t++){var o=null,i=this._sheet.grid.columns[this._range.leftCol+t],n=this._range.topRow*this._sheet.grid.columns.length+this._range.leftCol+t,l=void 0,r=void 0,s=this._flex;if(1===this._range.rowSpan)l=this._getUniqueColumnName(t+1);else{null==(l=o=this._sheet.grid.getCellData(this._range.topRow,this._range.leftCol+t,!1))&&(l="");_isFormula(l)&&(l=this._owner.evaluate(l,"",this._sheet,!1));r=this._sheet._styledCells[n];var a=this._owner._formatEvaluatedResult(l,i,r?r.format:"");null!=l&&""==a||(l=a);l=this._getUniqueColumnName(t+1,l.toString())}if(e&&this._range.rowSpan>1){this._orgHeaderCellsContent[t]=this._sheet.grid.getCellData(this._range.topRow,this._range.leftCol+t,!1);isNaN(+l)||i.format||r&&r.format||(r?r.format="@":this._sheet._styledCells[n]={format:"@"});s.setCellData(this._range.topRow,this._range.leftCol+t,i.dataType===wijmo_1.DataType.Boolean&&wijmo_1.isBoolean(o)?o:l,!1)}var h=new TableColumn(l);h._attach(this);0===t?h._totalRowLabel="Total":t===this._range.columnSpan-1&&(h._totalRowFunction="Sum");this._columns.push(h)}};Table.prototype._getTableCellAppliedStyles=function(e,t){var o={},i=0,n=!1,l=!1;this._showHeaderRow&&(i=1);this._showHeaderRow&&0===e?n=!0:this._showTotalRow&&e===this._range.rowSpan-1&&(l=!0);this._extendStyle(o,this._style.wholeTableStyle,e,t,n,l);if(!n&&!l){if(this._showBandedColumns&&(null!=this._style.firstBandedColumnStyle||null!=this._style.secondBandedColumnStyle)){var r=void 0;t%((r=this._style.firstBandedColumnStyle?null==this._style.firstBandedColumnStyle.size?1:this._style.firstBandedColumnStyle.size:1)+(this._style.secondBandedColumnStyle?null==this._style.secondBandedColumnStyle.size?1:this._style.secondBandedColumnStyle.size:1))>=r?this._style.secondBandedColumnStyle&&this._extendStyle(o,this._style.secondBandedRowStyle,e,t,n,l):this._style.firstBandedColumnStyle&&this._extendStyle(o,this._style.firstBandedColumnStyle,e,t,n,l)}if(this._showBandedRows&&(null!=this._style.firstBandedRowStyle||null!=this._style.secondBandedRowStyle)){r=void 0;(e-i)%((r=this._style.firstBandedRowStyle?null==this._style.firstBandedRowStyle.size?1:this._style.firstBandedRowStyle.size:1)+(this._style.secondBandedRowStyle?null==this._style.secondBandedRowStyle.size?1:this._style.secondBandedRowStyle.size:1))>=r?this._style.secondBandedRowStyle&&this._extendStyle(o,this._style.secondBandedRowStyle,e,t,n,l):this._style.firstBandedRowStyle&&this._extendStyle(o,this._style.firstBandedRowStyle,e,t,n,l)}}this._alterLastColumn&&t===this._range.columnSpan-1&&this._style.lastColumnStyle&&this._extendStyle(o,this._style.lastColumnStyle,e,t,n,l);this._alterFirstColumn&&0===t&&this._style.firstColumnStyle&&this._extendStyle(o,this._style.firstColumnStyle,e,t,n,l);if(n){this._style.headerRowStyle&&this._extendStyle(o,this._style.headerRowStyle,e,t,n,l);t===this._range.columnSpan-1&&this._style.lastHeaderCellStyle&&this._extendStyle(o,this._style.lastHeaderCellStyle,e,t,n,l);0===t&&this._style.firstHeaderCellStyle&&this._extendStyle(o,this._style.firstHeaderCellStyle,e,t,n,l)}else if(l){this._style.totalRowStyle&&this._extendStyle(o,this._style.totalRowStyle,e,t,n,l);t===this._range.columnSpan-1&&this._style.lastTotalCellStyle&&this._extendStyle(o,this._style.lastTotalCellStyle,e,t,n,l);0===t&&this._style.firstTotalCellStyle&&this._extendStyle(o,this._style.firstTotalCellStyle,e,t,n,l)}return o};Table.prototype._applyStylesForCell=function(e,t){var o=t.style;for(var i in e){var n=e[i];n&&("className"==i?wijmo_1.addClass(t,n):o[i]=n)}};Table.prototype._extendStyle=function(e,t,o,i,n,l){for(var r in t){var s=t[r];null!==s&&(r.indexOf("borderTop")>-1?(0===o||l)&&(e[r]=s):r.indexOf("borderBottom")>-1?(o===this._range.rowSpan-1||n)&&(e[r]=s):r.indexOf("borderLeft")>-1?0===i&&(e[r]=s):r.indexOf("borderRight")>-1?i===this._range.columnSpan-1&&(e[r]=s):r.indexOf("borderHorizontal")>-1?o<this._range.rowSpan-1&&("borderHorizontalStyle"===r?e.borderBottomStyle=s:"borderHorizontalWidth"===r?e.borderBottomWidth=s:e.borderBottomColor=s):r.indexOf("borderVertical")>-1?i<this._range.columnSpan-1&&("borderVerticalStyle"===r?e.borderRightStyle=s:"borderVerticalWidth"===r?e.borderRightWidth=s:e.borderRightColor=s):e[r]=s)}};Table.prototype._getSubtotalFunction=function(e){switch(e){case"average":return"101";case"countnums":return"102";case"count":return"103";case"max":return"104";case"min":return"105";case"stddev":return"107";case"sum":return"109";case"var":return"110"}return null};Table.prototype._checkColumnNameExist=function(e){for(var t=this.getColumns(),o=0;o<t.length;o++){if(t[o].name.toLowerCase()===e.toLowerCase())return!0}return!1};Table.prototype._adjustTableRangeWithHeaderRow=function(){var e=this._flex;if(this._showHeaderRow){if(this._sheet._needMoveDownTable(this)){var t=this.getRange(),o=new wijmo_grid_1.CellRange(t.bottomRow+1,t.col,t.bottomRow+1,t.col2);if(!this._sheet._canShiftCells(o))throw"The operation is not allowed. The operation is attempting to shift the cells in a table or a merged cell on the current sheet.";if(1===this._sheet._needAddRowCountForInsertTableRows(1,t))if(e.collectionView){e.collectionView.beginUpdate();e.itemsSource instanceof wijmo_1.CollectionView?e.itemsSource.sourceCollection.push({}):e.itemsSource.push({});e.collectionView.endUpdate(!0)}else e.rows.push(new wijmo_grid_1.Row);this._sheet._moveDownCells(1,o);this._sheet._moveDownTable(this)}this._range.row<=this._range.row2?this._range.row-=1:this._range.row2-=1;for(var i=0;i<this._columns.length;i++){var n=this._columns[i];this._orgHeaderCellsContent[i]=e.getCellData(this._range.topRow,this._range.leftCol+i,!1);e.setCellData(this._range.topRow,this._range.leftCol+i,n.name)}}else{for(i=this._range.leftCol;i<=this._range.rightCol;i++)e.setCellData(this._range.topRow,i,"");this._range.row<=this._range.row2?this._range.row+=1:this._range.row2+=1}};Table.prototype._adjustTableRangeWithTotalRow=function(){var e=this._sheet===this._owner.selectedSheet?this._owner:this._sheet.grid,t=this.getRange(),o=new wijmo_grid_1.CellRange(t.bottomRow+1,t.col,t.bottomRow+1,t.col2);if(this._showTotalRow){if(this._sheet._canShiftCells(o)){if(1===this._sheet._needAddRowCountForInsertTableRows(1,t))if(e.collectionView){e.collectionView.beginUpdate();e.itemsSource instanceof wijmo_1.CollectionView?e.itemsSource.sourceCollection.push({}):e.itemsSource.push({});e.collectionView.endUpdate(!0)}else e.rows.push(new wijmo_grid_1.Row);this._sheet._moveDownCells(1,o);this._owner._updateAffectedFormula(this._range.bottomRow+1,1,!0,!0,this.getRange())}else if(!this._beneathRowIsEmpty())throw"The operation is not allowed. The operation is attempting to shift the cells in a table or a merged cell on the current sheet.";this._range.row<=this._range.row2?this._range.row2+=1:this._range.row+=1;this._updateTotalRow()}else{for(var i=this._range.leftCol;i<=this._range.rightCol;i++)e.setCellData(this._range.bottomRow,i,"");if(this._sheet._canShiftCells(o)){this._owner._updateAffectedFormula(this._range.bottomRow,1,!1,!0,this.getRange());this._sheet._moveUpCells(1,o)}this._range.row<=this._range.row2?this._range.row2-=1:this._range.row-=1}};Table.prototype._updateTotalRow=function(){if(this.showTotalRow)for(var e=0;e<this._columns.length;e++){var t=this._columns[e];this._updateColumnTotalRowContent(t,e)}};Table.prototype._getUniqueColumnName=function(e,t){null!=t&&""!==t||(t="Column"+e);if(this._checkColumnNameExist(t)){for(var o=1,i=t+o;this._checkColumnNameExist(i);)i=t+ ++o;t=i}return t};Table.prototype._moveColumns=function(e,t){if(this._columns){var o=this._columns[e];this._columns.splice(e,1);t<0&&(t=this._columns.length);this._columns.splice(t,0,o)}};Table.prototype._canInsertRowsWithoutShift=function(e){var t=this._flex;if(this._range.bottomRow+e>=t.rows.length)return!1;for(var o=1;o<=e;o++)for(var i=this._range.bottomRow+o,n=this._range.leftCol;n<=this._range.rightCol;n++){var l=t.getCellData(i,n,!1),r=this._sheet.getCellStyle(i,n);if(null!=l&&""!==l||null!=r)return!1}return!0};Table.prototype._beneathRowIsEmpty=function(){var e=this._range.bottomRow+1,t=this._flex;if(e>=t.rows.length)return!1;for(var o=this._range.leftCol;o<=this._range.rightCol;o++){var i=t.getCellData(this._range.bottomRow+1,o,!1);if(null!=i&&""!==i)return!1;if(null!=this._sheet.getCellStyle(this._range.bottomRow+1,o))return!1;if(this._sheet.findTable(e,o))return null;var n=e*t.columns.length+o;if(null!=this._sheet._mergedRanges[n])return!1}return!0};Table.prototype._getDataRange=function(){var e=this._range.topRow,t=this._range.bottomRow;this._showHeaderRow&&(e+=1);this._showTotalRow&&(t-=1);return new wijmo_grid_1.CellRange(e,this._range.leftCol,t,this._range.rightCol)};Table.prototype._getHeaderRange=function(){return this._showHeaderRow?new wijmo_grid_1.CellRange(this._range.topRow,this._range.leftCol,this._range.topRow,this._range.rightCol):null};Table.prototype._getFooterRange=function(){return this._showTotalRow?new wijmo_grid_1.CellRange(this._range.bottomRow,this._range.leftCol,this._range.bottomRow,this._range.rightCol):null};Table.prototype._getColumnIndex=function(e){var t;if(wijmo_1.isInt(e)&&e>=0&&e<this._columns.length)t=e;else{var o=void 0;e instanceof TableColumn?o=e.name.toLowerCase():wijmo_1.isString(e)&&""!==e&&(o=e.toLowerCase());for(var i=this.getColumns(),n=0;n<i.length;n++)if(i[n].name.toLowerCase()===o){t=n;break}}return t};return Table}();exports.Table=Table;var TableColumn=function(){function TableColumn(e,t,o,i){void 0===i&&(i=!0);this._name=e;this._totalRowLabel=t;this._totalRowFunction=o;null!=i&&(this._showFilterButton=i)}Object.defineProperty(TableColumn.prototype,"table",{get:function(){return this._table},enumerable:!0,configurable:!0});Object.defineProperty(TableColumn.prototype,"name",{get:function(){return this._name},set:function(e){e!==this._name&&(this._name=e)},enumerable:!0,configurable:!0});Object.defineProperty(TableColumn.prototype,"totalRowLabel",{get:function(){return this._totalRowLabel},set:function(e){if(e!==this._totalRowLabel){this._totalRowLabel=e;this._updateTableTotalInfo()}},enumerable:!0,configurable:!0});Object.defineProperty(TableColumn.prototype,"totalRowFunction",{get:function(){return this._totalRowFunction},set:function(e){if(e!==this._totalRowFunction){this._totalRowFunction=e;this._updateTableTotalInfo()}},enumerable:!0,configurable:!0});Object.defineProperty(TableColumn.prototype,"showFilterButton",{get:function(){return this._showFilterButton},set:function(e){this._showFilterButton!==e&&(this._showFilterButton=e)},enumerable:!0,configurable:!0});TableColumn.prototype._attach=function(e){this._table=e};TableColumn.prototype._updateTableTotalInfo=function(){if(this._table&&this._table.showTotalRow){this._table._updateColumnTotalRowContent(this);this._table._owner&&this._table._owner.refresh()}};return TableColumn}();exports.TableColumn=TableColumn;var TableSection,TableStyle=function(){function TableStyle(e,t){void 0===t&&(t=!1);this._name=e;this._isBuiltIn=t}Object.defineProperty(TableStyle.prototype,"name",{get:function(){return this._name},set:function(e){e!==this._name&&(this._name=e)},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"wholeTableStyle",{get:function(){return this._wholeTableStyle},set:function(e){this._wholeTableStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstBandedColumnStyle",{get:function(){return this._firstBandedColumnStyle},set:function(e){this._firstBandedColumnStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"secondBandedColumnStyle",{get:function(){return this._secondBandedColumnStyle},set:function(e){this._secondBandedColumnStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstBandedRowStyle",{get:function(){return this._firstBandedRowStyle},set:function(e){this._firstBandedRowStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"secondBandedRowStyle",{get:function(){return this._secondBandedRowStyle},set:function(e){this._secondBandedRowStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstColumnStyle",{get:function(){return this._firstColumnStyle},set:function(e){this._firstColumnStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"lastColumnStyle",{get:function(){return this._lastColumnStyle},set:function(e){this._lastColumnStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"headerRowStyle",{get:function(){return this._headerRowStyle},set:function(e){this._headerRowStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"totalRowStyle",{get:function(){return this._totalRowStyle},set:function(e){this._totalRowStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstHeaderCellStyle",{get:function(){return this._firstHeaderCellStyle},set:function(e){this._firstHeaderCellStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"lastHeaderCellStyle",{get:function(){return this._lastHeaderCellStyle},set:function(e){this._lastHeaderCellStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"firstTotalCellStyle",{get:function(){return this._firstTotalCellStyle},set:function(e){this._firstTotalCellStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"lastTotalCellStyle",{get:function(){return this._lastTotalCellStyle},set:function(e){this._lastTotalCellStyle=e},enumerable:!0,configurable:!0});Object.defineProperty(TableStyle.prototype,"isBuiltIn",{get:function(){return this._isBuiltIn},enumerable:!0,configurable:!0});return TableStyle}();exports.TableStyle=TableStyle;!function(e){e[e.All=0]="All";e[e.Data=1]="Data";e[e.Header=2]="Header";e[e.Footer=3]="Footer"}(TableSection=exports.TableSection||(exports.TableSection={}));var _UndoAction=function(){function _UndoAction(e){this._owner=e;this._sheetUuid=e.selectedSheet?e.selectedSheet._uid:-1}Object.defineProperty(_UndoAction.prototype,"sheetUid",{get:function(){return this._sheetUuid},enumerable:!0,configurable:!0});_UndoAction.prototype.undo=function(){throw"This abstract method must be overridden."};_UndoAction.prototype.redo=function(){throw"This abstract method must be overridden."};_UndoAction.prototype.saveNewState=function(){throw"This abstract method must be overridden."};return _UndoAction}();exports._UndoAction=_UndoAction;var _EditAction=function(e){__extends(_EditAction,e);function _EditAction(t,o){var i=e.call(this,t)||this;i._isPaste=!1;i._selections=o?[o]:t.selectedSheet.selectionRanges.length>0?t.selectedSheet.selectionRanges.slice():[t.selection.clone()];i._mergeAction=new _CellMergeAction(t);i._cellStyleAction=new _CellStyleAction(t);i._saveValues(!0);return i}Object.defineProperty(_EditAction.prototype,"isPaste",{get:function(){return this._isPaste},enumerable:!0,configurable:!0});_EditAction.prototype.undo=function(){this._handleUndoRedo(!0)};_EditAction.prototype.redo=function(){this._handleUndoRedo(!1)};_EditAction.prototype.saveNewState=function(){if(!this._saveValues(!1))return!1;this._mergeAction.saveNewState();this._cellStyleAction.saveNewState();return this._checkActionState()};_EditAction.prototype.markIsPaste=function(){this._isPaste=!0};_EditAction.prototype.updateForPasting=function(e){var t=this._selections[this._selections.length-1],o=this._owner.getCellData(e.row,e.col,!!this._owner.columns[e.col].dataMap);if(!t){t=this._owner.selection;this._selections=[t]}o=null==o?"":o;this._oldValues["r"+e.row+"_c"+e.col]={row:e.row,col:e.col,value:o};t.row=Math.min(t.topRow,e.topRow);t.row2=Math.max(t.bottomRow,e.bottomRow);t.col=Math.min(t.leftCol,e.leftCol);t.col2=Math.max(t.rightCol,e.rightCol)};_EditAction.prototype._storeDeletedTables=function(e){null==this._deletedTables&&(this._deletedTables=[]);this._deletedTables.push(e)};_EditAction.prototype._checkActionState=function(){var e=this,t=!1;Object.keys(this._oldValues).forEach((function(o){var i,n;if(!t){i=e._oldValues[o];n=e._newValues[o];i&&n&&i.value!==n.value&&(t=!0)}}));return t||this._mergeAction._checkActionState()||this._cellStyleAction._checkActionState()};_EditAction.prototype._saveValues=function(e){for(var t={},o=0;o<this._selections.length;o++)for(var i=this._selections[o],n=i.topRow;n<=i.bottomRow;n++)if(!(n<0))for(var l=i.leftCol;l<=i.rightCol;l++){var r=this._owner.columns[l];if(!r)return!1;var s=this._owner.getCellData(n,l,!!r.dataMap);s=null==s?"":s;t["r"+n+"_c"+l]={row:n,col:l,value:s}}e?this._oldValues=t:this._newValues=t;return!0};_EditAction.prototype._handleUndoRedo=function(e){var t=this;this._owner._clearCalcEngine();this._owner.selectedSheet.selectionRanges.clear();this._owner.deferUpdate((function(){var o,i=e?t._oldValues:t._newValues;if(t._deletedTables&&t._deletedTables.length>0)for(var n=0;n<t._deletedTables.length;n++){var l=t._deletedTables[n];e?t._owner.selectedSheet.tables.push(l):t._owner.selectedSheet.tables.remove(l)}for(n=0;n<t._selections.length;n++){var r=t._selections[n];t._owner.selectedSheet.selectionRanges.push(r)}Object.keys(i).forEach((function(e){var o=i[e];t._owner.setCellData(o.row,o.col,o.value)}));t._affectedFormulas&&(o=e?t._affectedFormulas.oldFormulas:t._affectedFormulas.newFormulas);if(o&&o.length>0)for(n=0;n<o.length;n++){var s=o[n];t._owner.setCellData(s.point.x,s.point.y,s.formula)}if(e){t._mergeAction.undo();t._cellStyleAction.undo()}else{t._mergeAction.redo();t._cellStyleAction.redo()}t._owner.refresh(!1)}))};return _EditAction}(_UndoAction);exports._EditAction=_EditAction;var _ColumnResizeAction=function(e){__extends(_ColumnResizeAction,e);function _ColumnResizeAction(t,o,i){var n=e.call(this,t)||this;n._panel=o;n._colIndex=i;n._oldColWidth=o.columns[i].width;return n}_ColumnResizeAction.prototype.undo=function(){this._handleUndoRedo(!0)};_ColumnResizeAction.prototype.redo=function(){this._handleUndoRedo(!1)};_ColumnResizeAction.prototype.saveNewState=function(){this._newColWidth=this._panel.columns[this._colIndex].width;return this._oldColWidth!==this._newColWidth};_ColumnResizeAction.prototype._handleUndoRedo=function(e){var t=this._panel.columns[this._colIndex];t&&(t.width=e?this._oldColWidth:this._newColWidth)};return _ColumnResizeAction}(_UndoAction);exports._ColumnResizeAction=_ColumnResizeAction;var _RowResizeAction=function(e){__extends(_RowResizeAction,e);function _RowResizeAction(t,o,i){var n=e.call(this,t)||this;n._panel=o;n._rowIndex=i;n._oldRowHeight=o.rows[i].height;return n}_RowResizeAction.prototype.undo=function(){this._handleUndoRedo(!0)};_RowResizeAction.prototype.redo=function(){this._handleUndoRedo(!1)};_RowResizeAction.prototype.saveNewState=function(){this._newRowHeight=this._panel.rows[this._rowIndex].height;return this._oldRowHeight!==this._newRowHeight};_RowResizeAction.prototype._handleUndoRedo=function(e){var t=this._panel.rows[this._rowIndex];t&&(t.height=e?this._oldRowHeight:this._newRowHeight)};return _RowResizeAction}(_UndoAction);exports._RowResizeAction=_RowResizeAction;var _ColumnsChangedAction=function(e){__extends(_ColumnsChangedAction,e);function _ColumnsChangedAction(t,o,i,n){var l=e.call(this,t)||this;l._delSubActions=[];l._columnIndex=o;l._count=i;l._isAdding=n;l._saveValues(!0);return l}_ColumnsChangedAction.prototype.undo=function(){this._handleUndoRedo(!0)};_ColumnsChangedAction.prototype.redo=function(){this._handleUndoRedo(!1)};_ColumnsChangedAction.prototype.saveNewState=function(){this._saveValues(!1);return!0};_ColumnsChangedAction.prototype._saveValues=function(e){var t=[],o=[];if(null==this._isAdding)for(var i=0;i<this._owner.columns.length;i++)t.push(this._owner.columns[i]);else if(e&&!this._isAdding||!e&&this._isAdding)for(i=this._columnIndex;i<this._columnIndex+this._count&&i<this._owner.columns.length;i++)t.push(this._owner.columns[i]);if(this._owner.selectedSheet.tables&&this._owner.selectedSheet.tables.length>0)for(i=0;i<this._owner.selectedSheet.tables.length;i++){var n=this._owner.selectedSheet.tables[i];n&&n.sheet.name===this._owner.selectedSheet.name&&o.push({name:n.name,range:n.getRange(),columns:n.getColumns()})}var l={columns:t,sortList:this._owner.sortManager._cloneSortList(this._owner.sortManager._committedList),styledCells:this._owner.selectedSheet?this._owner._cloneObject(this._owner.selectedSheet._styledCells):null,mergedCells:this._owner.selectedSheet?this._owner.selectedSheet._cloneMergedCells():null,tableRanges:o,selection:this._owner.selection,filterDef:this._owner.selectedSheet._filterDefinition};e?this._oldValue=l:this._newValue=l};_ColumnsChangedAction.prototype._handleUndoRedo=function(e,t){var o=this;void 0===t&&(t=!0);var i=e?this._oldValue:this._newValue;if(this._owner.selectedSheet)if(this._delSubActions.length)this._owner.deferUpdate((function(){if(e)for(var t=o._delSubActions.length-1;t>=0;t--){o._delSubActions[t]._handleUndoRedo(e,!1)}else for(t=0;t<o._delSubActions.length;t++){o._delSubActions[t]._handleUndoRedo(e,!1)}}));else{try{t&&this._owner.beginUpdate();var n=void 0;this._owner._isUndoing=!0;this._owner._clearCalcEngine();this._owner.finishEditing();if(null==this._isAdding){this._owner.columns.clear();this._columnIndex=0}this._owner.selectedSheet._styledCells=null;this._owner.selectedSheet._mergedRanges.length=0;this._owner.columns.beginUpdate();if(i.columns&&i.columns.length>0)for(var l=0;l<i.columns.length;l++){if((r=i.columns[l])&&r.isVisible){this._owner.columns.insert(this._columnIndex+l,r);if(this._owner.itemsSource&&(n=this._owner.rows[this._owner._getDataRowsOffset()-1])){n._ubv||(n._ubv={});n._ubv[r._hash]=r.header}}}else for(l=this._columnIndex+this._count-1;l>=this._columnIndex;l--){var r;(r=this._owner.columns[l])&&r.isVisible&&this._owner.columns.removeAt(l)}this._owner.columns.endUpdate();this._owner.selectedSheet._styledCells=this._owner._cloneObject(i.styledCells);for(var s=0;s<i.mergedCells.length;s++)this._owner.selectedSheet._mergedRanges[s]=i.mergedCells[s];for(s=0;s<i.tableRanges.length;s++){var a=i.tableRanges[s];(d=this._owner._getTable(a.name))&&d._setTableRange(a.range,a.columns)}var h=void 0;this._affectedFormulas&&(h=e?this._affectedFormulas.oldFormulas:this._affectedFormulas.newFormulas);if(h&&h.length>0)for(s=0;s<h.length;s++){var u=h[s];null!=u.point?u.sheet.name===this._owner.selectedSheet.name?this._owner.setCellData(u.point.x,u.point.y,u.formula):u.sheet.grid.setCellData(u.point.x,u.point.y,u.formula):u.row._ubv[u.column._hash]=u.formula}if(this._deletedTables&&this._deletedTables.length>0)for(s=0;s<this._deletedTables.length;s++){var d=this._deletedTables[s];e?this._owner.selectedSheet.tables.push(d):this._owner.selectedSheet.tables.remove(d)}var _=void 0;this._affectedDefinedNameVals&&(_=e?this._affectedDefinedNameVals.oldDefinedNameVals:this._affectedDefinedNameVals.newDefinedNameVals);if(_&&_.length>0)for(s=0;s<_.length;s++){var c=_[s],g=this._owner.definedNames._getIndexByName(c.name);g>-1&&(this._owner.definedNames[g].value=c.value)}this._owner.selectedSheet.grid.wj_sheetInfo.styledCells=this._owner.selectedSheet._styledCells;this._owner.selectedSheet.grid.wj_sheetInfo.mergedRanges=this._owner.selectedSheet._mergedRanges}finally{t&&this._owner.endUpdate()}this._owner._copyColumnsToSelectedSheet();this._owner.sortManager.sortDescriptions.sourceCollection=i.sortList.slice();if(this._owner.selectedSheet._filterDefinition!==i.filterDef){this._owner._isUndoing=!0;this._owner.selectedSheet._filterDefinition=i.filterDef;this._owner.selectedSheet._applyFilterSetting();this._owner._isUndoing=!1;this._owner.filter.apply()}this._owner.sortManager.commitSort(!1);this._owner.selection=i.selection;this._owner._isUndoing=!1}};return _ColumnsChangedAction}(_UndoAction);exports._ColumnsChangedAction=_ColumnsChangedAction;var _RowsChangedAction=function(e){__extends(_RowsChangedAction,e);function _RowsChangedAction(t,o,i,n){var l=e.call(this,t)||this;l._delSubActions=[];l._headerRowIndex=-1;if(t.itemsSource){l._headerRowAtTop=t._headerRowAtTop();if(!l._headerRowAtTop)for(var r=0;r<t.rows.length;r++)if(t.rows[r]instanceof HeaderRow){l._headerRowIndex=r;break}}l._rowIndex=o;l._count=i;l._isAdding=n;l._saveValues(!0);return l}_RowsChangedAction.prototype.undo=function(){this._handleUndoRedo(!0)};_RowsChangedAction.prototype.redo=function(){this._handleUndoRedo(!1)};_RowsChangedAction.prototype.saveNewState=function(){this._saveValues(!1);return!0};_RowsChangedAction.prototype.addDeleteSubAction=function(e){this._delSubActions.push(e)};_RowsChangedAction.prototype._saveValues=function(e){var t,o,i=[],n=[],l=[];if(null==this._isAdding)if(this._owner.itemsSource){t=this._owner.itemsSource instanceof wijmo_1.CollectionView?this._owner.itemsSource.sourceCollection.slice():this._owner.itemsSource.slice();for(var r=0;r<this._owner.columns.length;r++)n.push(this._owner.columns[r])}else for(r=0;r<this._owner.rows.length;r++)i.push(this._owner.rows[r]);else{if(e&&!this._isAdding||!e&&this._isAdding)for(r=this._rowIndex;r<this._rowIndex+this._count&&r<this._owner.rows.length;r++){var s=this._owner.rows[r];s.isVisible||this._isAdding?i.push(s):i.push(null)}this._owner.collectionView&&this._owner.collectionView.sortDescriptions.length>0&&(o=this._owner.collectionView._view.slice())}if(this._owner.selectedSheet.tables&&this._owner.selectedSheet.tables.length>0)for(r=0;r<this._owner.selectedSheet.tables.length;r++){var a=this._owner.selectedSheet.tables[r];a&&a.sheet.name===this._owner.selectedSheet.name&&l.push({name:a.name,range:a.getRange(),setting:{showHeaderRow:a.showHeaderRow,showTotalRow:a.showTotalRow}})}var h={rows:i,columns:n,itemsSource:t,styledCells:this._owner.selectedSheet?this._owner._cloneObject(this._owner.selectedSheet._styledCells):null,mergedCells:this._owner.selectedSheet?this._owner.selectedSheet._cloneMergedCells():null,tableSettings:l,selection:this._owner.selection,dataView:o,scrollPosition:this._owner.scrollPosition};e?this._oldValue=h:this._newValue=h};_RowsChangedAction.prototype._handleUndoRedo=function(e,t){var o=this;void 0===t&&(t=!0);var i,n=!!this._owner.itemsSource,l=e?this._oldValue:this._newValue;if(this._owner.selectedSheet)if(this._delSubActions.length)this._owner.deferUpdate((function(){if(e)for(var t=o._delSubActions.length-1;t>=0;t--){o._delSubActions[t]._handleUndoRedo(e,!1)}else{for(t=0;t<o._delSubActions.length;t++){o._delSubActions[t]._handleUndoRedo(e,!1)}o._owner.selection=o._newValue.selection}}));else{try{t&&this._owner.beginUpdate();this._owner._isUndoing=!0;this._owner._clearCalcEngine();this._owner.finishEditing();if(null==this._isAdding){this._owner.itemsSource&&this._owner.columns.clear();this._owner.rows.clear();this._rowIndex=0}this._owner.selectedSheet._styledCells=null;this._owner.selectedSheet._mergedRanges.length=0;if(null==this._isAdding&&n){i=this._owner.autoGenerateColumns;this._owner.autoGenerateColumns=!1;this._owner.collectionView.beginUpdate();if(this._owner.itemsSource instanceof wijmo_1.CollectionView){var r=[0,this._owner.itemsSource.sourceCollection.length].concat(l.itemsSource);Array.prototype.splice.apply(this._owner.itemsSource.sourceCollection,r)}else this._owner.itemsSource=l.itemsSource.slice();this._owner.columns.beginUpdate();for(var s=0;s<l.columns.length;s++)this._owner.columns.push(l.columns[s]);this._owner.columns.endUpdate();this._owner.collectionView.endUpdate(!0);this._owner.autoGenerateColumns=i}else{this._owner.rows.beginUpdate();if(n){i=this._owner.autoGenerateColumns;this._owner.autoGenerateColumns=!1;this._owner.collectionView.beginUpdate()}var a=this._owner.collectionView,h=a instanceof wijmo_1.CollectionView?a:null;if(l.rows&&l.rows.length>0){var u=void 0;if(n){var d=this._owner._getDataRowsOffset();u=Math.max(this._rowIndex-d,0);!this._isAdding&&!this._headerRowAtTop&&this._owner._headerRowAtTop()&&this._rowIndex>=d&&u<this._headerRowIndex&&u++}for(s=0;s<l.rows.length;s++){if(p=l.rows[s])if(n&&p.dataItem){var _=null!=p.dataItem._itemIdx?p.dataItem._itemIdx:u+s;this._owner._updateItemIndexForInsertingRow(a.sourceCollection,_,1);a.sourceCollection.splice(_,0,p.dataItem);if(h&&h.trackChanges){var c=h.itemsRemoved.indexOf(p.dataItem)>=0;c&&h.itemsRemoved.remove(p.dataItem);!c&&h.itemsAdded.indexOf(p.dataItem)<=0&&h.itemsAdded.push(p.dataItem)}}else this._owner.rows.insert(this._rowIndex+s,p)}}else{var g=this._rowIndex;!this._isAdding&&!this._headerRowAtTop&&this._owner._headerRowAtTop()&&g<this._headerRowIndex&&g++;for(var f=g+this._count-1;f>=g;f--){var p;if(p=this._owner.rows[f])if(n&&p.dataItem){_=null!=p.dataItem._itemIdx?p.dataItem._itemIdx:f-this._owner._getDataRowsOffset();a.sourceCollection.splice(_,1);this._owner._updateItemIndexForRemovingRow(a.sourceCollection,_);if(h&&h.trackChanges){var m=h.itemsAdded.indexOf(p.dataItem)>=0;m&&h.itemsAdded.remove(p.dataItem);!m&&h.itemsRemoved.indexOf(p.dataItem)<0&&h.itemsRemoved.push(p.dataItem)}}else this._owner.rows.removeAt(f)}}if(n){this._owner._lastCount=this._owner.collectionView.itemCount;this._owner.collectionView.endUpdate(!0);this._owner.selectedSheet._dataView=this._owner.collectionView._view.slice();if(l.dataView&&l.dataView.length>0){this._owner.collectionView._view=l.dataView;this._owner.collectionView._pgView=this._owner.collectionView._getPageView();if(!(this._owner.itemsSource instanceof wijmo_1.CollectionView)){this._owner.selectedSheet.grid.collectionView._view=l.dataView;this._owner.selectedSheet.grid.collectionView._pgView=this._owner.selectedSheet.grid.collectionView._getPageView()}this._owner._bindGrid(!1);this._owner.selectedSheet.grid._bindGrid(!1)}this._owner.autoGenerateColumns=i}this._owner.rows.endUpdate()}this._owner.selectedSheet._styledCells=this._owner._cloneObject(l.styledCells);for(s=0;s<l.mergedCells.length;s++)this._owner.selectedSheet._mergedRanges[s]=l.mergedCells[s];for(s=0;s<l.tableSettings.length;s++){var w=l.tableSettings[s];if(b=this._owner._getTable(w.name)){b._showHeaderRow=w.setting.showHeaderRow;b._showTotalRow=w.setting.showTotalRow;b._setTableRange(w.range)}}var C=void 0;this._affectedFormulas&&(C=e?this._affectedFormulas.oldFormulas:this._affectedFormulas.newFormulas);if(C&&C.length>0)for(s=0;s<C.length;s++){var S=C[s];null!=S.point?S.sheet.name===this._owner.selectedSheet.name?this._owner.setCellData(S.point.x,S.point.y,S.formula):S.sheet.grid.setCellData(S.point.x,S.point.y,S.formula):S.row._ubv[S.column._hash]=S.formula}if(this._deletedTables&&this._deletedTables.length>0)for(s=0;s<this._deletedTables.length;s++){var b=this._deletedTables[s];e?this._owner.selectedSheet.tables.push(b):this._owner.selectedSheet.tables.remove(b)}var v=void 0;this._affectedDefinedNameVals&&(v=e?this._affectedDefinedNameVals.oldDefinedNameVals:this._affectedDefinedNameVals.newDefinedNameVals);if(v&&v.length>0)for(s=0;s<v.length;s++){var y=v[s],x=this._owner.definedNames._getIndexByName(y.name);x>-1&&(this._owner.definedNames[x].value=y.value)}this._owner.selectedSheet.grid.wj_sheetInfo.styledCells=this._owner.selectedSheet._styledCells;this._owner.selectedSheet.grid.wj_sheetInfo.mergedRanges=this._owner.selectedSheet._mergedRanges;this._owner.selection=l.selection;this._owner.scrollPosition=l.scrollPosition;this._owner._isUndoing=!1}finally{t&&this._owner.endUpdate()}this._owner._copyRowsToSelectedSheet()}};return _RowsChangedAction}(_UndoAction);exports._RowsChangedAction=_RowsChangedAction;var _CellStyleAction=function(e){__extends(_CellStyleAction,e);function _CellStyleAction(t,o){var i=e.call(this,t)||this;i._oldStyledCells=o?t._cloneObject(o):t.selectedSheet?t._cloneObject(t.selectedSheet._styledCells):null;return i}_CellStyleAction.prototype.undo=function(){this._handleUndoRedo(!0)};_CellStyleAction.prototype.redo=function(){this._handleUndoRedo(!1)};_CellStyleAction.prototype.saveNewState=function(){this._newStyledCells=this._owner.selectedSheet?this._owner._cloneObject(this._owner.selectedSheet._styledCells):null;return!0};_CellStyleAction.prototype._checkActionState=function(){return null!=this._oldStyledCells&&null==this._newStyledCells||null==this._oldStyledCells&&null!=this._newStyledCells||null!=this._oldStyledCells&&null!=this._newStyledCells&&this._oldStyledCells.length!==this._newStyledCells.length};_CellStyleAction.prototype._handleUndoRedo=function(e){var t;if(this._owner.selectedSheet){t=e?this._oldStyledCells:this._newStyledCells;this._owner.selectedSheet._styledCells=this._owner._cloneObject(t);this._owner.selectedSheet.grid.wj_sheetInfo.styledCells=this._owner.selectedSheet._styledCells;this._owner.refresh(!1)}};return _CellStyleAction}(_UndoAction);exports._CellStyleAction=_CellStyleAction;var _CellMergeAction=function(e){__extends(_CellMergeAction,e);function _CellMergeAction(t){var o=e.call(this,t)||this;o._oldMergedCells=t.selectedSheet?t.selectedSheet._cloneMergedCells():null;return o}_CellMergeAction.prototype.undo=function(){this._handleUndoRedo(!0)};_CellMergeAction.prototype.redo=function(){this._handleUndoRedo(!1)};_CellMergeAction.prototype.saveNewState=function(){this._newMergedCells=this._owner.selectedSheet?this._owner.selectedSheet._cloneMergedCells():null;return!0};_CellMergeAction.prototype._handleUndoRedo=function(e){var t,o;if(this._owner.selectedSheet){t=e?this._oldMergedCells:this._newMergedCells;this._owner._clearCalcEngine();if(t){this._owner.selectedSheet._mergedRanges.length=0;for(o=0;o<t.length;o++)this._owner.selectedSheet._mergedRanges[o]=t[o]}this._owner.selectedSheet.grid.wj_sheetInfo.mergedRanges=this._owner.selectedSheet._mergedRanges;this._owner.refresh(!0)}};_CellMergeAction.prototype._checkActionState=function(){var e,t,o;if(null!=this._oldMergedCells&&null==this._newMergedCells||null==this._oldMergedCells&&null!=this._newMergedCells)return!0;if(null!=this._oldMergedCells&&null!=this._newMergedCells&&this._oldMergedCells.length!==this._newMergedCells.length)return!0;if(null!=this._oldMergedCells&&null!=this._newMergedCells&&this._oldMergedCells.length===this._newMergedCells.length)for(e=0;e<this._oldMergedCells.length;e++){o=this._oldMergedCells[e];t=this._oldMergedCells[e];if(!o.equals(t))return!0}return!1};return _CellMergeAction}(_UndoAction);exports._CellMergeAction=_CellMergeAction;var _SortColumnAction=function(e){__extends(_SortColumnAction,e);function _SortColumnAction(t){var o=e.call(this,t)||this;o._saveValues(!0);return o}_SortColumnAction.prototype.undo=function(){this._handleUndoRedo(!0)};_SortColumnAction.prototype.redo=function(){this._handleUndoRedo(!1)};_SortColumnAction.prototype.saveNewState=function(){this._saveValues(!1);return!0};_SortColumnAction.prototype._saveValues=function(e){for(var t,o,i,n=[],l=0;l<this._owner.columns.length;l++)n.push(this._owner.columns[l]);if(this._owner.itemsSource){var r=this._owner._getDataRowsOffset();o=[];for(var s=0;s<this._owner.rows.length-r;s++){var a=this._owner.rows[s+r],h=a.dataItem;if(h){o[null!=h._itemIdx?h._itemIdx:s]=a.visible}}e&&(i=this._owner.collectionView._view.slice())}else{t=[];for(s=0;s<this._owner.rows.length;s++)t.push(this._owner.rows[s])}var u={sortList:this._owner.sortManager._committedList.slice(),rows:t,columns:n,selection:this._owner.selection.clone(),formulas:this._owner._scanFormulas(),styledCells:this._owner.selectedSheet?this._owner._cloneObject(this._owner.selectedSheet._styledCells):null,rowsVisible:o,dataView:i};e?this._oldValue=u:this._newValue=u};_SortColumnAction.prototype._handleUndoRedo=function(e){var t=this,o=e?this._oldValue:this._newValue,i=!!this._owner.itemsSource,n=this._owner.itemsSource instanceof wijmo_1.CollectionView;if(this._owner.selectedSheet){this._owner._isUndoing=!0;this._owner.deferUpdate((function(){t._owner._clearCalcEngine();t._owner.sortManager.sortDescriptions.sourceCollection=o.sortList.slice();t._owner.sortManager.commitSort(!1);t._owner.selectedSheet._styledCells=t._owner._cloneObject(o.styledCells);if(i){if(o.dataView&&o.dataView.length>0){t._owner.collectionView._view=o.dataView;t._owner.collectionView._pgView=t._owner.collectionView._getPageView();if(!n){t._owner.selectedSheet.grid.collectionView._view=o.dataView;t._owner.selectedSheet.grid.collectionView._pgView=t._owner.selectedSheet.grid.collectionView._getPageView()}t._owner._bindGrid(!1);t._owner.selectedSheet.grid._bindGrid(!1)}}else{t._owner.rows.clear();t._owner.selectedSheet.grid.rows.clear();for(var e=0;e<o.rows.length;e++){var l=o.rows[e];t._owner.selectedSheet.grid.rows.push(l);t._owner.rows.push(l)}t._owner.columns.clear();for(e=0;e<o.columns.length;e++){var r=o.columns[e];t._owner.columns.push(r)}t._owner._resetFormulas(o.formulas)}t._owner._isUndoing=!1}))}};return _SortColumnAction}(_UndoAction);exports._SortColumnAction=_SortColumnAction;var _MoveCellsAction=function(e){__extends(_MoveCellsAction,e);function _MoveCellsAction(t,o,i,n){var l=e.call(this,t)||this;if(!t.selectedSheet)return l;0===o.topRow&&o.bottomRow===t.rows.length-1?l._isDraggingColumns=!0:l._isDraggingColumns=!1;l._isCopyCells=n;l._dragRange=o;l._dropRange=i;l._saveValues(!0);return l}_MoveCellsAction.prototype.undo=function(){this._handleUndoRedo(!0)};_MoveCellsAction.prototype.redo=function(){this._handleUndoRedo(!1)};_MoveCellsAction.prototype.saveNewState=function(){if(!this._owner.selectedSheet)return!1;if(this._dropRange){this._saveValues(!1);return!0}return!1};_MoveCellsAction.prototype._saveValues=function(e){for(var t=[],o={},i=this._dropRange.topRow;i<=this._dropRange.bottomRow;i++)for(var n=this._dropRange.leftCol;n<=this._dropRange.rightCol;n++){this._isDraggingColumns&&(o[n]||(o[n]={dataType:this._owner.columns[n].dataType,align:this._owner.columns[n].align,format:this._owner.columns[n].format}));var l=i*this._owner.columns.length+n,r=this._owner.selectedSheet._styledCells[l]?this._owner._cloneObject(this._owner.selectedSheet._styledCells[l]):null,s=this._owner.getCellData(i,n,!1);t.push({rowIndex:i,columnIndex:n,cellContent:s,cellStyle:r})}if(e){this._oldDroppingCells=t;this._oldDroppingColumnSetting=o}else{this._newDroppingCells=t;this._newDroppingColumnSetting=o}if(this._isCopyCells){if(this._isDraggingColumns)if(e)for(i=this._dragRange.topRow;i<=this._dragRange.bottomRow;i++)for(n=this._dragRange.leftCol;n<=this._dragRange.rightCol;n++){if((_=this._owner.selectedSheet.findTable(i,n))&&_._isHeaderRow(i)){var a=_._getTableRange(),h=_._getColumns();this._draggingTableColumns||(this._draggingTableColumns=[]);this._draggingTableColumns.push({rowIndex:i,columnIndex:n,cellContent:h[n-a.leftCol].name})}}else if(this._draggingTableColumns&&this._draggingTableColumns.length>0&&this._draggingTableColumns&&this._draggingTableColumns.length>0)for(var u=0;u<this._draggingTableColumns.length;u++){var d=this._draggingTableColumns[u];if((_=this._owner.selectedSheet.findTable(d.rowIndex,d.columnIndex))&&_._isHeaderRow(d.rowIndex)){a=_._getTableRange(),h=_._getColumns();d.updatedCellContent=h[d.columnIndex-a.leftCol].name}}}else if(e){this._draggingCells=[];this._draggingColumnSetting={};for(i=this._dragRange.topRow;i<=this._dragRange.bottomRow;i++)for(n=this._dragRange.leftCol;n<=this._dragRange.rightCol;n++){this._isDraggingColumns&&(this._draggingColumnSetting[n]||(this._draggingColumnSetting[n]={dataType:this._owner.columns[n].dataType,align:this._owner.columns[n].align,format:this._owner.columns[n].format}));l=i*this._owner.columns.length+n,r=this._owner.selectedSheet._styledCells[l]?this._owner._cloneObject(this._owner.selectedSheet._styledCells[l]):null,s=this._owner.getCellData(i,n,!1);this._draggingCells.push({rowIndex:i,columnIndex:n,cellContent:s,cellStyle:r})}}else if(this._isDraggingColumns&&this._draggingCells&&this._draggingCells.length>0)for(u=0;u<this._draggingCells.length;u++){var _;d=this._draggingCells[u];if((_=this._owner.selectedSheet.findTable(d.rowIndex,d.columnIndex))&&_._isHeaderRow(d.rowIndex)){a=_._getTableRange(),h=_._getColumns();d.updatedCellContent=h[d.columnIndex-a.leftCol].name}}};_MoveCellsAction.prototype._handleUndoRedo=function(e){var t=this,o=e?this._oldDroppingCells:this._newDroppingCells,i=e?this._oldDroppingColumnSetting:this._newDroppingColumnSetting;if(this._owner.selectedSheet){this._owner._clearCalcEngine();this._owner.deferUpdate((function(){var n,l;t._affectedFormulas&&(n=e?t._affectedFormulas.oldFormulas:t._affectedFormulas.newFormulas);if(n&&n.length>0)for(var r=0;r<n.length;r++){var s=n[r];s.sheet.name===t._owner.selectedSheet.name?t._owner.setCellData(s.point.x,s.point.y,s.formula):s.sheet.grid.setCellData(s.point.x,s.point.y,s.formula)}t._affectedDefinedNameVals&&(l=e?t._affectedDefinedNameVals.oldDefinedNameVals:t._affectedDefinedNameVals.newDefinedNameVals);if(l&&l.length>0)for(r=0;r<l.length;r++){var a=l[r],h=t._owner.definedNames._getIndexByName(a.name);h>-1&&(t._owner.definedNames[h].value=a.value)}for(r=0;r<o.length;r++){var u=o[r];t._owner.setCellData(u.rowIndex,u.columnIndex,u.cellContent);if((g=t._owner.selectedSheet.findTable(u.rowIndex,u.columnIndex))&&g._isHeaderRow(u.rowIndex)){var d=g._getTableRange();(c=g._getColumns())[u.columnIndex-d.leftCol].name=u.cellContent}var _=u.rowIndex*t._owner.columns.length+u.columnIndex;u.cellStyle?t._owner.selectedSheet._styledCells[_]=u.cellStyle:delete t._owner.selectedSheet._styledCells[_]}t._isDraggingColumns&&i&&Object.keys(i).forEach((function(e){t._owner.columns[+e].dataType=i[+e].dataType?i[+e].dataType:wijmo_1.DataType.Object;t._owner.columns[+e].align=i[+e].align;t._owner.columns[+e].format=i[+e].format}));if(t._isCopyCells){if(t._draggingTableColumns&&t._draggingTableColumns.length>0)for(r=0;r<t._draggingTableColumns.length;r++){u=t._draggingTableColumns[r];if((g=t._owner.selectedSheet.findTable(u.rowIndex,u.columnIndex))&&g._isHeaderRow(u.rowIndex)){d=g._getTableRange();var c=g._getColumns();t._owner.setCellData(u.rowIndex,u.columnIndex,e?u.cellContent:u.updatedCellContent);c[u.columnIndex-d.leftCol].name=e?u.cellContent:u.updatedCellContent}}}else{for(r=0;r<t._draggingCells.length;r++){var g;u=t._draggingCells[r];if(g=t._owner.selectedSheet.findTable(u.rowIndex,u.columnIndex)){d=g._getTableRange(),c=g._getColumns();if(g._isHeaderRow(u.rowIndex)){t._owner.setCellData(u.rowIndex,u.columnIndex,e?u.cellContent:u.updatedCellContent);c[u.columnIndex-d.leftCol].name=e?u.cellContent:u.updatedCellContent}else t._owner.setCellData(u.rowIndex,u.columnIndex,e?u.cellContent:null)}else t._owner.setCellData(u.rowIndex,u.columnIndex,e?u.cellContent:null);_=u.rowIndex*t._owner.columns.length+u.columnIndex;e?u.cellStyle&&(t._owner.selectedSheet._styledCells[_]=u.cellStyle):t._owner.selectedSheet._styledCells[_]&&delete t._owner.selectedSheet._styledCells[_]}t._isDraggingColumns&&t._draggingColumnSetting&&Object.keys(t._draggingColumnSetting).forEach((function(o){t._owner.columns[+o].dataType=e&&t._draggingColumnSetting[+o].dataType?t._draggingColumnSetting[+o].dataType:wijmo_1.DataType.Object;t._owner.columns[+o].align=e?t._draggingColumnSetting[+o].align:null;t._owner.columns[+o].format=e?t._draggingColumnSetting[+o].format:null}));if(e){if(t._isDraggingColumns)if(t._dragRange.leftCol<t._dropRange.leftCol)for(var f=t._dragRange.leftCol,p=t._dropRange.leftCol;p<=t._dropRange.rightCol;p++){t._owner._updateColumnFiler(p,f);f++}else for(f=t._dragRange.rightCol,p=t._dropRange.rightCol;p>=t._dropRange.leftCol;p--){t._owner._updateColumnFiler(p,f);f--}}else if(t._isDraggingColumns)if(t._dragRange.leftCol>t._dropRange.leftCol)for(f=t._dropRange.leftCol,p=t._dragRange.leftCol;p<=t._dragRange.rightCol;p++){t._owner._updateColumnFiler(p,f);f++}else for(f=t._dropRange.rightCol,p=t._dragRange.rightCol;p>=t._dragRange.leftCol;p--){t._owner._updateColumnFiler(p,f);f--}}}))}};return _MoveCellsAction}(_UndoAction);exports._MoveCellsAction=_MoveCellsAction;var _CutAction=function(e){__extends(_CutAction,e);function _CutAction(t){var o=e.call(this,t)||this;o._oldValues=[];o._mergeAction=new _CellMergeAction(t);o._celltyleAction=new _CellStyleAction(t);o._cutSheet=t._copiedSheet;o._selection=t.selection;o._cutSelection=t.selectionMode===wijmo_grid_1.SelectionMode.ListBox?t._getSelectionForListBoxMode(o._cutSheet.grid):t._copiedRanges[0];o._saveCutValues(!0);return o}_CutAction.prototype.undo=function(){this._handleUndoRedo(!0)};_CutAction.prototype.redo=function(){this._handleUndoRedo(!1)};_CutAction.prototype.saveNewState=function(){this._cutSheet===this._owner.selectedSheet?this._owner:this._cutSheet.grid;this._saveCutValues(!1);this._newValues=[];for(var e=this._selection.topRow;e<=this._selection.bottomRow;e++)for(var t=this._selection.leftCol;t<=this._selection.rightCol;t++){if(!this._owner.columns[t])return!1;var o=this._owner.getCellData(e,t,!!this._owner.columns[t].dataMap);o=null==o?"":o;this._newValues.push({row:e,col:t,value:o})}this._mergeAction.saveNewState();this._celltyleAction.saveNewState();return!0};_CutAction.prototype.updateForPasting=function(e){var t=this._owner.getCellData(e.row,e.col,!!this._owner.columns[e.col].dataMap);t=null==t?"":t;this._oldValues.push({row:e.row,col:e.col,value:t});this._selection.row=Math.min(this._selection.topRow,e.topRow);this._selection.row2=Math.max(this._selection.bottomRow,e.bottomRow);this._selection.col=Math.min(this._selection.leftCol,e.leftCol);this._selection.col2=Math.max(this._selection.rightCol,e.rightCol)};_CutAction.prototype._saveCutValues=function(e){for(var t=this._cutSheet===this._owner.selectedSheet?this._owner:this._cutSheet.grid,o=[],i=this._cutSelection.topRow;i<=this._cutSelection.bottomRow;i++)if(null!=t.rows[i])for(var n=this._cutSelection.leftCol;n<=this._cutSelection.rightCol;n++){var l=t.getCellData(i,n,!!t.columns[n].dataMap);""===(l=null==l?"":l)&&t.columns[n].dataMap&&(l=null);o.push({row:i,col:n,value:l})}e?this._oldCutValues=o:this._newCutValues=o};_CutAction.prototype._handleUndoRedo=function(e){var t=this,o=e?this._oldCutValues:this._newCutValues,i=e?this._oldValues:this._newValues;this._owner._clearCalcEngine();this._owner.selectedSheet.selectionRanges.clear();this._owner.deferUpdate((function(){var n,l,r=t._cutSheet===t._owner.selectedSheet?t._owner:t._cutSheet.grid;t._owner.selectedSheet.selectionRanges.push(t._selection);for(n=0;n<o.length;n++){l=o[n];r.setCellData(l.row,l.col,l.value)}for(n=0;n<i.length;n++){l=i[n];t._owner.setCellData(l.row,l.col,l.value)}if(e){t._mergeAction.undo();t._celltyleAction.undo()}else{t._mergeAction.redo();t._celltyleAction.redo()}t._owner.refresh(!1)}))};return _CutAction}(_UndoAction);exports._CutAction=_CutAction;var _TableSettingAction=function(e){__extends(_TableSettingAction,e);function _TableSettingAction(t,o){var i=e.call(this,t)||this;i._table=o;i._saveValues(!0);return i}_TableSettingAction.prototype.undo=function(){this._handleUndoRedo(!0)};_TableSettingAction.prototype.redo=function(){this._handleUndoRedo(!1)};_TableSettingAction.prototype.saveNewState=function(){this._saveValues(!1);return!0};_TableSettingAction.prototype._saveValues=function(e){var t={name:this._table.name,style:this._table.style,showHeaderRow:this._table.showHeaderRow,showTotalRow:this._table.showTotalRow,showbandedRows:this._table.showBandedRows,showBandedColumns:this._table.showBandedColumns,alterFirstColumn:this._table.alterFirstColumn,alterLastColumn:this._table.alterLastColumn};e?this._oldTableSetting=t:this._newTableSetting=t};_TableSettingAction.prototype._handleUndoRedo=function(e){var t=e?this._oldTableSetting:this._newTableSetting;this._owner.beginUpdate();this._owner._isUndoing=!0;this._table.name=t.name;this._table.style=t.style;this._table.showHeaderRow=t.showHeaderRow;this._table.showTotalRow=t.showTotalRow;this._table.showBandedRows=t.showbandedRows;this._table.showBandedColumns=t.showBandedColumns;this._table.alterFirstColumn=t.alterFirstColumn;this._table.alterLastColumn=t.alterLastColumn;this._owner._isUndoing=!1;this._owner.endUpdate()};return _TableSettingAction}(_UndoAction);exports._TableSettingAction=_TableSettingAction;var _TableAction=function(e){__extends(_TableAction,e);function _TableAction(t,o){var i=e.call(this,t)||this;i._addedTable=o;o.showHeaderRow&&(i._orgHeaderCellsContent=o._orgHeaderCellsContent.slice());return i}_TableAction.prototype.undo=function(){this._handleUndoRedo(!0)};_TableAction.prototype.redo=function(){this._handleUndoRedo(!1)};_TableAction.prototype._handleUndoRedo=function(e){e?this._owner.selectedSheet.tables.remove(this._addedTable):this._owner.selectedSheet.tables.push(this._addedTable);if(this._addedTable.showHeaderRow)for(var t=this._addedTable.getRange(),o=this._addedTable.getColumns(),i=0;i<t.columnSpan;i++)this._owner.setCellData(t.topRow,t.leftCol+i,e?this._orgHeaderCellsContent[i]:o[i].name);this._owner.refresh()};return _TableAction}(_UndoAction);exports._TableAction=_TableAction;var _FilteringAction=function(e){__extends(_FilteringAction,e);function _FilteringAction(t){var o=e.call(this,t)||this;o._oldFilterDefinition=t.filter.filterDefinition;o._oldRowsVisible=o._getRowsVisible();return o}_FilteringAction.prototype.undo=function(){this._handleUndoRedo(!0)};_FilteringAction.prototype.redo=function(){this._handleUndoRedo(!1)};_FilteringAction.prototype.saveNewState=function(){this._newFilterDefinition=this._owner.filter.filterDefinition;this._newRowsVisible=this._getRowsVisible();return!0};_FilteringAction.prototype._handleUndoRedo=function(e){var t=e?this._oldFilterDefinition:this._newFilterDefinition;if(this._owner.filter.filterDefinition!==t){this._owner._isUndoing=!0;this._owner.selectedSheet._filterDefinition=t;this._owner.selectedSheet._applyFilterSetting();this._owner._isUndoing=!1;this._owner.filter.apply()}else this._setRowVisible(e)};_FilteringAction.prototype._getRowsVisible=function(){for(var e,t=[],o=0;o<this._owner.rows.length;o++)(e=this._owner.rows[o])&&t.push(e.visible);return t};_FilteringAction.prototype._setRowVisible=function(e){for(var t,o=e?this._oldRowsVisible:this._newRowsVisible,i=0;i<o.length;i++)(t=this._owner.rows[i])&&(t.visible=o[i])};return _FilteringAction}(_UndoAction);exports._FilteringAction=_FilteringAction;var _FillAction=function(e){__extends(_FillAction,e);function _FillAction(t,o){var i=e.call(this,t)||this;i._fillSource=o.clone();i._oldCellSettings=t._orgCellSettings;return i}_FillAction.prototype.undo=function(){this._handleUndoRedo(!0)};_FillAction.prototype.redo=function(){this._handleUndoRedo(!1)};_FillAction.prototype.saveNewState=function(){this._fillRange=this._owner.selection.clone();this._newCellSettings=this._owner._getCellSettingsForFill(this._fillSource,this._fillRange);return!0};_FillAction.prototype._handleUndoRedo=function(e){var t,o,i,n,l,r,s=e?this._oldCellSettings:this._newCellSettings,a=e?this._fillSource:this._fillRange;this._owner.beginUpdate();r=this._fillRange.topRow<this._fillSource.topRow?new wijmo_grid_1.CellRange(this._fillRange.topRow,this._fillRange.col,this._fillSource.topRow-1,this._fillRange.col2):this._fillRange.leftCol===this._fillSource.leftCol&&this._fillRange.rightCol===this._fillSource.rightCol?new wijmo_grid_1.CellRange(this._fillSource.bottomRow+1,this._fillRange.col,this._fillRange.bottomRow,this._fillRange.col2):this._fillRange.leftCol<this._fillSource.leftCol?new wijmo_grid_1.CellRange(this._fillRange.row,this._fillRange.leftCol,this._fillRange.row2,this._fillSource.leftCol-1):new wijmo_grid_1.CellRange(this._fillRange.row,this._fillSource.rightCol+1,this._fillRange.row2,this._fillRange.rightCol);this._owner._resetMergedRange(r);if(s&&s.length>0)for(t=0;t<s.length;t++){i=(o=s[t]).row;n=o.col;l=i*this._owner.columns.length+n;this._owner.selectedSheet._styledCells[l]=o.style;this._owner.setCellData(i,n,o.value);o.mergedCell&&this._owner.mergeRange(o.mergedCell)}this._owner.selection=a;this._owner.endUpdate()};return _FillAction}(_UndoAction);exports._FillAction=_FillAction;var SortManager=function(){function SortManager(e){this._owner=e;this._sortDescriptions=new wijmo_1.CollectionView;this._committedList=[new ColumnSortDescription(-1,!0)];this._sortDescriptions.newItemCreator=function(){return new ColumnSortDescription(-1,!0)}}Object.defineProperty(SortManager.prototype,"sortDescriptions",{get:function(){return this._sortDescriptions},set:function(e){this._sortDescriptions=e;this.commitSort()},enumerable:!0,configurable:!0});SortManager.prototype.addSortLevel=function(e,t){void 0===t&&(t=!0);var o=this._sortDescriptions.addNew();null!=e&&!isNaN(e)&&wijmo_1.isInt(e)&&(o.columnIndex=e);o.ascending=t;this._sortDescriptions.commitNew()};SortManager.prototype.deleteSortLevel=function(e){var t;(t=null!=e?this._getSortItem(e):this._sortDescriptions.currentItem)&&this._sortDescriptions.remove(t)};SortManager.prototype.copySortLevel=function(){var e=this._sortDescriptions.currentItem;if(e){var t=this._sortDescriptions.addNew();t.columnIndex=parseInt(e.columnIndex);t.ascending=e.ascending;this._sortDescriptions.commitNew()}};SortManager.prototype.editSortLevel=function(e,t){null!=e&&(this._sortDescriptions.currentItem.columnIndex=e);null!=t&&(this._sortDescriptions.currentItem.ascending=t)};SortManager.prototype.moveSortLevel=function(e){var t=this._sortDescriptions.currentItem;if(t){var o=this._sortDescriptions.sourceCollection,i=o.indexOf(t),n=i+e;if(i>-1&&n>-1){o.splice(i,1);o.splice(n,0,t);this._sortDescriptions.refresh();this._sortDescriptions.moveCurrentTo(t)}}};SortManager.prototype.checkSortItemExists=function(e){for(var t=0,o=this._sortDescriptions.itemCount;t<o;t++)if(+this._sortDescriptions.items[t].columnIndex===e)return t;return-1};SortManager.prototype.commitSort=function(e){void 0===e&&(e=!0);var t,o,i,n,l,r,s,a,h,u,d,_,c,g,f,p=this._owner,m=this._owner.itemsSource instanceof wijmo_1.CollectionView,w={};if(this._owner.selectedSheet&&0!==this._owner.columns.length){var C=null==this._owner.selectedSheet.grid.collectionView;p._needCopyToSheet=!1;r=p.selectedSheet._unboundSortDesc;e&&p.undoStack.stackSize>0&&(s=new _SortColumnAction(p));this._sortDescriptions.itemCount>0?this._committedList=this._cloneSortList(this._sortDescriptions.items):this._committedList=[new ColumnSortDescription(-1,!0)];p._isSorting=!0;if(p.collectionView){p.beginUpdate();(a=p.editableCollectionView)&&a.currentEditItem&&-1!==a.items.indexOf(a.currentEditItem)&&!this._isEmpty(a.currentEditItem)&&a.commitEdit();p.collectionView.beginUpdate();C||p.selectedSheet.grid.collectionView.beginUpdate();(i=p.collectionView.sortDescriptions).clear();h=p.selection.clone();u=p.scrollPosition;f=p._getDataRowsOffset();var S=[];if(!p._isUndoing&&!p._isDeletingColumns)for(l=0;l<p.rows.length-f;l++)(g=(c=p.rows[l+f]).dataItem)&&(S[_=null!=g._itemIdx?g._itemIdx:l]=c.visible);m||(n=C?p.collectionView.sortDescriptions:p.selectedSheet.grid.collectionView.sortDescriptions).clear();p.collectionView.sourceCollection.forEach((function(e,t){null==e._itemIdx&&(e._itemIdx=t)}));p.select(h,!1);p.scrollPosition=u;if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){p.collectionView.useStableSort=!0;m||C||(p.selectedSheet.grid.collectionView.useStableSort=!0)}for(l=0;l<this._sortDescriptions.itemCount;l++)if((t=this._sortDescriptions.items[l]).columnIndex>-1&&t.columnIndex<p.columns.length){o=new wijmo_1.SortDescription(p.columns[t.columnIndex].binding,t.ascending);i.push(o);m||n.push(o)}p.selectedSheet.selectionRanges.clear();p.collectionView.endUpdate(!1);C||p.selectedSheet.grid.collectionView.endUpdate(!1);h=p.selection.clone();u=p.scrollPosition;d=p.collectionView._view.slice();var b=Array(d.length);for(l=0;l<d.length;l++){l!==(g=d[l])._itemIdx&&p._updateFormulaForReorderingRows(g._itemIdx+f,l+f);p._updateCellStyleForReorderingRows(g._itemIdx+f,l+f,w);b[l+f]=p._heights[g._itemIdx+f]}p.setHeights(b);p.updateRowHeights();if(S.length)for(l=0;l<p.rows.length-f;l++)if(g=(c=p.rows[l+f]).dataItem){_=null!=g._itemIdx?g._itemIdx:l;c.visible=S[_]}d.forEach((function(e,t){e._itemIdx=t}));p.selectedSheet._styledCells=w;p.select(h,!1);p.scrollPosition=u;p.endUpdate();p._copyColumnsToSelectedSheet();p._isSorting=!1}else{r.clear();for(l=0;l<this._sortDescriptions.itemCount;l++)(t=this._sortDescriptions.items[l]).columnIndex>-1&&r.push(new _UnboundSortDescription(p.columns[t.columnIndex],t.ascending));!p.filter||!p._isUndoing&&p.filter._isActive()?p._isSorting=!1:setTimeout((function(){p._checkCollectionOwner(p.columns,!1);p.filter.apply();p._isSorting=!1}),10)}if(s){s.saveNewState();p.undoStack._addAction(s)}p._copiedRanges=null;p._needCopyToSheet=!0}};SortManager.prototype.cancelSort=function(){this._sortDescriptions.sourceCollection=this._committedList.slice()};SortManager.prototype.clearSort=function(){this._sortDescriptions.sourceCollection=[];this.commitSort()};SortManager.prototype._getSortItem=function(e){var t=this.checkSortItemExists(e);if(t>-1)return this._sortDescriptions.items[t]};SortManager.prototype._cloneSortList=function(e){for(var t=[],o=0;o<e.length;o++)t[o]=e[o].clone();return t};SortManager.prototype._updateSortDescriptions=function(e,t,o){void 0===o&&(o=!0);var i,n;for(i=this._sortDescriptions.items.length-1;i>=0;i--){n=this._sortDescriptions.items[i];o?n.columnIndex>e&&(n.columnIndex+=t):n.columnIndex>=e+t?n.columnIndex-=t:n.columnIndex>=e&&this._sortDescriptions.remove(n)}};SortManager.prototype._handleColumnMoving=function(e,t){this._sortDescriptions.items.forEach((function(o){if(!(o.columnIndex<0))if(o.columnIndex===e)o.columnIndex=t;else{o.columnIndex>e&&o.columnIndex--;o.columnIndex>=t&&o.columnIndex++}}))};SortManager.prototype._isEmpty=function(e){var t=Object.prototype.hasOwnProperty;if(null==e)return!0;if(e.length>0)return!1;if(0===e.length)return!0;for(var o in e)if(t.call(e,o))return!1;return!0};return SortManager}();exports.SortManager=SortManager;var ColumnSortDescription=function(){function ColumnSortDescription(e,t){this._columnIndex=e;this._ascending=t}Object.defineProperty(ColumnSortDescription.prototype,"columnIndex",{get:function(){return this._columnIndex},set:function(e){this._columnIndex=+e},enumerable:!0,configurable:!0});Object.defineProperty(ColumnSortDescription.prototype,"ascending",{get:function(){return this._ascending},set:function(e){this._ascending=e},enumerable:!0,configurable:!0});ColumnSortDescription.prototype.clone=function(){return new ColumnSortDescription(this._columnIndex,this._ascending)};return ColumnSortDescription}();exports.ColumnSortDescription=ColumnSortDescription;wijmo_1._addCultureInfo("FlexSheet",{insertRow:"Insert Row",deleteRow:"Delete Rows",insertCol:"Insert Column",deleteCol:"Delete Columns",convertTable:"Convert To Table",insertSheet:"Insert",deleteSheet:"Delete",renameSheet:"Rename",copyCells:"Copy Cells",fillSeries:"Fill Series",fillFormat:"Fill Formatting Only",fillWithoutFormat:"Fill Without Formatting"});var FlexSheetFunctions=[{name:"abs",description:"Returns the absolute value of a number."},{name:"acos",description:"Returns the arccosine of a number."},{name:"address",description:"Obtains the address of a cell in a worksheet by given specified row and column numbers."},{name:"and",description:"Returns TRUE if all of its arguments are TRUE."},{name:"asin",description:"Returns the arcsine of a number."},{name:"atan",description:"Returns the arctangent of a number."},{name:"atan2",description:"Returns the arctangent from x- and y-coordinates."},{name:"average",description:"Returns the average of its arguments."},{name:"ceiling",description:"Rounds a number to the nearest integer or to the nearest multiple of significance."},{name:"char",description:"Returns the character specified by the code number."},{name:"choose",description:"Chooses a value from a list of values."},{name:"code",description:"Returns a numeric code for the first character in a text string."},{name:"column",description:"Returns the column number of a reference."},{name:"columns",description:"Returns the number of columns in a reference."},{name:"concat",description:"Joins several text items into one text item."},{name:"concatenate",description:"Joins several text items into one text item."},{name:"cos",description:"Returns the cosine of a number."},{name:"count",description:"Counts how many numbers are in the list of arguments."},{name:"counta",description:"Counts how many values are in the list of arguments."},{name:"countblank",description:"Counts the number of blank cells within a range."},{name:"countif",description:"Counts the number of cells within a range that meet the given criteria."},{name:"countifs",description:"Counts the number of cells within a range that meet multiple criteria."},{name:"date",description:"Returns the serial number of a particular date."},{name:"datedif",description:"Calculates the number of days, months, or years between two dates."},{name:"day",description:"Converts a serial number to a day of the month."},{name:"dcount",description:"Counts the cells that contain numbers in a database."},{name:"exp",description:"Returns e raised to the power of a given number."},{name:"exact",description:"Compares two text strings and returns TRUE if they are exactly the same, FALSE otherwise."},{name:"false",description:"Returns the logical value FALSE."},{name:"find",description:"Finds one text value within another (case-sensitive)."},{name:"floor",description:"Rounds a number down, toward zero."},{name:"hlookup",description:"Looks in the top row of an array and returns the value of the indicated cell."},{name:"hour",description:"Converts a serial number to an hour."},{name:"if",description:"Specifies a logical test to perform."},{name:"iferror",description:"Returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula."},{name:"index",description:"Uses an index to choose a value from a reference."},{name:"indirect",description:"Returns the reference specified by a text string. References are immediately evaluated to display their contents."},{name:"isblank",description:"Checks if value refers to an empty cell."},{name:"iserr",description:"Checks if value is an error (#VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!) excluding #N/A, and returns TRUE or FALSE."},{name:"iserror",description:"Checks if value is an error (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!), and returns TRUE or FALSE."},{name:"left",description:"Returns the leftmost characters from a text value."},{name:"len",description:"Returns the number of characters in a text string."},{name:"ln",description:"Returns the natural logarithm of a number."},{name:"lower",description:"Converts text to lowercase."},{name:"max",description:"Returns the maximum value in a list of arguments."},{name:"mid",description:"Returns a specific number of characters from a text string starting at the position you specify."},{name:"min",description:"Returns the minimum value in a list of arguments."},{name:"mod",description:"Returns the remainder from division."},{name:"month",description:"Converts a serial number to a month."},{name:"not",description:"Reverses the logic of its argument."},{name:"now",description:"Returns the current date and time formatted as a date and time."},{name:"or",description:"Returns TRUE if any argument is TRUE."},{name:"pi",description:"Returns the value of pi."},{name:"power",description:"Returns the result of a number raised to a power."},{name:"product",description:"Multiplies its arguments."},{name:"proper",description:"Capitalizes the first letter in each word of a text value."},{name:"rand",description:"Returns a random number between 0 and 1."},{name:"rank",description:"Returns the rank of a number in a list of numbers."},{name:"rate",description:"Returns the interest rate per period of an annuity."},{name:"replace",description:"Replaces characters within text."},{name:"rept",description:"Repeats text a given number of times."},{name:"right",description:"Returns the rightmost characters from a text value."},{name:"round",description:"Rounds a number to a specified number of digits."},{name:"rounddown",description:"Rounds a number down, toward zero."},{name:"roundup",description:"Rounds a number up, away from zero."},{name:"row",description:"Returns the row number of a reference."},{name:"rows",description:"Returns the number of rows in a reference."},{name:"search",description:"Finds one text value within another (not case-sensitive)."},{name:"sin",description:"Returns the sine of the given angle."},{name:"sqrt",description:"Returns a positive square root."},{name:"stdev",description:"Estimates standard deviation based on a sample."},{name:"stdevp",description:"Calculates standard deviation based on the entire population."},{name:"substitute",description:"Substitutes new text for old text in a text string."},{name:"subtotal",description:"Returns a subtotal in a list or database."},{name:"sum",description:"Adds its arguments."},{name:"sumif",description:"Adds the cells specified by a given criteria."},{name:"sumifs",description:"Adds the cells in a range that meet multiple criteria."},{name:"sumproduct",description:"Multiplies corresponding components in the given arrays, and returns the sum of those products."},{name:"tan",description:"Returns the tangent of a number."},{name:"text",description:"Formats a number and converts it to text."},{name:"time",description:"Returns the serial number of a particular time."},{name:"today",description:"Returns the current date formatted as a date."},{name:"trim",description:"Removes spaces from text."},{name:"true",description:"Returns the logical value TRUE."},{name:"trunc",description:"Truncates a number to an integer."},{name:"upper",description:"Converts text to uppercase."},{name:"value",description:"Converts a text argument to a number."},{name:"var",description:"Estimates variance based on a sample."},{name:"varp",description:"Calculates variance based on the entire population."},{name:"vlookup",description:"Looks in the first column of an array and returns the value of the indicated cell."},{name:"year",description:"Converts a serial number to a year."}],FlexSheet=function(e){__extends(FlexSheet,e);function FlexSheet(t,o){var i=e.call(this,t,o)||this;i._heights=[];i._selectedSheetIndex=-1;i._columnHeaderClicked=!1;i._addingSheet=!1;i._mouseMoveHdl=i._mouseMove.bind(i);i._clickHdl=i._click.bind(i);i._touchStartHdl=i._touchStart.bind(i);i._touchEndHdl=i._touchEnd.bind(i);i._keydownHdl=i._keydown.bind(i);i._isContextMenuKeyDown=!1;i._isClicking=!1;i._builtInTableStylesCache=null;i._needCopyToSheet=!0;i._isSorting=!1;i._fillingData=!1;i._enableDragDrop=!0;i._enableFormulas=!0;i._headerRowRemoved=!1;i._clearCalcCacheOnRefresh=!0;i._copyingTo=!1;i._ignoreBindGrid=!1;i._loadingFromWorkbook=!1;i.insertedColumnIndex=0;i.dropzonePrevHit=-1;i.selectedSheetChanged=new wijmo_1.Event;i.draggingRowColumn=new wijmo_1.Event;i.droppingRowColumn=new wijmo_1.Event;i.beginDroppingRowColumn=new wijmo_1.Event;i.endDroppingRowColumn=new wijmo_1.Event;i.loaded=new wijmo_1.Event;i.unknownFunction=new wijmo_1.Event;i.sheetCleared=new wijmo_1.Event;i.prepareChangingRow=new wijmo_1.Event;i.prepareChangingColumn=new wijmo_1.Event;i.rowChanged=new wijmo_1.Event;i.columnChanged=new wijmo_1.Event;i.autoFilling=new wijmo_1.Event;i.autoFilled=new wijmo_1.Event;i._updateScrollPos=!1;o&&null!=o.allowAutoFill||(i._allowAutoFill=!0);i._needCopyToSheet=!1;i._colorThemes=["FFFFFF","000000","EEECE1","1F497D","4F818D","C0504D","9BBB59","8064A2","4BACC6","F79646"];i._eCt.style.backgroundColor="white";wijmo_1.addClass(i.hostElement,exports.FlexSheetClsNames.hostElement);wijmo_1.setCss(i.hostElement,{fontFamily:"Arial"});i._cf=new _FlexSheetCellFactory;i._bndSortConverter=i._sheetSortConverter.bind(i);i._selHdl=new _FlexSheetSelectionHandler(i);i.quickAutoSize=!1;i._canOverRuleCtrlPress=!0;i._init();i.showSort=!1;i.allowSorting=wijmo_grid_1.AllowSorting.None;i.showGroups=!1;i.showMarquee=!0;i.showSelectedHeaders=wijmo_grid_1.HeadersVisibility.All;i.allowResizing=wijmo_grid_1.AllowResizing.Both;i.allowDragging=wijmo_grid_1.AllowDragging.None;i.keyActionTab=wijmo_grid_1.KeyAction.CycleOut;i._needCopyToSheet=!0;return i}Object.defineProperty(FlexSheet,"controlTemplate",{get:function(){FlexSheet._ctrlTemplate||(FlexSheet._ctrlTemplate='<div style="width:100%;height:100%"><div wj-part="container" style="width:100%; max-width: 100vw;">'+wijmo_grid_1.FlexGrid.controlTemplate+'</div><div wj-part="tab-holder" class="'+exports.FlexSheetClsNames.tabHolder+'" style="width:100%; min-width:100px"></div><div wj-part="context-menu" style="display:none;z-index:100"></div></div>');return FlexSheet._ctrlTemplate},set:function(e){FlexSheet._ctrlTemplate=e},enumerable:!0,configurable:!0});FlexSheet.prototype._getProductInfo=function(){return"R20I,FlexSheet"};Object.defineProperty(FlexSheet.prototype,"sheets",{get:function(){this._sheets||(this._sheets=new SheetCollection);return this._sheets},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"selectedSheetIndex",{get:function(){return this._selectedSheetIndex},set:function(e){if(e!==this._selectedSheetIndex){this._showSheet(e);this._sheets.selectedIndex=e}},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"selectedSheet",{get:function(){return this._selectedSheetIndex>=0?this._sheets[this._selectedSheetIndex]:null},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"isFunctionListOpen",{get:function(){return this._functionListHost&&"none"!==this._functionListHost.style.display},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"isTabHolderVisible",{get:function(){return this._tabHolder?this._tabHolder.visible:void 0===this._isTabHolderVisibleCache||this._isTabHolderVisibleCache},set:function(e){if(this._tabHolder){if(e!==this._tabHolder.visible){this._updateDivContainerHeight(e);e?this._eFocus.removeAttribute("tabindex"):this._eFocus.tabIndex=this._orgTabIndex;this._tabHolder.visible=e;this.invalidate()}}else this._isTabHolderVisibleCache=e},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"undoStack",{get:function(){return this._undoStack},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"sortManager",{get:function(){return this._sortManager},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"showFilterIcons",{get:function(){return!!this._filter&&this._filter.showFilterIcons},set:function(e){this._filter&&this._filter.showFilterIcons!==e&&(this._filter.showFilterIcons=e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"calculationPrecision",{get:function(){var e=this._precision;return null==e?14:e},set:function(e){if(e!==this._precision){this._precision=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"definedNames",{get:function(){this._defNames||(this._defNames=new DefinedNameCollection(this));return this._defNames},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"enableDragDrop",{get:function(){return this._enableDragDrop},set:function(e){this._enableDragDrop=e},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"enableFormulas",{get:function(){return this._enableFormulas},set:function(e){if(this._enableFormulas!==e){this._enableFormulas=e;this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"allowAutoFill",{get:function(){return this._allowAutoFill},set:function(e){this._allowAutoFill=wijmo_1.asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheet.prototype,"_lastSelMovePos",{get:function(){return this._lsmPos},set:function(e){this._lsmPos=e?e.clone():null},enumerable:!0,configurable:!0});FlexSheet.prototype._setvalidateEdits=function(t){e.prototype._setvalidateEdits.call(this,t);for(var o=0;o<this.sheets.length;o++)this.sheets[o].grid&&(this.sheets[o].grid.validateEdits=t)};FlexSheet.prototype.onSelectedSheetChanged=function(e){this.selectedSheetChanged.raise(this,e)};FlexSheet.prototype.onDraggingRowColumn=function(e){this.draggingRowColumn.raise(this,e)};FlexSheet.prototype.onDroppingRowColumn=function(e){wijmo_1._deprecated("droppingRowColumn","beginDroppingRowColumn and endDroppingRowColumn");this.droppingRowColumn.raise(this,new wijmo_1.EventArgs)};FlexSheet.prototype.onBeginDroppingRowColumn=function(e){this.beginDroppingRowColumn.raise(this,e)};FlexSheet.prototype.onEndDroppingRowColumn=function(e){this.endDroppingRowColumn.raise(this,e)};FlexSheet.prototype.onLoaded=function(e){var t=this;if(this._toRefresh){clearTimeout(this._toRefresh);this._toRefresh=null}this._toRefresh=setTimeout((function(){t._setFlexSheetToDirty();t.invalidate()}),10);this.loaded.raise(this,new wijmo_1.EventArgs)};FlexSheet.prototype.onUnknownFunction=function(e){this.unknownFunction.raise(this,e)};FlexSheet.prototype.onSheetCleared=function(e){this.sheetCleared.raise(this,e)};FlexSheet.prototype.onPrepareChangingRow=function(e){this.prepareChangingRow.raise(this,e)};FlexSheet.prototype.onPrepareChangingColumn=function(e){this.prepareChangingColumn.raise(this,e)};FlexSheet.prototype.onRowChanged=function(e){this.rowChanged.raise(this,e)};FlexSheet.prototype.onColumnChanged=function(e){this.columnChanged.raise(this,e)};FlexSheet.prototype.onAutoFilling=function(e){this.autoFilling.raise(this,e)};FlexSheet.prototype.onAutoFilled=function(e){this.autoFilled.raise(this,e)};FlexSheet.prototype.refresh=function(t){void 0===t&&(t=!0);if(this.selectedSheet&&this.selectedSheet.grid.rows&&this._items&&this.selectedSheet.grid.rows.length<this._items.length)for(var o=this._items.length-this.selectedSheet.grid.rows.length,i=0;i<=o;i++)this.selectedSheet.grid.rows.push(new wijmo_grid_1.Row);this.hostElement&&!this.isUpdating&&this._updateDivContainerHeight(this.isTabHolderVisible);if(!this.preserveSelectedState&&this.selectedSheet){this.selectedSheet.selectionRanges.clear();this.selectedSheet.selectionRanges.push(this.selection)}if(t){this._clearCalcCacheOnRefresh&&this._clearCalcEngine();this._clearCalcCacheOnRefresh=!0}this._lastVisibleFrozenRow=-1;if(this.rows._frozenInternal>0)for(i=this.rows._frozenInternal-1;i>=0;i--)if(this.rows[i]&&this.rows[i].isVisible){this._lastVisibleFrozenRow=i;break}this._lastVisibleFrozenColumn=-1;if(this.columns._frozenInternal>0)for(i=this.columns._frozenInternal-1;i>=0;i--)if(this.columns[i]&&this.columns[i].isVisible){this._lastVisibleFrozenColumn=i;break}if(this.selectedSheet){if(this.selectedSheet._freezeHiddenRows&&this.selectedSheet._freezeHiddenRows.length>0)for(i=0;i<this.selectedSheet._freezeHiddenRows.length;i++){var n=this.rows[i];n instanceof HeaderRow||!this.selectedSheet._freezeHiddenRows[i]||(n.visible=!1)}if(this.selectedSheet._freezeHiddenCols&&this.selectedSheet._freezeHiddenCols.length>0)for(i=0;i<this.selectedSheet._freezeHiddenCols.length;i++)this.selectedSheet._freezeHiddenCols[i]&&(this.columns[i].visible=!1)}e.prototype.refresh.call(this,t);if(this.hostElement&&!this.isUpdating){this._tabHolder.adjustSize();this._tabHolder.isDisabled=this.isDisabled;this._tabHolder.sheetControl.isDisabled=this.isDisabled}};FlexSheet.prototype.setCellData=function(e,t,o,i,n,l){void 0===i&&(i=!1);void 0===n&&(n=!0);void 0===l&&(l=!1);var r=_isFormula(o),s=this.getCellData(e,t,!1);r&&s&&s!==o&&this.evaluate(o,null,this.sheets[this.selectedSheetIndex]);this._clearCalcEngine();return this.cells.setCellData(e,t,o,i&&!r,n,l)||this._getHasValidation()};FlexSheet.prototype.containsFocus=function(){return this.isFunctionListOpen||e.prototype.containsFocus.call(this)};FlexSheet.prototype.addUnboundSheet=function(e,t,o,i,n){var l=this._addSheet(e,t,o,i,n);0===l.selectionRanges.length&&l.selectionRanges.push(this.selection);return l};FlexSheet.prototype.addBoundSheet=function(e,t,o,i){var n=this._addSheet(e,0,0,o,i);if(t){n.itemsSource=t;this.childItemsPath&&(n.grid.childItemsPath=this.childItemsPath)}0===n.selectionRanges.length&&n.selectionRanges.push(this.selection);return n};FlexSheet.prototype.applyCellsStyle=function(e,t,o){void 0===o&&(o=!1);var i,n,l,r,s,a=null!=t&&t.length>0,h=t||[this.selection];if(this.selectedSheet)if(e||!this._cloneStyle){if(h){if(t||o)o&&!this._cloneStyle&&(this._cloneStyle=this._cloneObject(this.selectedSheet._styledCells));else{this.undoStack.stackSize>0&&(s=new _CellStyleAction(this,this._cloneStyle));this._cloneStyle=null}for(r=0;r<h.length;r++)for(i=(l=h[r]).topRow;i<=l.bottomRow;i++)for(n=l.leftCol;n<=l.rightCol;n++)this._applyStyleForCell(i,n,e,a);if(s){s.saveNewState();this._undoStack._addAction(s)}}t||this.refresh(!1)}else{this.selectedSheet._styledCells=this._cloneObject(this._cloneStyle);this._cloneStyle=null;this.refresh(!1)}};FlexSheet.prototype.freezeAtCursor=function(){var e,t,o=this;if(this.selectedSheet){this.selectedSheet._freezeHiddenRows=null;this.selectedSheet._freezeHiddenCols=null;if(this.selection&&0===this.rows._frozenInternal&&0===this.columns._frozenInternal){if(this._ptScrl.y<0){this.selectedSheet._freezeHiddenRows=[];for(var i=0;i<this.selection.topRow-1;i++){var n=this.rows[i];if(!(n instanceof HeaderRow)){if(!(n._pos+this._ptScrl.y<0&&n.visible))break;n.visible=!1;this.selectedSheet._freezeHiddenRows[i]=!0}}}if(this._ptScrl.x<0){this.selectedSheet._freezeHiddenCols=[];for(i=0;i<this.selection.leftCol-1;i++){var l=this.columns[i];if(!(l._pos+this._ptScrl.x<0&&l.visible))break;l.visible=!1;this.selectedSheet._freezeHiddenCols[i]=!0}}e=this.selection.leftCol>0?this.selection.leftCol:0;t=this.selection.topRow>0?this.selection.topRow:0}else{for(i=0;i<this.rows._frozenInternal-1&&i<this.rows.length;i++)this.rows[i].visible=!0;for(i=0;i<this.columns._frozenInternal-1&&i<this.columns.length;i++)this.columns[i].visible=!0;this._filter.apply();e=0;t=0}this.rows._frozenInternal=this.selectedSheet.grid.rows._frozenInternal=t;this.columns._frozenInternal=this.selectedSheet.grid.columns._frozenInternal=e;setTimeout((function(){o._setFlexSheetToDirty();o.invalidate();o.scrollIntoView(o.selection.topRow,o.selection.leftCol)}),10)}};FlexSheet.prototype.showColumnFilter=function(){var e=this.selection.col>0?this.selection.col:0;this.columns.length>0&&this._filter.editColumnFilter(this.columns[e])};FlexSheet.prototype.clear=function(){this.beginUpdate();this.selection=new wijmo_grid_1.CellRange;this.sheets.clear();this._selectedSheetIndex=-1;this.columns.clear();this.rows.clear();this.columnHeaders.columns.clear();this.rowHeaders.rows.clear();this._undoStack.clear();this._ptScrl=new wijmo_1.Point;this._clearCalcEngine();this._defNames&&this._defNames.clear();this._builtInTableStylesCache=null;this._copiedRanges=null;this._copiedSheet=null;this._isCutting=!1;this._cutValue=null;this._reservedContent=null;this._lastVisibleFrozenRow=-1;this._lastVisibleFrozenColumn=-1;this._loadingFromWorkbook||this.addUnboundSheet();this.endUpdate()};FlexSheet.prototype.getSelectionFormatState=function(){var e,t,o=this.rows.length,i=this.columns.length,n={isBold:!1,isItalic:!1,isUnderline:!1,isStrikethrough:!1,textAlign:"left",isMergedCell:!1,verticalAlign:"top"};if(0===o||0===i)return n;if(this.selection){if(this.selection.row>=o||this.selection.row2>=o||this.selection.col>=i||this.selection.col2>=i)return n;for(e=this.selection.topRow;e<=this.selection.bottomRow;e++)for(t=this.selection.leftCol;t<=this.selection.rightCol;t++)this._checkCellFormat(e,t,n)}return n};FlexSheet.prototype.insertRows=function(e,t){var o,i,n,l,r,s=this,a=wijmo_1.isNumber(e)&&e>=0?e:this.selection&&this.selection.topRow>-1?this.selection.topRow:0,h=wijmo_1.isNumber(t)?t:1,u=this.rows[a];if(this.selectedSheet){this.rows.length>0?a>=this.rows.length&&(a=this.rows.length-1):a=0;var d=this.collectionView,_=this.editableCollectionView,c=d instanceof wijmo_1.CollectionView?d:null;this._clearCalcEngine();this.finishEditing();_&&_.currentEditItem&&_.commitEdit();0===a&&u&&u.constructor===HeaderRow&&(a=1);this.onPrepareChangingRow(new RowColumnChangedEventArgs(a,h,!0,!1));this.undoStack.stackSize>0&&(n=new _RowsChangedAction(this,a,h,!0));this._updateCellsForUpdatingRow(this.rows.length,a,h);if(!this.collectionView||0===this.collectionView.sortDescriptions.length){l=this._updateAffectedFormula(a,h,!0,!0);r=this._updateAffectedNamedRanges(a,h,!0,!0)}if(n){n._affectedFormulas=l;n._affectedDefinedNameVals=r}var g=null==this.selectedSheet.grid.collectionView;this.beginUpdate();if(d){var f=this.itemsSource instanceof wijmo_1.CollectionView,p=this.autoGenerateColumns,m=void 0;this.selectedSheet._dataView=this.collectionView._view.slice();this.autoGenerateColumns=!1;this.collectionView.beginUpdate();this.rows[0]instanceof wijmo_grid_1._NewRowTemplate&&this.rows[1]instanceof HeaderRow?(o=this._heights).splice.apply(o,[2,0].concat(Array(h).map((function(){return null})))):(i=this._heights).splice.apply(i,[a,0].concat(Array(h).map((function(){return null}))));if(!f){m=this.selectedSheet.grid.autoGenerateColumns;this.selectedSheet.grid.autoGenerateColumns=!1;g||this.selectedSheet.grid.collectionView.beginUpdate()}var w=Math.max(a-this._getDataRowsOffset(),0);this.collectionView.moveCurrentToPosition(w);for(var C=0;C<h;C++){var S=c&&c.newItemCreator?c.newItemCreator():{};d.sourceCollection.splice(w,0,S);c&&c.trackChanges&&c.itemsAdded.push(S);if(!f){var b=this.selectedSheet.grid.itemsSource;b&&this.itemsSource!==b&&b.splice(w,0,S)}this.selectedSheet._dataView.splice(w,0,S)}this._updateItemIndexForInsertingRow(this.collectionView.sourceCollection,w,h);if(!f){g||this.selectedSheet.grid.collectionView.endUpdate(!0);this.selectedSheet.grid.autoGenerateColumns=m}var v=this.collectionView._idx;this.collectionView.endUpdate(!0);this.updateRowHeights();if(this.collectionView.sortDescriptions.length>0){this.collectionView._view=this.selectedSheet._dataView;this.collectionView._pgView=this.collectionView._getPageView();this.collectionView._idx=v;if(!f&&!g){this.selectedSheet.grid.collectionView._view=this.selectedSheet._dataView;this.selectedSheet.grid.collectionView._pgView=this.selectedSheet.grid.collectionView._getPageView();this.collectionView._idx=v}this._bindGrid(!1);this.selectedSheet.grid._bindGrid(!1)}setTimeout((function(){s._filter.apply()}));this.autoGenerateColumns=p}else{this.rows.beginUpdate();for(C=0;C<h;C++)this.rows.insert(a,new wijmo_grid_1.Row);var y=this.selectedSheet._freezeHiddenRows;if(y&&y.length)for(C=a+h;C<this.rows.length;C++)y[C]||(this.rows[C].visible=!0);this.rows.endUpdate()}this._updateTablesForUpdatingRow(a,h);this.selection&&-1!==this.selection.row&&-1!==this.selection.col||this.select(new wijmo_grid_1.CellRange(0,0),!1);if(n){n.saveNewState();this._undoStack._addAction(n)}this.onRowChanged(new RowColumnChangedEventArgs(a,h,!0,!1));this.endUpdate()}};FlexSheet.prototype.deleteRows=function(e,t){var o=this;if(this.selectedSheet&&!(this.rows.length<1)){var i=e,n=wijmo_1.isArray(e);if(!n)if(wijmo_1.isNumber(e)){if((t=wijmo_1.isNumber(t)?t:1)<1)return;i=[new wijmo_grid_1.CellRange(e,-1,e+t-1,-1)]}else n=(i=this._selections()).length>1;var l=!!this.collectionView;if(l){var r=[];i.forEach((function(e){if(e.row>=0&&e.row2>=0)for(var t=e.topRow,i=e.bottomRow;t<=i;t++)(o.rows[t]instanceof HeaderRow||o.rows[t]instanceof wijmo_grid_1._NewRowTemplate)&&r.push(t)}));r.forEach((function(e){_RangesHelper.excludeRow(i,e)}))}if((i=_RangesHelper.validateRowRanges(i,this.rows.length)).length){i.forEach((function(e){e.col=e.col2=-1}));this._clearCalcEngine();this.finishEditing();var s,a=this.selection.topRow,h=n?new RowColumnChangedEventArgs(i,!1,!1):new RowColumnChangedEventArgs(i[0].topRow,i[0].rowSpan,!1,!1);this.onPrepareChangingRow(h);this.undoStack.stackSize>0&&(s=new _RowsChangedAction(this,null,null,!1));var u,d,_=l&&this.itemsSource instanceof wijmo_1.CollectionView,c=null==this.selectedSheet.grid.collectionView,g=0;this.beginUpdate();this._isDeletingRows=!0;if(l){this.selectedSheet._dataView=this.collectionView._view.slice();u=this.autoGenerateColumns;this.autoGenerateColumns=!1;this.collectionView.beginUpdate();if(!_){d=this.selectedSheet.grid.autoGenerateColumns;this.selectedSheet.grid.autoGenerateColumns=!1;c||this.selectedSheet.grid.collectionView.beginUpdate()}}else this.rows.beginUpdate();for(var f=i.length-1;f>=0;f--){var p=i[f],m=void 0,w=new wijmo_grid_1.CellRangeEventArgs(this.cells,p);if(this.onDeletingRow(w)){if(s){(m=new _RowsChangedAction(this,p.topRow,p.rowSpan,!1))._affectedFormulas=this._updateAffectedFormula(p.bottomRow,p.rowSpan,!1,!0);m._affectedDefinedNameVals=this._updateAffectedNamedRanges(p.bottomRow,p.rowSpan,!1,!0);m._deletedTables=this._updateTablesForUpdatingRow(p.topRow,p.rowSpan,!0);s.addDeleteSubAction(m)}this._updateCellsForUpdatingRow(this.rows.length,p.topRow,p.rowSpan,!0);for(var C=p.bottomRow;C>=p.topRow;C--){var S=this.rows[C];if(!S||S.isVisible){g++;if(S.dataItem&&this.editableCollectionView){var b=void 0;this.editableCollectionView.remove(S.dataItem);var v=this.selectedSheet._dataView.indexOf(S.dataItem);this.selectedSheet._dataView.splice(v,1);var y=Array.from(this.rows).map((function(e){return e.height}));y.splice(C,1);this.setHeights(y);_||(b=this.itemsSource.indexOf(S.dataItem));this._updateItemIndexForRemovingRow(this.collectionView.sourceCollection,b)}else this.rows.removeAt(C)}}m&&m.saveNewState();this.onDeletedRow(w)}}if(l){if(!_){c||this.selectedSheet.grid.collectionView.endUpdate(g>0);this.selectedSheet.grid.autoGenerateColumns=d}this.collectionView.endUpdate(g>0);this.updateRowHeights();if(this.collectionView.sortDescriptions.length>0){this.collectionView._view=this.selectedSheet._dataView;this.collectionView._pgView=this.collectionView._getPageView();if(!_&&!c){this.selectedSheet.grid.collectionView._view=this.selectedSheet._dataView;this.selectedSheet.grid.collectionView._pgView=this.selectedSheet.grid.collectionView._getPageView()}this._bindGrid(!1);this.selectedSheet.grid._bindGrid(!1)}this.autoGenerateColumns=u}else this.rows.endUpdate();this.selectedSheet.selectionRanges.clear();var x,R=this.rows.length;if(0===R)x=new wijmo_grid_1.CellRange;else if(this.selection.topRow>=R)x=new wijmo_grid_1.CellRange(R-1,0,R-1,this.columns.length-1);else{var T=a;this.selection.topRow>=0&&(T=Math.min(T,this.selection.topRow));x=new wijmo_grid_1.CellRange(T,0,T,this.columns.length-1)}this.select(x,!1);0===R&&"move"===this.hostElement.style.cursor&&(this.hostElement.style.cursor="default");if(s){s.saveNewState();this._undoStack._addAction(s)}this.onRowChanged(h);this._isDeletingRows=!1;this.endUpdate()}}};FlexSheet.prototype.insertColumns=function(e,t){var o,i,n,l=this,r=wijmo_1.isNumber(e)&&e>=0?e:this.selection&&this.selection.leftCol>-1?this.selection.leftCol:0,s=wijmo_1.isNumber(t)?t:1;if(this.selectedSheet){this.columns.length>0?r>=this.columns.length&&(r=this.columns.length-1):r=0;this._clearCalcEngine();this.finishEditing();this.onPrepareChangingColumn(new RowColumnChangedEventArgs(r,s,!0,!0));this.undoStack.stackSize>0&&(o=new _ColumnsChangedAction(this,r,s,!0));this._updateCellsForUpdatingColumn(this.columns.length,r,s);i=this._updateAffectedFormula(r,s,!0,!1);n=this._updateAffectedNamedRanges(r,s,!0,!1);if(o){o._affectedFormulas=i;o._affectedDefinedNameVals=n}this.deferUpdate((function(){l.columns.beginUpdate();for(var e=0;e<s;e++){var t=new wijmo_grid_1.Column;t.isRequired=!1;if(l.itemsSource){t.binding=l._getUniqueColumnName();var i=l.rows[l._getDataRowsOffset()-1];if(i){i._ubv||(i._ubv={});i._ubv[t._hash]=FlexSheet._getHeaderRowText(t)}}l.columns.insert(r,t)}l.columns.endUpdate();l.selectedSheet._filterDefinition=l._filter.filterDefinition;l.selectedSheet.grid.columns._dirty=!1;l._sortManager._updateSortDescriptions(r,s);l._sortManager.commitSort(!1);l._updateTablesForUpdatingColumn(r,s);l.selection&&-1!==l.selection.row&&-1!==l.selection.col||l.select(new wijmo_grid_1.CellRange(0,0),!1);if(o){o.saveNewState();l._undoStack._addAction(o)}l.onColumnChanged(new RowColumnChangedEventArgs(r,s,!0,!0))}));this.updateRowHeights()}};FlexSheet.prototype.deleteColumns=function(e,t){if(this.selectedSheet){var o=e,i=wijmo_1.isArray(e);if(!i)if(wijmo_1.isNumber(e)){if((t=wijmo_1.isNumber(t)?t:1)<1)return;o=[new wijmo_grid_1.CellRange(-1,e,-1,e+t-1)]}else i=(o=this._selections()).length>1;if((o=_RangesHelper.validateColumnRanges(o,this.columns.length)).length){var n=this.selection.leftCol,l=0;o.forEach((function(e){l+=e.columnSpan;e.row=e.row2=-1}));this._clearCalcEngine();this.finishEditing();var r,s=i?new RowColumnChangedEventArgs(o,!1,!0):new RowColumnChangedEventArgs(o[0].leftCol,o[0].columnSpan,!1,!0);this.onPrepareChangingColumn(s);this.undoStack.stackSize>0&&(r=new _ColumnsChangedAction(this,null,null,!1));this.beginUpdate();this._isDeletingColumns=!0;var a=this.filter?this.filter._filters:null,h=!1;this.columns.beginUpdate();for(var u=o.length-1;u>=0;u--){var d=o[u],_=void 0;if(r){(_=new _ColumnsChangedAction(this,d.leftCol,d.columnSpan,!1))._affectedFormulas=this._updateAffectedFormula(d.rightCol,d.columnSpan,!1,!1);_._affectedDefinedNameVals=this._updateAffectedNamedRanges(d.rightCol,d.columnSpan,!1,!1);_._deletedTables=this._updateTablesForUpdatingColumn(d.leftCol,d.columnSpan,!0);r._delSubActions.push(_)}this._updateCellsForUpdatingColumn(this.columns.length,d.leftCol,d.columnSpan,!0);for(var c=d.rightCol;c>=d.leftCol;c--){var g=this.columns[c];if(g.isVisible){if(a)for(var f=0;f<a.length;f++)if(a[f].column===g){a.splice(f,1);h=!0;break}this.columns.removeAt(c);this._sortManager.deleteSortLevel(c)}}this._sortManager._updateSortDescriptions(d.leftCol,d.columnSpan,!1)}this.columns.endUpdate();if(h){for(c=0;c<this.columns.length;c++)this.columns[c].isVisible&&this.filter._updateColumnFilter(this.columns[c]);this.filter.apply()}this.selectedSheet._filterDefinition=this._filter.filterDefinition;this.selectedSheet.grid.columns._dirty=!1;this._sortManager.commitSort(!1);this.selectedSheet.selectionRanges.clear();var p,m=this.columns.length;if(0===m){p=new wijmo_grid_1.CellRange;"move"===this.hostElement.style.cursor&&(this.hostElement.style.cursor="default")}else if(this.selection.leftCol>=m)p=new wijmo_grid_1.CellRange(0,m-1,this.rows.length-1,m-1);else{var w=n-l+1;w=Math.max(w,o[0].leftCol);w=Math.min(w,this.selection.leftCol);p=new wijmo_grid_1.CellRange(this.selection.row,w,this.selection.row2,w)}this.select(p,!1);if(r){this._undoStack._addAction(r);r._delSubActions.forEach((function(e){e.saveNewState()}))}this.onColumnChanged(s);this._isDeletingColumns=!1;this.endUpdate();this.updateRowHeights()}}};FlexSheet.prototype.mergeRange=function(e,t){void 0===t&&(t=!1);var o,i,n,l,r,s=e||this.selection,a=-1,h=-1;if(this.selectedSheet){if(s){if(1===s.rowSpan&&1===s.columnSpan)return;for(o=s.topRow;o<=s.bottomRow;o++)for(i=s.leftCol;i<=s.rightCol;i++)if(this.selectedSheet.findTable(o,i))return;if(!e&&!t){this.undoStack.stackSize>0&&(r=new _CellMergeAction(this));this.hostElement.focus()}if(!this._resetMergedRange(s)){for(o=s.topRow;o<=s.bottomRow;o++)if((n=this.rows[o])&&n.isVisible){a=o;break}for(i=s.leftCol;i<=s.rightCol;i++)if((l=this.columns[i])&&l.isVisible){h=i;break}a>-1&&h>-1&&this.selectedSheet._mergedRanges.push(new wijmo_grid_1.CellRange(a,h,s.bottomRow,s.rightCol))}if(r){r.saveNewState();this._undoStack._addAction(r)}}e||this.refresh()}};FlexSheet.prototype.getMergedRange=function(t,o,i,n){void 0===n&&(n=!0);var l,r,s,a,h=this.selectedSheet?this.selectedSheet._getMergedRange(o,i):null;if(t===this.cells&&h){if(!h.isSingleCell&&(this.rows._frozenInternal>0||this.columns._frozenInternal>0)&&(h.topRow<this.rows._frozenInternal&&h.bottomRow>=this.rows._frozenInternal||h.leftCol<this.columns._frozenInternal&&h.rightCol>=this.columns._frozenInternal)){l=h.topRow;r=h.bottomRow;s=h.leftCol;a=h.rightCol;o>=this.rows._frozenInternal&&h.topRow<this.rows._frozenInternal&&(l=this.rows._frozenInternal);o<this.rows._frozenInternal&&h.bottomRow>=this.rows._frozenInternal&&(r=this.rows._frozenInternal-1);r>=this.rows.length&&(r=this.rows.length-1);i>=this.columns._frozenInternal&&h.leftCol<this.columns._frozenInternal&&(s=this.columns._frozenInternal);i<this.columns._frozenInternal&&h.rightCol>=this.columns._frozenInternal&&(a=this.columns._frozenInternal-1);a>=this.columns.length&&(a=this.columns.length-1);return new wijmo_grid_1.CellRange(l,s,r,a)}return h.bottomRow>=this.rows.length?new wijmo_grid_1.CellRange(h.topRow,h.leftCol,this.rows.length-1,h.rightCol):h.rightCol>=this.columns.length?new wijmo_grid_1.CellRange(h.topRow,h.leftCol,h.bottomRow,this.columns.length-1):h.clone()}return e.prototype.getMergedRange.call(this,t,o,i,n)};FlexSheet.prototype.evaluate=function(e,t,o,i){void 0===i&&(i=!0);var n=this._evaluate(e,t,o);return i&&null!=n&&!wijmo_1.isPrimitive(n)?n instanceof FormulaError?n.error:n.value:n};FlexSheet.prototype.getCellValue=function(e,t,o,i){void 0===o&&(o=!1);var n=i&&i!==this.selectedSheet?i.grid.columns[t]:this.columns[t],l=this._getCellStyle(e,t,i),r=l&&l.format||null,s=i&&i!==this.selectedSheet?i.grid.getCellData(e,t,!1):this.getCellData(e,t,!1);if(wijmo_1.isString(s)){var a=i||this.selectedSheet;if(a){var h=a.findTable(e,t);if(h&&h._isHeaderRow(e))return s}var u=_FormulaErrorHelper.asError(s);if(u)return u;if(_isFormula(s)){null==i&&(i=this.selectedSheet);if((s=this._evaluate(s,null,i,e,t))instanceof FormulaError)return s}}if(o){r||null==s||wijmo_1.isPrimitive(s)||(r=s.format);s=this._formatEvaluatedResult(s,n,r)}else null==s||wijmo_1.isPrimitive(s)||(s=s.value);return 0===o?s:null==s?"":s};FlexSheet.prototype.showFunctionList=function(e){var t=this;if(this._enableFormulas){this._functionTarget=wijmo_1.tryCast(e,HTMLInputElement);if(this._functionTarget&&this._functionTarget.value&&"="===this._functionTarget.value[0]){this._functionList._cv.filter=function(e){var o,i=e.actualvalue.toLowerCase(),n=t._getCurrentFormulaIndex(t._functionTarget.value);-1===n&&(n=0);return(o=t._functionTarget.value.substr(n+1).trim().toLowerCase()).length>0&&0===i.indexOf(o)||"="===t._functionTarget.value};this._functionList.selectedIndex=0;var o=e.getBoundingClientRect(),i=this._root.getBoundingClientRect(),n=FlexSheet._EDITOR_PADDING_BELOW+FlexSheet._MIN_DIALOG_GAP,l=Math.floor(o.bottom)+n+window.scrollY,r=o.left+window.scrollX;wijmo_1.setCss(this._functionListHost,{height:this._functionList._cv.items.length>5?"218px":"auto",display:this._functionList._cv.items.length>0?"block":"none",top:"",left:""});this._functionListHost.scrollTop=0;var s=this._functionListHost.offsetHeight,a=this._functionListHost.offsetWidth;n=FlexSheet._EDITOR_PADDING_BELOW+FlexSheet._MIN_DIALOG_GAP+FlexSheet._EDITOR_PADDING_ABOVE;var h=l-o.height-n-s;h>=0&&s+l>i.bottom&&(l=h);a+r>i.right+window.scrollX&&(r=i.right+window.scrollX-a);wijmo_1.setCss(this._functionListHost,{top:l,left:r})}else this.hideFunctionList()}};FlexSheet.prototype.hideFunctionList=function(){this._functionListHost.style.display="none"};FlexSheet.prototype.selectPreviousFunction=function(){this._functionList.selectedIndex>0&&this._functionList.selectedIndex--};FlexSheet.prototype.selectNextFunction=function(){this._functionList.selectedIndex<this._functionList.itemsSource.length&&this._functionList.selectedIndex++};FlexSheet.prototype.applyFunctionToCell=function(){if(this._functionTarget){var e=this._getCurrentFormulaIndex(this._functionTarget.value);-1===e?e=this._functionTarget.value.indexOf("="):e+=1;this._functionTarget.value=this._functionTarget.value.substring(0,e)+this._functionList.selectedValue+"(";"="!==this._functionTarget.value[0]&&(this._functionTarget.value="="+this._functionTarget.value);this._functionTarget.focus();this.hideFunctionList()}};FlexSheet.prototype.save=function(e,t){var o=this._saveToWorkbook(t);e&&o.save(e);return o};FlexSheet.prototype.saveAsync=function(e,t,o,i){var n=this._saveToWorkbook(i);n.saveAsync(e,t,o);return n};FlexSheet.prototype.saveToWorkbookOM=function(e){return this._saveToWorkbook(e)._serialize()};FlexSheet.prototype.load=function(e){var t=this;if(e instanceof Blob)wijmo_grid_xlsx_1._blobToBuffer(e,(function(o){e=null;var i=new mXlsx.Workbook;i.load(o);o=null;t._loadFromWorkbook(i);i=null}));else if(e instanceof mXlsx.Workbook){this._loadFromWorkbook(e);e=null}else{if(!(e instanceof ArrayBuffer||wijmo_1.isString(e)))throw"Invalid workbook.";var o=new mXlsx.Workbook;o.load(e);e=null;this._loadFromWorkbook(o);o=null}};FlexSheet.prototype.loadAsync=function(e,t,o){var i=this;if(e instanceof Blob)wijmo_grid_xlsx_1._blobToBuffer(e,(function(n){e=null;var l=new mXlsx.Workbook;l.loadAsync(n,(function(){i._loadFromWorkbook(l);t&&t(l);n=null;l=null}),o)}));else if(e instanceof mXlsx.Workbook){this._loadFromWorkbook(e);t&&t(e);e=null}else{if(!(e instanceof ArrayBuffer||wijmo_1.isString(e)))throw"Invalid workbook.";var n=new mXlsx.Workbook;n.loadAsync(e,(function(){e=null;i._loadFromWorkbook(n);t&&t(n);n=null}),o)}};FlexSheet.prototype.loadFromWorkbookOM=function(e){var t;e instanceof mXlsx.Workbook?t=e:(t=new mXlsx.Workbook)._deserialize(e);this._loadFromWorkbook(t)};FlexSheet.prototype.undo=function(){var e=this;setTimeout((function(){e._undoStack.undo()}),100)};FlexSheet.prototype.redo=function(){var e=this;setTimeout((function(){e._undoStack.redo()}),100)};FlexSheet.prototype.select=function(t,o,i){void 0===o&&(o=!0);var n,l,r;if(wijmo_1.isNumber(t)&&wijmo_1.isNumber(o)){t=new wijmo_grid_1.CellRange(t,o);this._lastSelMovePos=t;o=!0}else this._lastSelMovePos=null;if(t.rowSpan!==this.rows.length&&t.columnSpan!==this.columns.length)for(l=t.topRow;l<=t.bottomRow;l++)for(r=t.leftCol;r<=t.rightCol;r++)if((n=this.getMergedRange(this.cells,l,r))&&!t.equals(n)){if(t.row<=t.row2){t.row=Math.min(t.topRow,n.topRow);t.row2=Math.max(t.bottomRow,n.bottomRow)}else{t.row=Math.max(t.bottomRow,n.bottomRow);t.row2=Math.min(t.topRow,n.topRow)}if(t.col<=t.col2){t.col=Math.min(t.leftCol,n.leftCol);t.col2=Math.max(t.rightCol,n.rightCol)}else{t.col=Math.max(t.rightCol,n.rightCol);t.col2=Math.min(t.leftCol,n.leftCol)}}this._isPasting&&this.collectionView&&(this.collectionView._pendingRefresh=!1);!this._enableMulSel&&this.selectedSheet&&this.selectedSheet.selectionRanges.clear();return e.prototype.select.call(this,t,o,i)};FlexSheet.prototype.addCustomFunction=function(e,t,o,i,n){wijmo_1._deprecated("addCustomFunction","addFunction");this._calcEngine.addCustomFunction(e,t,i,n);this._addCustomFunctionDescription(e,o)};FlexSheet.prototype.addFunction=function(e,t,o,i,n){this._calcEngine.addFunction(e,t,i,n);this._addCustomFunctionDescription(e,o)};FlexSheet.prototype.dispose=function(){var t=window.navigator.userAgent;this._needCopyToSheet=!1;this.removeEventListener(document.body,"mousemove",this._mouseMoveHdl);this.removeEventListener(document.body,"keydown",this._keydownHdl);this.removeEventListener(document.body,"click",this._clickHdl);if(t.match(/iPad/i)||t.match(/iPhone/i)){this.removeEventListener(document.body,"touchstart",this._touchStartHdl);this.removeEventListener(document.body,"touchend",this._touchEndHdl)}this._filter&&this._filter.filterApplied.removeAllHandlers();this.hideFunctionList();if(!this.itemsSource){var o=this._selHdl.selection;o.row=o.row2=-1}if(this._toRefresh){clearTimeout(this._toRefresh);this._toRefresh=null}this._sheets.clear();this._tabHolder.dispose();this._contextMenu.dispose();this._functionList.dispose();e.prototype.dispose.call(this)};FlexSheet.prototype.getClipString=function(t){var o,i,n,l,r,s,a,h="",u=!0;if(!this.selectedSheet)return e.prototype.getClipString.call(this,t);this._isCutting=!1;if(!t)if(this.selectedSheet.selectionRanges.length>1){if(this._isMultipleRowsSelected()){h="";(o=this._selections()).sort(this._sortByRow);for(n=0;n<o.length;n++){h&&(h+="\n");h+=this.getClipString(o[n])}return h}if(this._isMultipleColumnsSelected()){h="";(o=this._selections()).sort(this._sortByColumn);for(i=(r=o[0]).topRow,u=!0;i<=r.bottomRow;i++){u||(h+="\n");u=!1;for(n=0,l=!0;n<o.length;n++){s=o[n];l||(h+="\t");l=!1;h+=this.getClipString(new wijmo_grid_1.CellRange(i,s.col,i,s.col2))}}return h}wijmo_1.assert(!1,"Copy or Cut operation cannot be used on multiple selections.")}else{var d=this.selectionMode;if(d!=wijmo_grid_1.SelectionMode.ListBox)for(var _=this.rows,c=0;c<_.length;c++)if(_[c].isSelected){d=wijmo_grid_1.SelectionMode.ListBox;break}t=this.selection;switch(d){case wijmo_grid_1.SelectionMode.Row:case wijmo_grid_1.SelectionMode.RowRange:t.col=0;t.col2=this.columns.length-1;break;case wijmo_grid_1.SelectionMode.ListBox:t.col=0;t.col2=this.columns.length-1;for(var g=0;g<this.rows.length;g++)if(this.rows[g].isSelected&&this.rows[g].isVisible){t.row=t.row2=g;h&&(h+="\n");h+=this.getClipString(t)}return h}}if(!(t=wijmo_1.asType(t,wijmo_grid_1.CellRange)).isValid)return"";c=t.topRow;for(var f=!0;c<=t.bottomRow;c++){var p=this.rows[c];if(p.isVisible){f||(h+="\n");f=!1;for(var m=p instanceof wijmo_grid_1.GroupRow?p:null,w=this.activePanel.grid,C=m&&(w.groupSummaryPosition===wijmo_grid_1.GroupSummaryPosition.Bottom||w.groupSummaryPosition===wijmo_grid_1.GroupSummaryPosition.Auto&&!m.isCollapsed),S=m&&!m.isSummary&&C,b=t.leftCol,v=!0;b<=t.rightCol;b++)if(this.columns[b].isVisible){v||(h+="\t");v=!1;a=this.getCellValue(c,b,!0).toString();S&&b!=this.columns.firstVisibleIndex&&(a="");var y=new wijmo_grid_1.CellRangeEventArgs(this.activePanel,new wijmo_grid_1.CellRange(c,b,c,b),a);this.onGettingCellClipString(y);(a=(a=y.data).replace(/\t/g," ")).indexOf("\n")>-1&&(a='"'+a.replace(/"/g,'""')+'"');h+=a}}}return h};FlexSheet.prototype.setClipString=function(t,o){var i=null==o,n=!1;if(this.selectedSheet){o=o?wijmo_1.asType(o,wijmo_grid_1.CellRange):this.selection;var l=t=wijmo_1.asString(t).replace(/\r\n/g,"\n").replace(/\r/g,"\n"),r=this._edtHdl._parseClipString(wijmo_1.asString(t));i&&!o.isSingleCell&&r.length&&this._edtHdl._expandClipRows(r,o);var s=this._containsMultiLineText(r);if(this._copiedRanges&&0!==this._copiedRanges.length&&(l.trim()===this._getRangeString(this._copiedRanges,this._copiedSheet).trim()||this._containsRandFormula(this._copiedRanges,this._copiedSheet))&&!this._cutValue||s){0===o.topRow&&this.allowAddNew&&this.newRowAtTop&&this.rows[0].isVisible&&o.rowSpan>1&&this.select(new wijmo_grid_1.CellRange(o.topRow,o.leftCol,o.topRow,o.rightCol));if(this._copiedRanges){var a=this._getRangeString(this._copiedRanges,this._copiedSheet,!1)+"\r\n";a=wijmo_1.asString(a).replace(/\r\n/g,"\n").replace(/\r/g,"\n");r=this._edtHdl._parseClipString(wijmo_1.asString(a));i&&!o.isSingleCell&&r.length&&this._edtHdl._expandClipRows(r,o)}var h=o.topRow+r.length-1;h>=this.rows.length&&(h=this.rows.length-1);var u=o.leftCol;if(r.length)for(var d=u,_=0;d<this.columns.length&&_<r[0].length;d++){this.columns[d].visible&&_++;u=d}var c=new wijmo_grid_1.CellRange(o.topRow,o.leftCol,h,u);if(this.onPasting(new wijmo_grid_1.CellRangeEventArgs(this.cells,c,t))){this.beginUpdate();var g=r.length>1,f=this.editableCollectionView;f&&g&&f.beginUpdate();if(s||!this._copiedRanges||this._copiedRanges.length>1||0===this._copiedRanges.length)for(var p=0,m=(I=this._copiedRanges&&this._copiedRanges.length>1?this._copiedRanges[0]:new wijmo_grid_1.CellRange).topRow,w=(d=0,o.topRow);d<r.length&&w<this.rows.length;d++,w++){if((D=this.rows[w]).isVisible){if(!D.isReadOnly){var C=r[d],S=I.leftCol,b=D.dataItem;if(D instanceof wijmo_grid_1._NewRowTemplate){g&&(D.dataItem=f.addNew());var v=this.newRowAtTop?g?0:d:w,y=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(v,-1));if(!this.onRowEditStarting(y)){w--;g&&f.cancelNew();continue}this.onRowEditStarted(y)}for(var x=0,R=o.leftCol;x<C.length&&R<this.columns.length;x++,R++)if(this.columns[R].isVisible){if(!this.columns[R].isReadOnly){var T=C[x];if(!this.columns[R].isReadOnly&&!D.isReadOnly){var E=T.length;E>1&&'"'==T[0]&&'"'==T[E-1]&&T.indexOf("\n")>-1&&(T=T.substr(1,E-2));n=this._postSetClipStringProcess(b,T,w,R,p,m,S,f)||n;c.row2=Math.max(c.row2,w+p);c.col2=Math.max(c.col2,R)}S>=0&&S++}}else x--;m>=0&&m++;if(g&&D instanceof wijmo_grid_1._NewRowTemplate){D.dataItem=null;w--;p++;y=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(this.newRowAtTop?0:w,-1));this.onRowEditEnding(y);this.onRowEditEnded(y);f.commitNew()}}}else d--}else if(this._copiedRanges&&1===this._copiedRanges.length){var F=this.selectedSheet===this._copiedSheet?this:this._copiedSheet.grid,A=(p=0,0),I=this.selectionMode===wijmo_grid_1.SelectionMode.ListBox?this._getSelectionForListBoxMode(F):this._copiedRanges[0];for(d=0,w=o.topRow;d<r.length&&w<this.rows.length;d++,w++){var D,k=0;if((D=this.rows[w]).isVisible){if(!D.isReadOnly){for(;F.rows[I.topRow+A]&&!F.rows[I.topRow+A].isVisible;)A++;A>=I.rowSpan&&(A%=I.rowSpan);if(!F.rows[I.topRow+A])break;var j=w-I.topRow-A;C=r[d],b=D.dataItem;if(D instanceof wijmo_grid_1._NewRowTemplate){g&&(D.dataItem=f.addNew());v=this.newRowAtTop?g?0:d:w,y=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(v,-1));if(!this.onRowEditStarting(y)){w--;g&&f.cancelNew();continue}this.onRowEditStarted(y)}for(x=0,R=o.leftCol;x<C.length&&R<this.columns.length;x++,R++)if(this.columns[R]&&this.columns[R].isVisible){if(!this.columns[R].isReadOnly){k>=I.columnSpan&&(k%=I.columnSpan);if(!F.columns[I.leftCol+k])break;var M=R-I.leftCol-k;if(!this.columns[R].isReadOnly&&!D.isReadOnly){T=C[x];var N=this._getCellStyle(I.topRow+A,I.leftCol+k,this._copiedSheet);if(_isFormula(T)&&(0!==j||0!==M))try{var V=this._calcEngine.parse(T),B=new wijmo_grid_1.CellRange(I.topRow+A,I.leftCol+k),H=new wijmo_grid_1.CellRange(I.topRow+A+j,I.leftCol+k+M),L=!(this._isCutting&&!V._refersTo(I));V._moveCellRangeExp(this.selectedSheetIndex,B,H,!1,L)&&(T="="+V._getStringExpression())}catch(e){}F.columns[I.leftCol+k].format&&!this.columns[R].format&&(N?N.format||(N.format=F.columns[I.leftCol+k].format):N={format:F.columns[I.leftCol+k].format});n=this._postSetClipStringProcess(b,T,w,R,p,I.topRow+A,I.leftCol+k,f,N)||n;c.row2=Math.max(c.row2,w+p);c.col2=Math.max(c.col2,R)}k++}}else x--;A++;if(g&&D instanceof wijmo_grid_1._NewRowTemplate){D.dataItem=null;w--;p++;y=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(this.newRowAtTop?0:w,-1));this.onRowEditEnding(y);this.onRowEditEnded(y);f.commitNew()}}}else d--}}if(this._isCutting){this._delCutData(r.length,r[0].length);this._isCutting=!1;this._cutValue=l;this._copiedRanges=null;this._copiedSheet=null}if(f&&g){f.currentEditItem&&f.commitEdit();f.endUpdate(!0)}else if(f&&n){var P=f.currentAddItem;!P&&0===o.topRow&&this.newRowAtTop&&this.rows[0]instanceof wijmo_grid_1._NewRowTemplate&&(P=this.rows[0].dataItem);if(P){f.editItem(P);this._edtHdl._edItem=P}f.refresh()}this.endUpdate();this.select(c);this.onPasted(new wijmo_grid_1.CellRangeEventArgs(this.cells,c))}else{this._cutValue=null;this._copiedRanges=null;this._copiedSheet=null}}else{if(l!==this._cutValue){this._cutValue=null;e.prototype.setClipString.call(this,t,o)}this._copiedRanges=null;this._copiedSheet=null}}else e.prototype.setClipString.call(this,t,o)};FlexSheet.prototype.getBuiltInTableStyle=function(e){var t;null==this._builtInTableStylesCache&&(this._builtInTableStylesCache={});if(null==(t=this._builtInTableStylesCache[e.toLowerCase()])){t=this._createBuiltInTableStyle(e);Object.freeze(t);this._builtInTableStylesCache[e.toLowerCase()]=t}return t};FlexSheet.prototype.onSortingColumn=function(e){if(e.data.srcElement instanceof HTMLButtonElement&&wijmo_1.hasClass(e.data.srcElement,"wj-btn")){this.sortingColumn.raise(this,e);return!e.cancel}return!1};FlexSheet.prototype._getCvIndex=function(t){return t>-1&&this.collectionView?this.rows[t]instanceof HeaderRow?t:e.prototype._getCvIndex.call(this,t):-1};FlexSheet.prototype._headerRowAtTop=function(){var e=this._getDataRowsOffset();return e>0&&this.rows[e-1]instanceof HeaderRow};FlexSheet.prototype._getDataRowsOffset=function(){var e=0;this.allowAddNew&&this.newRowAtTop&&e++;this.rows[e]instanceof HeaderRow&&e++;return e};FlexSheet.prototype._bindGrid=function(t){if(!this._ignoreBindGrid)if(this.itemsSource)e.prototype._bindGrid.call(this,t);else if(!this.rows.length){var o=this._selHdl.selection;o.row=o.row2=-1}};FlexSheet.prototype._init=function(){var e=this,t=window.navigator.userAgent,mouseUp=function(t){document.removeEventListener("mouseup",mouseUp);e._mouseUp(t)};this.hostElement.setAttribute("tabindex","-1");this._divContainer=this.hostElement.querySelector('[wj-part="container"]');this._tabHolder=new _TabHolder(this.hostElement.querySelector('[wj-part="tab-holder"]'),this);if(void 0!==this._isTabHolderVisibleCache){this._tabHolder.visible=this._isTabHolderVisibleCache;this._isTabHolderVisibleCache||(this._eFocus.tabIndex=this._orgTabIndex);this._isTabHolderVisibleCache=void 0}this._sheets.selectedSheetChanged.addHandler(this._selectedSheetChange,this);this._sheets.collectionChanged.addHandler(this._sourceChange,this);this._sheets.sheetVisibleChanged.addHandler(this._sheetVisibleChange,this);this._sheets.sheetCleared.addHandler(this.onSheetCleared,this);this._contextMenu=new _SheetContextMenu(this.hostElement.querySelector('[wj-part="context-menu"]'),this);this._tabHolder.addEventListener(this._tabHolder.hostElement,"mousedown",(function(){t.match(/iPad/i)||t.match(/iPhone/i)||e._hideContextMenu()}));this._gpCells=new FlexSheetPanel(this,wijmo_grid_1.CellType.Cell,this.rows,this.columns,this._eCt);this._gpCHdr=new FlexSheetPanel(this,wijmo_grid_1.CellType.ColumnHeader,this._hdrRows,this.columns,this._eCHdrCt);this._gpRHdr=new FlexSheetPanel(this,wijmo_grid_1.CellType.RowHeader,this.rows,this._hdrCols,this._eRHdrCt);this._gpTL=new FlexSheetPanel(this,wijmo_grid_1.CellType.TopLeft,this._hdrRows,this._hdrCols,this._eTLCt);this._syncSelection=this._flexSheetSyncSelection.bind(this);this._sortManager=new SortManager(this);this._filter=new FlexSheetFilter(this);this._filter.filterApplied.addHandler((function(){if(e.selectedSheet){e.selectedSheet._filterDefinition=e._filter.filterDefinition;if(e.selectedSheet.itemsSource){e.selectedSheet._storeRowSettings();e.selectedSheet._setRowSettings()}}}));this._calcEngine=new _CalcEngine(this);this._calcEngine.unknownFunction.addHandler((function(t,o){e.onUnknownFunction(o)}),this);this._initFuncsList();this._undoStack=new UndoStack(this);this.loadedRows.addHandler((function(){if(e.collectionView&&!(e.rows[0]instanceof HeaderRow)&&!e._headerRowRemoved){var t=new HeaderRow;t.isReadOnly=!0;for(var o=0;o<e.columns.length;o++){var i=e.columns[o];t._ubv||(t._ubv={});t._ubv[i._hash]=FlexSheet._getHeaderRowText(i)}e.rows[0]instanceof wijmo_grid_1._NewRowTemplate&&e.newRowAtTop?e.rows.insert(1,t):e.rows.insert(0,t)}e._filter&&e._filter.apply()}));this.itemsSourceChanged.addHandler((function(){var t;for(t=0;t<e.columns.length;t++)e.columns[t].isRequired=!1;e.collectionView&&e.collectionView.currentChanged.removeHandler(null,e)}));this.copied.addHandler((function(t,o){var i;if(e.selectedSheet){e._copiedSheet=e.selectedSheet;e._needCopyToSheet=!0;if(e.selectedSheet.selectionRanges.length>1)if(e._isMultipleRowsSelected()){(i=e.selectedSheet.selectionRanges.slice(0)).sort(e._sortByRow);e._copiedRanges=i}else if(e._isMultipleColumnsSelected()){(i=e.selectedSheet.selectionRanges.slice(0)).sort(e._sortByColumn);e._copiedRanges=i}else wijmo_1.assert(!1,"Copy operation cannot be used on multiple selections.");else e._copiedRanges=[o.range]}}));this.rows.collectionChanged.addHandler((function(t,o){e._clearForEmptySheet("rows");e.itemsSource||!e.selectedSheet||!e._needCopyToSheet||e._isCopying||e._isUndoing||o.item instanceof wijmo_grid_1._NewRowTemplate||e._copyRowsToSelectedSheet();e.itemsSource&&e.selectedSheet&&o.action===wijmo_1.NotifyCollectionChangedAction.Remove&&o.item instanceof HeaderRow&&!e._draggingSingleRow&&(e._headerRowRemoved=!0)}),this);this.columns.collectionChanged.addHandler((function(t){e._clearForEmptySheet("columns");e.selectedSheet&&e._needCopyToSheet&&!e._isCopying&&!e._isUndoing&&e._copyColumnsToSelectedSheet()}),this);this.addEventListener(this.hostElement,"mousedown",(function(t){document.addEventListener("mouseup",mouseUp);e._isDescendant(e._divContainer,t.target)&&e._mouseDown(t)}),!0);this.addEventListener(this.hostElement,"dragend",(function(){e._columnHeaderClicked=!1;e._htDown=null;e._enableMulSel=!1;e.selectedSheet._addSelection(e.selection)}));this.addEventListener(this.hostElement,"contextmenu",(function(t){if(!t.defaultPrevented&&e.selectedSheet){if(!e.activeEditor){var o=void 0,i=void 0,n=e.selection;if(e._isContextMenuKeyDown&&n.row>-1&&n.col>-1&&e.rows.length>0&&e.columns.length>0){var l=e.columns[n.col],r=e.rows[n.row],s=e._cumulativeOffset(e.hostElement),a=e._cumulativeScrollOffset(e.hostElement),h=l.pos+e._eCt.offsetLeft+s.x+l.renderSize/2+e._ptScrl.x,u=r.pos+e._eCt.offsetTop+s.y+r.renderSize/2+e._ptScrl.y;i=new wijmo_1.Point(h-a.x,u-a.y);o=e.hitTest(h,u)}else o=e.hitTest(t);t.preventDefault();if(o&&o.cellType!==wijmo_grid_1.CellType.None){var d=e.columns.length-1,_=e.rows.length-1,c=void 0;switch(o.cellType){case wijmo_grid_1.CellType.TopLeft:c=new wijmo_grid_1.CellRange(Math.min(0,_),Math.min(0,d),_,d);break;case wijmo_grid_1.CellType.RowHeader:c=new wijmo_grid_1.CellRange(o.row,Math.min(0,d),o.row,d);break;case wijmo_grid_1.CellType.ColumnHeader:c=new wijmo_grid_1.CellRange(e.itemsSource&&e.rows[0]&&!e.rows[0].isVisible?1:Math.min(0,_),o.col,_,o.col);break;case wijmo_grid_1.CellType.Cell:c=new wijmo_grid_1.CellRange(o.row,o.col)}(c&&e.selection.contains(c)||o.cellType===wijmo_grid_1.CellType.RowHeader&&e._isRowSelected(o.row)||o.cellType===wijmo_grid_1.CellType.ColumnHeader&&e._isColumnSelected(o.col)||o.cellType===wijmo_grid_1.CellType.Cell&&e._isCellSelected(o.row,o.col))&&(c=null);if(c){if(e.selectedSheet){e.selectedSheet.selectionRanges.clear();e.selectedSheet.selectionRanges.push(c)}e.selection=c}e._contextMenu.show(t,i)}}e._isContextMenuKeyDown=!1}}));this.prepareCellForEdit.addHandler(this._prepareCellForEditHandler,this);this.cellEditEnded.addHandler((function(t,o){(!o.data||46!==o.data.keyCode&&8!==o.data.keyCode)&&setTimeout((function(){e.hideFunctionList()}),200)}));this.cellEditEnding.addHandler((function(t,o){if(!o.cancel&&(!o.data||46!==o.data.keyCode&&8!==o.data.keyCode)){var i=e.getCellData(o.row,o.col,!1),n=e.cellFactory.getEditorValue(e);if((null==i||""===i)&&null!=n&&""!==n&&!isNaN(+n)){var l=e._updateFormulaBoundaryForEditingCell(o.row,o.col);e._undoStack._pendingAction&&e._undoStack._pendingAction instanceof _EditAction&&(e._undoStack._pendingAction._affectedFormulas=l)}e._clearCalcEngine();e._clearCalcCacheOnRefresh=!1}}));this.rowEditEnding.addHandler((function(t){var o=e.collectionView;if(o&&e.selectedSheet){var i=o.sortDescriptions.length>0,n=e._filter&&e._filter._isActive();(i||e.selectedSheet._dataView||n)&&(e.selectedSheet._dataView=o._view.slice());i&&(e.selectedSheet._scrollPosition=e.scrollPosition)}}));this.rowEditEnded.addHandler((function(t){var o=e.collectionView;if(o&&e.selectedSheet){e.selectedSheet._dataView&&(e.selectedSheet._dataView=o._view.slice());var i=o.sortDescriptions.length>0,n=e._filter&&e._filter._isActive();if(i||n){o._view=e.selectedSheet._dataView;o._pgView=o._getPageView();if(!(e.itemsSource instanceof wijmo_1.CollectionView)&&null!=e.selectedSheet.grid.collectionView){e.selectedSheet.grid.collectionView._view=e.selectedSheet._dataView;e.selectedSheet.grid.collectionView._pgView=e.selectedSheet.grid.collectionView._getPageView()}if(e.refreshOnEdit){e._isPasting||e._bindGrid(!1);e.selectedSheet.grid._bindGrid(!1)}}i&&(e.scrollPosition=e.selectedSheet._scrollPosition)}}));this.pasting.addHandler((function(){e._needCopyToSheet=!1;e._isPasting=!0}));this.pasted.addHandler((function(){var t=e.collectionView,o=e.selectedSheet;t&&o&&o._dataView&&o._dataView.length!==t._view.length&&(o._dataView=t._view.slice());e._needCopyToSheet=!0;e._isPasting=!1;e._clearCalcEngine()}));this.resizingColumn.addHandler((function(){e._resizing=!0}));this.resizingRow.addHandler((function(){e._resizing=!0}));this.resizedColumn.addHandler((function(){e._resizing=!1}));this.resizedRow.addHandler((function(){e._resizing=!1}));this.selectionChanged.addHandler((function(){var t=e.selection;t.rightCol>=e.columns.length&&(e.selection=new wijmo_grid_1.CellRange(t.row,Math.min(t.col,e.columns.length-1),t.row2,Math.min(e.selection.col2,e.columns.length-1)));e._enableMulSel||e._isCopying||!e.selectedSheet||e.selectedSheet.selectionRanges.clear()}));this.draggingRow.addHandler((function(){e._draggingSingleRow=!0}));this.draggedRow.addHandler((function(){e._draggingSingleRow=!1}));this.addEventListener(this.hostElement,"keydown",(function(t){var o,i,n=!1,l=!1;if(t.ctrlKey){if(89===t.keyCode){e.finishEditing();e.redo();t.preventDefault()}if(90===t.keyCode){e.finishEditing();e.undo();t.preventDefault()}if(e.selectedSheet&&65===t.keyCode){e._isClicking=!0;e.selectedSheet.selectionRanges.clear();e.selectedSheet.selectionRanges.push(e.selection);e._isClicking=!1}if(67===t.keyCode||45==t.keyCode){if(e.activeEditor){e._copiedRanges=null;e._copiedSheet=null}e._cutValue=null}if(88===t.keyCode&&!e.activeEditor){t.stopPropagation();if(e.selectionMode===wijmo_grid_1.SelectionMode.ListBox)for(var r=0;r<e.rows.length;r++)if(e.rows[r].isSelected)if(n)l||wijmo_1.assert(!1,"Cut operation cannot be used on multiple selections.");else{n=!0;l=!0}else l&&(l=!1);if(e.selectedSheet.selectionRanges.length>1)wijmo_1.assert(!1,"Cut operation cannot be used on multiple selections.");else{e.finishEditing();o=new wijmo_grid_1.CellRangeEventArgs(e.cells,e.selection);if(e.onCopying(o)){e._cutValue=null;i=e.getClipString();e._isCutting=!0;wijmo_1.Clipboard.copy(i);e.onCopied(o)}}}t.keyCode!==wijmo_1.Key.Space||!e.selection.isValid||e.selectionMode!==wijmo_grid_1.SelectionMode.CellRange&&e.selectionMode!==wijmo_grid_1.SelectionMode.MultiRange||e.select(new wijmo_grid_1.CellRange(0,e.selection.col,e.rows.length-1,e.selection.col))}t.keyCode===wijmo_1.Key.Escape&&e._hideContextMenu();(93===t.keyCode||t.shiftKey&&121===t.keyCode)&&(e._contextMenu.visible&&!wijmo_1.isFirefox()?e._isContextMenuKeyDown=!1:e._isContextMenuKeyDown=!0)}));this.addEventListener(document.body,"keydown",this._keydownHdl,!0);this.addEventListener(document.body,"click",this._clickHdl);this.addEventListener(document.body,"mousemove",this._mouseMoveHdl);this.draggedColumn.addHandler((function(t,o){e.sortManager._handleColumnMoving(o.data.col,o.col)}));if(t.match(/iPad/i)||t.match(/iPhone/i)){this.addEventListener(document.body,"touchstart",this._touchStartHdl);this.addEventListener(document.body,"touchend",this._touchEndHdl)}};FlexSheet.prototype._flexSheetSyncSelection=function(e){if(this.collectionView&&this.selectionMode!=wijmo_grid_1.SelectionMode.None){var t=this.selection,o=t.row>-1&&t.row<this.rows.length?this.rows[t.row]:null,i=o?o.dataItem:null;if(this.collectionView instanceof wijmo_1.CollectionView&&this.collectionView.isUpdating)return;(o instanceof HeaderRow||this.newRowAtTop&&o instanceof wijmo_grid_1._NewRowTemplate||i instanceof wijmo_1.CollectionViewGroup)&&(i=null);if((i!=this.collectionView.currentItem||e)&&(!this.editableCollectionView||!this.editableCollectionView.currentAddItem)){var n=this._getRowIndex(this.collectionView.currentPosition);if(n>-1&&n!=t.row){t.row=t.row2=n;this.select(t,!1);this.selectionMode&&!this._copyingTo&&this.scrollIntoView(t.row,-1)}}}};FlexSheet.prototype._initFuncsList=function(){var e=this;this._functionListHost=document.createElement("div");wijmo_1.addClass(this._functionListHost,exports.FlexSheetClsNames.flexSheetFormulaList);document.querySelector("body").appendChild(this._functionListHost);this._functionListHost.style.display="none";this._functionListHost.style.position="absolute";this._functionList=new mInput.ListBox(this._functionListHost);this._functionList.isContentHtml=!0;this._functionList.itemsSource=this._getFunctions();this._functionList.displayMemberPath="displayValue";this._functionList.selectedValuePath="actualvalue";this.addEventListener(this._functionListHost,"click",this.applyFunctionToCell.bind(this));this.addEventListener(this._functionListHost,"keydown",(function(t){if(t.keyCode===wijmo_1.Key.Escape){e.hideFunctionList();e.hostElement.focus();t.preventDefault()}if(t.keyCode===wijmo_1.Key.Enter){e.applyFunctionToCell();e.hostElement.focus();t.preventDefault();t.stopPropagation()}}))};FlexSheet.prototype._getFunctions=function(){for(var e,t=[],o=0;o<FlexSheetFunctions.length;o++){e=FlexSheetFunctions[o];t.push({displayValue:'<div class="'+exports.FlexSheetClsNames.flexSheetFormulaName+'">'+e.name+'</div><div class="'+exports.FlexSheetClsNames.flexSheetFormulaDescription+'">'+e.description+"</div>",actualvalue:e.name})}return t};FlexSheet.prototype._addCustomFunctionDescription=function(e,t){for(var o={displayValue:'<div class="'+exports.FlexSheetClsNames.flexSheetFormulaName+'">'+e+"</div>"+(t?'<div class="'+exports.FlexSheetClsNames.flexSheetFormulaDescription+'">'+t+"</div>":""),actualvalue:e},i=this._functionList.itemsSource,n=-1,l=0;l<i.length;l++)if(i[l].actualvalue===e){n=l;break}n>-1?i.splice(n,1,o):i.push(o)};FlexSheet.prototype._getCurrentFormulaIndex=function(e){var t=-1;["+","-","*","/","^","(","&"].forEach((function(o){var i=e.lastIndexOf(o);"/"===o&&(i>=2&&"#N"===e.substr(i-2,2)||i>=4&&"#DIV"===e.substr(i-4,4))||i>t&&(t=i)}));return t};FlexSheet.prototype._prepareCellForEditHandler=function(){var e=this,t=this._edtHdl._edt;if(t){this.addEventListener(t,"keydown",(function(t){if(e.isFunctionListOpen)switch(t.keyCode){case wijmo_1.Key.Up:e.selectPreviousFunction();t.preventDefault();t.stopPropagation();break;case wijmo_1.Key.Down:e.selectNextFunction();t.preventDefault();t.stopPropagation();break;case wijmo_1.Key.Tab:case wijmo_1.Key.Enter:e.applyFunctionToCell();t.preventDefault();t.stopPropagation();break;case wijmo_1.Key.Escape:e.hideFunctionList();t.preventDefault();t.stopPropagation()}}));this.addEventListener(t,"keyup",(function(o){(o.keyCode>40||o.keyCode<32)&&o.keyCode!==wijmo_1.Key.Tab&&o.keyCode!==wijmo_1.Key.Escape&&setTimeout((function(){e.showFunctionList(t)}),0)}))}};FlexSheet.prototype._addSheet=function(e,t,o,i,n){var l=new Sheet(this,n,e,t,o);l.name||l._setValidName(this.sheets.getUniqueNameOnInit());if("number"==typeof i){i<0&&(i=0);i>=this.sheets.length&&(i=this.sheets.length)}else i=this.sheets.length;this.sheets.insert(i,l);return l};FlexSheet.prototype._showSheet=function(e){if(!(!this.sheets||!this.sheets.length||e>=this.sheets.length||e<0||e===this.selectedSheetIndex||this.sheets[e]&&!this.sheets[e].visible)){this.beginUpdate();this.finishEditing();this._clearCalcEngine();this._isCopying=!0;if(this.selectedSheetIndex>-1&&this.selectedSheetIndex<this.sheets.length&&!this._sheets._exchangingPosition){this._copyingTo=!0;try{this._copyTo(this.sheets[this.selectedSheetIndex])}finally{this._copyingTo=!1}}if(this.sheets[e]){this._selectedSheetIndex=e;this._copyFrom(this.sheets[e])}this._isCopying=!1;this.endUpdate();this._filter.closeEditor()}};FlexSheet.prototype._selectedSheetChange=function(e,t){this.beginUpdate();this._showSheet(t.newValue);this._clearCalcCacheOnRefresh=!1;this.endUpdate();this.onSelectedSheetChanged(t)};FlexSheet.prototype._sourceChange=function(e,t){if(!this.sheets._exchangingPosition){this.beginUpdate();if(t.action===wijmo_1.NotifyCollectionChangedAction.Add||t.action===wijmo_1.NotifyCollectionChangedAction.Change){t.item._attachOwner(this);if(t.action===wijmo_1.NotifyCollectionChangedAction.Add){this._addingSheet=!0;t.index<=this.selectedSheetIndex&&(this._selectedSheetIndex+=1)}else t.index===this.selectedSheetIndex&&this._copyFrom(t.item);this.selectedSheetIndex=t.index}else if(t.action===wijmo_1.NotifyCollectionChangedAction.Reset){for(var o=0;o<this.sheets.length;o++)this.sheets[o]._attachOwner(this);if(this.sheets.length>0){0===this.selectedSheetIndex&&this._copyFrom(this.selectedSheet);this.selectedSheetIndex=0}else{this.rows.clear();this.columns.clear();this._selectedSheetIndex=-1}}else if(this.sheets.length>0){if(this.selectedSheetIndex===t.index){this._selectedSheetIndex=-1;this.sheets._setCurrentIdx(-1);this.selectedSheetIndex=t.index>this.sheets.length-1?this.sheets.length-1:t.index}else if(this.selectedSheetIndex>t.index){this._selectedSheetIndex--;this.sheets._setCurrentIdx(this._selectedSheetIndex)}}else{this.rows.clear();this.columns.clear();this._selectedSheetIndex=-1}this._updateDivContainerHeight(this.isTabHolderVisible);this.endUpdate()}};FlexSheet.prototype._sheetVisibleChange=function(e,t){t.item.visible||this._loadingFromWorkbook||t.index===this.selectedSheetIndex&&(this.selectedSheetIndex===this.sheets.length-1?this.selectedSheetIndex=t.index-1:this.selectedSheetIndex=t.index+1)};FlexSheet.prototype._applyStyleForCell=function(e,t,o,i){void 0===i&&(i=!1);var n=this.rows[e];if(!(null==n||n instanceof HeaderRow||!n.isVisible&&!i)){var l,r=this.selectedSheet._styledCells,s=e*this.columns.length+t,a=this.selectedSheet._getMergedRange(e,t);a&&(l=a.topRow*this.columns.length+a.leftCol);Object.keys(o).forEach((function(i){var n=o[i];("className"===i&&"normal"===n||("fontStyle"===i||"fontWeight"===i||"textDecoration"===i)&&"none"===n)&&(n="");if(a){var h={top:e===a.topRow,bottom:e===a.bottomRow,left:t===a.leftCol,right:t===a.rightCol},u="border"===i||i.startsWith("borderTop")&&h.top||i.startsWith("borderBottom")&&h.bottom||i.startsWith("borderLeft")&&h.left||i.startsWith("borderRight")&&h.right;applyStyleImp(r,u?s:l,i,n)}else applyStyleImp(r,s,i,n)}))}};FlexSheet.prototype._checkCellFormat=function(e,t,o){var i,n,l=e*this.columns.length+t;if(this.selectedSheet){if(i=this.selectedSheet._getMergedRange(e,t)){o.isMergedCell=!0;l=i.topRow*this.columns.length+i.leftCol}if(n=this.selectedSheet._styledCells[l]){o.isBold=o.isBold||"bold"===n.fontWeight;o.isItalic=o.isItalic||"italic"===n.fontStyle;o.isUnderline=o.isUnderline||n.textDecoration&&n.textDecoration.indexOf("underline")>=0;o.isStrikethrough=o.isStrikethrough||n.textDecoration&&n.textDecoration.indexOf("line-through")>=0;o.verticalAlign=n.verticalAlign||"top"}e===this.selection.row&&t===this.selection.col&&(n&&n.textAlign?o.textAlign=n.textAlign:t>-1&&(o.textAlign=this.columns[t].getAlignment()||o.textAlign))}};FlexSheet.prototype._resetMergedRange=function(e){var t,o,i,n,l=!1;for(t=e.topRow;t<=e.bottomRow;t++)for(o=e.leftCol;o<=e.rightCol;o++)if(n=this.selectedSheet._getMergedRange(t,o)){l=!0;i=this.selectedSheet._mergedRanges.indexOf(n);this.selectedSheet._mergedRanges.splice(i,1)}return l};FlexSheet.prototype._updateCellsForUpdatingRow=function(e,t,o,i){var n,l,r,s,a,h,u,d=e*this.columns.length;if(i)for(l=n=t*this.columns.length;l<d;l++){r=l-o*this.columns.length;if(s=this.selectedSheet._styledCells[l]){l>=(t+o)*this.columns.length&&(this.selectedSheet._styledCells[r]=s);delete this.selectedSheet._styledCells[l]}}else{n=t*this.columns.length-1;for(l=d-1;l>n;l--){r=l+this.columns.length*o;if(s=this.selectedSheet._styledCells[l]){this.selectedSheet._styledCells[r]=s;delete this.selectedSheet._styledCells[l]}}}if(this.selectedSheet._mergedRanges.length>0)for(h=this.selectedSheet._mergedRanges.length-1;h>=0;h--){a=this.selectedSheet._mergedRanges[h];if(i)if((u=t+o-1)<a.topRow){a.row-=o;a.row2-=o}else if(u>=a.topRow&&u<=a.bottomRow)if(t<=a.topRow&&u>=a.bottomRow)this.selectedSheet._mergedRanges.splice(h,1);else if(t<a.topRow)if(a.row<=a.row2){a.row+=t-a.topRow;a.row2-=o}else{a.row2+=t-a.topRow;a.row-=o}else t===a.topRow&&o===a.rowSpan?this.selectedSheet._mergedRanges.splice(h,1):a.row<=a.row2?a.row2-=o:a.row-=o;else t<=a.topRow?this.selectedSheet._mergedRanges.splice(h,1):t<=a.bottomRow&&(a.row<=a.row2?a.row2+=t-a.bottomRow-1:a.row+=t-a.bottomRow-1);else if(t<=a.topRow){a.row+=o;a.row2+=o}else t>a.topRow&&t<=a.bottomRow&&(a.row<=a.row2?a.row2+=o:a.row+=o)}};FlexSheet.prototype._updateCellsForUpdatingColumn=function(e,t,o,i){var n,l,r,s,a,h,u,d=this.rows.length*e;if(i)for(n=t;n<d;n++){l=n-o*(Math.floor(n/e)+((s=n%e)>=t?1:0));if(r=this.selectedSheet._styledCells[n]){(s<t||s>=t+o)&&(this.selectedSheet._styledCells[l]=r);delete this.selectedSheet._styledCells[n]}}else for(n=d-1;n>=t;n--){l=Math.floor(n/e)*o+n+((s=n%e)>=t?o:0);if(r=this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[l]=r;delete this.selectedSheet._styledCells[n]}}if(this.selectedSheet._mergedRanges.length>0)for(h=this.selectedSheet._mergedRanges.length-1;h>=0;h--){a=this.selectedSheet._mergedRanges[h];if(i)if((u=t+o-1)<a.leftCol){a.col-=o;a.col2-=o}else if(u>=a.leftCol&&u<=a.rightCol)if(t<=a.leftCol&&u>=a.rightCol)this.selectedSheet._mergedRanges.splice(h,1);else if(t<a.leftCol)if(a.col<=a.col2){a.col+=t-a.leftCol;a.col2-=o}else{a.col2+=t-a.leftCol;a.col-=o}else t===a.leftCol&&o===a.columnSpan?this.selectedSheet._mergedRanges.splice(h,1):a.col<=a.col2?a.col2-=o:a.col-=o;else t<=a.leftCol?this.selectedSheet._mergedRanges.splice(h,1):t<=a.rightCol&&(a.col<=a.col2?a.col2-=a.rightCol-t+1:a.col-=a.rightCol-t+1);else if(t<=a.leftCol){a.col+=o;a.col2+=o}else t>a.leftCol&&t<=a.rightCol&&(a.col<=a.col2?a.col2+=o:a.col+=o)}};FlexSheet.prototype._cloneObject=function(e){var t;if(null==e||!wijmo_1.isObject(e))return e;t={};for(var o in e)e.hasOwnProperty(o)&&null!=e[o]&&(e[o].clone?t[o]=e[o].clone():t[o]=this._cloneObject(e[o]));return t};FlexSheet.prototype._evaluate=function(e,t,o,i,n){if(e&&e.length>1&&this._enableFormulas){e="="===e[0]?e:"="+e;var l=this._calcEngine.evaluate(e,t,o,i,n);wijmo_1.isPrimitive(l)?wijmo_1.isNumber(l)&&(l=this._calcEngine.round(l)):l&&wijmo_1.isNumber(l.value)&&(l.value=this._calcEngine.round(l.value));return l}return e};FlexSheet.prototype._clearAndCheckItemsOwner=function(e){if(e&&e.length){var t=e[0]._list;e.clear();this._checkCollectionOwner(t)}};FlexSheet.prototype._checkCollectionOwner=function(e,t){void 0===t&&(t=!0);if(e&&e.length&&(!e[0]._list||!t&&e[0]._list!=e))for(var o=0,i=e.length;o<i;o++)e[o]._setList(e)};FlexSheet.prototype._checkCollectionsOwner=function(){this._checkCollectionOwner(this.columns,!1);this._checkCollectionOwner(this.rows,!1);this._checkCollectionOwner(this.columnFooters.columns,!1);this._checkCollectionOwner(this.columnFooters.rows,!1);this._checkCollectionOwner(this.columnHeaders.columns,!1);this._checkCollectionOwner(this.columnHeaders.rows,!1);this._checkCollectionOwner(this.rowHeaders.columns,!1);this._checkCollectionOwner(this.rowHeaders.rows,!1)};FlexSheet.prototype._copyTo=function(e){var t,o=e.grid.autoGenerateColumns;this.beginUpdate();e._storeRowSettings();this._selHdl.extendedSelection.clear();t=this.selection.clone();e.grid.select(new wijmo_grid_1.CellRange,!1);this._clearAndCheckItemsOwner(e.grid.rows);this._clearAndCheckItemsOwner(e.grid.columns);this._clearAndCheckItemsOwner(e.grid.columnHeaders.columns);this._clearAndCheckItemsOwner(e.grid.rowHeaders.rows);e._ownerHeaderRowRemoved=this._headerRowRemoved;if(this.itemsSource){e.grid.autoGenerateColumns=!1;e.itemsSource=this.itemsSource;this.collectionView.sortDescriptions.length>0&&(e._dataView=this.collectionView._view.slice());e.grid.collectionView.beginUpdate()}else{e.itemsSource=null;for(var i=0;i<this.rows.length;i++)e.grid.rows.push(this.rows[i])}e._sortList=this.sortManager._committedList.slice();e._getFilterSetting();for(var n=0;n<this.columns.length;n++)e.grid.columns.push(this.columns[n]);if(e.grid.collectionView){this._resetMappedColumns(e.grid);e.grid.collectionView.endUpdate(!0)}e.grid.autoGenerateColumns=o;e.grid.rows._frozenInternal=this.rows._frozenInternal;e.grid.columns._frozenInternal=this.columns._frozenInternal;e.grid.allowAddNew=this.allowAddNew;null!=this.newRowAtTop&&(e.grid.newRowAtTop=this.newRowAtTop);e.grid.select(t,!1);e._scrollPosition=this.scrollPosition;this._setFlexSheetToDirty();this.endUpdate()};FlexSheet.prototype._copyFrom=function(e,t){var o=this;void 0===t&&(t=!0);var i,n=this.autoGenerateColumns;this._isCopying=!0;this._dragable=!1;t&&this.beginUpdate();this.itemsSource=null;this._clearAndCheckItemsOwner(this.rows);this._clearAndCheckItemsOwner(this.columns);this._clearAndCheckItemsOwner(this.columnHeaders.columns);this._clearAndCheckItemsOwner(this.rowHeaders.rows);i=e.grid.selection.clone();this._selHdl.select(new wijmo_grid_1.CellRange,!1);e.selectionRanges.length>1&&(this.selectionMode===wijmo_grid_1.SelectionMode.CellRange||this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange)&&(this._enableMulSel=!0);this._headerRowRemoved=e._ownerHeaderRowRemoved;if(e.itemsSource){this.autoGenerateColumns=!1;this._ignoreBindGrid=wijmo_1.isArray(e.itemsSource)||e.itemsSource instanceof wijmo_1.CollectionView;this.itemsSource=e.itemsSource;this._ignoreBindGrid=!1;this.collectionView.beginUpdate()}else for(var l=0;l<e.grid.rows.length;l++)this.rows.push(e.grid.rows[l]);for(var r=0;r<e.grid.columns.length;r++){var s=e.grid.columns[r];s.isRequired=!1;this.columns.push(s)}this.sortManager.sortDescriptions.sourceCollection=e._sortList.slice();this.sortManager._committedList=e._sortList.slice();if(this.collectionView){if(e.grid.collectionView){this.collectionView.sortDescriptions.clear();e.grid.collectionView.sortDescriptions.forEach((function(e){o.collectionView.sortDescriptions.push(e)}))}this.collectionView.moveCurrentToPosition(this._getCvIndex(i.row));this._resetMappedColumns(this);this.collectionView.endUpdate(!0);if(e._dataView){this.collectionView._view=e._dataView;this.collectionView._pgView=this.collectionView._getPageView();if(!(this.itemsSource instanceof wijmo_1.CollectionView)){e.grid.collectionView._view=e._dataView;e.grid.collectionView._pgView=e.grid.collectionView._getPageView()}this._bindGrid(!1);e.grid._bindGrid(!1)}this.collectionView.collectionChanged.addHandler((function(e,t){t.action===wijmo_1.NotifyCollectionChangedAction.Reset&&setTimeout((function(){o.invalidate()}),10)}),this)}if(this.rows.length&&this.columns.length){this._selHdl.select(i,!1);if(this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange){this._selHdl.extendedSelection.beginUpdate();for(var a=0;a<e.selectionRanges.length;a++)this.selection.equals(e.selectionRanges[a])||this._selHdl.extendedSelection.push(e.selectionRanges[a]);this._selHdl.extendedSelection.endUpdate()}}e._applyFilterSetting();for(l=0;l<this.rows.length;l++){var h=e._rowSettings[l];if(h){var u=this.rows[l],d=u instanceof HeaderRow;u.height=h.height;u.allowMerging=h.allowMerging;u.visible=h.visible;u instanceof wijmo_grid_1.GroupRow&&(u.isCollapsed=!!h.isCollapsed);u.isSelected=!!h.isSelected;u.isReadOnly=d||!!h.readOnly}}this.autoGenerateColumns=n;this.rows._frozenInternal=e.grid.rows._frozenInternal;this.columns._frozenInternal=e.grid.columns._frozenInternal;this._isCopying=!1;if(t){this.cells.hostElement.style.overflow="hidden";this._setFlexSheetToDirty();this.endUpdate();if(this._addingSheet){clearTimeout(this._toRefresh);this._toRefresh=setTimeout((function(){o._setFlexSheetToDirty();o.invalidate()}),wijmo_1.Control._REFRESH_INTERVAL);this._addingSheet=!1}}this._updateScrollPos=!0};FlexSheet.prototype.onUpdatedLayout=function(t){if(this._updateScrollPos){this.cells.hostElement.style.overflow="";this._updateScrollPos=!1;var o=this.selectedSheet;if(o){this.scrollPosition=o._scrollPosition;this._ptScrl=o._scrollPosition}}e.prototype.onUpdatedLayout.call(this,t)};FlexSheet.prototype._resetMappedColumns=function(e){var t,o,i=0;e._mappedColumns=null;if(e.collectionView){o=e.collectionView.sortDescriptions;for(;i<o.length;i++)if((t=e.columns.getColumn(o[i].property))&&t.dataMap){e._mappedColumns||(e._mappedColumns={});e._mappedColumns[t.binding]=t.dataMap}}};FlexSheet.prototype._loadFromWorkbook=function(e){var t=this;if(null!=e.sheets&&0!==e.sheets.length){this._loadingFromWorkbook=!0;this.beginUpdate();this.clear();this._reservedContent=e.reservedContent;if(e.colorThemes&&e.colorThemes.length>0)for(var o=0;o<this._colorThemes.length;o++)this._colorThemes[o]=e.colorThemes[o];o=0;for(var i=e.sheets.length;o<i;o++){this.addUnboundSheet("",0,0);var n=this.selectedSheet,l=n.grid;l.wj_sheetInfo={};var r=l.wj_sheetInfo;wijmo_grid_xlsx_1.FlexGridXlsxConverter.load(l,e,{sheetIndex:o,includeColumnHeaders:!1});n.name=r.name;n.visible=r.visible;n._styledCells=r.styledCells;if(r.mergedRanges){for(var s=0;s<r.mergedRanges.length;s++)n._mergedRanges[s]=r.mergedRanges[s];r.mergedRanges=n._mergedRanges}this._copyFrom(n);if(r.tables&&r.tables.length>0)for(var a=0;a<r.tables.length;a++)this._parseFromWorkbookTable(r.tables[a],n)}null!=e.activeWorksheet&&e.activeWorksheet>-1&&e.activeWorksheet<this.sheets.length?this.selectedSheetIndex=e.activeWorksheet:this.selectedSheetIndex=0;e.definedNames&&e.definedNames.forEach((function(e){t.definedNames.push(new DefinedName(t,e.name,e.value,e.sheetName))}));this.endUpdate();this._loadingFromWorkbook=!1;this.onLoaded()}};FlexSheet.prototype._saveToWorkbook=function(e){var t=this;if(0===this.sheets.length)throw"The flexsheet is empty.";for(var o=!(!e||!e.includeFormulaValues),i=e&&e.convertHtmlEntities,n=this._saveSheetToWorkbook(0,o,i),l=1;l<this.sheets.length;l++){var r=this._saveSheetToWorkbook(l,o,i);n._addWorkSheet(r.sheets[0],l)}n.sheets.forEach((function(e){e.rightToLeft=t.rightToLeft}));n.activeWorksheet=this.selectedSheetIndex;n.reservedContent=this._reservedContent;for(l=0;l<this.definedNames.length;l++){var s=this.definedNames[l],a=new mXlsx.DefinedName;a.name=s.name;a.value=s.value;a.sheetName=s.sheetName;n.definedNames.push(a)}var h=this._colorThemes;if(h&&h.length>0)for(l=0;l<h.length;l++)n.colorThemes[l]=h[l];return n};FlexSheet.prototype._saveSheetToWorkbook=function(e,t,o){var i=this,n=this.sheets[e],l=n.grid.wj_sheetInfo;t&&(l.evaluateFormula=function(e){return i.evaluate(e,null,n)});if(this.selectedSheetIndex===e){n._storeRowSettings();this._copyRowsToSelectedSheet()}n._setRowSettings();if(n.tables.length>0){l.tables=[];for(var r=0;r<n.tables.length;r++)l.tables.push(this._parseToWorkbookTable(n.tables[r]))}n.grid.groupSummaryPosition=this.groupSummaryPosition;var s=wijmo_grid_xlsx_1.FlexGridXlsxConverter.save(n.grid,{sheetName:n.name,sheetVisible:n.visible,includeColumnHeaders:!1,convertHtmlEntities:o});this._checkTableHeaderRow(n.tables,s);l.evaluateFormula=null;return s};FlexSheet.prototype._mouseDown=function(e){var t,o,i=window.navigator.userAgent,n=this.hitTest(e);this.selectedSheet&&(this.selectedSheet._scrollPosition=this.scrollPosition);n.cellType!==wijmo_grid_1.CellType.None&&(this._isClicking=!0);if(this._dragable){this._isDragging=!0;this.createDropzone(e);this.onDraggingRowColumn(new DraggingRowColumnEventArgs(this.selection.clone(),this._draggingRow,e.shiftKey));e.preventDefault()}else if("crosshair"!==this.hostElement.style.cursor||null!=this._fillingMarker){if(this.selectionMode===wijmo_grid_1.SelectionMode.CellRange||this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange){if(e.ctrlKey){if(!this._enableMulSel){this._enableMulSel=!0;0===this.selectedSheet.selectionRanges.length&&this.selectedSheet.selectionRanges.push(this.selection)}}else if(n.cellType!==wijmo_grid_1.CellType.None){if(this.selectedSheet)if(n.cellType===wijmo_grid_1.CellType.TopLeft){this.selectedSheet.selectionRanges.clear();this.selectedSheet._addSelection(new wijmo_grid_1.CellRange(0,0,this.rows.length-1,this.columns.length-1))}else if(3===e.which&&this._isCellSelected(n.row,n.col));else{var l=n.edgeRight&&n.getColumn().allowResizing,r=n.edgeBottom&&n.getRow().allowResizing;l||r||this.selectedSheet.selectionRanges.clear()}this._enableMulSel&&this.refresh(!1);this._enableMulSel=!1}}else{this._enableMulSel=!1;this.selectedSheet&&this.selectedSheet.selectionRanges.clear()}this._htDown=n;if(0!==this.rows.length&&0!==this.columns.length){i.match(/iPad/i)||i.match(/iPhone/i)||this._hideContextMenu();if(3!==e.which&&(this.selectionMode===wijmo_grid_1.SelectionMode.CellRange||this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange)&&(n.cellType===wijmo_grid_1.CellType.ColumnHeader||n.cellType===wijmo_grid_1.CellType.None)&&!(n.col>-1&&this.columns[n.col].isSelected)&&wijmo_1.hasClass(e.target,wijmo_grid_1.FlexGridClsNames.cell)&&!n.edgeRight){this._columnHeaderClicked=!0;o=this.itemsSource&&this.rows[0]&&!this.rows[0].isVisible?1:0;e.target.focus();if(e.shiftKey)this._multiSelectColumns(n);else{t=new wijmo_grid_1.CellRange(o,n.col,this.rows.length-1,n.col);if(3===e.which&&this.selection.contains(t))return;this.select(t)}this._eCt.children[o]&&this._eCt.children[o].children[n.col]&&this._eCt.children[o].children[n.col].focus()}}}else{this.finishEditing();this._fillingData=!0;this._fillingPoint=new wijmo_1.Point(e.clientX-this.scrollPosition.x,e.clientY-this.scrollPosition.y);this._fillingSource=this.selection.clone();this._fillingMarker=document.createElement("div");wijmo_1.setCss(this._fillingMarker,{position:"absolute",display:"none",border:"2px dashed"});this._root.appendChild(this._fillingMarker);this._fillingTooltip=new wijmo_1.Tooltip;e.preventDefault()}};FlexSheet.prototype._mouseMove=function(e){var t,o=this.hitTest(e),i=this.selection.clone(),n=this.rows.length,l=this.columns.length,r=this.hostElement.style.cursor;if(0!==this.rows.length&&0!==this.columns.length)if(this._isDragging){this.hostElement.style.cursor="move";this.updateDropzone(e)}else if(!this._isClicking&&o.edgeBottom&&o.edgeRight&&o.row===i.bottomRow&&o.col===i.rightCol&&this.allowAutoFill)this.hostElement.style.cursor="crosshair";else if(this._fillingData){this.hostElement.style.cursor="crosshair";this._showFillMarker(e)}else{"crosshair"!=r||o.edgeBottom&&o.edgeRight||(this.hostElement.style.cursor="default");t=this.itemsSource?0===i.topRow||1===i.topRow:0===i.topRow;if(!this._isClicking&&i&&o.cellType!==wijmo_grid_1.CellType.None&&!this.itemsSource&&!this.isReadOnly&&this._enableDragDrop&&(!this._filter||!this._filter._isEditorOpened())){this._draggingColumn=t&&i.bottomRow===n-1;this._draggingRow=0===i.leftCol&&i.rightCol===l-1;if(o.cellType===wijmo_grid_1.CellType.Cell){this._draggingColumn&&((o.col===i.leftCol-1||o.col===i.rightCol)&&o.edgeRight||o.row===n-1&&o.edgeBottom)&&(r="move");this._draggingRow&&!this._containsGroupRows(i)&&((o.row===i.topRow-1||o.row===i.bottomRow)&&o.edgeBottom||o.col===l-1&&o.edgeRight)&&(r="move")}else o.cellType===wijmo_grid_1.CellType.ColumnHeader?o.edgeBottom&&(this._draggingColumn&&o.col>=i.leftCol&&o.col<=i.rightCol||this._draggingRow&&0===i.topRow)&&(r="move"):o.cellType===wijmo_grid_1.CellType.RowHeader&&o.edgeRight&&(this._draggingColumn&&0===i.leftCol||this._draggingRow&&o.row>=i.topRow&&o.row<=i.bottomRow&&!this._containsGroupRows(i))&&(r="move");this._dragable="move"===r;this.hostElement.style.cursor=r}if(this._htDown&&this._htDown.panel){o=new wijmo_grid_1.HitTestInfo(this._htDown.panel,e);this._multiSelectColumns(o);o.cellType===wijmo_grid_1.CellType.Cell&&this.scrollIntoView(o.row,o.col)}}else{this._dragable=!1;o.cellType===wijmo_grid_1.CellType.Cell&&(this.hostElement.style.cursor="default")}};FlexSheet.prototype._mouseUp=function(e){var t=this;try{if(this._isDragging){if(this._dropRange&&!this._draggingCells.equals(this._dropRange)){var o=new DroppingRowColumnEventArgs(this._dropRange.clone(),this._draggingRow),i=new wijmo_1.CancelEventArgs;this.onBeginDroppingRowColumn(o);i.cancel=o.cancel;o.cancel||this._handleDropping(e);this.onEndDroppingRowColumn(i)}}else if(this._fillingData){var n=AutoFillOperation.CopyContent,l=this._fillingRange,r=this._fillingSource;this._orgCellSettings=null;if(this._fillingRange&&this._fillingRange.isValid){wijmo_1.assert(this._canDoFillOperation(),"To do this, all the merged cells need be the same size.");r.leftCol===l.leftCol&&r.rightCol===l.rightCol?r.row!==r.row2&&(n=AutoFillOperation.FillSeries):r.col!==r.col2&&(n=AutoFillOperation.FillSeries);this._orgCellSettings=this._getCellSettingsForFill();var s=new _FillAction(this,this._fillingSource);this._undoStack._addAction(s);n=AutoFillOperation.CopyFormat|n;if(this._fillData(n))var a=this._root.appendChild(document.createElement("div")),h=new _SmartTag(a,this,n,{operationSelected:function(e){t._fillData(e.operation)},cancelled:function(){a.parentElement.removeChild(a);h.dispose();h=null;s.saveNewState();t.focus()}})}}}finally{this._draggingSingleRow=!1;if(this._isDragging){this._draggingCells=null;this._dropRange=null;this.destroyDropzone(e);this._isDragging=!1;this._draggingColumn=!1;this._draggingRow=!1}if(this._htDown&&this._htDown.cellType!==wijmo_grid_1.CellType.None&&this.selectedSheet){this.selection.isValid&&this.selectedSheet._addSelection(this.selection);this._enableMulSel=!1}if(this._fillingData){this._fillingData=!1;this._fillingPoint=null;this._fillingRange=null;this._root.removeChild(this._fillingMarker);this._fillingMarker=null;this._fillingTooltip.hide();this._fillingTooltip=null;this.hostElement.style.cursor="default"}this._isClicking=!1;this._columnHeaderClicked=!1;this._htDown=null}};FlexSheet.prototype._click=function(){var e=this,t=window.navigator.userAgent;t.match(/iPad/i)||t.match(/iPhone/i)||this._hideContextMenu();setTimeout((function(){e.hideFunctionList()}),200)};FlexSheet.prototype._touchStart=function(e){var t=this;wijmo_1.hasClass(e.target,exports._ContextMenuClsNames.contextMenuItem)||this._hideContextMenu();this._longClickTimer=setTimeout((function(){var o;if(t._isDescendant(t._divContainer,e.target)&&(o=t.hitTest(e))&&o.cellType!==wijmo_grid_1.CellType.None&&!t._resizing){if(o.cellType===wijmo_grid_1.CellType.TopLeft){t.selection=new wijmo_grid_1.CellRange(0,0,t.rows.length-1,t.columns.length-1);if(t.selectedSheet){t.selectedSheet.selectionRanges.clear();t.selectedSheet.selectionRanges.push(t.selection)}}t._contextMenu.show(null,new wijmo_1.Point(e.pageX+10,e.pageY+10))}}),500)};FlexSheet.prototype._touchEnd=function(){clearTimeout(this._longClickTimer)};FlexSheet.prototype._keydown=function(e){if(!e.defaultPrevented){if((this._isDescendant(this.hostElement,e.target)||this.hostElement===e.target)&&!this._edtHdl.activeEditor&&!(e.target instanceof HTMLInputElement)&&this.selectedSheet&&(e.keyCode===wijmo_1.Key.Delete||e.keyCode===wijmo_1.Key.Back)){this._delSeletionContent(e);e.preventDefault()}var t=this._contextMenu.visible?this._contextMenu:this._tabHolder.sheetControl._contextMenu.visible?this._tabHolder.sheetControl._contextMenu:null;if(t){e.keyCode===wijmo_1.Key.Down&&t.moveToNext();e.keyCode===wijmo_1.Key.Up&&t.moveToPrev();e.keyCode===wijmo_1.Key.Home&&t.moveToFirst();e.keyCode===wijmo_1.Key.End&&t.moveToLast();e.keyCode===wijmo_1.Key.Enter&&t.handleContextMenu();e.preventDefault()}}};FlexSheet.prototype.createDropzone=function(e){var t=new wijmo_1.Tooltip({gap:0}),o=document.createElement("div");o.style.position="absolute";o.style.display="block";o.style.borderStyle="dotted";o.style.cursor="move";o.style.zIndex="1";o.style.opacity="0.5";this.dropzoneMarker=o;this._draggingTooltip=t;this._draggingCells=this.selection;this._root.appendChild(o);this.selectedSheet&&this.selectedSheet.selectionRanges.clear()};FlexSheet.prototype.updateDropzoneArea=function(e){var t=this._draggingColumn,o=this._root,i=this.dropzoneMarker,n={col:0,row:0};t?n.col=e.hit<this.dropzonePrevHit?e.start:e.end:n.row=e.hit<this.dropzonePrevHit?e.start:e.end;this.scrollIntoView(n.row,n.col);var l,r=t?{start:this.cells.getCellBoundingRect(0,e.start),hit:this.cells.getCellBoundingRect(0,e.hit),end:this.cells.getCellBoundingRect(0,e.end)}:{start:this.cells.getCellBoundingRect(e.start,0),hit:this.cells.getCellBoundingRect(e.hit,0),end:this.cells.getCellBoundingRect(e.end,0)},s={};if(t){l=FlexSheet.convertNumberToAlpha(e.start)+" : "+FlexSheet.convertNumberToAlpha(e.end);s={top:this._eCHdr.offsetHeight,left:o.scrollLeft,height:this.cells.height};r.hit.top=r.hit.bottom+o.scrollTop+8;if(this.rightToLeft){s.left=r.end.left-this.controlRect.left+o.scrollLeft;s.width=r.start.right-r.end.left}else{s.left+=r.start.left-this.controlRect.left;s.width=r.end.right-r.start.left}}else{l=e.start+1+" : "+(e.end+1);s={top:r.start.top-this.controlRect.top+o.scrollTop,width:this.cells.width,height:r.end.bottom-r.start.top};r.hit.top=r.hit.bottom;this.rightToLeft?s.right=this._eRHdr.offsetWidth:s.left=this._eRHdr.offsetWidth}if(this._dropRange)if(t){this._dropRange.col=e.start;this._dropRange.col2=e.end}else{this._dropRange.row=e.start;this._dropRange.row2=e.end}else this._dropRange=t?new wijmo_grid_1.CellRange(0,e.start,this.rows.length-1,e.end):new wijmo_grid_1.CellRange(e.start,0,e.end,this.columns.length-1);wijmo_1.setCss(i,s);this._draggingTooltip.show(this.hostElement,l,r.hit);this.dropzonePrevHit=e.hit};FlexSheet.prototype.updateDropzone=function(e){var t=this,o=new wijmo_grid_1.HitTestInfo(this.cells,e),i=this.rightToLeft,n=this._draggingColumn,l=n?o.col:o.row,r=this.dropzonePrevHit,s=this.selection,a=n?this.columns.length:this.rows.length;if(-1!==l&&l!==r){this.dropzone||(this.dropzone=n?{left:l-s.leftCol,right:s.rightCol-l}:{left:l-s.topRow,right:s.bottomRow-l});var h={start:l-this.dropzone.left,hit:l,end:l+this.dropzone.right};if(!(h.start<0||h.end>a-1)){var u,d=n?i?{start:this.cells.getCellBoundingRect(0,h.end),end:this.cells.getCellBoundingRect(0,h.start)}:{start:this.cells.getCellBoundingRect(0,h.start),end:this.cells.getCellBoundingRect(0,h.end)}:{start:this.cells.getCellBoundingRect(h.start,0),end:this.cells.getCellBoundingRect(h.end,0)},_={top:this.controlRect.top+this._eCHdr.offsetHeight,right:this.controlRect.right,bottom:this.controlRect.bottom,left:this.controlRect.left};if(n){i?_.right-=this._eRHdr.offsetWidth:_.left+=this._eRHdr.offsetWidth;(_.left>=d.start.right||_.right<=d.end.left)&&(u=!0)}else(_.top>=d.start.bottom||_.bottom<=d.end.top)&&(u=!0);clearTimeout(this.dropzoneTimeout);u?this.dropzoneTimeout=setTimeout((function(){t.updateDropzoneArea(h);t.updateDropzone(e)}),100):this.updateDropzoneArea(h)}}};FlexSheet.prototype.destroyDropzone=function(e){if(this.dropzoneMarker){this._root.removeChild(this.dropzoneMarker);this.dropzoneMarker=null}if(this.dropzoneTimeout){clearTimeout(this.dropzoneTimeout);this.dropzoneTimeout=null}if(this._draggingTooltip){this._draggingTooltip.hide();this._draggingTooltip=null}this.dropzone=null;this.dropzonePrevHit=-1};FlexSheet.prototype._showFillMarker=function(e){var t=new wijmo_grid_1.HitTestInfo(this.cells,e);if(t.row>-1&&t.col>-1){var o=e.clientX-this.scrollPosition.x-this._fillingPoint.x,i=e.clientY-this.scrollPosition.y-this._fillingPoint.y,n=void 0,l=void 0,r=void 0,s=void 0;if(Math.abs(o)>=Math.abs(i)){n=this._fillingSource.topRow;r=this._fillingSource.bottomRow;l=o>=0?this._fillingSource.leftCol:t.col;s=o>=0?t.col:this._fillingSource.rightCol}else{n=i>=0?this._fillingSource.topRow:t.row;r=i>=0?t.row:this._fillingSource.bottomRow;l=this._fillingSource.leftCol;s=this._fillingSource.rightCol}this._fillingRange=new wijmo_grid_1.CellRange(n,l,r,s);this._updateFillingMarquee();this.scrollIntoView(t.row,t.col);this._showFillTooltip()}};FlexSheet.prototype._updateMarquee=function(){e.prototype._updateMarquee.call(this);this._updateFillingMarquee()};FlexSheet.prototype._updateFillingMarquee=function(){var e=this._fillingMarker,t=this._fillingRange;if(e&&t){var o=this.cells.getCellBoundingRect(t.row,t.col,!0),i=this.cells.getCellBoundingRect(t.row2,t.col2,!0);if(this.rows._frozenInternal){var n=Math.min(this.rows.length,this.rows._frozenInternal),l=this.cells.getCellBoundingRect(n-1,0,!0);t.topRow>=n&&o.top<l.bottom&&(o.top=l.bottom);t.bottomRow>=n&&i.bottom<l.bottom&&(i.height=l.bottom-i.top)}if(this.columns._frozenInternal){var r=Math.min(this.columns.length,this.columns._frozenInternal);l=this.cells.getCellBoundingRect(0,r-1,!0);if(this.rightToLeft){t.leftCol>=r&&o.right>l.left&&(o.left=l.left-o.width);t.rightCol>=r&&i.left>l.left&&(i.left=l.left)}else{t.leftCol>=r&&o.left<l.right&&(o.left=l.right);t.rightCol>=r&&i.right<l.right&&(i.width=l.right-i.left)}}var s=this.cells.hostElement;wijmo_1.setCss(e,{left:o.left+s.offsetLeft,top:o.top+s.offsetTop,width:i.right-o.left,height:i.bottom-o.top,display:"",zIndex:this.rows._frozenInternal||this.columns._frozenInternal?"3":""})}};FlexSheet.prototype._showFillTooltip=function(){var e,t,o,i,n,l,r,s,a,h,u,d,_=this._fillingSource,c=this._fillingRange;this._fillingTooltip.hide();if(!c.equals(_)&&!_.contains(c)){if(t=_.leftCol===c.leftCol&&_.rightCol===c.rightCol){if(c.bottomRow>_.bottomRow){(e=this.cells.getCellBoundingRect(c.bottomRow,c.rightCol)).top=e.bottom+10;o=c.bottomRow-_.topRow}else{(e=this.cells.getCellBoundingRect(c.topRow,c.rightCol)).top+=10;o=c.topRow-_.topRow}e.left=e.right;(i=o%_.rowSpan)<0&&(i+=_.rowSpan);_.row===_.row2&&(n=!0);a=this.selectedSheet.getCellStyle(_.topRow+i,_.leftCol);h=this.getMergedRange(this.cells,_.topRow+i,_.leftCol);u=this.columns[_.leftCol];d=a&&a.format?a.format:u.format;if(n)s=_isFormula(s=this.getCellData(h?h.topRow:_.topRow+i,_.leftCol,!1))?"":wijmo_1.Globalize.format(s,d);else{l=this.getCellData(_.topRow+i,_.leftCol,!1);if(wijmo_1.isNumber(l)||wijmo_1.isDate(l))if(r=this._getFillSeries(t,0,i)){s=this._getFillData(i,o,_,t,r,!0);s=wijmo_1.Globalize.format(s,d)}else s="";else _isFormula(s=l)&&(s="")}}else{if(c.rightCol>_.rightCol){e=this.cells.getCellBoundingRect(c.bottomRow,c.rightCol);o=c.rightCol-_.leftCol}else{e=this.cells.getCellBoundingRect(c.bottomRow,c.leftCol);o=c.leftCol-_.leftCol}e.top=e.bottom+10;(i=o%_.columnSpan)<0&&(i+=_.columnSpan);_.col===_.col2&&(n=!0);a=this.selectedSheet.getCellStyle(_.topRow,_.leftCol+i);h=this.getMergedRange(this.cells,_.topRow,_.leftCol+i);u=this.columns[_.leftCol+i];d=a&&a.format?a.format:u.format;if(n)s=_isFormula(s=this.getCellData(_.topRow,h?h.leftCol:_.leftCol+i,!1))?"":wijmo_1.Globalize.format(s,d);else{l=this.getCellData(_.topRow,_.leftCol+i,!1);if(wijmo_1.isNumber(l)||wijmo_1.isDate(l))if(r=this._getFillSeries(t,0,i)){s=this._getFillData(i,o,_,t,r,!0);s=wijmo_1.Globalize.format(s,d)}else s="";else _isFormula(s=l)&&(s="")}}e.top+=this.cells.hostElement.offsetTop;this._fillingTooltip.show(this.hostElement,s,e)}};FlexSheet.prototype._selections=function(){var e=[];if(!this.selectedSheet)return e;if(this.selectionMode==wijmo_grid_1.SelectionMode.ListBox)for(var t=0,o=this.rows.length,i=this.columns.length-1;t<o;t++)this.rows[t].isSelected&&e.push(new wijmo_grid_1.CellRange(t,0,t,i));else e=this.selectedSheet.selectionRanges.slice();return e.length?e:[this.selection]};FlexSheet.prototype._isCellSelected=function(e,t){return this._selections().some((function(o){return o.contains(e,t)}))};FlexSheet.prototype._isColumnSelected=function(e){var t=this;return this._selections().some((function(o){return o.containsColumn(e)&&0===o.topRow&&o.bottomRow===t.rows.length-1}))};FlexSheet.prototype._isRowSelected=function(e){var t=this;return this._selections().some((function(o){return o.containsRow(e)&&0===o.leftCol&&o.rightCol===t.columns.length-1}))};FlexSheet.prototype._handleDropping=function(e){var t,o,i,n,l,r,s;if(this.selectedSheet&&this._draggingCells&&this._dropRange&&!this._containsMergedCells(this._draggingCells)&&!this._containsMergedCells(this._dropRange)){this._clearCalcEngine();if(this._draggingColumn&&this._draggingCells.leftCol>this._dropRange.leftCol||this._draggingRow&&this._draggingCells.topRow>this._dropRange.topRow)if(e.shiftKey){if(!this._allowExchangeCells(this._draggingRow,!0)){console.warn("Can not complete operation: You are attempting to change a position of table row or column in a way that is not allowed.");return}if(this._draggingColumn){n=this._dropRange.leftCol;for(o=this._draggingCells.leftCol;o<=this._draggingCells.rightCol;o++){this.columns.moveElement(o,n);n++}this._exchangeTableColumns(!0)}else if(this._draggingRow){i=this._dropRange.topRow;for(t=this._draggingCells.topRow;t<=this._draggingCells.bottomRow;t++){this.rows.moveElement(t,i);i++}}this._exchangeCellStyle(!0)}else{this.undoStack.stackSize>0&&(l=new _MoveCellsAction(this,this._draggingCells,this._dropRange,e.ctrlKey));i=this._dropRange.topRow;for(t=this._draggingCells.topRow;t<=this._draggingCells.bottomRow;t++){n=this._dropRange.leftCol;for(o=this._draggingCells.leftCol;o<=this._draggingCells.rightCol;o++){this._moveCellContent(t,o,i,n,e.ctrlKey);if(this._draggingColumn&&i===this._dropRange.topRow){this.columns[n].dataType=this.columns[o].dataType?this.columns[o].dataType:wijmo_1.DataType.Object;this.columns[n].align=this.columns[o].align;this.columns[n].format=this.columns[o].format;if(!e.ctrlKey){this.columns[o].dataType=wijmo_1.DataType.Object;this.columns[o].align=null;this.columns[o].format=null}}n++}i++}if(this._draggingColumn&&!e.ctrlKey){n=this._dropRange.leftCol;for(o=this._draggingCells.leftCol;o<=this._draggingCells.rightCol;o++){this._updateColumnFiler(o,n);n++}}}else if(this._draggingColumn&&this._draggingCells.leftCol<this._dropRange.leftCol||this._draggingRow&&this._draggingCells.topRow<this._dropRange.topRow)if(e.shiftKey){if(!this._allowExchangeCells(this._draggingRow,!1)){console.warn("Can not complete operation: You are attempting to change a position of table row or column in a way that is not allowed.");return}if(this._draggingColumn){n=this._dropRange.rightCol;for(o=this._draggingCells.rightCol;o>=this._draggingCells.leftCol;o--){this.columns.moveElement(o,n);n--}this._exchangeTableColumns(!1)}else if(this._draggingRow){i=this._dropRange.bottomRow;for(t=this._draggingCells.bottomRow;t>=this._draggingCells.topRow;t--){this.rows.moveElement(t,i);i--}}this._exchangeCellStyle(!1)}else{this.undoStack.stackSize>0&&(l=new _MoveCellsAction(this,this._draggingCells,this._dropRange,e.ctrlKey));i=this._dropRange.bottomRow;for(t=this._draggingCells.bottomRow;t>=this._draggingCells.topRow;t--){n=this._dropRange.rightCol;for(o=this._draggingCells.rightCol;o>=this._draggingCells.leftCol;o--){this._moveCellContent(t,o,i,n,e.ctrlKey);if(this._draggingColumn&&i===this._dropRange.bottomRow){this.columns[n].dataType=this.columns[o].dataType?this.columns[o].dataType:wijmo_1.DataType.Object;this.columns[n].align=this.columns[o].align;this.columns[n].format=this.columns[o].format;if(!e.ctrlKey){this.columns[o].dataType=wijmo_1.DataType.Object;this.columns[o].align=null;this.columns[o].format=null}}n--}i--}if(this._draggingColumn&&!e.ctrlKey){n=this._dropRange.rightCol;for(o=this._draggingCells.rightCol;o>=this._draggingCells.leftCol;o--){this._updateColumnFiler(o,n);n--}}}if(!e.ctrlKey){r=this._updateFormulaForDropping(e.shiftKey);s=this._updateNamedRangesForDropping(e.shiftKey)}if(l&&l.saveNewState()){l._affectedFormulas=r;l._affectedDefinedNameVals=s;this._undoStack._addAction(l)}if(this._undoStack._pendingAction){this._undoStack._pendingAction._affectedFormulas=r;this._undoStack._pendingAction._affectedDefinedNameVals=s}this.select(this._dropRange);this.selectedSheet._addSelection(this.selection);this.hostElement.focus()}};FlexSheet.prototype._moveCellContent=function(e,t,o,i,n){var l,r=this.getCellData(e,t,!1),s=e*this.columns.length+t,a=o*this.columns.length+i,h=this.selectedSheet._styledCells[s],u=!0,d=this.selectedSheet.findTable(o,i);if(d&&d._isHeaderRow(o)){var _=d.getRange(),c=d.getColumns(),g=i-_.leftCol;l=c[g].name;null==r||""===r?u=!1:c[g].name=""+r}if(u){if(n&&_isFormula(r)&&a-s!=0)try{var f=this._calcEngine.parse(r);f._moveCellRangeExp(this.selectedSheetIndex,new wijmo_grid_1.CellRange(e,t),new wijmo_grid_1.CellRange(o,i),!1,!0)&&(r="="+f._getStringExpression())}catch(e){}this.setCellData(o,i,r)}else u=!0;h?this.selectedSheet._styledCells[a]=this._cloneObject(h):delete this.selectedSheet._styledCells[a];if(n){if(p=this.selectedSheet.findTable(e,t)){m=p._getTableRange();if(p===d&&e===o&&p._isHeaderRow(e)){w=t-m.leftCol;p._updateColumnName(w,r)}}}else{delete this.selectedSheet._styledCells[s];var p;if(p=this.selectedSheet.findTable(e,t)){var m=p._getTableRange();if(p===d&&e===o&&p._isHeaderRow(e)){var w=t-m.leftCol;p._updateColumnName(w,l);return}if(p.showHeaderRow&&e===m.topRow)return}this.setCellData(e,t,null)}};FlexSheet.prototype._allowExchangeCells=function(e,t){for(var o=this.selectedSheet.tables,i=0;i<o.length;i++){var n=o[i],l=void 0,r=void 0,s=void 0;if(e){l=n.getRange(TableSection.Data);r=new wijmo_grid_1.CellRange(this._draggingCells.topRow,l.leftCol,this._draggingCells.bottomRow,l.rightCol);s=new wijmo_grid_1.CellRange(this._dropRange.topRow,l.leftCol,this._dropRange.bottomRow,l.rightCol)}else{l=n.getRange();r=new wijmo_grid_1.CellRange(l.topRow,this._draggingCells.leftCol,l.bottomRow,this._draggingCells.rightCol);s=new wijmo_grid_1.CellRange(l.topRow,this._dropRange.leftCol,l.bottomRow,this._dropRange.rightCol)}if(l.intersects(r)&&!l.contains(r)||l.intersects(s)&&!l.contains(s)||l.contains(r)&&!l.contains(s)||!l.contains(r)&&l.contains(s))return!1}return!0};FlexSheet.prototype._exchangeTableColumns=function(e){for(var t=this.selectedSheet.tables,o=0;o<t.length;o++){var i=t[o],n=i.getRange();if(n.leftCol<=this._draggingCells.leftCol&&n.rightCol>=this._draggingCells.rightCol)for(var l=(e?this._draggingCells.leftCol:this._draggingCells.rightCol)-n.leftCol,r=(e?this._dropRange.leftCol:this._dropRange.rightCol)-n.leftCol,s=0;s<this._draggingCells.columnSpan;s++){i._moveColumns(l,r);if(e){l++;r++}else{l--;r--}}}};FlexSheet.prototype._exchangeCellStyle=function(e){for(var t=[],o=this._draggingCells.topRow;o<=this._draggingCells.bottomRow;o++)for(var i=this._draggingCells.leftCol;i<=this._draggingCells.rightCol;i++){var n=o*this.columns.length+i;if(this.selectedSheet._styledCells[n]){t.push(this._cloneObject(this.selectedSheet._styledCells[n]));delete this.selectedSheet._styledCells[n]}else t.push(void 0)}if(e){if(this._draggingColumn){var l=this._draggingCells.rightCol-this._draggingCells.leftCol+1;for(i=this._draggingCells.leftCol-1;i>=this._dropRange.leftCol;i--)for(o=0;o<this.rows.length;o++){n=o*this.columns.length+i;var r=o*this.columns.length+i+l;if(this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[r]=this._cloneObject(this.selectedSheet._styledCells[n]);delete this.selectedSheet._styledCells[n]}else delete this.selectedSheet._styledCells[r]}}else if(this._draggingRow)for(l=this._draggingCells.bottomRow-this._draggingCells.topRow+1,o=this._draggingCells.topRow-1;o>=this._dropRange.topRow;o--)for(i=0;i<this.columns.length;i++){n=o*this.columns.length+i,r=(o+l)*this.columns.length+i;if(this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[r]=this._cloneObject(this.selectedSheet._styledCells[n]);delete this.selectedSheet._styledCells[n]}else delete this.selectedSheet._styledCells[r]}}else if(this._draggingColumn)for(l=this._draggingCells.rightCol-this._draggingCells.leftCol+1,i=this._draggingCells.rightCol+1;i<=this._dropRange.rightCol;i++)for(o=0;o<this.rows.length;o++){n=o*this.columns.length+i,r=o*this.columns.length+i-l;if(this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[r]=this._cloneObject(this.selectedSheet._styledCells[n]);delete this.selectedSheet._styledCells[n]}else delete this.selectedSheet._styledCells[r]}else if(this._draggingRow)for(l=this._draggingCells.bottomRow-this._draggingCells.topRow+1,o=this._draggingCells.bottomRow+1;o<=this._dropRange.bottomRow;o++)for(i=0;i<this.columns.length;i++){n=o*this.columns.length+i,r=(o-l)*this.columns.length+i;if(this.selectedSheet._styledCells[n]){this.selectedSheet._styledCells[r]=this._cloneObject(this.selectedSheet._styledCells[n]);delete this.selectedSheet._styledCells[n]}else delete this.selectedSheet._styledCells[r]}o=this._dropRange.topRow;for(var s=0;o<=this._dropRange.bottomRow;o++)for(i=this._dropRange.leftCol;i<=this._dropRange.rightCol;i++){n=o*this.columns.length+i;t[s]?this.selectedSheet._styledCells[n]=t[s]:delete this.selectedSheet._styledCells[n];s++}};FlexSheet.prototype._containsMergedCells=function(e,t){if(!(t=t||this.selectedSheet))return!1;for(var o=0;o<t._mergedRanges.length;o++){var i=t._mergedRanges[o];if(e.intersects(i))return!0}return!1};FlexSheet.prototype._multiSelectColumns=function(e){if(e&&this._columnHeaderClicked){var t=e.col;t<0&&this.selection.col2>-1&&(t=this.selection.col);var o=new wijmo_grid_1.CellRange(e.row,t);o.row=this.itemsSource&&this.rows[0]&&!this.rows[0].isVisible?1:0;o.row2=this.rows.length-1;o.col2=this.selection.col2;this.select(o)}};FlexSheet.prototype._cumulativeOffset=function(e){var t=0,o=0;do{t+=e.offsetTop||0;o+=e.offsetLeft||0;e=e.offsetParent}while(e);return new wijmo_1.Point(o,t)};FlexSheet.prototype._cumulativeScrollOffset=function(e){var t=0,o=0;do{t+=e.scrollTop||0;o+=e.scrollLeft||0;e=e.offsetParent}while(e&&!(e instanceof HTMLBodyElement));t+=document.body.scrollTop||document.documentElement.scrollTop;o+=document.body.scrollLeft||document.documentElement.scrollLeft;return new wijmo_1.Point(o,t)};FlexSheet.prototype._checkHitWithinSelection=function(e){if(null!=e&&e.cellType===wijmo_grid_1.CellType.Cell){var t=this.getMergedRange(this.cells,e.row,e.col);if(t&&t.contains(this.selection))return!0;if(this.selection.row===e.row&&this.selection.col===e.col)return!0}return!1};FlexSheet.prototype._clearForEmptySheet=function(e){if(this.selectedSheet&&0===this[e].length&&!0!==this._isCopying&&!0!==this._isUndoing&&!0!==this._isSorting){this.selectedSheet._mergedRanges.length=0;this.selectedSheet._styledCells=null;this._isDeletingRows||this.select(new wijmo_grid_1.CellRange)}};FlexSheet.prototype._containsGroupRows=function(e){for(var t=e.topRow;t<=e.bottomRow;t++){if(this.rows[t]instanceof wijmo_grid_1.GroupRow)return!0}return!1};FlexSheet.prototype._delSeletionContent=function(e){if(!this.isReadOnly)if(this.allowDelete&&this.selection.isValid&&0===this.selection.leftCol&&this.selection.rightCol===this.columns.length-1)this.deleteRows(this._selections());else{var t,o=this.editableCollectionView,i=!1,n=!1,l=this.scrollPosition;this.beginUpdate();var r=new _EditAction(this);this.undoStack.stackSize>0&&(r=new _EditAction(this));for(var s=this._selections(),a=0;a<s.length;a++){t=s[a];var h=new wijmo_grid_1.CellRange,u=new wijmo_grid_1.CellEditEndingEventArgs(this.cells,h,e),d=this.selectedSheet.tables.length;if(d>0)for(var _=d-1;_>=0;_--){var c=this.selectedSheet.tables[_];if(t.contains(c.getRange())){r&&r._storeDeletedTables(c);this.selectedSheet.tables.remove(c)}}this._imeHdl&&this._imeHdl._suspendIME();for(var g=t.topRow;g<=t.bottomRow;g++){var f=this.rows[g];if(f&&!f.isReadOnly&&(f.visible||this.selectedSheet._freezeHiddenRows&&this.selectedSheet._freezeHiddenRows[g]))for(var p=t.leftCol;p<=t.rightCol;p++){var m=this._getBindingColumn(this.cells,g,this.columns[p]);if(m&&!m.isReadOnly&&(!1===m.isRequired||null==m.isRequired&&m.dataType==wijmo_1.DataType.String)&&(m.visible||this.selectedSheet._freezeHiddenCols&&this.selectedSheet._freezeHiddenCols[p])){var w=this.getCellData(g,p,!1);if(null!=w){h.setRange(g,p);u.cancel=!1;u.previousData=w;if(this.onBeginningEdit(u)){if(o){if(!i){i=!0;o.beginUpdate()}o.editItem(f.dataItem);this._edtHdl._edItem=o.currentEditItem}this.setCellData(g,p,void 0,!1);n=!0;this.onCellEditEnding(u);this.onCellEditEnded(u)}}}}}this._imeHdl&&this._imeHdl._resumeIME();if(i){o.endUpdate(!0);o._pendingRefresh=!1;t.rowSpan>1&&o.commitEdit()}}if(n&&r){r.saveNewState();this._undoStack._addAction(r)}this.selection=t;this.scrollPosition=l;this.endUpdate()}};FlexSheet.prototype._updateAffectedFormula=function(e,t,o,i,n){var l=[],r=[],s=this.selection.clone();this.selectedSheet._storeRowSettings();this.beginUpdate();for(var a=0;a<this.sheets.length;a++)for(var h=this.sheets[a],u=h.grid,d=u.rows.length,_=u.columns.length,c=0;c<d;c++){var g=u._getRowData(c);if(!(null==g||g.length<_))for(var f=0;f<_;f++){var p=g[f];if(_isFormula(p)){var m=this._updateCellRef(p,a,e,t,o,i,n);if(m){l.push({sheet:h,point:new wijmo_1.Point(c,f),formula:p});var w=c,C=f;if(a===this.selectedSheetIndex){i?c>=e&&(o?w+=t:w-=t):f>=e&&(o?C+=t:C-=t);if(!o&&(i&&c<=e&&c>=e-t+1||!i&&f<=e&&f>=e-t+1))continue}u.setCellData(c,f,m,!1);r.push({sheet:h,point:new wijmo_1.Point(w,C),formula:m})}}}}this.select(s,!1);this.endUpdate();return{oldFormulas:l,newFormulas:r}};FlexSheet.prototype._updateAffectedNamedRanges=function(e,t,o,i){for(var n=this,l=[],r=[],s=[],a=0;a<this.definedNames.length;a++){var h=this.definedNames[a],u=h.value;if(u&&wijmo_1.isString(u)){var d=this._updateCellRef(u,this.selectedSheetIndex,e,t,o,i);if("object"==typeof d&&null!==d)s.push(d.name);else if(d){l.push({name:h.name,value:u});h.value=d;r.push({name:h.name,value:d})}}}s.forEach((function(e){n.definedNames.remove(n.definedNames.find((function(t){return t.name==e})))}));return{oldDefinedNameVals:l,newDefinedNameVals:r}};FlexSheet.prototype._updateFormulaBoundaryForEditingCell=function(e,t){var o=[],i=[];this.beginUpdate();for(var n=e;n<this.rows.length;n++){if(_isFormula(r=this.getCellData(n,t,!1))){if(s=this._updateCellBoundary(r,e,t)){o.push({point:new wijmo_1.Point(n,t),formula:r});this.setCellData(n,t,s,!1);i.push({point:new wijmo_1.Point(n,t),formula:s})}}}for(var l=t;l<this.columns.length;l++){var r;if(_isFormula(r=this.getCellData(e,l,!1))){var s;if(s=this._updateCellBoundary(r,e,t)){o.push({point:new wijmo_1.Point(e,l),formula:r});this.setCellData(e,l,s,!1);i.push({point:new wijmo_1.Point(e,l),formula:s})}}}this.endUpdate();return{oldFormulas:o,newFormulas:i}};FlexSheet.prototype._updateColumnFiler=function(e,t){for(var o=JSON.parse(this._filter.filterDefinition),i=0;i<o.filters.length;i++){var n=o.filters[i];if(n.columnIndex===e){n.columnIndex=t;break}}this._filter.filterDefinition=JSON.stringify(o)};FlexSheet.prototype._isDescendant=function(e,t){for(var o=t.parentNode;null!=o;){if(o===e)return!0;o=o.parentNode}return!1};FlexSheet.prototype._clearCalcEngine=function(){this._calcEngine.clearExpressionCache()};FlexSheet.prototype._getRangeString=function(e,t,o){void 0===o&&(o=!0);var i,n,l,r,s,a,h="",u=!0,d=t&&t!==this.selectedSheet?t.grid:this;if(wijmo_1.isArray(e))if(e.length>1){if(this._isMultipleRowsSelected(e,t)){h="";for(n=0;n<e.length;n++){h&&(h+="\n");h+=this._getRangeString(e[n],t)}return h}if(!this._isMultipleColumnsSelected(e,t))return"";h="";for(i=0,u=!0;i<d.rows.length;i++){u||(h+="\n");u=!1;for(n=0,l=!0;n<e.length;n++){(r=e[n].clone()).row=r.row2=i;l||(h+="\t");l=!1;h+=this._getRangeString(e[n],t)}return h}}else{a=e[0];switch(this.selectionMode){case wijmo_grid_1.SelectionMode.Row:case wijmo_grid_1.SelectionMode.RowRange:a.col=0;a.col2=t.grid.columns.length-1;break;case wijmo_grid_1.SelectionMode.ListBox:a.col=0;a.col2=t.grid.columns.length-1;for(var _=0;_<t.grid.rows.length;_++)if(t.grid.rows[_].isSelected&&t.grid.rows[_].isVisible){a.row=a.row2=_;h&&(h+="\n");h+=this._getRangeString(a,t)}return h}}for(var c=(a=wijmo_1.asType(wijmo_1.isArray(e)?e[0]:e,wijmo_grid_1.CellRange)).topRow;c<=a.bottomRow;c++)if(d.rows[c]&&d.rows[c].isVisible){u||(h+="\n");u=!1;for(var g=a.leftCol,f=!0;g<=a.rightCol;g++)if(d.columns[g]&&d.columns[g].isVisible){f||(h+="\t");f=!1;var p=this._getCellStyle(c,g,t),m=p?p.format:"",w=d.columns[g];if(o){_isFormula(s=d.getCellData(c,g,!1))&&(s=this._evaluate(s,null,t,c,g));s=this._formatEvaluatedResult(s,w,m)}else{s=d.getCellData(c,g,!1);wijmo_1.isDate(s)&&(s=wijmo_1.Globalize.format(s,m||w.format));w.dataMap&&(s=w.dataMap.getDisplayValue(s))}(s=(s=null==s?"":s.toString()).replace(/\t/g," ")).indexOf("\n")>-1&&(s='"'+s.replace(/"/g,'""')+'"');h+=s}}return h};FlexSheet.prototype._getSelectionForListBoxMode=function(e){for(var t,o=0;o<e.rows.length;o++)e.rows[o].isSelected&&(t?t.row2=o:t=new wijmo_grid_1.CellRange(o,0,o,e.columns.length-1));return t};FlexSheet.prototype._containsRandFormula=function(e,t){for(var o=0;o<e.length;o++)for(var i=e[o],n=i.topRow;n<=i.bottomRow&&n<t.grid.rows.length;n++)for(var l=i.leftCol;l<=i.rightCol&&l<t.grid.columns.length;l++){var r=t.grid.getCellData(n,l,!1);if(_isFormula(r)&&-1!==r.search(/rand/i))return!0}return!1};FlexSheet.prototype._isMultipleRowsSelected=function(e,t){var o,i,n;e&&e.length>1?n=e:this.selectedSheet.selectionRanges.length>1&&(n=this.selectedSheet.selectionRanges);o=n[0];for(var l=1;l<n.length;l++)if((i=n[l]).leftCol!==o.leftCol||i.rightCol!==o.rightCol)return!1;return!0};FlexSheet.prototype._isMultipleColumnsSelected=function(e,t){var o,i,n;e&&e.length>1?n=e:this.selectedSheet.selectionRanges.length>1&&(n=this.selectedSheet.selectionRanges);o=n[0];for(var l=0;l<n.length;l++)if((i=n[l]).topRow!==o.topRow||i.bottomRow!==o.bottomRow)return!1;return!0};FlexSheet.prototype._postSetClipStringProcess=function(e,t,o,i,n,l,r,s,a){var h,u,d=new wijmo_grid_1.CellRangeEventArgs(this.cells,new wijmo_grid_1.CellRange(o+n,i),t);if(this.onPastingCell(d)){if(l>=0&&r>=0&&this._copiedSheet&&(h=this._copiedSheet._getMergedRange(l,r))&&h.topRow===l&&h.leftCol===r){var _=o+h.rowSpan-1;_=_<this.rows.length?_:this.rows.length-1;var c=i+h.columnSpan-1;c=c<this.columns.length?c:this.columns.length-1;for(var g=new wijmo_grid_1.CellRange(o,i,_,c),f=g.topRow;f<=g.bottomRow;f++)for(var p=g.leftCol;p<=g.rightCol;p++){var m=this.getMergedRange(this.cells,f,p);if(null!=m&&!m.equals(g)){console.error("We can't paste the merged cell to another merged cell.");return!1}}this.mergeRange(new wijmo_grid_1.CellRange(o,i,_,c),!0)}s&&s.editItem(e);if(u=this.cells.setCellData(o,i,a&&a.format?new _ValWithFormat(d.data,a.format):d.data)){if(wijmo_1.isString(d.data)&&"\n"!==d.data){var w=d.data.match(/\n/g);w&&w.length>0&&(a?a.whiteSpace="pre":a={whiteSpace:"pre"})}var C=o*this.columns.length+i;this.selectedSheet._styledCells[C]=a?this._cloneObject(a):void 0;this.onPastedCell(d)}}return u};FlexSheet.prototype._delCutData=function(e,t){for(var o,i=this._copiedSheet===this.selectedSheet?this:this._copiedSheet.grid,n=this.selection,l=(o=this.selectionMode===wijmo_grid_1.SelectionMode.ListBox?this._getSelectionForListBoxMode(i):this._copiedRanges[0]).topRow;l<=o.bottomRow;l++)if(null!=i.rows[l]&&!i.rows[l].isReadOnly)for(var r=o.leftCol;r<=o.rightCol;r++)if(this._copiedSheet!==this.selectedSheet||l<n.topRow||l>n.topRow+e-1||r<n.leftCol||r>n.leftCol+t-1||i.rows[n.topRow]instanceof wijmo_grid_1._NewRowTemplate){var s=i._getBindingColumn(i.cells,l,i.columns[r]);s.isReadOnly||0!=s.isRequired&&(null!=s.isRequired||s.dataType!=wijmo_1.DataType.String)||i.getCellData(l,r,!0)&&(s.dataMap||i.rows[l].dataMap?i.setCellData(l,r,null,!0):i.setCellData(l,r,"",!0))}};FlexSheet.prototype._containsMultiLineText=function(e){for(var t=0;t<e.length;t++)for(var o=e[t],i=0;i<o.length;i++)if(o[i].indexOf("\n")>0)return!0;return!1};FlexSheet.prototype._sortByRow=function(e,t){return e.topRow>t.topRow?1:e.topRow<t.topRow?-1:0};FlexSheet.prototype._sortByColumn=function(e,t){return e.leftCol>t.leftCol?1:e.leftCol<t.leftCol?-1:0};FlexSheet.prototype._setFlexSheetToDirty=function(){if(this.columns&&this.rows&&this.rowHeaders&&this.columnHeaders){this.columns._dirty=!0;this.rows._dirty=!0;this.rowHeaders.columns._dirty=!0;this.rowHeaders.rows._dirty=!0;this.columnHeaders.columns._dirty=!0;this.columnHeaders.rows._dirty=!0}};FlexSheet.convertNumberToAlpha=function(e){var t,o,i="";if(e>=0)do{t=Math.floor(e/26);o=e%26;i=String.fromCharCode(o+65)+i;e=t-1}while(t);return i};FlexSheet.prototype._updateFormulaForReorderingRows=function(e,t,o){void 0===o&&(o=!1);var i,n,l=o?e-t:t-e;this.beginUpdate();for(var r=0;r<this.columns.length;r++)if(_isFormula(i=this.getCellData(t,r,!1))&&0!==l){try{n=this._calcEngine.parse(i)}catch(e){continue}n._updateCellRangeExpForReorderingRows(l)&&this.setCellData(t,r,"="+n._getStringExpression())}this.endUpdate()};FlexSheet.prototype._updateFormulaForDropping=function(e){var t,o,i,n,l,r,s,a,h,u=[],d=[];this.beginUpdate();for(i=0;i<this.sheets.length;i++){o=(t=this.sheets[i]).grid;for(n=0;n<o.rows.length;n++)for(r=0;r<o.columns.length;r++)if(_isFormula(a=o.getCellData(n,r,!1))&&(h=this._updateCellRefForDropping(a,i,e))){o.setCellData(n,r,h,!1);if(e&&i===this.selectedSheetIndex){l=o.rows[n];s=o.columns[r];u.push({sheet:t,row:l,column:s,formula:a});d.push({sheet:t,row:l,column:s,formula:h})}else{u.push({sheet:t,point:new wijmo_1.Point(n,r),formula:a});d.push({sheet:t,point:new wijmo_1.Point(n,r),formula:h})}}}this.endUpdate();return{oldFormulas:u,newFormulas:d}};FlexSheet.prototype._updateNamedRangesForDropping=function(e){var t,o,i,n,l=[],r=[];for(t=0;t<this.definedNames.length;t++)if((i=(o=this.definedNames[t]).value)&&wijmo_1.isString(i)&&(n=this._updateCellRefForDropping(i,this.selectedSheetIndex,e))){l.push({name:o.name,value:i});o.value=n;r.push({name:o.name,value:n})}return{oldDefinedNameVals:l,newDefinedNameVals:r}};FlexSheet.prototype._updateCellRefForDropping=function(e,t,o){void 0===o&&(o=!1);var i;try{i=this._calcEngine.parse(e)}catch(e){return null}return i._moveCellRangeExp(t,this._draggingCells,this._dropRange,o)?"="+i._getStringExpression():null};FlexSheet.prototype._updateCellStyleForReorderingRows=function(e,t,o){var i,n,l=this.columns.length;for(i=0;i<l;i++)(n=this._getCellStyle(e,i))&&(o[t*l+i]=n)};FlexSheet.prototype._scanFormulas=function(){for(var e=[],t=0;t<this.rows.length;t++)for(var o=0;o<this.columns.length;o++){var i=this.getCellData(t,o,!1);_isFormula(i)&&e.push({row:t,column:o,formula:i})}return e};FlexSheet.prototype._resetFormulas=function(e){var t=this;e&&this.deferUpdate((function(){for(var o=0;o<e.length;o++){var i=e[o];t.setCellData(i.row,i.column,i.formula)}}))};FlexSheet.prototype._getCellStyle=function(e,t,o){var i=o||this.selectedSheet;return i?i.getCellStyle(e,t):null};FlexSheet.prototype._getSheet=function(e){if(null==e)return null;e=e.toLowerCase();for(var t=0;t<this.sheets.length;t++){var o=this.sheets[t];if(o.name.toLowerCase()===e)return o}return null};FlexSheet.prototype._validateSheetName=function(e){return!!this._getSheet(e)};FlexSheet.prototype._sheetNameChanged=function(e,t){if(!this._loadingFromWorkbook){this.definedNames._updateSheetName(e,t);this._updateFormulasWithNameUpdating(e,t)}};FlexSheet.prototype._updateFormulasTableColumn=function(e,t,o,i){if(o!==i){this.beginUpdate();for(var n=new RegExp(e.name+"\\["+o+"\\]","g"),l=e.name+"["+i+"]",r=new RegExp("\\["+o+"\\]","g"),s="["+o+"]",a="["+i+"]",h=0;h<this.sheets.length;h++)for(var u=this.sheets[h],d=u.grid,_=0;_<d.rows.length;_++)for(var c=0;c<d.columns.length;c++){var g=d.getCellData(_,c,!1);if(_isFormula(g)&&g.indexOf("[")>=0){if((g=g.replace(n,l)).indexOf(s)>=0){var f=u.findTable(_,c);f&&f.name===e.name&&(g=g.replace(r,a))}d.setCellData(_,c,g,!1)}}e._updateColumnName(t-e._getTableRange().leftCol,i,!1);this.endUpdate()}};FlexSheet.prototype._updateFormulasWithNameUpdating=function(e,t,o){void 0===o&&(o=!1);if(this.sheets.length){var i=o?/\[/:/\w/,n=this.selection.clone();this.selectedSheet._storeRowSettings();this.beginUpdate();for(var l=0;l<this.sheets.length;l++)for(var r=this.sheets[l].grid,s=0;s<r.rows.length;s++)for(var _loop_1=function(n){var l=r.getCellData(s,n,!1);if(_isFormula(l)){for(var a=!1,h=l.indexOf(e),u=new RegExp(e,"g");h>-1;){var d="",_="";h>0&&(d=l[h-1]);h+e.length<l.length&&(_=l[h+e.length]);if(!/\w/.test(d)&&(o&&i.test(_)||!o&&!i.test(_))){l=l.replace(u,(function(o,i){return i===h?t:e}));a=!0}h=l.indexOf(e,h+e.length)}a&&r.setCellData(s,n,l,!1)}},a=0;a<r.columns.length;a++)_loop_1(a);this.selection=n;this.endUpdate()}};FlexSheet.prototype._updateTablesForUpdatingRow=function(e,t,o){var i,n,l,r,s;if(this.selectedSheet.tables.length>0)for(i=this.selectedSheet.tables.length-1;i>=0;i--){l=(n=this.selectedSheet.tables[i]).getRange();if(o){if((r=e+t-1)<l.topRow)n._updateTableRange(-t,-t,0,0);else if(r>=l.topRow&&r<=l.bottomRow)if(e<=l.topRow&&r===l.bottomRow){null==s&&(s=[]);s.push(n);this.selectedSheet.tables.remove(n)}else if(e<l.topRow){n.showHeaderRow&&(n._showHeaderRow=!1);n._updateTableRange(e-l.topRow,-t,0,0)}else{e===l.topRow&&n.showHeaderRow&&(n._showHeaderRow=!1);r===l.bottomRow&&n.showTotalRow&&(n._showTotalRow=!1);n._updateTableRange(0,-t,0,0)}else if(e<=l.topRow){null==s&&(s=[]);s.push(n);this.selectedSheet.tables.remove(n)}else if(e<=l.bottomRow){n.showTotalRow&&(n._showTotalRow=!1);n._updateTableRange(0,e-l.bottomRow-1,0,0)}}else e<=l.topRow?n._updateTableRange(t,t,0,0):e>l.topRow&&e<=l.bottomRow&&n._updateTableRange(0,t,0,0)}return s};FlexSheet.prototype._updateTablesForUpdatingColumn=function(e,t,o){var i,n,l,r,s,a,h,u;if(this.selectedSheet.tables.length>0)for(i=this.selectedSheet.tables.length-1;i>=0;i--){l=(n=this.selectedSheet.tables[i]).getRange();if(o){if((r=e+t-1)<l.leftCol)n._updateTableRange(0,0,-t,-t);else if(r>=l.leftCol&&r<=l.rightCol){if(e<=l.leftCol&&r===l.rightCol){null==u&&(u=[]);u.push(n);this.selectedSheet.tables.remove(n);continue}if(e<l.leftCol){s=t-l.leftCol+e;a=l.leftCol;n._updateTableRange(0,0,e-l.leftCol,-t)}else{s=t;a=e;n._updateTableRange(0,0,0,-s)}n._columns.splice(a-l.leftCol,s)}else if(e<=l.leftCol){null==u&&(u=[]);u.push(n);this.selectedSheet.tables.remove(n)}else if(e<=l.rightCol){s=l.rightCol-e+1;n._updateTableRange(0,0,0,-s);n._columns.splice(e,s)}}else if(e<=l.leftCol)n._updateTableRange(0,0,t,t);else if(e>l.leftCol&&e<=l.rightCol){n._updateTableRange(0,0,0,t);a=e-l.leftCol;for(h=0;h<t;h++)n._addColumn(a+h)}}return u};FlexSheet.prototype._updateDivContainerHeight=function(e){var t=this._divContainer.parentElement.clientHeight;e&&(t-=this._tabHolder.getSheetBlanketSize());t=t<0?0:t;this._divContainer.style.height=t+"px"};FlexSheet.prototype._isDisableDeleteRow=function(e,t){var o,i,n;if(this.selectedSheet.tables.length>0)for(o=0;o<this.selectedSheet.tables.length;o++){n=(i=this.selectedSheet.tables[o]).getRange();if(i.showHeaderRow&&n.topRow>=e&&n.topRow<=t)return!0}return!1};FlexSheet.prototype._copy=function(t,o){var i,n;if("columns"==t){e.prototype._copy.call(this,t,o);if(this.itemsSource&&(i=this.rows[0])instanceof HeaderRow){i._ubv=null;i._ubv={};for(var l=0;l<this.columns.length;l++){n=this.columns[l];i._ubv[n._hash]=FlexSheet._getHeaderRowText(n)}}return!0}return!1};FlexSheet.prototype._getTableSheetIndex=function(e,t){for(var o=0;o<e.length;o++)if(e[o].indexOf(t)>-1)return o;return-1};FlexSheet.prototype._sheetSortConverter=function(t,o,i,n){_isFormula(i=e.prototype._sortConverter.call(this,t,o,i,n))&&(i=this.evaluate(i));return i};FlexSheet.prototype._formatEvaluatedResult=function(e,t,o){if(wijmo_1.isPrimitive(e)){t.dataMap&&(e=t.dataMap.getDisplayValue(e));var i=o||t.format;if(!wijmo_1.isInt(e)||i||t.dataMap){wijmo_1.isDate(e)&&_isExclusiveNumericFormat(i)?e=FlexSheet._toOADate(e):i&&"@"!==i&&wijmo_1.isString(e)&&(+e).toString()===e&&(e=+e);e=null!=e?wijmo_1.Globalize.format(e,i):""}else e=e.toString()}else if(e){if(e instanceof FormulaError)return e.error;i=o||e.format||t.format;if(wijmo_1.isArray(e))return wijmo_1.Globalize.format(e,i);if(!wijmo_1.isInt(e.value)||i||t.dataMap){wijmo_1.isDate(e.value)&&_isExclusiveNumericFormat(i)?e.value=FlexSheet._toOADate(e.value):wijmo_1.isString(e.value)&&(+e.value).toString()===e.value&&(e.value=+e.value);e=null!=e.value?wijmo_1.Globalize.format(e.value,i):""}else e=e.value.toString()}return e};FlexSheet.prototype._updateCellRef=function(e,t,o,i,n,l,r){var s;try{s=this._calcEngine.parse(e)}catch(e){return null}var a=s;if(!n&&this._isDeletingColumns&&this.definedNames&&this.definedNames.length&&a._cells){var h=this.selection,u=(h._col,h._col2,a._cells),d=u._col,_=u._col2,c=[o,o-i+1],g=c[0],f=c[1],p=[Math.max(d,_),Math.min(d,_)];if(p[1]>=f&&p[0]<=g){var m=this.definedNames.find((function(t){return t.value==e}));if(m){var w=this.sheets[this.selectedSheetIndex].name,C=m.sheetName;if(C&&C===w||null==C&&m.value.includes(w))return{name:m.name}}}}return s._updateCellRangeExp(t,o,i,n,l,r)?"="+s._getStringExpression():null};FlexSheet.prototype._updateCellBoundary=function(e,t,o){var i;try{i=this._calcEngine.parse(e)}catch(e){return null}return i instanceof _FunctionExpression&&i._updateCellBoundary(t,o)?"="+i._getStringExpression():null};FlexSheet.prototype._fillData=function(e){void 0===e&&(e=AutoFillOperation.CopyFormat|AutoFillOperation.FillSeries);var t=this._fillingRange||this.selection,o=this._fillingSource,i=0!=(e&AutoFillOperation.CopyFormat),n=0!=(e&AutoFillOperation.CopyContent),l=0!=(e&AutoFillOperation.FillSeries),r=o.leftCol===t.leftCol&&o.rightCol===t.rightCol,s=[],a=new AutoFillingEventArgs(t,e);this.onAutoFilling(a);if(a.cancel)return!1;this.beginUpdate();this._resetCellsForFillRange(e);for(var h=0;h<t.rowSpan;h++){var u=t.topRow+h,d=u-o.topRow,_=d%o.rowSpan;if(this.rows[u].visible){_<0&&(_+=o.rowSpan);for(var c=0;c<t.columnSpan;c++){var g=t.leftCol+c,f=g-o.leftCol;if(!(d>=0&&d<o.rowSpan&&f>=0&&f<o.columnSpan)){var p=f%o.columnSpan;p<0&&(p+=o.columnSpan);var m=!1,w=this.getMergedRange(this.cells,o.topRow+_,o.leftCol+p);if(w&&(m=w.topRow===o.topRow+_&&w.leftCol===o.leftCol+p)){this.getMergedRange(this.cells,u,g)||this.mergeRange(new wijmo_grid_1.CellRange(u,g,u+w.rowSpan-1,g+w.columnSpan-1))}if(i){var C=this.selectedSheet.getCellStyle(o.topRow+_,o.leftCol+p),S=C?this._cloneObject(C):null,b=u*this.columns.length+g;this.selectedSheet._styledCells[b]=S}if((!w||m)&&!this.isReadOnly&&!this.rows[u].isReadOnly&&!this.columns[g].isReadOnly){var v=void 0;if(n)_isFormula(v=this.getCellData(o.topRow+_,o.leftCol+p,!1))?this._fillFormula(v,o.topRow+_,o.leftCol+p,u,g):this.setCellData(u,g,v);else if(l){var y=void 0,x=void 0;if(r){y=c;x=_}else{y=h;x=p}if(null==(v=this.getCellData(o.topRow+_,o.leftCol+p,!1))||wijmo_1.isString(v)){_isFormula(v)?this._fillFormula(v,o.topRow+_,o.leftCol+p,u,g):this.setCellData(u,g,v);s[y]=null}else{s[y]||(s[y]=this._getFillSeries(r,y,x));var R=s[y];if(R){if(r){v=this._getFillData(_,d,o,r,R,null!=e||0===y);R.endIndex===o.topRow+_&&(s[y]=null)}else{v=this._getFillData(p,f,o,r,R,null!=e||0===y);R.endIndex===o.leftCol+p&&(s[y]=null)}this.setCellData(u,g,v)}}}}}}}}this._fillingRange&&this.select(this._fillingRange,!1);this.endUpdate();this.onAutoFilled(a);return!0};FlexSheet.prototype._getFillData=function(e,t,o,i,n,l){var r,s,a=n.items;if(1===a.length&&!l)return a[0];r=i?Math.floor(t/o.rowSpan)*n.itemIndexes[n.itemIndexes.length-1]+o.topRow+e-n.startIndex+1:Math.floor(t/o.columnSpan)*n.itemIndexes[n.itemIndexes.length-1]+o.leftCol+e-n.startIndex+1;s=this._getLinearBestFitTrendData(a,n.itemIndexes,r);"date"===n.type&&(s=FlexSheet._fromOADate(s));return s};FlexSheet.prototype._fillFormula=function(e,t,o,i,n){var l,r,s;try{l=this._calcEngine.parse(e);r=new wijmo_grid_1.CellRange(t,o);s=new wijmo_grid_1.CellRange(i,n);l._moveCellRangeExp(this.selectedSheetIndex,r,s,!1,!0)&&(e="="+l._getStringExpression())}catch(e){}finally{this.setCellData(i,n,e)}};FlexSheet.prototype._getFillSeries=function(e,t,o){var i,n,l,r,s,a,h,u,d=this._fillingSource,_=[],c=[];if(e){o=d.topRow+o;r=0;for(s=d.topRow;s<=d.bottomRow;s++){if(a=this.getMergedRange(this.cells,s,d.leftCol+t))if(h&&!a.equals(h)){r+=h.rowSpan;h=a;if(a.leftCol!==d.leftCol+t)continue}else{if(a.topRow!==s||a.leftCol!==d.leftCol+t)continue;r+=1;h=a}else if(h){r+=h.rowSpan;h=null}else r+=1;if(null!=(u=this.getCellData(s,d.leftCol+t,!1))&&""!==u)if(wijmo_1.isNumber(u)||wijmo_1.isDate(u)){i=wijmo_1.isNumber(u)?"number":"date";wijmo_1.isDate(u)&&(u=FlexSheet._toOADate(u));if(0===_.length){l=s;n=i;_.push(u);c.push(r)}else if(i===n){_.push(u);c.push(r)}else{if(o>=l&&o<=s)return{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c};_.splice(0,_.length);c.splice(0,c.length)}}else if(_.length>0){if(o>=l&&o<=s)return{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c};_.splice(0,_.length);c.splice(0,c.length)}}}else{o=d.leftCol+o;r=0;for(s=d.leftCol;s<=d.rightCol;s++){if(a=this.getMergedRange(this.cells,d.topRow+t,s))if(h&&!a.equals(h)){r+=h.columnSpan;h=a;if(a.topRow!==d.topRow+t)continue}else{if(a.leftCol!==s||a.topRow!==d.topRow+t)continue;r+=1;h=a}else if(h){r+=h.columnSpan;h=null}else r+=1;if(null!=(u=this.getCellData(d.topRow+t,s,!1))&&""!==u)if(wijmo_1.isNumber(u)||wijmo_1.isDate(u)){i=wijmo_1.isNumber(u)?"number":"date";wijmo_1.isDate(u)&&(u=FlexSheet._toOADate(u));if(0===_.length){l=s;n=i;_.push(u);c.push(r)}else if(i===n){_.push(u);c.push(r)}else{if(o>=l&&o<=s)return{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c};_.splice(0,_.length);c.splice(0,c.length)}}else if(_.length>0){if(o>=l&&o<=s)return{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c};_.splice(0,_.length);c.splice(0,c.length)}}}return _.length>0?{type:n,startIndex:l,endIndex:s-1,items:_,itemIndexes:c}:null};FlexSheet.prototype._getLinearBestFitTrendData=function(e,t,o){var i,n,l,r,s=0,a=0,h=0,u=0;if(1===(r=e.length))return e[0]+o-1;for(i=0;i<t.length;i++){s+=n=t[i];h+=n*n;a+=l=e[i];u+=n*l}return o*((r*u-s*a)/(r*h-s*s))+(a*h-s*u)/(r*h-s*s)};FlexSheet.prototype._getCellSettingsForFill=function(e,t){var o,i,n,l,r,s;e||(e=this._fillingSource);t||(t=this._fillingRange);r=[];for(o=t.topRow;o<=t.bottomRow;o++)for(i=t.leftCol;i<=t.rightCol;i++)if(!(o>=e.topRow&&o<=e.bottomRow&&i>=e.leftCol&&i<=e.rightCol)){n=this.getCellData(o,i,!1);l=this._cloneObject(this.selectedSheet.getCellStyle(o,i));(s=this.getMergedRange(this.cells,o,i))&&s.topRow===o&&s.leftCol===i||(s=null);r.push({row:o,col:i,value:n,style:l,mergedCell:s?s.clone():null})}return r};FlexSheet.prototype._resetCellsForFillRange=function(e){var t=0!=(e&AutoFillOperation.CopyFormat),o=0!=(e&AutoFillOperation.CopyContent),i=0!=(e&AutoFillOperation.FillSeries);if(this._orgCellSettings&&this._orgCellSettings.length>0)for(var n=0;n<this._orgCellSettings.length;n++){var l=this._orgCellSettings[n],r=l.row,s=l.col;if(!t){var a=r*this.columns.length+s;this.selectedSheet._styledCells[a]=l.style}o||i||this.setCellData(r,s,l.value)}};FlexSheet.prototype._canDoFillOperation=function(){var e,t,o,i,n,l,r,s,a,h,u,d,_,c,g,f=this._fillingSource,p=this._fillingRange,m=!1;for(e=f.topRow;e<=f.bottomRow;e++)for(t=f.leftCol;t<=f.rightCol;t++){h=this.getMergedRange(this.cells,e,t);if(u){if(!h||!u.equals(h)){m=!0;break}}else u=h}for(o=p.topRow;o<=p.bottomRow;o++){(i=(n=o-f.topRow)%f.rowSpan)<0&&(i+=f.rowSpan);i+=f.topRow;for(l=p.leftCol;l<=p.rightCol;l++){s=l-f.leftCol;if(!(n>=0&&n<f.rowSpan&&s>=0&&s<f.columnSpan)){(r=s%f.columnSpan)<0&&(r+=f.columnSpan);r+=f.leftCol;h=this.getMergedRange(this.cells,i,r);if(a=this.getMergedRange(this.cells,o,l)){if(m||!h)return!1;d=a?o-a.topRow:NaN;_=a?l-a.leftCol:NaN;c=h?i-h.topRow:NaN;g=h?r-h.leftCol:NaN;if(d!==c||_!==g)return!1}}}}return!0};FlexSheet.prototype._updateItemIndexForInsertingRow=function(e,t,o){for(var i=0;i<e.length;i++){var n=e[i];n&&null!=n._itemIdx&&n._itemIdx>=t&&(n._itemIdx+=o)}};FlexSheet.prototype._updateItemIndexForRemovingRow=function(e,t){for(var o=0;o<e.length;o++){var i=e[o];i&&null!=i._itemIdx&&i._itemIdx>=t&&(i._itemIdx-=1)}};FlexSheet.prototype._copyRowsToSelectedSheet=function(){var e=this;if(this.selectedSheet){this.selectedSheet.grid.rows.clear();for(var t=0;t<this.rows.length;t++){var o=this.rows[t];this.selectedSheet.grid.rows.push(o);o._list=this.rows}setTimeout((function(){e._setFlexSheetToDirty();e.invalidate()}),10)}};FlexSheet.prototype._copyColumnsToSelectedSheet=function(){var e=this;if(this.selectedSheet){this.selectedSheet.grid.columns.clear();for(var t=0;t<this.columns.length;t++){var o=this.columns[t];this.selectedSheet.grid.columns.push(o);o._setList(this.columns)}setTimeout((function(){e._setFlexSheetToDirty();e.invalidate()}),10)}};FlexSheet.prototype._getUniqueColumnName=function(){for(var e=this.insertedColumnIndex+1;null!=this.columns.getColumn("col"+e);)e++;this.insertedColumnIndex=e;return"col"+this.insertedColumnIndex};FlexSheet.prototype._hideContextMenu=function(){this._contextMenu.hide();this._tabHolder.sheetControl._contextMenu.hide()};FlexSheet.prototype._parseFromWorkbookTable=function(e,t){var o,i,n,l,r,s,a,h,u,d,_,c,g=t===this.selectedSheet?this:t.grid;n=(i=e.range.split(":"))[0];l=i[1];r=mXlsx.Workbook.tableAddress(n);o=new wijmo_grid_1.CellRange(r.row,r.col);s=mXlsx.Workbook.tableAddress(l);o.row2=s.row;o.col2=s.col;if(o.bottomRow>=t.rowCount){_=o.bottomRow-t.rowCount+1;for(c=0;c<_;c++)g.rows.push(new wijmo_grid_1.Row)}if(o.rightCol>=t.columnCount){_=o.rightCol-t.columnCount+1;for(c=0;c<_;c++)g.columns.push(new wijmo_grid_1.Column)}if(e.columns&&e.columns.length>0){a=[];for(var f=0;f<e.columns.length;f++){h=e.columns[f];a[f]=new TableColumn(h.name,h.totalRowLabel,h.totalRowFunction,h.showFilterButton)}}null!=e.style&&(u=this._isBuiltInStyleName(e.style.name)?this.getBuiltInTableStyle(e.style.name):this._parseFromWorkbookTableStyle(e.style));d=new Table(e.name,o,u,a,{showHeaderRow:e.showHeaderRow,showTotalRow:e.showTotalRow,showBandedColumns:e.showBandedColumns,showBandedRows:e.showBandedRows,alterFirstColumn:e.alterFirstColumn,alterLastColumn:e.alterLastColumn});t.tables.push(d);return d};FlexSheet.prototype._parseFromWorkbookTableStyle=function(e){var t=new TableStyle(e.name);null!=e.firstBandedColumnStyle&&(t.firstBandedColumnStyle=this._parseFromWorkbookTableStyleElement(e.firstBandedColumnStyle));null!=e.firstBandedRowStyle&&(t.firstBandedRowStyle=this._parseFromWorkbookTableStyleElement(e.firstBandedRowStyle));null!=e.firstColumnStyle&&(t.firstColumnStyle=this._parseFromWorkbookTableStyleElement(e.firstColumnStyle));null!=e.firstHeaderCellStyle&&(t.firstHeaderCellStyle=this._parseFromWorkbookTableStyleElement(e.firstHeaderCellStyle));null!=e.firstTotalCellStyle&&(t.firstTotalCellStyle=this._parseFromWorkbookTableStyleElement(e.firstTotalCellStyle));null!=e.headerRowStyle&&(t.headerRowStyle=this._parseFromWorkbookTableStyleElement(e.headerRowStyle));null!=e.lastColumnStyle&&(t.lastColumnStyle=this._parseFromWorkbookTableStyleElement(e.lastColumnStyle));null!=e.lastHeaderCellStyle&&(t.lastHeaderCellStyle=this._parseFromWorkbookTableStyleElement(e.lastHeaderCellStyle));null!=e.lastTotalCellStyle&&(t.lastTotalCellStyle=this._parseFromWorkbookTableStyleElement(e.lastTotalCellStyle));null!=e.secondBandedColumnStyle&&(t.secondBandedColumnStyle=this._parseFromWorkbookTableStyleElement(e.secondBandedColumnStyle));null!=e.secondBandedRowStyle&&(t.secondBandedRowStyle=this._parseFromWorkbookTableStyleElement(e.secondBandedRowStyle));null!=e.totalRowStyle&&(t.totalRowStyle=this._parseFromWorkbookTableStyleElement(e.totalRowStyle));null!=e.wholeTableStyle&&(t.wholeTableStyle=this._parseFromWorkbookTableStyleElement(e.wholeTableStyle));return t};FlexSheet.prototype._parseFromWorkbookTableStyleElement=function(e){var t;t={fontWeight:e.font&&e.font.bold?"bold":"none",fontStyle:e.font&&e.font.italic?"italic":"none",textDecoration:wijmo_1._getTextDecorations(e.font),fontFamily:e.font&&e.font.family?e.font.family:"",fontSize:e.font&&e.font.size?e.font.size+"px":"",color:e.font&&e.font.color?e.font.color:"",backgroundColor:e.fill&&e.fill.color?e.fill.color:""};if(e.borders){if(e.borders.left){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.left.style,"Left",t);t.borderLeftColor=e.borders.left.color}if(e.borders.right){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.right.style,"Right",t);t.borderRightColor=e.borders.right.color}if(e.borders.top){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.top.style,"Top",t);t.borderTopColor=e.borders.top.color}if(e.borders.bottom){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.bottom.style,"Bottom",t);t.borderBottomColor=e.borders.bottom.color}if(e.borders.vertical){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.vertical.style,"Vertical",t);t.borderVerticalColor=e.borders.vertical.color}if(e.borders.horizontal){wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseBorderStyle(e.borders.horizontal.style,"Horizontal",t);t.borderHorizontalColor=e.borders.horizontal.color}}null!=e.size&&(t.size=e.size);return t};FlexSheet.prototype._parseToWorkbookTable=function(e){var t,o,i=new mXlsx.WorkbookTable,n=e.getRange(),l=e.getColumns();i.name=e.name;t=mXlsx.Workbook.xlsxAddress(n.topRow,n.leftCol);o=mXlsx.Workbook.xlsxAddress(n.bottomRow,n.rightCol);i.range=t+":"+o;if(null!=e.style)if(e.style.isBuiltIn){i.style=new mXlsx.WorkbookTableStyle;i.style.name=e.style.name}else i.style=this._parseToWorkbookTableStyle(e.style);i.showBandedColumns=e.showBandedColumns;i.showBandedRows=e.showBandedRows;i.showHeaderRow=e.showHeaderRow;i.showTotalRow=e.showTotalRow;i.alterFirstColumn=e.alterFirstColumn;i.alterLastColumn=e.alterLastColumn;for(var r=0;r<l.length;r++){var s=l[r],a=new mXlsx.WorkbookTableColumn;a.name=s.name;a.totalRowLabel=s.totalRowLabel;a.totalRowFunction=s.totalRowFunction;a.showFilterButton=s.showFilterButton;i.columns.push(a)}return i};FlexSheet.prototype._parseToWorkbookTableStyle=function(e){var t=new mXlsx.WorkbookTableStyle;t.name=e.name;null!=e.firstBandedColumnStyle&&(t.firstBandedColumnStyle=this._parseToWorkbookTableStyleElement(e.firstBandedColumnStyle,!0));null!=e.firstBandedRowStyle&&(t.firstBandedRowStyle=this._parseToWorkbookTableStyleElement(e.firstBandedRowStyle,!0));null!=e.firstColumnStyle&&(t.firstColumnStyle=this._parseToWorkbookTableStyleElement(e.firstColumnStyle));null!=e.firstHeaderCellStyle&&(t.firstHeaderCellStyle=this._parseToWorkbookTableStyleElement(e.firstHeaderCellStyle));null!=e.firstTotalCellStyle&&(t.firstTotalCellStyle=this._parseToWorkbookTableStyleElement(e.firstTotalCellStyle));null!=e.headerRowStyle&&(t.headerRowStyle=this._parseToWorkbookTableStyleElement(e.headerRowStyle));null!=e.lastColumnStyle&&(t.lastColumnStyle=this._parseToWorkbookTableStyleElement(e.lastColumnStyle));null!=e.lastHeaderCellStyle&&(t.lastHeaderCellStyle=this._parseToWorkbookTableStyleElement(e.lastHeaderCellStyle));null!=e.lastTotalCellStyle&&(t.lastTotalCellStyle=this._parseToWorkbookTableStyleElement(e.lastTotalCellStyle));null!=e.secondBandedColumnStyle&&(t.secondBandedColumnStyle=this._parseToWorkbookTableStyleElement(e.secondBandedColumnStyle,!0));null!=e.secondBandedRowStyle&&(t.secondBandedRowStyle=this._parseToWorkbookTableStyleElement(e.secondBandedRowStyle,!0));null!=e.totalRowStyle&&(t.totalRowStyle=this._parseToWorkbookTableStyleElement(e.totalRowStyle));null!=e.wholeTableStyle&&(t.wholeTableStyle=this._parseToWorkbookTableStyleElement(e.wholeTableStyle));return t};FlexSheet.prototype._parseToWorkbookTableStyleElement=function(e,t){void 0===t&&(t=!1);var o,i=wijmo_grid_xlsx_1.FlexGridXlsxConverter._parseCellStyle(e,!0);t?(o=new mXlsx.WorkbookTableBandedStyle).size=e.size:o=new mXlsx.WorkbookTableCommonStyle;o._deserialize(i);return o};FlexSheet.prototype._isBuiltInStyleName=function(e){var t;if(0===e.search(/TableStyleLight/i)){t=+e.substring(15);if(!isNaN(t)&&t>=1&&t<=21)return!0}else if(0===e.search(/TableStyleMedium/i)){t=+e.substring(16);if(!isNaN(t)&&t>=1&&t<=28)return!0}else if(0===e.search(/TableStyleDark/i)){t=+e.substring(14);if(!isNaN(t)&&t>=1&&t<=11)return!0}return!1};FlexSheet.prototype._getTable=function(e){e=e.substr(e.lastIndexOf("!")+1);for(var t=0;t<this.sheets.length;t++)for(var o=this.sheets[t].tables,i=0;i<o.length;i++){var n=o[i];if(n.name.toLowerCase()===e.toLowerCase())return n}return null};FlexSheet.prototype._checkTableHeaderRow=function(e,t){e.forEach((function(e){if(e.showHeaderRow)for(var o=e.getRange(TableSection.Header),i=o.row,n=o.leftCol;n<=o.rightCol;n++){var l=t.sheets[0].rows[i].cells[n];l.isDate=!1;if(null==l.value||""===l.value){var r=n-o.leftCol;l.value=e._getColumns()[r].name}}}))};FlexSheet.prototype._getThemeColor=function(e,t){var o,i=this._colorThemes[e];if(null!=t){(o=new wijmo_1.Color("#"+i).getHsl())[2]=t<0?o[2]*(1+t):o[2]*(1-t)+(1-1*(1-t));return wijmo_1.Color.fromHsl(o[0],o[1],o[2]).toString()}return"#"+i};FlexSheet.prototype._createBuiltInTableStyle=function(e){var t;if(0===e.search(/TableStyleLight/i)){t=+e.substring(15);if(!isNaN(t)&&t>=1&&t<=21)return t<=7?this._generateTableLightStyle1(t-1,e,!0):t<=14?this._generateTableLightStyle2(t-8,e):this._generateTableLightStyle1(t-15,e,!1)}else if(0===e.search(/TableStyleMedium/i)){t=+e.substring(16);if(!isNaN(t)&&t>=1&&t<=28)return t<=7?this._generateTableMediumStyle1(t-1,e):t<=14?this._generateTableMediumStyle2(t-8,e):t<=21?this._generateTableMediumStyle3(t-15,e):this._generateTableMediumStyle4(t-22,e)}else if(0===e.search(/TableStyleDark/i)){t=+e.substring(14);if(!isNaN(t)&&t>=1&&t<=11)return t<=7?this._generateTableDarkStyle1(t-1,e):this._generateTableDarkStyle2(t-8,e)}return null};FlexSheet.prototype._generateTableLightStyle1=function(e,t,o){var i=new TableStyle(t,!0),n=0===e?1:e+3,l=o?"1px":"2px",r=o?"solid":"double",s=o?"1px":"3px";i.wholeTableStyle={borderTopColor:this._getThemeColor(n),borderTopStyle:"solid",borderTopWidth:"1px",borderBottomColor:this._getThemeColor(n),borderBottomStyle:"solid",borderBottomWidth:"1px"};i.firstColumnStyle={fontWeight:"bold"};i.lastColumnStyle={fontWeight:"bold"};i.headerRowStyle={borderBottomColor:this._getThemeColor(n),borderBottomStyle:"solid",borderBottomWidth:l,fontWeight:"bold"};i.totalRowStyle={borderTopColor:this._getThemeColor(n),borderTopStyle:r,borderTopWidth:s,fontWeight:"bold"};if(0===e){i.wholeTableStyle.color=this._getThemeColor(n);i.firstColumnStyle.color=this._getThemeColor(n);i.lastColumnStyle.color=this._getThemeColor(n);i.headerRowStyle.color=this._getThemeColor(n);i.totalRowStyle.color=this._getThemeColor(n);i.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.15)};i.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.15)}}else{if(o){i.wholeTableStyle.color=this._getThemeColor(n,-.25);i.firstColumnStyle.color=this._getThemeColor(n,-.25);i.lastColumnStyle.color=this._getThemeColor(n,-.25);i.headerRowStyle.color=this._getThemeColor(n,-.25);i.totalRowStyle.color=this._getThemeColor(n,-.25)}else{i.wholeTableStyle.color=this._getThemeColor(1);i.firstColumnStyle.color=this._getThemeColor(1);i.lastColumnStyle.color=this._getThemeColor(1);i.headerRowStyle.color=this._getThemeColor(1);i.totalRowStyle.color=this._getThemeColor(1)}i.firstBandedRowStyle={backgroundColor:this._getThemeColor(n,.8)};i.firstBandedColumnStyle={backgroundColor:this._getThemeColor(n,.8)}}if(!o){i.wholeTableStyle.borderLeftColor=this._getThemeColor(n);i.wholeTableStyle.borderLeftStyle="solid";i.wholeTableStyle.borderLeftWidth="1px";i.wholeTableStyle.borderRightColor=this._getThemeColor(n);i.wholeTableStyle.borderRightStyle="solid";i.wholeTableStyle.borderRightWidth="1px";i.wholeTableStyle.borderHorizontalColor=this._getThemeColor(n);i.wholeTableStyle.borderHorizontalStyle="solid";i.wholeTableStyle.borderHorizontalWidth="1px";i.wholeTableStyle.borderVerticalColor=this._getThemeColor(n);i.wholeTableStyle.borderVerticalStyle="solid";i.wholeTableStyle.borderVerticalWidth="1px"}return i};FlexSheet.prototype._generateTableLightStyle2=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"solid",borderTopWidth:"1px",borderBottomColor:this._getThemeColor(i),borderBottomStyle:"solid",borderBottomWidth:"1px",borderLeftColor:this._getThemeColor(i),borderLeftStyle:"solid",borderLeftWidth:"1px",borderRightColor:this._getThemeColor(i),borderRightStyle:"solid",borderRightWidth:"1px",color:this._getThemeColor(1)};o.firstBandedRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"solid",borderTopWidth:"1px"};o.secondBandedRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"solid",borderTopWidth:"1px"};o.firstBandedColumnStyle={borderLeftColor:this._getThemeColor(i),borderLeftStyle:"solid",borderLeftWidth:"1px"};o.secondBandedColumnStyle={borderLeftColor:this._getThemeColor(i),borderLeftStyle:"solid",borderLeftWidth:"1px"};o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.headerRowStyle={backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};o.totalRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"double",borderTopWidth:"3px",fontWeight:"bold",color:this._getThemeColor(1)};return o};FlexSheet.prototype._generateTableMediumStyle1=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderTopStyle:"solid",borderTopWidth:"1px",borderBottomStyle:"solid",borderBottomWidth:"1px",borderLeftStyle:"solid",borderLeftWidth:"1px",borderRightStyle:"solid",borderRightWidth:"1px",borderHorizontalStyle:"solid",borderHorizontalWidth:"1px",color:this._getThemeColor(1)};if(0===e){o.wholeTableStyle.borderTopColor=this._getThemeColor(i);o.wholeTableStyle.borderBottomColor=this._getThemeColor(i);o.wholeTableStyle.borderLeftColor=this._getThemeColor(i);o.wholeTableStyle.borderRightColor=this._getThemeColor(i);o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(i);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.15)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.15)}}else{o.wholeTableStyle.borderTopColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderBottomColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderLeftColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderRightColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(i,.4);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,.8)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,.8)}}o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.headerRowStyle={backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};o.totalRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"double",borderTopWidth:"3px",fontWeight:"bold",color:this._getThemeColor(1)};return o};FlexSheet.prototype._generateTableMediumStyle2=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderVerticalStyle:"solid",borderVerticalWidth:"1px",borderVerticalColor:this._getThemeColor(0),borderHorizontalStyle:"solid",borderHorizontalWidth:"1px",borderHorizontalColor:this._getThemeColor(0),color:this._getThemeColor(1)};if(0===e){o.wholeTableStyle.backgroundColor=this._getThemeColor(0,-.15);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.35)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.35)}}else{o.wholeTableStyle.backgroundColor=this._getThemeColor(i,.8);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,.6)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,.6)}}o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i)};o.headerRowStyle={borderBottomColor:this._getThemeColor(0),borderBottomStyle:"solid",borderBottomWidth:"3px",backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};o.totalRowStyle={borderTopColor:this._getThemeColor(0),borderTopStyle:"solid",borderTopWidth:"3px",backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};return o};FlexSheet.prototype._generateTableMediumStyle3=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderTopStyle:"solid",borderTopWidth:"2px",borderTopColor:this._getThemeColor(1),borderBottomStyle:"solid",borderBottomWidth:"2px",borderBottomColor:this._getThemeColor(1),color:this._getThemeColor(1)};if(0===e){o.wholeTableStyle.borderLeftColor=this._getThemeColor(1);o.wholeTableStyle.borderLeftStyle="solid";o.wholeTableStyle.borderLeftWidth="1px";o.wholeTableStyle.borderRightColor=this._getThemeColor(1);o.wholeTableStyle.borderRightStyle="solid";o.wholeTableStyle.borderRightWidth="1px";o.wholeTableStyle.borderVerticalColor=this._getThemeColor(1);o.wholeTableStyle.borderVerticalStyle="solid";o.wholeTableStyle.borderVerticalWidth="1px";o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(1);o.wholeTableStyle.borderHorizontalStyle="solid";o.wholeTableStyle.borderHorizontalWidth="1px"}o.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.35)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.35)};o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i)};o.headerRowStyle={borderBottomColor:this._getThemeColor(1),borderBottomStyle:"solid",borderBottomWidth:"2px",backgroundColor:this._getThemeColor(i),fontWeight:"bold",color:this._getThemeColor(0)};o.totalRowStyle={borderTopColor:this._getThemeColor(1),borderTopStyle:"double",borderTopWidth:"3px"};return o};FlexSheet.prototype._generateTableMediumStyle4=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3;o.wholeTableStyle={borderTopStyle:"solid",borderTopWidth:"1px",borderBottomStyle:"solid",borderBottomWidth:"1px",borderLeftStyle:"solid",borderLeftWidth:"1px",borderRightStyle:"solid",borderRightWidth:"1px",borderVerticalStyle:"solid",borderVerticalWidth:"1px",borderHorizontalStyle:"solid",borderHorizontalWidth:"1px",color:this._getThemeColor(1)};if(0===e){o.wholeTableStyle.borderTopColor=this._getThemeColor(i);o.wholeTableStyle.borderBottomColor=this._getThemeColor(i);o.wholeTableStyle.borderLeftColor=this._getThemeColor(i);o.wholeTableStyle.borderRightColor=this._getThemeColor(i);o.wholeTableStyle.borderVerticalColor=this._getThemeColor(i);o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(i);o.wholeTableStyle.backgroundColor=this._getThemeColor(0,-.15);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(0,-.35)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(0,-.35)}}else{o.wholeTableStyle.borderTopColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderBottomColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderLeftColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderRightColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderVerticalColor=this._getThemeColor(i,.4);o.wholeTableStyle.borderHorizontalColor=this._getThemeColor(i,.4);o.wholeTableStyle.backgroundColor=this._getThemeColor(i,.8);o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,.6)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,.6)}}o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.headerRowStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.totalRowStyle={borderTopColor:this._getThemeColor(i),borderTopStyle:"solid",borderTopWidth:"2px",fontWeight:"bold",color:this._getThemeColor(1)};return o};FlexSheet.prototype._generateTableDarkStyle1=function(e,t){var o=new TableStyle(t,!0),i=0===e?1:e+3,n=0===e?.25:-.25;o.wholeTableStyle={color:this._getThemeColor(0)};o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,n)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,n)};o.firstColumnStyle={borderRightColor:this._getThemeColor(0),borderRightStyle:"solid",borderRightWidth:"2px",fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i,n)};o.lastColumnStyle={borderLeftColor:this._getThemeColor(0),borderLeftStyle:"solid",borderLeftWidth:"2px",fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(i,n)};o.headerRowStyle={borderBottomColor:this._getThemeColor(0),borderBottomStyle:"solid",borderBottomWidth:"2px",fontWeight:"bold",color:this._getThemeColor(0),backgroundColor:this._getThemeColor(1)};o.totalRowStyle={borderTopColor:this._getThemeColor(0),borderTopStyle:"solid",borderTopWidth:"2px",fontWeight:"bold",color:this._getThemeColor(0)};if(0===e){o.wholeTableStyle.backgroundColor=this._getThemeColor(i,.5);o.totalRowStyle.backgroundColor=this._getThemeColor(i,.15)}else{o.wholeTableStyle.backgroundColor=this._getThemeColor(i);o.totalRowStyle.backgroundColor=this._getThemeColor(i,-.5)}return o};FlexSheet.prototype._generateTableDarkStyle2=function(e,t){var o=new TableStyle(t,!0),i=0===e?0:2*e+2,n=0===e?1:2*e+3,l=0===e?-.15:.8;o.wholeTableStyle={backgroundColor:this._getThemeColor(i,l)};o.firstBandedRowStyle={backgroundColor:this._getThemeColor(i,l-.2)};o.firstBandedColumnStyle={backgroundColor:this._getThemeColor(i,l-.2)};o.firstColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.lastColumnStyle={fontWeight:"bold",color:this._getThemeColor(1)};o.headerRowStyle={color:this._getThemeColor(0),backgroundColor:this._getThemeColor(n)};o.totalRowStyle={borderTopColor:this._getThemeColor(1),borderTopStyle:"double",borderTopWidth:"3px",fontWeight:"bold",color:this._getThemeColor(1)};return o};FlexSheet._getHeaderRowText=function(e){var t=e.binding,o=e._hdr;null!=o&&""!=o.trim()||(o=wijmo_1.toHeaderCase(t||""));return o};FlexSheet._toOADate=function(e){var t,o=new Date(1900,0,0),i=Date.UTC(1900,0,0),n=o.getTime()-i-6e4*o.getTimezoneOffset(),l=6e4*(e.getTimezoneOffset()-o.getTimezoneOffset());t=(e.getTime()-o.getTime()-(0!==l?l-n:0))/864e5;return t+=t>59?1:0};FlexSheet._fromOADate=function(e){var t,o,i,n=new Date(1900,0,0),l=Date.UTC(1900,0,0),r=n.getTime()-l-6e4*n.getTimezoneOffset();o=e>59?1:0;return 0!==(t=6e4*((i=new Date(n.getTime()+864e5*(e-o))).getTimezoneOffset()-n.getTimezoneOffset()))?new Date(n.getTime()+t-r+864e5*(e-o)):i};FlexSheet.prototype.setHeights=function(e){this._heights=e};FlexSheet.prototype.updateRowHeights=function(){if(this.collectionView)for(var e=0;e<this._heights.length;e++)this._heights[e]&&this.rows[e]&&(this.rows[e].height=this._heights[e])};FlexSheet.prototype._getRangesToResize=function(e,t,o){var i=null,n=this._getResizingInfo(t,e),l=n.isRowResizing,r=n.isColResizing,s=n.rangeBeingResized;if(this.selectionMode===wijmo_grid_1.SelectionMode.MultiRange){i=this._selections();this._removeNegativeRange(i);if(!this._isAllCellsSelected()){var a=null;r?a=this._checkSelectedRangesForResizingCol(i,s):l&&(a=this._checkSelectedRangesForResizingRow(i,s));a&&(i=a)}}else(r&&!this.selection.containsColumn(s.col)||l&&!this.selection.containsRow(s.row))&&(i=[s]);return i};FlexSheet.prototype._checkSelectedRangesForResizingCol=function(e,t){for(var o=e,i=!1,n=0;n<o.length;n++){var l=o[n];!i&&l.containsColumn(t.rightCol)&&(i=!0);if(l.bottomRow-l.topRow+1!==this.rows.length)return[t]}return i?o:[t]};FlexSheet.prototype._checkSelectedRangesForResizingRow=function(e,t){for(var o=e,i=!1,n=0;n<o.length;n++){var l=o[n];!i&&l.containsRow(t.bottomRow)&&(i=!0);if(l.rightCol-l.leftCol+1!==this.columns.length)return[t]}return i?o:[t]};FlexSheet.prototype._removeNegativeRange=function(e){e&&e.length&&-1===e[0].row&&-1===e[0].col&&-1===e[0].row2&&-1===e[0].col2&&e.splice(0,1)};FlexSheet._EDITOR_PADDING_BELOW=2;FlexSheet._EDITOR_PADDING_ABOVE=3;FlexSheet._MIN_DIALOG_GAP=6;FlexSheet._ctrlTemplate="";return FlexSheet}(wijmo_grid_1.FlexGrid);exports.FlexSheet=FlexSheet;var DraggingRowColumnEventArgs=function(e){__extends(DraggingRowColumnEventArgs,e);function DraggingRowColumnEventArgs(t,o,i){var n=e.call(this)||this;n._draggingRange=t;n._isDraggingRows=o;n._isShiftKey=i;return n}Object.defineProperty(DraggingRowColumnEventArgs.prototype,"draggingRange",{get:function(){return this._draggingRange},enumerable:!0,configurable:!0});Object.defineProperty(DraggingRowColumnEventArgs.prototype,"isDraggingRows",{get:function(){return this._isDraggingRows},enumerable:!0,configurable:!0});Object.defineProperty(DraggingRowColumnEventArgs.prototype,"isShiftKey",{get:function(){return this._isShiftKey},enumerable:!0,configurable:!0});return DraggingRowColumnEventArgs}(wijmo_1.EventArgs);exports.DraggingRowColumnEventArgs=DraggingRowColumnEventArgs;var DroppingRowColumnEventArgs=function(e){__extends(DroppingRowColumnEventArgs,e);function DroppingRowColumnEventArgs(t,o){var i=e.call(this)||this;i._droppingRange=t;i._isDroppingRows=o;return i}Object.defineProperty(DroppingRowColumnEventArgs.prototype,"droppingRange",{get:function(){return this._droppingRange},enumerable:!0,configurable:!0});Object.defineProperty(DroppingRowColumnEventArgs.prototype,"isDroppingRows",{get:function(){return this._isDroppingRows},enumerable:!0,configurable:!0});return DroppingRowColumnEventArgs}(wijmo_1.CancelEventArgs);exports.DroppingRowColumnEventArgs=DroppingRowColumnEventArgs;var UnknownFunctionEventArgs=function(e){__extends(UnknownFunctionEventArgs,e);function UnknownFunctionEventArgs(t,o){var i=e.call(this)||this;i._funcName=t;i._params=o;return i}Object.defineProperty(UnknownFunctionEventArgs.prototype,"funcName",{get:function(){return this._funcName},enumerable:!0,configurable:!0});Object.defineProperty(UnknownFunctionEventArgs.prototype,"params",{get:function(){return this._params},enumerable:!0,configurable:!0});return UnknownFunctionEventArgs}(wijmo_1.EventArgs);exports.UnknownFunctionEventArgs=UnknownFunctionEventArgs;var RowColumnChangedEventArgs=function(e){__extends(RowColumnChangedEventArgs,e);function RowColumnChangedEventArgs(t,o,i,n){var l=e.call(this)||this;if(wijmo_1.isArray(t)){l._ranges=t;l._added=o;if(1===t.length){var r=t[0];if(i){l._index=r.leftCol;l._count=r.columnSpan}else{l._index=r.topRow;l._count=r.rowSpan}}else{l._index=-1;l._count=-1}}else{l._index=t;l._count=o;l._added=i;l._ranges=n?[new wijmo_grid_1.CellRange(-1,l._index,-1,l._index+l._count-1)]:[new wijmo_grid_1.CellRange(l._index,-1,l._index+l._count-1,-1)]}return l}Object.defineProperty(RowColumnChangedEventArgs.prototype,"ranges",{get:function(){return this._ranges},enumerable:!0,configurable:!0});Object.defineProperty(RowColumnChangedEventArgs.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0});Object.defineProperty(RowColumnChangedEventArgs.prototype,"count",{get:function(){return this._count},enumerable:!0,configurable:!0});Object.defineProperty(RowColumnChangedEventArgs.prototype,"added",{get:function(){return this._added},enumerable:!0,configurable:!0});Object.defineProperty(RowColumnChangedEventArgs.prototype,"isAdd",{get:function(){wijmo_1._deprecated("RowColumnChangedEventArgs.isAdd","RowColumnChangedEventArgs.added");return this._added},enumerable:!0,configurable:!0});return RowColumnChangedEventArgs}(wijmo_1.EventArgs);exports.RowColumnChangedEventArgs=RowColumnChangedEventArgs;var AutoFillingEventArgs=function(e){__extends(AutoFillingEventArgs,e);function AutoFillingEventArgs(t,o){var i=e.call(this)||this;i._range=t;i._op=o;return i}Object.defineProperty(AutoFillingEventArgs.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(AutoFillingEventArgs.prototype,"operation",{get:function(){return this._op},enumerable:!0,configurable:!0});return AutoFillingEventArgs}(wijmo_1.CancelEventArgs);exports.AutoFillingEventArgs=AutoFillingEventArgs;var AutoFilledEventArgs=function(e){__extends(AutoFilledEventArgs,e);function AutoFilledEventArgs(t,o){var i=e.call(this)||this;i._range=t;i._op=o;return i}Object.defineProperty(AutoFilledEventArgs.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(AutoFilledEventArgs.prototype,"operation",{get:function(){return this._op},enumerable:!0,configurable:!0});return AutoFilledEventArgs}(wijmo_1.EventArgs);exports.AutoFilledEventArgs=AutoFilledEventArgs;var FlexSheetPanel=function(e){__extends(FlexSheetPanel,e);function FlexSheetPanel(t,o,i,n,l){var r=e.call(this,t,o,i,n,l)||this;r._drkColors={};return r}FlexSheetPanel.prototype.getSelectedState=function(t,o,i){if(this.grid){var n=this.grid.selectedSheet,l=n?n.selectionRanges:null,r=l?l.length:0,s=e.prototype.getSelectedState.call(this,t,o,i);if(s===wijmo_grid_1.SelectedState.None&&r>0)for(var a=this.grid.getMergedRange(this,t,o),h=this.columns.length-1,u=this.rows.length-1,d=0;d<l.length;d++){var _=l[d];if(_&&_ instanceof wijmo_grid_1.CellRange){if(this.cellType===wijmo_grid_1.CellType.Cell){if(a){if(a.contains(_.row,_.col))return d!==r-1||this.grid._isClicking?wijmo_grid_1.SelectedState.Selected:this.grid.showMarquee?wijmo_grid_1.SelectedState.None:wijmo_grid_1.SelectedState.Cursor;if(a.intersects(_))return wijmo_grid_1.SelectedState.Selected}if(_.row===t&&_.col===o)return d!==r-1||this.grid._isClicking?wijmo_grid_1.SelectedState.Selected:this.grid.showMarquee?wijmo_grid_1.SelectedState.None:wijmo_grid_1.SelectedState.Cursor;if(_.contains(t,o))return wijmo_grid_1.SelectedState.Selected}if(this.cellType===wijmo_grid_1.CellType.RowHeader&&this.grid.showSelectedHeaders&wijmo_grid_1.HeadersVisibility.Row&&o===h&&_.containsRow(t))return wijmo_grid_1.SelectedState.Selected;if(this.cellType===wijmo_grid_1.CellType.ColumnHeader&&this.grid.showSelectedHeaders&wijmo_grid_1.HeadersVisibility.Column&&t===u&&_.containsColumn(o))return wijmo_grid_1.SelectedState.Selected}}return s}};FlexSheetPanel.prototype.getCellData=function(t,o,i){if(wijmo_1.isString(o)&&(o=this.columns.indexOf(o))<0)throw"Invalid column name or binding.";if(t>=this.rows.length||wijmo_1.asNumber(o,!1,!0)>=this.columns.length)return null;if(this.cellType===wijmo_grid_1.CellType.RowHeader)return""+(t+1);var n=this.columns[wijmo_1.asNumber(o,!1,!0)],l=this.grid?this.grid._getBindingColumn(this,t,n):n,r=this.grid;if(this.cellType===wijmo_grid_1.CellType.ColumnHeader){var s=this.rows[t];if(s&&s._ubv&&null!=s._ubv[n._hash])return e.prototype.getCellData.call(this,t,o,i);var a=l.header;return null==l._hdr||l._hdr==l._orgHdr||a===l.binding||a===wijmo_1.toHeaderCase(l.binding)?FlexSheet.convertNumberToAlpha(o):a}if(i&&(!l||!l.dataMap))if(_isEditingCell(this.grid,t,o)){var h=e.prototype.getCellData.call(this,t,o,!1);if(!wijmo_1.isDate(h)||!l.format)return wijmo_1.Globalize.format(h,null)}else{var u=r&&r._getCellStyle(t,o);if(u&&u.format){h=e.prototype.getCellData.call(this,t,o,!1);if(wijmo_1.isDate(h)||wijmo_1.isNumber(h))return wijmo_1.Globalize.format(h,u.format)}}return e.prototype.getCellData.call(this,t,o,i)};FlexSheetPanel.prototype.setCellData=function(t,o,i,n,l,r){void 0===n&&(n=!0);void 0===l&&(l=!0);void 0===r&&(r=!1);if(t>=this.rows.length||o>=this.columns.length)return!1;var s,a=this.grid,h=a?a._getBindingColumn(this,t,this.columns[o]):this.columns[o],u=this.rows[t];if(i instanceof _ValWithFormat){s=i.format;i=i.value}a&&a._isPasting&&(n=!0);var d=wijmo_1.isString(i);if(a&&a.selectedSheet){var _=a.selectedSheet.findTable(t,o);if(_&&_._isHeaderRow(t)){if(null==i||d&&wijmo_1.isNullOrWhiteSpace(i)&&!h.dataMap)return;if(!(u instanceof HeaderRow)){i=h.dataType===wijmo_1.DataType.Boolean&&wijmo_1.isBoolean(i)?i:i.toString();_._attached&&a._updateFormulasTableColumn(_,o,""+this.getCellData(t,o,!1),""+i);return e.prototype.setCellData.call(this,t,o,i,!1,l,r)}u._ubv[h._hash]=i.toString()}}var c=d&&"'"===i[0],g=d&&_isFormula(i);if(n&&i&&h.dataType!==wijmo_1.DataType.String&&d&&!c&&!g){var f=wijmo_1.culture.Globalize;if(this.getCellData(t,o,!0)===i)return!0;var p=a?a._getCellStyle(t,o):null,m=s||p&&p.format||h.format,w=null;m&&/[yYMhsmt:-]/.test(m)&&!/[pc]/.test(m)&&(w=wijmo_1.Globalize.parseDate(i,m));null==w&&i.indexOf(f.calendar["/"])>=0&&(w=wijmo_1.Globalize.parseDate(i,null));if(w)i=w;else if(h.dataType===wijmo_1.DataType.Array)i=wijmo_1.changeType(i,wijmo_1.DataType.Array,null);else if(wijmo_1.isNullOrWhiteSpace(i))h.dataType===wijmo_1.DataType.Boolean&&(i=wijmo_1.changeType(i,wijmo_1.DataType.Boolean,null));else{var C="%"===i[i.length-1],S=i.indexOf(f.numberFormat.currency.symbol)>=0;if(C||S||!/[^-\d,.]/.test(i)){var b=wijmo_1.changeType(i,wijmo_1.DataType.Number,"");if(wijmo_1.isNumber(b)){i=b;m||h.dataType&&h.dataType!==wijmo_1.DataType.Number||(S?a.applyCellsStyle({format:"C"+(wijmo_1.isInt(i)?"0":"")},[new wijmo_grid_1.CellRange(t,o)]):C&&a.applyCellsStyle({format:"P"+(wijmo_1.isInt(100*i)?"0":"")},[new wijmo_grid_1.CellRange(t,o)]))}else n=!1}}}(g||c||!h.dataType&&i)&&(n=!1);if(""===i&&n&&h.dataType!==wijmo_1.DataType.String&&!h.dataMap&&!u.dataMap){i=null;n=!1}if(!(u instanceof HeaderRow))return e.prototype.setCellData.call(this,t,o,i,n,l,r);u._ubv[h._hash]=i};FlexSheetPanel.prototype._renderCell=function(t,o,i,n,l,r){var s=o*this.grid.columns.length+i,a=this.grid.getMergedRange(this,o,i),h=e.prototype._renderCell.call(this,t,o,i,n,l,r);if(this.cellType!==wijmo_grid_1.CellType.Cell)return h;if(a&&s>a.topRow*this.grid.columns.length+a.leftCol)return h;if(this.columns[i].renderSize<=0&&(!a||a.getRenderSize(this).width<=0))return h;var u=t.childNodes[r];if(u){var d=this.grid.selectedSheet;if(d&&!_isEditingCell(this.grid,o,i)){var _=d.findTable(o,i);_&&_._updateCell(o,i,u)}var c,g=d?d._styledCells[s]:null;c=wijmo_1.hasClass(u,wijmo_1.ControlStateClsNames.multiSelected);if(wijmo_1.hasClass(u,wijmo_1.ControlStateClsNames.selected)||c){g&&g.backgroundColor&&(u.style.backgroundColor="");g&&g.color&&(u.style.color="");c&&g&&g.backgroundColor&&(u.style.backgroundColor=this._darker(g.backgroundColor))}else if(g){""!==g.backgroundColor&&(u.style.backgroundColor=g.backgroundColor);""!==g.color&&(u.style.color=g.color)}}return h};FlexSheetPanel.prototype._darker=function(e){var t=this._drkColors[e];if(!t){var o=new wijmo_1.Color(e).getHsl();this._drkColors[e]=t=wijmo_1.Color.fromHsl(o[0],o[1],.75*o[2]).toString()}return t};return FlexSheetPanel}(wijmo_grid_1.GridPanel);exports.FlexSheetPanel=FlexSheetPanel;var AutoFillOperation,HeaderRow=function(e){__extends(HeaderRow,e);function HeaderRow(){var t=e.call(this)||this;t.isReadOnly=!0;return t}return HeaderRow}(wijmo_grid_1.Row);exports.HeaderRow=HeaderRow;function _isFormula(e){return e&&"string"==typeof e&&e.length>1&&"="===e[0]&&"="!==e[1]}exports._isFormula=_isFormula;function _isEditingCell(e,t,o){var i=e.editRange;return i&&i.contains(t,o)}exports._isEditingCell=_isEditingCell;function _isExclusiveNumericFormat(e){if(e){var t=e.match(/^[cdefgnprx](\d?)/i);if(t){var o=t[0][0].toLowerCase();return"d"!==o&&"e"!==o&&"f"!==o&&"g"!==o||!!t[1]}}return!1}function applyStyleImp(e,t,o,i){e[t]||(e[t]={});e[t][o]=null===i||""===i?void 0:i||e[t][o]}!function(e){e[e.CopyFormat=1]="CopyFormat";e[e.CopyContent=2]="CopyContent";e[e.FillSeries=4]="FillSeries"}(AutoFillOperation=exports.AutoFillOperation||(exports.AutoFillOperation={}));var _RangesHelper=function(){function _RangesHelper(){}_RangesHelper.validateRowRanges=function(e,t){return _RangesHelper._validateCellRanges(e,t,"topRow","bottomRow","row2")};_RangesHelper.excludeRow=function(e,t){if(e&&e.length)for(var o=0;o<e.length;o++){var i=e[o];if(i.containsRow(t))if(1===i.rowSpan){e.splice(o);o--}else if(i.topRow===t)i.setRange(i.topRow+1,i.col,i.bottomRow,i.col2);else if(i.bottomRow===t)i.setRange(i.topRow,i.col,i.bottomRow-1,i.col2);else{e.splice(o,1,new wijmo_grid_1.CellRange(i.topRow,i.col,t-1,i.col2),new wijmo_grid_1.CellRange(t+1,i.col,i.bottomRow,i.col2));o++}}};_RangesHelper.validateColumnRanges=function(e,t){return _RangesHelper._validateCellRanges(e,t,"leftCol","rightCol","col2")};_RangesHelper._validateCellRanges=function(e,t,o,i,n){var l=(e=e.filter((function(e){return e&&e[o]>=0&&e[i]>=0&&e[o]<t&&e[i]<t}))).length;if(l>1){for(var r=[],s=(e=e.sort((function(e,t){return t[o]>=e[o]&&t[i]<=e[i]?-1:e[o]-t[o]})))[0].clone(),a=1;a<l;a++){var h=e[a];if(h[o]>=s[o]&&h[i]<=s[i]);else if(h[o]<=s[i]+1)s[n]=h[i];else{r.push(s);s=h.clone()}a===l-1&&r.push(s)}e=r}return e};return _RangesHelper}(),_ValWithFormat=function _ValWithFormat(e,t){this.value=e;this.format=t},UndoStack=function(){function UndoStack(e){var t=this;this.MAX_STACK_SIZE=500;this._stack=[];this._pointer=-1;this._resizingTriggered=!1;this.undoStackChanged=new wijmo_1.Event;this._owner=e;this._owner.prepareCellForEdit.addHandler(this._initCellEditAction,this);this._owner.cellEditEnded.addHandler((function(e,o){t._pendingAction&&(!o.data||46!==o.data.keyCode&&8!==o.data.keyCode)&&t._pendingAction instanceof _EditAction&&!t._pendingAction.isPaste&&t._afterProcessCellEditAction(t)}),this);this._owner.pasting.addHandler(this._initCellEditActionForPasting,this);this._owner.pastingCell.addHandler((function(e,o){t._pendingAction&&(t._pendingAction instanceof _EditAction||t._pendingAction instanceof _CutAction)&&t._pendingAction.updateForPasting(o.range)}),this);this._owner.pasted.addHandler((function(){if(t._pendingAction)if(t._pendingAction instanceof _EditAction&&t._pendingAction.isPaste)t._afterProcessCellEditAction(t);else if(t._pendingAction instanceof _CutAction){t._pendingAction.saveNewState();t._addAction(t._pendingAction);t._pendingAction=null}}),this);this._owner.resizingColumn.addHandler((function(e,o){if(0!==t.stackSize&&t._owner.selectedSheet&&!t._resizingTriggered){t._pendingAction=new _ColumnResizeAction(t._owner,o.panel,o.col);t._resizingTriggered=!0}}),this);this._owner.resizedColumn.addHandler((function(e){t._pendingAction instanceof _ColumnResizeAction&&t._pendingAction.saveNewState()&&t._addAction(t._pendingAction);t._pendingAction=null;t._resizingTriggered=!1}),this);this._owner.resizingRow.addHandler((function(e,o){if(0!==t.stackSize&&t._owner.selectedSheet&&!t._resizingTriggered){t._pendingAction=new _RowResizeAction(t._owner,o.panel,o.row);t._resizingTriggered=!0}}),this);this._owner.resizedRow.addHandler((function(e){t._pendingAction instanceof _RowResizeAction&&t._pendingAction.saveNewState()&&t._addAction(t._pendingAction);t._pendingAction=null;t._resizingTriggered=!1}),this);this._owner.draggingRowColumn.addHandler((function(e,o){0!==t.stackSize&&t._owner.selectedSheet&&o.isShiftKey&&(o.isDraggingRows?t._pendingAction=new _RowsChangedAction(t._owner):t._pendingAction=new _ColumnsChangedAction(t._owner))}),this);this._owner.endDroppingRowColumn.addHandler((function(e,o){!o.cancel&&t._pendingAction&&t._pendingAction.saveNewState()&&t._addAction(t._pendingAction);t._pendingAction=null}),this);this._owner.sheets.collectionChanged.addHandler((function(e,o){if(o.action===wijmo_1.NotifyCollectionChangedAction.Remove){for(var i=0;i<t._stack.length;i++)if(t._stack[i].sheetUid===o.item._uid){t._stack.splice(i,1);i--}t._pointer=Math.min(t._pointer,t._stack.length-1)}}));this._owner.sheets.sheetCleared.addHandler((function(){return t.clear()}))}Object.defineProperty(UndoStack.prototype,"stackSize",{get:function(){return null==this._stackSize?this.MAX_STACK_SIZE:this._stackSize},set:function(e){wijmo_1.isNumber(e)&&(e<0?this._stackSize=0:e>this.MAX_STACK_SIZE?this._stackSize=this.MAX_STACK_SIZE:this._stackSize=Math.floor(e))},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canUndo",{get:function(){return this._pointer>-1&&this._pointer<this._stack.length},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canRedo",{get:function(){return this._pointer+1>-1&&this._pointer+1<this._stack.length},enumerable:!0,configurable:!0});UndoStack.prototype.onUndoStackChanged=function(e){this.undoStackChanged.raise(this,e)};UndoStack.prototype.undo=function(){if(this.canUndo){var e=this._stack[this._pointer];this._beforeUndoRedo(e);e.undo();this._pointer--;this.onUndoStackChanged()}};UndoStack.prototype.redo=function(){if(this.canRedo){this._pointer++;var e=this._stack[this._pointer];this._beforeUndoRedo(e);e.redo();this.onUndoStackChanged()}};UndoStack.prototype.clear=function(){this._stack.length=0;this._pointer=-1};UndoStack.prototype._addAction=function(e){this._stack.length>0&&this._stack.length>this._pointer+1&&this._stack.splice(this._pointer+1,this._stack.length-this._pointer-1);this._stack.length>=this.stackSize&&this._stack.splice(0,this._stack.length-this.stackSize+1);this._pointer=this._stack.length;this._stack.push(e);this.onUndoStackChanged()};UndoStack.prototype._pop=function(){if(this._pointer<0)return null;var e=this._stack[this._pointer];this._pointer--;return e};UndoStack.prototype._initCellEditAction=function(e,t){0!==this.stackSize&&this._owner.selectedSheet&&(this._pendingAction=new _EditAction(this._owner,t.range))};UndoStack.prototype._initCellEditActionForPasting=function(e,t){if(0!==this.stackSize&&this._owner.selectedSheet)if(this._owner._isCutting)this._pendingAction=new _CutAction(this._owner);else{this._pendingAction=new _EditAction(this._owner,t?t._rng:null);this._pendingAction.markIsPaste()}};UndoStack.prototype._afterProcessCellEditAction=function(e){if(e._pendingAction){e._pendingAction instanceof _EditAction&&e._pendingAction.saveNewState()&&e._addAction(this._pendingAction);e._pendingAction=null}};UndoStack.prototype._beforeUndoRedo=function(e){for(var t=this._owner.sheets,o=0;o<t.length;o++)if(t[o]._uid===e.sheetUid){this._owner.selectedSheetIndex=o;break}};return UndoStack}();exports.UndoStack=UndoStack;var FlexSheetValueFilterEditor=function(e){__extends(FlexSheetValueFilterEditor,e);function FlexSheetValueFilterEditor(){return null!==e&&e.apply(this,arguments)||this}Object.defineProperty(FlexSheetValueFilterEditor,"controlTemplate",{get:function(){FlexSheetValueFilterEditor._ctrlTemplate||(FlexSheetValueFilterEditor._ctrlTemplate=wijmo_grid_filter_1.ValueFilterEditor.controlTemplate);return FlexSheetValueFilterEditor._ctrlTemplate},set:function(e){FlexSheetValueFilterEditor._ctrlTemplate=e},enumerable:!0,configurable:!0});FlexSheetValueFilterEditor.prototype.updateEditor=function(){var t=this,o=this.filter.column,i=o.grid;if(this.filter.uniqueValues||null!=i.itemsSource&&null!=i.childItemsPath)e.prototype.updateEditor.call(this);else{this.filter.showIncludeSelection&&!this.hostElement.contains(this._lblIncludeSel)?this._divOptions.appendChild(this._lblIncludeSel):this.filter.showIncludeSelection||this._lblIncludeSel.remove();var n=i.filter._getValueFilters(o),l=this.filter.showValues;if(!l||0==Object.keys(l).length&&this._isSingleFilterMode())for(var r=0;r<n.length;r++)n[r].show=!0;else for(var s in l)for(var a=0;a<n.length;a++)if(l[s]&&""!==n[a].cellRef&&n[a].cellRef===l[s].cellRef){l[n[a].text]={show:!0,cellRef:n[a].cellRef};n[a].show=!0;n[a].text!=s&&delete l[s]}else if(n[a].text==s){n[a].show=!0;break}this._lbValues.isContentHtml=o.isContentHtml;this._cmbFilter.text=this.filter.filterText;var h=this._cmbFilter.text.toLowerCase();this._filterText=h;this._rxFilter=this._getSearchExp(h,this._getCaseSensitive());this._view.pageSize=this.filter.maxValues;this._view.sourceCollection=n;setTimeout((function(){t._adjustWidths()}),0)}};FlexSheetValueFilterEditor.prototype.updateFilter=function(){var e,t=null;e=this._isSingleFilterMode()?this._getItems():this._filter._allValues=wijmo_1.replaceItems(this._filter._allValues,this._view.sourceCollection);t=this._shouldIncludeSelection&&this.filter.showValues||null;if(!this._isSingleFilterMode()||this._filterText||this._cbSelectAll.indeterminate){t=t||{};for(var o=0;o<e.length;o++){var i=e[o];i.show&&(t[i.text]={show:!0,cellRef:i.cellRef})}}this._filter.showValues=t;this._filter.filterText=this._filterText};FlexSheetValueFilterEditor._ctrlTemplate="";return FlexSheetValueFilterEditor}(wijmo_grid_filter_1.ValueFilterEditor);exports.FlexSheetValueFilterEditor=FlexSheetValueFilterEditor;var FlexSheetConditionFilter=function(e){__extends(FlexSheetConditionFilter,e);function FlexSheetConditionFilter(t){return e.call(this,t)||this}FlexSheetConditionFilter.prototype.apply=function(e){var t,o,i,n,l=this.column,r=l.grid,s=this.condition1,a=this.condition2;if(!(r instanceof FlexSheet))return!0;if(!this.isActive)return!0;if(r.rows[e]instanceof wijmo_grid_1._NewRowTemplate)return!0;""===(t=r.getCellValue(e,l.index))&&l.dataType!==wijmo_1.DataType.String&&(t=null);o=i=t;if(n=this.dataMap||l.dataMap)o=i=t=n.getDisplayValue(t);else if(wijmo_1.isDate(t))(wijmo_1.isString(s.value)||wijmo_1.isString(a.value))&&(o=i=t=r.getCellValue(e,l.index,!0));else if(wijmo_1.isNumber(t)){o=i=t=wijmo_1.Globalize.parseFloat(r.getCellValue(e,l.index,!0));if(0===t&&!l.dataType){s.isActive&&""===s.value&&(o=t.toString());a.isActive&&""===a.value&&(i=i.toString())}}else if(null==t){s.isActive&&wijmo_1.isNumber(s.value)&&(o=NaN);a.isActive&&wijmo_1.isNumber(a.value)&&(i=NaN)}var h=s.apply(o),u=a.apply(i);return s.isActive&&a.isActive?this.and?h&&u:h||u:s.isActive?h:!a.isActive||u};return FlexSheetConditionFilter}(wijmo_grid_filter_1.ConditionFilter);exports.FlexSheetConditionFilter=FlexSheetConditionFilter;var FlexSheetValueFilter=function(e){__extends(FlexSheetValueFilter,e);function FlexSheetValueFilter(t){return e.call(this,t)||this}FlexSheetValueFilter.prototype.apply=function(e){var t,o=this.column.grid;if(!(o instanceof FlexSheet))return!0;if(!this.isActive)return!0;if(o.rows[e]instanceof wijmo_grid_1._NewRowTemplate)return!0;e=(t=this.dataMap||this.column.dataMap)?t.getDisplayValue(o.getCellValue(e,this.column.index)):o.getCellValue(e,this.column.index,!0);return null!=this.showValues[e]};FlexSheetValueFilter.prototype.setInitialAllValues=function(){var e=this.column.grid.filter._getValueFilters(this.column,!1);this._allValues=this.updateShowStatus(e)};return FlexSheetValueFilter}(wijmo_grid_filter_1.ValueFilter);exports.FlexSheetValueFilter=FlexSheetValueFilter;var FlexSheetColumnFilter=function(e){__extends(FlexSheetColumnFilter,e);function FlexSheetColumnFilter(t,o){var i=e.call(this,t,o)||this;i._valueFilter=new FlexSheetValueFilter(o);i._valueFilter.setColumnFilter(i);i._valueFilter.exclusiveValueSearch=t.exclusiveValueSearch;i._valueFilter.showIncludeSelection=t.showIncludeSelection;i._conditionFilter=new FlexSheetConditionFilter(o);i._conditionFilter.setColumnFilter(i);t._showIncludeSelectionChanged.addHandler((function(e){i._valueFilter.showIncludeSelection=e.showIncludeSelection}));return i}return FlexSheetColumnFilter}(wijmo_grid_filter_1.ColumnFilter);exports.FlexSheetColumnFilter=FlexSheetColumnFilter;var FlexSheetColumnFilterEditor=function(e){__extends(FlexSheetColumnFilterEditor,e);function FlexSheetColumnFilterEditor(t,o,i){void 0===i&&(i=!0);var n=this;wijmo_grid_filter_1.ColumnFilterEditor.isCustomedTemplate(FlexSheetColumnFilterEditor.controlTemplate)&&(o.filterMode===wijmo_grid_filter_1.FilterMode.MultiFilter?FlexSheetColumnFilterEditor.controlTemplate=wijmo_grid_filter_1.ColumnFilterEditor._multiFilterTemplate:FlexSheetColumnFilterEditor.controlTemplate=wijmo_grid_filter_1.ColumnFilterEditor._singleFilterTemplate);n=e.call(this,t,o,i)||this;i&&(n._divSort.style.display="");n._btnSortAsc=n.cloneElement(n._btnAsc);n._btnSortDsc=n.cloneElement(n._btnDsc);n._btnAsc.parentNode.replaceChild(n._btnSortAsc,n._btnAsc);n._btnDsc.parentNode.replaceChild(n._btnSortDsc,n._btnDsc);n._btnSortAsc.addEventListener("click",(function(e){n._sortBtnClick(e,!0)}));n._btnSortDsc.addEventListener("click",(function(e){n._sortBtnClick(e,!1)}));n._updateSortButtonStateUnbound();return n}Object.defineProperty(FlexSheetColumnFilterEditor,"controlTemplate",{get:function(){FlexSheetColumnFilterEditor._ctrlTemplate||(FlexSheetColumnFilterEditor._ctrlTemplate=wijmo_grid_filter_1.ColumnFilterEditor.controlTemplate);return FlexSheetColumnFilterEditor._ctrlTemplate},set:function(e){FlexSheetColumnFilterEditor._ctrlTemplate=e},enumerable:!0,configurable:!0});FlexSheetColumnFilterEditor.prototype._showFilter=function(t){var o=this;if(t==wijmo_grid_filter_1.FilterType.Value&&null==this._edtVal||this.filter.filterMode===wijmo_grid_filter_1.FilterMode.MultiFilter){this._edtVal=new FlexSheetValueFilterEditor(this._divEdtVal,this.filter.valueFilter);this.filter.filterMode!==wijmo_grid_filter_1.FilterMode.MultiFilter&&this._edtVal.canApplyChanged.addHandler((function(){wijmo_1.enable(o._btnApply,o._edtVal.canApply)}))}e.prototype._showFilter.call(this,t)};FlexSheetColumnFilterEditor.prototype._sortBtnClick=function(e,t){var o,i,n=this.filter.column,l=n.grid.sortManager,r=this.filter.column.grid,s=this.hostElement["$WJ-OWNR"]&&this.hostElement["$WJ-OWNR"]["wj-cell-index"];e.preventDefault();e.stopPropagation();if(s){var a=s.panel,h=s.rng;null===h&&(h=new wijmo_grid_1.CellRange(s.row,s.col,s.row,s.col));var u=new wijmo_grid_1.CellRangeEventArgs(a,h,e);if(r.onSortingColumn(u)){if((o=l.checkSortItemExists(n.index))>-1){l.sortDescriptions.moveCurrentToPosition(o);l.sortDescriptions.currentItem.ascending=t;i=-o}else{l.addSortLevel(n.index,t);i=-(l.sortDescriptions.items.length-1)}l.moveSortLevel(i);l.commitSort();r.onSortedColumn(u)}}this.onButtonClicked()};FlexSheetColumnFilterEditor.prototype.cloneElement=function(e){for(var t=e.cloneNode();e.firstChild;)t.appendChild(e.lastChild);return t};FlexSheetColumnFilterEditor.prototype._updateSortButtonStateUnbound=function(){var e=this.filter.column;if(e&&e.grid&&e.grid.selectedSheet)for(var t=e.grid.selectedSheet._unboundSortDesc,o=0;o<t.length;o++)if(t[o].column===e){wijmo_1.toggleClass(this._btnSortAsc,wijmo_1.ControlStateClsNames.active,!0===t[o].ascending);wijmo_1.toggleClass(this._btnSortDsc,wijmo_1.ControlStateClsNames.active,!1===t[o].ascending);break}};FlexSheetColumnFilterEditor._ctrlTemplate="";return FlexSheetColumnFilterEditor}(wijmo_grid_filter_1.ColumnFilterEditor);exports.FlexSheetColumnFilterEditor=FlexSheetColumnFilterEditor;var FlexSheetFilter=function(e){__extends(FlexSheetFilter,e);function FlexSheetFilter(){return null!==e&&e.apply(this,arguments)||this}Object.defineProperty(FlexSheetFilter.prototype,"filterDefinition",{get:function(){for(var e={filters:[]},t=0;t<this._filters.length;t++){var o=this._filters[t];if(o&&o.column&&this.grid.columns.indexOf(o.column)>-1)if(o.conditionFilter.isActive){var i=o.conditionFilter;e.filters.push({columnIndex:o.column.index,type:"condition",condition1:{operator:i.condition1.operator,value:i.condition1.value},and:i.and,condition2:{operator:i.condition2.operator,value:i.condition2.value}})}else if(o.valueFilter.isActive){var n=o.valueFilter;e.filters.push({columnIndex:o.column.index,type:"value",filterText:n.filterText,showValues:n.showValues})}}return JSON.stringify(e)},set:function(e){var t=JSON.parse(wijmo_1.asString(e));this.clear();for(var o=0;o<t.filters.length;o++){var i=t.filters[o],n=this.grid.columns[i.columnIndex],l=this.getColumnFilter(n,!0);if(l)switch(i.type){case"condition":var r=l.conditionFilter;r.condition1.value=n.dataType==wijmo_1.DataType.Date?wijmo_1.changeType(i.condition1.value,n.dataType,null):i.condition1.value;r.condition1.operator=i.condition1.operator;r.and=i.and;r.condition2.value=n.dataType==wijmo_1.DataType.Date?wijmo_1.changeType(i.condition2.value,n.dataType,null):i.condition2.value;r.condition2.operator=i.condition2.operator;break;case"value":var s=l.valueFilter;s.filterText=i.filterText;s.showValues=i.showValues}}this.apply()},enumerable:!0,configurable:!0});FlexSheetFilter.prototype.apply=function(){var e=this;this.grid.deferUpdate((function(){for(var t,o,i,n=-1,l=0;l<e.grid.rows.length;l++){var r=!1;if(!((t=e.grid.rows[l])instanceof HeaderRow||l<=n)){n=-1;var s=e.excludedRowsSet;if(!e.reApplyFilterOnUpdate&&s.has(t.dataItem||t)){o=!0;r=!0}r||(o=e._filter(l));if(t instanceof wijmo_grid_1.GroupRow&&!t.isSummary){i=t.getCellRange();e.grid.groupSummaryPosition===wijmo_grid_1.GroupSummaryPosition.Auto&&i.row2--;if(null==t.dataItem||t.dataItem instanceof wijmo_1.CollectionViewGroup)t.visible=e._checkGroupVisible(i);else{t.visible=o;n=i.bottomRow;if(i.isValid)for(var a=i.topRow;a<=i.bottomRow;a++)e.grid.rows[a].visible=o}}else if(t instanceof wijmo_grid_1.GroupRow&&t.isSummary){a=l-1;for(var h=t.dataItem;a>=0;a--){var u=e.grid.rows[a],d=u.dataItem;if(u instanceof wijmo_grid_1.GroupRow&&!u.isSummary&&d.groupDescription==h.groupDescription&&d.name==h.name)break}a>=0&&(t.visible=e.grid.rows[a].visible)}else t.visible=o}}e.grid._isCopying||e.grid._isUndoing||e.grid._isSorting||e.onFilterApplied()}))};FlexSheetFilter.prototype.editColumnFilter=function(e,t){var o=this,i=this.grid;this.closeEditor();e=this._asColumn(e);var n=document.createElement("div"),l=this.getColumnFilter(e),r=new FlexSheetColumnFilterEditor(n,l,this.showSortButtons);wijmo_1.addClass(n,wijmo_input_1.DropDownClsNames.dropDownPanel);this._divEdt=n;this._edtCol=e;var s=new wijmo_grid_1.CellRangeEventArgs(i.cells,new wijmo_grid_1.CellRange(-1,e.index));this.onFilterChanging(s);if(s.cancel){this._divEdt=null;this._edtCol=null}else{s.cancel=!0;i.undoStack.stackSize>0&&(this._undoAcion=new _FilteringAction(i));i.rightToLeft&&(n.dir="rtl");r.filterChanged.addHandler((function(){s.cancel=!1;o._filterChanged=!0;setTimeout((function(){if(!s.cancel){o.excludedRowsSet=null;o.apply();if(o._undoAcion){o._undoAcion.saveNewState();i.undoStack._addAction(o._undoAcion);o._undoAcion=null}}}))}));r.buttonClicked.addHandler((function(){o.closeEditor();i.focus();o.onFilterChanged(s)}));r.lostFocus.addHandler((function(){setTimeout((function(){var e=wijmo_1.Control.getControl(o._divEdt);e&&!e.containsFocus()&&o.closeEditor()}),10)}));i._edtHdl._commitRowEdits();i.scrollIntoView(-1,e.index,!0);var a=this.grid.columnHeaders,h=t?t.row:a.rows.length-1,u=t?t.col:e.index,d=a.getCellBoundingRect(h,u),_=wijmo_1.deepElementFromPoint(d.left+d.width/2,d.top+d.height/2);(_=wijmo_1.closest(_,"."+wijmo_grid_1.FlexGridClsNames.cell))?wijmo_1.showPopup(n,_,!1,!1,!1):wijmo_1.showPopup(n,d);this._setAriaExpanded(_,!0);this._setAriaExpanded(i.cells.getCellElement(-1,u),!0);for(var c=r.hostElement.querySelectorAll("input"),g=0;g<c.length;g++){var f=c[g];if(f.offsetHeight>0&&f.tabIndex>-1&&!f.disabled){f.focus();break}}r.containsFocus()||r.focus()}};FlexSheetFilter.prototype._updateColumnFilter=function(e){e=this._asColumn(e);var t=this.getColumnFilter(e,!1),o=null!=t?t.valueFilter:null;if(o&&o.isActive){var i=this._getValueFilters(e),n=o.showValues;if(i&&i.length>0){for(var l in n)for(var r=0;r<i.length;r++){if(n[l]&&isSameRow(i[r].cellRef,n[l].cellRef)){n[i[r].text]={show:!0,cellRef:i[r].cellRef};i[r].text!=l&&delete n[l];break}if(i[r].text==l){n[l].show=!0;break}}o.showValues=n}}function isSameRow(e,t){return!(!e||!t)&&e.split("_")[0]===t.split("_")[0]}};FlexSheetFilter.prototype._getValueFilters=function(e,t){void 0===t&&(t=!0);var o=this.getColumnFilter(e,!1),i=o.valueFilter,n=e.grid,l=e.index,r=[],s={};if(i.uniqueValues||null!=n.itemsSource&&null!=n.childItemsPath)r=i.getUniqueValues(!0);else for(var a=0;a<n.rows.length;a++){var h=n.rows[a];if(!(h instanceof HeaderRow||h instanceof wijmo_grid_1.GroupRow||h instanceof wijmo_grid_1._NewRowTemplate)){if(t){var u=i.showValues,d=o.conditionFilter,_=d.condition1.operator,c=d.condition2.operator;i.showValues=null;if(o.filterMode===wijmo_grid_filter_1.FilterMode.SingleFilter){d.condition1.operator=null;d.condition2.operator=null}var g=n.filter._filter(a);i.showValues=u;if(o.filterMode===wijmo_grid_filter_1.FilterMode.SingleFilter){d.condition1.operator=_;d.condition2.operator=c}if(!h.visible&&!g)continue;if(!h.visible&&i.apply(a)&&d.apply(a))continue}var f=a,p=l,m=n.getMergedRange(n.cells,f,p);if(m){if(m.leftCol!==l)continue;f=m.topRow;p=m.leftCol}var w=n.getCellValue(f,p),C=void 0;C=i.dataMap?i.dataMap.getDisplayValue(w):n.getCellValue(f,p,!0);w=""===w?null:w;var S=n.getCellData(f,p,!0),b=void 0;if(!s[C]){s[C]=!0;b=S&&"="===S[0]?a+"_"+l:"";r.push({value:w,text:C,cellRef:b})}}}return r};FlexSheetFilter.prototype.closeEditor=function(){this._undoAcion&&!this._filterChanged&&(this._undoAcion=null);e.prototype.closeEditor.call(this)};FlexSheetFilter.prototype.getColumnFilter=function(e,t){void 0===t&&(t=!0);if(e=this._asColumn(e)){for(var o=0;o<this._filters.length;o++)if(this._filters[o].column==e)return this._filters[o];if(t){var i=new FlexSheetColumnFilter(this,e);this._filters.push(i);return i}}return null};FlexSheetFilter.prototype._isActive=function(){var e=this;return this._filters.some((function(t){return t.column&&(t.conditionFilter.isActive||t.valueFilter.isActive)&&e.grid.columns.indexOf(t.column)>=0}))};FlexSheetFilter.prototype._isEditorOpened=function(){return!!this._divEdt};FlexSheetFilter.prototype._checkGroupVisible=function(e){for(var t,o=!0,i=e.topRow+1;i<=e.bottomRow;i++)if(t=this.grid.rows[i])if(t instanceof wijmo_grid_1.GroupRow&&!t.isSummary)o=this._checkGroupVisible(t.getCellRange());else if(o=this._filter(i))break;return o};return FlexSheetFilter}(wijmo_grid_filter_1.FlexGridFilter);exports.FlexSheetFilter=FlexSheetFilter;var _SmartTag=function(e){__extends(_SmartTag,e);function _SmartTag(t,o,i,n){var l=e.call(this,t)||this;l.CopyCells=AutoFillOperation.CopyFormat|AutoFillOperation.CopyContent;l.FillSeries=AutoFillOperation.CopyFormat|AutoFillOperation.FillSeries;l.FillFormat=AutoFillOperation.CopyFormat;l.FillWithoutFormat=AutoFillOperation.FillSeries;l.FullWidth=32;l.CompactWidth=18;l._uiEventHdl=l._onUIEvent.bind(l);l.operationSelected=new wijmo_1.Event;l.cancelled=new wijmo_1.Event;l._owner=o;l._op=i;var r=l.getTemplate();l.applyTemplate(exports._SmartTagClsNames.hostElement,r,{_icon:"icon",_btnMenu:"btn-menu"});var s=l._getPos();wijmo_1.setCss(l.hostElement,{left:s.x,top:s.y});l.addEventListener(l.hostElement,"mouseover",(function(){l.hostElement.style.width=l.FullWidth+"px";l._btnMenu.style.display=""}));l.addEventListener(l.hostElement,"mouseleave",(function(){if(!l._menu){l.hostElement.style.width=l.CompactWidth+"px";l._btnMenu.style.display="none"}}));l.addEventListener(l.hostElement,"mousedown",(function(e){e.preventDefault();l._showFillOpMenu()}),!0);l.addEventListener(document.body,"mousedown",l._uiEventHdl,!0);l.addEventListener(document.body,"keydown",l._uiEventHdl,!0);l.initialize(n);return l}Object.defineProperty(_SmartTag,"controlTemplate",{get:function(){_SmartTag._ctrlTemplate||(_SmartTag._ctrlTemplate='<img wj-part="icon" style="float:left; height: 18; margin: 0" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAFJJREFUeNrclEEKACAIBOfp/Xy7i4WSRnRYBIVRVhFJVIhyEAxllQa5E/wBSnsU6Rza2nugqNmASi57C/KKNg/Iqn+iVWzx6M4bOdUEAAD//wMAAYRMfiNaiqEAAAAASUVORK5CYII=" /><img wj-part="btn-menu" style="float:left; height: 18; margin: 0; display: none" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAASCAYAAACXScT7AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAGCSURBVHjafNFPKKRxHAbw5/v7GYdBYUQjLm5SkoNykCQHtcx431/KgdKumJvSrAO7Nwc3RQ5kd3OkHJC/hUJREluonVcToqRh3sRFPA6M1Mbhc3z6Pj1fkMRHQNJL0uPeul731lU37o1y49cqHr8GvvgWQRLBsmpM/P0j4XAXiooKcXl1CZDEzl4EJBEwAZBUwWAQsVgsFSRR11gmM8trimSa3WypzZ31l5v2/vfk/4oAcv9aSGyUSz4gg/AIAOET0YQswIQWaNrnH+2OeSaY0BJN2+wDTi/OpCrwkxX1vW8q63p5cnaaB+Z/09u7x0nFJTVMiEajPsNCQaC6Ryb8THKcw/Tikho6zj//0RGUNV6gMZ1H8fmpH5iTHDlwsiOhO7FrN5RdP6aBIUj/pvJ2bkFbkxAzBzELELNCQQqgrJ5ST1/jqmYOJcHa7dYYGV5TrQ3d+vfUU+b7IfrOIRCGBYD0o1VGmaHaB6DZkqvMD2hUfF1UAISkvE/+yqbCZ89+HgBtwgFOrBUzJgAAAABJRU5ErkJggg==" />');return _SmartTag._ctrlTemplate},set:function(e){_SmartTag._ctrlTemplate=e},enumerable:!0,configurable:!0});_SmartTag.prototype.dispose=function(){this.removeEventListener(document.body,"mousedown",this._uiEventHdl,!0);this.removeEventListener(document.body,"keydown",this._uiEventHdl,!0);e.prototype.dispose.call(this)};Object.defineProperty(_SmartTag.prototype,"operation",{get:function(){return this._op},enumerable:!0,configurable:!0});_SmartTag.prototype.onOperationSelected=function(e){this.operationSelected.raise(this,e)};_SmartTag.prototype.onCancelled=function(e){this.cancelled.raise(this,e)};_SmartTag.prototype._getPos=function(){var e=this._owner,t=e._root,o=e.selection,i=e.cells.getCellBoundingRect(o.bottomRow,o.rightCol,!0),n=e.cells.hostElement,l=i.right+n.offsetLeft,r=i.bottom+n.offsetTop;l+e._ptScrl.x+32+(n.offsetHeight>t.offsetHeight?17:0)>t.offsetWidth&&(l-=32);r+e._ptScrl.y+18+(n.offsetWidth>t.offsetWidth?17:0)>t.offsetHeight&&(r-=18);return new wijmo_1.Point(l,r)};_SmartTag.prototype._showFillOpMenu=function(){var e=this,t=wijmo_1.culture.FlexSheet;this._menu=new wijmo_input_1.Menu(document.createElement("div"),{displayMemberPath:"item",selectedValuePath:"op",dropDownCssClass:exports._SmartTagClsNames.flexSheetFillMenu,openOnHover:!1,closeOnLeave:!1,itemsSource:[{item:t.copyCells,op:this.CopyCells,checked:this._op===this.CopyCells},{item:t.fillSeries,op:this.FillSeries,checked:this._op===this.FillSeries},{item:t.fillFormat,op:this.FillFormat,checked:this._op===this.FillFormat},{item:t.fillWithoutFormat,op:this.FillWithoutFormat,checked:this._op===this.FillWithoutFormat}],selectedValue:this._op,itemClicked:function(t){e._op=t.selectedValue;e.onOperationSelected()}});this._menu.listBox.checkedMemberPath="checked";this._menu.show(this.hostElement);this._menu.selectedValue=this._op};_SmartTag.prototype._onUIEvent=function(e){var t=e.target,o=wijmo_1.contains(this.hostElement,t),i=this._menu&&wijmo_1.contains(this._menu.listBox.hostElement,t),n=o||i;n&&e instanceof KeyboardEvent&&(n=i&&(e.keyCode==wijmo_1.Key.Down||e.keyCode==wijmo_1.Key.Up||e.keyCode==wijmo_1.Key.Enter||e.keyCode==wijmo_1.Key.Escape));n||this.onCancelled()};_SmartTag._ctrlTemplate="";return _SmartTag}(wijmo_1.Control);exports._SmartTag=_SmartTag;var _FlexSheetSelectionHandler=function(e){__extends(_FlexSheetSelectionHandler,e);function _FlexSheetSelectionHandler(t){var o=this,i=t.selectionMode;(o=e.call(this,t)||this)._mode=i;o._fs=t;return o}_FlexSheetSelectionHandler.prototype.moveSelection=function(t,o,i){var n=this._fs;!i&&n._lastSelMovePos&&this.selection.copy(n._lastSelMovePos);n._lastSelMovePos=null;e.prototype.moveSelection.call(this,t,o,i)};return _FlexSheetSelectionHandler}(wijmo_grid_1._SelectionHandler);exports._FlexSheetSelectionHandler=_FlexSheetSelectionHandler;var DefinedName=function(){function DefinedName(e,t,o,i){this._owner=e;this._name=t;this._value=o;if(null!=i){if(!e._validateSheetName(i))throw"The sheet name:("+i+") does not exist in FlexSheet.";this._sheetName=i}}Object.defineProperty(DefinedName.prototype,"name",{get:function(){return this._name},set:function(e){if(this._name!==e){if(this._owner.definedNames._find(e,this._sheetName,-1,!0))throw"The "+e+" already existed in definedNames.";var t=this._name;this._name=e;this._owner._updateFormulasWithNameUpdating(t,this._name)}},enumerable:!0,configurable:!0});Object.defineProperty(DefinedName.prototype,"value",{get:function(){return this._value},set:function(e){this._value!==e&&(this._value=e)},enumerable:!0,configurable:!0});Object.defineProperty(DefinedName.prototype,"sheetName",{get:function(){return this._sheetName},enumerable:!0,configurable:!0});return DefinedName}();exports.DefinedName=DefinedName;var DefinedNameCollection=function(e){__extends(DefinedNameCollection,e);function DefinedNameCollection(t){var o=e.call(this)||this;o._owner=t;o.collectionChanged.addHandler((function(e,t){if(t.action===wijmo_1.NotifyCollectionChangedAction.Add||t.action===wijmo_1.NotifyCollectionChangedAction.Change){var i=t.action===wijmo_1.NotifyCollectionChangedAction.Add?"inserted":"updated";if(!(t.item instanceof DefinedName)){o.remove(t.item);throw"Invalid defined name item object was "+i+". The DefinedName instance should be "+i+" in the definedNames array."}if(!t.item||!t.item.name||null==t.item.value){o.remove(t.item);throw"Invalid defined name was "+i+"."}if(null!=t.item.sheetName&&!o._owner._validateSheetName(t.item.sheetName)){o.remove(t.item);throw"The sheet name ("+t.item.sheetName+") does not exist in FlexSheet."}if(o._find(t.item.name,t.item.sheetName,t.index,!0)){o.remove(t.item);throw"The "+t.item.name+" already existed in definedNames."}}}));return o}DefinedNameCollection.prototype._find=function(e,t,o,i){void 0===o&&(o=-1);void 0===i&&(i=!1);var n=null;t=t?t.toLowerCase():t;e=e?e.toLowerCase():e;for(var l=0;l<this.length;l++){var r=this[l];if(r.name.toLowerCase()===e&&l!==o)if(r.sheetName){if(r.sheetName.toLowerCase()===t)return r}else{if(i&&t)continue;n=r}}return n};DefinedNameCollection.prototype._getIndexByName=function(e){for(var t=0;t<this.length;t++)if(this[t].name===e)return t;return-1};DefinedNameCollection.prototype._updateSheetName=function(e,t){for(var o=e.toLowerCase(),i=0;i<this.length;i++){var n=this[i];if(null!=n.sheetName&&n.sheetName.toLowerCase()===o){n._sheetName=t;n.value=n.value.replaceAll(e,t)}var l=n.value.match(/(\w+)!\$?[A-Za-z]+\$?\d+/g);if(l&&l.length>0)for(var r=0;r<l.length;r++){var s=l[r];s.substring(0,s.indexOf("!"))===e&&(n.value=n.value.replace(s,s.replace(e,t)))}}};return DefinedNameCollection}(wijmo_1.ObservableArray);exports.DefinedNameCollection=DefinedNameCollection;var _ContextMenu=function(e){__extends(_ContextMenu,e);function _ContextMenu(t,o){var i=e.call(this,t)||this;i._idx=-1;i._owner=o;return i}Object.defineProperty(_ContextMenu.prototype,"visible",{get:function(){return"none"!==this.hostElement.style.display},enumerable:!0,configurable:!0});_ContextMenu.prototype.show=function(e,t){if(this._owner.selectedSheet){this._owner.finishEditing();var o=(t?t.x:e.clientX)+(e?window.pageXOffset:0),i=(t?t.y:e.clientY)+(e?window.pageYOffset:0);this.hostElement.style.position="absolute";this.hostElement.style.display="inline";i+this.hostElement.clientHeight>window.innerHeight+(e?window.pageYOffset:0)&&(i-=this.hostElement.clientHeight);o+this.hostElement.clientWidth>window.innerWidth+(e?window.pageXOffset:0)&&(o-=this.hostElement.clientWidth);this.hostElement.style.top=i+"px";this.hostElement.style.left=o+"px"}};_ContextMenu.prototype.hide=function(){this._idx=-1;var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this.hostElement.style.display="none"};_ContextMenu.prototype.moveToNext=function(){var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this._idx++;for(;e[this._idx]&&("none"===e[this._idx].style.display||wijmo_1.hasClass(e[this._idx],wijmo_1.ControlStateClsNames.disabled));)this._idx++;this._idx>=e.length&&(this._idx=0);wijmo_1.addClass(e[this._idx],exports._ContextMenuClsNames.contextMenuItemSelected)};_ContextMenu.prototype.moveToPrev=function(){var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this._idx--;this._idx<0&&(this._idx=e.length-1);for(;this._idx>0&&("none"===e[this._idx].style.display||wijmo_1.hasClass(e[this._idx],wijmo_1.ControlStateClsNames.disabled));)this._idx--;wijmo_1.addClass(e[this._idx],exports._ContextMenuClsNames.contextMenuItemSelected)};_ContextMenu.prototype.moveToFirst=function(){var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this._idx=0;wijmo_1.addClass(e[this._idx],exports._ContextMenuClsNames.contextMenuItemSelected)};_ContextMenu.prototype.moveToLast=function(){var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._removeSelectedState(e);this._idx=e.length-1;e[this._idx]&&"none"===e[this._idx].style.display&&this._idx--;wijmo_1.addClass(e[this._idx],exports._ContextMenuClsNames.contextMenuItemSelected)};_ContextMenu.prototype.handleContextMenu=function(){if(-1===this._idx)this.moveToNext();else{var e=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this._handleMenuItemOperation(e);this.hide();this._owner.hostElement.focus()}};_ContextMenu.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this._localize()};_ContextMenu.prototype._init=function(){var e=this,t=this.hostElement.querySelectorAll("."+exports._ContextMenuClsNames.contextMenuItem);this.hostElement.style.zIndex="9999";document.body.appendChild(this.hostElement);this.addEventListener(document.body,"mousemove",(function(){e._removeSelectedState(t)}));this.addEventListener(this.hostElement,"contextmenu",(function(e){e.preventDefault()}));this._localize()};_ContextMenu.prototype._handleMenuItemOperation=function(e){};_ContextMenu.prototype._localize=function(){};_ContextMenu.prototype._removeSelectedState=function(e){for(var t=0;t<e.length;t++)wijmo_1.removeClass(e[t],exports._ContextMenuClsNames.contextMenuItemSelected)};return _ContextMenu}(wijmo_1.Control);exports._ContextMenu=_ContextMenu;var _SheetContextMenu=function(e){__extends(_SheetContextMenu,e);function _SheetContextMenu(t,o){var i=e.call(this,t,o)||this;i._isDisableDelRow=!1;i._isDisableConvertTable=!1;i.applyTemplate("",i.getTemplate(),{_insRows:"insert-rows",_delRows:"delete-rows",_insCols:"insert-columns",_delCols:"delete-columns",_splitter:"splitter",_convertTable:"convert-table"});i._init();return i}Object.defineProperty(_SheetContextMenu,"controlTemplate",{get:function(){_SheetContextMenu._ctrlTemplate||(_SheetContextMenu._ctrlTemplate='<div class="'+exports._ContextMenuClsNames.hostElement+" "+wijmo_1.ControlClsNames.hostElement+" "+exports._ContextMenuClsNames.flexSheetContextMenu+'" width="150px"><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="insert-rows"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="delete-rows"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="insert-columns"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="delete-columns"></div><div class='+wijmo_1.ControlStateClsNames.disabled+' wj-part="splitter" style="width:100%;height:1px;background-color:lightgray;"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="convert-table"></div></div>');return _SheetContextMenu._ctrlTemplate},set:function(e){_SheetContextMenu._ctrlTemplate=e},enumerable:!0,configurable:!0});_SheetContextMenu.prototype.show=function(t,o){if(this._owner.selectedSheet){if(this._owner._isDisableDeleteRow(this._owner.selection.topRow,this._owner.selection.bottomRow)){this._isDisableDelRow=!0;wijmo_1.addClass(this._delRows,wijmo_1.ControlStateClsNames.disabled)}this._showTableOperation();if(!this._owner.selection.isValid){this._isDisableConvertTable=!0;wijmo_1.addClass(this._convertTable,wijmo_1.ControlStateClsNames.disabled)}e.prototype.show.call(this,t,o)}};_SheetContextMenu.prototype.hide=function(){e.prototype.hide.call(this);this._isDisableDelRow=!1;this._isDisableConvertTable=!1;wijmo_1.removeClass(this._delRows,wijmo_1.ControlStateClsNames.disabled);wijmo_1.removeClass(this._convertTable,wijmo_1.ControlStateClsNames.disabled)};_SheetContextMenu.prototype._init=function(){var t=this;e.prototype._init.call(this);this.addEventListener(this._insRows,"click",(function(e){t._owner.insertRows();t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._delRows,"click",(function(e){t._isDisableDelRow||t._owner.deleteRows();t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._insCols,"click",(function(e){t._owner.insertColumns();t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._delCols,"click",(function(e){t._owner.deleteColumns();t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._convertTable,"click",(function(e){t._isDisableConvertTable||t._addTable();t.hide();t._owner.hostElement.focus()}))};_SheetContextMenu.prototype._handleMenuItemOperation=function(e){switch(e[this._idx]){case this._insCols:this._owner.insertColumns();break;case this._insRows:this._owner.insertRows();break;case this._delCols:this._owner.deleteColumns();break;case this._delRows:this._isDisableDelRow||this._owner.deleteRows();break;case this._convertTable:this._addTable()}};_SheetContextMenu.prototype._localize=function(){e.prototype._localize.call(this);var t=wijmo_1.culture.FlexSheet;this._insRows.textContent=t.insertRow;this._delRows.textContent=t.deleteRow;this._insCols.textContent=t.insertCol;this._delCols.textContent=t.deleteCol;this._convertTable.textContent=t.convertTable};_SheetContextMenu.prototype._showTableOperation=function(){for(var e=this._owner.selection,t=e.topRow;t<=e.bottomRow;t++)for(var o=e.leftCol;o<=e.rightCol;o++){if(null!=this._owner.selectedSheet.findTable(t,o)){this._convertTable.style.display="none";this._splitter.style.display="none";return}}if(e.isSingleCell||this._owner._containsMergedCells(e)){this._convertTable.style.display="none";this._splitter.style.display="none"}else{this._convertTable.style.display="";this._splitter.style.display=""}};_SheetContextMenu.prototype._addTable=function(){var e=this._owner.selectedSheet._addTable(this._owner.selection);if(e){if(0===this._owner.undoStack.stackSize)return;var t=new _TableAction(this._owner,e);this._owner.undoStack._addAction(t)}};_SheetContextMenu._ctrlTemplate="";return _SheetContextMenu}(_ContextMenu);exports._SheetContextMenu=_SheetContextMenu;var _SheetTabContextMenu=function(e){__extends(_SheetTabContextMenu,e);function _SheetTabContextMenu(t,o){var i=e.call(this,t,o)||this;i.applyTemplate("",i.getTemplate(),{_insSheet:"insert-sheet",_delSheet:"delete-sheet",_renameSheet:"rename-sheet"});i._init();return i}Object.defineProperty(_SheetTabContextMenu,"controlTemplate",{get:function(){_SheetTabContextMenu._ctrlTemplate||(_SheetTabContextMenu._ctrlTemplate='<div class="'+exports._ContextMenuClsNames.hostElement+" "+wijmo_1.ControlClsNames.hostElement+" "+exports._ContextMenuClsNames.flexSheetContextMenu+'" width="150px"><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="insert-sheet"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="delete-sheet"></div><div class="'+exports._ContextMenuClsNames.contextMenuItem+'" wj-part="rename-sheet"></div><div>');return _SheetTabContextMenu._ctrlTemplate},set:function(e){_SheetTabContextMenu._ctrlTemplate=e},enumerable:!0,configurable:!0});_SheetTabContextMenu.prototype._init=function(){var t=this,o=wijmo_1.culture.FlexSheet;this._insSheet.textContent=o.insertSheet;this._delSheet.textContent=o.deleteSheet;this._renameSheet.textContent=o.renameSheet;e.prototype._init.call(this);this.addEventListener(this._insSheet,"click",(function(e){t._owner.addUnboundSheet(null,null,null,t._owner.selectedSheetIndex);t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._delSheet,"click",(function(e){t._owner.sheets.removeAt(t._owner.selectedSheetIndex);t.hide();t._owner.hostElement.focus()}));this.addEventListener(this._renameSheet,"click",(function(e){t._owner._tabHolder.sheetControl._startEditingSheetName(t._owner.selectedSheetIndex);t.hide()}))};_SheetTabContextMenu.prototype._handleMenuItemOperation=function(e){switch(e[this._idx]){case this._insSheet:this._owner.addUnboundSheet(null,null,null,this._owner.selectedSheetIndex);break;case this._delSheet:this._owner.sheets.removeAt(this._owner.selectedSheetIndex);break;case this._renameSheet:this._owner._tabHolder.sheetControl._startEditingSheetName(this._owner.selectedSheetIndex)}};_SheetTabContextMenu.prototype._localize=function(){e.prototype._localize.call(this);var t=wijmo_1.culture.FlexSheet;this._insSheet.textContent=t.insertSheet;this._delSheet.textContent=t.deleteSheet;this._renameSheet.textContent=t.renameSheet};_SheetTabContextMenu._ctrlTemplate="";return _SheetTabContextMenu}(_ContextMenu);exports._SheetTabContextMenu=_SheetTabContextMenu;var Sheet=function(){function Sheet(e,t,o,i,n){var l=this;this._visible=!0;this._unboundSortDesc=new wijmo_1.ObservableArray;this._currentStyledCells={};this._currentMergedRanges=[];this._isEmptyGrid=!1;this._rowSettings=[];this._scrollPosition=new wijmo_1.Point;this._ownerHeaderRowRemoved=!1;this.workingAs="";this.nameChanged=new wijmo_1.Event;this.visibleChanged=new wijmo_1.Event;this._uuid=Sheet.GenId++;this._owner=e;this._name=o;this._sortList=[new ColumnSortDescription(-1,!0)];i=wijmo_1.isNumber(i)&&!isNaN(i)&&i>=0?i:200;n=wijmo_1.isNumber(n)&&!isNaN(n)&&n>=0?n:20;if(t){t.columns.forEach((function(e){e._orgHdr=e._hdr}));this._grid=t;this._addHeaderRow(!0)}else{this._grid=this._createGrid(i,n);this._owner&&(this._grid.validateEdits=this._owner.validateEdits)}this._grid.loadedRows.addHandler((function(){l._owner&&l._owner._checkCollectionsOwner();l._addHeaderRow();l._setRowSettings()}));this._grid.refreshed.addHandler((function(){l._owner&&l._owner._checkCollectionsOwner()}));this._grid.itemsSourceChanged.addHandler(this._gridItemsSourceChanged,this);this._unboundSortDesc.collectionChanged.addHandler((function(){for(var e=l._unboundSortDesc,t={},o=0;o<e.length;o++){if(!wijmo_1.tryCast(e[o],_UnboundSortDescription))throw"sortDescriptions array must contain SortDescription objects."}if(l._owner){l._owner.rows.beginUpdate();l._owner.rows.sort(l._compareRows());if(!l._owner._isUndoing){for(o=0;o<l._owner.rows.length;o++){var i=l._owner.rows[o];o!==i._idx&&l._owner._updateFormulaForReorderingRows(i._idx,o);l._owner._updateCellStyleForReorderingRows(i._idx,o,t)}l._currentStyledCells=t}l._owner.rows.endUpdate();l._owner.rows._dirty=!0;l._owner.rows._update();if(l._owner.selectedSheet){l._owner._copyTo(l._owner.selectedSheet);l._owner._copyFrom(l._owner.selectedSheet)}}}));this.tables.collectionChanged.addHandler((function(e,t){if(null!=t.item&&!(t.item instanceof Table))throw"The tables only allows to handle Table instance.";if(l._owner)if(t.action===wijmo_1.NotifyCollectionChangedAction.Add||t.action===wijmo_1.NotifyCollectionChangedAction.Change){if(t.item){var o=t.item,i=o._getTableRange(),n=l===l._owner.selectedSheet?l._owner:l.grid;try{if(i.topRow>=n.rows.length||i.leftCol>=n.columns.length)throw"";if(i.leftCol+i.columnSpan>n.columns.length)throw"";if(i.topRow+i.rowSpan>n.rows.length)throw"";for(var r=i.topRow;r<=i.bottomRow;r++)for(var s=i.leftCol;s<=i.rightCol;s++){if(l.findTable(r,s)!==o)throw""}o._attachSheet(l)}catch(e){l.tables.removeAt(t.index)}}}else t.action===wijmo_1.NotifyCollectionChangedAction.Remove&&t.item&&t.item._detachSheet()}))}Object.defineProperty(Sheet.prototype,"grid",{get:function(){null==this._grid.wj_sheetInfo&&(this._grid.wj_sheetInfo={});return this._grid},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"name",{get:function(){return this._name},set:function(e){if(!wijmo_1.isNullOrWhiteSpace(e)&&(this._name&&this._name.toLowerCase()!==e.toLowerCase()||!this._name)){var t=new wijmo_1.PropertyChangedEventArgs("sheetName",this._name,e);this._name=e;this.grid.wj_sheetInfo.name=e;this.onNameChanged(t)}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"visible",{get:function(){return this._visible},set:function(e){if(this._visible!==e){this._visible=e;this.grid.wj_sheetInfo.visible=e;this.onVisibleChanged(new wijmo_1.EventArgs)}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"rowCount",{get:function(){return null!=this._grid?this._grid.rows.length:0},set:function(e){if(!this.itemsSource){var t=this.grid.rows.length;if(wijmo_1.isNumber(e)&&!isNaN(e)&&e>=0&&t!==e){if(t<e)for(var o=0;o<e-t;o++)this.grid.rows.push(new wijmo_grid_1.Row);else this.grid.rows.splice(e,t-e);this._currentStyledCells=this._adjustStylesDict(this._currentStyledCells);this._owner&&this._owner.selectedSheet&&this._name===this._owner.selectedSheet.name&&this._owner._copyFrom(this)}}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"columnCount",{get:function(){return null!=this._grid?this._grid.columns.length:0},set:function(e){if(!this.itemsSource){var t=this.grid.columns.length;if(wijmo_1.isNumber(e)&&!isNaN(e)&&e>=0&&t!==e){if(t<e)for(var o=0;o<e-t;o++)this._grid.columns.push(new wijmo_grid_1.Column);else this._grid.columns.splice(e,t-e);this._currentStyledCells=this._adjustStylesDict(this._currentStyledCells);this._owner&&this._owner.selectedSheet&&this._name===this._owner.selectedSheet.name&&this._owner._copyFrom(this)}}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"selectionRanges",{get:function(){var e=this;if(!this._selectionRanges){this._selectionRanges=new wijmo_1.ObservableArray;this._selectionRanges.collectionChanged.addHandler((function(){if(e._owner&&!e._owner._isClicking){var t=e._selectionRanges.length;if(t>0){var o=e._selectionRanges[t-1];o&&o instanceof wijmo_grid_1.CellRange&&(e._owner.selection=o)}if(t>1){e._owner._enableMulSel=!0;e._owner.refresh(!1)}e._owner._enableMulSel=!1}}),this)}return this._selectionRanges},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"itemsSource",{get:function(){return null!=this._grid?this._grid.itemsSource:null},set:function(e){if(!this._grid||this._grid.itemsSource!=e){this._owner&&this._owner._isCopying||(this._dataView=null);this._isEmptyGrid&&this._clearGrid();this._grid.itemsSource=e}},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"filterSetting",{get:function(){this._owner&&this===this._owner.selectedSheet&&this._getFilterSetting();return this._filterSetting},set:function(e){this._filterSetting=e;this._owner&&this===this._owner.selectedSheet&&this._applyFilterSetting()},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"tables",{get:function(){null==this._tables&&(this._tables=new wijmo_1.ObservableArray);return this._tables},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"_styledCells",{get:function(){this._currentStyledCells||(this._currentStyledCells={});this._currentStyledCells.columnCount=this.columnCount;this._currentStyledCells.rowCount=this.rowCount;return this._currentStyledCells},set:function(e){this._currentStyledCells=e},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"_uid",{get:function(){return this._uuid},enumerable:!0,configurable:!0});Object.defineProperty(Sheet.prototype,"_mergedRanges",{get:function(){this._currentMergedRanges||(this._currentMergedRanges=[]);return this._currentMergedRanges},enumerable:!0,configurable:!0});Sheet.prototype.onNameChanged=function(e){this.nameChanged.raise(this,e)};Sheet.prototype.onVisibleChanged=function(e){this.visibleChanged.raise(this,e)};Sheet.prototype.dispose=function(){this._clearGrid();this._grid.wj_sheetInfo=null;this._grid.dispose();this._grid=null;if(null!=this._tables){for(var e=0;e<this._tables.length;e++)this._tables[e]=null;this._tables=null}};Sheet.prototype.getCellStyle=function(e,t){var o=this._grid.rows.length,i=this._grid.columns.length;if(e>=o||t>=i)return null;var n=e*i+t;return this._styledCells[n]};Sheet.prototype.addTableFromArray=function(e,t,o,i,n,l,r,s){void 0===s&&(s=!0);var a=!1;if(this._owner){if(null==o||0===o.length)throw"Invalid array to load.";if(!(null!=i&&0!==i.length||null!=(i=Object.keys(o[0]))&&0!==i.length))throw"Invalid array to load.";if(e>=this.rowCount||t>=this.columnCount)return null;for(var h=null==(r&&r.showHeaderRow)||r.showHeaderRow,u=!(!r||!r.showTotalRow),d=e+(h?1:0),_=d+o.length-1+(u?1:0),c=[],g=this._flex,f=0;f<i.length;f++){var p=i[f],m=new TableColumn(p);0===f?m._totalRowLabel="Total":f===i.length-1&&(m._totalRowFunction="Sum");c.push(m)}var w=new wijmo_grid_1.CellRange(e,t,_,t+i.length-1),C=this._needShiftForTable(w);if(0!==C){if(!s)return null;if(!this._canShiftCells(w))return null;var S=this._needAddRowCountForAddTable(C,w);if(g.collectionView){var b=g.itemsSource instanceof wijmo_1.CollectionView;g.collectionView.beginUpdate();for(var v=0;v<S;v++)b?g.itemsSource.sourceCollection.push({}):g.itemsSource.push({});g.collectionView.endUpdate(!0)}else for(v=0;v<S;v++)g.rows.push(new wijmo_grid_1.Row);a=!0}if(t+i.length>=g.columns.length){if(!s)return null;var y=t+i.length-g.columns.length+1;if(this.itemsSource&&y>0)return null;g.columns.beginUpdate();for(v=0;v<y;v++)g.columns.push(new wijmo_grid_1.Column);g.columns.endUpdate()}g.beginUpdate();a&&this._moveDownCells(C,w);if(h)for(f=0;f<i.length;f++){p=i[f];g.setCellData(e,t+f,p)}for(var x=0;x<o.length;x++)for(f=0;f<i.length;f++){p=i[f];g.setCellData(d+x,t+f,o[x][p])}g.endUpdate();return this._addTable(w,n,l,c,r)}};Sheet.prototype.findTable=function(e,t){var o=this._tables;if(o&&o.length>0)for(var i=o.length,n=0;n<i;n++){var l=o[n],r=l._getTableRange();if(e>=r.topRow&&e<=r.bottomRow&&t>=r.leftCol&&t<=r.rightCol)return l}return null};Sheet.prototype._attachOwner=function(e){var t=this;if(this._owner!==e){this._owner=e;if(this._owner){var o=!1;this._owner.loadedRows.addHandler((function(){if(!o){o=!0;t._addHeaderRow()}}))}}};Sheet.prototype._setValidName=function(e){this._name=e;this.grid.wj_sheetInfo.name=e};Sheet.prototype._storeRowSettings=function(){if(this._owner){this._rowSettings=[];for(var e=0;e<this._grid.rows.length;e++){var t=this._owner.rows[e];t&&(this._rowSettings[e]={height:t.height,allowMerging:t.allowMerging,isCollapsed:t instanceof wijmo_grid_1.GroupRow?t.isCollapsed:null,visible:t.visible,isSelected:t.isSelected,readOnly:t.isReadOnly&&!(t instanceof HeaderRow)})}}};Sheet.prototype._setRowSettings=function(){for(var e=0;e<this._rowSettings.length;e++){var t=this._rowSettings[e];if(t){var o=this._grid.rows[e];if(o){var i=o instanceof HeaderRow;o.height=t.height;o.allowMerging=t.allowMerging;o.visible=t.visible;o instanceof wijmo_grid_1.GroupRow&&(o.isCollapsed=!!t.isCollapsed);o.isSelected=!!t.isSelected;o.isReadOnly=i||!!t.readOnly}}}};Sheet.prototype._addTable=function(e,t,o,i,n){if(!e.isValid||!this._owner)return null;null!=t&&null==this._owner._getTable(t)||(t=this._getUniqueTableName());var l=new Table(t,e,o,i,n);this.tables.push(l);return l};Sheet.prototype._addSelection=function(e){var t=this.selectionRanges;t.beginUpdate();for(var o=t.length-1;o>=0;o--)e.contains(t[o])&&t.removeAt(o);e.isValid&&t.push(e);t.endUpdate()};Object.defineProperty(Sheet.prototype,"_flex",{get:function(){return this===this._owner.selectedSheet?this._owner:this.grid},enumerable:!0,configurable:!0});Sheet.prototype._compareRows=function(){var e=this,t=this._unboundSortDesc;return function(o,i){for(var n=0;n<t.length;n++){var l=t[n],r=o._ubv&&l.column?o._ubv[l.column._hash]:"",s=i._ubv&&l.column?i._ubv[l.column._hash]:"";_isFormula(r)&&(r=e._owner.evaluate(r));_isFormula(s)&&(s=e._owner.evaluate(s));r!=r&&(r=null);s!=s&&(s=null);wijmo_1.isString(r)&&(r=r.toLowerCase()+r);wijmo_1.isString(s)&&(s=s.toLowerCase()+s);if(""===r||null==r)return 1;if(""===s||null==s)return-1;var a=r<s?-1:r>s?1:0;wijmo_1.isString(r)&&wijmo_1.isNumber(s)&&(a=1);wijmo_1.isString(s)&&wijmo_1.isNumber(r)&&(a=-1);if(0!==a)return l.ascending?+a:-a}return 0}};Sheet.prototype._createGrid=function(e,t){var o=document.createElement("div");this._isEmptyGrid=!0;o.style.visibility="hidden";document.body.appendChild(o);var i=new wijmo_grid_1.FlexGrid(o);document.body.removeChild(o);for(var n=0;n<e;n++)i.rows.push(new wijmo_grid_1.Row);for(var l=0;l<t;l++){var r=new wijmo_grid_1.Column;r.isRequired=!1;i.columns.push(r)}i.wj_sheetInfo={name:this.name,visible:this.visible,styledCells:this._styledCells,mergedRanges:this._mergedRanges};return i};Sheet.prototype._clearGrid=function(){this._grid.rows.clear();this._grid.columns.clear();this._grid.columnHeaders.columns.clear();this._grid.rowHeaders.rows.clear()};Sheet.prototype._gridItemsSourceChanged=function(){var e=this;if(this._owner&&!this._owner._isCopying&&this._owner.selectedSheet&&this._name===this._owner.selectedSheet.name){this._owner.filter.clear();this._owner._copyFrom(this,!1);setTimeout((function(){e._owner._setFlexSheetToDirty();e._owner.invalidate()}),10)}};Sheet.prototype._addHeaderRow=function(e){void 0===e&&(e=!1);if(this._needAddHeaderRow()||e){var t=new HeaderRow;t.isReadOnly=!0;for(var o=0;o<this._grid.columns.length;o++){var i=this._grid.columns[o];t._ubv||(t._ubv={});t._ubv[i._hash]=FlexSheet._getHeaderRowText(i)}this._grid.rows.insert(0,t)}};Sheet.prototype._needAddHeaderRow=function(){var e=this._grid.allowAddNew&&this._grid.newRowAtTop?this._grid.rows[1]:this._grid.rows[0];return!(!this._grid.collectionView||e instanceof HeaderRow)&&(null==this._owner||!this._owner.rows.length||((this._owner.allowAddNew&&this._owner.newRowAtTop?this._owner.rows[1]:this._owner.rows[0])instanceof HeaderRow||!this._ownerHeaderRowRemoved))};Sheet.prototype._getUniqueTableName=function(){for(var e="Table1",t=2;;){if(null==this._owner._getTable(e))break;e="Table"+t;t++}return e};Sheet.prototype._needShiftForTable=function(e){for(var t=0,o=0,i=this._flex,n=e.topRow;n<=e.bottomRow;n++){if(n>=i.rows.length)return t=e.rowSpan-o;for(var l=e.leftCol;l<=e.rightCol&&l<i.columns.length;l++){var r=i.getCellData(n,l,!1);if(null!=r&&""!==r)return t=e.rowSpan-o}o++}return t};Sheet.prototype._needAddRowCountForAddTable=function(e,t){for(var o=this._flex,i=1;i<=e;i++)for(var n=o.rows.length-i,l=t.leftCol;l<=t.rightCol&&l<o.columns.length;l++){var r=o.getCellData(n,l,!1),s=this.getCellStyle(n,l);if(null!=r&&""!==r||null!=s)return e-i+1}return 0};Sheet.prototype._moveDownTable=function(e){for(var t=e._getTableRange(),o=this._flex,i=t.bottomRow;i>=t.topRow;i--)for(var n=t.leftCol;n<=t.rightCol;n++){var l=null!=o.columns[n].dataMap,r=o.getCellData(i,n,l);o.setCellData(i+1,n,r);o.setCellData(i,n,"")}e._updateTableRange(1,1,0,0)};Sheet.prototype._moveDownCells=function(e,t){for(var o=this._flex,i=o.rows.length-1-e;i>=t.topRow;i--)for(var n=t.leftCol;n<=t.rightCol&&n<o.columns.length;n++){var l=null!=o.columns[n].dataMap,r=o.getCellData(i,n,l);o.setCellData(i+e,n,r);o.setCellData(i,n,"");var s=this.getCellStyle(i,n),a=(i+e)*o.columns.length+n,h=i*o.columns.length+n;if(s){this._styledCells[a]=s;this._styledCells[h]=null}var u=this._mergedRanges[h];if(u){u.row+=e;u.row2+=e;this._mergedRanges[a]=u;this._mergedRanges[h]=null}var d=this.findTable(i,n);if(d){var _=d._getTableRange();_.topRow===i&&_.leftCol===n&&d._updateTableRange(e,e,0,0)}}};Sheet.prototype._moveUpCells=function(e,t){for(var o=this._flex,i=t.topRow;i<o.rows.length;i++)for(var n=t.leftCol;n<=t.rightCol&&n<o.columns.length;n++){var l=null!=o.columns[n].dataMap,r=o.getCellData(i,n,l);o.setCellData(i-e,n,r);o.setCellData(i,n,"");var s=this.getCellStyle(i,n),a=(i-e)*o.columns.length+n,h=i*o.columns.length+n;if(s){this._styledCells[a]=s;this._styledCells[h]=null}var u=this._mergedRanges[h];if(u){u.row-=e;u.row2-=e;this._mergedRanges[a]=u;this._mergedRanges[h]=null}var d=this.findTable(i,n);if(d){var _=d._getTableRange();_.topRow===i&&_.leftCol===n&&d._updateTableRange(-e,-e,0,0)}}};Sheet.prototype._moveDownCellsWithinTable=function(e,t,o){for(var i=this._flex,n=o.bottomRow;n>o.topRow+e;n--)for(var l=o.leftCol;l<=o.rightCol;l++){var r=null!=i.columns[l].dataMap,s=i.getCellData(n,l,r);i.setCellData(n+t,l,s);i.setCellData(n,l,"")}};Sheet.prototype._moveUpCellsWithinTable=function(e,t,o){for(var i=o.topRow+e,n=this._flex,l=i;l<=o.bottomRow;l++)for(var r=o.leftCol;r<=o.rightCol;r++){if(l>=i+t){var s=null!=n.columns[r].dataMap,a=n.getCellData(l,r,s);n.setCellData(l-t,r,a)}n.setCellData(l,r,"")}};Sheet.prototype._canShiftCells=function(e){for(var t=this._flex,o=e.topRow;o<t.rows.length;o++)for(var i=e.leftCol;i<=e.rightCol&&i<t.columns.length;i++){var n=this.findTable(o,i);if(n){var l=n._getTableRange();if(l.leftCol<e.leftCol||l.rightCol>e.rightCol)return!1}var r=o*t.columns.length+i,s=this._mergedRanges[r];if(s&&(s.leftCol<e.leftCol||s.rightCol>e.rightCol))return!1}return!0};Sheet.prototype._needMoveDownTable=function(e){var t=e.getRange();if(0===t.topRow)return!0;for(var o=e.getColumns(),i=this._flex,n=0;n<o.length;n++){var l=i.getCellData(t.topRow-1,t.leftCol+n,!1);if(null!=l&&""!==l)return!0}return!1};Sheet.prototype._needAddRowCountForInsertTableRows=function(e,t){for(var o=this._flex,i=1;i<=e;i++){var n=o.rows.length-i;if(n<=t.bottomRow)return e;for(var l=t.leftCol;l<=t.rightCol&&l<o.columns.length;l++){var r=o.getCellData(n,l,!1),s=this.getCellStyle(n,l);if(null!=r&&""!==r||null!=s)return e-i+1}}return 0};Sheet.prototype._getFilterSetting=function(){this._filterDefinition=this._owner.filter.filterDefinition;this._filterSetting={};this._filterSetting.filterColumns=this._owner.filter.filterColumns;this._filterSetting.columnFilterSettings||(this._filterSetting.columnFilterSettings=[]);for(var e=0;e<this._owner.filter._filters.length;e++){var t=this._owner.filter._filters[e];t&&this._filterSetting.columnFilterSettings.push({column:t.column,filterType:t.filterType,dataMap:t.dataMap,valueFilterSetting:{maxValues:t.valueFilter.maxValues,uniqueValues:t.valueFilter.uniqueValues,sortValues:t.valueFilter.sortValues,dataMap:t.valueFilter.dataMap,exclusiveValueSearch:t.valueFilter.exclusiveValueSearch},conditionFilterSetting:{dataMap:t.conditionFilter.dataMap}})}};Sheet.prototype._applyFilterSetting=function(){if(null==this._filterSetting)this._clearFilterSetting();else{this._owner.filter.filterColumns=this._filterSetting.filterColumns;this._filterDefinition&&(this._owner.filter.filterDefinition=this._filterDefinition);var e=this._filterSetting.columnFilterSettings;if(!e||!e.length)return;for(var t=0;t<e.length;t++){var o=e[t];if(o&&null!=o.column){var i=this._owner.filter.getColumnFilter(o.column);if(i){var n=i.valueFilter.showValues,l=i.valueFilter.filterText,r={operator:i.conditionFilter.condition1.operator,value:i.conditionFilter.condition1.value},s={operator:i.conditionFilter.condition2.operator,value:i.conditionFilter.condition2.value},a=i.conditionFilter.and;null!=o.dataMap&&(i.dataMap=o.dataMap);null!=o.filterType&&(i.filterType=o.filterType);var h=o.valueFilterSetting;if(h){h.dataMap&&(i.valueFilter.dataMap=h.dataMap);null!=h.maxValues&&(i.valueFilter.maxValues=h.maxValues);null!=h.sortValues&&(i.valueFilter.sortValues=h.sortValues);h.uniqueValues&&(i.valueFilter.uniqueValues=h.uniqueValues);i.valueFilter.exclusiveValueSearch=h.exclusiveValueSearch}var u=o.conditionFilterSetting;u&&u.dataMap&&(i.conditionFilter.dataMap=u.dataMap);i.valueFilter.showValues=n;i.valueFilter.filterText=l;i.conditionFilter.condition1.operator=r.operator;i.conditionFilter.condition1.value=r.value;i.conditionFilter.condition2.operator=s.operator;i.conditionFilter.condition2.value=s.value;i.conditionFilter.and=a}}}}};Sheet.prototype._cloneMergedCells=function(){for(var e=[],t=0;t<this._mergedRanges.length;t++){var o=this._mergedRanges[t];e.push(o.clone())}return e};Sheet.prototype._getMergedRange=function(e,t){for(var o=0;o<this._mergedRanges.length;o++){var i=this._mergedRanges[o];if(e>=i.topRow&&e<=i.bottomRow&&t>=i.leftCol&&t<=i.rightCol)return i}return null};Sheet.prototype._clearFilterSetting=function(){this._owner.filter._filters=[];this._owner.filter.filterColumns=null;this._filterDefinition&&(this._owner.filter.filterDefinition=this._filterDefinition)};Sheet.prototype._adjustStylesDict=function(e){if(e){var t=e.columnCount,o=e.rowCount,i=this.columnCount,n=this.rowCount;if(t&&t!=i||o&&o!=n){var l={};Object.keys(e).forEach((function(o){var r=+o;if(!isNaN(r)){var s=Math.floor(r/t),a=r%t;s<n&&a<i&&(l[s*i+a]=e[o]);delete e[o]}}));e=l}e.columnCount=i;e.rowCount=n;return e}};Sheet.GenId=0;return Sheet}();exports.Sheet=Sheet;var SheetCollection=function(e){__extends(SheetCollection,e);function SheetCollection(){var t=null!==e&&e.apply(this,arguments)||this;t._current=-1;t.sheetCleared=new wijmo_1.Event;t.selectedSheetChanged=new wijmo_1.Event;t.sheetNameChanged=new wijmo_1.Event;t.sheetVisibleChanged=new wijmo_1.Event;return t}SheetCollection.prototype.onSheetCleared=function(){this.sheetCleared.raise(this)};Object.defineProperty(SheetCollection.prototype,"selectedIndex",{get:function(){return this._current},set:function(e){this._moveCurrentTo(+e)},enumerable:!0,configurable:!0});SheetCollection.prototype.onSelectedSheetChanged=function(e){this.selectedSheetChanged.raise(this,e)};SheetCollection.prototype.push=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];for(var i=0;i<t.length;i++){var n=t[i].name?this.getValidSheetName(t[i]):this._getUniqueName();n!==t[i].name&&(t[i].name=n);e.prototype.push.call(this,t[i]);this._postprocessSheet(t[i])}return this.length};SheetCollection.prototype.splice=function(t,o){for(var i=this,n=[],l=2;l<arguments.length;l++)n[l-2]=arguments[l];n.forEach((function(e){if(e instanceof Sheet&&"Angular"===e.workingAs)requestAnimationFrame((function(){e.name=e.name?i.getValidSheetName(e):i._getUniqueName();i._postprocessSheet(e)}));else{e.name=e.name?i.getValidSheetName(e):i._getUniqueName();i._postprocessSheet(e)}}));return e.prototype.splice.apply(this,[t,o].concat(n))};SheetCollection.prototype.onCollectionChanged=function(t){this._current>=this.length&&(this._current=this.length-1);e.prototype.onCollectionChanged.call(this,t)};SheetCollection.prototype.onSheetNameChanged=function(e){this.sheetNameChanged.raise(this,e)};SheetCollection.prototype.onSheetVisibleChanged=function(e){this.sheetVisibleChanged.raise(this,e)};SheetCollection.prototype.selectFirst=function(){return this._moveCurrentTo(0)};SheetCollection.prototype.selectLast=function(){return this._moveCurrentTo(this.length-1)};SheetCollection.prototype.selectPrevious=function(){return this._moveCurrentTo(this._current-1)};SheetCollection.prototype.selectNext=function(){return this._moveCurrentTo(this._current+1)};SheetCollection.prototype.hide=function(e){if(e<0&&e>=this.length)return!1;if(!this[e].visible)return!1;this[e].visible=!1;return!0};SheetCollection.prototype.show=function(e){if(e<0&&e>=this.length)return!1;this[e].visible=!0;this._moveCurrentTo(e);return!0};SheetCollection.prototype.clear=function(){for(var t=0;t<this.length;t++){var o=this[t];o.dispose();o=null}e.prototype.clear.call(this);this._current=-1;this.onSheetCleared()};SheetCollection.prototype.isValidSheetName=function(e){var t=this._getSheetIndexFrom(e.name),o=this.indexOf(e);return-1===t||t===o};SheetCollection.prototype.getValidSheetName=function(e){for(var t=e.name,o=1,i=this.indexOf(e);;){var n=this._getSheetIndexFrom(t);if(-1===n||n===i)break;t=e.name.concat((o+1).toString());o++}return t};SheetCollection.prototype.getUniqueNameOnInit=function(){for(var e="Sheet1",t=1;;){if(-1===this._getSheetIndexFrom(e))break;e="Sheet"+t;t++}return e};SheetCollection.prototype._setCurrentIdx=function(e){this._current=e};SheetCollection.prototype._moveCurrentTo=function(e){var t=e;if(e<0||e>=this.length)return!1;if(this._current<t||0===t)for(;t<this.length&&!this[t].visible;)t++;else if(this._current>t)for(;t>=0&&!this[t].visible;)t--;if(t===this.length){t=e;for(;t>=0&&!this[t].visible;)t--}if(t<0)return!1;if(t!==this._current){var o=new wijmo_1.PropertyChangedEventArgs("sheetIndex",this._current,t);this._current=t;this.onSelectedSheetChanged(o)}return!0};SheetCollection.prototype._getSheetIndexFrom=function(e){if(!e)return-1;e=e.toLowerCase();for(var t=0;t<this.length;t++){var o=this[t];if((o.name?o.name.toLowerCase():"")===e)return t}return-1};SheetCollection.prototype._postprocessSheet=function(e){e.nameChanged.removeHandler(this._shNameChanged,this);e.nameChanged.addHandler(this._shNameChanged,this);e.visibleChanged.removeHandler(this._shVisibleChanged,this);e.visibleChanged.addHandler(this._shVisibleChanged,this)};SheetCollection.prototype._shNameChanged=function(e,t){this.isValidSheetName(e)||e._setValidName(this.getValidSheetName(e));e._owner&&e._owner._sheetNameChanged(t.oldValue,e.name);var o=this._getSheetIndexFrom(e.name),i=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e,wijmo_1.isNumber(o)?o:this.length-1);this.onSheetNameChanged(i)};SheetCollection.prototype._shVisibleChanged=function(e,t){var o=this._getSheetIndexFrom(e.name),i=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,e,wijmo_1.isNumber(o)?o:this.length-1);this.onSheetVisibleChanged(i)};SheetCollection.prototype._getUniqueName=function(){for(var e="Sheet1",t=2;;){if(-1===this._getSheetIndexFrom(e))break;e="Sheet"+t;t++}return e};return SheetCollection}(wijmo_1.ObservableArray);exports.SheetCollection=SheetCollection;var _SheetTabs=function(e){__extends(_SheetTabs,e);function _SheetTabs(t,o,i){var n=e.call(this,t,i)||this;n._rtl=!1;n._sheetTabClicked=!1;n._owner=o;n._sheets=o.sheets;n._rtl="rtl"==getComputedStyle(o.hostElement).direction;n._initControl();n.deferUpdate((function(){n.initialize(i)}));return n}Object.defineProperty(_SheetTabs,"controlTemplate",{get:function(){_SheetTabs._ctrlTemplate||(_SheetTabs._ctrlTemplate='<div wj-part="sheet-container" class="'+exports.SheetClsNames.hostElement+'" style="height:100%;position:relative"><div wj-part="sheet-page" class="'+wijmo_1.InputFormElementsClsNames.btnGroup+" "+exports.SheetClsNames.sheetPage+'"><button type="button" class="'+wijmo_1.InputFormElementsClsNames.btn+" "+wijmo_1.InputFormElementsClsNames.btnDefault+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.stepBackward+'"></span></button><button type="button" class="'+wijmo_1.InputFormElementsClsNames.btn+" "+wijmo_1.InputFormElementsClsNames.btnDefault+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.left+'"></span></button><button type="button" class="'+wijmo_1.InputFormElementsClsNames.btn+" "+wijmo_1.InputFormElementsClsNames.btnDefault+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.right+'"></span></button><button type="button" class="'+wijmo_1.InputFormElementsClsNames.btn+" "+wijmo_1.InputFormElementsClsNames.btnDefault+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.stepForward+'"></span></button></div><div class="'+exports.SheetClsNames.sheetTab+'" style="height:100%;overflow:hidden"><ul wj-part="container"></ul></div><div wj-part="new-sheet" class="'+exports.SheetClsNames.newSheet+'"><span class="'+exports.SheetClsNames.sheetIcon+" "+wijmo_1.GlyphClsNames.file+'"></span></div><div wj-part="context-menu" style="display:none;z-index:100"></div></div>');return _SheetTabs._ctrlTemplate},set:function(e){_SheetTabs._ctrlTemplate=e},enumerable:!0,configurable:!0});_SheetTabs.prototype.refresh=function(e){this._tabContainer.innerHTML="";this._tabContainer.innerHTML=this._getSheetTabs();this._rtl&&this._adjustSheetsPosition();this._adjustSize()};_SheetTabs.prototype._sourceChanged=function(e,t){void 0===t&&(t=wijmo_1.NotifyCollectionChangedEventArgs.reset);var o=t;switch(o.action){case wijmo_1.NotifyCollectionChangedAction.Add:var i=o.index-1;i<0&&(i=0);this._tabContainer.innerHTML="";this._tabContainer.innerHTML=this._getSheetTabs();this._rtl&&this._adjustSheetsPosition();this._adjustSize();break;case wijmo_1.NotifyCollectionChangedAction.Remove:this._tabContainer.removeChild(this._tabContainer.children[o.index]);this._adjustSize();break;default:this.invalidate()}};_SheetTabs.prototype._selectedSheetChanged=function(e,t){this._updateTabActive(t.oldValue,!1);this._updateTabActive(t.newValue,!0);this._sheetTabClicked?this._sheetTabClicked=!1:this._scrollToActiveSheet(t.newValue,t.oldValue);this._adjustSize()};_SheetTabs.prototype._initControl=function(){var e=this,t=this.hostElement;this.applyTemplate("",this.getTemplate(),{_sheetContainer:"sheet-container",_tabContainer:"container",_sheetPage:"sheet-page",_newSheet:"new-sheet",_contextMenuHost:"context-menu"});this._contextMenu=new _SheetTabContextMenu(this._contextMenuHost,this._owner);if(this._rtl){this._sheetPage.style.right="0px";this._tabContainer.parentElement.style.right=this._sheetPage.clientWidth+"px";this._tabContainer.style.right="0px";this._tabContainer.style.cssFloat="right";this._newSheet.style.right=this._sheetPage.clientWidth+this._tabContainer.parentElement.clientWidth+"px"}this._adjustNavigationButtons(this._rtl);this.addEventListener(t,"mousedown",(function(){e._owner._mouseHdl._htDown=null}));this.addEventListener(t,"dragstart",(function(t){t.dataTransfer.setData("text","foo");t.target instanceof HTMLLIElement&&e._owner._isDescendant(e._tabContainer,t.target)?e._dragSrcIdx=e._getItemIndex(e._tabContainer,t.target):e._dragSrcIdx=-1}));this.addEventListener(t,"dragover",(function(e){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation()}));this.addEventListener(t,"drop",(function(t){if(e._dragSrcIdx>-1){var o;if(t.target instanceof HTMLLIElement&&e._owner._isDescendant(e._tabContainer,t.target))o=e._getItemIndex(e._tabContainer,t.target);else{var i=e._tabContainer.getBoundingClientRect();o=t.clientX<i.left?0:t.clientX>i.right?e._sheets.length-1:-1}if(o!==e._dragSrcIdx){var n=e._sheets[e._dragSrcIdx],l=e._owner.selection.clone();e._sheets._exchangingPosition=!0;e._sheets.deferUpdate((function(){n.grid._selHdl.select(l,!1,!1);e._sheets.splice(e._dragSrcIdx,1);e._sheets.splice(o,0,n)}));e._owner.selectedSheetIndex=o;e._sheets._exchangingPosition=!1}}e._dragSrcIdx=-1;t.preventDefault();t.stopPropagation()}));this.addEventListener(this._newSheet,"click",(function(){var t=e._owner.selectedSheetIndex;e._owner.addUnboundSheet();e._scrollToActiveSheet(e._owner.selectedSheetIndex,t)}));this._sheets.collectionChanged.addHandler(this._sourceChanged,this);this._sheets.selectedSheetChanged.addHandler(this._selectedSheetChanged,this);this._sheets.sheetNameChanged.addHandler(this._updateSheetName,this);this._sheets.sheetVisibleChanged.addHandler(this._updateTabShown,this);this._initSheetPage();this._initSheetTab()};_SheetTabs.prototype._initSheetTab=function(){var e=this;this.addEventListener(this._tabContainer,"mousedown",(function(t){var o,i=t.target;if(i instanceof HTMLLIElement){e._sheetTabClicked=!0;o=e._getItemIndex(e._tabContainer,i);e._scrollSheetTabContainer(i);o>-1&&(e._sheets.selectedIndex=o)}}));this.addEventListener(this._tabContainer,"dblclick",(function(t){var o,i=t.target;if(i instanceof HTMLLIElement){o=e._getItemIndex(e._tabContainer,i);e._scrollSheetTabContainer(i);o>-1&&e._startEditingSheetName(o)}}));this.addEventListener(this._tabContainer,"contextmenu",(function(t){t.preventDefault();e._contextMenu.show(t)}))};_SheetTabs.prototype._initSheetPage=function(){var e=this;this.hostElement.querySelector("div."+exports.SheetClsNames.sheetPage).addEventListener("click",(function(t){var o="[object HTMLButtonElement]"===t.target.toString()?t.target:t.target.parentElement,i=e._getItemIndex(e._sheetPage,o);if(0!==e._sheets.length)switch(i){case 0:e._sheets.selectFirst();break;case 1:e._sheets.selectPrevious();break;case 2:e._sheets.selectNext();break;case 3:e._sheets.selectLast()}}))};_SheetTabs.prototype._getSheetTabs=function(){for(var e="",t=0;t<this._sheets.length;t++)e+=this._getSheetElement(this._sheets[t],this._sheets.selectedIndex===t);return e};_SheetTabs.prototype._getSheetElement=function(e,t){void 0===t&&(t=!1);var o="<li";e.visible?t&&(o+=' class="active"'):o+=' class="hidden"';return o+=' draggable="true">'+e.name+"</li>"};_SheetTabs.prototype._updateTabActive=function(e,t){e>=0&&e<this._tabContainer.children.length&&wijmo_1.toggleClass(this._tabContainer.children[e],"active",t)};_SheetTabs.prototype._updateTabShown=function(e,t){if(!(t.index<0||t.index>=this._tabContainer.children.length)){t.item.visible?wijmo_1.removeClass(this._tabContainer.children[t.index],"hidden"):wijmo_1.addClass(this._tabContainer.children[t.index],"hidden");this._adjustSize()}};_SheetTabs.prototype._adjustSize=function(){var e,t=0;if(null!=this.hostElement&&"none"!==this.hostElement.style.display){e=this._tabContainer.parentElement.scrollLeft;this._tabContainer.parentElement.style.width="";this._tabContainer.style.width="";this._sheetPage.parentElement.style.width="";for(var o=0,i=this._tabContainer.childElementCount;o<i;o++)t+=this._tabContainer.children[o].offsetWidth+1;var n=this.hostElement.offsetWidth-this._sheetPage.offsetWidth-this._newSheet.offsetWidth-2;this._tabContainer.parentElement.style.width=(t>n?n:t)+"px";this._tabContainer.style.width=t+"px";this._sheetPage.parentElement.style.width=this._sheetPage.offsetWidth+this._newSheet.offsetWidth+this._tabContainer.parentElement.offsetWidth+3+"px";this._tabContainer.parentElement.scrollLeft=e}};_SheetTabs.prototype._getItemIndex=function(e,t){for(var o=0;o<e.children.length;o++)if(e.children[o]===t)return o;return-1};_SheetTabs.prototype._updateSheetName=function(e,t){this._tabContainer.querySelectorAll("li")[t.index].textContent=t.item.name;this._adjustSize()};_SheetTabs.prototype._scrollSheetTabContainer=function(e){var t=this._tabContainer.parentElement.scrollLeft,o=this._tabContainer.parentElement.offsetWidth;if(this._rtl)switch(wijmo_grid_1.FlexGrid._getRtlMode()){case"rev":var i=-this._tabContainer.offsetLeft;i+e.offsetLeft+e.offsetWidth>o+t?this._tabContainer.parentElement.scrollLeft+=e.offsetWidth:i+e.offsetLeft<t&&(this._tabContainer.parentElement.scrollLeft-=e.offsetWidth);break;case"neg":e.offsetLeft<t?this._tabContainer.parentElement.scrollLeft-=e.offsetWidth:e.offsetLeft+e.offsetWidth>o+t&&(this._tabContainer.parentElement.scrollLeft+=e.offsetWidth);break;default:var n=this._newSheet.offsetWidth;e.offsetLeft-n+t<0?this._tabContainer.parentElement.scrollLeft+=e.offsetWidth:e.offsetLeft+e.offsetWidth-n+t>o&&(this._tabContainer.parentElement.scrollLeft-=e.offsetWidth)}else{var l=this._sheetPage.offsetWidth;e.offsetLeft+e.offsetWidth-l>o+t?this._tabContainer.parentElement.scrollLeft+=e.offsetWidth:e.offsetLeft-l<t&&(this._tabContainer.parentElement.scrollLeft-=e.offsetWidth)}};_SheetTabs.prototype._adjustSheetsPosition=function(){for(var e=this._tabContainer.querySelectorAll("li"),t=0,o=0;o<e.length;o++){var i=e[o];i.style.cssFloat="right";i.style.right=t+"px";t+=e[o].clientWidth}};_SheetTabs.prototype._scrollToActiveSheet=function(e,t){var o=this._tabContainer.querySelectorAll("li"),i=0;this._tabContainer.clientWidth>this._tabContainer.parentElement.clientWidth&&(i=this._tabContainer.clientWidth-this._tabContainer.parentElement.clientWidth);if(o.length>0&&e<o.length&&t<o.length){if(0===e&&!this._rtl||e===o.length-1&&this._rtl){if(this._rtl)switch(wijmo_grid_1.FlexGrid._getRtlMode()){case"rev":this._tabContainer.parentElement.scrollLeft=0;break;case"neg":this._tabContainer.parentElement.scrollLeft=-i;break;default:this._tabContainer.parentElement.scrollLeft=i}else this._tabContainer.parentElement.scrollLeft=0;return}if(0===e&&this._rtl||e===o.length-1&&!this._rtl){if(this._rtl)switch(wijmo_grid_1.FlexGrid._getRtlMode()){case"rev":this._tabContainer.parentElement.scrollLeft=i;break;case"neg":default:this._tabContainer.parentElement.scrollLeft=0}else this._tabContainer.parentElement.scrollLeft=i;return}if(e>=t)for(var n=t+1;n<=e;n++){var l=o[n];this._scrollSheetTabContainer(l)}else for(n=t-1;n>=e;n--){l=o[n];this._scrollSheetTabContainer(l)}}};_SheetTabs.prototype._adjustNavigationButtons=function(e){var t=this.hostElement.querySelectorAll("."+exports.SheetClsNames.sheetPage+" button");if(t&&4===t.length){var o=void 0;if(e){o=t[0].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.stepBackward);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.stepForward);o=t[1].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.left);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.right);o=t[2].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.right);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.left);o=t[3].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.stepForward);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.stepBackward)}else{o=t[0].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.stepForward);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.stepBackward);o=t[1].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.right);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.left);o=t[2].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.left);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.right);o=t[3].querySelector("span");wijmo_1.removeClass(o,wijmo_1.GlyphClsNames.stepBackward);wijmo_1.addClass(o,wijmo_1.GlyphClsNames.stepForward)}}};_SheetTabs.prototype._startEditingSheetName=function(e){var t=this,o=this._tabContainer.children[e],i=o.textContent;this._editingSheetTab=o;this._measureEle=document.createElement("span");this._measureEle.setAttribute(wijmo_grid_1.FlexGrid._WJS_MEASURE,"true");this._measureEle.style.visibility="hidden";this.hostElement.appendChild(this._measureEle);var n=document.createElement("input");n.type="text";n.style.width=o.offsetWidth-40+"px";o.textContent="";o.appendChild(n);wijmo_1.addClass(n,exports.SheetClsNames.sheetNameEditor+" "+wijmo_1.InputFormElementsClsNames.formControl);n.value=i;wijmo_1.setSelectionRange(n,0,i.length);this.addEventListener(n,"keydown",(function(e){e.keyCode===wijmo_1.Key.Enter?t._commitSheetName():t._measureInputWidth(e.key)}));this.addEventListener(n,"blur",this._commitSheetName.bind(this))};_SheetTabs.prototype._commitSheetName=function(){if(this._editingSheetTab){var e=this._editingSheetTab.children[0];this.removeEventListener(e);var t=e.value,o=this._getItemIndex(this._tabContainer,this._editingSheetTab);if(null!=t&&""!==t&&-1===this._sheets._getSheetIndexFrom(t)){this._sheets[o].name=t;this._editingSheetTab.textContent=t}else this._editingSheetTab.textContent=this._sheets[o].name;this._editingSheetTab=null;wijmo_1.removeChild(this._measureEle);this._measureEle=null;this._adjustSize()}};_SheetTabs.prototype._measureInputWidth=function(e){if(this._editingSheetTab&&!(e.length>1)){var t=this._editingSheetTab.children[0],o=t.selectionStart,i=t.selectionEnd,n=t.value;if(null!=(n=n.substring(0,o)+e+n.substring(i))&&""!==n){this._measureEle.textContent=n;t.style.width=this._measureEle.offsetWidth+"px";this._adjustSize()}}};_SheetTabs.prototype.dispose=function(){this._contextMenu.dispose();e.prototype.dispose.call(this)};_SheetTabs._ctrlTemplate="";return _SheetTabs}(wijmo_1.Control);exports._SheetTabs=_SheetTabs;var _UnboundSortDescription=function(){function _UnboundSortDescription(e,t){this._column=e;this._ascending=t}Object.defineProperty(_UnboundSortDescription.prototype,"column",{get:function(){return this._column},enumerable:!0,configurable:!0});Object.defineProperty(_UnboundSortDescription.prototype,"ascending",{get:function(){return this._ascending},enumerable:!0,configurable:!0});return _UnboundSortDescription}();exports._UnboundSortDescription=_UnboundSortDescription;var _TabHolder=function(e){__extends(_TabHolder,e);function _TabHolder(t,o){var i=e.call(this,t)||this;i._splitterMousedownHdl=i._splitterMousedownHandler.bind(i);i._owner=o;i.applyTemplate("",i.getTemplate(),{_divSheet:"left",_divSplitter:"splitter",_divRight:"right"});i._init();return i}Object.defineProperty(_TabHolder,"controlTemplate",{get:function(){_TabHolder._ctrlTemplate||(_TabHolder._ctrlTemplate='<div><div wj-part="left" style="float:left;height:100%;overflow:hidden"></div><div wj-part="splitter" style="float:left;height:100%;width:6px;background-color:#e9eaee;padding:2px;cursor:e-resize"><div style="background-color:#8a9eb2;height:100%"></div></div><div wj-part="right" style="float:left;height:100%;background-color:#e9eaee"></div></div>');return _TabHolder._ctrlTemplate},set:function(e){_TabHolder._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(_TabHolder.prototype,"sheetControl",{get:function(){return this._sheetControl},enumerable:!0,configurable:!0});Object.defineProperty(_TabHolder.prototype,"visible",{get:function(){return null!=this.hostElement&&"none"!==this.hostElement.style.display},set:function(e){this.hostElement.style.display=e?"block":"none";this._divSheet.style.display=e?"block":"none"},enumerable:!0,configurable:!0});_TabHolder.prototype.getSheetBlanketSize=function(){return 20};_TabHolder.prototype.adjustSize=function(){var e=this._owner.scrollSize.width-this._owner.clientSize.width,t=(this._owner.scrollSize.height,this._owner.clientSize.height,this._divSplitter.parentElement);if(e<=0){t.style.minWidth="100px";this._divSplitter.style.display="none";this._divRight.style.display="none";this._divSheet.style.width="100%";this._divSplitter.removeEventListener("mousedown",this._splitterMousedownHdl,!0)}else{t.style.minWidth="300px";this._divSplitter.style.display="none";this._divRight.style.display="none";this._divSheet.style.width="100%";this._divSplitter.removeEventListener("mousedown",this._splitterMousedownHdl,!0);this._divSplitter.addEventListener("mousedown",this._splitterMousedownHdl,!0)}this._sheetControl._adjustSize()};_TabHolder.prototype._init=function(){var e=this;this._funSplitterMousedown=function(t){e._splitterMouseupHandler(t)};this._divSplitter.parentElement.style.height=this.getSheetBlanketSize()+"px";this._sheetControl=new _SheetTabs(this._divSheet,this._owner)};_TabHolder.prototype._splitterMousedownHandler=function(e){this._startPos=e.pageX;document.addEventListener("mousemove",this._splitterMousemoveHandler.bind(this),!0);document.addEventListener("mouseup",this._funSplitterMousedown,!0);e.preventDefault()};_TabHolder.prototype._splitterMousemoveHandler=function(e){null!==this._startPos&&void 0!==this._startPos&&this._adjustDis(e.pageX-this._startPos)};_TabHolder.prototype._splitterMouseupHandler=function(e){document.removeEventListener("mousemove",this._splitterMousemoveHandler,!0);document.removeEventListener("mouseup",this._funSplitterMousedown,!0);this._adjustDis(e.pageX-this._startPos);this._startPos=null};_TabHolder.prototype._adjustDis=function(e){var t=this._divRight.offsetWidth-e,o=this._divSheet.offsetWidth+e;if(t<=100){t=100;e=this._divRight.offsetWidth-t;o=this._divSheet.offsetWidth+e}else if(o<=100){e=(o=100)-this._divSheet.offsetWidth;t=this._divRight.offsetWidth-e}if(0!=e){this._divRight.style.width=t+"px";this._divSheet.style.width=o+"px";this._startPos=this._startPos+e}};_TabHolder.prototype.dispose=function(){this.sheetControl.dispose();e.prototype.dispose.call(this)};_TabHolder._ctrlTemplate="";return _TabHolder}(wijmo_1.Control);exports._TabHolder=_TabHolder;var _Expression=function(){function _Expression(e,t){this._evaluated=!1;this._rounder=e;this._token=t?t instanceof _Token?t:new _Token(t,_TokenID.ATOM,_TokenType.LITERAL):new _Token(null,_TokenID.ATOM,_TokenType.IDENTIFIER)}Object.defineProperty(_Expression.prototype,"token",{get:function(){return this._token},enumerable:!0,configurable:!0});Object.defineProperty(_Expression.prototype,"evaluated",{get:function(){return this._evaluated},enumerable:!0,configurable:!0});Object.defineProperty(_Expression.prototype,"evaluatedValue",{get:function(){return this._evaluated?this._evaluatedValue:void 0},set:function(e){this._evaluatedValue=e;this._evaluated=!0},enumerable:!0,configurable:!0});_Expression.prototype.evaluate=function(e,t,o,i,n,l){void 0===i&&(i=!0);void 0===n&&(n=!1);void 0===l&&(l=!0);if(this._token.tokenType===_TokenType.ERROR){if(l)throw this._token.value;return this._token.value}if(this._token.tokenType!==_TokenType.LITERAL)throw new SyntaxError(exports._ErrorMessages.BadExpression);return this._token.value};_Expression.toString=function(e,t,o,i){var n=e.evaluate(t,o,i);if(n instanceof FormulaError)throw n;(null==n||e instanceof _CellRangeExpression&&e._isEmpty)&&(n="");n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isString(n)&&"'"===n[0]){var l=n.substring(1);""!=l.trim()&&(n=l)}wijmo_1.isDate(n)&&(n=n.valueOf());return null!=n?n.toString():""};_Expression.toNumber=function(e,t,o,i){var n=e.evaluate(t,o,i);(null==n||e instanceof _CellRangeExpression&&e._isEmpty)&&(n=0);if(n instanceof FormulaError)throw n;n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isNumber(n))return n;if(wijmo_1.isBoolean(n))return n?1:0;if(wijmo_1.isDate(n))return FlexSheet._toOADate(n);if(wijmo_1.isString(n)){"'"===n[0]&&(n=n.substr(1));if(n=n.trim()){if(!isNaN(+n))return+n;if(_Expression.isDateValue(n))return FlexSheet._toOADate(new Date(n))}}return wijmo_1.changeType(n,wijmo_1.DataType.Number)};_Expression.toBoolean=function(e,t,o,i){var n=e.evaluate(t,o,i);(null==n||e instanceof _CellRangeExpression&&e._isEmpty)&&(n=0);if(n instanceof FormulaError)throw n;n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isBoolean(n))return n;if(wijmo_1.isNumber(n))return 0!==n;wijmo_1.isString(n)&&"'"===n[0]&&(n=n.substr(1));return wijmo_1.changeType(n,wijmo_1.DataType.Boolean,"")};_Expression.toDate=function(e,t,o,i){var n=e.evaluate(t,o,i);(null==n||e instanceof _CellRangeExpression&&e._isEmpty)&&(n=0);if(n instanceof FormulaError)throw n;n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isDate(n))return n;if(wijmo_1.isNumber(n))return FlexSheet._fromOADate(n);wijmo_1.isString(n)&&"'"===n[0]&&(n=n.substr(1));return wijmo_1.changeType(n,wijmo_1.DataType.Date,"")};_Expression.isDateValue=function(e){var t,o=["January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];!e||e instanceof FormulaError||wijmo_1.isPrimitive(e)||(e=e.value);if(!(t=wijmo_1.isDate(e))&&wijmo_1.isString(e)){"'"===e[0]&&(e=e.substr(1));if(!wijmo_1.isNullOrWhiteSpace(e)&&isNaN(e)&&(e.indexOf("/")>0||e.indexOf("-")>0)&&!(t=!isNaN(Date.parse(e))))for(var i in o)if(e.indexOf(o[i])>-1){t=!0;break}}return t};_Expression.prototype._refersTo=function(e){return!1};_Expression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){return!1};_Expression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);return!1};_Expression.prototype._updateCellRangeExpForReorderingRows=function(e){return!1};_Expression.prototype._updateCellBoundary=function(e,t){return!1};_Expression.prototype._getStringExpression=function(){return null==this._token.value?"":wijmo_1.isString(this._token.value)?'"'+this._token.value+'"':this._token.value.toString()};return _Expression}();exports._Expression=_Expression;var _UnaryExpression=function(e){__extends(_UnaryExpression,e);function _UnaryExpression(t,o,i){var n=e.call(this,t,o)||this;n._expr=i;return n}_UnaryExpression.prototype.evaluate=function(e,t,o,i,n,l){void 0===i&&(i=!0);void 0===n&&(n=!1);void 0===l&&(l=!0);if(this._expr.token.tokenType===_TokenType.ERROR){if(l)throw this._expr.token.value;return this._expr.token.value}if(this.token.tokenID===_TokenID.SUB){if(!this.evaluated){var r=_Expression.toNumber(this._expr,e,t,o);this.evaluatedValue=wijmo_1.isString(r)?NaN:-r}return this.evaluatedValue}if(this.token.tokenID===_TokenID.ADD){if(!this.evaluated){r=_Expression.toNumber(this._expr,e,t,o);this.evaluatedValue=wijmo_1.isString(r)?NaN:+r}return this.evaluatedValue}throw new SyntaxError(exports._ErrorMessages.BadExpression)};_UnaryExpression.prototype._refersTo=function(e){return this._expr._refersTo(e)};_UnaryExpression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){return this._expr._updateCellRangeExp(e,t,o,i,n,l)};_UnaryExpression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);return this._expr._moveCellRangeExp(e,t,o,i,n)};_UnaryExpression.prototype._updateCellRangeExpForReorderingRows=function(e){return this._expr._updateCellRangeExpForReorderingRows(e)};_UnaryExpression.prototype._getStringExpression=function(){return this.token.tokenID===_TokenID.SUB?(this._inGroup?"(":"")+"-"+this._expr._getStringExpression()+(this._inGroup?")":""):this.token.tokenID===_TokenID.ADD?(this._inGroup?"(":"")+"+"+this._expr._getStringExpression()+(this._inGroup?")":""):""};return _UnaryExpression}(_Expression);exports._UnaryExpression=_UnaryExpression;var _BinaryExpression=function(e){__extends(_BinaryExpression,e);function _BinaryExpression(t,o,i,n){var l=e.call(this,t,o)||this;l._leftExpr=i;l._rightExpr=n;return l}_BinaryExpression.prototype.evaluate=function(e,t,o,i,n,l){void 0===i&&(i=!0);void 0===n&&(n=!1);void 0===l&&(l=!0);var r,s,a,h;if(this.evaluated)return this.evaluatedValue;if(this._leftExpr.token.tokenType===_TokenType.ERROR){if(l)throw this._leftExpr.token.value;return this._leftExpr.token.value}if(this._rightExpr.token.tokenType===_TokenType.ERROR){if(l)throw this._rightExpr.token.value;return this._rightExpr.token.value}var u=_Expression.toString(this._leftExpr,e,t,o),d=_Expression.toString(this._rightExpr,e,t,o);if(this.token.tokenType===_TokenType.CONCAT){this.evaluatedValue=u+d;return this.evaluatedValue}var _=this._leftExpr.evaluate(e,t,o),c=this._rightExpr.evaluate(e,t,o);if(_&&!wijmo_1.isPrimitive(_)){r=_.format;_=_.value}if(c&&!wijmo_1.isPrimitive(c)){s=c.format;c=c.value}var g=_Expression.isDateValue(_),f=_Expression.isDateValue(c),p=g||f;if(p){a=wijmo_1.isDate(_)?FlexSheet._toOADate(_):wijmo_1.isNumber(_)?_:FlexSheet._toOADate(new Date(_));h=wijmo_1.isDate(c)?FlexSheet._toOADate(c):wijmo_1.isNumber(c)?c:FlexSheet._toOADate(new Date(c))}else{a=_Expression.toNumber(this._leftExpr,e,t,o);h=_Expression.toNumber(this._rightExpr,e,t,o)}if(this.token.tokenType===_TokenType.COMPARE){var m=void 0;this._leftExpr instanceof _CellRangeExpression&&this._leftExpr._isEmpty&&(_=null);this._rightExpr instanceof _CellRangeExpression&&this._rightExpr._isEmpty&&(c=null);var w=null==_,C=null==c;if(w!==C)m=w&&!c||C&&!_?0:w?-1:1;else{var S=typeof _,b=typeof c;if(n&&S!==b){if(this.token.tokenID===_TokenID.NE){this.evaluatedValue=!0;return this.evaluatedValue}if(this.token.tokenID!==_TokenID.EQ||"number"!==b&&!f){this.evaluatedValue=!1;return this.evaluatedValue}}var v="boolean"===S;if(v!==("boolean"===b))m=v?1:-1;else{var y="string"===S;if(i&&y!==("string"===b))m=y?1:-1;else if(0!==_&&wijmo_1.isNullOrWhiteSpace(_)||0!==c&&wijmo_1.isNullOrWhiteSpace(c))m=_===c?0:_<=c?-1:1;else{wijmo_1.isNumber(a)&&(a=this._rounder.round(a));wijmo_1.isNumber(h)&&(h=this._rounder.round(h));m=a-h}}}switch(this.token.tokenID){case _TokenID.GT:this.evaluatedValue=m>0;return this.evaluatedValue;case _TokenID.LT:this.evaluatedValue=m<0;return this.evaluatedValue;case _TokenID.GE:this.evaluatedValue=m>=0;return this.evaluatedValue;case _TokenID.LE:this.evaluatedValue=m<=0;return this.evaluatedValue;case _TokenID.EQ:if(isNaN(m)){this.evaluatedValue=u.toLowerCase()===d.toLowerCase();return this.evaluatedValue}this.evaluatedValue=0===m;return this.evaluatedValue;case _TokenID.NE:if(isNaN(m)){this.evaluatedValue=u.toLowerCase()!==d.toLowerCase();return this.evaluatedValue}this.evaluatedValue=0!==m;return this.evaluatedValue}}if(wijmo_1.isString(a)||wijmo_1.isString(h))throw new ValueError;switch(this.token.tokenID){case _TokenID.ADD:this.evaluatedValue=a+h;break;case _TokenID.SUB:this.evaluatedValue=a-h;break;case _TokenID.MUL:this.evaluatedValue=a*h;break;case _TokenID.DIV:case _TokenID.PERCENT:if(0===h){this.evaluatedValue=new DivideByZeroError;throw this.evaluatedValue}this.evaluatedValue=a/h;break;case _TokenID.DIVINT:if(0===h){this.evaluatedValue=new DivideByZeroError;throw this.evaluatedValue}this.evaluatedValue=Math.floor(a/h);break;case _TokenID.MOD:if(0===h){this.evaluatedValue=new DivideByZeroError;throw this.evaluatedValue}this.evaluatedValue=Math.floor(a%h);break;case _TokenID.POWER:switch(h){case 0:this.evaluatedValue=1;break;case.5:this.evaluatedValue=Math.sqrt(a);break;case 1:this.evaluatedValue=a;break;case 2:this.evaluatedValue=a*a;break;case 3:this.evaluatedValue=a*a*a;break;case 4:this.evaluatedValue=a*a*a*a;break;default:this.evaluatedValue=Math.pow(a,h)}break;default:this.evaluatedValue=NaN}if(!isNaN(this.evaluatedValue)){p&&(this.evaluatedValue={value:FlexSheet._fromOADate(this.evaluatedValue),format:r||s});return this.evaluatedValue}throw new SyntaxError(exports._ErrorMessages.BadExpression)};_BinaryExpression.prototype._refersTo=function(e){return this._leftExpr._refersTo(e)||this._rightExpr._refersTo(e)};_BinaryExpression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){var r,s=!1;r=this._leftExpr._updateCellRangeExp(e,t,o,i,n,l);s=s||r;r=this._rightExpr._updateCellRangeExp(e,t,o,i,n,l);return s||r};_BinaryExpression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);var l,r=!1;l=this._leftExpr._moveCellRangeExp(e,t,o,i,n);r=r||l;l=this._rightExpr._moveCellRangeExp(e,t,o,i,n);return r||l};_BinaryExpression.prototype._updateCellRangeExpForReorderingRows=function(e){var t,o=!1;t=this._leftExpr._updateCellRangeExpForReorderingRows(e);o=o||t;t=this._rightExpr._updateCellRangeExpForReorderingRows(e);return o||t};_BinaryExpression.prototype._getStringExpression=function(){var e=exports._OpMap[this.token.tokenID]||"",t=this._leftExpr._getStringExpression(),o=this.token.tokenID!==_TokenID.PERCENT?this._rightExpr._getStringExpression():"";return(this._inGroup?"(":"")+t+e+o+(this._inGroup?")":"")};return _BinaryExpression}(_Expression);exports._BinaryExpression=_BinaryExpression;var _CellRangeExpression=function(e){__extends(_CellRangeExpression,e);function _CellRangeExpression(t,o,i,n,l,r,s,a,h,u){void 0===l&&(l=!0);void 0===r&&(r=!1);void 0===s&&(s=!1);void 0===a&&(a=!1);void 0===h&&(h=!1);var d=e.call(this,t)||this;d._cells=new wijmo_grid_1.CellRange(o.topRow,o.leftCol,o.bottomRow,o.rightCol);d._sheetRef=i;d._flex=n;d._evalutingRange={};d._isCellRange=l;d._absRow=r;d._absCol=s;d._absRow2=a;d._absCol2=h;d._isWholeRow=u;return d}_CellRangeExpression.prototype.evaluate=function(e,t,o,i,n,l){void 0===i&&(i=!0);void 0===n&&(n=!1);void 0===l&&(l=!0);if(!this.evaluated){var r=this._extendRange(o),s=this._getCellValue(r,o,e,t,l,!0);this._isEmpty=null==s;this.evaluatedValue=s}return null==this.evaluatedValue?0:this.evaluatedValue};_CellRangeExpression.prototype.getValues=function(e,t,o,i){void 0===e&&(e=!0);void 0===i&&(i=!0);var n=[];if(!(o=this._getSheet()||o||this._flex.selectedSheet))return null;for(var l=this._extendRange(o),r=null==t||isNaN(+t)?l.leftCol:t,s=null==t||isNaN(+t)?l.rightCol:t,a=new wijmo_grid_1.CellRange,h=l.topRow;h<=l.bottomRow&&h<o.grid.rows.length;h++)if(e||!1!==o.grid.rows[h].isVisible)for(var u=r;u<=s&&u<o.grid.columns.length;u++){a.setRange(h,u);var d=this._getCellValue(a,o,void 0,void 0,i);!d||d instanceof FormulaError||wijmo_1.isPrimitive(d)||(d=d.value);n.push(d)}return n};_CellRangeExpression.prototype.getValuesWithTwoDimensions=function(e,t){void 0===e&&(e=!0);var o,i,n,l,r,s=[],a=0,h=0;if(!(t=this._getSheet()||t||this._flex.selectedSheet))return null;for(n=(r=this._extendRange(t)).topRow;n<=r.bottomRow&&n<t.grid.rows.length;n++)if(e||!1!==t.grid.rows[n].isVisible){i=[];h=0;for(l=r.leftCol;l<=r.rightCol&&l<t.grid.columns.length;l++)if(e||!1!==t.grid.columns[l].isVisible){!(o=this._getCellValue(new wijmo_grid_1.CellRange(n,l),t))||o instanceof FormulaError||wijmo_1.isPrimitive(o)||(o=o.value);i[h]=o;h++}else h++;s[a]=i;a++}else a++;return s};Object.defineProperty(_CellRangeExpression.prototype,"cells",{get:function(){return this._cells},enumerable:!0,configurable:!0});Object.defineProperty(_CellRangeExpression.prototype,"sheetRef",{get:function(){return this._sheetRef},enumerable:!0,configurable:!0});_CellRangeExpression.prototype._getCellValue=function(e,t,o,i,n,l){void 0===n&&(n=!0);var r,s,a,h;if(!(r=this._getSheet()||t||this._flex.selectedSheet))return null;for(var u=0,d=r._currentMergedRanges;u<d.length;u++){var _=d[u];if(e._row>=_._row&&e._row2<=_._row2&&e._col>=_._col&&e._col2<=_._col2&&(e._row!==_._row||e._col!==_._col))return null}if(e.isSingleCell){a=e.row;h=e.col}else{if(null!=o&&o>=e.topRow&&o<=e.bottomRow&&e.col===e.col2){a=o;h=e.col}if(null!=i&&i>=e.leftCol&&i<=e.rightCol&&e.row===e.row2){a=e.row;h=i}}if(null==a||null==h)throw new ReferenceError(exports._ErrorMessages.InvalidCellRef);s=r.name+":"+a+","+h+"-"+a+","+h;if(this._evalutingRange[s])throw new SyntaxError(exports._ErrorMessages.CircRef);try{if(this._flex){this._evalutingRange[s]=!0;var c=r===this._flex.selectedSheet?this._flex:r.grid;if(a<c.rows.length&&h<c.columns.length){var g=r.grid.columns[h],f=this._flex.getCellValue(a,h,!!l&&0,r);if(f instanceof FormulaError){if(n)throw f;return f}g.dataMap&&!l&&(f=g.dataMap.getDisplayValue(f));return f}return}}finally{delete this._evalutingRange[s]}};_CellRangeExpression.prototype._getSheet=function(){if(!this._sheetRef)return null;var e=this._flex._getSheet(this._sheetRef);if(!e)throw new ReferenceError(exports._ErrorMessages.InvalidSheetRef);return e};_CellRangeExpression.prototype._refersTo=function(e){return e.contains(this.cells)};_CellRangeExpression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){var r=this._cells,s=!1;if(this._tableParams&&this._tableParams.length>0)return!1;if(e===this._flex.selectedSheetIndex){if(this._sheetRef&&this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase())return!1}else if(!this._sheetRef||this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase())return!1;if(n){if(null==this._isWholeRow||this._isWholeRow){if(l&&(r.leftCol>l.rightCol||r.rightCol<l.leftCol))return!1;if(i){if(r.topRow>=t){r.row+=o;r.row2+=o;s=!0}else if(r.topRow<t&&r.bottomRow>=t){r.row2+=o;s=!0}}else if(r.topRow>t){r.row-=o;r.row2-=o;s=!0}else if(r.isSingleCell){if(r.row>=t-o+1){r.row=t-o+1;r.row2=t-o+1;s=!0}}else if(r.topRow>=t-o+1){r.row=t-o+1;r.row2-=o;s=!0}else if(r.topRow<t-o+1&&r.bottomRow>=t-o+1){r.bottomRow>t?r.row2-=o:r.row2=t-o;s=!0}}}else if(null==this._isWholeRow||!this._isWholeRow){if(l&&(r.topRow>l.bottomRow||r.bottomRow<l.topRow))return!1;if(i){if(r.leftCol>=t){r.col+=o;r.col2+=o;s=!0}else if(r.leftCol<t&&r.rightCol>=t){r.col2+=o;s=!0}}else if(r.leftCol>t){r.col-=o;r.col2-=o;s=!0}else if(r.isSingleCell){if(r.col>=t-o+1){r.col=t-o+1;r.col2=t-o+1;s=!0}}else if(r.leftCol>=t-o+1){r.col=t-o+1;r.col2-=o;s=!0}else if(r.leftCol<t-o+1&&r.rightCol>=t-o+1){r.rightCol>t?r.col2-=o:r.col2=t-o;s=!0}}return s};_CellRangeExpression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);var l,r,s=this._cells,a=!1;if(this._tableParams&&this._tableParams.length>0)return!1;if(this._flex.selectedSheetIndex!=e&&(!this._sheetRef||this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase()))return!1;if(!n&&this._flex.selectedSheetIndex==e&&this._sheetRef&&this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase())return!1;l=o.topRow-t.topRow;r=o.leftCol-t.leftCol;if(n){if(0!==l&&(null==this._isWholeRow||this._isWholeRow)){s.row+=n&&this._absRow?0:l;s.row2+=this._isCellRange?n&&this._absRow2?0:l:n&&this._absRow?0:l;a=!0}if(0!==r&&(null==this._isWholeRow||!this._isWholeRow)){s.col+=n&&this._absCol?0:r;s.col2+=this._isCellRange?n&&this._absCol2?0:r:n&&this._absCol?0:r;a=!0}return a}if(t.contains(s)){if(0!==l&&(null==this._isWholeRow||this._isWholeRow)){s.row+=l;s.row2+=l;a=!0}if(0!==r&&(null==this._isWholeRow||!this._isWholeRow)){s.col+=r;s.col2+=r;a=!0}}else if(t.intersects(s)){if(t.intersectsRow(s)){var h=t.topRow>=s.topRow&&t.bottomRow<=s.bottomRow;if(0!==l&&(null==this._isWholeRow||this._isWholeRow))if(t.topRow<=s.topRow){if(l<0){s.row+=l;a=!0}else if(l>0){var u=h&&o.bottomRow<s.bottomRow;if(i&&!u){t.topRow<s.topRow&&(s.row-=s.topRow-t.topRow);s.row2-=t.rowSpan;a=!0}}}else if(t.bottomRow>=s.bottomRow){if(l>0){s.row2+=l;a=!0}else if(l<0){var d=h&&o.topRow>s.topRow;if(i&&!d){t.bottomRow>s.bottomRow&&(s.row2+=t.bottomRow-s.bottomRow);s.row+=t.rowSpan;a=!0}}}else if(i){l<0&&o.topRow<=s.topRow&&(s.row+=t.rowSpan);l>0&&o.bottomRow>=s.bottomRow&&(s.row2-=t.rowSpan);a=!0}}if(t.intersectsColumn(s)&&0!==r&&(null==this._isWholeRow||!this._isWholeRow))if(t.leftCol<=s.leftCol){if(r<0){s.col+=r;a=!0}else if(r>0&&i){t.leftCol<s.leftCol&&(s.col-=s.leftCol-t.leftCol);s.col2-=t.columnSpan;a=!0}}else if(t.rightCol>=s.rightCol){if(r>0){s.col2+=r;a=!0}else if(r<0&&i){t.rightCol>s.rightCol&&(s.col2+=t.rightCol-s.rightCol);s.col+=t.columnSpan;a=!0}}else if(i){r<0?s.col+=t.columnSpan:s.col2-=t.columnSpan;a=!0}}else if(i){if(null==this._isWholeRow||this._isWholeRow)if(s.row!==s.row2&&s.containsRow(o.topRow)){l<0?s.row2+=o.rowSpan:s.row=Math.max(0,s.row-o.rowSpan);a=!0}else{if(s.topRow>=o.topRow&&s.topRow<t.topRow&&l<0){s.row+=o.rowSpan;s.row2+=o.rowSpan;a=!0}if(s.topRow>t.bottomRow&&s.bottomRow<=o.bottomRow&&l>0){s.row-=o.rowSpan;s.row2-=o.rowSpan;a=!0}}if(null==this._isWholeRow||!this._isWholeRow)if(s.col!==s.col2&&s.containsColumn(o.leftCol)){r<0?s.col2+=o.columnSpan:s.col=Math.max(0,s.col-o.columnSpan);a=!0}else{if(s.leftCol>=o.leftCol&&s.leftCol<t.leftCol&&r<0){s.col+=o.columnSpan;s.col2+=o.columnSpan;a=!0}if(s.leftCol>t.rightCol&&s.rightCol<=o.rightCol&&r>0){s.col-=o.columnSpan;s.col2-=o.columnSpan;a=!0}}}return a};_CellRangeExpression.prototype._updateCellRangeExpForReorderingRows=function(e){var t,o=this._cells;if(null==this._isWholeRow||this._isWholeRow){(t=this._cells.row+e)<0?t=0:t>=this._flex.rows.length&&(t=this._flex.rows.length-1);o.row=t;this._isCellRange&&((t=this._cells.row2+e)<0?t=0:t>=this._flex.rows.length&&(t=this._flex.rows.length-1));o.row2=t}return!0};_CellRangeExpression.prototype._updateCellBoundary=function(e,t){var o=this._cells;if(this._sheetRef&&this._sheetRef.toLowerCase()!==this._flex.selectedSheet.name.toLowerCase())return!1;if(o.row===o.row2&&o.row===e&&t===o.col2+1){o.col2+=1;return!0}if(o.col===o.col2&&o.col===t&&e===o.row2+1){o.row2+=1;return!0}return!1};_CellRangeExpression.prototype._getStringExpression=function(){if(this._tableParams&&this._tableParams.length>0)return this._getTableParamsStringExpression();var e=this._quoteName(this._sheetRef);return this._definedName?this._definedName:(e?e+"!":"")+wijmo_xlsx_1.Workbook.xlsxAddress(this._cells.row,this._cells.col,this._absRow,this._absCol,this._isWholeRow)+(this._isCellRange?":"+wijmo_xlsx_1.Workbook.xlsxAddress(this._cells.row2,this._cells.col2,this._absRow2,this._absCol2,this._isWholeRow):"")};_CellRangeExpression.prototype._quoteName=function(e){e&&(/[\s\-!$]/.test(e)||/^\d/.test(e))&&(e="'"+e+"'");return e};_CellRangeExpression.prototype._getTableParamsStringExpression=function(){var e,t=0,o="",i=this._tableParams.length,n=!1;if(!this._defTableParameterProvided){for(;t<i;t++)if("#"===(e=this._tableParams[t])[0]){o+="["+e+"]";t<i-1&&(o+=", ")}else if(n)o+=": ["+e+"]";else{o+="["+e+"]";n=!0}i>1&&(o="["+o+"]")}this._tableName&&(o=this._tableName+o);return o};_CellRangeExpression.prototype._extendRange=function(e){var t=this._cells.clone();if(null!=this._isWholeRow)if(this._isWholeRow){t.col=0;t.col2=e?e.grid.columns.length-1:this._flex.columns.length-1}else{t.row=0;t.row2=e?e.grid.rows.length-1:this._flex.rows.length-1}return t};return _CellRangeExpression}(_Expression);exports._CellRangeExpression=_CellRangeExpression;var _FunctionExpression=function(e){__extends(_FunctionExpression,e);function _FunctionExpression(t,o,i,n,l){void 0===l&&(l=!0);var r=e.call(this,t)||this;r._funcId=o;r._funcDefinition=i;r._params=n;r._needCacheEvaluatedVal=l;return r}_FunctionExpression.prototype.evaluate=function(e,t,o){if(!this._needCacheEvaluatedVal)return this._funcDefinition.func(this._params,o,e,t);this.evaluated||(this.evaluatedValue=this._funcDefinition.func(this._params,o,e,t));return this.evaluatedValue};_FunctionExpression.prototype._refersTo=function(e){if(this._params)for(var t=0;t<this._params.length;t++)if(this._params[t]._refersTo(e))return!0;return!1};_FunctionExpression.prototype._updateCellRangeExp=function(e,t,o,i,n,l){var r,s,a=!1;if(this._params&&this._params.length>0)for(r=0;r<this._params.length;r++){s=this._params[r]._updateCellRangeExp(e,t,o,i,n,l);a||(a=a||s)}return a};_FunctionExpression.prototype._moveCellRangeExp=function(e,t,o,i,n){void 0===i&&(i=!1);void 0===n&&(n=!1);var l,r,s=!1;if(this._params&&this._params.length>0)for(l=0;l<this._params.length;l++){r=this._params[l]._moveCellRangeExp(e,t,o,i,n);s||(s=s||r)}return s};_FunctionExpression.prototype._updateCellRangeExpForReorderingRows=function(e){var t,o,i=!1;if(this._params&&this._params.length>0)for(t=0;t<this._params.length;t++){o=this._params[t]._updateCellRangeExpForReorderingRows(e);i||(i=i||o)}return i};_FunctionExpression.prototype._updateCellBoundary=function(e,t){var o;return!!(this._params&&1===this._params.length&&(o=this._params[0])instanceof _CellRangeExpression)&&o._updateCellBoundary(e,t)};_FunctionExpression.prototype._getStringExpression=function(){return"true"===this._funcId||"false"===this._funcId?this._funcId.toUpperCase():this._funcId+this._parseParamsExpToString()};_FunctionExpression.prototype._parseParamsExpToString=function(){var e,t;if(this._params&&this._params.length>0){t="";for(e=0;e<this._params.length;e++){0===e&&(t+="(");t+=this._params[e]._getStringExpression();e<this._params.length-1?t+=", ":t+=")"}return t}return"()"};return _FunctionExpression}(_Expression);exports._FunctionExpression=_FunctionExpression;var _CalcEngine=function(){function _CalcEngine(e){this._expressionCache={};this._idChars="_$:!";this._functionTable={};this._cacheSize=0;this._tableRefStart=!1;this.unknownFunction=new wijmo_1.Event;this._owner=e;this._buildSymbolTable();this._registerAggregateFunction();this._registerMathFunction();this._registerLogicalFunction();this._registerTextFunction();this._registerDateFunction();this._registLookUpReferenceFunction();this._registFinacialFunction();this._registAddressRelatedFunction();this._registerIsFunctions()}_CalcEngine.prototype.onUnknownFunction=function(e,t){var o,i;if(t&&t.length>0){o=[];for(var n=0;n<t.length;n++)o[n]=t[n].evaluate(this._rowIndex,this._columnIndex)}i=new UnknownFunctionEventArgs(e,o);this.unknownFunction.raise(this,i);if(null!=i.value)return new _Expression(this,i.value);throw new NameError(exports._ErrorMessages.UnkFuncName(e))};_CalcEngine.prototype.evaluate=function(e,t,o,i,n,l,r){void 0===l&&(l=!0);void 0===r&&(r=!1);var s,a;if(!this._owner.enableFormulas)return e;try{if(_isFormula(e)){this._containsCellRef=!1;this._rowIndex=i;this._columnIndex=n;this._sheet=o||this._owner.selectedSheet;e=this._filterUnwantedCommas(e);a=(s=this._checkCache(e,l,r)).evaluate(i,n,o,l,r);for(;a instanceof _Expression;)a=a.evaluate(i,n,o,l,r);return t&&wijmo_1.isPrimitive(a)?wijmo_1.Globalize.format(a,t):a}return e||""}catch(e){var h=e instanceof FormulaError?e:new UnknownError(e);s&&(s.evaluatedValue=h);return h}};_CalcEngine.prototype.addCustomFunction=function(e,t,o,i){var n=this;e=e.toLowerCase();this._functionTable[e]=new _FunctionDefinition((function(e){var o,i=[];if(e&&e.length>0)for(var l=0;l<e.length;l++){o=e[l];i[l]=o instanceof _CellRangeExpression?o.cells:o.evaluate(n._rowIndex,n._columnIndex)}return t.apply(n,i)}),i,o)};_CalcEngine.prototype.addFunction=function(e,t,o,i){var n=this;e=e.toLowerCase();this._functionTable[e]=new _FunctionDefinition((function(e,o){var i,l=[];if(e&&e.length>0)for(var r=o||n._sheet,s=0;s<e.length;s++){i=e[s];l[s]=i instanceof _CellRangeExpression?i.getValuesWithTwoDimensions(void 0,r):[[i.evaluate(n._rowIndex,n._columnIndex,r)]]}return t.apply(n,l)}),i,o)};_CalcEngine.prototype.clearExpressionCache=function(){this._expressionCache=null;this._expressionCache={};this._cacheSize=0};_CalcEngine.prototype.round=function(e){var t=this._owner.calculationPrecision;if(e.toString().indexOf(".")<0)return e;if(t<0)return e;t>20&&(t=20);var o=_CalcEngine.PowOf10[t];return e>=0?Math.round(e*o)/o:-Math.round(Math.abs(e)*o)/o};_CalcEngine.prototype.parse=function(e){if(wijmo_1.isNumber(e)){this._token=new _Token(e,_TokenID.END,_TokenType.GROUP);return new _Expression(this,new _Token(e,_TokenID.ATOM,_TokenType.LITERAL))}this._expression=e;this._expressLength=e?e.length:0;this._pointer=0;this._expressLength>0&&"="===this._expression[0]&&this._pointer++;return this._parseExpression()};_CalcEngine.prototype._buildSymbolTable=function(){if(!this._tokenTable){this._tokenTable={};this._addToken("+",_TokenID.ADD,_TokenType.ADDSUB);this._addToken("-",_TokenID.SUB,_TokenType.ADDSUB);this._addToken("(",_TokenID.OPEN,_TokenType.GROUP);this._addToken(")",_TokenID.CLOSE,_TokenType.GROUP);this._addToken("*",_TokenID.MUL,_TokenType.MULDIV);this._addToken(",",_TokenID.COMMA,_TokenType.GROUP);this._addToken(".",_TokenID.PERIOD,_TokenType.GROUP);this._addToken("/",_TokenID.DIV,_TokenType.MULDIV);this._addToken("\\",_TokenID.DIVINT,_TokenType.MULDIV);this._addToken("%",_TokenID.PERCENT,_TokenType.MULDIV);this._addToken("=",_TokenID.EQ,_TokenType.COMPARE);this._addToken(">",_TokenID.GT,_TokenType.COMPARE);this._addToken("<",_TokenID.LT,_TokenType.COMPARE);this._addToken("^",_TokenID.POWER,_TokenType.POWER);this._addToken("<>",_TokenID.NE,_TokenType.COMPARE);this._addToken(">=",_TokenID.GE,_TokenType.COMPARE);this._addToken("<=",_TokenID.LE,_TokenType.COMPARE);this._addToken("&",_TokenID.CONCAT,_TokenType.CONCAT);this._addToken("[",_TokenID.OPEN,_TokenType.SQUAREBRACKETS);this._addToken("]",_TokenID.CLOSE,_TokenType.SQUAREBRACKETS)}};_CalcEngine.prototype._registerAggregateFunction=function(){var e=this;this._functionTable.sum=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Sum,t,o)}));this._functionTable.average=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Avg,t,o)}));this._functionTable.max=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Max,t,o)}));this._functionTable.min=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Min,t,o)}));this._functionTable.var=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Var,t,o)}));this._functionTable.varp=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.VarPop,t,o)}));this._functionTable.stdev=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.Std,t,o)}));this._functionTable.stdevp=new _FunctionDefinition((function(t,o){return e._getAggregateResult(wijmo_1.Aggregate.StdPop,t,o)}));this._functionTable.count=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.Count,t,o)}));this._functionTable.counta=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.CountA,t,o)}));this._functionTable.countblank=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.CountBlank,t,o)}));this._functionTable.countif=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.CountIf,t,o)}),2,2);this._functionTable.countifs=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.CountIfs,t,o)}),254,2);this._functionTable.sumif=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.SumIf,t,o)}),3,2);this._functionTable.sumifs=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.SumIfs,t,o)}),255,2);this._functionTable.rank=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.Rank,t,o)}),3,2);this._functionTable.product=new _FunctionDefinition((function(t,o){return e._getFlexSheetAggregateResult(_FlexSheetAggregate.Product,t,o)}),255,1);this._functionTable.subtotal=new _FunctionDefinition((function(t,o){return e._handleSubtotal(t,o)}),255,2);this._functionTable.dcount=new _FunctionDefinition((function(t,o){return e._handleDCount(t,o)}),3,3);this._functionTable.sumproduct=new _FunctionDefinition((function(t,o){return e._getSumProduct(t,o)}),255,1)};_CalcEngine.prototype._registerMathFunction=function(){var e=this;this._functionTable.pi=new _FunctionDefinition((function(){return Math.PI}),0,0);this._functionTable.rand=new _FunctionDefinition((function(){return Math.random()}),0,0);this._functionTable.power=new _FunctionDefinition((function(t,o){return Math.pow(_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o))}),2,2);this._functionTable.atan2=new _FunctionDefinition((function(t,o){var i=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),n=_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o);if(0===i&&0===n)throw new DivideByZeroError(exports._ErrorMessages.Atan2ArgsLessThanZero);return Math.atan2(n,i)}),2,2);this._functionTable.mod=new _FunctionDefinition((function(t,o){var i=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),n=_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o),l=Math.abs(n);if(0===l)throw new DivideByZeroError;var r=Math.abs(i)%l;n<0&&(r=-r);return r}),2,2);this._functionTable.trunc=new _FunctionDefinition((function(t,o){var i,n,l,r=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),s=2===t.length?_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o):0;if(0===s){l="n0";n=r>=0?Math.floor(r):Math.ceil(r)}else{l="n"+((s=s>0?Math.floor(s):Math.ceil(s))>0?s:0);i=Math.pow(10,s);n=r>=0?Math.floor(r*i)/i:Math.ceil(r*i)/i}if(null!=n)return{value:n,format:l}}),2,1);["ceiling","floor"].forEach((function(t){e._functionTable[t]=new _FunctionDefinition((function(o,i){var n,l,r=_Expression.toNumber(o[0],e._rowIndex,e._columnIndex,i),s=2===o.length?_Expression.toNumber(o[1],e._rowIndex,e._columnIndex,i):1;if(isNaN(r))throw new ValueError(exports._ErrorMessages.InvalidParameter("number"));if(isNaN(s))throw new ValueError(exports._ErrorMessages.InvalidParameter("significance"));if(r>0&&s<0)throw new NumericError(exports._ErrorMessages.InvalidParameter("significance"));if(0===r||0===s)return 0;l=1;if(0!==(n=s-Math.floor(s)))for(;n<1;){l*=10;n*=10}return s*l*("ceiling"===t?Math.ceil(r/s):Math.floor(r/s))/l}),2,1)}));["round","rounddown","roundup"].forEach((function(t){e._functionTable[t]=new _FunctionDefinition((function(o,i){var n,l,r,s=_Expression.toNumber(o[0],e._rowIndex,e._columnIndex,i),a=_Expression.toNumber(o[1],e._rowIndex,e._columnIndex,i);if(0===a){switch(t){case"rounddown":n=s>=0?Math.floor(s):Math.ceil(s);break;case"roundup":n=s>=0?Math.ceil(s):Math.floor(s);break;case"round":n=(s>=0?1:-1)*Math.round(Math.abs(s));break;default:n=Math.floor(s)}l="n0"}else{a=a>0?Math.floor(a):Math.ceil(a);r=Math.pow(10,a);switch(t){case"rounddown":n=s>=0?Math.floor(s*r)/r:Math.ceil(s*r)/r;break;case"roundup":n=s>=0?Math.ceil(s*r)/r:Math.floor(s*r)/r;break;case"round":n=(s>=0?1:-1)*Math.round(Math.abs(s)*r)/r}l="n"+(a>0?a:0)}if(null!=n)return{value:n,format:l}}),2,2)}));["abs","acos","asin","atan","cos","exp","ln","sin","sqrt","tan"].forEach((function(t){e._functionTable[t]=new _FunctionDefinition((function(o,i){return"ln"===t?Math.log(_Expression.toNumber(o[0],e._rowIndex,e._columnIndex,i)):Math[t](_Expression.toNumber(o[0],e._rowIndex,e._columnIndex,i))}),1,1)}))};_CalcEngine.prototype._registerLogicalFunction=function(){var e=this;this._functionTable.and=new _FunctionDefinition((function(t,o){var i,n=!0;for(i=0;i<t.length&&(n=n&&_Expression.toBoolean(t[i],e._rowIndex,e._columnIndex,o));i++);return n}),Number.MAX_VALUE,1);this._functionTable.or=new _FunctionDefinition((function(t,o){var i,n=!1;for(i=0;i<t.length&&!(n=n||_Expression.toBoolean(t[i],e._rowIndex,e._columnIndex,o));i++);return n}),Number.MAX_VALUE,1);this._functionTable.not=new _FunctionDefinition((function(t,o){return!_Expression.toBoolean(t[0],e._rowIndex,e._columnIndex,o)}),1,1);this._functionTable.if=new _FunctionDefinition((function(t,o){return 3===t.length?_Expression.toBoolean(t[0],e._rowIndex,e._columnIndex,o)?t[1].evaluate(e._rowIndex,e._columnIndex,o):t[2].evaluate(e._rowIndex,e._columnIndex,o):!!_Expression.toBoolean(t[0],e._rowIndex,e._columnIndex,o)&&t[1].evaluate(e._rowIndex,e._columnIndex,o)}),3,2);this._functionTable.true=new _FunctionDefinition((function(){return!0}),0,0);this._functionTable.false=new _FunctionDefinition((function(){return!1}),0,0)};_CalcEngine.prototype._registerTextFunction=function(){var e=this;this._functionTable.char=new _FunctionDefinition((function(t,o){var i,n="";for(i=0;i<t.length;i++)n+=String.fromCharCode(_Expression.toNumber(t[i],e._rowIndex,e._columnIndex,o));return n}),Number.MAX_VALUE,1);this._functionTable.code=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return i&&i.length>0?i.charCodeAt(0):-1}),1,1);var t=new _FunctionDefinition((function(t,o){var i="";t.forEach((function(t){if(t instanceof _CellRangeExpression){var n=t.getValues(!0,void 0,o);i=i.concat(n.reduce((function(e,t){return""+e+t}),""))}else i=i.concat(_Expression.toString(t,e._rowIndex,e._columnIndex,o))}));return i}),Number.MAX_VALUE,1);this._functionTable.concat=t;this._functionTable.concatenate=t;this._functionTable.left=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),n=null==t[1]?1:Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o));return i&&i.length>0?i.slice(0,n):null}),2,1);this._functionTable.right=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),n=null==t[1]?1:Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o));return i&&i.length>0?n?i.slice(-n):"":null}),2,1);this._functionTable.find=new _FunctionDefinition((function(t,o){var i,n=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),l=_Expression.toString(t[1],e._rowIndex,e._columnIndex,o),r=null!=t[2]?wijmo_1.asInt(_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o)):0;return null!=l&&null!=n&&(i=!isNaN(r)&&r>0&&r<=l.length?l.indexOf(n,r-1):l.indexOf(n))>-1?i+1:-1}),3,2);this._functionTable.search=new _FunctionDefinition((function(t,o){var i,n,l,r=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),s=_Expression.toString(t[1],e._rowIndex,e._columnIndex,o),a=null!=t[2]?wijmo_1.asInt(_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o)):0;if(null!=s&&null!=r){n=new RegExp(r,"i");if(!isNaN(a)&&a>0&&a<s.length){s=s.substring(a-1);i=a}else i=1;if((l=s.search(n))>-1)return l+i}return-1}),3,2);this._functionTable.len=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return null!=i?i.length:-1}),1,1);this._functionTable.mid=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),n=Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o)),l=Math.floor(_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o));return i&&i.length>0&&n>0?i.substr(n-1,l):null}),3,3);this._functionTable.lower=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return i&&i.length>0?i.toLowerCase():null}),1,1);this._functionTable.upper=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return i&&i.length>0?i.toUpperCase():null}),1,1);this._functionTable.proper=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);if(i&&i.length>0){i=(i=i.toLowerCase())[0].toUpperCase()+i.substring(1);for(var n=1;n<i.length;n++)if(rgLetter.test(i[n])&&!rgLetter.test(i[n-1])){i=i.substr(0,n)+i[n].toUpperCase()+i.substring(n+1);n++}return i}return null}),1,1);this._functionTable.trim=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);return i&&i.length>0?i.trim().replace(/\s+/gm," "):null}),1,1);this._functionTable.replace=new _FunctionDefinition((function(t,o){var i=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),n=Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o)),l=Math.floor(_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o)),r=_Expression.toString(t[3],e._rowIndex,e._columnIndex,o);return i&&i.length>0&&n>0?i.substring(0,n-1)+r+i.slice(n-1+l):null}),4,4);this._functionTable.substitute=new _FunctionDefinition((function(t,o){var i,n=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),l=_Expression.toString(t[1],e._rowIndex,e._columnIndex,o),r=_Expression.toString(t[2],e._rowIndex,e._columnIndex,o),s=4===t.length?_Expression.toNumber(t[3],e._rowIndex,e._columnIndex,o):null,a=0;if(null!=s&&s<1||isNaN(s))throw new ValueError(exports._ErrorMessages.InvalidParameter("instance_num"));if(n&&n.length>0&&l&&l.length>0){i=new RegExp(l,"g");return n.replace(i,(function(e){a++;if(null!=s){s=Math.floor(s);return a===s?r:e}return r}))}return null}),4,3);this._functionTable.rept=new _FunctionDefinition((function(t,o){var i,n=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o),l=Math.floor(_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o)),r="";if(n&&n.length>0&&l>0)for(i=0;i<l;i++)r=r.concat(n);return r}),2,2);this._functionTable.text=new _FunctionDefinition((function(t,o){var i,n=t[0].evaluate(e._rowIndex,e._columnIndex,o),l=_Expression.toString(t[1],e._rowIndex,e._columnIndex,o);n&&!wijmo_1.isPrimitive(n)&&(n=n.value);if(wijmo_1.isDate(n))l=wijmo_xlsx_1.Workbook._fromXlsxDateFormat(l);else{var r=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o);if(!wijmo_1.isNumber(r)||isNaN(r))return n;if((i=l.match(/^(\d+)(\.\d+)?E\+(\d+)(\.\d+)?$/))&&5===i.length)return e._parseToScientificValue(r,i[1],i[2],i[3],i[4]);if(/M{1,4}|d{1,4}|y{1,4}/i.test(l)){l=wijmo_xlsx_1.Workbook._fromXlsxDateFormat(l);n=FlexSheet._fromOADate(r)}else l&&!/[ncpfdg]\d?/i.test(l)&&(l=wijmo_xlsx_1.Workbook.fromXlsxFormat(l)[0])}if(wijmo_1.isDate(n))switch(l){case"d":return n.getDate();case"M":return n.getMonth()+1;case"y":l="yy";break;case"yyy":l="yyyy"}return wijmo_1.Globalize.format(n,l)}),2,2);this._functionTable.value=new _FunctionDefinition((function(t,o){var i,n=_Expression.toString(t[0],e._rowIndex,e._columnIndex,o);if((n=n.replace(/(,\d{3})/g,(function(e){return e.substring(1)}))).length>0){if(n[0]===wijmo_1.culture.Globalize.numberFormat.currency.symbol)return+(n=n.substring(1));if("%"===n[n.length-1])return+(n=n.substring(0,n.length-1))/100}i=+n;return isNaN(i)?_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o):i}),1,1);this._functionTable.exact=new _FunctionDefinition((function(t,o){return _Expression.toString(t[0],e._rowIndex,e._columnIndex,o)==_Expression.toString(t[1],e._rowIndex,e._columnIndex,o)}),2,2)};_CalcEngine.prototype._registerDateFunction=function(){var e=this;this._functionTable.now=new _FunctionDefinition((function(){return{value:new Date,format:"M/d/yyyy h:mm"}}),0,0);this._functionTable.today=new _FunctionDefinition((function(){var e=new Date;return{value:new Date(e.getFullYear(),e.getMonth(),e.getDate()),format:"M/d/yyyy"}}),0,0);this._functionTable.year=new _FunctionDefinition((function(t,o){if(!_Expression.toString(t[0],e._rowIndex,e._columnIndex,o).trim())return 1900;var i=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o);return i&&!wijmo_1.isPrimitive(i)?i.value:wijmo_1.isDate(i)?i.getFullYear():1900}),1,1);this._functionTable.month=new _FunctionDefinition((function(t,o){if(!_Expression.toString(t[0],e._rowIndex,e._columnIndex,o).trim())return 1;var i=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o);return!wijmo_1.isPrimitive(i)&&i?i.value:wijmo_1.isDate(i)?i.getMonth()+1:1}),1,1);this._functionTable.day=new _FunctionDefinition((function(t,o){if(!_Expression.toString(t[0],e._rowIndex,e._columnIndex,o))return 0;var i=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o);return i&&!wijmo_1.isPrimitive(i)?i.value:wijmo_1.isDate(i)?i.getDate():0}),1,1);this._functionTable.hour=new _FunctionDefinition((function(t,o){var i=t[0].evaluate(e._rowIndex,e._columnIndex,o);if(wijmo_1.isNumber(i)&&!isNaN(i))return Math.floor(24*(i-Math.floor(i)));if(wijmo_1.isDate(i))return i.getHours();(i=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o))&&!wijmo_1.isPrimitive(i)&&(i=i.value);if(wijmo_1.isDate(i))return i.getHours();throw new ValueError(exports._ErrorMessages.InvalidParameter("serial_number"))}),1,1);this._functionTable.time=new _FunctionDefinition((function(t,o){var i=t[0].evaluate(e._rowIndex,e._columnIndex,o),n=t[1].evaluate(e._rowIndex,e._columnIndex,o),l=t[2].evaluate(e._rowIndex,e._columnIndex,o);if(wijmo_1.isNumber(i)&&wijmo_1.isNumber(n)&&wijmo_1.isNumber(l)){i%=24;n%=60;l%=60;return{value:new Date(0,0,0,i,n,l),format:"h:mm tt"}}throw new ValueError(exports._ErrorMessages.InvalidParameters)}),3,3);this._functionTable.date=new _FunctionDefinition((function(t,o){var i=t[0].evaluate(e._rowIndex,e._columnIndex,o),n=t[1].evaluate(e._rowIndex,e._columnIndex,o),l=t[2].evaluate(e._rowIndex,e._columnIndex,o);if(wijmo_1.isNumber(i)&&wijmo_1.isNumber(n)&&wijmo_1.isNumber(l))return{value:new Date(i,n-1,l),format:"M/d/yyyy"};throw new ValueError(exports._ErrorMessages.InvalidParameters)}),3,3);this._functionTable.datedif=new _FunctionDefinition((function(t,o){var i,n,l,r,s,a=_Expression.toDate(t[0],e._rowIndex,e._columnIndex,o),h=_Expression.toDate(t[1],e._rowIndex,e._columnIndex,o),u=t[2].evaluate(e._rowIndex,e._columnIndex,o);a&&!wijmo_1.isPrimitive(a)&&(a=a.value);h&&!wijmo_1.isPrimitive(h)&&(h=h.value);if(wijmo_1.isDate(a)&&wijmo_1.isDate(h)&&wijmo_1.isString(u)){if((i=a.getTime())>(n=h.getTime()))throw new NumericError(exports._ErrorMessages.InvalidParameter("start_date"));l=h.getDate()-a.getDate();r=h.getMonth()-a.getMonth();s=h.getFullYear()-a.getFullYear();switch(u.toUpperCase()){case"Y":return r>0?s:r<0?s-1:l>=0?s:s-1;case"M":return l>=0?12*s+r:12*s+r-1;case"D":return(n-i)/864e5;case"YM":return(r=l>=0?12*s+r:12*s+r-1)%12;case"YD":return r>0?(new Date(a.getFullYear(),h.getMonth(),h.getDate()).getTime()-a.getTime())/864e5:r<0?(new Date(a.getFullYear()+1,h.getMonth(),h.getDate()).getTime()-a.getTime())/864e5:l>=0?l:(new Date(a.getFullYear()+1,h.getMonth(),h.getDate()).getTime()-a.getTime())/864e5;case"MD":return l>=0?l:l=new Date(h.getFullYear(),h.getMonth(),0).getDate()-new Date(h.getFullYear(),h.getMonth()-1,1).getDate()+1+l;default:throw new NumericError(exports._ErrorMessages.InvalidParameter("unit"))}}throw new ValueError(exports._ErrorMessages.InvalidParameters)}),3,3)};_CalcEngine.prototype._registLookUpReferenceFunction=function(){var e=this;this._functionTable.column=new _FunctionDefinition((function(t,o,i,n){var l;if(null==t)return n+1;l=t[0];if((l=e._ensureNonFunctionExpression(l,o))instanceof _CellRangeExpression)return l.cells.col+1;throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),1,0);this._functionTable.columns=new _FunctionDefinition((function(t,o){var i=t[0];if((i=e._ensureNonFunctionExpression(i,o))instanceof _CellRangeExpression)return i.cells.columnSpan;throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),1,1);this._functionTable.row=new _FunctionDefinition((function(t,o,i,n){var l;if(null==t)return i+1;l=t[0];if((l=e._ensureNonFunctionExpression(l,o))instanceof _CellRangeExpression)return l.cells.row+1;throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),1,0);this._functionTable.rows=new _FunctionDefinition((function(t,o){var i=t[0];if((i=e._ensureNonFunctionExpression(i,o))instanceof _CellRangeExpression)return i.cells.rowSpan;throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),1,1);this._functionTable.choose=new _FunctionDefinition((function(t,o){var i=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o);if(isNaN(i))throw new ValueError(exports._ErrorMessages.InvalidParameter("index_num"));if(i<1||i>=t.length)throw new ValueError(exports._ErrorMessages.ParameterIsOutOfRange("index_num"));return t[i=Math.floor(i)].evaluate(e._rowIndex,e._columnIndex,o)}),255,2);this._functionTable.index=new _FunctionDefinition((function(t,o){var i,n=t[0],l=_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o),r=null!=t[2]?_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o):0;if(isNaN(l)||l<0)throw new ValueError(exports._ErrorMessages.InvalidParameter("row_num"));if(isNaN(r)||r<0)throw new ValueError(exports._ErrorMessages.InvalidParameter("column_num"));if((n=e._ensureNonFunctionExpression(n,o))instanceof _CellRangeExpression){if(l>(i=n.cells).rowSpan)throw new ReferenceError(exports._ErrorMessages.ParameterIsOutOfRange("row_num"));if(r>i.columnSpan)throw new ReferenceError(exports._ErrorMessages.ParameterIsOutOfRange("column_num"));if(l>0&&r>0)return e._owner.getCellValue(i.topRow+l-1,i.leftCol+r-1,!0,o);if(0===l&&0===r)return n;if(0===l)return new _CellRangeExpression(e,new wijmo_grid_1.CellRange(i.topRow,i.leftCol+r-1,i.bottomRow,i.leftCol+r-1),n.sheetRef,e._owner);if(0===r)return new _CellRangeExpression(e,new wijmo_grid_1.CellRange(i.topRow+l-1,i.leftCol,i.topRow+l-1,i.rightCol),n.sheetRef,e._owner)}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),4,2);this._functionTable.hlookup=new _FunctionDefinition((function(t,o){return e._handleHLookup(t,o)}),4,3);this._functionTable.vlookup=new _FunctionDefinition((function(t,o){return e._handleVLookup(t,o)}),4,3)};_CalcEngine.prototype._registFinacialFunction=function(){var e=this;this._functionTable.rate=new _FunctionDefinition((function(t,o){return{value:e._calculateRate(t,o),format:"p2"}}),6,3)};_CalcEngine.prototype._registAddressRelatedFunction=function(){var e=this;this._functionTable.indirect=new _FunctionDefinition((function(t,o){var i,n,l,r,s,a,h,u=e._ensureNonFunctionExpression(t[0],o);if(u instanceof _CellRangeExpression){i=u.cells;n=u.evaluate(i.row,i.col,o)}else n=u instanceof _Expression?u.evaluate(e._rowIndex,e._columnIndex,o):u;if(wijmo_1.isString(n)){if(2===(l=n.split("!")).length){r=l[0].toLowerCase();s=l[1].toLowerCase()}else s=l[0].toLowerCase();var d=e._owner.definedNames._find(s,r||e._sheet.name);o=o||e._owner.selectedSheet;if(d){if(d.sheetName&&d.sheetName.toLowerCase()!==o.name.toLowerCase())throw new ReferenceError(exports._ErrorMessages.InvalidCellRef);n=d.value}if(a=e._getCellRange(n)){if(a.sheetRef){for(var _=0;_<e._owner.sheets.length;_++)if(e._owner.sheets[_].name.toLowerCase()===a.sheetRef.toLowerCase()){h=e._owner.sheets[_];break}}else h=e._owner.selectedSheet;if(h)return e._owner.getCellValue(a.cellRef.cellRange.row,a.cellRef.cellRange.col,!0,o)}}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)}),2,1);this._functionTable.address=new _FunctionDefinition((function(t,o){var i,n,l=_Expression.toNumber(t[0],e._rowIndex,e._columnIndex,o),r=_Expression.toNumber(t[1],e._rowIndex,e._columnIndex,o),s=!1,a=!1;if(isNaN(l)||!wijmo_1.isInt(l)||l<1||l>1048576)throw new ValueError(exports._ErrorMessages.InvalidParameter("row_num"));if(isNaN(r)||!wijmo_1.isInt(r)||r<1||r>16384)throw new ValueError(exports._ErrorMessages.InvalidParameter("column_num"));if(null!=t[2]){i=_Expression.toNumber(t[2],e._rowIndex,e._columnIndex,o);if(isNaN(i)||!wijmo_1.isInt(i)||i<1||i>4)throw new ValueError(exports._ErrorMessages.InvalidParameter("abs_num"))}null!=t[4]&&(n=_Expression.toString(t[4],e._rowIndex,e._columnIndex,o));if(null==i||1===i){s=!0;a=!0}else 2===i?s=!0:3===i&&(a=!0);return(null!=n?n+"!":"")+(a?"$":"")+e._numAlpha(r)+(s?"$":"")+l}),5,2)};_CalcEngine.prototype._registerIsFunctions=function(){var e=this,getError=function(t,o){var i;try{i=t.evaluate(e._rowIndex,e._columnIndex,o)}catch(e){e instanceof FormulaError&&(i=e)}return i};this._functionTable.isblank=new _FunctionDefinition((function(t,o){var i=!1,n=t[0];if(n instanceof _CellRangeExpression){n.evaluate(e._rowIndex,e._columnIndex,o);i=!!n._isEmpty}return i}),1,1);this._functionTable.iserror=new _FunctionDefinition((function(e,t){return getError(e[0],t)instanceof FormulaError}),1,1);this._functionTable.iserr=new _FunctionDefinition((function(e,t){var o=getError(e[0],t);return o instanceof FormulaError&&!(o instanceof NotAvailableError)}),1,1);this._functionTable.iferror=new _FunctionDefinition((function(t,o){var i=getError(t[0],o);return i instanceof FormulaError?t[1].evaluate(e._rowIndex,e._columnIndex,o):i}),2,2)};_CalcEngine.prototype._addToken=function(e,t,o){var i=new _Token(e,t,o);this._tokenTable[e]=i};_CalcEngine.prototype._parseExpression=function(){this._getToken();return this._parseCompareOrConcat()};_CalcEngine.prototype._parseCompareOrConcat=function(){for(var e,t,o=this._parseAddSub();this._token.tokenType===_TokenType.COMPARE||this._token.tokenType===_TokenType.CONCAT;){e=this._token;this._getToken();t=this._parseAddSub();o=new _BinaryExpression(this,e,o,t)}return o};_CalcEngine.prototype._parseAddSub=function(){for(var e,t,o=this._parseMulDiv();this._token.tokenType===_TokenType.ADDSUB;){e=this._token;this._getToken();t=this._parseMulDiv();o=new _BinaryExpression(this,e,o,t)}return o};_CalcEngine.prototype._parseMulDiv=function(){for(var e,t,o=this._parsePower();this._token.tokenType===_TokenType.MULDIV;){if(this._token.tokenID===_TokenID.PERCENT){e=new _Token("%",_TokenID.PERCENT,_TokenType.MULDIV);this._token=new _Token(100,_TokenID.ATOM,_TokenType.LITERAL)}else{e=this._token;this._getToken()}t=this._parsePower();o=new _BinaryExpression(this,e,o,t)}return o};_CalcEngine.prototype._parsePower=function(){for(var e,t,o=this._parseUnary();this._token.tokenType===_TokenType.POWER;){e=this._token;this._getToken();t=this._parseUnary();o=new _BinaryExpression(this,e,o,t)}return o};_CalcEngine.prototype._parseUnary=function(){var e,t;if(this._token.tokenID===_TokenID.ADD||this._token.tokenID===_TokenID.SUB){e=this._token;this._getToken();t=this._parseAtom();return new _UnaryExpression(this,e,t)}return this._parseAtom()};_CalcEngine.prototype._parseAtom=function(){var e=null;switch(this._token.tokenType){case _TokenType.LITERAL:case _TokenType.ERROR:e=new _Expression(this,this._token);break;case _TokenType.IDENTIFIER:var t=this._token.value.toString(),o=t.toLowerCase(),i=this._functionTable[0===o.indexOf("_xlfn.")?o.substr(6):o];if(i){var n=this._getParameters();if(this._token.tokenType===_TokenType.GROUP&&this._token.tokenID===_TokenID.CLOSE){var l=n?n.length:0;if(-1!==i.paramMin&&l<i.paramMin)throw new SyntaxError(exports._ErrorMessages.TooFewParameters);if(-1!==i.paramMax&&l>i.paramMax)throw new SyntaxError(exports._ErrorMessages.TooManyParameters);"rand"!==o&&("column"!==o&&"row"!==o||0!==l)||(this._containsCellRef=!0);e=new _FunctionExpression(this,o,i,n);break}if("true"===o||"false"===o){e=new _FunctionExpression(this,o,i,n,!1);break}}var r=o.split("!"),s=void 0,a=void 0;if(2===r.length){a=r[0];s=r[1]}else s=r[0];var h=this._owner.definedNames._find(s,a||this._sheet.name);if(h){if(h.sheetName&&h.sheetName.toLowerCase()!==this._sheet.name.toLowerCase()&&h.sheetName.toLowerCase()!==a)throw new NameError(exports._ErrorMessages.DefNameInvalidSheet(h.sheetName));var u=this._pointer,d=this._expressLength,_=this._expression;this._pointer=0;(e=this._checkCache(h.value))._definedName=h.name;this._pointer=u;this._expressLength=d;this._expression=_;break}a="";if(null!=(p=this._owner._getTable(o))){if(""===(a=p.sheet.name))throw new NameError(exports._ErrorMessages.InvalidTable(o));var c=this._pointer,g=this._token;this._getToken();if(this._token.tokenType===_TokenType.SQUAREBRACKETS&&this._token.tokenID===_TokenID.OPEN){this._tableRefStart=!0;e=this._getTableReference(p,a,!0)}else{e=this._getTableReference(p,a,!1);this._pointer=c;this._token=g}break}var f=this._getCellRange(t);if(f){this._containsCellRef=!0;e=new _CellRangeExpression(this,f.cellRef.cellRange,f.sheetRef,this._owner,t.indexOf(":")>-1,f.cellRef.absRow,f.cellRef.absCol,f.cellRef.absRow2,f.cellRef.absCol2,f.isWholeRow);break}e=this.onUnknownFunction(o,this._getParameters());break;case _TokenType.GROUP:if(this._token.tokenID!==_TokenID.OPEN)throw new SyntaxError(exports._ErrorMessages.ExpressionExpected);this._getToken();e=this._parseCompareOrConcat();if(this._token.tokenID!==_TokenID.CLOSE)throw new SyntaxError(exports._ErrorMessages.UnbalancedParenthesis);e._inGroup=!0;break;case _TokenType.SQUAREBRACKETS:if(this._token.tokenID!==_TokenID.OPEN)throw new ValueError(exports._ErrorMessages.TableReferencesExpected);var p;if(null!=(p=this._sheet.findTable(this._rowIndex,this._columnIndex))){a=p.sheet.name;this._tableRefStart=!0;e=this._getTableReference(p,a,!0,!1)}}if(null==e)throw new SyntaxError(exports._ErrorMessages.BadExpression);this._getToken();return e};_CalcEngine.prototype._getToken=function(){for(var e,t,o,i,n,l,r="",s="",a=new RegExp("[ -〿-ゟ゠-ヿ-゚一-龯㐀-䶿]");this._pointer<this._expressLength&&" "===this._expression[this._pointer];)this._pointer++;if(this._pointer>=this._expressLength)this._token=new _Token(null,_TokenID.END,_TokenType.GROUP);else{l=(t=this._expression[this._pointer])>="0"&&t<="9"||"."==t;if(!(n=t>="a"&&t<="z"||t>="A"&&t<="Z"||a.test(t))&&!l){var h=this._tokenTable[t];if(h){this._token=h;this._pointer++;if(this._pointer<this._expressLength&&(">"===t||"<"===t)&&(h=this._tokenTable[this._expression.substring(this._pointer-1,this._pointer+1)])){this._token=h;this._pointer++}return}}if(l){i=this._pointer;this._parseDigit();if(":"!==this._expression[this._pointer])return;this._pointer=i}if('"'!==t){if(("'"!==t||(s=this._parseSheetRef()))&&("#"!==t||!this._parseError()))if("#"!==t){if(!n&&!l&&this._idChars.indexOf(t)<0&&!s)throw new SyntaxError(exports._ErrorMessages.IdentifierExpected);for(e=1;e+this._pointer<this._expressLength;e++){n=(t=this._expression[this._pointer+e])>="a"&&t<="z"||t>="A"&&t<="Z"||a.test(t);l=t>="0"&&t<="9";if("'"!==t||":"!==o){o=t;if(!n&&!l&&"."!==t&&this._idChars.indexOf(t)<0)break}else{r=s+this._expression.substring(this._pointer,this._pointer+e);this._pointer+=e;s=this._parseSheetRef();e=0}}r+=s+this._expression.substring(this._pointer,this._pointer+e);this._pointer+=e;this._token=new _Token(r,_TokenID.ATOM,_TokenType.IDENTIFIER)}else this._parseDate()}else this._parseString()}};_CalcEngine.prototype._getTableToken=function(){for(var e,t,o,i="",n=!1;this._pointer<this._expressLength&&" "===this._expression[this._pointer];)this._pointer++;if("@"===(t=this._expression[this._pointer])){i=t;this._pointer++}"["===(t=this._expression[this._pointer])&&(n=!0);for(e=1;e+this._pointer<this._expressLength;e++){t=this._expression[this._pointer+e];if(n&&","===t)throw new SyntaxError(exports._ErrorMessages.InvalidTableRef);if("]"===t)break}o=i+this._expression.substring(this._pointer+(n?1:0),this._pointer+e);this._pointer+=e+(n?1:0);this._token=new _Token(o,_TokenID.ATOM,_TokenType.IDENTIFIER)};_CalcEngine.prototype._parseDigit=function(){var e,t,o=-1,i=!1,n=0;for(e=0;e+this._pointer<this._expressLength;e++)if((t=this._expression[this._pointer+e])>="0"&&t<="9"){n=10*n+(+t-0);o>-1&&(o*=10)}else if("."===t&&o<0)o=1;else{if("E"!==t&&"e"!==t||i)break;i=!0;"+"!==(t=this._expression[this._pointer+e+1])&&"-"!==t||e++}i?n=+this._expression.substring(this._pointer,this._pointer+e):o>1&&(n/=o);this._token=new _Token(n,_TokenID.ATOM,_TokenType.LITERAL);this._pointer+=e};_CalcEngine.prototype._parseString=function(){var e,t,o;for(e=1;e+this._pointer<this._expressLength;e++)if('"'===(t=this._expression[this._pointer+e])){if('"'!==(e+this._pointer<this._expressLength-1?this._expression[this._pointer+e+1]:" "))break;e++}if('"'!==t)throw new SyntaxError(exports._ErrorMessages.CantFindFinalQuote);o=this._expression.substring(this._pointer+1,this._pointer+e);this._pointer+=e+1;if("!"===this._expression[this._pointer])throw new SyntaxError(exports._ErrorMessages.IllegalCrossSheetReference);this._token=new _Token(o.replace('""','"'),_TokenID.ATOM,_TokenType.LITERAL)};_CalcEngine.prototype._parseDate=function(){var e,t,o;for(e=1;e+this._pointer<this._expressLength&&"#"!==(t=this._expression[this._pointer+e]);e++);if("#"!==t)throw new SyntaxError(exports._ErrorMessages.CantFindFinalDateDelimiter);o=this._expression.substring(this._pointer+1,this._pointer+e);this._pointer+=e+1;this._token=new _Token(Date.parse(o),_TokenID.ATOM,_TokenType.LITERAL)};_CalcEngine.prototype._parseError=function(){var e,t=this._pointer;for(e=t+1;e<this._expressLength;e++){var o=this._expression[e],i=this._expression[e-1];if(!(o>="a"&&o<="z"||o>="A"&&o<="Z"||("0"===o||"?"===o||"!"===o||"/"===o)&&(i>="a"&&i<="z"||i>="A"&&i<="Z"||"/"===i||"0"===i)))break}var n=e-t;if(n>3){var l=this._expression.substring(t,t+n),r=_FormulaErrorHelper.asError(l);if(r){this._token=new _Token(r,_TokenID.ATOM,_TokenType.ERROR);this._pointer+=n;return!0}}return!1};_CalcEngine.prototype._parseSheetRef=function(){var e,t,o;for(e=1;e+this._pointer<this._expressLength;e++)if("'"===(t=this._expression[this._pointer+e])){if("'"!==(e+this._pointer<this._expressLength-1?this._expression[this._pointer+e+1]:" "))break;e++}if("'"!==t)throw new SyntaxError(exports._ErrorMessages.CantFindFinalQuote);o=this._expression.substring(this._pointer+1,this._pointer+e);this._pointer+=e+1;return"!"===this._expression[this._pointer]?o.replace(/''/g,"'"):""};_CalcEngine.prototype._getCellRange=function(e){var t,o,i,n,l;if(e&&(t=e.split(":")).length>0&&t.length<3){if(null==(o=this._parseCell(t[0])).cellRef)return null;n=o.cellRef.cellRange;if(null!=o.cellRef.isWholeRow&&1===t.length)return null;if(n&&2===t.length){l=(i=this._parseCell(t[1])).cellRef.cellRange;if(null!=o.cellRef.isWholeRow&&o.cellRef.isWholeRow!==i.cellRef.isWholeRow)return null;o.sheetRef&&!i.sheetRef&&(i.sheetRef=o.sheetRef);if(o.sheetRef!==i.sheetRef)throw new ReferenceError(exports._ErrorMessages.CellRefMustBeInSameSheet);if(l){n.col2=l.col;n.row2=l.row}else n=null}}return null==n?null:{cellRef:{cellRange:n,absRow:o.cellRef.absRow,absCol:o.cellRef.absCol,absRow2:i?i.cellRef.absRow:null,absCol2:i?i.cellRef.absCol:null},sheetRef:o.sheetRef,isWholeRow:o.cellRef.isWholeRow}};_CalcEngine.prototype._parseCellRange=function(e){var t,o,i,n,l=-1,r=-1,s=!1,a=!1;for(t=0;t<e.length;t++)if("$"===(i=e[t])&&!s&&l<0)s=!0;else{if(!(i>="a"&&i<="z"||i>="A"&&i<="Z"))break;l<0&&(l=0);l=26*l+(i.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1)}for(;t<e.length;t++)if("$"===(i=e[t])&&!a&&r<0)a=!0;else{if(!(i>="0"&&i<="9"))break;r<0&&(r=0);r=10*r+(+i-0)}if(t<e.length)return null;if(r>-1&&l>-1){if(0===r)throw new NameError(exports._ErrorMessages.InvalidCellRef);o=new wijmo_grid_1.CellRange(r-1,l-1)}else if(-1===l){n=!0;o=new wijmo_grid_1.CellRange(r-1,0)}else if(-1===r){n=!1;o=new wijmo_grid_1.CellRange(0,l-1)}return{cellRange:o,absRow:a,absCol:s,isWholeRow:n}};_CalcEngine.prototype._parseCell=function(e){var t,o,i;if((t=e.lastIndexOf("!"))>0&&t<e.length-1){i=e.substring(0,t);o=e.substring(t+1)}else{if(!(t<=0))return null;o=e}return{cellRef:this._parseCellRange(o),sheetRef:i}};_CalcEngine.prototype._getParameters=function(){var e,t,o=this._pointer,i=this._token;this._getToken();if(this._token.tokenType!==_TokenType.SQUAREBRACKETS||this._token.tokenID!==_TokenID.OPEN){if(this._token.tokenID!==_TokenID.OPEN){this._pointer=o;this._token=i;return null}o=this._pointer;this._getToken();if(this._token.tokenID===_TokenID.CLOSE)return null;this._pointer=o;e=[];t=this._parseExpression();e.push(t);for(;this._token.tokenID===_TokenID.COMMA;){t=this._parseExpression();e.push(t)}if(this._token.tokenID!==_TokenID.CLOSE)throw new SyntaxError(exports._ErrorMessages.SyntaxError);return e}};_CalcEngine.prototype._getTableReference=function(e,t,o,i){void 0===i&&(i=!0);var n=[],l=o?this._getTableParameter():null,r=!1,s=!1;if(null==l){n.push("#Data");s=!0}else{n.push(l);for(;this._tableRefStart&&(this._token.tokenID===_TokenID.COMMA||":"===this._token.value);){":"===this._token.value&&(r=!0);if(null==(l=this._getTableParameter()))throw new SyntaxError(exports._ErrorMessages.InvalidTableRef);if(r){n[n.length-1]+=":"+l;r=!1}else n.push(l)}if(this._token.tokenType!==_TokenType.SQUAREBRACKETS||this._token.tokenID!==_TokenID.CLOSE)throw new SyntaxError(exports._ErrorMessages.UnbalancedSquareBrackets);this._tableRefStart=!1}var a=this._getTableRange(e,n);this._containsCellRef=!0;var h=new _CellRangeExpression(this,a,t.toLowerCase(),this._owner);h._tableParams=n;i&&(h._tableName=e.name);s&&(h._defTableParameterProvided=!0);return h};_CalcEngine.prototype._getTableParameter=function(){var e;for(this._pointer;this._pointer<this._expressLength&&" "===this._expression[this._pointer];)this._pointer++;if("]"===this._expression[this._pointer]){this._getToken();this._tableRefStart=!1;return null}this._getTableToken();e=this._token.value;this._getToken();return e};_CalcEngine.prototype._getTableRange=function(e,t){for(var o,i,n,l,r,s,a=0;a<t.length;a++){if(i)throw new ValueError(exports._ErrorMessages.InvalidTableRef);r=null;if("#"===(o=t[a].toLowerCase())[0]){switch(o){case"#all":r=e.getRange();break;case"#data":r=e.getRange(TableSection.Data);break;case"#headers":r=e.getRange(TableSection.Header);break;case"#totals":r=e.getRange(TableSection.Footer);break;case"#this row":l=e.getRange();if(!(this._rowIndex>=l.topRow&&this._rowIndex<=l.bottomRow))throw new ValueError(exports._ErrorMessages.RowIsOutOfTableRange(e.name));r=new wijmo_grid_1.CellRange(this._rowIndex,l.leftCol,this._rowIndex,l.rightCol);break;default:throw new ValueError(exports._ErrorMessages.InvalidTableRef)}if(null==r)throw new ValueError(exports._ErrorMessages.InvalidTableRef);if(null==n)n=r;else{n.row=n.topRow<r.topRow?n.topRow:r.topRow;n.row2=n.bottomRow>r.bottomRow?n.bottomRow:r.bottomRow}}else{i=!0;s=o.split(":");for(var h=0;h<s.length;h++){if(s.length>2)throw new ValueError(exports._ErrorMessages.InvalidTableColRef);if("@"===(o=s[h])[0]){if(null==(r=e.getRange(TableSection.Data,o.substring(1))))throw new ValueError(exports._ErrorMessages.InvalidTableRef);if(!(this._rowIndex>=r.topRow&&this._rowIndex<=r.bottomRow))throw new ValueError(exports._ErrorMessages.RowIsOutOfTableRange(e.name));r.row=this._rowIndex;r.row2=this._rowIndex}else if(null==(r=e.getRange(TableSection.Data,o)))throw new ValueError(exports._ErrorMessages.InvalidTableRef);0===h&&(null==n?n=r:n.col=r.col);n.col2=r.col;r=null}}}return n};_CalcEngine.prototype._getAggregate=function(e,t){for(var o=0,i=0,n=0,l=null,r=null,s=0;s<t.length;s++){var a=t[s];if(null!=a&&"number"==typeof a&&!isNaN(a)){(null==l||a<l)&&(l=a);(null==r||a>r)&&(r=a);o++;i+=a;n+=a*a}}var h=0==o?0:i/o;switch(e){case wijmo_1.Aggregate.Avg:return h;case wijmo_1.Aggregate.Max:return r;case wijmo_1.Aggregate.Min:return l;case wijmo_1.Aggregate.Sum:return i;case wijmo_1.Aggregate.VarPop:return o<=1?0:n/o-h*h;case wijmo_1.Aggregate.StdPop:return o<=1?0:Math.sqrt(n/o-h*h);case wijmo_1.Aggregate.Var:return o<=1?0:(n/o-h*h)*o/(o-1);case wijmo_1.Aggregate.Std:return o<=1?0:Math.sqrt((n/o-h*h)*o/(o-1))}throw"Invalid aggregate type."};_CalcEngine.prototype._getAggregateResult=function(e,t,o){var i,n=this._getItemList(t,o);i=this._getAggregate(e,n.items);n.isDate&&(i={value:i=new Date(i),format:n.format||"M/d/yyyy"});return i};_CalcEngine.prototype._getFlexSheetAggregateResult=function(e,t,o){var i,n;switch(e){case _FlexSheetAggregate.Count:i=this._getItemList(t,o,!1,void 0,void 0,!1);return this._countNumberCells(i.items);case _FlexSheetAggregate.CountA:return(i=this._getItemList(t,o,!1,void 0,void 0,!1)).items.length;case _FlexSheetAggregate.CountBlank:i=this._getItemList(t,o,!0,void 0,void 0,!1);return this._countBlankCells(i.items);case _FlexSheetAggregate.Rank:var l=_Expression.toNumber(t[0],this._rowIndex,this._columnIndex,o),r=t[2]?_Expression.toNumber(t[2],this._rowIndex,this._columnIndex,o):0;if(isNaN(l))throw new ValueError(exports._ErrorMessages.InvalidParameter("number"));if(isNaN(r))throw new ValueError(exports._ErrorMessages.InvalidParameter("order"));t[1]=this._ensureNonFunctionExpression(t[1],o);if(t[1]instanceof _CellRangeExpression){i=this._getItemList([t[1]],o);return this._getRankOfCellRange(l,i.items,r)}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);case _FlexSheetAggregate.CountIf:t[0]=this._ensureNonFunctionExpression(t[0],o);if(t[0]instanceof _CellRangeExpression){i=this._getItemList([t[0]],o,void 0,void 0,void 0,!1);return this._countCellsByCriteria([i.items],[t[1]],o)}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);case _FlexSheetAggregate.CountIfs:return this._handleCountIfs(t,o);case _FlexSheetAggregate.SumIf:t[0]=this._ensureNonFunctionExpression(t[0],o);if(t[0]instanceof _CellRangeExpression){var s=!1;t[2]=this._ensureNonFunctionExpression(t[2],o);null!=t[2]&&t[2]instanceof _CellRangeExpression&&(n=this._getItemList([t[2]],o,s=!0));i=this._getItemList([t[0]],o,s);return this._sumCellsByCriteria([i.items],[t[1]],n?n.items:null,o)}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);case _FlexSheetAggregate.SumIfs:return this._handleSumIfs(t,o);case _FlexSheetAggregate.Product:i=this._getItemList(t,o);return this._getProductOfNumbers(i.items)}throw"Invalid aggregate type."};_CalcEngine.prototype._getItemList=function(e,t,o,i,n,l){void 0===o&&(o=!1);void 0===i&&(i=!0);void 0===l&&(l=!0);var r,s,a,h,u,d,_,c,g,f,p=[];for(s=0;s<e.length;s++){u=e[s];if((u=this._ensureNonFunctionExpression(u,t))instanceof _CellRangeExpression){c=u._getSheet()||t||this._sheet;h=u.getValues(i,n,c,l);if(0===s){(g=c.getCellStyle(u.cells.topRow,u.cells.leftCol))&&(_=g.format);_||(f=c.grid.columns[u.cells.leftCol])&&(_=f.format)}for(a=0;a<h.length;a++){r=h[a];if(null==d&&null!=r&&!wijmo_1.isString(r)){d=wijmo_1.isDate(r);break}}for(a=0;a<h.length;a++){r=h[a];(o||null!=r&&""!==r)&&(wijmo_1.isDate(r)?p.push(+r):p.push(r))}}else{!(r=u instanceof _Expression?u.evaluate(this._rowIndex,this._columnIndex,t,void 0,void 0,l):u)||r instanceof FormulaError||wijmo_1.isPrimitive(r)||(r=r.value);if(!o&&(null==r||""===r))continue;var m=+r;isNaN(m)||(r=m);p.push(r);null==d&&p.length>0&&(d=r instanceof Date)}}0===p.length&&(d=!1);return{isDate:d,items:p,format:_}};_CalcEngine.prototype._countBlankCells=function(e){for(var t,o=0,i=0;o<e.length;o++)(null==(t=e[o])||wijmo_1.isString(t)&&""===t||wijmo_1.isNumber(t)&&isNaN(t))&&i++;return i};_CalcEngine.prototype._countNumberCells=function(e){for(var t,o=0,i=0;o<e.length;o++)null!=(t=e[o])&&wijmo_1.isNumber(t)&&!isNaN(t)&&i++;return i};_CalcEngine.prototype._getRankOfCellRange=function(e,t,o){void 0===o&&(o=0);var i,n=0,l=0;o?t.sort((function(e,t){return isNaN(e)||isNaN(t)?-1:e-t})):t.sort((function(e,t){return isNaN(e)||isNaN(t)?1:t-e}));for(;n<t.length;n++){i=t[n];if(!isNaN(i)&&wijmo_1.isNumber(i)){l++;if(e===i)return l}}throw new ValueError(exports._ErrorMessages.ParameterIsOutOfRange("number"))};_CalcEngine.prototype._handleCountIfs=function(e,t){var o,i,n,l,r=0,s=[],a=[];if(e.length%2!=0)throw new ValueError(exports._ErrorMessages.InvalidParameters);for(;r<e.length/2;r++){i=e[2*r];if(!((i=this._ensureNonFunctionExpression(i,t))instanceof _CellRangeExpression))throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);if(0===r){if(!i.cells)throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);n=i.cells.rowSpan;l=i.cells.columnSpan}else{if(!i.cells)throw new SyntaxError(exports._ErrorMessages.InvalidCellRef);if(i.cells.rowSpan!==n||i.cells.columnSpan!==l)throw new ValueError(exports._ErrorMessages.RangesMustBeTheSame)}o=this._getItemList([i],t,void 0,void 0,void 0,!1);s[r]=o.items;a[r]=e[2*r+1]}return this._countCellsByCriteria(s,a,t)};_CalcEngine.prototype._countCellsByCriteria=function(e,t,o,i){for(var n,l=0,r=e[0].length,s=[],a=0;a<t.length;a++){"*"===(u=_Expression.toString(t[a],this._rowIndex,this._columnIndex,o))?s.push(u):s.push(this._parseRightExpr(u))}for(var h=0;h<r;h++){n=!1;for(a=0;a<e.length;a++){var u,d=e[a][h];if("string"==typeof(u=s[a])){if("*"!==u&&(null==d||""===d)){n=!1;break}if((n="*"===u||this.evaluate(this._combineExpr(d,u),null,o,this._rowIndex,this._columnIndex,!1,!0))instanceof FormulaError||!n)break}else if(!(n=n=u.reg.test(d.toString())===u.checkMathces))break}if(n&&!(n instanceof FormulaError))if(i){var _=i[h];null!=_&&wijmo_1.isNumber(_)&&!isNaN(_)&&l++}else l++}return l};_CalcEngine.prototype._handleSumIfs=function(e,t){var o,i,n,l,r,s,a=1,h=[],u=[],d=!1;if(e.length%2!=1)throw new ValueError(exports._ErrorMessages.InvalidParameters);n=e[0];if(!((n=this._ensureNonFunctionExpression(n,t))instanceof _CellRangeExpression))throw new ValueError(exports._ErrorMessages.InvalidParameter("Sum_range"));if(!n.cells)throw new ValueError(exports._ErrorMessages.InvalidParameter("Sum_range"));r=n.cells.rowSpan;s=n.cells.columnSpan;i=this._getItemList([n],t,d=!0);for(;a<(e.length+1)/2;a++){l=e[2*a-1];if(!((l=this._ensureNonFunctionExpression(l,t))instanceof _CellRangeExpression))throw new ValueError(exports._ErrorMessages.InvalidParameter("Criteria_range"+a));if(!l.cells)throw new ValueError(exports._ErrorMessages.InvalidParameter("Criteria_range"+a));if(l.cells.rowSpan!==r||l.cells.columnSpan!==s)throw new ValueError(exports._ErrorMessages.RangesMustBeTheSame);o=this._getItemList([l],t,d);h[a-1]=o.items;u[a-1]=e[2*a]}return this._sumCellsByCriteria(h,u,i.items,t)};_CalcEngine.prototype._sumCellsByCriteria=function(e,t,o,i){var n,l,r,s,a=0,h=0,u=0,d=e[0].length,_=[];null==o&&(o=e[0]);for(;h<t.length;h++)"*"===(s=_Expression.toString(t[h],this._rowIndex,this._columnIndex,i))?_.push(s):_.push(this._parseRightExpr(s));for(;a<d;a++){l=!1;n=o[a];for(h=0;h<e.length;h++){r=e[h][a];if("string"==typeof(s=_[h])){if("*"!==s&&null==r){l=!1;break}if((l="*"===s||this.evaluate(this._combineExpr(r,s),null,i,this._rowIndex,this._columnIndex,!1))instanceof FormulaError||!l)break}else if(!(l=s.reg.test(r.toString())===s.checkMathces))break}l&&wijmo_1.isNumber(n)&&!isNaN(n)&&(u+=n)}return u};_CalcEngine.prototype._getProductOfNumbers=function(e){var t,o=0,i=1,n=!1;if(e)for(;o<e.length;o++){t=e[o];if(wijmo_1.isNumber(t)&&!isNaN(t)){i*=t;n=!0}}return n?i:0};_CalcEngine.prototype._handleSubtotal=function(e,t){var o,i,n,l,r=!0,s=!0;if((o=_Expression.toNumber(e[0],this._rowIndex,this._columnIndex,t))>=1&&o<=11||o>=101&&o<=111){o>=101&&o<=111&&(r=!1);(o=wijmo_1.asEnum(o,_SubtotalFunction))!==_SubtotalFunction.CountA&&o!==_SubtotalFunction.CountAWithoutHidden||(s=!1);i=this._getItemList(e.slice(1),t,s,r);switch(o){case _SubtotalFunction.Count:case _SubtotalFunction.CountWithoutHidden:return this._countNumberCells(i.items);case _SubtotalFunction.CountA:case _SubtotalFunction.CountAWithoutHidden:return i.items.length;case _SubtotalFunction.Product:case _SubtotalFunction.ProductWithoutHidden:return this._getProductOfNumbers(i.items);case _SubtotalFunction.Average:case _SubtotalFunction.AverageWithoutHidden:n=wijmo_1.Aggregate.Avg;break;case _SubtotalFunction.Max:case _SubtotalFunction.MaxWithoutHidden:n=wijmo_1.Aggregate.Max;break;case _SubtotalFunction.Min:case _SubtotalFunction.MinWithoutHidden:n=wijmo_1.Aggregate.Min;break;case _SubtotalFunction.Std:case _SubtotalFunction.StdWithoutHidden:n=wijmo_1.Aggregate.Std;break;case _SubtotalFunction.StdPop:case _SubtotalFunction.StdPopWithoutHidden:n=wijmo_1.Aggregate.StdPop;break;case _SubtotalFunction.Sum:case _SubtotalFunction.SumWithoutHidden:n=wijmo_1.Aggregate.Sum;break;case _SubtotalFunction.Var:case _SubtotalFunction.VarWithoutHidden:n=wijmo_1.Aggregate.Var;break;case _SubtotalFunction.VarPop:case _SubtotalFunction.VarPopWithoutHidden:n=wijmo_1.Aggregate.VarPop}l=this._getAggregate(n,i.items);i.isDate&&(l=new Date(l));return l}throw new ValueError(exports._ErrorMessages.InvalidParameter("Function_num"))};_CalcEngine.prototype._handleDCount=function(e,t){var o,i,n,l=e[0],r=e[2];l=this._ensureNonFunctionExpression(l,t);r=this._ensureNonFunctionExpression(r,t);if(l instanceof _CellRangeExpression&&r instanceof _CellRangeExpression){o=e[1].evaluate(this._rowIndex,this._columnIndex,t);i=this._getColumnIndexByField(l,o);return(n=this._getItemList([l],t,!1,!0,i,!1)).items&&n.items.length>1?this._DCountWithCriteria(n.items.slice(1),l,r):0}throw new ValueError(exports._ErrorMessages.InvalidParameter("Database"))};_CalcEngine.prototype._DCountWithCriteria=function(e,t,o){var i,n,l,r,s,a,h,u,d,_,c,g=o.cells,f=0;i=this._owner._getSheet(t.sheetRef);n=this._owner._getSheet(o.sheetRef);if(g.rowSpan>1){l=g.topRow;for(r=g.bottomRow;r>g.topRow;r--){_=[];c=[];for(s=g.leftCol;s<=g.rightCol;s++)if(null!=(h=this._owner.getCellValue(r,s,!1,n))&&""!==h){c.push(new _Expression(this,h));u=this._owner.getCellValue(l,s,!1,n);a=this._getColumnIndexByField(t,u);if(!(null!=(d=this._getItemList([t],i,!1,!0,a,!1)).items&&d.items.length>1))throw new ValueError("Criteria");_.push(d.items.slice(1))}f+=this._countCellsByCriteria(_,c,i,e)}return f}throw new ValueError("Criteria")};_CalcEngine.prototype._getColumnIndexByField=function(e,t){var o,i,n,l,r;if(-1===(r=(o=e.cells).topRow))throw new ValueError(exports._ErrorMessages.InvalidParameter("Database"));if(wijmo_1.isInt(t)&&!isNaN(t)){if(t>=1&&t<=o.columnSpan)return n=o.leftCol+t-1}else{i=this._owner._getSheet(e.sheetRef);for(n=o.leftCol;n<=o.rightCol;n++){l=this._owner.getCellValue(r,n,!1,i);if((t=wijmo_1.isString(t)?t.toLowerCase():t)===(l=wijmo_1.isString(l)?l.toLowerCase():l))return n}}throw new ValueError(exports._ErrorMessages.InvalidParameter("Field"))};_CalcEngine.prototype._getSumProduct=function(e,t){var o,i,n,l=0,r=this._getItemListForSumProduct(e,t);if(r.length>0){i=r[0].length;n=r.length;for(var s=0;s<i;s++){o=1;for(var a=0;a<n;a++)o*=r[a][s];l+=o}}return l};_CalcEngine.prototype._getItemListForSumProduct=function(e,t){var o,i,n,l,r,s,a=[[]];for(n=0;n<e.length;n++){s=e[n];o=[];if((s=this._ensureNonFunctionExpression(s,t))instanceof _CellRangeExpression){r=s.getValues(!0,null,t);for(l=0;l<r.length;l++){i=r[l];o.push(+i)}}else{i=s instanceof _Expression?s.evaluate(this._rowIndex,this._columnIndex,t):s;o.push(+i)}if(n>0&&o.length!==a[0].length)throw new ValueError(exports._ErrorMessages.RangesMustBeTheSame);a[n]=o}return a};_CalcEngine.prototype._parseRightExpr=function(e){var t,o,i=!1;if(e.indexOf("?")>-1||e.indexOf("*")>-1){if(null==(t=e.match(/=?([?*]*)(\w*)([?*]*)(\w*)([?*]*)/))||6!==t.length)throw new ValueError(exports._ErrorMessages.InvalidParameter("Criteria"));o=new RegExp("^"+(t[1].length>0?this._parseRegCriteria(t[1]):"")+t[2]+(t[3].length>0?this._parseRegCriteria(t[3]):"")+t[4]+(t[5].length>0?this._parseRegCriteria(t[5]):"")+"$","i");/^[<>=]/.test(e)?"="===e.trim()[0]&&(i=!0):i=!0;return{reg:o,checkMathces:i}}var n=e.toLowerCase();if(isNaN(+e))if("true"===n||"false"===n)e="="+e;else if(/^\w/.test(e))e='="'+e+'"';else{if(!/^[<>=]{1,2}\s*-?.+$/.test(e))throw new ValueError(exports._ErrorMessages.InvalidParameter("Criteria"));e=e.replace(/([<>=]{1,2})\s*(-?.+)/,(function(e,t,o){var i=o.toLowerCase();return t+(isNaN(+o)&&"true"!==i&&"false"!==i?'"'+o+'"':o)}))}else e="="+ +e;return e};_CalcEngine.prototype._combineExpr=function(e,t){(wijmo_1.isString(e)||wijmo_1.isDate(e))&&(e='"'+e+'"');return(e="="+e)+t};_CalcEngine.prototype._parseRegCriteria=function(e){for(var t=0,o=0,i="";t<e.length;t++)if("*"===e[t]){if(o>0){i+="\\w{"+o+"}";o=0}i+="\\w*"}else"?"===e[t]&&o++;o>0&&(i+="\\w{"+o+"}");return i};_CalcEngine.prototype._calculateRate=function(e,t){var o,i,n,l,r,s,a,h,u,d,_=0,c=0;n=_Expression.toNumber(e[0],this._rowIndex,this._columnIndex,t);l=_Expression.toNumber(e[1],this._rowIndex,this._columnIndex,t);r=_Expression.toNumber(e[2],this._rowIndex,this._columnIndex,t);s=null!=e[3]?_Expression.toNumber(e[3],this._rowIndex,this._columnIndex,t):0;a=null!=e[4]?_Expression.toNumber(e[4],this._rowIndex,this._columnIndex,t):0;i=null!=e[5]?_Expression.toNumber(e[5],this._rowIndex,this._columnIndex,t):.1;Math.abs(i)<1e-7?r*(1+n*i)+l*(1+i*a)*n+s:r*(h=Math.exp(n*Math.log(1+i)))+l*(1/i+a)*(h-1)+s;u=r+l*n+s;d=r*h+l*(1/i+a)*(h-1)+s;o=i;for(;Math.abs(u-d)>1e-7&&_<20;){i=(d*c-u*o)/(d-u);c=o;o=i;u=d;d=Math.abs(i)<1e-7?r*(1+n*i)+l*(1+i*a)*n+s:r*(h=Math.exp(n*Math.log(1+i)))+l*(1/i+a)*(h-1)+s;++_}if(Math.abs(u-d)>1e-7&&20===_)throw new NumericError(exports._ErrorMessages.RateCriteriaFails);return i};_CalcEngine.prototype._handleHLookup=function(e,t){var o=this;return this._handleLookup(e,t,{base:function(e){return e.topRow},span:function(e){return e.rowSpan},iterStart:function(e){return e.leftCol},iterEnd:function(e){return e.rightCol},getValue:function(e,t,i){return o._owner.getCellValue(e,t,0,i)}})};_CalcEngine.prototype._handleVLookup=function(e,t){var o=this;return this._handleLookup(e,t,{base:function(e){return e.leftCol},span:function(e){return e.columnSpan},iterStart:function(e){return e.topRow},iterEnd:function(e){return e.bottomRow},getValue:function(e,t,i){return o._owner.getCellValue(t,e,0,i)}})};_CalcEngine.prototype._handleLookup=function(e,t,o){var i=e[0].evaluate(this._rowIndex,this._columnIndex,t),n=e[1],l=_Expression.toNumber(e[2],this._rowIndex,this._columnIndex,t),r=null==e[3]||_Expression.toBoolean(e[3],this._rowIndex,this._columnIndex,t);if(null==i||""===i)throw new NotAvailableError(exports._ErrorMessages.InvalidParameter("Lookup_value"));if(isNaN(l)||l<0)throw new ValueError(exports._ErrorMessages.InvalidParameter("index_num"));if((n=this._ensureNonFunctionExpression(n,t))instanceof _CellRangeExpression){t=n._getSheet()||t||this._sheet;var s=n.cells;if(l>o.span(s))throw new ReferenceError(exports._ErrorMessages.ParameterIsOutOfRange("index_num"));var a=void 0;r?-1===(a=this._exactMatch(i,s,!1,o,t))&&(a=this._approximateMatch(i,s,o,t)):a=this._exactMatch(i,s,!0,o,t);if(-1===a)throw new NotAvailableError;var h=o.getValue(o.base(s)+l-1,a,t);if(null==h)throw new NotAvailableError;return h}throw new SyntaxError(exports._ErrorMessages.InvalidCellRef)};_CalcEngine.prototype._exactMatch=function(e,t,o,i,n){var l,r=i.base(t);wijmo_1.isString(e)&&(e=e.toLowerCase());if(o&&wijmo_1.isString(e)&&(e.indexOf("?")>-1||e.indexOf("*")>-1)){var s=e.match(/([?*]*)(\w+)([?*]*)(\w+)([?*]*)/);if(null==s||6!==s.length)throw new ValueError(exports._ErrorMessages.InvalidParameter("Lookup_value"));l=new RegExp("^"+(s[1].length>0?this._parseRegCriteria(s[1]):"")+s[2]+(s[3].length>0?this._parseRegCriteria(s[3]):"")+s[4]+(s[5].length>0?this._parseRegCriteria(s[5]):"")+"$","i")}for(var a=i.iterStart(t);a<=i.iterEnd(t);a++){var h=i.getValue(r,a,n);if(null!=l){if(l.test(h))return a}else{wijmo_1.isString(h)&&(h=h.toLowerCase());if(e===h)return a}}return-1};_CalcEngine.prototype._approximateMatch=function(e,t,o,i){var n=o.base(t),l=[];wijmo_1.isString(e)&&(e=e.toLowerCase());for(var r=o.iterStart(t);r<=o.iterEnd(t);r++){var s=o.getValue(n,r,i);s=isNaN(+s)?s:+s;l.push({value:s,index:r})}l.sort((function(e,t){wijmo_1.isString(e.value)&&(e.value=e.value.toLowerCase());wijmo_1.isString(t.value)&&(t.value=t.value.toLowerCase());return e.value>t.value?-1:e.value===t.value?t.index-e.index:1}));for(var a=0;a<l.length;a++){s=l[a];wijmo_1.isString(s.value)&&(s.value=s.value.toLowerCase());if(e>s.value)return s.index}throw new NotAvailableError};_CalcEngine.prototype._parseToScientificValue=function(e,t,o,i,n){var l,r,s,a,h=0;if(Math.abs(e)>=1){r="+";l=Math.pow(10,t.length);for(;e>l;){e/=l;h+=t.length}}else{r="-";l=Math.pow(10,t.length);for(;e*l<l;){e*=l;h+=t.length}}s=wijmo_1.Globalize.format(e,"D"+t.length);if(o){if((s+=wijmo_1.Globalize.format(e-Math.floor(e),t+o).substring(1)).indexOf(".")>-1)a=s.length-1-s.indexOf(".");else{s+=".";a=0}for(;a<o.length-1;){s+="0";a++}}s+="E"+r+wijmo_1.Globalize.format(h,"D"+i.length);if(n){s+=".";for(var u=1;u<n.length;u++)s+="0"}return s};_CalcEngine.prototype._checkCache=function(e,t,o,i,n,l){void 0===t&&(t=!0);void 0===o&&(o=!1);null!=i&&(this._sheet=this._owner.sheets[i]);null!=n&&(this._rowIndex=n);null!=l&&(this._columnIndex=l);var r=this._sheet?this._sheet.name:"",s=this._expressionCache[r+":"+t+":"+o+":"+e]||this._expressionCache[r+"_"+this._rowIndex+"_"+this._columnIndex+":"+t+":"+o+":"+e];if(s){if(s.token.tokenType===_TokenType.ERROR)throw s.token.value;return s}s=this.parse(e);if(this._token.tokenID!==_TokenID.END||this._token.tokenType!==_TokenType.GROUP)throw new SyntaxError(exports._ErrorMessages.InvalidExpression(e));this._cacheSize>1e4&&this.clearExpressionCache();this._expressionCache[r+(this._containsCellRef?"_"+this._rowIndex+"_"+this._columnIndex:"")+":"+t+":"+o+":"+e]=s;this._cacheSize++;return s};_CalcEngine.prototype._ensureNonFunctionExpression=function(e,t){for(;e instanceof _FunctionExpression;)e=e.evaluate(this._rowIndex,this._columnIndex,t);return e};_CalcEngine.prototype._numAlpha=function(e){var t=Math.floor((e-1)/26);return(t>0?this._numAlpha(t):"")+String.fromCharCode((e-1)%26+65)};_CalcEngine.prototype._filterUnwantedCommas=function(e){return e.replace(/,+\s*(?=\))/g,"")};_CalcEngine.PowOf10=Array.apply(null,{length:21}).map((function(e,t){return Math.pow(10,t)}));return _CalcEngine}();exports._CalcEngine=_CalcEngine;var _Token=function(){function _Token(e,t,o){this._value=e;this._tokenID=t;this._tokenType=o}Object.defineProperty(_Token.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0});Object.defineProperty(_Token.prototype,"tokenID",{get:function(){return this._tokenID},enumerable:!0,configurable:!0});Object.defineProperty(_Token.prototype,"tokenType",{get:function(){return this._tokenType},enumerable:!0,configurable:!0});return _Token}();exports._Token=_Token;var _TokenType,_TokenID,_FlexSheetAggregate,_SubtotalFunction,_FunctionDefinition=function(){function _FunctionDefinition(e,t,o){this._paramMax=Number.MAX_VALUE;this._paramMin=Number.MIN_VALUE;this._func=e;wijmo_1.isNumber(t)&&!isNaN(t)&&(this._paramMax=t);wijmo_1.isNumber(o)&&!isNaN(o)&&(this._paramMin=o)}Object.defineProperty(_FunctionDefinition.prototype,"paramMax",{get:function(){return this._paramMax},enumerable:!0,configurable:!0});Object.defineProperty(_FunctionDefinition.prototype,"paramMin",{get:function(){return this._paramMin},enumerable:!0,configurable:!0});Object.defineProperty(_FunctionDefinition.prototype,"func",{get:function(){return this._func},enumerable:!0,configurable:!0});return _FunctionDefinition}();exports._FunctionDefinition=_FunctionDefinition;!function(e){e[e.COMPARE=0]="COMPARE";e[e.ADDSUB=1]="ADDSUB";e[e.MULDIV=2]="MULDIV";e[e.POWER=3]="POWER";e[e.CONCAT=4]="CONCAT";e[e.GROUP=5]="GROUP";e[e.LITERAL=6]="LITERAL";e[e.IDENTIFIER=7]="IDENTIFIER";e[e.ERROR=8]="ERROR";e[e.SQUAREBRACKETS=9]="SQUAREBRACKETS"}(_TokenType=exports._TokenType||(exports._TokenType={}));!function(e){e[e.GT=0]="GT";e[e.LT=1]="LT";e[e.GE=2]="GE";e[e.LE=3]="LE";e[e.EQ=4]="EQ";e[e.NE=5]="NE";e[e.ADD=6]="ADD";e[e.SUB=7]="SUB";e[e.MUL=8]="MUL";e[e.DIV=9]="DIV";e[e.DIVINT=10]="DIVINT";e[e.MOD=11]="MOD";e[e.POWER=12]="POWER";e[e.CONCAT=13]="CONCAT";e[e.OPEN=14]="OPEN";e[e.CLOSE=15]="CLOSE";e[e.END=16]="END";e[e.COMMA=17]="COMMA";e[e.PERIOD=18]="PERIOD";e[e.ATOM=19]="ATOM";e[e.PERCENT=20]="PERCENT"}(_TokenID=exports._TokenID||(exports._TokenID={}));exports._OpMap=((_a={})[_TokenID.GT]=">",_a[_TokenID.LT]="<",_a[_TokenID.GE]=">=",_a[_TokenID.LE]="<=",_a[_TokenID.EQ]="=",_a[_TokenID.NE]="<>",_a[_TokenID.ADD]="+",_a[_TokenID.SUB]="-",_a[_TokenID.MUL]="*",_a[_TokenID.DIV]="/",_a[_TokenID.PERCENT]="%",_a[_TokenID.DIVINT]="\\",_a[_TokenID.POWER]="^",_a[_TokenID.CONCAT]="&",_a);!function(e){e[e.Count=0]="Count";e[e.CountA=1]="CountA";e[e.CountBlank=2]="CountBlank";e[e.CountIf=3]="CountIf";e[e.CountIfs=4]="CountIfs";e[e.Rank=5]="Rank";e[e.SumIf=6]="SumIf";e[e.SumIfs=7]="SumIfs";e[e.Product=8]="Product"}(_FlexSheetAggregate||(_FlexSheetAggregate={}));!function(e){e[e.Average=1]="Average";e[e.Count=2]="Count";e[e.CountA=3]="CountA";e[e.Max=4]="Max";e[e.Min=5]="Min";e[e.Product=6]="Product";e[e.Std=7]="Std";e[e.StdPop=8]="StdPop";e[e.Sum=9]="Sum";e[e.Var=10]="Var";e[e.VarPop=11]="VarPop";e[e.AverageWithoutHidden=101]="AverageWithoutHidden";e[e.CountWithoutHidden=102]="CountWithoutHidden";e[e.CountAWithoutHidden=103]="CountAWithoutHidden";e[e.MaxWithoutHidden=104]="MaxWithoutHidden";e[e.MinWithoutHidden=105]="MinWithoutHidden";e[e.ProductWithoutHidden=106]="ProductWithoutHidden";e[e.StdWithoutHidden=107]="StdWithoutHidden";e[e.StdPopWithoutHidden=108]="StdPopWithoutHidden";e[e.SumWithoutHidden=109]="SumWithoutHidden";e[e.VarWithoutHidden=110]="VarWithoutHidden";e[e.VarPopWithoutHidden=111]="VarPopWithoutHidden"}(_SubtotalFunction||(_SubtotalFunction={}));var rgLetter=/[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,_FlexSheetCellFactory=function(e){__extends(_FlexSheetCellFactory,e);function _FlexSheetCellFactory(){return null!==e&&e.apply(this,arguments)||this}_FlexSheetCellFactory.prototype.updateCell=function(t,o,i,n,l){var r,s,a,h=t.grid,u=/^border/;t.cellType===wijmo_grid_1.CellType.Cell&&(n.style.cssText="");if(t.cellType===wijmo_grid_1.CellType.Cell){var d=o*h.columns.length+i,_=h.selectedSheet;l&&!l.isSingleCell&&(d=l.row*h.columns.length+l.col);s=_&&_._styledCells?_._styledCells[d]:null;a=_isEditingCell(h,o,i);if(s&&"pre-wrap"==s.whiteSpace&&a){r=t.rows[o]._getFlag(wijmo_grid_1.RowColFlags.MultiLine);t.rows[o]._setFlag(wijmo_grid_1.RowColFlags.MultiLine,!0,!0)}}e.prototype.updateCell.call(this,t,o,i,n,l);null!=r&&t.rows[o]._setFlag(wijmo_grid_1.RowColFlags.MultiLine,r,!0);if(l&&!l.isSingleCell){o=l.row;i=l.col}switch(t.cellType){case wijmo_grid_1.CellType.ColumnHeader:var c=t.getCellData(o,i,!0),g=null,f=null;if(y=n.querySelector('[type="checkbox"]')){g=y.checked;f=y.indeterminate}n.textContent?n.innerHTML=n.innerHTML.replace(wijmo_1.escapeHtml(n.textContent),c).replace(n.textContent,c):n.innerHTML+=c;if(g||f){var p=n.querySelectorAll('[type="checkbox"]');if(p)for(var m=0;m<p.length;m++){var w=p[m];w.checked=g;w.indeterminate=f}}n.style.textAlign="center";break;case wijmo_grid_1.CellType.Cell:var C=h._getBindingColumn(t,o,t.columns[i]);if(l&&!l.isSingleCell){var S=this._getFirstVisibleCell(h,l);o=S.row;i=S.col}if(t.rows[o]instanceof HeaderRow){(t.columns[i].dataMapEditor===wijmo_grid_1.DataMapEditor.RadioButtons&&n.firstElementChild instanceof HTMLLabelElement||t.columns[i].dataType===wijmo_1.DataType.Boolean&&1===n.childElementCount&&n.firstElementChild instanceof HTMLLabelElement&&n.firstElementChild.firstElementChild instanceof HTMLInputElement&&"checkbox"===n.firstElementChild.firstElementChild.type||t.columns[i].dataType!==wijmo_1.DataType.Boolean&&!n.innerHTML)&&(n.innerHTML=wijmo_1.escapeHtml(h.getCellValue(o,i)));wijmo_1.addClass(n,exports.FlexSheetClsNames.headerRow)}else{if(a){var b=n.querySelector("input");b&&s&&s.textAlign&&(b.style.textAlign=s.textAlign)}else{var v=t.rows[o]instanceof wijmo_grid_1.GroupRow;if(t.columns[i].dataType===wijmo_1.DataType.Boolean){var y;if((y=n.querySelector('[type="checkbox"]'))&&!wijmo_1.hasClass(y,"wj-column-selector")){y.checked=h.getCellValue(o,i);y.disabled=y.disabled||!h.canEditCell(o,i)}}else if(C.dataMap&&!v){var x=h.getCellValue(o,i,!0),R=n.firstChild;R&&3===R.nodeType&&R.nodeValue!==x&&(R.nodeValue=x)}else if(0===n.childElementCount&&n.textContent===h.getCellData(o,i,!0)){x=h.getCellValue(o,i,!0);var T=(s?s.format:null)||(v?null:C.format);if(""!==x&&wijmo_1.isNumber(+x)&&!isNaN(+x)&&/[hsmy:]/i.test(T)){var E=wijmo_1.Globalize.parseDate(x,T);if(!E){E=FlexSheet._fromOADate(+x);isNaN(E.getTime())||(x=wijmo_1.Globalize.formatDate(E,T))}}if(T||!v){x=wijmo_1.isString(x)?x.replace(/^(')(\s*[\w|=])/,"$2"):x;wijmo_1.isString(x)?x&&this._isURL(x)?n.innerHTML='<a href="'+x+'" target="_blank">'+wijmo_1.escapeHtml(x)+"</a>":n.innerHTML=wijmo_1.escapeHtml(x):n.innerHTML=x}}}if(s){var F=n.style,A=void 0;for(var I in s)if("className"===I)s.className&&wijmo_1.addClass(n,s.className);else if("format"!==I&&(A=s[I]))if(!wijmo_1.hasClass(n,wijmo_1.ControlStateClsNames.selected)&&!wijmo_1.hasClass(n,wijmo_1.ControlStateClsNames.multiSelected)||"color"!==I&&"backgroundColor"!==I)if("whiteSpace"===I&&"normal"===A)F[I]="";else{if(u.test(I))continue;F[I]=A}else F[I]=""}var D=this._getCellBorders(h,h.selectedSheet,l||new wijmo_grid_1.CellRange(o,i));if(D)for(var k in D)n.style[k]=D[k]}if(n.style.backgroundColor||n.style.color){s||(s={});n.style.backgroundColor&&(s.backgroundColor=n.style.backgroundColor);n.style.color&&(s.color=n.style.color)}}if(t.cellType===wijmo_grid_1.CellType.Cell){o!==h._lastVisibleFrozenRow||wijmo_1.hasClass(n,wijmo_grid_1.FlexGridClsNames.frozenRow)||wijmo_1.addClass(n,wijmo_grid_1.FlexGridClsNames.frozenRow);i!==h._lastVisibleFrozenColumn||wijmo_1.hasClass(n,wijmo_grid_1.FlexGridClsNames.frozenCol)||wijmo_1.addClass(n,wijmo_grid_1.FlexGridClsNames.frozenCol)}};_FlexSheetCellFactory.prototype._getFirstVisibleCell=function(e,t){var o,i;for(o=t.topRow;o<=t.bottomRow&&!e.rows[o].isVisible;o++);for(i=t.leftCol;i<=t.rightCol&&!e.columns[i].isVisible;i++);return new wijmo_grid_1.CellRange(o,i)};_FlexSheetCellFactory.prototype._isURL=function(e){return new RegExp("^(https|http|ftp|rtsp|mms)://(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})(:[0-9]{1,4})?(/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*").test(e)};_FlexSheetCellFactory.prototype._getCellBorders=function(e,t,o){var i=t&&t._styledCells;if(!i)return null;var n=o.topRow,l=o.leftCol,r=o.bottomRow,s=o.rightCol,a=e.columns.length;if((r>n||s>l)&&!i[r*a+s]){r=n;s=l}var h=i[n*a+l],u=i[r*a+s],d=l>0?i[n*a+l-1]:null,_=s+1<a?i[n*a+s+1]:null,c=n>0?i[(n-1)*a+l]:null,g=i[(r+1)*a+l];if(!(h||u||d||_||c||g))return null;var f={},p=h&&h.borderLeftStyle&&"none"!==h.borderLeftStyle&&!(!h.borderLeftColor&&!h.borderLeftWidth),m=d&&d.borderRightStyle&&"none"!==d.borderRightStyle&&!(!d.borderRightColor&&!d.borderRightWidth);if(!p&&m||p&&m&&parseInt(d.borderRightWidth||1)>parseInt(h.borderLeftWidth||1)){if("double"!==d.borderRightStyle){f.borderLeftColor=d.borderRightColor;f.borderLeftStyle=d.borderRightStyle;f.borderLeftWidth=Math.floor(parseInt(d.borderRightWidth||1)/2)+"px"}}else if(p){f.borderLeftColor=h.borderLeftColor;f.borderLeftStyle=h.borderLeftStyle;f.borderLeftWidth="double"!==h.borderLeftStyle?Math.ceil(parseInt(h.borderLeftWidth||1)/2)+"px":h.borderLeftWidth}var w=h&&h.borderTopStyle&&"none"!==h.borderTopStyle&&!(!h.borderTopColor&&!h.borderTopWidth),C=c&&c.borderBottomStyle&&"none"!==c.borderBottomStyle&&!(!c.borderBottomColor&&!c.borderBottomWidth);if(!w&&C||w&&C&&parseInt(c.borderBottomWidth||1)>parseInt(h.borderTopWidth||1)){if("double"!==c.borderBottomStyle){f.borderTopColor=c.borderBottomColor;f.borderTopStyle=c.borderBottomStyle;f.borderTopWidth=Math.floor(parseInt(c.borderBottomWidth||1)/2)+"px"}}else if(w){f.borderTopColor=h.borderTopColor;f.borderTopStyle=h.borderTopStyle;f.borderTopWidth="double"!==h.borderTopStyle?Math.ceil(parseInt(h.borderTopWidth||1)/2)+"px":h.borderTopStyle}var S=u&&u.borderRightStyle&&"none"!==u.borderRightStyle&&!(!u.borderRightColor&&!u.borderRightWidth),b=_&&_.borderLeftStyle&&"none"!==_.borderLeftStyle&&!(!_.borderLeftColor&&!_.borderLeftWidth);if(!S&&b||S&&b&&parseInt(_.borderLeftWidth||1)>=parseInt(u.borderRightWidth||1)){if("double"!==_.borderLeftStyle){f.borderRightColor=_.borderLeftColor;f.borderRightStyle=_.borderLeftStyle;f.borderRightWidth=Math.floor(parseInt(_.borderLeftWidth||1)/2)+"px"}}else if(S){f.borderRightColor=u.borderRightColor;f.borderRightStyle=u.borderRightStyle;f.borderRightWidth="double"!==u.borderRightStyle?Math.ceil(parseInt(u.borderRightWidth||1)/2)+"px":u.borderRightWidth}var v=u&&u.borderBottomStyle&&"none"!==u.borderBottomStyle&&!(!u.borderBottomColor&&!u.borderBottomWidth),y=g&&g.borderTopStyle&&"none"!==g.borderTopStyle&&!(!g.borderTopColor&&!g.borderTopWidth);if(!v&&y||v&&y&&parseInt(g.borderTopWidth||1)>=parseInt(u.borderBottomWidth||1)){if("double"!==g.borderTopStyle){f.borderBottomColor=g.borderTopColor;f.borderBottomStyle=g.borderTopStyle;f.borderBottomWidth=Math.floor(parseInt(g.borderTopWidth||1)/2)+"px"}}else if(v){f.borderBottomColor=u.borderBottomColor;f.borderBottomStyle=u.borderBottomStyle;f.borderBottomWidth="double"!==u.borderBottomStyle?Math.ceil(parseInt(u.borderBottomWidth||1)/2)+"px":u.borderBottomWidth}return f};return _FlexSheetCellFactory}(wijmo_grid_1.CellFactory);exports._FlexSheetCellFactory=_FlexSheetCellFactory;wijmo_1._registerModule("wijmo.grid.sheet",selfModule);
|