@extend-ai/react-xlsx 0.18.0 → 0.18.1
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/README.md +50 -0
- package/dist/Carlito-OFL.txt +94 -0
- package/dist/chart-renderer-HQSQHDCB.js +5040 -0
- package/dist/chart-renderer-HQSQHDCB.js.map +1 -0
- package/dist/chart-renderer-ZUWRNNZT.cjs +5041 -0
- package/dist/chart-renderer-ZUWRNNZT.cjs.map +1 -0
- package/dist/chunk-5ERNVHSO.cjs +94 -0
- package/dist/chunk-5ERNVHSO.cjs.map +1 -0
- package/dist/chunk-BAAMDEDS.js +104 -0
- package/dist/chunk-BAAMDEDS.js.map +1 -0
- package/dist/chunk-E2VSYCP2.cjs +104 -0
- package/dist/chunk-E2VSYCP2.cjs.map +1 -0
- package/dist/chunk-FO6MIHX4.cjs +8 -0
- package/dist/chunk-FO6MIHX4.cjs.map +1 -0
- package/dist/chunk-OZLJPZUX.js +70 -0
- package/dist/chunk-OZLJPZUX.js.map +1 -0
- package/dist/chunk-VWGKYABF.js +94 -0
- package/dist/chunk-VWGKYABF.js.map +1 -0
- package/dist/chunk-WFQGZI2Z.cjs +70 -0
- package/dist/chunk-WFQGZI2Z.cjs.map +1 -0
- package/dist/index.cjs +2701 -9431
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +1084 -7781
- package/dist/index.js.map +1 -1
- package/dist/region-map-geography-5E5SVPGS.cjs +184 -0
- package/dist/region-map-geography-5E5SVPGS.cjs.map +1 -0
- package/dist/region-map-geography-YD54DI3H.js +182 -0
- package/dist/region-map-geography-YD54DI3H.js.map +1 -0
- package/dist/spreadsheet-font-assets-7QMV43XD.cjs +121 -0
- package/dist/spreadsheet-font-assets-7QMV43XD.cjs.map +1 -0
- package/dist/spreadsheet-font-assets-V366MXRM.js +119 -0
- package/dist/spreadsheet-font-assets-V366MXRM.js.map +1 -0
- package/dist/surface-regl-NWR5ZZ5D.js +720 -0
- package/dist/surface-regl-NWR5ZZ5D.js.map +1 -0
- package/dist/surface-regl-WVLW3SEA.cjs +721 -0
- package/dist/surface-regl-WVLW3SEA.cjs.map +1 -0
- package/dist/xlsx-worker.js +234 -267
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/builtin-chart-styles.ts
|
|
2
|
+
function decodeSrgb(channel) {
|
|
3
|
+
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
4
|
+
}
|
|
5
|
+
function encodeSrgb(channel) {
|
|
6
|
+
return channel <= 31308e-7 ? channel * 12.92 : 1.055 * channel ** (1 / 2.4) - 0.055;
|
|
7
|
+
}
|
|
8
|
+
function quantizeLinear(channel) {
|
|
9
|
+
return Math.round(channel * 1e5) / 1e5;
|
|
10
|
+
}
|
|
11
|
+
function resolveBuiltinChartColor(color, colorsByIndex) {
|
|
12
|
+
if (!color) return void 0;
|
|
13
|
+
const hex = _optionalChain([colorsByIndex, 'access', _ => _[color.themeIndex], 'optionalAccess', _2 => _2.replace, 'call', _3 => _3(/^#/, "")]);
|
|
14
|
+
if (!hex || !/^[\da-f]{6}$/i.test(hex)) return void 0;
|
|
15
|
+
if (color.transforms.length === 0) return `#${hex.toLowerCase()}`;
|
|
16
|
+
const channels = [0, 2, 4].map((offset) => Math.fround(quantizeLinear(decodeSrgb(Number.parseInt(hex.slice(offset, offset + 2), 16) / 255))));
|
|
17
|
+
for (const transform of color.transforms) {
|
|
18
|
+
const amount = Math.fround(Math.max(0, Math.min(1, transform.value)));
|
|
19
|
+
for (let index = 0; index < channels.length; index += 1) {
|
|
20
|
+
const channel = channels[index];
|
|
21
|
+
channels[index] = transform.type === "tint" ? Math.fround(Math.fround(1 - amount) + Math.fround(amount * channel)) : Math.fround(amount * channel);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return `#${channels.map((channel) => Math.round(encodeSrgb(quantizeLinear(channel)) * 255).toString(16).padStart(2, "0")).join("")}`;
|
|
25
|
+
}
|
|
26
|
+
var GRAYSCALE_TINTS = [88, 55, 78, 92, 70, 30];
|
|
27
|
+
var DARK_GRAYSCALE_TINTS = [5, 55, 78, 15, 70, 30];
|
|
28
|
+
function normalizeClassicStyle(styleId) {
|
|
29
|
+
if (styleId === void 0 || !Number.isInteger(styleId)) return void 0;
|
|
30
|
+
if (styleId >= 1 && styleId <= 48) return styleId;
|
|
31
|
+
if (styleId >= 101 && styleId <= 148) return styleId - 100;
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
function themeColor(themeIndex, tint) {
|
|
35
|
+
return {
|
|
36
|
+
themeIndex,
|
|
37
|
+
transforms: tint === void 0 ? [] : [{ type: "tint", value: tint / 100 }]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function appendBrightness(color, percent) {
|
|
41
|
+
if (percent > 0) color.transforms.push({ type: "tint", value: (100 - percent) / 100 });
|
|
42
|
+
if (percent < 0) color.transforms.push({ type: "shade", value: (100 + percent) / 100 });
|
|
43
|
+
return color;
|
|
44
|
+
}
|
|
45
|
+
function getBuiltinChartColor(styleId, index, count) {
|
|
46
|
+
const style = normalizeClassicStyle(styleId);
|
|
47
|
+
if (style === void 0 || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
const palette = style === 41 ? 9 : (style - 1) % 8 + 1;
|
|
51
|
+
const monochrome = palette >= 3 && palette <= 8;
|
|
52
|
+
const color = monochrome ? themeColor(palette + 1) : palette === 2 ? themeColor(4 + index % 6) : themeColor(1, (palette === 9 ? DARK_GRAYSCALE_TINTS : GRAYSCALE_TINTS)[index % 6]);
|
|
53
|
+
const numerator = 140 * (monochrome ? index + 1 : Math.floor(index / 6) + 1);
|
|
54
|
+
const denominator = monochrome ? count + 1 : Math.floor(count / 6) + 2;
|
|
55
|
+
const brightness = (Math.trunc(Math.fround(Math.fround(numerator) / Math.fround(denominator))) - 70) % 100;
|
|
56
|
+
return appendBrightness(color, brightness);
|
|
57
|
+
}
|
|
58
|
+
function getBuiltinChartSurfaceStyle(styleId) {
|
|
59
|
+
const style = normalizeClassicStyle(styleId);
|
|
60
|
+
if (style === void 0) return void 0;
|
|
61
|
+
let fill = null;
|
|
62
|
+
if (style === 33 || style === 34) fill = themeColor(1, 20);
|
|
63
|
+
if (style >= 35 && style <= 40) fill = themeColor(style - 31, (_nullishCoalesce(styleId, () => ( 0))) >= 100 ? 20 : void 0);
|
|
64
|
+
if (style >= 41) fill = themeColor(1, 95);
|
|
65
|
+
return {
|
|
66
|
+
floor: { fill, line: style <= 40 ? themeColor(1, 75) : null },
|
|
67
|
+
wall: { fill, line: null },
|
|
68
|
+
majorGridline: themeColor(1, (_nullishCoalesce(styleId, () => ( 0))) >= 100 ? 75 : void 0),
|
|
69
|
+
minorGridline: themeColor(1, style >= 41 ? 90 : 50)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function getBuiltinChartSurfaceLine(styleId, index, count) {
|
|
73
|
+
const style = normalizeClassicStyle(styleId);
|
|
74
|
+
if (style === void 0 || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {
|
|
75
|
+
return void 0;
|
|
76
|
+
}
|
|
77
|
+
if (style >= 9 && style <= 16) return themeColor(2);
|
|
78
|
+
if (styleId === 133) return themeColor(1, 92);
|
|
79
|
+
if (style === 33 || style >= 35 && style <= 40) {
|
|
80
|
+
return {
|
|
81
|
+
themeIndex: style === 33 ? 1 : style - 31,
|
|
82
|
+
transforms: [{ type: "shade", value: 0.5 }]
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
exports.resolveBuiltinChartColor = resolveBuiltinChartColor; exports.getBuiltinChartColor = getBuiltinChartColor; exports.getBuiltinChartSurfaceStyle = getBuiltinChartSurfaceStyle; exports.getBuiltinChartSurfaceLine = getBuiltinChartSurfaceLine;
|
|
94
|
+
//# sourceMappingURL=chunk-5ERNVHSO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/react-xlsx/react-xlsx/packages/react-xlsx/dist/chunk-5ERNVHSO.cjs","../src/builtin-chart-styles.ts"],"names":[],"mappings":"AAAA;ACiBA,SAAS,UAAA,CAAW,OAAA,EAAiB;AACnC,EAAA,OAAO,QAAA,GAAW,QAAA,EAAU,QAAA,EAAU,MAAA,EAAA,CAAA,CAAU,QAAA,EAAU,KAAA,EAAA,EAAS,KAAA,EAAA,GAAU,GAAA;AAC/E;AAEA,SAAS,UAAA,CAAW,OAAA,EAAiB;AACnC,EAAA,OAAO,QAAA,GAAW,SAAA,EAAY,QAAA,EAAU,MAAA,EAAQ,MAAA,EAAQ,QAAA,GAAA,CAAY,EAAA,EAAI,GAAA,EAAA,EAAO,KAAA;AACjF;AAEA,SAAS,cAAA,CAAe,OAAA,EAAiB;AACvC,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,QAAA,EAAU,GAAM,EAAA,EAAI,GAAA;AACxC;AAGO,SAAS,wBAAA,CACd,KAAA,EACA,aAAA,EACoB;AACpB,EAAA,GAAA,CAAI,CAAC,KAA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HSO.cjs","sourcesContent":[null,"export type BuiltinChartColorTransform = {\n type: \"tint\" | \"shade\";\n value: number;\n};\n\nexport type BuiltinChartColor = {\n themeIndex: number;\n transforms: BuiltinChartColorTransform[];\n};\n\nexport type BuiltinChartSurfaceStyle = {\n floor: { fill: BuiltinChartColor | null; line: BuiltinChartColor | null };\n wall: { fill: BuiltinChartColor | null; line: BuiltinChartColor | null };\n majorGridline: BuiltinChartColor;\n minorGridline: BuiltinChartColor;\n};\n\nfunction decodeSrgb(channel: number) {\n return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;\n}\n\nfunction encodeSrgb(channel: number) {\n return channel <= 0.0031308 ? channel * 12.92 : 1.055 * channel ** (1 / 2.4) - 0.055;\n}\n\nfunction quantizeLinear(channel: number) {\n return Math.round(channel * 100000) / 100000;\n}\n\n/** DrawingML tint and shade operate on linear RGB and retain the given fraction. */\nexport function resolveBuiltinChartColor(\n color: BuiltinChartColor | null | undefined,\n colorsByIndex: Readonly<Record<number, string | null | undefined>>\n): string | undefined {\n if (!color) return undefined;\n const hex = colorsByIndex[color.themeIndex]?.replace(/^#/, \"\");\n if (!hex || !/^[\\da-f]{6}$/i.test(hex)) return undefined;\n if (color.transforms.length === 0) return `#${hex.toLowerCase()}`;\n\n const channels = [0, 2, 4].map((offset) => Math.fround(quantizeLinear(decodeSrgb(Number.parseInt(hex.slice(offset, offset + 2), 16) / 255))));\n for (const transform of color.transforms) {\n const amount = Math.fround(Math.max(0, Math.min(1, transform.value)));\n for (let index = 0; index < channels.length; index += 1) {\n const channel = channels[index]!;\n channels[index] = transform.type === \"tint\"\n ? Math.fround(Math.fround(1 - amount) + Math.fround(amount * channel))\n : Math.fround(amount * channel);\n }\n }\n return `#${channels.map((channel) => Math.round(encodeSrgb(quantizeLinear(channel)) * 255).toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\nconst GRAYSCALE_TINTS = [88, 55, 78, 92, 70, 30];\nconst DARK_GRAYSCALE_TINTS = [5, 55, 78, 15, 70, 30];\n\nfunction normalizeClassicStyle(styleId: number | undefined) {\n if (styleId === undefined || !Number.isInteger(styleId)) return undefined;\n if (styleId >= 1 && styleId <= 48) return styleId;\n if (styleId >= 101 && styleId <= 148) return styleId - 100;\n return undefined;\n}\n\nfunction themeColor(themeIndex: number, tint?: number): BuiltinChartColor {\n return {\n themeIndex,\n transforms: tint === undefined ? [] : [{ type: \"tint\", value: tint / 100 }]\n };\n}\n\nfunction appendBrightness(color: BuiltinChartColor, percent: number) {\n if (percent > 0) color.transforms.push({ type: \"tint\", value: (100 - percent) / 100 });\n if (percent < 0) color.transforms.push({ type: \"shade\", value: (100 + percent) / 100 });\n return color;\n}\n\n/** Returns defaults only; explicit colors and custom color styles take precedence. */\nexport function getBuiltinChartColor(\n styleId: number | undefined,\n index: number,\n count: number\n): BuiltinChartColor | undefined {\n const style = normalizeClassicStyle(styleId);\n if (style === undefined || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {\n return undefined;\n }\n\n const palette = style === 41 ? 9 : ((style - 1) % 8) + 1;\n const monochrome = palette >= 3 && palette <= 8;\n const color = monochrome\n ? themeColor(palette + 1)\n : palette === 2\n ? themeColor(4 + (index % 6))\n : themeColor(1, (palette === 9 ? DARK_GRAYSCALE_TINTS : GRAYSCALE_TINTS)[index % 6]);\n\n const numerator = 140 * (monochrome ? index + 1 : Math.floor(index / 6) + 1);\n const denominator = monochrome ? count + 1 : Math.floor(count / 6) + 2;\n const brightness = (Math.trunc(Math.fround(Math.fround(numerator) / Math.fround(denominator))) - 70) % 100;\n return appendBrightness(color, brightness);\n}\n\nexport function getBuiltinChartSurfaceStyle(styleId: number | undefined): BuiltinChartSurfaceStyle | undefined {\n const style = normalizeClassicStyle(styleId);\n if (style === undefined) return undefined;\n\n let fill: BuiltinChartColor | null = null;\n if (style === 33 || style === 34) fill = themeColor(1, 20);\n if (style >= 35 && style <= 40) fill = themeColor(style - 31, (styleId ?? 0) >= 100 ? 20 : undefined);\n if (style >= 41) fill = themeColor(1, 95);\n\n return {\n floor: { fill, line: style <= 40 ? themeColor(1, 75) : null },\n wall: { fill, line: null },\n majorGridline: themeColor(1, (styleId ?? 0) >= 100 ? 75 : undefined),\n minorGridline: themeColor(1, style >= 41 ? 90 : 50)\n };\n}\n\nexport function getBuiltinChartSurfaceLine(\n styleId: number | undefined,\n index: number,\n count: number\n): BuiltinChartColor | undefined {\n const style = normalizeClassicStyle(styleId);\n if (style === undefined || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {\n return undefined;\n }\n if (style >= 9 && style <= 16) return themeColor(2);\n if (styleId === 133) return themeColor(1, 92);\n if (style === 33 || (style >= 35 && style <= 40)) {\n return {\n themeIndex: style === 33 ? 1 : style - 31,\n transforms: [{ type: \"shade\", value: 0.5 }]\n };\n }\n return undefined;\n}\n"]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// src/surface-lighting.ts
|
|
2
|
+
function surfaceNormal(a, b, c) {
|
|
3
|
+
const ux = b.x - a.x;
|
|
4
|
+
const uy = b.y - a.y;
|
|
5
|
+
const uz = b.z - a.z;
|
|
6
|
+
const vx = c.x - a.x;
|
|
7
|
+
const vy = c.y - a.y;
|
|
8
|
+
const vz = c.z - a.z;
|
|
9
|
+
const x = uy * vz - uz * vy;
|
|
10
|
+
const y = uz * vx - ux * vz;
|
|
11
|
+
const z = ux * vy - uy * vx;
|
|
12
|
+
const length = Math.hypot(x, y, z) || 1;
|
|
13
|
+
return { x: x / length, y: y / length, z: z / length };
|
|
14
|
+
}
|
|
15
|
+
function transformSurfaceNormal(normal, rotX, rotY, rightAngleAxes = false) {
|
|
16
|
+
const xAngle = rightAngleAxes ? 0 : rotX * Math.PI / 180;
|
|
17
|
+
const yAngle = rightAngleAxes ? 0 : rotY * Math.PI / 180;
|
|
18
|
+
const cx = Math.cos(xAngle);
|
|
19
|
+
const sx = Math.sin(xAngle);
|
|
20
|
+
const cy = Math.cos(yAngle);
|
|
21
|
+
const sy = Math.sin(yAngle);
|
|
22
|
+
const x = -cy * normal.x + sy * normal.z;
|
|
23
|
+
const y = sy * sx * normal.x + cx * normal.y + cy * sx * normal.z;
|
|
24
|
+
const z = sy * cx * normal.x - sx * normal.y + cy * cx * normal.z;
|
|
25
|
+
const facing = rightAngleAxes ? z - x * Math.sin(rotY * Math.PI / 180) - y * Math.sin(rotX * Math.PI / 180) : z;
|
|
26
|
+
const length = (Math.hypot(x, y, z) || 1) * (facing > 0 ? -1 : 1);
|
|
27
|
+
return { x: x / length, y: y / length, z: z / length };
|
|
28
|
+
}
|
|
29
|
+
function shadeSurfaceMatteColor(color, normal) {
|
|
30
|
+
const hex = color.replace(/^#/, "");
|
|
31
|
+
if (!/^[0-9a-f]{6}$/i.test(hex)) return color;
|
|
32
|
+
const diffuse = Math.max(0, Math.min(1, (normal.x + normal.y - normal.z) / Math.sqrt(3)));
|
|
33
|
+
const intensity = 0.4 + 0.75 * diffuse;
|
|
34
|
+
return `#${[0, 2, 4].map((offset) => Math.min(255, Math.floor(Number.parseInt(hex.slice(offset, offset + 2), 16) * intensity)).toString(16).padStart(2, "0")).join("")}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/surface-geometry.ts
|
|
38
|
+
function surfaceHeightRatio(heightPercent, plot) {
|
|
39
|
+
return heightPercent != null && Number.isFinite(heightPercent) && heightPercent > 0 ? heightPercent / 100 : plot.height / Math.max(1, plot.width);
|
|
40
|
+
}
|
|
41
|
+
function surfaceDataRatios(rows, columns, betweenCategories, heightPercent, depthPercent, plot) {
|
|
42
|
+
const columnCount = Math.max(1, columns);
|
|
43
|
+
const dataFraction = betweenCategories && columnCount > 1 ? (columnCount - 1) / columnCount : 1;
|
|
44
|
+
return {
|
|
45
|
+
height: Math.floor((columnCount + Math.max(1, rows) - (betweenCategories ? 0 : 1)) / 2) / columnCount / dataFraction * surfaceHeightRatio(heightPercent, plot),
|
|
46
|
+
depth: Math.max(0.01, Math.max(1, rows) / columnCount * (depthPercent ?? 100) / 100) / dataFraction
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function scaleSurfaceValue(value, axis) {
|
|
50
|
+
const scaled = axis?.logBase != null && axis.logBase > 1 ? Math.log(Math.max(Number.MIN_VALUE, value)) / Math.log(axis.logBase) : value;
|
|
51
|
+
return axis?.orientation === "maxMin" ? -scaled : scaled;
|
|
52
|
+
}
|
|
53
|
+
function normalizeSurfaceValue(value, min, max, axis) {
|
|
54
|
+
const start = scaleSurfaceValue(min, axis);
|
|
55
|
+
const end = scaleSurfaceValue(max, axis);
|
|
56
|
+
const lower = Math.min(start, end);
|
|
57
|
+
const span = Math.abs(end - start);
|
|
58
|
+
return span > 0 ? (scaleSurfaceValue(value, axis) - lower) / span : 0.5;
|
|
59
|
+
}
|
|
60
|
+
function triangulateSurfaceQuad(corners, axis) {
|
|
61
|
+
const heights = corners.map((point) => -scaleSurfaceValue(point.value, axis));
|
|
62
|
+
return heights[0] * 0.5 + heights[2] * 0.5 > heights[1] * 0.5 + heights[3] * 0.5 ? [[corners[3], corners[0], corners[1]], [corners[1], corners[2], corners[3]]] : [[corners[2], corners[3], corners[0]], [corners[0], corners[1], corners[2]]];
|
|
63
|
+
}
|
|
64
|
+
function clipSurfaceBand(points, threshold, keepAbove, axis, includeBoundary = true) {
|
|
65
|
+
const result = [];
|
|
66
|
+
points.forEach((end, index) => {
|
|
67
|
+
const start = points[(index + points.length - 1) % points.length];
|
|
68
|
+
const startInside = keepAbove ? start.value >= threshold : start.value <= threshold;
|
|
69
|
+
const endInside = keepAbove ? end.value >= threshold : end.value <= threshold;
|
|
70
|
+
if (startInside !== endInside) {
|
|
71
|
+
const startValue = scaleSurfaceValue(start.value, axis);
|
|
72
|
+
const ratio = (scaleSurfaceValue(threshold, axis) - startValue) / (scaleSurfaceValue(end.value, axis) - startValue);
|
|
73
|
+
result.push({ value: threshold, x: start.x + (end.x - start.x) * ratio, y: start.y + (end.y - start.y) * ratio });
|
|
74
|
+
}
|
|
75
|
+
if (endInside) {
|
|
76
|
+
result.push(end);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return !includeBoundary && result.every((point) => point.value === threshold) ? [] : result;
|
|
80
|
+
}
|
|
81
|
+
function surfaceBandEdges(polygon, triangle) {
|
|
82
|
+
const start = triangle[2];
|
|
83
|
+
const end = triangle[0];
|
|
84
|
+
const dx = end.x - start.x;
|
|
85
|
+
const dy = end.y - start.y;
|
|
86
|
+
const tolerance = 1e-9 * Math.max(1, dx * dx + dy * dy);
|
|
87
|
+
const onDiagonal = (point) => Math.abs((point.x - start.x) * dy - (point.y - start.y) * dx) <= tolerance;
|
|
88
|
+
return polygon.flatMap((from, index) => {
|
|
89
|
+
const to = polygon[(index + 1) % polygon.length];
|
|
90
|
+
return onDiagonal(from) && onDiagonal(to) || from.x === to.x && from.y === to.y ? [] : [[from, to]];
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
surfaceNormal,
|
|
96
|
+
transformSurfaceNormal,
|
|
97
|
+
shadeSurfaceMatteColor,
|
|
98
|
+
surfaceDataRatios,
|
|
99
|
+
normalizeSurfaceValue,
|
|
100
|
+
triangulateSurfaceQuad,
|
|
101
|
+
clipSurfaceBand,
|
|
102
|
+
surfaceBandEdges
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=chunk-BAAMDEDS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/surface-lighting.ts","../src/surface-geometry.ts"],"sourcesContent":["export type SurfaceVector = { x: number; y: number; z: number };\n\nexport function surfaceNormal(a: SurfaceVector, b: SurfaceVector, c: SurfaceVector): SurfaceVector {\n const ux = b.x - a.x;\n const uy = b.y - a.y;\n const uz = b.z - a.z;\n const vx = c.x - a.x;\n const vy = c.y - a.y;\n const vz = c.z - a.z;\n const x = uy * vz - uz * vy;\n const y = uz * vx - ux * vz;\n const z = ux * vy - uy * vx;\n const length = Math.hypot(x, y, z) || 1;\n return { x: x / length, y: y / length, z: z / length };\n}\n\nexport function transformSurfaceNormal(normal: SurfaceVector, rotX: number, rotY: number, rightAngleAxes = false): SurfaceVector {\n const xAngle = rightAngleAxes ? 0 : rotX * Math.PI / 180;\n const yAngle = rightAngleAxes ? 0 : rotY * Math.PI / 180;\n const cx = Math.cos(xAngle);\n const sx = Math.sin(xAngle);\n const cy = Math.cos(yAngle);\n const sy = Math.sin(yAngle);\n const x = -cy * normal.x + sy * normal.z;\n const y = sy * sx * normal.x + cx * normal.y + cy * sx * normal.z;\n const z = sy * cx * normal.x - sx * normal.y + cy * cx * normal.z;\n const facing = rightAngleAxes\n ? z - x * Math.sin(rotY * Math.PI / 180) - y * Math.sin(rotX * Math.PI / 180)\n : z;\n const length = (Math.hypot(x, y, z) || 1) * (facing > 0 ? -1 : 1);\n return { x: x / length, y: y / length, z: z / length };\n}\n\nexport function shadeSurfaceMatteColor(color: string, normal: SurfaceVector) {\n const hex = color.replace(/^#/, \"\");\n if (!/^[0-9a-f]{6}$/i.test(hex)) return color;\n const diffuse = Math.max(0, Math.min(1, (normal.x + normal.y - normal.z) / Math.sqrt(3)));\n const intensity = 0.4 + 0.75 * diffuse;\n return `#${[0, 2, 4].map((offset) => Math.min(255, Math.floor(Number.parseInt(hex.slice(offset, offset + 2), 16) * intensity)).toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n","import type { XlsxChartAxis } from \"./types\";\n\nexport type SurfaceBandPoint = { x: number; y: number; value: number };\n\nexport function surfaceHeightRatio(heightPercent: number | undefined, plot: { width: number; height: number }) {\n return heightPercent != null && Number.isFinite(heightPercent) && heightPercent > 0\n ? heightPercent / 100\n : plot.height / Math.max(1, plot.width);\n}\n\nexport function surfaceDataRatios(rows: number, columns: number, betweenCategories: boolean, heightPercent: number | undefined, depthPercent: number | undefined, plot: { width: number; height: number }) {\n const columnCount = Math.max(1, columns);\n const dataFraction = betweenCategories && columnCount > 1 ? (columnCount - 1) / columnCount : 1;\n return {\n height: Math.floor((columnCount + Math.max(1, rows) - (betweenCategories ? 0 : 1)) / 2) / columnCount / dataFraction * surfaceHeightRatio(heightPercent, plot),\n depth: Math.max(0.01, Math.max(1, rows) / columnCount * (depthPercent ?? 100) / 100) / dataFraction\n };\n}\n\nexport function scaleSurfaceValue(value: number, axis?: XlsxChartAxis | null) {\n const scaled = axis?.logBase != null && axis.logBase > 1\n ? Math.log(Math.max(Number.MIN_VALUE, value)) / Math.log(axis.logBase)\n : value;\n return axis?.orientation === \"maxMin\" ? -scaled : scaled;\n}\n\nexport function normalizeSurfaceValue(value: number, min: number, max: number, axis?: XlsxChartAxis | null) {\n const start = scaleSurfaceValue(min, axis);\n const end = scaleSurfaceValue(max, axis);\n const lower = Math.min(start, end);\n const span = Math.abs(end - start);\n return span > 0 ? (scaleSurfaceValue(value, axis) - lower) / span : 0.5;\n}\n\nexport function triangulateSurfaceQuad<T extends { value: number }>(corners: [T, T, T, T], axis?: XlsxChartAxis | null): Array<[T, T, T]> {\n const heights = corners.map((point) => -scaleSurfaceValue(point.value, axis));\n return heights[0] * 0.5 + heights[2] * 0.5 > heights[1] * 0.5 + heights[3] * 0.5\n ? [[corners[3], corners[0], corners[1]], [corners[1], corners[2], corners[3]]]\n : [[corners[2], corners[3], corners[0]], [corners[0], corners[1], corners[2]]];\n}\n\nexport function clipSurfaceBand(points: SurfaceBandPoint[], threshold: number, keepAbove: boolean, axis?: XlsxChartAxis | null, includeBoundary = true) {\n const result: SurfaceBandPoint[] = [];\n points.forEach((end, index) => {\n const start = points[(index + points.length - 1) % points.length];\n const startInside = keepAbove ? start.value >= threshold : start.value <= threshold;\n const endInside = keepAbove ? end.value >= threshold : end.value <= threshold;\n if (startInside !== endInside) {\n const startValue = scaleSurfaceValue(start.value, axis);\n const ratio = (scaleSurfaceValue(threshold, axis) - startValue) / (scaleSurfaceValue(end.value, axis) - startValue);\n result.push({ value: threshold, x: start.x + (end.x - start.x) * ratio, y: start.y + (end.y - start.y) * ratio });\n }\n if (endInside) {\n result.push(end);\n }\n });\n return !includeBoundary && result.every((point) => point.value === threshold) ? [] : result;\n}\n\nexport function surfaceBandEdges(polygon: SurfaceBandPoint[], triangle: [SurfaceBandPoint, SurfaceBandPoint, SurfaceBandPoint]) {\n const start = triangle[2];\n const end = triangle[0];\n const dx = end.x - start.x;\n const dy = end.y - start.y;\n const tolerance = 1e-9 * Math.max(1, dx * dx + dy * dy);\n const onDiagonal = (point: SurfaceBandPoint) => Math.abs((point.x - start.x) * dy - (point.y - start.y) * dx) <= tolerance;\n return polygon.flatMap((from, index): Array<[SurfaceBandPoint, SurfaceBandPoint]> => {\n const to = polygon[(index + 1) % polygon.length];\n return (onDiagonal(from) && onDiagonal(to)) || (from.x === to.x && from.y === to.y)\n ? []\n : [[from, to]];\n });\n}\n"],"mappings":";AAEO,SAAS,cAAc,GAAkB,GAAkB,GAAiC;AACjG,QAAM,KAAK,EAAE,IAAI,EAAE;AACnB,QAAM,KAAK,EAAE,IAAI,EAAE;AACnB,QAAM,KAAK,EAAE,IAAI,EAAE;AACnB,QAAM,KAAK,EAAE,IAAI,EAAE;AACnB,QAAM,KAAK,EAAE,IAAI,EAAE;AACnB,QAAM,KAAK,EAAE,IAAI,EAAE;AACnB,QAAM,IAAI,KAAK,KAAK,KAAK;AACzB,QAAM,IAAI,KAAK,KAAK,KAAK;AACzB,QAAM,IAAI,KAAK,KAAK,KAAK;AACzB,QAAM,SAAS,KAAK,MAAM,GAAG,GAAG,CAAC,KAAK;AACtC,SAAO,EAAE,GAAG,IAAI,QAAQ,GAAG,IAAI,QAAQ,GAAG,IAAI,OAAO;AACvD;AAEO,SAAS,uBAAuB,QAAuB,MAAc,MAAc,iBAAiB,OAAsB;AAC/H,QAAM,SAAS,iBAAiB,IAAI,OAAO,KAAK,KAAK;AACrD,QAAM,SAAS,iBAAiB,IAAI,OAAO,KAAK,KAAK;AACrD,QAAM,KAAK,KAAK,IAAI,MAAM;AAC1B,QAAM,KAAK,KAAK,IAAI,MAAM;AAC1B,Q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AAI,GAAG,KAAK,KAAK,KAAK,EAAE;AACtD,QAAM,aAAa,CAAC,UAA4B,KAAK,KAAK,MAAM,IAAI,MAAM,KAAK,MAAM,MAAM,IAAI,MAAM,KAAK,EAAE,KAAK;AACjH,SAAO,QAAQ,QAAQ,CAAC,MAAM,UAAuD;AACnF,UAAM,KAAK,SAAS,QAAQ,KAAK,QAAQ,MAAM;AAC/C,WAAQ,WAAW,IAAI,KAAK,WAAW,EAAE,KAAO,KAAK,MAAM,GAAG,KAAK,KAAK,MAAM,GAAG,IAC7E,CAAC,IACD,CAAC,CAAC,MAAM,EAAE,CAAC;AAAA,EACjB,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/surface-lighting.ts
|
|
2
|
+
function surfaceNormal(a, b, c) {
|
|
3
|
+
const ux = b.x - a.x;
|
|
4
|
+
const uy = b.y - a.y;
|
|
5
|
+
const uz = b.z - a.z;
|
|
6
|
+
const vx = c.x - a.x;
|
|
7
|
+
const vy = c.y - a.y;
|
|
8
|
+
const vz = c.z - a.z;
|
|
9
|
+
const x = uy * vz - uz * vy;
|
|
10
|
+
const y = uz * vx - ux * vz;
|
|
11
|
+
const z = ux * vy - uy * vx;
|
|
12
|
+
const length = Math.hypot(x, y, z) || 1;
|
|
13
|
+
return { x: x / length, y: y / length, z: z / length };
|
|
14
|
+
}
|
|
15
|
+
function transformSurfaceNormal(normal, rotX, rotY, rightAngleAxes = false) {
|
|
16
|
+
const xAngle = rightAngleAxes ? 0 : rotX * Math.PI / 180;
|
|
17
|
+
const yAngle = rightAngleAxes ? 0 : rotY * Math.PI / 180;
|
|
18
|
+
const cx = Math.cos(xAngle);
|
|
19
|
+
const sx = Math.sin(xAngle);
|
|
20
|
+
const cy = Math.cos(yAngle);
|
|
21
|
+
const sy = Math.sin(yAngle);
|
|
22
|
+
const x = -cy * normal.x + sy * normal.z;
|
|
23
|
+
const y = sy * sx * normal.x + cx * normal.y + cy * sx * normal.z;
|
|
24
|
+
const z = sy * cx * normal.x - sx * normal.y + cy * cx * normal.z;
|
|
25
|
+
const facing = rightAngleAxes ? z - x * Math.sin(rotY * Math.PI / 180) - y * Math.sin(rotX * Math.PI / 180) : z;
|
|
26
|
+
const length = (Math.hypot(x, y, z) || 1) * (facing > 0 ? -1 : 1);
|
|
27
|
+
return { x: x / length, y: y / length, z: z / length };
|
|
28
|
+
}
|
|
29
|
+
function shadeSurfaceMatteColor(color, normal) {
|
|
30
|
+
const hex = color.replace(/^#/, "");
|
|
31
|
+
if (!/^[0-9a-f]{6}$/i.test(hex)) return color;
|
|
32
|
+
const diffuse = Math.max(0, Math.min(1, (normal.x + normal.y - normal.z) / Math.sqrt(3)));
|
|
33
|
+
const intensity = 0.4 + 0.75 * diffuse;
|
|
34
|
+
return `#${[0, 2, 4].map((offset) => Math.min(255, Math.floor(Number.parseInt(hex.slice(offset, offset + 2), 16) * intensity)).toString(16).padStart(2, "0")).join("")}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/surface-geometry.ts
|
|
38
|
+
function surfaceHeightRatio(heightPercent, plot) {
|
|
39
|
+
return heightPercent != null && Number.isFinite(heightPercent) && heightPercent > 0 ? heightPercent / 100 : plot.height / Math.max(1, plot.width);
|
|
40
|
+
}
|
|
41
|
+
function surfaceDataRatios(rows, columns, betweenCategories, heightPercent, depthPercent, plot) {
|
|
42
|
+
const columnCount = Math.max(1, columns);
|
|
43
|
+
const dataFraction = betweenCategories && columnCount > 1 ? (columnCount - 1) / columnCount : 1;
|
|
44
|
+
return {
|
|
45
|
+
height: Math.floor((columnCount + Math.max(1, rows) - (betweenCategories ? 0 : 1)) / 2) / columnCount / dataFraction * surfaceHeightRatio(heightPercent, plot),
|
|
46
|
+
depth: Math.max(0.01, Math.max(1, rows) / columnCount * (_nullishCoalesce(depthPercent, () => ( 100))) / 100) / dataFraction
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function scaleSurfaceValue(value, axis) {
|
|
50
|
+
const scaled = _optionalChain([axis, 'optionalAccess', _ => _.logBase]) != null && axis.logBase > 1 ? Math.log(Math.max(Number.MIN_VALUE, value)) / Math.log(axis.logBase) : value;
|
|
51
|
+
return _optionalChain([axis, 'optionalAccess', _2 => _2.orientation]) === "maxMin" ? -scaled : scaled;
|
|
52
|
+
}
|
|
53
|
+
function normalizeSurfaceValue(value, min, max, axis) {
|
|
54
|
+
const start = scaleSurfaceValue(min, axis);
|
|
55
|
+
const end = scaleSurfaceValue(max, axis);
|
|
56
|
+
const lower = Math.min(start, end);
|
|
57
|
+
const span = Math.abs(end - start);
|
|
58
|
+
return span > 0 ? (scaleSurfaceValue(value, axis) - lower) / span : 0.5;
|
|
59
|
+
}
|
|
60
|
+
function triangulateSurfaceQuad(corners, axis) {
|
|
61
|
+
const heights = corners.map((point) => -scaleSurfaceValue(point.value, axis));
|
|
62
|
+
return heights[0] * 0.5 + heights[2] * 0.5 > heights[1] * 0.5 + heights[3] * 0.5 ? [[corners[3], corners[0], corners[1]], [corners[1], corners[2], corners[3]]] : [[corners[2], corners[3], corners[0]], [corners[0], corners[1], corners[2]]];
|
|
63
|
+
}
|
|
64
|
+
function clipSurfaceBand(points, threshold, keepAbove, axis, includeBoundary = true) {
|
|
65
|
+
const result = [];
|
|
66
|
+
points.forEach((end, index) => {
|
|
67
|
+
const start = points[(index + points.length - 1) % points.length];
|
|
68
|
+
const startInside = keepAbove ? start.value >= threshold : start.value <= threshold;
|
|
69
|
+
const endInside = keepAbove ? end.value >= threshold : end.value <= threshold;
|
|
70
|
+
if (startInside !== endInside) {
|
|
71
|
+
const startValue = scaleSurfaceValue(start.value, axis);
|
|
72
|
+
const ratio = (scaleSurfaceValue(threshold, axis) - startValue) / (scaleSurfaceValue(end.value, axis) - startValue);
|
|
73
|
+
result.push({ value: threshold, x: start.x + (end.x - start.x) * ratio, y: start.y + (end.y - start.y) * ratio });
|
|
74
|
+
}
|
|
75
|
+
if (endInside) {
|
|
76
|
+
result.push(end);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return !includeBoundary && result.every((point) => point.value === threshold) ? [] : result;
|
|
80
|
+
}
|
|
81
|
+
function surfaceBandEdges(polygon, triangle) {
|
|
82
|
+
const start = triangle[2];
|
|
83
|
+
const end = triangle[0];
|
|
84
|
+
const dx = end.x - start.x;
|
|
85
|
+
const dy = end.y - start.y;
|
|
86
|
+
const tolerance = 1e-9 * Math.max(1, dx * dx + dy * dy);
|
|
87
|
+
const onDiagonal = (point) => Math.abs((point.x - start.x) * dy - (point.y - start.y) * dx) <= tolerance;
|
|
88
|
+
return polygon.flatMap((from, index) => {
|
|
89
|
+
const to = polygon[(index + 1) % polygon.length];
|
|
90
|
+
return onDiagonal(from) && onDiagonal(to) || from.x === to.x && from.y === to.y ? [] : [[from, to]];
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
exports.surfaceNormal = surfaceNormal; exports.transformSurfaceNormal = transformSurfaceNormal; exports.shadeSurfaceMatteColor = shadeSurfaceMatteColor; exports.surfaceDataRatios = surfaceDataRatios; exports.normalizeSurfaceValue = normalizeSurfaceValue; exports.triangulateSurfaceQuad = triangulateSurfaceQuad; exports.clipSurfaceBand = clipSurfaceBand; exports.surfaceBandEdges = surfaceBandEdges;
|
|
104
|
+
//# sourceMappingURL=chunk-E2VSYCP2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/react-xlsx/react-xlsx/packages/react-xlsx/dist/chunk-E2VSYCP2.cjs","../src/surface-lighting.ts","../src/surface-geometry.ts"],"names":[],"mappings":"AAAA;ACEO,SAAS,aAAA,CAAc,CAAA,EAAkB,CAAA,EAAkB,CAAA,EAAiC;AACjG,EAAA,MAAM,GAAA,EAAK,CAAA,CAAE,EAAA,EAAI,CAAA,CAAE,CAAA;AACnB,EAAA,MAAM,GAAA,EAAK,CAAA,CAAE,EAAA,EAAI,CAAA,CAAE,CAAA;AACnB,EAAA,MAAM,GAAA,EAAK,CAAA,CAAE,EAAA,EAAI,CAAA,CAAE,CAAA;AACnB,EAAA,MAAM,GAAA,EAAK,CAAA,CAAE,EAAA,EAAI,CAAA,CAAE,CAAA;AACnB,EAAA,MAAM,GAAA,EAAK,CAAA,CAAE,EAAA,EAAI,CAAA,CAAE,CAAA;AACnB,EAAA,MAAM,GAAA,EAAK,CAAA,CAAE,EAAA,EAAI,CAAA,CAAE,CAAA;AACnB,EAAA,MAAM,EAAA,EAAI,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,EAAA;AACzB,EAAA,MAAM,EAAA,EAAI,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,EAAA;AACzB,EAAA,MAAM,EAAA,EAAI,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,EAAA;AACzB,EAAA,MAAM,OAAA,EAAS,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,CAAA,EAAG,CAAC,EAAA,GAAK,CAAA;AACtC,EAAA,OAAO,EAAE,CAAA,EAAG,EAAA,EAAI,MAAA,EAAQ,CAAA,EAAG,EAAA,EAAI,MAAA,EAAQ,CAAA,EAAG,EAAA,EAAI,OAAO,CAAA;AACvD;AAEO,SAAS,sBAAA,CAAuB,MAAA,EAAuB,IAA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rE,EAAA;AAC1C;AAE2M;AAClK,EAAA;AACuD,EAAA;AACvF,EAAA;AACwJ,IAAA;AACtE,IAAA;AACzF,EAAA;AACF;AAE8E;AAGxE,EAAA;AAC8C,EAAA;AACpD;AAE4G;AACjE,EAAA;AACF,EAAA;AACN,EAAA;AACA,EAAA;AACmC,EAAA;AACtE;AAE0I;AAC5D,EAAA;AAGtE,EAAA;AACR;AAEwJ;AAClH,EAAA;AACL,EAAA;AACmC,IAAA;AACU,IAAA;AACN,IAAA;AACrC,IAAA;AACyB,MAAA;AACkD,MAAA;AACQ,MAAA;AAClH,IAAA;AACe,IAAA;AACE,MAAA;AACjB,IAAA;AACD,EAAA;AACoF,EAAA;AACvF;AAEgI;AACtG,EAAA;AACF,EAAA;AACG,EAAA;AACA,EAAA;AAC6B,EAAA;AAC2D,EAAA;AAC5B,EAAA;AACpC,IAAA;AAGhC,IAAA;AAChB,EAAA;AACH;AFoByK;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/react-xlsx/react-xlsx/packages/react-xlsx/dist/chunk-E2VSYCP2.cjs","sourcesContent":[null,"export type SurfaceVector = { x: number; y: number; z: number };\n\nexport function surfaceNormal(a: SurfaceVector, b: SurfaceVector, c: SurfaceVector): SurfaceVector {\n const ux = b.x - a.x;\n const uy = b.y - a.y;\n const uz = b.z - a.z;\n const vx = c.x - a.x;\n const vy = c.y - a.y;\n const vz = c.z - a.z;\n const x = uy * vz - uz * vy;\n const y = uz * vx - ux * vz;\n const z = ux * vy - uy * vx;\n const length = Math.hypot(x, y, z) || 1;\n return { x: x / length, y: y / length, z: z / length };\n}\n\nexport function transformSurfaceNormal(normal: SurfaceVector, rotX: number, rotY: number, rightAngleAxes = false): SurfaceVector {\n const xAngle = rightAngleAxes ? 0 : rotX * Math.PI / 180;\n const yAngle = rightAngleAxes ? 0 : rotY * Math.PI / 180;\n const cx = Math.cos(xAngle);\n const sx = Math.sin(xAngle);\n const cy = Math.cos(yAngle);\n const sy = Math.sin(yAngle);\n const x = -cy * normal.x + sy * normal.z;\n const y = sy * sx * normal.x + cx * normal.y + cy * sx * normal.z;\n const z = sy * cx * normal.x - sx * normal.y + cy * cx * normal.z;\n const facing = rightAngleAxes\n ? z - x * Math.sin(rotY * Math.PI / 180) - y * Math.sin(rotX * Math.PI / 180)\n : z;\n const length = (Math.hypot(x, y, z) || 1) * (facing > 0 ? -1 : 1);\n return { x: x / length, y: y / length, z: z / length };\n}\n\nexport function shadeSurfaceMatteColor(color: string, normal: SurfaceVector) {\n const hex = color.replace(/^#/, \"\");\n if (!/^[0-9a-f]{6}$/i.test(hex)) return color;\n const diffuse = Math.max(0, Math.min(1, (normal.x + normal.y - normal.z) / Math.sqrt(3)));\n const intensity = 0.4 + 0.75 * diffuse;\n return `#${[0, 2, 4].map((offset) => Math.min(255, Math.floor(Number.parseInt(hex.slice(offset, offset + 2), 16) * intensity)).toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n","import type { XlsxChartAxis } from \"./types\";\n\nexport type SurfaceBandPoint = { x: number; y: number; value: number };\n\nexport function surfaceHeightRatio(heightPercent: number | undefined, plot: { width: number; height: number }) {\n return heightPercent != null && Number.isFinite(heightPercent) && heightPercent > 0\n ? heightPercent / 100\n : plot.height / Math.max(1, plot.width);\n}\n\nexport function surfaceDataRatios(rows: number, columns: number, betweenCategories: boolean, heightPercent: number | undefined, depthPercent: number | undefined, plot: { width: number; height: number }) {\n const columnCount = Math.max(1, columns);\n const dataFraction = betweenCategories && columnCount > 1 ? (columnCount - 1) / columnCount : 1;\n return {\n height: Math.floor((columnCount + Math.max(1, rows) - (betweenCategories ? 0 : 1)) / 2) / columnCount / dataFraction * surfaceHeightRatio(heightPercent, plot),\n depth: Math.max(0.01, Math.max(1, rows) / columnCount * (depthPercent ?? 100) / 100) / dataFraction\n };\n}\n\nexport function scaleSurfaceValue(value: number, axis?: XlsxChartAxis | null) {\n const scaled = axis?.logBase != null && axis.logBase > 1\n ? Math.log(Math.max(Number.MIN_VALUE, value)) / Math.log(axis.logBase)\n : value;\n return axis?.orientation === \"maxMin\" ? -scaled : scaled;\n}\n\nexport function normalizeSurfaceValue(value: number, min: number, max: number, axis?: XlsxChartAxis | null) {\n const start = scaleSurfaceValue(min, axis);\n const end = scaleSurfaceValue(max, axis);\n const lower = Math.min(start, end);\n const span = Math.abs(end - start);\n return span > 0 ? (scaleSurfaceValue(value, axis) - lower) / span : 0.5;\n}\n\nexport function triangulateSurfaceQuad<T extends { value: number }>(corners: [T, T, T, T], axis?: XlsxChartAxis | null): Array<[T, T, T]> {\n const heights = corners.map((point) => -scaleSurfaceValue(point.value, axis));\n return heights[0] * 0.5 + heights[2] * 0.5 > heights[1] * 0.5 + heights[3] * 0.5\n ? [[corners[3], corners[0], corners[1]], [corners[1], corners[2], corners[3]]]\n : [[corners[2], corners[3], corners[0]], [corners[0], corners[1], corners[2]]];\n}\n\nexport function clipSurfaceBand(points: SurfaceBandPoint[], threshold: number, keepAbove: boolean, axis?: XlsxChartAxis | null, includeBoundary = true) {\n const result: SurfaceBandPoint[] = [];\n points.forEach((end, index) => {\n const start = points[(index + points.length - 1) % points.length];\n const startInside = keepAbove ? start.value >= threshold : start.value <= threshold;\n const endInside = keepAbove ? end.value >= threshold : end.value <= threshold;\n if (startInside !== endInside) {\n const startValue = scaleSurfaceValue(start.value, axis);\n const ratio = (scaleSurfaceValue(threshold, axis) - startValue) / (scaleSurfaceValue(end.value, axis) - startValue);\n result.push({ value: threshold, x: start.x + (end.x - start.x) * ratio, y: start.y + (end.y - start.y) * ratio });\n }\n if (endInside) {\n result.push(end);\n }\n });\n return !includeBoundary && result.every((point) => point.value === threshold) ? [] : result;\n}\n\nexport function surfaceBandEdges(polygon: SurfaceBandPoint[], triangle: [SurfaceBandPoint, SurfaceBandPoint, SurfaceBandPoint]) {\n const start = triangle[2];\n const end = triangle[0];\n const dx = end.x - start.x;\n const dy = end.y - start.y;\n const tolerance = 1e-9 * Math.max(1, dx * dx + dy * dy);\n const onDiagonal = (point: SurfaceBandPoint) => Math.abs((point.x - start.x) * dy - (point.y - start.y) * dx) <= tolerance;\n return polygon.flatMap((from, index): Array<[SurfaceBandPoint, SurfaceBandPoint]> => {\n const to = polygon[(index + 1) % polygon.length];\n return (onDiagonal(from) && onDiagonal(to)) || (from.x === to.x && from.y === to.y)\n ? []\n : [[from, to]];\n });\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.15_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js
|
|
2
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
3
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.importMetaUrl = importMetaUrl;
|
|
8
|
+
//# sourceMappingURL=chunk-FO6MIHX4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/react-xlsx/react-xlsx/packages/react-xlsx/dist/chunk-FO6MIHX4.cjs","../../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.15_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":"AAAA;ACKA,IAAM,iBAAA,EAAmB,CAAA,EAAA,GACvB,OAAO,SAAA,IAAa,YAAA,EAChB,IAAI,GAAA,CAAI,CAAA,KAAA,EAAQ,UAAU,CAAA,CAAA;AAK8B;ADT4B;AACA;AACA;AACA","file":"/home/runner/work/react-xlsx/react-xlsx/packages/react-xlsx/dist/chunk-FO6MIHX4.cjs","sourcesContent":[null,"// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/use-chart-module.ts
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
function useChartModule(resource) {
|
|
4
|
+
const snapshot = React.useSyncExternalStore(resource.subscribe, resource.getSnapshot, resource.getServerSnapshot);
|
|
5
|
+
React.useEffect(() => {
|
|
6
|
+
void resource.load().catch(() => {
|
|
7
|
+
});
|
|
8
|
+
}, [resource]);
|
|
9
|
+
if (snapshot.error) throw snapshot.error;
|
|
10
|
+
return snapshot.module;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/chart-loader.ts
|
|
14
|
+
function createChartModule(importModule) {
|
|
15
|
+
const initialSnapshot = { module: null, error: null };
|
|
16
|
+
let snapshot = initialSnapshot;
|
|
17
|
+
let promise;
|
|
18
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
19
|
+
const publish = (next) => {
|
|
20
|
+
snapshot = next;
|
|
21
|
+
listeners.forEach((listener) => listener());
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
load: () => promise ??= importModule().then((module) => {
|
|
25
|
+
publish({ module, error: null });
|
|
26
|
+
return module;
|
|
27
|
+
}, (error) => {
|
|
28
|
+
publish({ module: null, error: error instanceof Error ? error : new Error("Unable to load chart module.") });
|
|
29
|
+
throw error;
|
|
30
|
+
}),
|
|
31
|
+
getSnapshot: () => snapshot,
|
|
32
|
+
getServerSnapshot: () => initialSnapshot,
|
|
33
|
+
subscribe: (listener) => {
|
|
34
|
+
listeners.add(listener);
|
|
35
|
+
return () => {
|
|
36
|
+
listeners.delete(listener);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
var chartRenderer = createChartModule(() => import("./chart-renderer-HQSQHDCB.js"));
|
|
42
|
+
var regionMapResources = createChartModule(() => import("./region-map-geography-YD54DI3H.js"));
|
|
43
|
+
var surfaceRenderer = createChartModule(() => import("./surface-regl-NWR5ZZ5D.js"));
|
|
44
|
+
function preloadChartRenderers(chartsBySheet) {
|
|
45
|
+
let hasCharts = false;
|
|
46
|
+
let hasMaps = false;
|
|
47
|
+
let hasSurfaces = false;
|
|
48
|
+
for (const charts of chartsBySheet) {
|
|
49
|
+
for (const chart of charts) {
|
|
50
|
+
hasCharts = true;
|
|
51
|
+
hasMaps ||= chart.chartType === "RegionMap";
|
|
52
|
+
hasSurfaces ||= chart.chartType === "Surface";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (hasCharts) void chartRenderer.load().catch(() => {
|
|
56
|
+
});
|
|
57
|
+
if (hasMaps) void regionMapResources.load().catch(() => {
|
|
58
|
+
});
|
|
59
|
+
if (hasSurfaces) void surfaceRenderer.load().catch(() => {
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
useChartModule,
|
|
65
|
+
chartRenderer,
|
|
66
|
+
regionMapResources,
|
|
67
|
+
surfaceRenderer,
|
|
68
|
+
preloadChartRenderers
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=chunk-OZLJPZUX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/use-chart-module.ts","../src/chart-loader.ts"],"sourcesContent":["import * as React from \"react\";\nimport type { ChartModule } from \"./chart-loader\";\n\nexport function useChartModule<T>(resource: ChartModule<T>) {\n const snapshot = React.useSyncExternalStore(resource.subscribe, resource.getSnapshot, resource.getServerSnapshot);\n React.useEffect(() => {\n void resource.load().catch(() => {});\n }, [resource]);\n if (snapshot.error) throw snapshot.error;\n return snapshot.module;\n}\n","import type { XlsxChart } from \"./types\";\n\ntype ModuleSnapshot<T> = { module: T | null; error: unknown };\n\nexport type ChartModule<T> = {\n load: () => Promise<T>;\n getSnapshot: () => ModuleSnapshot<T>;\n getServerSnapshot: () => ModuleSnapshot<T>;\n subscribe: (listener: () => void) => () => void;\n};\n\nfunction createChartModule<T>(importModule: () => Promise<T>): ChartModule<T> {\n const initialSnapshot: ModuleSnapshot<T> = { module: null, error: null };\n let snapshot = initialSnapshot;\n let promise: Promise<T> | undefined;\n const listeners = new Set<() => void>();\n const publish = (next: ModuleSnapshot<T>) => {\n snapshot = next;\n listeners.forEach((listener) => listener());\n };\n\n return {\n load: () => promise ??= importModule().then((module) => {\n publish({ module, error: null });\n return module;\n }, (error: unknown) => {\n publish({ module: null, error: error instanceof Error ? error : new Error(\"Unable to load chart module.\") });\n throw error;\n }),\n getSnapshot: () => snapshot,\n getServerSnapshot: () => initialSnapshot,\n subscribe: (listener) => {\n listeners.add(listener);\n return () => { listeners.delete(listener); };\n }\n };\n}\n\nexport const chartRenderer = createChartModule(() => import(\"./chart-renderer\"));\nexport const regionMapResources = createChartModule(() => import(\"./region-map-geography\"));\nexport const surfaceRenderer = createChartModule(() => import(\"./surface-regl\"));\n\nexport function preloadChartRenderers(chartsBySheet: readonly (readonly XlsxChart[])[]) {\n let hasCharts = false;\n let hasMaps = false;\n let hasSurfaces = false;\n for (const charts of chartsBySheet) {\n for (const chart of charts) {\n hasCharts = true;\n hasMaps ||= chart.chartType === \"RegionMap\";\n hasSurfaces ||= chart.chartType === \"Surface\";\n }\n }\n\n if (hasCharts) void chartRenderer.load().catch(() => {});\n if (hasMaps) void regionMapResources.load().catch(() => {});\n if (hasSurfaces) void surfaceRenderer.load().catch(() => {});\n}\n"],"mappings":";AAAA,YAAY,WAAW;AAGhB,SAAS,eAAkB,UAA0B;AAC1D,QAAM,WAAiB,2BAAqB,SAAS,WAAW,SAAS,aAAa,SAAS,iBAAiB;AAChH,EAAM,gBAAU,MAAM;AACpB,SAAK,SAAS,KAA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,EACF;AAEA,MAAI,UAAW,MAAK,cAAc,KAAK,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AACvD,MAAI,QAAS,MAAK,mBAAmB,KAAK,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AAC1D,MAAI,YAAa,MAAK,gBAAgB,KAAK,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AAC7D;","names":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/builtin-chart-styles.ts
|
|
2
|
+
function decodeSrgb(channel) {
|
|
3
|
+
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
4
|
+
}
|
|
5
|
+
function encodeSrgb(channel) {
|
|
6
|
+
return channel <= 31308e-7 ? channel * 12.92 : 1.055 * channel ** (1 / 2.4) - 0.055;
|
|
7
|
+
}
|
|
8
|
+
function quantizeLinear(channel) {
|
|
9
|
+
return Math.round(channel * 1e5) / 1e5;
|
|
10
|
+
}
|
|
11
|
+
function resolveBuiltinChartColor(color, colorsByIndex) {
|
|
12
|
+
if (!color) return void 0;
|
|
13
|
+
const hex = colorsByIndex[color.themeIndex]?.replace(/^#/, "");
|
|
14
|
+
if (!hex || !/^[\da-f]{6}$/i.test(hex)) return void 0;
|
|
15
|
+
if (color.transforms.length === 0) return `#${hex.toLowerCase()}`;
|
|
16
|
+
const channels = [0, 2, 4].map((offset) => Math.fround(quantizeLinear(decodeSrgb(Number.parseInt(hex.slice(offset, offset + 2), 16) / 255))));
|
|
17
|
+
for (const transform of color.transforms) {
|
|
18
|
+
const amount = Math.fround(Math.max(0, Math.min(1, transform.value)));
|
|
19
|
+
for (let index = 0; index < channels.length; index += 1) {
|
|
20
|
+
const channel = channels[index];
|
|
21
|
+
channels[index] = transform.type === "tint" ? Math.fround(Math.fround(1 - amount) + Math.fround(amount * channel)) : Math.fround(amount * channel);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return `#${channels.map((channel) => Math.round(encodeSrgb(quantizeLinear(channel)) * 255).toString(16).padStart(2, "0")).join("")}`;
|
|
25
|
+
}
|
|
26
|
+
var GRAYSCALE_TINTS = [88, 55, 78, 92, 70, 30];
|
|
27
|
+
var DARK_GRAYSCALE_TINTS = [5, 55, 78, 15, 70, 30];
|
|
28
|
+
function normalizeClassicStyle(styleId) {
|
|
29
|
+
if (styleId === void 0 || !Number.isInteger(styleId)) return void 0;
|
|
30
|
+
if (styleId >= 1 && styleId <= 48) return styleId;
|
|
31
|
+
if (styleId >= 101 && styleId <= 148) return styleId - 100;
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
function themeColor(themeIndex, tint) {
|
|
35
|
+
return {
|
|
36
|
+
themeIndex,
|
|
37
|
+
transforms: tint === void 0 ? [] : [{ type: "tint", value: tint / 100 }]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function appendBrightness(color, percent) {
|
|
41
|
+
if (percent > 0) color.transforms.push({ type: "tint", value: (100 - percent) / 100 });
|
|
42
|
+
if (percent < 0) color.transforms.push({ type: "shade", value: (100 + percent) / 100 });
|
|
43
|
+
return color;
|
|
44
|
+
}
|
|
45
|
+
function getBuiltinChartColor(styleId, index, count) {
|
|
46
|
+
const style = normalizeClassicStyle(styleId);
|
|
47
|
+
if (style === void 0 || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
const palette = style === 41 ? 9 : (style - 1) % 8 + 1;
|
|
51
|
+
const monochrome = palette >= 3 && palette <= 8;
|
|
52
|
+
const color = monochrome ? themeColor(palette + 1) : palette === 2 ? themeColor(4 + index % 6) : themeColor(1, (palette === 9 ? DARK_GRAYSCALE_TINTS : GRAYSCALE_TINTS)[index % 6]);
|
|
53
|
+
const numerator = 140 * (monochrome ? index + 1 : Math.floor(index / 6) + 1);
|
|
54
|
+
const denominator = monochrome ? count + 1 : Math.floor(count / 6) + 2;
|
|
55
|
+
const brightness = (Math.trunc(Math.fround(Math.fround(numerator) / Math.fround(denominator))) - 70) % 100;
|
|
56
|
+
return appendBrightness(color, brightness);
|
|
57
|
+
}
|
|
58
|
+
function getBuiltinChartSurfaceStyle(styleId) {
|
|
59
|
+
const style = normalizeClassicStyle(styleId);
|
|
60
|
+
if (style === void 0) return void 0;
|
|
61
|
+
let fill = null;
|
|
62
|
+
if (style === 33 || style === 34) fill = themeColor(1, 20);
|
|
63
|
+
if (style >= 35 && style <= 40) fill = themeColor(style - 31, (styleId ?? 0) >= 100 ? 20 : void 0);
|
|
64
|
+
if (style >= 41) fill = themeColor(1, 95);
|
|
65
|
+
return {
|
|
66
|
+
floor: { fill, line: style <= 40 ? themeColor(1, 75) : null },
|
|
67
|
+
wall: { fill, line: null },
|
|
68
|
+
majorGridline: themeColor(1, (styleId ?? 0) >= 100 ? 75 : void 0),
|
|
69
|
+
minorGridline: themeColor(1, style >= 41 ? 90 : 50)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function getBuiltinChartSurfaceLine(styleId, index, count) {
|
|
73
|
+
const style = normalizeClassicStyle(styleId);
|
|
74
|
+
if (style === void 0 || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {
|
|
75
|
+
return void 0;
|
|
76
|
+
}
|
|
77
|
+
if (style >= 9 && style <= 16) return themeColor(2);
|
|
78
|
+
if (styleId === 133) return themeColor(1, 92);
|
|
79
|
+
if (style === 33 || style >= 35 && style <= 40) {
|
|
80
|
+
return {
|
|
81
|
+
themeIndex: style === 33 ? 1 : style - 31,
|
|
82
|
+
transforms: [{ type: "shade", value: 0.5 }]
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
resolveBuiltinChartColor,
|
|
90
|
+
getBuiltinChartColor,
|
|
91
|
+
getBuiltinChartSurfaceStyle,
|
|
92
|
+
getBuiltinChartSurfaceLine
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=chunk-VWGKYABF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/builtin-chart-styles.ts"],"sourcesContent":["export type BuiltinChartColorTransform = {\n type: \"tint\" | \"shade\";\n value: number;\n};\n\nexport type BuiltinChartColor = {\n themeIndex: number;\n transforms: BuiltinChartColorTransform[];\n};\n\nexport type BuiltinChartSurfaceStyle = {\n floor: { fill: BuiltinChartColor | null; line: BuiltinChartColor | null };\n wall: { fill: BuiltinChartColor | null; line: BuiltinChartColor | null };\n majorGridline: BuiltinChartColor;\n minorGridline: BuiltinChartColor;\n};\n\nfunction decodeSrgb(channel: number) {\n return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;\n}\n\nfunction encodeSrgb(channel: number) {\n return channel <= 0.0031308 ? channel * 12.92 : 1.055 * channel ** (1 / 2.4) - 0.055;\n}\n\nfunction quantizeLinear(channel: number) {\n return Math.round(channel * 100000) / 100000;\n}\n\n/** DrawingML tint and shade operate on linear RGB and retain the given fraction. */\nexport function resolveBuiltinChartColor(\n color: BuiltinChartColor | null | undefined,\n colorsByIndex: Readonly<Record<number, string | null | undefined>>\n): string | undefined {\n if (!color) return undefined;\n const hex = colorsByIndex[color.themeIndex]?.replace(/^#/, \"\");\n if (!hex || !/^[\\da-f]{6}$/i.test(hex)) return undefined;\n if (color.transforms.length === 0) return `#${hex.toLowerCase()}`;\n\n const channels = [0, 2, 4].map((offset) => Math.fround(quantizeLinear(decodeSrgb(Number.parseInt(hex.slice(offset, offset + 2), 16) / 255))));\n for (const transform of color.transforms) {\n const amount = Math.fround(Math.max(0, Math.min(1, transform.value)));\n for (let index = 0; index < channels.length; index += 1) {\n const channel = channels[index]!;\n channels[index] = transform.type === \"tint\"\n ? Math.fround(Math.fround(1 - amount) + Math.fround(amount * channel))\n : Math.fround(amount * channel);\n }\n }\n return `#${channels.map((channel) => Math.round(encodeSrgb(quantizeLinear(channel)) * 255).toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\nconst GRAYSCALE_TINTS = [88, 55, 78, 92, 70, 30];\nconst DARK_GRAYSCALE_TINTS = [5, 55, 78, 15, 70, 30];\n\nfunction normalizeClassicStyle(styleId: number | undefined) {\n if (styleId === undefined || !Number.isInteger(styleId)) return undefined;\n if (styleId >= 1 && styleId <= 48) return styleId;\n if (styleId >= 101 && styleId <= 148) return styleId - 100;\n return undefined;\n}\n\nfunction themeColor(themeIndex: number, tint?: number): BuiltinChartColor {\n return {\n themeIndex,\n transforms: tint === undefined ? [] : [{ type: \"tint\", value: tint / 100 }]\n };\n}\n\nfunction appendBrightness(color: BuiltinChartColor, percent: number) {\n if (percent > 0) color.transforms.push({ type: \"tint\", value: (100 - percent) / 100 });\n if (percent < 0) color.transforms.push({ type: \"shade\", value: (100 + percent) / 100 });\n return color;\n}\n\n/** Returns defaults only; explicit colors and custom color styles take precedence. */\nexport function getBuiltinChartColor(\n styleId: number | undefined,\n index: number,\n count: number\n): BuiltinChartColor | undefined {\n const style = normalizeClassicStyle(styleId);\n if (style === undefined || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {\n return undefined;\n }\n\n const palette = style === 41 ? 9 : ((style - 1) % 8) + 1;\n const monochrome = palette >= 3 && palette <= 8;\n const color = monochrome\n ? themeColor(palette + 1)\n : palette === 2\n ? themeColor(4 + (index % 6))\n : themeColor(1, (palette === 9 ? DARK_GRAYSCALE_TINTS : GRAYSCALE_TINTS)[index % 6]);\n\n const numerator = 140 * (monochrome ? index + 1 : Math.floor(index / 6) + 1);\n const denominator = monochrome ? count + 1 : Math.floor(count / 6) + 2;\n const brightness = (Math.trunc(Math.fround(Math.fround(numerator) / Math.fround(denominator))) - 70) % 100;\n return appendBrightness(color, brightness);\n}\n\nexport function getBuiltinChartSurfaceStyle(styleId: number | undefined): BuiltinChartSurfaceStyle | undefined {\n const style = normalizeClassicStyle(styleId);\n if (style === undefined) return undefined;\n\n let fill: BuiltinChartColor | null = null;\n if (style === 33 || style === 34) fill = themeColor(1, 20);\n if (style >= 35 && style <= 40) fill = themeColor(style - 31, (styleId ?? 0) >= 100 ? 20 : undefined);\n if (style >= 41) fill = themeColor(1, 95);\n\n return {\n floor: { fill, line: style <= 40 ? themeColor(1, 75) : null },\n wall: { fill, line: null },\n majorGridline: themeColor(1, (styleId ?? 0) >= 100 ? 75 : undefined),\n minorGridline: themeColor(1, style >= 41 ? 90 : 50)\n };\n}\n\nexport function getBuiltinChartSurfaceLine(\n styleId: number | undefined,\n index: number,\n count: number\n): BuiltinChartColor | undefined {\n const style = normalizeClassicStyle(styleId);\n if (style === undefined || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {\n return undefined;\n }\n if (style >= 9 && style <= 16) return themeColor(2);\n if (styleId === 133) return themeColor(1, 92);\n if (style === 33 || (style >= 35 && style <= 40)) {\n return {\n themeIndex: style === 33 ? 1 : style - 31,\n transforms: [{ type: \"shade\", value: 0.5 }]\n };\n }\n return undefined;\n}\n"],"mappings":";AAiBA,SAAS,WAAW,SAAiB;AACnC,SAAO,WAAW,UAAU,UAAU,UAAU,UAAU,SAAS,UAAU;AAC/E;AAEA,SAAS,WAAW,SAAiB;AACnC,SAAO,WAAW,WAAY,UAAU,QAAQ,QAAQ,YAAY,IAAI,OAAO;AACjF;AAEA,SAAS,eAAe,SAAiB;AACvC,SAAO,KAAK,MAAM,UAAU,GAAM,IAAI;AACxC;AAGO,SAAS,yBACd,OACA,eACoB;AACpB,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,MAAM,cAAc,MAAM,UAAU,GAAG,QAAQ,MAAM,EAAE;AAC7D,MAAI,CAAC,OAAO,CAAC,gBAAgB,KAAK,GAAG,EAAG,QAAO;AAC/C,MAAI,MAAM,WAAW,WAAW,EAAG,QAAO,IAAI,IAAI,YAAY,CAAC;AAE/D,QAAM,WAAW,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,CAAC,WAAW,KAAK,OAAO,eAAe,WAAW,OAAO,SA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