UNPKG

superrfjs

Version:

12 lines 946 kB
/*! * * SpreadJS Library 17.0.7 * * Copyright(c) MESCIUS inc. All rights reserved. * * Licensed under the SpreadJS Commercial License. * us.sales@mescius.com * https://developer.mescius.com/spreadjs * */ !function (t) { "object" == typeof module && "object" == typeof module.exports ? module.exports = t(require("@mescius/spread-sheets")) : "function" == typeof define && define.amd ? define(["@mescius/spread-sheets"], t) : "object" == typeof exports ? exports.Spread = t(require("@mescius/spread-sheets")) : t(GC) }(function (e) { function n(t) { var i, i, i = o[t]; return void 0 !== i || (i = o[t] = { exports: {} }, r[t].call(i.exports, i, i.exports, n)), i.exports } var r, o, t; r = { "./dist/plugins/pivot/lr.msc.en.js": function (t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }), i.wmk2 = i.wmk1 = void 0, i.wmk1 = "5069766f745461626c65", i.wmk2 = "5069766f745461626c65" }, "./dist/plugins/pivot/pivot-all-entry.js": function (t, i, n) { (e = e || {}).Pivot = n("./node_modules_local/@spreadjs/js-pivot/dist/gc.pivot.js"), e.Spread = e.Spread || {}, e.Spread.Pivot = n("./dist/plugins/pivot/pivot-table-entry.js"), t.exports = e.Spread.Pivot }, "./dist/plugins/pivot/pivot-core/pivot-core-entry.js": function (t, i, n) { "use strict"; var e, r, e = this && this.__createBinding || (Object.create ? function (t, i, n, e) { void 0 === e && (e = n); var r = Object.getOwnPropertyDescriptor(i, n); r && ("get" in r ? i.__esModule : !r.writable && !r.configurable) || (r = { enumerable: !0, get: function () { return i[n] } }), Object.defineProperty(t, e, r) } : function (t, i, n, e) { t[e = void 0 === e ? n : e] = i[n] }), r = this && this.__exportStar || function (t, i) { for (var n in t) "default" === n || Object.prototype.hasOwnProperty.call(i, n) || e(i, t, n) }; Object.defineProperty(i, "__esModule", { value: !0 }), r(n("./dist/plugins/pivot/pivot-core/pivot-fields-model.js"), i), r(n("./dist/plugins/pivot/pivot-core/pivot-view.js"), i) }, "./dist/plugins/pivot/pivot-core/pivot-core-interface.js": function (t, i) { "use strict"; var n, e, r, o, a, s, u, c, l, f, h, v, d, p, m, b, b, b, b, b, b, b, b, b, b, b, b, b, b, b; Object.defineProperty(i, "__esModule", { value: !0 }), i.top10CompareTypeExcel = i.dateCompareTypeExcel = i.valueCompareTypeExcel = i.captionCompareTypeExcel = i.overlapCheck = i.PivotAreaReference = i.PivotPanelLayoutType = i.PivotPanelSection = i.SerializeIndex = i.DisplayFields = i.CalcItemAggregation = i.SubtotalsPosition = i.GrandTotalPosition = i.PivotAreaAxisType = i.PivotAreaType = i.PivotTableLayoutType = i.PivotPanelDirectionEnum = i.PivotChartFieldType = i.PivotTableFieldType = void 0, (b = n = i.PivotTableFieldType || (i.PivotTableFieldType = {}))[b.filterField = 0] = "filterField", b[b.rowField = 1] = "rowField", b[b.columnField = 2] = "columnField", b[b.valueField = 3] = "valueField", (b = e = i.PivotChartFieldType || (i.PivotChartFieldType = {}))[b.filterField = 0] = "filterField", b[b.axisField = 1] = "axisField", b[b.legendField = 2] = "legendField", b[b.valueField = 3] = "valueField", (b = r = i.PivotPanelDirectionEnum || (i.PivotPanelDirectionEnum = {}))[b.fieldAndAreaStacked = 0] = "fieldAndAreaStacked", b[b.fieldAndAreaBySide = 1] = "fieldAndAreaBySide", b[b.fieldOnly = 2] = "fieldOnly", b[b.areaOnlyGrid = 3] = "areaOnlyGrid", b[b.areaOnlyTable = 4] = "areaOnlyTable", (b = o = i.PivotTableLayoutType || (i.PivotTableLayoutType = {}))[b.compact = 0] = "compact", b[b.outline = 1] = "outline", b[b.tabular = 2] = "tabular", (b = a = i.PivotAreaType || (i.PivotAreaType = {}))[b.all = 0] = "all", b[b.button = 1] = "button", b[b.data = 2] = "data", b[b.none = 3] = "none", b[b.normal = 4] = "normal", b[b.corner = 5] = "corner", b[b.topEnd = 6] = "topEnd", b[b.topRight = 7] = "topRight", (b = s = i.PivotAreaAxisType || (i.PivotAreaAxisType = {}))[b.row = 0] = "row", b[b.col = 1] = "col", (b = u = i.GrandTotalPosition || (i.GrandTotalPosition = {}))[b.none = 0] = "none", b[b.row = 1] = "row", b[b.col = 2] = "col", b[b.both = 3] = "both", (b = c = i.SubtotalsPosition || (i.SubtotalsPosition = {}))[b.none = 0] = "none", b[b.top = 1] = "top", b[b.bottom = 2] = "bottom", (b = l = i.CalcItemAggregation || (i.CalcItemAggregation = {}))[b.include = 0] = "include", b[b.exclude = 1] = "exclude", (b = f = i.DisplayFields || (i.DisplayFields = {}))[b.downThenOver = 0] = "downThenOver", b[b.overThenDown = 1] = "overThenDown", (b = h = i.SerializeIndex || (i.SerializeIndex = {}))[b.fields = 1] = "fields", b[b.options = 2] = "options", b[b.filter = 4] = "filter", b[b.sort = 8] = "sort", b[b.layout = 16] = "layout", b[b.showValueAs = 32] = "showValueAs", b[b.group = 64] = "group", b[b.styles = 128] = "styles", b[b.collapse = 256] = "collapse", b[b.theme = 512] = "theme", b[b.position = 1024] = "position", b[b.showNoData = 2048] = "showNoData", (b = v = i.PivotPanelSection || (i.PivotPanelSection = {}))[b.fields = 1] = "fields", b[b.area = 2] = "area", b[b.viewList = 4] = "viewList", (b = d = i.PivotPanelLayoutType || (i.PivotPanelLayoutType = {}))[b.stack = 0] = "stack", b[b.flow = 1] = "flow", (b = p = i.PivotAreaReference || (i.PivotAreaReference = {}))[b.cellReference = 0] = "cellReference", b[b.getPivotData = 1] = "getPivotData", (b = m = i.overlapCheck || (i.overlapCheck = {}))[b.pt = 1] = "pt", b[b.value = 2] = "value", b[b.table = 4] = "table", i.captionCompareTypeExcel = { captionEqual: 0, captionNotEqual: 1, captionBeginsWith: 2, captionNotBeginsWith: 3, captionEndsWith: 4, captionNotEndsWith: 5, captionContains: 6, captionNotContains: 7, captionGreaterThan: 8, captionGreaterThanOrEqual: 9, captionLessThan: 10, captionLessThanOrEqual: 11, captionBetween: 12, captionNotBetween: 13 }, i.valueCompareTypeExcel = { valueEqual: 0, valueNotEqual: 1, valueGreaterThan: 2, valueGreaterThanOrEqual: 3, valueLessThan: 4, valueLessThanOrEqual: 5, valueBetween: 6, valueNotBetween: 7 }, i.dateCompareTypeExcel = { dateEqual: 0, dateNotEqual: 1, dateOlderThan: 2, dateOlderThanOrEqual: 3, dateNewerThan: 4, dateNewerThanOrEqual: 5, dateBetween: 6, dateNotBetween: 7, tomorrow: 10, today: 8, yesterday: 9, nextWeek: 17, thisWeek: 15, lastWeek: 16, nextMonth: 14, thisMonth: 12, lastMonth: 13, nextQuarter: 18, thisQuarter: 19, lastQuarter: 20, nextYear: 21, thisYear: 22, lastYear: 23, yearToDate: 40, Q1: 24, Q2: 25, Q3: 26, Q4: 27, M1: 28, M2: 29, M3: 30, M4: 31, M5: 32, M6: 33, M7: 34, M8: 35, M9: 36, M10: 37, M11: 38, M12: 39 }, i.top10CompareTypeExcel = { count: 0, percent: 1, sum: 2 } }, "./dist/plugins/pivot/pivot-core/pivot-fields-model.js": function (L, w, t) { "use strict"; var c, E, B, M, g, D, i, u, n, y, b, l, o, m, t, C, n, A, f, N, k, R, G, I, d, T, V, S, U, x, h, j, Q, O, W, z, Z, Y, H, J, q, K, p, v, t; function _(t, n, i) { var e, t, e = -1, t = B([], t, !0); return i && t.splice(i.valuePositionIndex, 0, i), (0, M.o)(t, function (t, i) { if (-1 === e && t.Zc === n) return e = i, !0 }), e } function X(t, n) { var e; return (0, M.o)(t, function (t, i) { if (t.Zc === n) return e = t, !0 }), e } function $(t, n) { var e; return (0, M.o)(t, function (t, i) { if (t.a === n) return e = t, !0 }), e } function e() { this.Pq = {} } function r(t, i, n) { var e = this; t && t.textItem && this.updateLabelTextItem(t.textItem, n.allowMultipleFiltersPerField), t && t.condition && this.updateLabelCondition(t.condition, n.allowMultipleFiltersPerField), i && this.updateValueCondition(i), e.selectMultipleItems = n || { allowMultipleFiltersPerField: !0 }, e.u = !1 } function a(t, i, n, e) { var r = this; r.a = i, k(n) ? r.Zc = i : r.Zc = n, r.l = t.p(i), r.bbt = e, r.g(t) } function tt(t, i, n, e, r, o, a, s, u, c) { var l, f, o, h, v, d, p; return void 0 === u && (u = !1), e && e.valueFilter && (l = e.valueFilter), f = 1 === o || 2 === o, o = 2 === o, e && e.C(u) ? (v = void 0, p = d = !1, m(a.A) || k(s) || !k(a.N) || (d = !0, p = a.T instanceof Date), { isDim: f, isHeader: o, sourceName: i, displayName: t, items: (v = d ? (p ? et : nt)(e, a, s, u) : it(e, a, u)).rs, filterItems: v.ds, index: n, isALL: !1, valueFilter: l, sortInfo: r, isShowSubtotalTop: c }) : { isDim: f, isHeader: o, sourceName: i, displayName: t, items: h, filterItems: null, index: n, isALL: !0, valueFilter: l, sortInfo: r, isShowSubtotalTop: c } } function it(n, t, e) { var r, o, i, a, s, r = [], o = [], i = t.getFieldsItemList(), a = t.M(), s = !m(a); return (0, M.o)(i, function (t) { var i = s ? a[t] : t; (n.isMatchedLabelItem(t, e) ? r : o).push(i) }), { rs: r, ds: o } } function nt(n, e, t, r) { var i, o, t, a, s, u, i = [], o = [], t = t.D, a = e.getFieldsItemList(), s = {}; for (u in (0, M.o)(t, function (t) { var i = e.S(t); r || n.evaluateLabelCondition(t + "") ? s[i] = !0 : !0 !== s[i] && (s[i] = !1) }), (0, M.o)(a, function (t) { n.isInLabelFilterItem(t + "") && s[t] || (s[t] = !1) }), s) (s.hasOwnProperty(u) && s[u] ? i : o).push(u); return { rs: i, ds: o } } function et(n, e, t, r) { var i, o, a, s, u, c, l, f, i = [], o = [], a = t.D, s = e.getFieldsItemList(), u = t.k, c = t.P, l = {}; for (f in (0, M.o)(s, function (t) { l[t] = [] }), (0, M.o)(a, function (t) { var i = e.S(t); (r || n.evaluateLabelCondition(t + "")) && (l[i] = (0, M.F)(l[i], u[c[t]])) }), (0, M.o)(s, function (t) { n.isInLabelFilterItem(t + "") || (l[t].length = 0) }), l) l.hasOwnProperty(f) && (0 < l[f].length ? i : o).push(l[f]); return { rs: i, ds: o } } function rt(t) { var i, t, i = { filterType: 1 }; return i.isBottom = -1 === t.type ? 1 : 0, i.percent = 1 === t.compareType ? 1 : 0, t = t.expected ? 1 : 0, k(t) || (i.value = t, i.filterValue = t), i } function ot(t, i) { var n, e, r, o, a; if (void 0 === i && (i = !1), !k(t.compareType)) return n = { filterType: 4, filter1: {} }, o = r = void 0, 6 === (e = t.compareType) ? (r = 5, o = 3, n.and = !0) : o = r = !i || 4 !== e && 2 !== e ? e : a = 4 === e ? 2 : 4, n.filter1.operator = r, t.item1 && !k(t.item1.expected) && (n.filter1.value = t.item1.expected), t.item2 && !k(t.item2.expected) && (n.filter2 = {}, n.filter2.operator = o, n.filter2.value = t.item2.expected), n } function at(t) { var i, n, e; if (k(t.value1) ? k(t.item1) || (i = t.item1.expected) : i = t.value1, k(t.value2) ? k(t.item2) || (n = t.item2.expected) : n = t.value2, n) return 12 === t.compareType ? { filterType: 4, filter1: { operator: 3, value: i }, filter2: { operator: 5, value: n } } : 13 === t.compareType ? { filterType: 4, filter1: { operator: 4, value: i }, filter2: { operator: 2, value: n } } : void 0; switch (e = -1, t.compareType) { case 0: return { filterType: 3, filter: [i] }; case 1: e = 1; break; case 2: i += "*"; break; case 3: e = 1, i += "*"; break; case 4: i = "*" + i; break; case 5: e = 1, i = "*" + i; break; case 6: i = "*" + i + "*"; break; case 7: e = 1, i = "*" + i + "*"; break; case 8: e = 2; break; case 9: e = 5; break; case 10: e = 4; break; case 11: e = 3 }return { filterType: 4, filter1: { operator: e, value: i } } } function st(t) { var i, n, e, r, o, a, s, a, s, a, s, i = new Date, n = i.getDay(), e = i.getDate(), r = new Date(i), o = new Date(i); switch (t) { case 11: r.setDate(e - 6); break; case 9: r.setDate(e - 1); break; case 8: break; case 10: r.setDate(e + 1); break; case 16: r.setDate(e - n - 7), o.setDate(e - n - 1); break; case 15: r.setDate(e - n), o.setDate(e - n + 6); break; case 17: r.setDate(e - n + 7), o.setDate(e - n + 13); break; case 13: r.setDate(1), r.setMonth(r.getMonth() - 1), o.setDate(0); break; case 12: r.setDate(1), o.setMonth(o.getMonth() + 1), o.setDate(0); break; case 14: r.setDate(1), r.setMonth(r.getMonth() + 1), o.setMonth(o.getMonth() + 2), o.setDate(0); break; case 18: s = 3 + (a = r.getMonth() - r.getMonth() % 3 + 1 + 3) + 3, r.setDate(1), r.setMonth(a), o.setMonth(s), o.setDate(0); break; case 19: s = 3 + (a = r.getMonth() - r.getMonth() % 3 + 1), r.setDate(1), r.setMonth(a), o.setMonth(s), o.setDate(0); break; case 20: s = 3 + (a = r.getMonth() - r.getMonth() % 3 + 1 - 3), r.setDate(1), r.setMonth(a), o.setMonth(s), o.setDate(0); break; case 21: r.setDate(1), r.setMonth(1), r.setFullYear(r.getFullYear() + 1), o.setFullYear(o.getFullYear() + 2), o.setMonth(0), o.setDate(0); break; case 22: r.setDate(1), r.setMonth(1), o.setFullYear(o.getFullYear() + 1), o.setMonth(0), o.setDate(0); break; case 23: r.setDate(1), r.setMonth(1), r.setMonth(r.getFullYear() - 1), o.setMonth(0), o.setDate(0); break; case 40: r.setMonth(0, 1), r.setHours(0, 0, 0, 0), o.setHours(23, 59, 59, 999) }return r.setHours(0), r.setMinutes(0), r.setSeconds(0), o.setHours(23), o.setMinutes(59), o.setSeconds(59), { from: l.o0(r), to: l.o0(o) } } function ut(t, i) { var n, e, r, n = k(t.compareType) ? t.operator : t.compareType; if (8 <= n && n <= 23 || 40 === n) e = { filterType: 2, type: i }, (r = st(n)).from && r.to && (e.value = r.from, e.maxValue = r.to); else if (24 <= n && n <= 39) e = { filterType: 2, type: i }; else if (0 <= n && n <= 7) return ot(t, !0); return e } function ct(t, i) { var n = t.conType; return 3 === n ? rt(t) : 2 === n ? ot(t) : 0 === n ? at(t) : 1 === n ? ut(t, i) : void 0 } function lt(t, o) { var i, n, a, u, i = { n_: "autoFilter", ref: "A1" }, a = []; return t && (t.forEach(function (t) { var i, n, e, t, r; t && (e = {}, t = ct(n = (i = t.conditions)[0], o), k(t) || (1 === (r = t.filterType) ? e.top10 = t : 2 === r ? e.dynamicFilter = t : 4 === r ? e.customFilters = t : 3 === r && (e.filters = t)), a.push(e)) }), u = [], a.forEach(function (t) { var i, n, e, r, o, o, e, a, r, o, s, i = { n_: "filterColumn", colId: 0 }; k(t.hiddenButton) || (i.hiddenButton = t.hiddenButton ? 1 : 0), (t.colorFilter || t.top10 || t.filters || t.dynamicFilter || t.customFilters) && (i.c_ = [], n = void 0, k(t.top10) ? k(t.dynamicFilter) ? k(t.customFilters) ? k(t.filters) || (n = { n_: "filters" }, (o = t.filters).blank && (n.blank = 1), k(o.dateGroupItem) && k(o.filter) || (s = n.c_ = []), o.filter && o.filter.forEach(function (t) { D.StringEx.Xi(t) || s.push({ n_: "filter", val: h(t) }) }), o.dateGroupItem && o.dateGroupItem.forEach(function (t) { var i = { n_: "dateGroupItem" }; 0 < t.year && (i.year = t.year), 0 <= t.month && t.month < 12 && (i.month = t.month), 0 < t.day && t.day < 32 && (i.day = t.day), t.hour < 24 && (i.hour = t.hour), t.minute < 60 && (i.minute = t.minute), t.second < 60 && (i.second = t.second), i.dateTimeGrouping = t.day, s.push(i) }), i.c_.push(n)) : (o = t.customFilters, k(o.filter1) && k(o.filter2) || (n = { n_: "customFilters" }, o.and && (n.and = 1), e = void 0, k(o.filter1) && k(o.filter2) || (e = n.c_ = []), k(o.filter1) || (a = { n_: "customFilter" }, "none" !== (r = y.PivotComparisonOperators[o.filter1.operator]) && (a.operator = r), a.val = o.filter1.value + "", e.push(a)), k(o.filter2) || (a = { n_: "customFilter" }, "none" !== (r = y.PivotComparisonOperators[o.filter2.operator]) && (a.operator = r), a.val = o.filter2.value + "", e.push(a)), i.c_.push(n))) : (r = t.dynamicFilter, k(r.type) || (n = { n_: "dynamicFilter" }, (o = r.type) && (n.type = o), k(r.value) || (n.val = r.value), k(r.maxValue) || (n.maxVal = r.maxValue), i.c_.push(n))) : (n = { n_: "top10" }, (e = t.top10).isBottom && (n.top = "0"), e.percent && (n.percent = "1"), isNaN(e.value) || (n.val = e.value + ""), isNaN(e.filterVal) || (n.filterVal = e.filterVal + ""), i.c_.push(n))), u.push(i) }), i.c_ = u), i } function F(t, i, n, e) { var r, t, r = this; r.Zc = t, r.L = i, r.Ti = n, r.Qy = e, r.B = [], r.R = [], r.G = [], r.Q = [], r.z = [], r.Z = {}, r.nrt = {}, r.Y = [], r.H = { allowMultipleFiltersPerField: !0 }, r.K = new K, r.X = {}, t = r.Ti && r.Ti.getPivotCacheByName(i), r.si = t && t.getAllFieldsNames(), F.et(r, "init") } function ft(t) { switch (t) { case "average": return M.SubtotalType.average; case "count": return M.SubtotalType.count; case "countNums": return M.SubtotalType.countNums; case "max": return M.SubtotalType.max; case "min": return M.SubtotalType.min; case "product": return M.SubtotalType.product; case "stdDev": return M.SubtotalType.stdDev; case "stdDevp": return M.SubtotalType.stdDevp; case "var": return M.SubtotalType.varr; case "varp": return M.SubtotalType.varp; default: return M.SubtotalType.sum } } function ht(t) { switch (t) { case M.SubtotalType.average: return "average"; case M.SubtotalType.count: return "count"; case M.SubtotalType.countNums: return "countNums"; case M.SubtotalType.max: return "max"; case M.SubtotalType.min: return "min"; case M.SubtotalType.product: return "product"; case M.SubtotalType.stdDev: return "stdDev"; case M.SubtotalType.stdDevp: return "stdDevp"; case M.SubtotalType.varr: return "var"; case M.SubtotalType.varp: return "varp"; default: return "sum" } } function vt(t) { return -1 < t.indexOf("caption") && !k(g.captionCompareTypeExcel[t]) ? { conType: 0, compareType: g.captionCompareTypeExcel[t] } : -1 < t.indexOf("value") && !k(g.valueCompareTypeExcel[t]) ? { conType: 2, compareType: g.valueCompareTypeExcel[t] } : k(g.dateCompareTypeExcel[t]) ? k(g.top10CompareTypeExcel[t]) ? void 0 : { conType: 3, compareType: g.top10CompareTypeExcel[t] } : { conType: 1, compareType: g.dateCompareTypeExcel[t] } } function dt(t) { return !t || " " === t } function pt(t, i) { return !k(i.Z[t]) && 3 !== i.Z[t] } function mt(t, i) { var n, e, e, e, e, t, t, n = { filter: [] }; return n.blank = t.blank, (e = t.c_)[0] ? (e = x(e[0].val), s(i.conType, 0, e, n.blank)) : (n.dateGroupItem = [], (e = [].concat(t.dateGroupItem))[0] ? (t = e[0], (e = {}).day = T(t.day, 1), e.hour = T(t.hour, 0), e.minute = T(t.minute, 0), e.month = T(t.month, 0), e.second = T(t.second, 0), e.year = T(t.year, 0), t = new Date(e.year, 0 < e.month ? e.month - 1 : e.month, e.day, e.hour, e.minute, e.second), s(i.conType, 0, t, !n.blank)) : void 0) } function bt(t, i) { var n, e, e, t, t, n = {}, e = t.and; return dt(e) || (n.and = "1" === e), 0 < (e = t.c_).length && ((t = n.filter1 = {}).operator = e[0].operator, t.value = e[0].val), 1 < e.length && ((t = n.filter2 = {}).operator = e[1].operator, t.value = e[1].val), yt(n, i) } function gt(t, i) { var n, e, t, n = {}; return n.type = Z[t.type], e = t.val, t = t.maxVal, dt(e) || (n.value = e), dt(t) || (n.maxValue = t), Ct(n, i) } function wt(t, i) { var n = {}; return n.value = V(t.val, NaN), n.percent = d(t.percent, !1), n.top = d(t.top, !0), At(n, i) } function s(t, i, n, e, r, o, a, s, u, c) { var l = {}; return l.conType = t, k(i) || (l.compareType = i), k(n) || (l.expected = n), k(e) || (l.ignoreBlank = e), k(r) || (l.type = r), k(o) || (l.isPercent = o), k(a) || (l.item1 = a), k(s) || (l.item2 = s), k(u) || (l.ranges = u), k(c) || (l.expectTypeId = c), 2 === t && (l.ignoreCase = !0), l } function yt(t, r) { function i(t) { var i, t, n, e, t = t.value, n = t.indexOf("*"), e = t.lastIndexOf("*"); return -1 !== n ? i = n === t.length - 1 && 0 !== n ? s(r.conType, r.compareType, t.substring(0, t.length - 1)) : 0 === n && n === e ? s(r.conType, r.compareType, t.substring(1)) : (-1 !== n && -1 !== e && (t = t.substr(1, t.length - 2)), s(r.conType, r.compareType, t)) : k(r) || (i = s(r.conType, r.compareType, t)), i } var n; return t.filter1 && (n = i(t.filter1)), n = t.filter2 ? s(r.conType, r.compareType, o, o, o, o, n, i(t.filter2)) : s(r.conType, r.compareType, o, o, o, o, n, o) } function Ct(t, i) { var n, e, e; return n = 1 === i.conType ? s(1, i.compareType, o) : n } function At(t, i) { var n = t.top ? 1 : -1; return s(3, i.compareType, t.value, o, n, t.percent) } function P(t, i, n) { for (var e, r, o, e = 0; e < i.length; e++)(o = (r = i[e]).nrt) && n(o) && t.setSortInfo(r.Zc, I) } function Nt(a, s, u, c) { for (var l, l, l, t, i, t = function (t) { var t, i, n, i, i, e, r, n, i, o, t = a[t]; return t.rpi && (n = (i = t.rpi).sortType, i = i.pivotArea, i = c ? u.excelPivotAreaSJSToSheetPivotArea(i) : u.excelPivotAreaToSheetPivotArea(i), e = s.getFieldInfoByName(null == (l = null == (l = null == (l = i.references) ? void 0 : l[0]) ? void 0 : l.items) ? void 0 : l[0])) ? (r = 2 === s.Z[t.Zc], n = { sortType: n, sortValueFieldName: e.Zc }, 1 < i.references.length && (i = i.references.slice(1), o = (r ? s.B : s.R).map(function (t) { return t.Zc }), i.sort(function (t, i) { return o.indexOf(t.fieldName) - o.indexOf(i.fieldName) }), n.sortByPivotReferences = i.map(function (t) { return { fieldName: s.X[t.fieldName], items: t.items } })), n.sortByHeader = r, n.cacheName = e.a, n.sortValueSubtotalText = M.SubtotalType[e.Ar], t.setSortInfo(n), void (s.nrt[t.Zc] = n)) : "continue" }, i = 0; i < a.length; i++)t(i) } function It(t, i) { var n, t, n = { references: [{ fieldName: C().Values, items: [t.sortValueFieldName] }] }; return t.sortByPivotReferences && 0 < t.sortByPivotReferences.length && (t = t.sortByPivotReferences.map(function (t) { return { fieldName: i.getFieldNameBySourceName(t.fieldName), items: t.items } }), n.references = n.references.concat(t)), n } function Tt(t, i) { for (var n, e, n = t.sortByPivotReferences, e = 0; e < n.length; e++)if (n[e].fieldName !== i[e]) return } function St(t) { return t && (t.sumSubtotal = I, t.avgSubtotal = I, t.maxSubtotal = I, t.minSubtotal = I, t.varSubtotal = I, t.varPSubtotal = I, t.countSubtotal = I, t.countASubtotal = I, t.stdDevSubtotal = I, t.stdDevPSubtotal = I, t.productSubtotal = I), t } c = this && this.__assign || function () { return (c = Object.assign || function (t) { for (var i, n, e, r, n = 1, e = arguments.length; n < e; n++)for (r in i = arguments[n]) Object.prototype.hasOwnProperty.call(i, r) && (t[r] = i[r]); return t }).apply(this, arguments) }, E = this && this.__rest || function (t, i) { var n, e, r, n = {}; for (e in t) Object.prototype.hasOwnProperty.call(t, e) && i.indexOf(e) < 0 && (n[e] = t[e]); if (null != t && "function" == typeof Object.getOwnPropertySymbols) for (r = 0, e = Object.getOwnPropertySymbols(t); r < e.length; r++)i.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[r]) && (n[e[r]] = t[e[r]]); return n }, B = this && this.__spreadArray || function (t, i, n) { if (n || 2 === arguments.length) for (var e = 0, r = i.length, o; e < r; e++)!o && e in i || ((o = o || Array.prototype.slice.call(i, 0, e))[e] = i[e]); return t.concat(o || Array.prototype.slice.call(i)) }, Object.defineProperty(w, "__esModule", { value: !0 }), w.PivotFieldsModel = w.getPivotDateExConditionRange = w.getCellValuePivotFilter = w.toPivotViewQueryField = w.PivotViewField = w.PivotViewFilter = w.PivotViewFilterManager = w.in = w.Caption_Compare_Type_Excel = w.throwError = void 0, M = t("Pivot"), g = t("./dist/plugins/pivot/pivot-core/pivot-core-interface.js"), D = t("Core"), i = t("@spreadjs/js-sheets-common"), u = t("./dist/plugins/pivot/pivot-table/pivot-table.js"), n = t("./dist/plugins/pivot/pivot.ns.js"), y = t("./dist/plugins/pivot/pivot-util.js"), b = i.Common.kh, l = i.Common.ct, o = null, m = D.GC$.isEmptyObject, t = new i.Common.ResourceManager(n.SR, "PivotTables"), C = t.getResource.bind(t), n = i.Common.ct, A = n.o0, f = n.Y0, N = null, k = i.Common.lt.ht, R = Math.min, G = Math.max, I = void 0, d = D.NodeHelper.ur, T = D.NodeHelper.sr, V = D.NodeHelper.ar, S = D.Util.io, U = D.Util.pr, x = D.mt.n1, h = D.mt.vo, j = D.mt.xr, Q = D.mt.f1, O = D.mt.xr, W = D.mt.go, w.throwError = z = function (t) { throw new Error(t) }, Z = { null: -1, aboveAverage: 100, belowAverage: 101, tomorrow: 2, today: 0, yesterday: 1, nextWeek: 9, thisWeek: 7, lastWeek: 8, nextMonth: 6, thisMonth: 4, lastMonth: 5, nextQuarter: 10, thisQuarter: 11, lastQuarter: 12, nextYear: 13, thisYear: 14, lastYear: 15, yearToDate: 16, Q1: 17, Q2: 18, Q3: 19, Q4: 20, M1: 21, M2: 22, M3: 23, M4: 24, M5: 25, M6: 26, M7: 27, M8: 28, M9: 29, M10: 30, M11: 31, M12: 32 }, Y = function (t) { var i, n, n, e, r, o, i, e = N, r = t.autoFilter && t.autoFilter.filterItemMap && t.autoFilter.filterItemMap[0] && t.autoFilter.filterItemMap[0].conditions && t.autoFilter.filterItemMap[0].conditions[0]; if (r) { switch (r.conType) { case 0: r.item1 || r.item2 ? (o = (i = [r.item1 && r.item1.expected, r.item2 && r.item2.expected])[0], i = i[1]) : o = r.expected, e = { conType: M.PivotConditionType.caption, operator: r.compareType, val: [o, i] }; break; case 1: i = (n = [r.item1 && r.item1.expected, r.item2 && r.item2.expected])[1], !(o = n[0]) || o instanceof Date || (o = f(o)), !i || i instanceof Date || (i = f(i)), e = { conType: M.PivotConditionType.date, val: [o, i], operator: r.compareType, isWholeDay: r.isWholeDay }, r.compareType === M.PivotDateFilterOperator.dateToDate && (e.isParallel = r.isParallel, e.isDynamicEndDate = r.isDynamicEndDate, e.by = r.by); break; case 3: e = { conType: M.PivotConditionType.top10, val: r.expected, type: r.compareType, operator: r.type }; break; case 2: o = (n = [r.item1 && r.item1.expected, r.item2 && r.item2.expected])[0], i = n[1], e = { conType: M.PivotConditionType.value, val: r.expected ? [r.expected] : [o, i], operator: r.compareType } }return e } }, H = function (t, i) { var n, n, n, t, e, t, r, o, a, s, t, u, c, l, t = j(t, "autoFilter"); if (t) { switch (r = void 0, (t = (e = W(t, "filterColumn"))[0]) && (o = O(t, "filters"), a = O(t, "customFilters"), s = O(t, "dynamicFilter"), t = O(t, "top10"), o ? r = mt(o, i) : a ? r = bt(a, i) : s ? r = gt(s, i) : t && (r = wt(t, i))), u = N, l = c = void 0, i.conType) { case 0: r.item1 || r.item2 ? (c = (n = [r.item1 && r.item1.expected, r.item2 && r.item2.expected])[0], l = n[1]) : c = r.expected, u = { conType: M.PivotConditionType.caption, operator: r.compareType, val: [c, l] }; break; case 1: l = (n = [r.item1 && r.item1.expected, r.item2 && r.item2.expected])[1], !(c = n[0]) || c instanceof Date || (c = f(c)), !l || l instanceof Date || (l = f(l)), u = { conType: M.PivotConditionType.date, val: [c, l], operator: r.compareType, isWholeDay: r.isWholeDay }, r.compareType === M.PivotDateFilterOperator.dateToDate && (u.isParallel = r.isParallel, u.isDynamicEndDate = r.isDynamicEndDate, u.by = r.by); break; case 3: u = { conType: M.PivotConditionType.top10, val: r.expected, type: r.compareType, operator: r.type }; break; case 2: c = (n = [r.item1 && r.item1.expected, r.item2 && r.item2.expected])[0], l = n[1], u = { conType: M.PivotConditionType.value, val: r.expected ? [r.expected] : [c, l], operator: r.compareType } }return u } }, J = function (t) { var i, n, e, n, e, n, e, n, e, n, i = N; switch (t.conType) { case M.PivotConditionType.caption: e = (n = t.val)[0], n = n[1], i = new M.PivotFilterCaptionCondition(t.operator, e, n); break; case M.PivotConditionType.date: n = (e = t.val)[0], e = e[1], i = t.operator === M.PivotDateFilterOperator.dateToDate ? new M.PivotFilterDateCondition(t.operator, t.isWholeDay, n, e, t.isDynamicEndDate, t.isParallel, t.by) : new M.PivotFilterDateCondition(t.operator, t.isWholeDay, n, e); break; case M.PivotConditionType.top10: i = new M.PivotFilterTop10Condition(t.operator, t.type, t.val); break; case M.PivotConditionType.value: e = (n = t.val)[0], n = n[1], i = new M.PivotFilterValueCondition(t.operator, e, n) }return i }, q = ["difference", "index", "normal", "percent", "percentDiff", "percentOfCol", "percentOfRow", "percentOfTotal", "runTotal"], w.Caption_Compare_Type_Excel = [["captionEqual", "captionNotEqual", "captionBeginsWith", "captionNotBeginsWith", "captionEndsWith", "captionNotEndsWith", "captionContains", "captionNotContains", "captionGreaterThan", "captionGreaterThanOrEqual", "captionLessThan", "captionLessThanOrEqual", "captionBetween", "captionNotBetween"], ["dateEqual", "dateNotEqual", "dateOlderThan", "dateOlderThanOrEqual", "dateNewerThan", "dateNewerThanOrEqual", "dateBetween", "dateNotBetween", "today", "yesterday", "tomorrow", I, "thisMonth", "lastMonth", "nextMonth", "thisWeek", "lastWeek", "nextWeek", "nextQuarter", "thisQuarter", "lastQuarter", "nextYear", "thisYear", "lastYear", "Q1", "Q2", "Q3", "Q4", "M1", "M2", "M3", "M4", "M5", "M6", "M7", "M8", "M9", "M10", "M11", "M12", "yearToDate"], ["valueEqual", "valueNotEqual", "valueGreaterThan", "valueGreaterThanOrEqual", "valueLessThan", "valueLessThanOrEqual", "valueBetween", "valueNotBetwee"], ["count", "percent", "sum"]], w.in = _, e.prototype.add = function (t, i) { !this.get(t) && i && (this.Pq[t] = i) }, e.prototype.get = function (t) { return this.Pq[t] }, e.prototype.set = function (t, i, n) { var e = this.get(t); !k(n) && k(i) ? (k(e) && (e = {}), 1 === n ? e.labelFilter = N : 2 === n ? e.valueFilter = N : this.remove(t)) : e = i, e && k(e.labelFilter) && k(e.valueFilter) && this.remove(t) }, e.prototype.isFilter = function (t) { var t = this.get(t); return !!t && (t.C() || t.on()) }, e.prototype.remove = function (t) { this.get(t) && delete this.Pq[t] }, e.prototype.dispose = function () { for (var t, i, n, e, t = 0, i = Object.keys(this.Pq); t < i.length; t++)n = i[t], (e = this.Pq[n]).L0() }, K = e, w.PivotViewFilterManager = K, r.prototype.C = function (t) { var i, n = this.labelFilter; if (n) { if (n.textItem && !n.textItem.isAll) return !0; if (!t && n.condition) return !0 } return !1 }, r.prototype.getSlicerItemInfo = function () { var t, i, n, e, r, t = this.selectMultipleItems, i = this.labelFilter, n = !1, e = ""; return i && i.textItem && i.textItem.list && (1 === (r = i.textItem.list.length) ? e = i.textItem.list[0] : 1 < r && (n = !0)), { selectMultipleItems: t.allowMultipleFiltersPerField, hasMoreThanOneSelect: n, text: e } }, r.prototype.on = function () { return !!this.valueFilter }, r.prototype.evaluateLabelCondition = function (t) { var i, n, e, i = this; return !i.labelFilter || !i.labelFilter.condition || (e = t, (n = i.labelFilter.condition).sn === M.PivotConditionType.date && (e = (0, M.parseStringToDate)(t) || t), i.labelFilter.condition.evaluate(e)) }, r.prototype.isInLabelFilterItem = function (t) { var i = this; return !i.labelFilter || !i.labelFilter.textItem || -1 < i.labelFilter.textItem.list.indexOf(t) }, r.prototype.updateLabelCondition = function (t, i) { var n = this; k(n.labelFilter) && (n.labelFilter = {}), k(t) ? n.labelFilter.condition = N : n.labelFilter.condition = J(t), i || (n.labelFilter.textItem = N), n.u = !0 }, r.prototype.updateLabelTextItem = function (t, i) { var n = this; k(n.labelFilter) && (n.labelFilter = {}), k(t) || (n.labelFilter.textItem = t), i || (n.labelFilter.condition = N), n.u = !0 }, r.prototype.updateValueCondition = function (t) { var i = this; k(i.valueFilter) && (i.valueFilter = {}), i.valueFilter.condition = J(t.condition), i.valueFilter.conditionByName = t.conditionByName }, r.prototype.isMatchedLabelItem = function (t, i) { return (i || this.evaluateLabelCondition(t + "")) && this.isInLabelFilterItem(t) }, r.prototype.L0 = function () { var t = this; t.labelFilter = N, t.valueFilter = N, t.selectMultipleItems = N }, p = r, w.PivotViewFilter = p, a.prototype.ln = function (t) { this.g(t) }, a.prototype.g = function (t) { var i, n, e, e, i = this, n = i.a, e = t.fn(n); i.DV = e.startValue, i.mn = e.endValue, i.lp = t.kn(n), i.ie = t.Le(n), e = t.tr(n), i.W5 = t.hr(n), i._items = i.br(t.yr(n), e) }, a.prototype.br = function (t, i) { for (var n, e, r, o, a, s, n, e = [], r = this.ie, a = 0; a < t.length; a++)s = a, o = !1, r && 0 < r.length && (s = r[t[a]]), i && i[t[a]] && (o = !0), e.push({ indexValue: s, value: t[a], calculatedMember: o }); return e }, a.prototype.getSubTotalType = function () { return this.Ar }, a.prototype.setSubTotalType = function (t) { this.Ar !== t && (this.Ar = t) }, a.prototype.getSortInfo = function () { return this.nrt }, a.prototype.setSortInfo = function (t) { this.nrt = t, this.kr = t && t.sortType }, a.prototype.toPivotViewSubTotalFields = function () { var t, i, n, t = N; return this.Or && (i = this.a, n = E(this.Or, []), t = c({ subtotalType: this.Ar, cacheName: i, fieldName: this.Zc }, n)), { subTotalType: this.Ar, cacheName: this.a, valueFieldName: this.Zc, index: this.lp, showDataAs: t } }, a.prototype.toPivotViewQueryField = function (t, i, n, e, r) { return tt(this.Zc, this.a, this.lp, t, this.nrt, i, n, e, r, this.Spi) }, a.prototype.Br = function (t) { }, a.prototype.do = function (t) { switch (t) { case g.PivotTableFieldType.rowField: return "axisRow"; case g.PivotTableFieldType.columnField: return "axisCol"; case g.PivotTableFieldType.filterField: return "axisPage"; case g.PivotTableFieldType.valueField: return "axisValues" } }, a.prototype.ea = function (t) { for (var i, n, e, r, i, n = this._items, e = 0; e < n.length; e++)if ((r = n[e]) && r.indexValue === t) return r }, a.prototype.es = function (t) { for (var i, n, e, r, i, n = this._items, e = 0; e < n.length; e++)if ((r = n[e]) && r.value === t) return r }, a.prototype.cs = function (t, i) { for (var n, e, r, o, n, e = i || this._items, r = 0; r < e.length; r++)if ((o = e[r]) && o.value === t) return r }, a.prototype.gs = function (t, i, n, e) { for (var r, o, a, s, u, c, l, f, f, h, v, r = this, o = [], a = !1, s = t.length, u = [], c = 0; c < s; c++)f = (l = t[c]).indexValue, k(f) || (f = r.ea(f), k(f)) || (k(l.childItems) || (f.childItems = l.childItems), k(l.expanded) || (f.expanded = l.expanded), k(l.drillAcross) || (f.drillAcross = l.drillAcross), k(l.calculatedMember) || (f.calculatedMember = l.calculatedMember), !0 === l.hidden ? a = !0 : o.push(f.value), k(l.missing) || (f.missing = l.missing), k(l.caption) || (f.caption = l.caption), k(l.character) || (f.character = l.character), !0 === l.collapse && n.setCollapse(i, f.value, !0), k(l.type) || (f.type = l.type), u.push(f)); r._items = u, a && (h = n.getFilterInfo(r.a), k(h) && (h = new p(N, N, n.H), n.K.add(r.a, h)), h.updateLabelTextItem(v = { isAll: !1, list: o }, n.H.allowMultipleFiltersPerField), n.K.set(r.a, h)) }, a.prototype.Bs = function (t, i, n, e) { for (var r, o, a, s, u, c, l, f, f, h, v, r = this, o = [], a = !1, s = +t.count, u = [], c = 0; c < s; c++)l = t.c_[c], f = T(l.x), k(f) || (f = r.ea(f), k(f)) || (k(l.c) || (f.childItems = d(l.c)), k(l.d) || (f.expanded = d(l.d)), k(l.e) || (f.drillAcross = d(l.e)), k(l.f) || (f.calculatedMember = d(l.f)), !0 === d(l.h) ? a = !0 : o.push(f.value), k(l.m) || (f.missing = d(l.m)), k(l.n) || (f.caption = l.n), k(l.s) || (f.character = d(l.s)), !1 === d(l.sd) && n.setCollapse(i, f.value, !0), k(l.t) || (f.type = l.t), u.push(f)); r._items = u, a && (h = n.getFilterInfo(r.a), k(h) && (h = new p(N, N, n.H), n.K.add(r.a, h)), h.updateLabelTextItem(v = { isAll: !1, list: o }, n.H.allowMultipleFiltersPerField), n.K.set(r.a, h)) }, a.prototype.fromJson = function (t, i) { var n, e, r, o, o, a, s, u, n = this; n.cft = St(t), k(t.name) || (n.Zc = t.name), r = (e = i.Ti.getPivotCacheByName(i.L)).getField(n.a), k(t.items) || (o = r && 2 === r.W5 && !k(r.Rs), n.gs(t.items, n.Zc, i, o)), k(t.sortType) || (o = t.sortType, a = {}, s = t.autoSortScope, u = void 0, "ascending" === o ? u = M.SortType.asc : "descending" === o && (u = M.SortType.desc), s ? n.rpi = { sortType: u, pivotArea: s } : (a.sortType = u, n.nrt = a, n.kr = a.sortType)), k(t.fld) || (n.lp = t.fld), k(t.baseField) || (n.baseField = t.baseField), k(t.measureFilter) || (n.nc = t.measureFilter), k(t.numberFormat) || (n.bbt = t.numberFormat), k(t.showAll) || (n.rc = t.showAll, i.ac[r.Zc] = n.rc) }, a.prototype.yh = function (t, i, n) { var e, r, o, a, s, r, s, u, c, r, u, r, c, s, e = this; e.sc = St(i), k(i.name) || (e.Zc = S(x(i.name))), r = O(i, "items") || [], s = (a = (o = n.Ti.getPivotCacheByName(n.L)).getField(e.a)) && 2 === a.W5 && !k(a.Rs), e.Bs(r, e.Zc, n, s), k(i.sortType) || (r = i.sortType, s = {}, u = j(i, "autoSortScope"), c = void 0, "ascending" === r ? c = M.SortType.asc : "descending" === r && (c = M.SortType.desc), u ? (r = W(u, "pivotArea")) && 0 < r.length && (e.rpi = { sortType: c, pivotArea: r[0] }) : (s.sortType = c, e.nrt = s, e.kr = s.sortType)), k(i.fld) || (e.lp = +i.fld), k(i.baseField) || (e.baseField = T(i.baseField)), k(i.measureFilter) || (e.nc = d(i.measureFilter)), u = d(i.showAll, !0), e.rc = n.ac[a.Zc] = u, (s = (c = (r = O(i, "extLst")) && O(r, "ext")) && O(c, "pivotField")) && s.fillDownLabels && (t.options.fillDownLabels = d(s.fillDownLabels)) }, a.prototype.cc = function (t, i, n, e, r, o, a) { var s, u, c, l, f, h, v, s, u = a || this._items, c = [], l = 0; for (e && r && u && u[0] && u[0].value !== "<" + (0, y.formatDateToString)(r) && (c.push({ indexValue: 0 }), l = 1), f = 0; f < u.length; f++)h = u[f], v = {}, k(h) || (k(h.childItems) || (v.childItems = h.childItems), k(h.expanded) || (v.expanded = h.expanded), k(h.drillAcross) || (v.drillAcross = h.drillAcross), k(h.calculatedMember) || (v.calculatedMember = h.calculatedMember), !0 === n[h.value] && (v.hidden = !0), k(h.missing) || (v.missing = h.missing), k(h.caption) || (v.caption = h.caption), k(h.character) || (v.character = h.character), i && !0 === i[h.value] && (v.collapse = !0), k(h.type) || (v.type = h.type), k(h.indexValue) || (v.indexValue = e ? h.indexValue + l : h.indexValue), c.push(v)); return e && o && u && u[u.length - 1] && u[u.length - 1].value !== ">" + (0, y.formatDateToString)(o) && c.push({ indexValue: c.length }), t && c.push({ type: "default" }), c }, a.prototype.mc = function (t, i, n, e, r, o, a) { var s, u, c, l, f, h, v, s, u = a || this._items, c = [], l = 0; for (e && r && u && u[0] && u[0].value !== "<" + (0, y.formatDateToString)(r) && (c.push({ n_: "item", x: 0 }), l = 1), f = 0; f < u.length; f++)h = u[f], v = { n_: "item" }, k(h) || (h.childItems && (v.c = "1"), !1 === h.expanded && (v.d = "0"), !1 === h.drillAcross && (v.e = "0"), h.calculatedMember && (v.f = "1"), !0 === n[h.value] && (v.h = "1"), h.missing && (v.m = "1"), k(h.caption) || (v.n = h.caption), h.character && (v.s = "1"), i && !0 === i[h.value] && (v.sd = "0"), k(h.type) || (v.t = h.type), k(h.indexValue) || (v.x = e ? h.indexValue + l : h.indexValue), c.push(v)); return e && o && u && u[u.length - 1] && u[u.length - 1].value !== ">" + (0, y.formatDateToString)(o) && c.push({ n_: "item", x: c.length }), t && c.push({ n_: "item", t: "default" }), c }, a.prototype.tl = function (t) { var i, t, n, e, r, o, a, s, u, i, t = t.bl(this.a), n = t && t.sf(); if (n) for (s in e = [], r = t.sh, o = t.getFieldsItemList(), a = 0, n) n.hasOwnProperty(s) && (e[u = n[s]] = { indexValue: a, value: o[s], calculatedMember: !!r[o[s]] }, a += 1); return e }, a.prototype.toJson = function (t) { var i, n, e, r, e, e, e, e, e, o, e, a, s, u, c, r, i = this, n = i.cft || {}, e = t.layoutType(), r = t.dh; switch (e) { case g.PivotTableLayoutType.outline: n.compact = !1, delete n.outline; break; case g.PivotTableLayoutType.tabular: n.compact = !1, n.outline = !1; break; case g.PivotTableLayoutType.compact: delete n.outline, delete n.compact }if (e = t.dh, n.axis = i.do(e.Z[i.Zc]), k(t.options.subTotalsPosition) || (n.defaultSubtotal = t.options.subTotalsPosition !== g.SubtotalsPosition.none && I), n.insertBlankRow = t.options.insertBlankLineAfterEachItem, k(i.nc) || (n.measureFilter = i.nc), 0 <= e.Q.indexOf(i) ? n.name = i.a : k(i.Zc) || (n.name = i.Zc), k(i.kr) || (e = void 0, i.kr === M.SortType.asc ? e = "ascending" : i.kr === M.SortType.desc && (e = "descending"), n.sortType = e), (e = i.nrt) && e.sortValueFieldName && (e = It(e, r), n.autoSortScope = t.sheetPivotAreaToExcelPivotArea(e)), n.subtotalTop = !1 !== i.Spi && I, k(i.lp) || (n.fld = i.lp), k(i.bbt) || (n.numberFormat = i.bbt), n.showAll = t.showNoData(i.a), o = (e = r.getLabelFilterInfo(i.a)) && e.textItem && e.textItem.list, !k(i._items) && (pt(i.Zc, r) || o) && 0 < i._items.length) { if (e = r.dv && r.dv[i.Zc], a = {}, o && 0 < o.length) { for (s = 0; s < i._items.length; s++)a[i._items[s].value] = !0; for (s = 0; s < o.length; s++)a[o[s]] = !1 } (u = r.bl(i.a)) && (c = 2 === u.W5 && !k(u.Rs), r = i.tl(r), n.items = i.cc(t.options.subTotalsPosition !== g.SubtotalsPosition.none, e, a, c, u.T, u.gd, r)) } return n }, a.prototype.wh = function (t) { var i, n, e, r, e, e, o, a, e, o, s, e, u, c, o, l, f, e, o, l, f, e, i = this, n = i.sc || { n_: "pivotField" }, e = t.layoutType(), r = t.dh; switch (e) { case g.PivotTableLayoutType.outline: n.compact = "0", delete n.outline; break; case g.PivotTableLayoutType.tabular: n.compact = "0", n.outline = "0"; break; case g.PivotTableLayoutType.compact: delete n.outline, delete n.compact }if (0 <= r.Q.indexOf(i) ? n.name = h(U(i.a)) : k(i.Zc) || (n.name = h(U(i.Zc))), e = t.dh, n.axis = i.do(e.Z[i.Zc]), k(t.options.subTotalsPosition) || (n.defaultSubtotal = t.options.subTotalsPosition === g.SubtotalsPosition.none ? "0" : I), t.options.insertBlankLineAfterEachItem && (n.insertBlankRow = "1"), i.nc && (n.measureFilter = "1"), !1 === i.Spi ? n.subtotalTop = "0" : delete n.subtotalTop, k(i.bbt) || (o = (e = D.ExtendedNumberFormatHelper.getFormatId(i.bbt)).id, (a = e.isBuiltIn) ? n.numFmtId = o : ((e = {}).numberFormat = new D.ExcelNumerFormat(o, i.bbt), n.numFmtId = e.numberFormat.numberFormatId)), !1 === t.showNoData(i.a) && (n.showAll = "0"), s = (o = r.getLabelFilterInfo(i.a)) && o.textItem && o.textItem.list, !k(i._items) && (pt(i.Zc, r) || s) && 0 < i._items.length) { if (e = r.dv && r.dv[i.Zc], u = {}, s && 0 < s.length) { for (c = 0; c < i._items.length; c++)u[i._items[c].value] = !0; for (c = 0; c < s.length; c++)u[s[c]] = !1 } (o = r.bl(i.a)) && (l = 2 === o.W5 && !k(o.Rs), f = i.tl(r), e = i.mc(t.options.subTotalsPosition !== g.SubtotalsPosition.none, e, u, l, o.T, o.gd, f), n.c_ = [{ n_: "items", count: e.length + "", c_: e }]) } return k(i.nrt) || (l = void 0, (o = i.nrt).sortType === M.SortType.asc ? l = "ascending" : o.sortType === M.SortType.desc && (l = "descending"), n.sortType = l, o.sortValueFieldName && (f = It(o, r), e = { n_: "autoSortScope", c_: [t.sheetPivotAreaToSJSPivotArea(f)] }, n.c_.push(e))), !0 === t.options.fillDownLabels && (n.c_ = n.c_ || [], n.c_.push({ n_: "extLst", c_: [{ n_: "ext", r_: [63, 1], c_: [{ n_: "pivotField", fillDownLabels: "1" }] }] })), n }, a.prototype.eG = function () { var t = this; t.nrt = N, t._items = N, t.ie = N, t.bbt = N, t.Or = N, t.cft = N, t.sc = N, t.rc = N }, v = a, w.PivotViewField = v, w.toPivotViewQueryField = tt, w.getCellValuePivotFilter = ot, w.getPivotDateExConditionRange = st, F.prototype.a1 = function (t, i) { var n, e, n, t, n = this, e = n.ac; return k(e) && (n.ac = {}, e = n.ac), t = (n = n.bl(t)) && (n.y1 || n.Zc), k(i) ? e[t] || !1 : !i != !e[t] ? (e[t] = !!i, !0) : void 0 }, F.prototype.x1 = function (t, i, n, e) { var r = this, o = r.L, a = this.Ti, s; try { s = a.getPivotCacheByName(o).updateCalcItem(t, i, n, e, r.P1()) } catch (t) { (0, w.throwError)(C().PivotTableErrorFormula) } return s && (r.q1 = !0), s }, F.prototype.up = function (t) { var i, n = this.L, e; return this.Ti.getPivotCacheByName(n).getCalcItems(t) }, F.prototype.Rp = function (t, i) { var n, e, r, e, i, n = this, e = n.L, r, e = this.Ti.getPivotCacheByName(e).removeCalcItem(t, i), i = n.Up(t)[0]; return i && e && (n.sm(t, !0), i.ln(n), n.q1 = !0), e }, F.prototype.Db = function (t, i, n) { for (var e, r, o, a, s, u, c, l, c, f, e = this, r, a = 0, s = e.Up(t); a < s.length; a++)if (u = s[a], e.Z[u.Zc] !== g.PivotTableFieldType.valueField) { o = u; break } if (k(o) || !e.lg(o.Zc, i)) return !1; c = e.L, c = (l = this.Ti).getPivotCacheByName(c); try { f = c.addCalcItem(t, i, n, e.P1()) } catch (t) { (0, w.throwError)(C().PivotTableErrorFormula) } return !1 !== f && (e.q1 = !0, e.sm(t), o) && o.ln(e), f }, F.prototype.P1 = function () { for (var t, i, n, e, r, o, t = this, i, n = [], e = 0, r = t.nw(g.PivotTableFieldType.rowField).concat(t.nw(g.PivotTableFieldType.columnField)); e < r.length; e++)o = r[e], n.push(o.a); return n }, F.prototype.lw = function (t) { var i, n, e, n, i, n = this.L, e, n = this.Ti.getPivotCacheByName(n); if (!k(n)) return k(t) ? n.aggregateCalcItem() : n.aggregateCalcItem(t === g.CalcItemAggregation.include) }, F.prototype.tr = function (t) { for (var i, n, e, r, o, a, s, u, c, i, n = this.L, e, r, o, a = {}, s = 0, u = this.Ti.getPivotCacheByName(n).getField(t).ty; s < u.length; s++)a[c = u[s]] = !0; return a }, F.prototype.sm = function (t, i) { var n, t, e, n = this, t = n.sy(t); t && (e = t.textGroup && t.textGroup.fieldName, n.cy(e, null, !0), i && n.modifyGroupInfoByCalcItem(t), n.dy(t)) }, F.prototype.modifyGroupInfoByCalcItem = function (t) { var i, n, e, r, o, e, a, s, n, u, c, l, f, h, v, d, p, m, b, i, n = t.originFieldName, e = this.L, r, o, e = this.Ti.getPivotCacheByName(e).getField(n); if (e && (a = e.M() || {}, n = (s = t.textGroup && t.textGroup.groupItems) && Object.keys(s), !(k(n) || n.length < 1))) { for (c = 0, l = n; c < l.length; c++) { for (u = s[f = l[c]], h = 0; h < u.length;)k(a[u[h]]) ? u.splice(h, 1) : h++; 0 === u.length && delete s[f] } if (0 === Object.keys(s).length) { for (v = {}, p = 0, m = d = Object.keys(a); p < m.length; p++)v[b = m[p]] = b; t.textGroup.groupItems = v } } }, F.prototype.lg = function (t, i) { var n = this; return n.checkGroup(t) && n.checkSubTotal() && n.checkField(t) && n.checkFieldItem(t, i) }, F.prototype.checkField = function (t) { var i, n, t, e, r, o, a, s, u, i = this, n; if (i.Z[t] === g.PivotTableFieldType.filterField) return !1; if (e = {}, (t = i.nw(g.PivotTableFieldType.valueField)) && 1 < t.length) for (r = 0, o = t; r < o.length; r++)e[(a = o[r]).a] ? (0, w.throwError)(C().PivotTableCalcItemHasMultipleDataField) : e[a.a] = !0; for (s = 0, u = t; s < u.length; s++)a = u[s], 1 < i.Up(a.a).length && (0, w.throwError)(C().PivotTableCalcItemHasTowCacheField); return !0 }, F.prototype.checkSubTotal = function (t) { var i, n, n, t, i = this, n = i.nw(g.PivotTableFieldType.valueField); if (n && n.length) switch (n = n[0], t = k(t = t) ? i.xy(n.Zc) : t) { case M.SubtotalType.average: case M.SubtotalType.stdDev: case M.SubtotalType.stdDevp: case M.SubtotalType.varr: case M.SubtotalType.varp: (0, w.throwError)(C().PivotTableSubtotalType) }return !0 }, F.prototype.checkFieldItem = function (t, i) { var n, t, n, e, n, r, t, n, n = this, t = n.getFieldInfoByName(t); return !k(t) && (n = n.L, t = (r = (n = (e = this.Ti).getPivotCacheByName(n).getField(t.a)).getFieldsItemList()).indexOf(i), n = n.up(), 0 <= t && n.indexOf(i) < 0 && (0, w.throwError)(C().PivotTableHasSameItemName), !0) }, F.prototype.checkGroup = function (t) { for (var i, n, e, r, o, e, a, i = this, n, r = 0, o = i.ky(); r < o.length; r++)e = o[r], e = i.rC(e.name), k(e) || k(e.dateGroups) && k(e.numberGroup) || (0, w.throwError)(C().PivotTableHasNumberOrDateGroup); return (a = i.FC(t)).cC() && (0, w.throwError)(C().PivotTableHasNumberOrDateGroup), !0 }, F.prototype.cC = function (t) { var i, t, i, t = this.bl(t); if (t) return !!t.y1 }, F.prototype.NA = function (t) { var i, n, e, r, i, n = this.L, e, r; return this.Ti.getPivotCacheByName(n).getField(t).hasCalcItem() }, F.prototype.DA = function () { var t, i, n, i, e, r, o, t = this, i = t.L, n, i = this.Ti.getPivotCacheByName(i).getHeaderList(); if (i && i.length) for (e = 0, r = i; e < r.length; e++)if (o = r[e], t.NA(o.name)) return !0; return !1 }, F.prototype.Up = function (t) { for (var i, n, e, r, o, a, i, n = [], e, r = 0, o = this.nw(); r < o.length; r++)(a = o[r]).a === t && n.push(a); return n }, F.prototype.LN = function () { var t = this, i; return t.Ti.getPivotCacheByName(t.L).getDataRefer() }, F.prototype.ky = function () { var t, t, i, t = this, t = t.Ti.getPivotCacheByName(t.L), i = []; return i = t ? t.getHeaderList() : i }, F.prototype.y2 = function (t, i, n) { var e, r, o, e, r = this.Y, o = r.indexOf(t); -1 < o && r.splice(o, 1), i && (k(n) ? r.push(t) : r.splice(n, 0, t)) }, F.prototype.setSigmaValuePosition = function (t, i) { var n, e, r, e, n = this, e = n.getSigmaValuePosition(), r = e.positionType, e = e.positionIndex; k(t) || t !== M.DataPosition.row && t !== M.DataPosition.col || (n.x2 = t), !k(i) && 0 <= i && (n.P2 = i), n.DT({ position: r, valuesIndex: e, type: "updateValuePosition" }) }, F.prototype.getSigmaValuePosition = function () { var t, i, n, t = this, i = 1 < t.Q.length, n = t.P2; return { positionType: t.x2, positionIndex: n, display: i } }, F.prototype.xy = function (t, i) { var n, e, r, o, a, n = this, e = n.getFieldInfoByName(t); if (e) { if (r = e.getSubTotalType(), 1 === arguments.length) return r; if (r !== i) { for (o in n.DA() && !k(i) && n.checkSubTotal(i), e.setSubTotalType(i), n.nrt) !n.nrt.hasOwnProperty(o) || k(n.nrt[o]) || (a = n.nrt[o]).cacheName !== e.a && a.sortValueFieldName !== e.Zc || (a.sortValueSubtotalText = M.SubtotalType[i]); n.q1 = !0, this.DT({ fieldName: t, subtotalType: r, type: "subTotalType" }) } } }, F.prototype.VT = function (t) { var i, n, e, r, o, a, s, u, c, l, f, h, v, i = this; if (!k(t)) { for (n = t.fieldsInfo, e = 0; e <= 3; e++)i.RM(e); for (i.setSigmaValuePosition(t.valueInfo.positionType, t.valueInfo.positionIndex), r = 0; r < 4; r++)for (o = n[r], a = 0; a < o.length; a++)u = (s = o[a]).sourceName, c = s.displayName, l = s.subtotal, i.addFieldByName(u, c, r, l); for (e = 0; e < 4; e++)for (o = n[e], a = 0; a < o.length; a++)u = (s = o[a]).sourceName, f = s.valueFilter, h = s.labelFilter, v = s.sortInfo, !h || k(h.condition) && k(h.textItem) || i.setLabelFilterInfo(u, h), f && !k(f.condition) && i.setValueFilterInfo(u, f), k(v) || i.setSortInfo(u, v) } }, F.prototype.UM = function () { for (var t, i, n, e, r, o, a, s, u, t = this, i = [], n = t.getSigmaValuePosition(), e = 0; e < 4; e++) { for (r = t.nw(e), o = [], a = 0; a < r.length; a++)(u = { sourceName: (s = r[a]).a, displayName: s.Zc }).subtotal = s.Ar, u.labelFilter = t.getLabelFilterInfo(s.Zc), u.valueFilter = t.getValueFilterInfo(s.Zc), u.sortInfo = s.nrt, o.push(u); i[e] = o } return { fieldsInfo: i, valueInfo: n } }, F.prototype.KM = function (t) { var i, n, e, r, o, a, s, u, c, l, f, h, v, d, p, m, i = this, e = i.tx, o = e.sx, a = {}, s = [], u = !0, c = {}, f = {}, h = i.Ti.getPivotCacheByName(i.L); if (!k(e)) { if ((0, M.o)(t, function (t) { n = i.FC(t.fieldName), k(n) || (f[t.fieldName] = n.W5, c[t.fieldName] = k(n.y1) ? n.D : n.cx, a[t.fieldName] = t.fieldItem) }), k(a)) r = !0; else { for (v = 0, d = e.tx; v < d.l