ooxml-core 0.20.0 → 0.21.0

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.
Files changed (40) hide show
  1. package/README.md +21 -43
  2. package/dist/chart/axis-nice.d.ts +97 -0
  3. package/dist/chart/axis-nice.d.ts.map +1 -0
  4. package/dist/chart/histogram-binning.d.ts +40 -0
  5. package/dist/chart/histogram-binning.d.ts.map +1 -0
  6. package/dist/chart/index.cjs +167 -0
  7. package/dist/chart/index.d.ts +2 -0
  8. package/dist/chart/index.d.ts.map +1 -1
  9. package/dist/chart/index.mjs +162 -1
  10. package/dist/index.cjs +167 -0
  11. package/dist/index.mjs +167 -0
  12. package/dist/pptx/automation/index.cjs +1572 -863
  13. package/dist/pptx/automation/index.d.ts +4 -3
  14. package/dist/pptx/automation/index.d.ts.map +1 -1
  15. package/dist/pptx/automation/index.mjs +1572 -863
  16. package/dist/pptx/chunks/color-ref-BM66NGFP.d.ts +42 -0
  17. package/dist/pptx/chunks/color-ref-BM66NGFP.d.ts.map +1 -0
  18. package/dist/pptx/chunks/{index-D0yGoLyw.d.ts → index-CcQTCBnT.d.ts} +63 -479
  19. package/dist/pptx/chunks/index-CcQTCBnT.d.ts.map +1 -0
  20. package/dist/pptx/chunks/{index-BtBj3VG1.d.ts → index-DHoPgFcH.d.ts} +529 -11
  21. package/dist/pptx/chunks/index-DHoPgFcH.d.ts.map +1 -0
  22. package/dist/pptx/chunks/{text-operations-GuisjlbR.d.ts → text-operations-BzdehTeY.d.ts} +50 -51
  23. package/dist/pptx/chunks/text-operations-BzdehTeY.d.ts.map +1 -0
  24. package/dist/pptx/cli/index.cjs +1204 -489
  25. package/dist/pptx/cli/index.d.ts +1 -1
  26. package/dist/pptx/cli/index.mjs +1204 -489
  27. package/dist/pptx/converter/index.cjs +8 -5
  28. package/dist/pptx/converter/index.d.ts +1 -1
  29. package/dist/pptx/converter/index.mjs +8 -5
  30. package/dist/pptx/index.cjs +1699 -989
  31. package/dist/pptx/index.d.ts +5 -4
  32. package/dist/pptx/index.mjs +1698 -990
  33. package/dist/pptx/ui/index.cjs +510 -0
  34. package/dist/pptx/ui/index.d.ts +80 -0
  35. package/dist/pptx/ui/index.d.ts.map +1 -0
  36. package/dist/pptx/ui/index.mjs +499 -0
  37. package/package.json +15 -4
  38. package/dist/pptx/chunks/index-BtBj3VG1.d.ts.map +0 -1
  39. package/dist/pptx/chunks/index-D0yGoLyw.d.ts.map +0 -1
  40. package/dist/pptx/chunks/text-operations-GuisjlbR.d.ts.map +0 -1
@@ -1904,10 +1904,11 @@ var init_units = __esm({
1904
1904
  });
1905
1905
 
1906
1906
  // src/units/constants.ts
1907
- var EMU_PER_PIXEL;
1907
+ var EMU_PER_PIXEL, EMU_PER_POINT;
1908
1908
  var init_constants = __esm({
1909
1909
  "src/units/constants.ts"() {
1910
1910
  EMU_PER_PIXEL = 9525;
1911
+ EMU_PER_POINT = 12700;
1911
1912
  }
1912
1913
  });
1913
1914
 
@@ -2982,6 +2983,829 @@ var init_chart_gradient_input = __esm({
2982
2983
  }
2983
2984
  });
2984
2985
 
2986
+ // src/pptx/core/utils/chart-container-content-model.ts
2987
+ function chartTypeToContainerLocalName(chartType) {
2988
+ return TYPE_TO_CONTAINER[chartType];
2989
+ }
2990
+ function isKnownChartContainer(containerLocal) {
2991
+ return containerLocal in CHART_CONTAINER_CHILD_ORDER;
2992
+ }
2993
+ function chartContainerAllows(containerLocal, childLocal) {
2994
+ const order = CHART_CONTAINER_CHILD_ORDER[containerLocal];
2995
+ return order !== void 0 && order.includes(childLocal);
2996
+ }
2997
+ var CHART_CONTAINER_CHILD_ORDER, REQUIRED_LEADING_CHILD, TYPE_TO_CONTAINER, AXIS_LOCAL_NAMES;
2998
+ var init_chart_container_content_model = __esm({
2999
+ "src/pptx/core/utils/chart-container-content-model.ts"() {
3000
+ CHART_CONTAINER_CHILD_ORDER = {
3001
+ areaChart: ["grouping", "varyColors", "ser", "dLbls", "dropLines", "axId", "extLst"],
3002
+ area3DChart: [
3003
+ "grouping",
3004
+ "varyColors",
3005
+ "ser",
3006
+ "dLbls",
3007
+ "dropLines",
3008
+ "gapDepth",
3009
+ "axId",
3010
+ "extLst"
3011
+ ],
3012
+ barChart: [
3013
+ "barDir",
3014
+ "grouping",
3015
+ "varyColors",
3016
+ "ser",
3017
+ "dLbls",
3018
+ "gapWidth",
3019
+ "overlap",
3020
+ "serLines",
3021
+ "axId",
3022
+ "extLst"
3023
+ ],
3024
+ bar3DChart: [
3025
+ "barDir",
3026
+ "grouping",
3027
+ "varyColors",
3028
+ "ser",
3029
+ "dLbls",
3030
+ "gapWidth",
3031
+ "gapDepth",
3032
+ "shape",
3033
+ "axId",
3034
+ "extLst"
3035
+ ],
3036
+ bubbleChart: [
3037
+ "varyColors",
3038
+ "ser",
3039
+ "dLbls",
3040
+ "bubble3D",
3041
+ "bubbleScale",
3042
+ "showNegBubbles",
3043
+ "sizeRepresents",
3044
+ "axId",
3045
+ "extLst"
3046
+ ],
3047
+ doughnutChart: ["varyColors", "ser", "dLbls", "firstSliceAng", "holeSize", "extLst"],
3048
+ lineChart: [
3049
+ "grouping",
3050
+ "varyColors",
3051
+ "ser",
3052
+ "dLbls",
3053
+ "dropLines",
3054
+ "hiLowLines",
3055
+ "upDownBars",
3056
+ "marker",
3057
+ "smooth",
3058
+ "axId",
3059
+ "extLst"
3060
+ ],
3061
+ line3DChart: [
3062
+ "grouping",
3063
+ "varyColors",
3064
+ "ser",
3065
+ "dLbls",
3066
+ "dropLines",
3067
+ "gapDepth",
3068
+ "axId",
3069
+ "extLst"
3070
+ ],
3071
+ ofPieChart: [
3072
+ "ofPieType",
3073
+ "varyColors",
3074
+ "ser",
3075
+ "dLbls",
3076
+ "gapWidth",
3077
+ "splitType",
3078
+ "splitPos",
3079
+ "custSplit",
3080
+ "secondPieSize",
3081
+ "serLines",
3082
+ "extLst"
3083
+ ],
3084
+ pieChart: ["varyColors", "ser", "dLbls", "firstSliceAng", "extLst"],
3085
+ pie3DChart: ["varyColors", "ser", "dLbls", "extLst"],
3086
+ radarChart: ["radarStyle", "varyColors", "ser", "dLbls", "axId", "extLst"],
3087
+ scatterChart: ["scatterStyle", "varyColors", "ser", "dLbls", "axId", "extLst"],
3088
+ stockChart: ["ser", "dLbls", "dropLines", "hiLowLines", "upDownBars", "axId", "extLst"],
3089
+ surfaceChart: ["wireframe", "ser", "bandFmts", "axId", "extLst"],
3090
+ surface3DChart: ["wireframe", "ser", "bandFmts", "axId", "extLst"]
3091
+ };
3092
+ REQUIRED_LEADING_CHILD = {
3093
+ barChart: { local: "barDir", val: "col" },
3094
+ bar3DChart: { local: "barDir", val: "col" },
3095
+ lineChart: { local: "grouping", val: "standard" },
3096
+ line3DChart: { local: "grouping", val: "standard" },
3097
+ ofPieChart: { local: "ofPieType", val: "pie" },
3098
+ radarChart: { local: "radarStyle", val: "marker" },
3099
+ scatterChart: { local: "scatterStyle", val: "lineMarker" }
3100
+ };
3101
+ TYPE_TO_CONTAINER = {
3102
+ area: "areaChart",
3103
+ area3D: "area3DChart",
3104
+ bar: "barChart",
3105
+ bar3D: "bar3DChart",
3106
+ bubble: "bubbleChart",
3107
+ doughnut: "doughnutChart",
3108
+ line: "lineChart",
3109
+ line3D: "line3DChart",
3110
+ ofPie: "ofPieChart",
3111
+ pie: "pieChart",
3112
+ pie3D: "pie3DChart",
3113
+ radar: "radarChart",
3114
+ scatter: "scatterChart",
3115
+ stock: "stockChart",
3116
+ surface: "surfaceChart"
3117
+ };
3118
+ AXIS_LOCAL_NAMES = ["catAx", "valAx", "dateAx", "serAx"];
3119
+ }
3120
+ });
3121
+
3122
+ // src/pptx/core/utils/chart-container-schema.ts
3123
+ function normalizeChartGroupingValue(containerLocal, value) {
3124
+ const isBar = containerLocal === "barChart" || containerLocal === "bar3DChart";
3125
+ return !isBar && value === "clustered" ? "standard" : value;
3126
+ }
3127
+ function normalizeGroupingNode(containerLocal, node) {
3128
+ const value = node["@_val"];
3129
+ if (value !== void 0) {
3130
+ node["@_val"] = normalizeChartGroupingValue(containerLocal, value);
3131
+ }
3132
+ }
3133
+ function normalizeChartContainerChildren(container2, containerLocal, getLocalName2) {
3134
+ if (!isKnownChartContainer(containerLocal)) {
3135
+ return;
3136
+ }
3137
+ for (const key2 of Object.keys(container2)) {
3138
+ if (key2.startsWith("@_") || key2 === "#text") {
3139
+ continue;
3140
+ }
3141
+ const local = getLocalName2(key2);
3142
+ if (!chartContainerAllows(containerLocal, local)) {
3143
+ delete container2[key2];
3144
+ continue;
3145
+ }
3146
+ if (local === "grouping") {
3147
+ const node = container2[key2];
3148
+ if (node && typeof node === "object" && !Array.isArray(node)) {
3149
+ normalizeGroupingNode(containerLocal, node);
3150
+ }
3151
+ }
3152
+ }
3153
+ const required = REQUIRED_LEADING_CHILD[containerLocal];
3154
+ if (required) {
3155
+ const present = Object.keys(container2).some((k) => getLocalName2(k) === required.local);
3156
+ if (!present) {
3157
+ container2[`c:${required.local}`] = { "@_val": required.val };
3158
+ }
3159
+ }
3160
+ }
3161
+ function orderChartContainerChildren(container2, containerLocal, getLocalName2) {
3162
+ const order = CHART_CONTAINER_CHILD_ORDER[containerLocal];
3163
+ if (!order) {
3164
+ return;
3165
+ }
3166
+ const keys = Object.keys(container2).filter((k) => !k.startsWith("@_") && k !== "#text");
3167
+ if (keys.some((k) => !order.includes(getLocalName2(k)))) {
3168
+ return;
3169
+ }
3170
+ const sorted = [...keys].sort(
3171
+ (a, b) => order.indexOf(getLocalName2(a)) - order.indexOf(getLocalName2(b))
3172
+ );
3173
+ if (sorted.every((k, i) => k === keys[i])) {
3174
+ return;
3175
+ }
3176
+ const saved = sorted.map((k) => [k, container2[k]]);
3177
+ for (const k of keys) {
3178
+ delete container2[k];
3179
+ }
3180
+ for (const [k, v] of saved) {
3181
+ container2[k] = v;
3182
+ }
3183
+ }
3184
+ function renameXmlKeyInPlace(obj, oldKey, newKey) {
3185
+ if (oldKey === newKey || !(oldKey in obj)) {
3186
+ return;
3187
+ }
3188
+ const entries = Object.keys(obj).map((k) => [k === oldKey ? newKey : k, obj[k]]);
3189
+ for (const k of Object.keys(obj)) {
3190
+ delete obj[k];
3191
+ }
3192
+ for (const [k, v] of entries) {
3193
+ obj[k] = v;
3194
+ }
3195
+ }
3196
+ function referencedAxisIds(plotArea, getLocalName2) {
3197
+ const ids = /* @__PURE__ */ new Set();
3198
+ for (const key2 of Object.keys(plotArea)) {
3199
+ if (!getLocalName2(key2).endsWith("Chart")) {
3200
+ continue;
3201
+ }
3202
+ for (const container2 of toArray(plotArea[key2])) {
3203
+ for (const childKey3 of Object.keys(container2)) {
3204
+ if (getLocalName2(childKey3) !== "axId") {
3205
+ continue;
3206
+ }
3207
+ for (const axId of toArray(container2[childKey3])) {
3208
+ const val = axId["@_val"];
3209
+ if (val !== void 0) {
3210
+ ids.add(String(val));
3211
+ }
3212
+ }
3213
+ }
3214
+ }
3215
+ }
3216
+ return ids;
3217
+ }
3218
+ function toArray(value) {
3219
+ if (Array.isArray(value)) {
3220
+ return value.filter((v) => typeof v === "object" && v !== null);
3221
+ }
3222
+ return typeof value === "object" && value !== null ? [value] : [];
3223
+ }
3224
+ function reconcileChartPlotAreaAxes(plotArea, getLocalName2) {
3225
+ const referenced = referencedAxisIds(plotArea, getLocalName2);
3226
+ let removed = 0;
3227
+ for (const key2 of Object.keys(plotArea)) {
3228
+ const local = getLocalName2(key2);
3229
+ if (!AXIS_LOCAL_NAMES.includes(local)) {
3230
+ continue;
3231
+ }
3232
+ const axes = toArray(plotArea[key2]);
3233
+ const kept = axes.filter((axis) => {
3234
+ const axIdKey = Object.keys(axis).find((k) => getLocalName2(k) === "axId");
3235
+ const val = axIdKey ? toArray(axis[axIdKey])[0]?.["@_val"] : void 0;
3236
+ return val !== void 0 && referenced.has(String(val));
3237
+ });
3238
+ removed += axes.length - kept.length;
3239
+ if (kept.length === 0) {
3240
+ delete plotArea[key2];
3241
+ } else if (kept.length !== axes.length) {
3242
+ plotArea[key2] = kept.length === 1 ? kept[0] : kept;
3243
+ }
3244
+ }
3245
+ return removed;
3246
+ }
3247
+ var init_chart_container_schema = __esm({
3248
+ "src/pptx/core/utils/chart-container-schema.ts"() {
3249
+ init_chart_container_content_model();
3250
+ init_chart_container_content_model();
3251
+ }
3252
+ });
3253
+
3254
+ // src/pptx/core/utils/chart-group-options.ts
3255
+ function chartGroupOptionVal(spec, value) {
3256
+ return String(Math.min(spec.max, Math.max(spec.min, Math.round(value))));
3257
+ }
3258
+ function localNameOf2(key2) {
3259
+ return key2.replace(/^.*:/u, "");
3260
+ }
3261
+ function findKey3(obj, local, getLocalName2) {
3262
+ return Object.keys(obj).find((key2) => getLocalName2(key2) === local);
3263
+ }
3264
+ function modelValue(chartData, spec) {
3265
+ if (spec.element === "gapWidth" && chartData.chartType === "ofPie") {
3266
+ return chartData.ofPieOptions?.gapWidth ?? chartData.barGapWidth;
3267
+ }
3268
+ const value = chartData[spec.field];
3269
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
3270
+ }
3271
+ function applyGeneratedChartGroupOptions(container2, containerLocal, chartData) {
3272
+ for (const spec of CHART_GROUP_OPTIONS) {
3273
+ if (!chartContainerAllows(containerLocal, spec.element)) {
3274
+ continue;
3275
+ }
3276
+ const value = modelValue(chartData, spec) ?? spec.generatedDefault;
3277
+ if (value !== void 0) {
3278
+ container2[`c:${spec.element}`] = { "@_val": chartGroupOptionVal(spec, value) };
3279
+ }
3280
+ }
3281
+ orderChartContainerChildren(container2, containerLocal, localNameOf2);
3282
+ }
3283
+ function authoredValue(node) {
3284
+ if (!node || typeof node !== "object") {
3285
+ return void 0;
3286
+ }
3287
+ const raw = node["@_val"];
3288
+ const num4 = raw === void 0 || raw === null || raw === "" ? NaN : Number.parseFloat(String(raw));
3289
+ return Number.isFinite(num4) ? num4 : void 0;
3290
+ }
3291
+ function applyChartGroupOptionsToXml(container2, containerLocal, chartData, getLocalName2) {
3292
+ let changed = false;
3293
+ for (const spec of CHART_GROUP_OPTIONS) {
3294
+ if (!chartContainerAllows(containerLocal, spec.element)) {
3295
+ continue;
3296
+ }
3297
+ if (spec.element === "gapWidth" && containerLocal === "ofPieChart") {
3298
+ continue;
3299
+ }
3300
+ const key2 = findKey3(container2, spec.element, getLocalName2);
3301
+ const authored = key2 ? authoredValue(container2[key2]) : void 0;
3302
+ const value = chartData[spec.field];
3303
+ if (value === void 0) {
3304
+ if (key2 && authored !== void 0) {
3305
+ delete container2[key2];
3306
+ changed = true;
3307
+ }
3308
+ continue;
3309
+ }
3310
+ if (authored === value) {
3311
+ continue;
3312
+ }
3313
+ container2[key2 ?? `c:${spec.element}`] = { "@_val": chartGroupOptionVal(spec, value) };
3314
+ changed = true;
3315
+ }
3316
+ return changed;
3317
+ }
3318
+ var CHART_GROUP_OPTIONS;
3319
+ var init_chart_group_options = __esm({
3320
+ "src/pptx/core/utils/chart-group-options.ts"() {
3321
+ init_chart_container_content_model();
3322
+ init_chart_container_schema();
3323
+ CHART_GROUP_OPTIONS = [
3324
+ {
3325
+ element: "gapWidth",
3326
+ field: "barGapWidth",
3327
+ schemaType: "ST_GapAmount",
3328
+ min: 0,
3329
+ max: 500,
3330
+ generatedDefault: 150
3331
+ },
3332
+ { element: "overlap", field: "barOverlap", schemaType: "ST_Overlap", min: -100, max: 100 },
3333
+ {
3334
+ element: "firstSliceAng",
3335
+ field: "firstSliceAngle",
3336
+ schemaType: "ST_FirstSliceAng",
3337
+ min: 0,
3338
+ max: 360
3339
+ },
3340
+ {
3341
+ element: "holeSize",
3342
+ field: "doughnutHoleSize",
3343
+ schemaType: "ST_HoleSize",
3344
+ min: 1,
3345
+ max: 90,
3346
+ generatedDefault: 50
3347
+ }
3348
+ ];
3349
+ }
3350
+ });
3351
+
3352
+ // src/pptx/core/builders/sdk/chart-layout-input.ts
3353
+ function allowedTypes(element) {
3354
+ return CLASSIC_TYPES.filter((type) => {
3355
+ const local = chartTypeToContainerLocalName(type);
3356
+ return local !== void 0 && chartContainerAllows(local, element);
3357
+ });
3358
+ }
3359
+ function drawnTypes(chartData) {
3360
+ if (chartData.chartType !== "combo") {
3361
+ return [chartData.chartType];
3362
+ }
3363
+ return chartData.series.map((s) => s.seriesChartType ?? chartData.chartType);
3364
+ }
3365
+ function validateValue(spec, name, value) {
3366
+ if (!Number.isInteger(value) || value < spec.min || value > spec.max) {
3367
+ throw new RangeError(
3368
+ `${name} must be an integer from ${spec.min} to ${spec.max} (${spec.schemaType}), got ${value}.`
3369
+ );
3370
+ }
3371
+ }
3372
+ function applyChartGroupOptionsInput(chartData, input) {
3373
+ for (const spec of CHART_GROUP_OPTIONS) {
3374
+ const name = INPUT_KEYS[spec.element];
3375
+ const value = input[name];
3376
+ if (value === void 0) {
3377
+ continue;
3378
+ }
3379
+ if (value === null) {
3380
+ delete chartData[spec.field];
3381
+ continue;
3382
+ }
3383
+ validateValue(spec, name, value);
3384
+ const types = drawnTypes(chartData);
3385
+ const allowed = allowedTypes(spec.element);
3386
+ if (!types.some((type) => allowed.includes(type))) {
3387
+ throw new Error(
3388
+ `${name} applies to ${allowed.join(", ")} charts; this chart is drawn as "${types.join('", "')}".`
3389
+ );
3390
+ }
3391
+ chartData[spec.field] = value;
3392
+ if (spec.element === "gapWidth" && chartData.ofPieOptions) {
3393
+ chartData.ofPieOptions.gapWidth = value;
3394
+ }
3395
+ }
3396
+ }
3397
+ function toPaint(value, name) {
3398
+ const trimmed = value.trim();
3399
+ if (trimmed === "none") {
3400
+ return "none";
3401
+ }
3402
+ if (!HEX_COLOR2.test(trimmed)) {
3403
+ throw new Error(`${name} must be a 6-digit hex colour or 'none', got "${value}".`);
3404
+ }
3405
+ return `#${trimmed.replace(/^#/u, "").toUpperCase()}`;
3406
+ }
3407
+ function applyChartAreaFormatInput(chartData, area, input) {
3408
+ const style = chartData.style ??= {};
3409
+ const fillKey = area === "chart" ? "chartAreaFill" : "plotAreaFill";
3410
+ const gradientKey = area === "chart" ? "chartAreaGradient" : "plotAreaGradient";
3411
+ const borderKey = area === "chart" ? "chartAreaBorder" : "plotAreaBorder";
3412
+ if (input === null) {
3413
+ delete style[fillKey];
3414
+ delete style[gradientKey];
3415
+ delete style[borderKey];
3416
+ if (area === "chart") {
3417
+ delete chartData.roundedCorners;
3418
+ }
3419
+ return;
3420
+ }
3421
+ if (input.roundedCorners !== void 0 && area !== "chart") {
3422
+ throw new Error("roundedCorners applies to the chart area only.");
3423
+ }
3424
+ if (input.fill !== void 0) {
3425
+ delete style[fillKey];
3426
+ delete style[gradientKey];
3427
+ if (typeof input.fill === "string") {
3428
+ style[fillKey] = toPaint(input.fill, "fill");
3429
+ } else if (input.fill !== null) {
3430
+ style[gradientKey] = toChartGradientFill(input.fill);
3431
+ }
3432
+ }
3433
+ if (input.border !== void 0) {
3434
+ if (input.border === null) {
3435
+ delete style[borderKey];
3436
+ } else {
3437
+ style[borderKey] = toPaint(input.border, "border");
3438
+ }
3439
+ }
3440
+ if (input.roundedCorners !== void 0) {
3441
+ if (input.roundedCorners === null) {
3442
+ delete chartData.roundedCorners;
3443
+ } else {
3444
+ chartData.roundedCorners = input.roundedCorners;
3445
+ }
3446
+ }
3447
+ }
3448
+ var INPUT_KEYS, CLASSIC_TYPES, HEX_COLOR2;
3449
+ var init_chart_layout_input = __esm({
3450
+ "src/pptx/core/builders/sdk/chart-layout-input.ts"() {
3451
+ init_chart_group_options();
3452
+ init_chart_container_content_model();
3453
+ init_chart_gradient_input();
3454
+ INPUT_KEYS = {
3455
+ gapWidth: "gapWidth",
3456
+ overlap: "overlap",
3457
+ firstSliceAng: "firstSliceAngle",
3458
+ holeSize: "holeSize"
3459
+ };
3460
+ CLASSIC_TYPES = [
3461
+ "bar",
3462
+ "bar3D",
3463
+ "line",
3464
+ "line3D",
3465
+ "pie",
3466
+ "pie3D",
3467
+ "ofPie",
3468
+ "doughnut",
3469
+ "area",
3470
+ "area3D",
3471
+ "scatter",
3472
+ "bubble",
3473
+ "radar",
3474
+ "stock",
3475
+ "surface"
3476
+ ];
3477
+ HEX_COLOR2 = /^#?[0-9a-f]{6}$/iu;
3478
+ }
3479
+ });
3480
+
3481
+ // src/pptx/core/builders/sdk/chart-operations.ts
3482
+ function ensureChartData(element) {
3483
+ if (!element.chartData) {
3484
+ throw new Error(
3485
+ "Chart element has no chartData. Cannot perform chart operations on an uninitialised chart."
3486
+ );
3487
+ }
3488
+ }
3489
+ function validateSeriesIndex(element, seriesIndex) {
3490
+ ensureChartData(element);
3491
+ if (seriesIndex < 0 || seriesIndex >= element.chartData.series.length) {
3492
+ throw new RangeError(
3493
+ `Series index ${seriesIndex} is out of range. Chart has ${element.chartData.series.length} series (indices 0\u2013${element.chartData.series.length - 1}).`
3494
+ );
3495
+ }
3496
+ }
3497
+ function setChartType(element, newType) {
3498
+ ensureChartData(element);
3499
+ element.chartData.chartType = newType;
3500
+ }
3501
+ function addChartSeries(element, series) {
3502
+ ensureChartData(element);
3503
+ element.chartData.series.push({
3504
+ name: series.name,
3505
+ values: series.values,
3506
+ color: series.color
3507
+ });
3508
+ }
3509
+ function removeChartSeries(element, seriesIndex) {
3510
+ validateSeriesIndex(element, seriesIndex);
3511
+ element.chartData.series.splice(seriesIndex, 1);
3512
+ }
3513
+ function setChartCategories(element, categories) {
3514
+ ensureChartData(element);
3515
+ element.chartData.categories = categories;
3516
+ }
3517
+ function updateChartSeriesValues(element, seriesIndex, values) {
3518
+ validateSeriesIndex(element, seriesIndex);
3519
+ element.chartData.series[seriesIndex].values = values;
3520
+ }
3521
+ function setChartTitle(element, title) {
3522
+ ensureChartData(element);
3523
+ element.chartData.title = title;
3524
+ }
3525
+ function setChartGrouping(element, grouping) {
3526
+ ensureChartData(element);
3527
+ element.chartData.grouping = grouping;
3528
+ }
3529
+ function setChartLegend(element, options) {
3530
+ ensureChartData(element);
3531
+ const style = element.chartData.style ??= {};
3532
+ if (options.show !== void 0) {
3533
+ style.hasLegend = options.show;
3534
+ }
3535
+ if (options.position !== void 0) {
3536
+ style.legendPosition = options.position;
3537
+ if (style.hasLegend === void 0) {
3538
+ style.hasLegend = true;
3539
+ }
3540
+ }
3541
+ }
3542
+ function setChartDataLabels(element, edit) {
3543
+ ensureChartData(element);
3544
+ const style = element.chartData.style ??= {};
3545
+ if (edit.show !== void 0) {
3546
+ style.hasDataLabels = edit.show;
3547
+ const labels = style.dataLabels;
3548
+ const anyContent = labels?.showValue === true || labels?.showCategory === true || labels?.showSeriesName === true || labels?.showPercent === true || labels?.showBubbleSize === true;
3549
+ if (edit.show && labels !== void 0 && !anyContent && edit.showValue === void 0) {
3550
+ labels.showValue = true;
3551
+ }
3552
+ }
3553
+ const contentKeys = [
3554
+ "showValue",
3555
+ "showCategory",
3556
+ "showSeriesName",
3557
+ "showPercent",
3558
+ "showLegendKey"
3559
+ ];
3560
+ const hasContentEdit = contentKeys.some((k) => edit[k] !== void 0) || edit.position !== void 0;
3561
+ if (hasContentEdit) {
3562
+ const opts = style.dataLabels ??= {};
3563
+ for (const k of contentKeys) {
3564
+ if (edit[k] !== void 0) {
3565
+ opts[k] = edit[k];
3566
+ }
3567
+ }
3568
+ if (edit.position !== void 0) {
3569
+ opts.position = edit.position || void 0;
3570
+ }
3571
+ if (style.hasDataLabels === void 0) {
3572
+ style.hasDataLabels = true;
3573
+ }
3574
+ }
3575
+ }
3576
+ function setChartSeriesTrendline(element, seriesIndex, trendline) {
3577
+ validateSeriesIndex(element, seriesIndex);
3578
+ element.chartData.series[seriesIndex].trendlines = trendline ? [trendline] : [];
3579
+ }
3580
+ function setChartSeriesErrorBars(element, seriesIndex, errBars) {
3581
+ validateSeriesIndex(element, seriesIndex);
3582
+ element.chartData.series[seriesIndex].errBars = errBars ? [errBars] : [];
3583
+ }
3584
+ function setChartAxis(element, axisType, edit) {
3585
+ ensureChartData(element);
3586
+ const axes = element.chartData.axes ??= [];
3587
+ let axis = axes.find((a) => a.axisType === axisType);
3588
+ if (!axis) {
3589
+ axis = { axisType };
3590
+ axes.push(axis);
3591
+ }
3592
+ if (edit.min !== void 0) {
3593
+ axis.min = edit.min ?? void 0;
3594
+ }
3595
+ if (edit.max !== void 0) {
3596
+ axis.max = edit.max ?? void 0;
3597
+ }
3598
+ if (edit.majorUnit !== void 0) {
3599
+ axis.majorUnit = edit.majorUnit ?? void 0;
3600
+ }
3601
+ if (edit.minorUnit !== void 0) {
3602
+ axis.minorUnit = edit.minorUnit ?? void 0;
3603
+ }
3604
+ if (edit.orientation !== void 0) {
3605
+ axis.orientation = edit.orientation ?? void 0;
3606
+ }
3607
+ if (edit.numberFormat !== void 0) {
3608
+ axis.numFmt = edit.numberFormat ? { formatCode: edit.numberFormat, sourceLinked: false } : void 0;
3609
+ }
3610
+ if (edit.tickLabelPosition !== void 0) {
3611
+ axis.tickLblPos = edit.tickLabelPosition;
3612
+ }
3613
+ if (edit.title !== void 0) {
3614
+ axis.titleText = edit.title ?? "";
3615
+ }
3616
+ if (edit.majorGridlines !== void 0) {
3617
+ axis.majorGridlines = edit.majorGridlines;
3618
+ }
3619
+ if (edit.minorGridlines !== void 0) {
3620
+ axis.minorGridlines = edit.minorGridlines;
3621
+ }
3622
+ if (edit.displayUnits !== void 0) {
3623
+ axis.displayUnits = edit.displayUnits ?? void 0;
3624
+ }
3625
+ if (edit.displayUnitsValue !== void 0) {
3626
+ axis.displayUnitsValue = edit.displayUnitsValue ?? void 0;
3627
+ }
3628
+ if (edit.displayUnitsLabel !== void 0) {
3629
+ axis.displayUnitsLabel = edit.displayUnitsLabel;
3630
+ }
3631
+ if (edit.visible !== void 0) {
3632
+ axis.deleted = !edit.visible;
3633
+ }
3634
+ }
3635
+ function setChartSeriesMarker(element, seriesIndex, marker) {
3636
+ validateSeriesIndex(element, seriesIndex);
3637
+ const series = element.chartData.series[seriesIndex];
3638
+ if (marker === null) {
3639
+ series.marker = void 0;
3640
+ return;
3641
+ }
3642
+ const existing = series.marker;
3643
+ if ("symbol" in marker && "spPr" in marker) {
3644
+ series.marker = marker;
3645
+ return;
3646
+ }
3647
+ const patch = marker;
3648
+ const next = {
3649
+ symbol: patch.symbol ?? existing?.symbol ?? "circle",
3650
+ size: patch.size ?? existing?.size,
3651
+ spPr: existing?.spPr ? { ...existing.spPr } : void 0
3652
+ };
3653
+ if (patch.fillColor !== void 0) {
3654
+ next.spPr = { ...next.spPr ?? {}, fillColor: patch.fillColor };
3655
+ }
3656
+ series.marker = next;
3657
+ }
3658
+ function ensureDataPoint(series, pointIndex) {
3659
+ const points4 = series.dataPoints ??= [];
3660
+ let dp = points4.find((p) => p.idx === pointIndex);
3661
+ if (!dp) {
3662
+ dp = { idx: pointIndex };
3663
+ points4.push(dp);
3664
+ points4.sort((a, b) => a.idx - b.idx);
3665
+ }
3666
+ return dp;
3667
+ }
3668
+ function setChartDataPointExplosion(element, seriesIndex, pointIndex, explosion) {
3669
+ validateSeriesIndex(element, seriesIndex);
3670
+ const series = element.chartData.series[seriesIndex];
3671
+ if (explosion === null) {
3672
+ const dp2 = series.dataPoints?.find((p) => p.idx === pointIndex);
3673
+ if (dp2) {
3674
+ dp2.explosion = void 0;
3675
+ removeEmptyDataPoint(series, pointIndex);
3676
+ }
3677
+ return;
3678
+ }
3679
+ const dp = ensureDataPoint(series, pointIndex);
3680
+ dp.explosion = explosion;
3681
+ }
3682
+ function setChartDataPointMarker(element, seriesIndex, pointIndex, marker) {
3683
+ validateSeriesIndex(element, seriesIndex);
3684
+ const series = element.chartData.series[seriesIndex];
3685
+ if (marker === null) {
3686
+ const dp2 = series.dataPoints?.find((p) => p.idx === pointIndex);
3687
+ if (dp2) {
3688
+ dp2.marker = void 0;
3689
+ removeEmptyDataPoint(series, pointIndex);
3690
+ }
3691
+ return;
3692
+ }
3693
+ const dp = ensureDataPoint(series, pointIndex);
3694
+ const existing = dp.marker;
3695
+ const next = {
3696
+ symbol: marker.symbol ?? existing?.symbol ?? "circle",
3697
+ size: marker.size ?? existing?.size,
3698
+ spPr: existing?.spPr ? { ...existing.spPr } : void 0
3699
+ };
3700
+ if (marker.fillColor !== void 0) {
3701
+ next.spPr = { ...next.spPr ?? {}, fillColor: marker.fillColor };
3702
+ }
3703
+ dp.marker = next;
3704
+ }
3705
+ function applyLabelEdit(label, edit) {
3706
+ if (edit.showValue !== void 0) {
3707
+ label.showVal = edit.showValue;
3708
+ }
3709
+ if (edit.showCategory !== void 0) {
3710
+ label.showCatName = edit.showCategory;
3711
+ }
3712
+ if (edit.showSeriesName !== void 0) {
3713
+ label.showSerName = edit.showSeriesName;
3714
+ }
3715
+ if (edit.showPercent !== void 0) {
3716
+ label.showPercent = edit.showPercent;
3717
+ }
3718
+ if (edit.showLegendKey !== void 0) {
3719
+ label.showLegendKey = edit.showLegendKey;
3720
+ }
3721
+ if (edit.position !== void 0) {
3722
+ label.position = edit.position;
3723
+ }
3724
+ if (edit.text !== void 0) {
3725
+ label.text = edit.text === "" ? void 0 : edit.text;
3726
+ }
3727
+ if (edit.spPr !== void 0) {
3728
+ label.spPr = edit.spPr === null ? void 0 : { ...label.spPr ?? {}, ...edit.spPr };
3729
+ }
3730
+ if (edit.txPr !== void 0) {
3731
+ label.txPr = edit.txPr === null ? void 0 : { ...label.txPr ?? {}, ...edit.txPr };
3732
+ }
3733
+ }
3734
+ function setChartDataPointLabel(element, seriesIndex, pointIndex, edit) {
3735
+ validateSeriesIndex(element, seriesIndex);
3736
+ const series = element.chartData.series[seriesIndex];
3737
+ if (edit === null) {
3738
+ if (!series.dataLabels) {
3739
+ return;
3740
+ }
3741
+ series.dataLabels = series.dataLabels.filter((l) => l.idx !== pointIndex);
3742
+ if (series.dataLabels.length === 0) {
3743
+ series.dataLabels = void 0;
3744
+ }
3745
+ return;
3746
+ }
3747
+ const labels = series.dataLabels ??= [];
3748
+ let label = labels.find((l) => l.idx === pointIndex);
3749
+ if (!label) {
3750
+ label = { idx: pointIndex };
3751
+ labels.push(label);
3752
+ labels.sort((a, b) => a.idx - b.idx);
3753
+ }
3754
+ applyLabelEdit(label, edit);
3755
+ }
3756
+ function removeEmptyDataPoint(series, pointIndex) {
3757
+ if (!series.dataPoints) {
3758
+ return;
3759
+ }
3760
+ const dp = series.dataPoints.find((p) => p.idx === pointIndex);
3761
+ if (!dp) {
3762
+ return;
3763
+ }
3764
+ const empty = dp.spPr === void 0 && dp.gradientFill === void 0 && dp.explosion === void 0 && dp.invertIfNegative === void 0 && dp.bubble3D === void 0 && dp.marker === void 0;
3765
+ if (empty) {
3766
+ series.dataPoints = series.dataPoints.filter((p) => p.idx !== pointIndex);
3767
+ }
3768
+ }
3769
+ var init_chart_operations = __esm({
3770
+ "src/pptx/core/builders/sdk/chart-operations.ts"() {
3771
+ }
3772
+ });
3773
+
3774
+ // src/pptx/core/builders/sdk/chart-layout-operations.ts
3775
+ function setChartGroupOptions(element, options) {
3776
+ ensureChartData(element);
3777
+ applyChartGroupOptionsInput(element.chartData, options);
3778
+ }
3779
+ function setChartAreaFormat(element, area, format) {
3780
+ ensureChartData(element);
3781
+ applyChartAreaFormatInput(element.chartData, area, format);
3782
+ }
3783
+ function applyChartInputLayout(element, input) {
3784
+ setChartGroupOptions(element, {
3785
+ ...input.gapWidth !== void 0 ? { gapWidth: input.gapWidth } : {},
3786
+ ...input.overlap !== void 0 ? { overlap: input.overlap } : {},
3787
+ ...input.firstSliceAngle !== void 0 ? { firstSliceAngle: input.firstSliceAngle } : {},
3788
+ ...input.holeSize !== void 0 ? { holeSize: input.holeSize } : {}
3789
+ });
3790
+ if (input.chartArea) {
3791
+ setChartAreaFormat(element, "chart", input.chartArea);
3792
+ }
3793
+ if (input.plotArea) {
3794
+ setChartAreaFormat(element, "plot", input.plotArea);
3795
+ }
3796
+ for (const [axisType, edit] of Object.entries(input.axes ?? {})) {
3797
+ if (edit) {
3798
+ setChartAxis(element, axisType, edit);
3799
+ }
3800
+ }
3801
+ }
3802
+ var init_chart_layout_operations = __esm({
3803
+ "src/pptx/core/builders/sdk/chart-layout-operations.ts"() {
3804
+ init_chart_layout_input();
3805
+ init_chart_operations();
3806
+ }
3807
+ });
3808
+
2985
3809
  // src/pptx/core/builders/sdk/ElementFactory.ts
2986
3810
  function generateId(prefix) {
2987
3811
  idCounter += 1;
@@ -3325,12 +4149,14 @@ function createChartElement(chartType, input, options) {
3325
4149
  legendPosition: input.legendPosition
3326
4150
  }
3327
4151
  };
3328
- return {
4152
+ const element = {
3329
4153
  type: "chart",
3330
4154
  id: generateId("cht"),
3331
4155
  ...p,
3332
4156
  chartData
3333
4157
  };
4158
+ applyChartInputLayout(element, input);
4159
+ return element;
3334
4160
  }
3335
4161
  function createMediaElement(mediaType, source, options) {
3336
4162
  const p = pos("media", options);
@@ -3396,6 +4222,7 @@ var init_ElementFactory = __esm({
3396
4222
  init_table_style_defaults();
3397
4223
  init_custom_geometry();
3398
4224
  init_chart_gradient_input();
4225
+ init_chart_layout_operations();
3399
4226
  idCounter = 0;
3400
4227
  DEFAULTS = {
3401
4228
  text: { x: 100, y: 100, width: 600, height: 50 },
@@ -14875,7 +15702,7 @@ function nsGet(obj, localName28) {
14875
15702
  return obj[localName28];
14876
15703
  }
14877
15704
  for (const key2 of Object.keys(obj)) {
14878
- if (localNameOf2(key2) === localName28 && !key2.startsWith("@_")) {
15705
+ if (localNameOf3(key2) === localName28 && !key2.startsWith("@_")) {
14879
15706
  return obj[key2];
14880
15707
  }
14881
15708
  }
@@ -14887,13 +15714,13 @@ function nsAttr(obj, localName28) {
14887
15714
  return direct;
14888
15715
  }
14889
15716
  for (const key2 of Object.keys(obj)) {
14890
- if (key2.startsWith("@_") && localNameOf2(key2.slice(2)) === localName28) {
15717
+ if (key2.startsWith("@_") && localNameOf3(key2.slice(2)) === localName28) {
14891
15718
  return obj[key2];
14892
15719
  }
14893
15720
  }
14894
15721
  return void 0;
14895
15722
  }
14896
- function localNameOf2(key2) {
15723
+ function localNameOf3(key2) {
14897
15724
  const colon = key2.indexOf(":");
14898
15725
  return colon >= 0 ? key2.slice(colon + 1) : key2;
14899
15726
  }
@@ -14913,7 +15740,7 @@ function collectByLocalName(node, localName28) {
14913
15740
  if (key2.startsWith("@_") || key2 === "#text") {
14914
15741
  continue;
14915
15742
  }
14916
- if (localNameOf2(key2) === localName28) {
15743
+ if (localNameOf3(key2) === localName28) {
14917
15744
  for (const item of ensureArray(value)) {
14918
15745
  found.push(item);
14919
15746
  }
@@ -14969,7 +15796,7 @@ function resolveTiltMode(strokes) {
14969
15796
  }
14970
15797
  function buildInkMlContent(strokes, rawXml) {
14971
15798
  const data = rawXml ? { ...rawXml } : {};
14972
- const existingKey = Object.keys(data).find((key2) => localNameOf3(key2) === "ink");
15799
+ const existingKey = Object.keys(data).find((key2) => localNameOf4(key2) === "ink");
14973
15800
  const existingRoot = existingKey ? data[existingKey] : void 0;
14974
15801
  const root = existingRoot ? { ...existingRoot } : {};
14975
15802
  root["@_xmlns:ink"] = INKML_NAMESPACE;
@@ -15014,13 +15841,13 @@ function deleteStaleInkChildren(root) {
15014
15841
  if (key2.startsWith("ink:") || key2.startsWith("@_") || key2 === "#text") {
15015
15842
  continue;
15016
15843
  }
15017
- const local = localNameOf3(key2);
15844
+ const local = localNameOf4(key2);
15018
15845
  if (local === "trace" || local === "brush" || local === "traceGroup" || local === "definitions") {
15019
15846
  delete root[key2];
15020
15847
  }
15021
15848
  }
15022
15849
  }
15023
- function localNameOf3(key2) {
15850
+ function localNameOf4(key2) {
15024
15851
  const colon = key2.indexOf(":");
15025
15852
  return colon >= 0 ? key2.slice(colon + 1) : key2;
15026
15853
  }
@@ -16494,7 +17321,7 @@ var init_xml_access = __esm({
16494
17321
  });
16495
17322
 
16496
17323
  // src/pptx/core/utils/chart-xlsx-sheet-cells.ts
16497
- function toArray(value) {
17324
+ function toArray2(value) {
16498
17325
  if (Array.isArray(value)) {
16499
17326
  return value;
16500
17327
  }
@@ -16518,7 +17345,7 @@ function ensureCell(sheetData, ref) {
16518
17345
  return void 0;
16519
17346
  }
16520
17347
  const rowNumber = address.row + 1;
16521
- const rows = toArray(sheetData["row"]);
17348
+ const rows = toArray2(sheetData["row"]);
16522
17349
  let row = rows.find((r) => Number(r["@_r"]) === rowNumber);
16523
17350
  if (!row) {
16524
17351
  row = { "@_r": String(rowNumber), c: [] };
@@ -16530,7 +17357,7 @@ function ensureCell(sheetData, ref) {
16530
17357
  }
16531
17358
  sheetData["row"] = rows;
16532
17359
  }
16533
- const cells2 = toArray(row["c"]);
17360
+ const cells2 = toArray2(row["c"]);
16534
17361
  let cell = cells2.find((c) => String(c["@_r"] ?? "") === ref);
16535
17362
  if (!cell) {
16536
17363
  cell = { "@_r": ref };
@@ -22899,7 +23726,7 @@ var init_smartart_layout_interpreter_choose_composite = __esm({
22899
23726
  });
22900
23727
 
22901
23728
  // src/pptx/core/utils/smartart-layout-interpreter-choose-algorithm.ts
22902
- function branchAlg(raw, nodeCount, context, allowedTypes = CHOOSE_ALG_TYPES) {
23729
+ function branchAlg(raw, nodeCount, context, allowedTypes2 = CHOOSE_ALG_TYPES) {
22903
23730
  if (!raw) {
22904
23731
  return void 0;
22905
23732
  }
@@ -22923,7 +23750,7 @@ function branchAlg(raw, nodeCount, context, allowedTypes = CHOOSE_ALG_TYPES) {
22923
23750
  if (name === "alg") {
22924
23751
  for (const candidate of Array.isArray(entry) ? entry : [entry]) {
22925
23752
  const type = candidate && typeof candidate === "object" ? String(candidate["@_type"] ?? "") : "";
22926
- if (allowedTypes.has(type)) {
23753
+ if (allowedTypes2.has(type)) {
22927
23754
  found = { type, raw: candidate };
22928
23755
  return;
22929
23756
  }
@@ -23004,7 +23831,7 @@ function chooseAlgorithm(node, nodeCount, context = {}) {
23004
23831
  }
23005
23832
  return void 0;
23006
23833
  }
23007
- function chooseAlgorithmOfType(node, nodeCount, allowedTypes, context = {}) {
23834
+ function chooseAlgorithmOfType(node, nodeCount, allowedTypes2, context = {}) {
23008
23835
  if (!node.choose || node.choose.length === 0) {
23009
23836
  return void 0;
23010
23837
  }
@@ -23013,7 +23840,7 @@ function chooseAlgorithmOfType(node, nodeCount, allowedTypes, context = {}) {
23013
23840
  activeBranch(choose, nodeCount, context),
23014
23841
  nodeCount,
23015
23842
  context,
23016
- allowedTypes
23843
+ allowedTypes2
23017
23844
  );
23018
23845
  if (found) {
23019
23846
  const parameters = parseBranchAlgParams(found.raw);
@@ -37426,7 +38253,7 @@ var init_smartart_node_style_apply = __esm({
37426
38253
  });
37427
38254
 
37428
38255
  // src/pptx/core/utils/smartart-pres-layout-vars.ts
37429
- function localNameOf4(key2) {
38256
+ function localNameOf5(key2) {
37430
38257
  const idx = key2.indexOf(":");
37431
38258
  return idx >= 0 ? key2.slice(idx + 1) : key2;
37432
38259
  }
@@ -37447,7 +38274,7 @@ function findVarsContainer(node) {
37447
38274
  if (key2.startsWith("@_")) {
37448
38275
  continue;
37449
38276
  }
37450
- if (CONTAINER_LOCAL_NAMES.has(localNameOf4(key2))) {
38277
+ if (CONTAINER_LOCAL_NAMES.has(localNameOf5(key2))) {
37451
38278
  const container2 = Array.isArray(value) ? value[0] : value;
37452
38279
  if (container2 && typeof container2 === "object") {
37453
38280
  return container2;
@@ -37462,7 +38289,7 @@ function findVarsContainer(node) {
37462
38289
  }
37463
38290
  function presNameOf(pt) {
37464
38291
  for (const [key2, value] of Object.entries(pt)) {
37465
- if (key2.startsWith("@_") || localNameOf4(key2) !== "prSet") {
38292
+ if (key2.startsWith("@_") || localNameOf5(key2) !== "prSet") {
37466
38293
  continue;
37467
38294
  }
37468
38295
  const prSet = Array.isArray(value) ? value[0] : value;
@@ -37490,7 +38317,7 @@ function findNamedPresVars(node, presName) {
37490
38317
  if (key2.startsWith("@_")) {
37491
38318
  continue;
37492
38319
  }
37493
- if (localNameOf4(key2) === "pt") {
38320
+ if (localNameOf5(key2) === "pt") {
37494
38321
  for (const pt of Array.isArray(value) ? value : [value]) {
37495
38322
  if (pt && typeof pt === "object" && presNameOf(pt) === presName) {
37496
38323
  const vars = findVarsContainer(pt);
@@ -37509,7 +38336,7 @@ function findNamedPresVars(node, presName) {
37509
38336
  }
37510
38337
  function varValue(container2, name) {
37511
38338
  for (const [key2, value] of Object.entries(container2)) {
37512
- if (key2.startsWith("@_") || localNameOf4(key2) !== name) {
38339
+ if (key2.startsWith("@_") || localNameOf5(key2) !== name) {
37513
38340
  continue;
37514
38341
  }
37515
38342
  const node = Array.isArray(value) ? value[0] : value;
@@ -38354,7 +39181,7 @@ var init_smartart_effect_intensity = __esm({
38354
39181
  });
38355
39182
 
38356
39183
  // src/pptx/core/utils/smartart-color-lists.ts
38357
- function localNameOf5(key2) {
39184
+ function localNameOf6(key2) {
38358
39185
  const idx = key2.indexOf(":");
38359
39186
  return idx >= 0 ? key2.slice(idx + 1) : key2;
38360
39187
  }
@@ -38367,7 +39194,7 @@ function parseSmartArtColorListHexes(list2, deps) {
38367
39194
  if (key2.startsWith("@_")) {
38368
39195
  continue;
38369
39196
  }
38370
- const local = localNameOf5(key2);
39197
+ const local = localNameOf6(key2);
38371
39198
  if (!COLOR_LOCAL_NAMES.has(local)) {
38372
39199
  continue;
38373
39200
  }
@@ -41063,7 +41890,7 @@ var init_chart_shape_props_writer = __esm({
41063
41890
  });
41064
41891
 
41065
41892
  // src/pptx/core/utils/chart-marker-serializer.ts
41066
- function findKey3(obj, local, getLocalName2) {
41893
+ function findKey4(obj, local, getLocalName2) {
41067
41894
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
41068
41895
  }
41069
41896
  function insertOrdered(seriesNode, key2, value, getLocalName2) {
@@ -41097,7 +41924,7 @@ function buildChartMarkerXml(existing, marker, getLocalName2, resolveColor2) {
41097
41924
  if (marker.size !== void 0) {
41098
41925
  node["c:size"] = { "@_val": String(marker.size) };
41099
41926
  }
41100
- const existingSpPr = existing ? existing[findKey3(existing, "spPr", getLocalName2) ?? ""] : void 0;
41927
+ const existingSpPr = existing ? existing[findKey4(existing, "spPr", getLocalName2) ?? ""] : void 0;
41101
41928
  const spPr = buildMarkerSpPr(existingSpPr, marker, getLocalName2, resolveColor2);
41102
41929
  if (spPr) {
41103
41930
  node["c:spPr"] = spPr;
@@ -41113,7 +41940,7 @@ function buildChartMarkerXml(existing, marker, getLocalName2, resolveColor2) {
41113
41940
  return node;
41114
41941
  }
41115
41942
  function applySeriesMarkerToXml(seriesNode, marker, getLocalName2, resolveColor2) {
41116
- const existingKey = findKey3(seriesNode, "marker", getLocalName2);
41943
+ const existingKey = findKey4(seriesNode, "marker", getLocalName2);
41117
41944
  if (!marker) {
41118
41945
  if (existingKey) {
41119
41946
  delete seriesNode[existingKey];
@@ -41150,7 +41977,7 @@ var init_chart_marker_serializer = __esm({
41150
41977
  });
41151
41978
 
41152
41979
  // src/pptx/core/utils/chart-datapoint-serializer.ts
41153
- function findKey4(obj, local, getLocalName2) {
41980
+ function findKey5(obj, local, getLocalName2) {
41154
41981
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
41155
41982
  }
41156
41983
  function ensureArray2(v) {
@@ -41189,7 +42016,7 @@ function buildDataPoint(existing, dp, getLocalName2, resolveColor2, gradient) {
41189
42016
  if (dp.invertIfNegative !== void 0) {
41190
42017
  node["c:invertIfNegative"] = { "@_val": dp.invertIfNegative ? "1" : "0" };
41191
42018
  }
41192
- const existingMarker = existing ? existing[findKey4(existing, "marker", getLocalName2) ?? ""] : void 0;
42019
+ const existingMarker = existing ? existing[findKey5(existing, "marker", getLocalName2) ?? ""] : void 0;
41193
42020
  if (dp.marker) {
41194
42021
  node["c:marker"] = buildChartMarkerXml(existingMarker, dp.marker, getLocalName2, resolveColor2);
41195
42022
  } else if (existingMarker) {
@@ -41198,7 +42025,7 @@ function buildDataPoint(existing, dp, getLocalName2, resolveColor2, gradient) {
41198
42025
  if (dp.bubble3D !== void 0) {
41199
42026
  node["c:bubble3D"] = { "@_val": dp.bubble3D ? "1" : "0" };
41200
42027
  } else if (existing) {
41201
- const bubbleKey = findKey4(existing, "bubble3D", getLocalName2);
42028
+ const bubbleKey = findKey5(existing, "bubble3D", getLocalName2);
41202
42029
  if (bubbleKey) {
41203
42030
  node[bubbleKey] = existing[bubbleKey];
41204
42031
  }
@@ -41206,12 +42033,12 @@ function buildDataPoint(existing, dp, getLocalName2, resolveColor2, gradient) {
41206
42033
  if (dp.explosion !== void 0) {
41207
42034
  node["c:explosion"] = { "@_val": String(dp.explosion) };
41208
42035
  }
41209
- const existingSpPr = existing ? existing[findKey4(existing, "spPr", getLocalName2) ?? ""] : void 0;
42036
+ const existingSpPr = existing ? existing[findKey5(existing, "spPr", getLocalName2) ?? ""] : void 0;
41210
42037
  const spPr = buildDptSpPr(existingSpPr, dp, getLocalName2, resolveColor2, gradient);
41211
42038
  if (spPr) {
41212
42039
  node["c:spPr"] = spPr;
41213
42040
  }
41214
- const existingPictureOptions = existing ? existing[findKey4(existing, "pictureOptions", getLocalName2) ?? ""] : void 0;
42041
+ const existingPictureOptions = existing ? existing[findKey5(existing, "pictureOptions", getLocalName2) ?? ""] : void 0;
41215
42042
  const pictureOptions = buildDptPictureOptions(existingPictureOptions, dp.picture);
41216
42043
  if (pictureOptions) {
41217
42044
  node["c:pictureOptions"] = pictureOptions;
@@ -41229,11 +42056,11 @@ function buildDataPoint(existing, dp, getLocalName2, resolveColor2, gradient) {
41229
42056
  return node;
41230
42057
  }
41231
42058
  function applySeriesDataPointsToXml(seriesNode, dataPoints, getLocalName2, resolveColor2, gradient) {
41232
- const existingKey = findKey4(seriesNode, "dPt", getLocalName2);
42059
+ const existingKey = findKey5(seriesNode, "dPt", getLocalName2);
41233
42060
  const existingNodes = existingKey ? ensureArray2(seriesNode[existingKey]) : [];
41234
42061
  const byIdx = /* @__PURE__ */ new Map();
41235
42062
  for (const node of existingNodes) {
41236
- const idxNode = node[findKey4(node, "idx", getLocalName2) ?? ""];
42063
+ const idxNode = node[findKey5(node, "idx", getLocalName2) ?? ""];
41237
42064
  const idx = idxNode ? Number.parseInt(String(idxNode["@_val"]), 10) : NaN;
41238
42065
  if (Number.isFinite(idx)) {
41239
42066
  byIdx.set(idx, node);
@@ -41263,7 +42090,7 @@ function applySeriesDataPointsToXml(seriesNode, dataPoints, getLocalName2, resol
41263
42090
  }
41264
42091
  }
41265
42092
  function applySeriesPictureOptionsToXml(seriesNode, picture, getLocalName2) {
41266
- const existingKey = findKey4(seriesNode, "pictureOptions", getLocalName2);
42093
+ const existingKey = findKey5(seriesNode, "pictureOptions", getLocalName2);
41267
42094
  const existing = existingKey ? seriesNode[existingKey] : void 0;
41268
42095
  const built = buildDptPictureOptions(existing, picture);
41269
42096
  if (existingKey) {
@@ -41404,7 +42231,7 @@ var init_chart_series_identity = __esm({
41404
42231
  });
41405
42232
 
41406
42233
  // src/pptx/core/utils/chart-series-detail-parser.ts
41407
- function localNameOf6(key2) {
42234
+ function localNameOf7(key2) {
41408
42235
  return key2.replace(/^.*:/u, "");
41409
42236
  }
41410
42237
  function safeInt2(val) {
@@ -41542,7 +42369,7 @@ function parseSeriesDataPoints(seriesNode, xmlLookup, colorParser, parseGradient
41542
42369
  if (bubble3D !== void 0) {
41543
42370
  result.bubble3D = bubble3D;
41544
42371
  }
41545
- const uniqueId = parseChartUniqueId(node, localNameOf6);
42372
+ const uniqueId = parseChartUniqueId(node, localNameOf7);
41546
42373
  if (uniqueId !== void 0) {
41547
42374
  result.uniqueId = uniqueId;
41548
42375
  }
@@ -41626,7 +42453,7 @@ var init_chart_data_table_parser = __esm({
41626
42453
  });
41627
42454
 
41628
42455
  // src/pptx/core/utils/chart-data-label-field-table.ts
41629
- function localNameOf7(key2) {
42456
+ function localNameOf8(key2) {
41630
42457
  const colonIndex = key2.lastIndexOf(":");
41631
42458
  return colonIndex >= 0 ? key2.slice(colonIndex + 1) : key2;
41632
42459
  }
@@ -41653,7 +42480,7 @@ function collectByLocalName2(node, target, out) {
41653
42480
  const items = Array.isArray(child27) ? child27 : [child27];
41654
42481
  for (const item of items) {
41655
42482
  if (item && typeof item === "object") {
41656
- if (localNameOf7(key2) === target) {
42483
+ if (localNameOf8(key2) === target) {
41657
42484
  out.push(item);
41658
42485
  }
41659
42486
  collectByLocalName2(item, target, out);
@@ -41849,7 +42676,7 @@ function dataLabelsRangeUnchanged(dLbls, range, showDataLabelsRange, getLocalNam
41849
42676
  }
41850
42677
  return existingRange.formula === range.formula && existingRange.cache.length === range.cache.length && existingRange.cache.every((value, idx) => value === range.cache[idx]) && existingShow === (showDataLabelsRange !== false);
41851
42678
  }
41852
- function findKey5(obj, local, getLocalName2) {
42679
+ function findKey6(obj, local, getLocalName2) {
41853
42680
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
41854
42681
  }
41855
42682
  function asExtArray(value) {
@@ -41865,9 +42692,9 @@ function applyDataLabelsRangeToDLbls(dLbls, range, showDataLabelsRange, getLocal
41865
42692
  if (dataLabelsRangeUnchanged(dLbls, range, showDataLabelsRange, getLocalName2)) {
41866
42693
  return;
41867
42694
  }
41868
- const extLstKey = findKey5(dLbls, "extLst", getLocalName2) ?? "c:extLst";
42695
+ const extLstKey = findKey6(dLbls, "extLst", getLocalName2) ?? "c:extLst";
41869
42696
  const extLst = { ...dLbls[extLstKey] ?? {} };
41870
- const extKey = findKey5(extLst, "ext", getLocalName2);
42697
+ const extKey = findKey6(extLst, "ext", getLocalName2);
41871
42698
  const exts = extKey ? asExtArray(extLst[extKey]) : [];
41872
42699
  const otherExts = exts.filter((ext) => ext["@_uri"] !== CHART15_EXT_URI);
41873
42700
  const ownExt = { ...exts.find((ext) => ext["@_uri"] === CHART15_EXT_URI) ?? {} };
@@ -41956,7 +42783,7 @@ function scalar3(parent, name, xmlLookup) {
41956
42783
  const node = xmlLookup.getChildByLocalName(parent, name);
41957
42784
  return node?.["#text"] === void 0 ? void 0 : String(node["#text"]);
41958
42785
  }
41959
- function localNameOf8(key2) {
42786
+ function localNameOf9(key2) {
41960
42787
  const colonIndex = key2.lastIndexOf(":");
41961
42788
  return colonIndex >= 0 ? key2.slice(colonIndex + 1) : key2;
41962
42789
  }
@@ -42024,7 +42851,7 @@ function parseSeriesDataLabels(seriesNode, xmlLookup, colorParser, resolveTypefa
42024
42851
  if (numberFormat !== void 0) {
42025
42852
  result.numberFormat = numberFormat;
42026
42853
  }
42027
- const layout = parseChartManualLayout(node, localNameOf8);
42854
+ const layout = parseChartManualLayout(node, localNameOf9);
42028
42855
  if (layout) {
42029
42856
  result.layout = layout;
42030
42857
  }
@@ -42127,7 +42954,7 @@ var init_chart_data_label_parser = __esm({
42127
42954
 
42128
42955
  // src/pptx/core/utils/chart-axis-dispunits-serializer.ts
42129
42956
  function setOrdered(node, name, value, order, localName28) {
42130
- const existing = findKey6(node, name, localName28);
42957
+ const existing = findKey7(node, name, localName28);
42131
42958
  if (existing) {
42132
42959
  node[existing] = value;
42133
42960
  return;
@@ -42219,7 +43046,7 @@ function applyLabel(node, edit, localName28, resolveColor2) {
42219
43046
  if (edit === void 0) {
42220
43047
  return;
42221
43048
  }
42222
- const key2 = findKey6(node, "dispUnitsLbl", localName28);
43049
+ const key2 = findKey7(node, "dispUnitsLbl", localName28);
42223
43050
  if (edit === null) {
42224
43051
  if (key2) {
42225
43052
  delete node[key2];
@@ -42241,7 +43068,7 @@ function applyLabel(node, edit, localName28, resolveColor2) {
42241
43068
  );
42242
43069
  }
42243
43070
  if (labelEdit.spPr !== void 0) {
42244
- const spPrKey = findKey6(label, "spPr", localName28);
43071
+ const spPrKey = findKey7(label, "spPr", localName28);
42245
43072
  if (labelEdit.spPr === null) {
42246
43073
  if (spPrKey) {
42247
43074
  delete label[spPrKey];
@@ -42269,7 +43096,7 @@ function applyLabel(node, edit, localName28, resolveColor2) {
42269
43096
  );
42270
43097
  }
42271
43098
  function applyChartAxisDisplayUnitsToXml(axisNode, axis, localName28, resolveColor2) {
42272
- const existingKey = findKey6(axisNode, "dispUnits", localName28);
43099
+ const existingKey = findKey7(axisNode, "dispUnits", localName28);
42273
43100
  if (!axis.displayUnits) {
42274
43101
  if (existingKey) {
42275
43102
  delete axisNode[existingKey];
@@ -42283,7 +43110,7 @@ function applyChartAxisDisplayUnitsToXml(axisNode, axis, localName28, resolveCol
42283
43110
  ...existingKey ? axisNode[existingKey] : void 0
42284
43111
  };
42285
43112
  for (const choice of ["custUnit", "builtInUnit"]) {
42286
- const key2 = findKey6(node, choice, localName28);
43113
+ const key2 = findKey7(node, choice, localName28);
42287
43114
  if (key2) {
42288
43115
  delete node[key2];
42289
43116
  }
@@ -42312,7 +43139,7 @@ function applyChartAxisDisplayUnitsToXml(axisNode, axis, localName28, resolveCol
42312
43139
  applyLabel(node, axis.displayUnitsLabel, localName28, resolveColor2);
42313
43140
  setOrdered(axisNode, "dispUnits", node, ["dispUnits", "extLst"], localName28);
42314
43141
  }
42315
- var BUILT_IN_UNITS, findKey6;
43142
+ var BUILT_IN_UNITS, findKey7;
42316
43143
  var init_chart_axis_dispunits_serializer = __esm({
42317
43144
  "src/pptx/core/utils/chart-axis-dispunits-serializer.ts"() {
42318
43145
  init_chart_color_choice();
@@ -42329,7 +43156,7 @@ var init_chart_axis_dispunits_serializer = __esm({
42329
43156
  "billions",
42330
43157
  "trillions"
42331
43158
  ]);
42332
- findKey6 = (node, name, localName28) => Object.keys(node).find((key2) => localName28(key2) === name);
43159
+ findKey7 = (node, name, localName28) => Object.keys(node).find((key2) => localName28(key2) === name);
42333
43160
  }
42334
43161
  });
42335
43162
 
@@ -42346,11 +43173,11 @@ var init_chart_percent_union_value = __esm({
42346
43173
  });
42347
43174
 
42348
43175
  // src/pptx/core/utils/chart-axis-label-formatting.ts
42349
- function findKey7(node, name, localName28) {
43176
+ function findKey8(node, name, localName28) {
42350
43177
  return Object.keys(node).find((key2) => localName28(key2) === name);
42351
43178
  }
42352
43179
  function child8(node, name, localName28) {
42353
- const key2 = findKey7(node, name, localName28);
43180
+ const key2 = findKey8(node, name, localName28);
42354
43181
  const value = key2 ? node[key2] : void 0;
42355
43182
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
42356
43183
  }
@@ -42424,7 +43251,7 @@ function parseChartAxisLabelFormatting(node, axisType, localName28) {
42424
43251
  return Object.fromEntries(Object.entries(result).filter(([, value]) => value !== void 0));
42425
43252
  }
42426
43253
  function upsertOrdered(node, name, value, localName28) {
42427
- const key2 = findKey7(node, name, localName28);
43254
+ const key2 = findKey8(node, name, localName28);
42428
43255
  if (key2) {
42429
43256
  node[key2] = { ...node[key2], ...value };
42430
43257
  return;
@@ -42463,13 +43290,13 @@ function applyChartAxisLabelFormatting(node, formatting, localName28) {
42463
43290
  if (!Number.isFinite(formatting.crossesAt)) {
42464
43291
  throw new RangeError("crossesAt must be finite");
42465
43292
  }
42466
- const crossesKey = findKey7(node, "crosses", localName28);
43293
+ const crossesKey = findKey8(node, "crosses", localName28);
42467
43294
  if (crossesKey) {
42468
43295
  delete node[crossesKey];
42469
43296
  }
42470
43297
  upsertOrdered(node, "crossesAt", { "@_val": String(formatting.crossesAt) }, localName28);
42471
43298
  } else if (formatting.crosses !== void 0) {
42472
- const crossesAtKey = findKey7(node, "crossesAt", localName28);
43299
+ const crossesAtKey = findKey8(node, "crossesAt", localName28);
42473
43300
  if (crossesAtKey) {
42474
43301
  delete node[crossesAtKey];
42475
43302
  }
@@ -42621,9 +43448,30 @@ function applyChartAxisScaling(scalingNode, axis, getLocalName2) {
42621
43448
  if (axis.orientation !== void 0) {
42622
43449
  upsertChartAxisChild(scalingNode, "orientation", axis.orientation, getLocalName2);
42623
43450
  }
43451
+ orderScalingChildren(scalingNode, getLocalName2);
42624
43452
  }
43453
+ function orderScalingChildren(scalingNode, getLocalName2) {
43454
+ const rank = (key2) => {
43455
+ const index = SCALING_ORDER.indexOf(getLocalName2(key2));
43456
+ return index === -1 ? SCALING_ORDER.length : index;
43457
+ };
43458
+ const keys = Object.keys(scalingNode).filter((key2) => !key2.startsWith("@_"));
43459
+ const sorted = [...keys].sort((a, b) => rank(a) - rank(b));
43460
+ if (sorted.every((key2, i) => key2 === keys[i])) {
43461
+ return;
43462
+ }
43463
+ const entries = sorted.map((key2) => [key2, scalingNode[key2]]);
43464
+ for (const key2 of keys) {
43465
+ delete scalingNode[key2];
43466
+ }
43467
+ for (const [key2, value] of entries) {
43468
+ scalingNode[key2] = value;
43469
+ }
43470
+ }
43471
+ var SCALING_ORDER;
42625
43472
  var init_chart_axis_scaling = __esm({
42626
43473
  "src/pptx/core/utils/chart-axis-scaling.ts"() {
43474
+ SCALING_ORDER = ["logBase", "orientation", "max", "min"];
42627
43475
  }
42628
43476
  });
42629
43477
 
@@ -42711,7 +43559,7 @@ var init_chart_date_axis = __esm({
42711
43559
  });
42712
43560
 
42713
43561
  // src/pptx/core/utils/chart-title-xml-ops.ts
42714
- function findKey8(node, localName28, getLocalName2) {
43562
+ function findKey9(node, localName28, getLocalName2) {
42715
43563
  return Object.keys(node).find((key2) => getLocalName2(key2) === localName28);
42716
43564
  }
42717
43565
  function replaceEntries(parent, entries) {
@@ -42729,7 +43577,7 @@ function insertAt2(parent, index, key2, value) {
42729
43577
  }
42730
43578
  function setAutoTitleDeleted(chartRoot, deleted, getLocalName2) {
42731
43579
  const value = { "@_val": deleted ? "1" : "0" };
42732
- const existingKey = findKey8(chartRoot, "autoTitleDeleted", getLocalName2);
43580
+ const existingKey = findKey9(chartRoot, "autoTitleDeleted", getLocalName2);
42733
43581
  if (existingKey) {
42734
43582
  chartRoot[existingKey] = value;
42735
43583
  return;
@@ -46646,9 +47494,9 @@ function parseKinsoku(presentationXml3) {
46646
47494
  if (!presentationXml3) {
46647
47495
  return void 0;
46648
47496
  }
46649
- const rootKey = findKey9(presentationXml3, "presentation");
47497
+ const rootKey = findKey10(presentationXml3, "presentation");
46650
47498
  const root = rootKey ? presentationXml3[rootKey] : void 0;
46651
- const key2 = root ? findKey9(root, "kinsoku") : void 0;
47499
+ const key2 = root ? findKey10(root, "kinsoku") : void 0;
46652
47500
  const node = key2 && root ? root[key2] : void 0;
46653
47501
  if (!node) {
46654
47502
  return void 0;
@@ -46667,7 +47515,7 @@ function parseKinsoku(presentationXml3) {
46667
47515
  return result;
46668
47516
  }
46669
47517
  function setAttribute2(node, name, value) {
46670
- const key2 = findKey9(node, name);
47518
+ const key2 = findKey10(node, name);
46671
47519
  if (value === null) {
46672
47520
  if (key2) {
46673
47521
  delete node[key2];
@@ -46696,7 +47544,7 @@ function insertKinsoku(root, key2, value) {
46696
47544
  return result;
46697
47545
  }
46698
47546
  function applyKinsokuToXml(presentation, kinsoku) {
46699
- const existingKey = findKey9(presentation, "kinsoku");
47547
+ const existingKey = findKey10(presentation, "kinsoku");
46700
47548
  if (kinsoku === void 0) {
46701
47549
  return presentation;
46702
47550
  }
@@ -46723,7 +47571,7 @@ function applyKinsokuToXml(presentation, kinsoku) {
46723
47571
  Object.assign(presentation, rebuilt);
46724
47572
  return presentation;
46725
47573
  }
46726
- var BEFORE_KINSOKU, localName8, findKey9;
47574
+ var BEFORE_KINSOKU, localName8, findKey10;
46727
47575
  var init_kinsoku_parser = __esm({
46728
47576
  "src/pptx/core/utils/kinsoku-parser.ts"() {
46729
47577
  BEFORE_KINSOKU = /* @__PURE__ */ new Set([
@@ -46740,7 +47588,7 @@ var init_kinsoku_parser = __esm({
46740
47588
  "custDataLst"
46741
47589
  ]);
46742
47590
  localName8 = (key2) => key2.replace(/^@_/u, "").replace(/^.*:/u, "");
46743
- findKey9 = (node, name) => Object.keys(node).find((key2) => localName8(key2) === name);
47591
+ findKey10 = (node, name) => Object.keys(node).find((key2) => localName8(key2) === name);
46744
47592
  }
46745
47593
  });
46746
47594
 
@@ -51889,11 +52737,11 @@ function localName12(key2) {
51889
52737
  const idx = key2.indexOf(":");
51890
52738
  return idx >= 0 ? key2.slice(idx + 1) : key2;
51891
52739
  }
51892
- function findKey10(obj, local) {
52740
+ function findKey11(obj, local) {
51893
52741
  return Object.keys(obj).find((k) => localName12(k) === local);
51894
52742
  }
51895
52743
  function ensureChild(obj, local, prefixedFallback) {
51896
- const key2 = findKey10(obj, local) ?? prefixedFallback;
52744
+ const key2 = findKey11(obj, local) ?? prefixedFallback;
51897
52745
  const existing = obj[key2];
51898
52746
  if (existing && typeof existing === "object" && !Array.isArray(existing)) {
51899
52747
  return existing;
@@ -51909,7 +52757,7 @@ function solidFill2(color2) {
51909
52757
  return { "a:srgbClr": { "@_val": hexValue(color2) } };
51910
52758
  }
51911
52759
  function setSolidFill(parent, color2) {
51912
- const key2 = findKey10(parent, "solidFill") ?? "a:solidFill";
52760
+ const key2 = findKey11(parent, "solidFill") ?? "a:solidFill";
51913
52761
  parent[key2] = solidFill2(color2);
51914
52762
  }
51915
52763
  function applyShapeStyle(pt, style) {
@@ -51926,7 +52774,7 @@ function applyShapeStyle(pt, style) {
51926
52774
  }
51927
52775
  }
51928
52776
  function ensureFirstRunRPr(pt) {
51929
- const tKey = findKey10(pt, "t");
52777
+ const tKey = findKey11(pt, "t");
51930
52778
  if (!tKey) {
51931
52779
  return void 0;
51932
52780
  }
@@ -51934,7 +52782,7 @@ function ensureFirstRunRPr(pt) {
51934
52782
  if (!body || typeof body !== "object" || Array.isArray(body)) {
51935
52783
  return void 0;
51936
52784
  }
51937
- const pKey = findKey10(body, "p");
52785
+ const pKey = findKey11(body, "p");
51938
52786
  if (!pKey) {
51939
52787
  return void 0;
51940
52788
  }
@@ -51943,7 +52791,7 @@ function ensureFirstRunRPr(pt) {
51943
52791
  if (!firstP || typeof firstP !== "object") {
51944
52792
  return void 0;
51945
52793
  }
51946
- const rKey = findKey10(firstP, "r");
52794
+ const rKey = findKey11(firstP, "r");
51947
52795
  if (!rKey) {
51948
52796
  return void 0;
51949
52797
  }
@@ -52981,7 +53829,7 @@ var init_layout_display_name = __esm({
52981
53829
  });
52982
53830
 
52983
53831
  // src/pptx/core/utils/chart-bubble-options.ts
52984
- function findKey11(node, name, localName28) {
53832
+ function findKey12(node, name, localName28) {
52985
53833
  return Object.keys(node).find((key2) => localName28(key2) === name);
52986
53834
  }
52987
53835
  function boolValue2(node) {
@@ -52996,7 +53844,7 @@ function parseBubbleChartOptions(container2, localName28) {
52996
53844
  return void 0;
52997
53845
  }
52998
53846
  const node = (name) => {
52999
- const key2 = findKey11(container2, name, localName28);
53847
+ const key2 = findKey12(container2, name, localName28);
53000
53848
  return key2 ? container2[key2] : void 0;
53001
53849
  };
53002
53850
  const options = {};
@@ -53025,7 +53873,7 @@ function parseBubbleChartOptions(container2, localName28) {
53025
53873
  return Object.keys(options).length > 0 ? options : void 0;
53026
53874
  }
53027
53875
  function insertOrdered2(container2, name, value, localName28) {
53028
- const existingKey = findKey11(container2, name, localName28);
53876
+ const existingKey = findKey12(container2, name, localName28);
53029
53877
  if (existingKey) {
53030
53878
  container2[existingKey] = { ...container2[existingKey], ...value };
53031
53879
  return;
@@ -53155,7 +54003,7 @@ function parseChartUpDownBars(chartContainer, xmlLookup, colorParser) {
53155
54003
  return result;
53156
54004
  }
53157
54005
  function setOrdered2(node, name, value, order, localName28) {
53158
- const key2 = findKey12(node, name, localName28);
54006
+ const key2 = findKey13(node, name, localName28);
53159
54007
  if (key2) {
53160
54008
  node[key2] = value;
53161
54009
  return;
@@ -53178,7 +54026,7 @@ function applyChartUpDownBars(chartContainer, options, localName28, resolveColor
53178
54026
  if (options === void 0) {
53179
54027
  return;
53180
54028
  }
53181
- const key2 = findKey12(chartContainer, "upDownBars", localName28);
54029
+ const key2 = findKey13(chartContainer, "upDownBars", localName28);
53182
54030
  if (options === null) {
53183
54031
  if (key2) {
53184
54032
  delete chartContainer[key2];
@@ -53200,11 +54048,11 @@ function applyChartUpDownBars(chartContainer, options, localName28, resolveColor
53200
54048
  if (!style) {
53201
54049
  continue;
53202
54050
  }
53203
- const existingBar = findKey12(node, name, localName28);
54051
+ const existingBar = findKey13(node, name, localName28);
53204
54052
  const bar = {
53205
54053
  ...existingBar ? node[existingBar] : void 0
53206
54054
  };
53207
- const spPrKey = findKey12(bar, "spPr", localName28) ?? "c:spPr";
54055
+ const spPrKey = findKey13(bar, "spPr", localName28) ?? "c:spPr";
53208
54056
  bar[spPrKey] = writeChartShapeProps(
53209
54057
  bar[spPrKey],
53210
54058
  style,
@@ -53215,7 +54063,7 @@ function applyChartUpDownBars(chartContainer, options, localName28, resolveColor
53215
54063
  }
53216
54064
  setOrdered2(chartContainer, "upDownBars", node, CONTAINER_ORDER, localName28);
53217
54065
  }
53218
- var CONTAINER_ORDER, findKey12;
54066
+ var CONTAINER_ORDER, findKey13;
53219
54067
  var init_chart_up_down_bars = __esm({
53220
54068
  "src/pptx/core/utils/chart-up-down-bars.ts"() {
53221
54069
  init_chart_percent_union_value();
@@ -53234,7 +54082,7 @@ var init_chart_up_down_bars = __esm({
53234
54082
  "axId",
53235
54083
  "extLst"
53236
54084
  ];
53237
- findKey12 = (node, name, localName28) => Object.keys(node).find((key2) => localName28(key2) === name);
54085
+ findKey13 = (node, name, localName28) => Object.keys(node).find((key2) => localName28(key2) === name);
53238
54086
  }
53239
54087
  });
53240
54088
 
@@ -60587,9 +61435,7 @@ function applyCellBorderStyle(cellProperties, style, context) {
60587
61435
  }
60588
61436
  const widthEmu = parseInt(String(node["@_w"] || "0"), 10);
60589
61437
  if (widthEmu > 0) {
60590
- style[`${prefix}Width`] = Math.round(
60591
- widthEmu / context.emuPerPx
60592
- );
61438
+ style[`${prefix}Width`] = widthEmu / context.emuPerPx;
60593
61439
  hasStyle = true;
60594
61440
  }
60595
61441
  const color2 = context.parseColor(node["a:solidFill"]);
@@ -60619,7 +61465,7 @@ function applyCellBorderStyle(cellProperties, style, context) {
60619
61465
  hasStyle = true;
60620
61466
  }
60621
61467
  if (w > 0) {
60622
- style.borderDiagDownWidth = Math.round(w / context.emuPerPx);
61468
+ style.borderDiagDownWidth = w / context.emuPerPx;
60623
61469
  hasStyle = true;
60624
61470
  }
60625
61471
  }
@@ -60632,7 +61478,7 @@ function applyCellBorderStyle(cellProperties, style, context) {
60632
61478
  hasStyle = true;
60633
61479
  }
60634
61480
  if (w > 0) {
60635
- style.borderDiagUpWidth = Math.round(w / context.emuPerPx);
61481
+ style.borderDiagUpWidth = w / context.emuPerPx;
60636
61482
  hasStyle = true;
60637
61483
  }
60638
61484
  }
@@ -60650,7 +61496,7 @@ function applyCellMarginStyle(cellProperties, style, context) {
60650
61496
  return void 0;
60651
61497
  }
60652
61498
  const w = parseInt(String(node["@_w"]), 10);
60653
- return Number.isFinite(w) && w >= 0 ? Math.round(w / context.emuPerPx) : void 0;
61499
+ return Number.isFinite(w) && w >= 0 ? w / context.emuPerPx : void 0;
60654
61500
  };
60655
61501
  const ml = parseMargin(tcMar["a:marL"]);
60656
61502
  const mr = parseMargin(tcMar["a:marR"]);
@@ -60684,7 +61530,7 @@ function applyCellMarginStyle(cellProperties, style, context) {
60684
61530
  if (style[key2] === void 0 && raw !== void 0 && raw !== null) {
60685
61531
  const v = parseInt(String(raw), 10);
60686
61532
  if (Number.isFinite(v) && v >= 0) {
60687
- style[key2] = Math.round(v / context.emuPerPx);
61533
+ style[key2] = v / context.emuPerPx;
60688
61534
  hasStyle = true;
60689
61535
  }
60690
61536
  }
@@ -60980,6 +61826,10 @@ function applyRunProperties(run, runProperties2, context) {
60980
61826
  if (fontFamily) {
60981
61827
  run.fontFamily = fontFamily;
60982
61828
  }
61829
+ const baseline = parseInt(String(runProperties2["@_baseline"] ?? ""), 10);
61830
+ if (Number.isFinite(baseline) && baseline !== 0) {
61831
+ run.baseline = baseline;
61832
+ }
60983
61833
  }
60984
61834
  function extractTableCellTextRuns(tableCell, context) {
60985
61835
  const paragraphs = context.ensureArray(
@@ -89238,7 +90088,7 @@ function parseEmbeddedFontList(presentationData) {
89238
90088
  };
89239
90089
  }
89240
90090
  function applyAttribute(node, name, value) {
89241
- const key2 = findKey13(node, name);
90091
+ const key2 = findKey14(node, name);
89242
90092
  if (value === null) {
89243
90093
  if (key2) {
89244
90094
  delete node[key2];
@@ -89286,7 +90136,7 @@ function serializeEntry(entry) {
89286
90136
  }
89287
90137
  for (const name of ENTRY_ORDER) {
89288
90138
  const edit = edits.get(name);
89289
- const key2 = findKey13(source, name) ?? `p:${name}`;
90139
+ const key2 = findKey14(source, name) ?? `p:${name}`;
89290
90140
  if (edit !== null && edit !== void 0) {
89291
90141
  result[key2] = edit;
89292
90142
  } else if (!edits.has(name) && source[key2] !== void 0) {
@@ -89305,7 +90155,7 @@ function serializeEmbeddedFontList(list2) {
89305
90155
  throw new Error("CT_EmbeddedFontList requires at least one embeddedFont");
89306
90156
  }
89307
90157
  const source = { ...list2.rawXml ?? {} };
89308
- const key2 = findKey13(source, "embeddedFont") ?? "p:embeddedFont";
90158
+ const key2 = findKey14(source, "embeddedFont") ?? "p:embeddedFont";
89309
90159
  source[key2] = list2.fonts.map(serializeEntry);
89310
90160
  return source;
89311
90161
  }
@@ -89315,7 +90165,7 @@ function setEmbeddedFontList(presentationData, list2) {
89315
90165
  return;
89316
90166
  }
89317
90167
  const root = presentationData[rootKey];
89318
- const existingKey = findKey13(root, "embeddedFontLst");
90168
+ const existingKey = findKey14(root, "embeddedFontLst");
89319
90169
  const result = {};
89320
90170
  let inserted = false;
89321
90171
  for (const [key2, value] of Object.entries(root)) {
@@ -89334,7 +90184,7 @@ function setEmbeddedFontList(presentationData, list2) {
89334
90184
  }
89335
90185
  presentationData[rootKey] = result;
89336
90186
  }
89337
- var ENTRY_ORDER, PRESENTATION_BEFORE, localName16, findKey13, child16, children11;
90187
+ var ENTRY_ORDER, PRESENTATION_BEFORE, localName16, findKey14, child16, children11;
89338
90188
  var init_embedded_font_list = __esm({
89339
90189
  "src/pptx/core/utils/embedded-font-list.ts"() {
89340
90190
  ENTRY_ORDER = ["font", "regular", "bold", "italic", "boldItalic"];
@@ -89348,13 +90198,13 @@ var init_embedded_font_list = __esm({
89348
90198
  "smartTags"
89349
90199
  ]);
89350
90200
  localName16 = (key2) => key2.replace(/^@_/u, "").replace(/^.*:/u, "");
89351
- findKey13 = (node, name) => Object.keys(node).find((key2) => localName16(key2) === name);
90201
+ findKey14 = (node, name) => Object.keys(node).find((key2) => localName16(key2) === name);
89352
90202
  child16 = (node, name) => {
89353
- const key2 = findKey13(node, name);
90203
+ const key2 = findKey14(node, name);
89354
90204
  return key2 ? node[key2] : void 0;
89355
90205
  };
89356
90206
  children11 = (node, name) => {
89357
- const key2 = findKey13(node, name);
90207
+ const key2 = findKey14(node, name);
89358
90208
  const value = key2 ? node[key2] : void 0;
89359
90209
  return Array.isArray(value) ? value : value ? [value] : [];
89360
90210
  };
@@ -89869,7 +90719,7 @@ function parseChartBandFmts(seriesContainer, xmlLookup, colorParser) {
89869
90719
  return result.length > 0 ? result : void 0;
89870
90720
  }
89871
90721
  function setOrdered3(node, name, value, order, localName28) {
89872
- const key2 = findKey14(node, name, localName28);
90722
+ const key2 = findKey15(node, name, localName28);
89873
90723
  if (key2) {
89874
90724
  node[key2] = value;
89875
90725
  return;
@@ -89892,7 +90742,7 @@ function applyChartBandFmts(seriesContainer, bandFmts, localName28, resolveColor
89892
90742
  if (bandFmts === void 0) {
89893
90743
  return;
89894
90744
  }
89895
- const containerKey = findKey14(seriesContainer, "bandFmts", localName28);
90745
+ const containerKey = findKey15(seriesContainer, "bandFmts", localName28);
89896
90746
  if (bandFmts.length === 0) {
89897
90747
  if (containerKey) {
89898
90748
  delete seriesContainer[containerKey];
@@ -89900,11 +90750,11 @@ function applyChartBandFmts(seriesContainer, bandFmts, localName28, resolveColor
89900
90750
  return;
89901
90751
  }
89902
90752
  const bandFmtsNode = containerKey ? seriesContainer[containerKey] : void 0;
89903
- const bandFmtKey = bandFmtsNode ? findKey14(bandFmtsNode, "bandFmt", localName28) : void 0;
90753
+ const bandFmtKey = bandFmtsNode ? findKey15(bandFmtsNode, "bandFmt", localName28) : void 0;
89904
90754
  const existingRaw = bandFmtKey ? bandFmtsNode?.[bandFmtKey] : void 0;
89905
90755
  const existingNodes = existingRaw ? Array.isArray(existingRaw) ? existingRaw : [existingRaw] : [];
89906
90756
  const bandIndexOf = (node) => {
89907
- const idxKey = findKey14(node, "idx", localName28);
90757
+ const idxKey = findKey15(node, "idx", localName28);
89908
90758
  return idxKey ? safeUnsignedInt2(node[idxKey]?.["@_val"]) : void 0;
89909
90759
  };
89910
90760
  const byIndex = new Map(existingNodes.map((node) => [bandIndexOf(node), node]));
@@ -89916,7 +90766,7 @@ function applyChartBandFmts(seriesContainer, bandFmts, localName28, resolveColor
89916
90766
  updated.push(node);
89917
90767
  }
89918
90768
  if (band.spPr) {
89919
- const spPrKey = findKey14(node, "spPr", localName28);
90769
+ const spPrKey = findKey15(node, "spPr", localName28);
89920
90770
  const spPr = writeChartShapeProps(
89921
90771
  spPrKey ? node[spPrKey] : void 0,
89922
90772
  band.spPr,
@@ -89934,12 +90784,12 @@ function applyChartBandFmts(seriesContainer, bandFmts, localName28, resolveColor
89934
90784
  localName28
89935
90785
  );
89936
90786
  }
89937
- var findKey14;
90787
+ var findKey15;
89938
90788
  var init_chart_band_fmts = __esm({
89939
90789
  "src/pptx/core/utils/chart-band-fmts.ts"() {
89940
90790
  init_chart_series_detail_parser();
89941
90791
  init_chart_shape_props_writer();
89942
- findKey14 = (node, name, localName28) => Object.keys(node).find((key2) => localName28(key2) === name);
90792
+ findKey15 = (node, name, localName28) => Object.keys(node).find((key2) => localName28(key2) === name);
89943
90793
  }
89944
90794
  });
89945
90795
 
@@ -89989,142 +90839,6 @@ var init_chart_blank_values = __esm({
89989
90839
  }
89990
90840
  });
89991
90841
 
89992
- // src/pptx/core/utils/chart-container-content-model.ts
89993
- function chartTypeToContainerLocalName(chartType) {
89994
- return TYPE_TO_CONTAINER[chartType];
89995
- }
89996
- function isKnownChartContainer(containerLocal) {
89997
- return containerLocal in CHART_CONTAINER_CHILD_ORDER;
89998
- }
89999
- function chartContainerAllows(containerLocal, childLocal) {
90000
- const order = CHART_CONTAINER_CHILD_ORDER[containerLocal];
90001
- return order !== void 0 && order.includes(childLocal);
90002
- }
90003
- var CHART_CONTAINER_CHILD_ORDER, REQUIRED_LEADING_CHILD, TYPE_TO_CONTAINER, AXIS_LOCAL_NAMES;
90004
- var init_chart_container_content_model = __esm({
90005
- "src/pptx/core/utils/chart-container-content-model.ts"() {
90006
- CHART_CONTAINER_CHILD_ORDER = {
90007
- areaChart: ["grouping", "varyColors", "ser", "dLbls", "dropLines", "axId", "extLst"],
90008
- area3DChart: [
90009
- "grouping",
90010
- "varyColors",
90011
- "ser",
90012
- "dLbls",
90013
- "dropLines",
90014
- "gapDepth",
90015
- "axId",
90016
- "extLst"
90017
- ],
90018
- barChart: [
90019
- "barDir",
90020
- "grouping",
90021
- "varyColors",
90022
- "ser",
90023
- "dLbls",
90024
- "gapWidth",
90025
- "overlap",
90026
- "serLines",
90027
- "axId",
90028
- "extLst"
90029
- ],
90030
- bar3DChart: [
90031
- "barDir",
90032
- "grouping",
90033
- "varyColors",
90034
- "ser",
90035
- "dLbls",
90036
- "gapWidth",
90037
- "gapDepth",
90038
- "shape",
90039
- "axId",
90040
- "extLst"
90041
- ],
90042
- bubbleChart: [
90043
- "varyColors",
90044
- "ser",
90045
- "dLbls",
90046
- "bubble3D",
90047
- "bubbleScale",
90048
- "showNegBubbles",
90049
- "sizeRepresents",
90050
- "axId",
90051
- "extLst"
90052
- ],
90053
- doughnutChart: ["varyColors", "ser", "dLbls", "firstSliceAng", "holeSize", "extLst"],
90054
- lineChart: [
90055
- "grouping",
90056
- "varyColors",
90057
- "ser",
90058
- "dLbls",
90059
- "dropLines",
90060
- "hiLowLines",
90061
- "upDownBars",
90062
- "marker",
90063
- "smooth",
90064
- "axId",
90065
- "extLst"
90066
- ],
90067
- line3DChart: [
90068
- "grouping",
90069
- "varyColors",
90070
- "ser",
90071
- "dLbls",
90072
- "dropLines",
90073
- "gapDepth",
90074
- "axId",
90075
- "extLst"
90076
- ],
90077
- ofPieChart: [
90078
- "ofPieType",
90079
- "varyColors",
90080
- "ser",
90081
- "dLbls",
90082
- "gapWidth",
90083
- "splitType",
90084
- "splitPos",
90085
- "custSplit",
90086
- "secondPieSize",
90087
- "serLines",
90088
- "extLst"
90089
- ],
90090
- pieChart: ["varyColors", "ser", "dLbls", "firstSliceAng", "extLst"],
90091
- pie3DChart: ["varyColors", "ser", "dLbls", "extLst"],
90092
- radarChart: ["radarStyle", "varyColors", "ser", "dLbls", "axId", "extLst"],
90093
- scatterChart: ["scatterStyle", "varyColors", "ser", "dLbls", "axId", "extLst"],
90094
- stockChart: ["ser", "dLbls", "dropLines", "hiLowLines", "upDownBars", "axId", "extLst"],
90095
- surfaceChart: ["wireframe", "ser", "bandFmts", "axId", "extLst"],
90096
- surface3DChart: ["wireframe", "ser", "bandFmts", "axId", "extLst"]
90097
- };
90098
- REQUIRED_LEADING_CHILD = {
90099
- barChart: { local: "barDir", val: "col" },
90100
- bar3DChart: { local: "barDir", val: "col" },
90101
- lineChart: { local: "grouping", val: "standard" },
90102
- line3DChart: { local: "grouping", val: "standard" },
90103
- ofPieChart: { local: "ofPieType", val: "pie" },
90104
- radarChart: { local: "radarStyle", val: "marker" },
90105
- scatterChart: { local: "scatterStyle", val: "lineMarker" }
90106
- };
90107
- TYPE_TO_CONTAINER = {
90108
- area: "areaChart",
90109
- area3D: "area3DChart",
90110
- bar: "barChart",
90111
- bar3D: "bar3DChart",
90112
- bubble: "bubbleChart",
90113
- doughnut: "doughnutChart",
90114
- line: "lineChart",
90115
- line3D: "line3DChart",
90116
- ofPie: "ofPieChart",
90117
- pie: "pieChart",
90118
- pie3D: "pie3DChart",
90119
- radar: "radarChart",
90120
- scatter: "scatterChart",
90121
- stock: "stockChart",
90122
- surface: "surfaceChart"
90123
- };
90124
- AXIS_LOCAL_NAMES = ["catAx", "valAx", "dateAx", "serAx"];
90125
- }
90126
- });
90127
-
90128
90842
  // src/pptx/core/utils/chart-container-type-map.ts
90129
90843
  function chartContainerLocalNameToType(localName28) {
90130
90844
  return CONTAINER_LOCAL_NAME_TO_TYPE[localName28];
@@ -90184,7 +90898,7 @@ var init_chart_date_categories = __esm({
90184
90898
  });
90185
90899
 
90186
90900
  // src/pptx/core/utils/chart-filtered-series.ts
90187
- function localNameOf9(key2) {
90901
+ function localNameOf10(key2) {
90188
90902
  return key2.replace(/^.*:/u, "");
90189
90903
  }
90190
90904
  function scalarChild(parent, name, xmlLookup) {
@@ -90264,7 +90978,7 @@ function parseOneFilteredSeries(node, xmlLookup) {
90264
90978
  if (values.length > 0) {
90265
90979
  result.values = values;
90266
90980
  }
90267
- const uniqueId = parseChartUniqueId(node, localNameOf9);
90981
+ const uniqueId = parseChartUniqueId(node, localNameOf10);
90268
90982
  if (uniqueId) {
90269
90983
  result.uniqueId = uniqueId;
90270
90984
  }
@@ -90282,7 +90996,7 @@ function parseFilteredSeries(container2, xmlLookup) {
90282
90996
  if (!ext) {
90283
90997
  return void 0;
90284
90998
  }
90285
- const wrapperKey = Object.keys(ext).find((key2) => /^filtered.*series$/iu.test(localNameOf9(key2)));
90999
+ const wrapperKey = Object.keys(ext).find((key2) => /^filtered.*series$/iu.test(localNameOf10(key2)));
90286
91000
  if (!wrapperKey) {
90287
91001
  return void 0;
90288
91002
  }
@@ -94170,7 +94884,7 @@ function parsePrintProperties(node) {
94170
94884
  };
94171
94885
  }
94172
94886
  function applyAttribute2(node, name, value) {
94173
- const existingKey = findKey15(node, name);
94887
+ const existingKey = findKey16(node, name);
94174
94888
  if (value === null) {
94175
94889
  if (existingKey) {
94176
94890
  delete node[existingKey];
@@ -94205,14 +94919,14 @@ function serializePrintProperties(properties) {
94205
94919
  result[key2] = value;
94206
94920
  }
94207
94921
  }
94208
- const extKey = findKey15(source, "extLst");
94922
+ const extKey = findKey16(source, "extLst");
94209
94923
  if (extKey) {
94210
94924
  result[extKey] = source[extKey];
94211
94925
  }
94212
94926
  return result;
94213
94927
  }
94214
94928
  function findChildByLocalName2(parent, name) {
94215
- const key2 = findKey15(parent, name);
94929
+ const key2 = findKey16(parent, name);
94216
94930
  return key2 ? parent[key2] : void 0;
94217
94931
  }
94218
94932
  function setPresentationPropertiesChild(root, name, value) {
@@ -94251,7 +94965,7 @@ function slidesPerPageToPrintOutput(value) {
94251
94965
  }
94252
94966
  return `handouts${value}`;
94253
94967
  }
94254
- var PRINT_OUTPUTS, COLOR_MODES, ROOT_ORDER, localName20, findKey15;
94968
+ var PRINT_OUTPUTS, COLOR_MODES, ROOT_ORDER, localName20, findKey16;
94255
94969
  var init_pptx_print_properties = __esm({
94256
94970
  "src/pptx/core/core/runtime/pptx-print-properties.ts"() {
94257
94971
  PRINT_OUTPUTS = /* @__PURE__ */ new Set([
@@ -94268,7 +94982,7 @@ var init_pptx_print_properties = __esm({
94268
94982
  COLOR_MODES = /* @__PURE__ */ new Set(["bw", "gray", "clr"]);
94269
94983
  ROOT_ORDER = ["htmlPubPr", "webPr", "prnPr", "showPr", "clrMru", "extLst"];
94270
94984
  localName20 = (key2) => key2.replace(/^@_/u, "").replace(/^.*:/u, "");
94271
- findKey15 = (node, name) => Object.keys(node).find((key2) => localName20(key2) === name);
94985
+ findKey16 = (node, name) => Object.keys(node).find((key2) => localName20(key2) === name);
94272
94986
  }
94273
94987
  });
94274
94988
 
@@ -99759,7 +100473,7 @@ var init_chart_cx_generator = __esm({
99759
100473
  });
99760
100474
 
99761
100475
  // src/pptx/core/utils/chart-data-labels-serializer.ts
99762
- function findKey16(obj, local, getLocalName2) {
100476
+ function findKey17(obj, local, getLocalName2) {
99763
100477
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
99764
100478
  }
99765
100479
  function boolVal(on) {
@@ -99833,7 +100547,7 @@ function applyChartDataLabelsToXml(plotArea, style, getLocalName2) {
99833
100547
  if (!container2 || typeof container2 !== "object") {
99834
100548
  continue;
99835
100549
  }
99836
- const existingKey = findKey16(container2, "dLbls", getLocalName2);
100550
+ const existingKey = findKey17(container2, "dLbls", getLocalName2);
99837
100551
  if (style.hasDataLabels === false) {
99838
100552
  const existing2 = existingKey ? container2[existingKey] : void 0;
99839
100553
  const off = ordered3(existing2, { "c:delete": { "@_val": "1" } }, getLocalName2);
@@ -99911,11 +100625,11 @@ var init_chart_data_labels_serializer = __esm({
99911
100625
  });
99912
100626
 
99913
100627
  // src/pptx/core/utils/chart-data-table.ts
99914
- function findKey17(node, name, localName28) {
100628
+ function findKey18(node, name, localName28) {
99915
100629
  return Object.keys(node).find((key2) => localName28(key2) === name);
99916
100630
  }
99917
100631
  function setOrdered4(node, name, value, order, localName28) {
99918
- const existingKey = findKey17(node, name, localName28);
100632
+ const existingKey = findKey18(node, name, localName28);
99919
100633
  if (existingKey) {
99920
100634
  node[existingKey] = value;
99921
100635
  return;
@@ -99938,7 +100652,7 @@ function applyChartDataTable(plotArea, dataTable, localName28, resolveColor2) {
99938
100652
  if (dataTable === void 0) {
99939
100653
  return;
99940
100654
  }
99941
- const tableKey = findKey17(plotArea, "dTable", localName28);
100655
+ const tableKey = findKey18(plotArea, "dTable", localName28);
99942
100656
  if (dataTable === null) {
99943
100657
  if (tableKey) {
99944
100658
  delete plotArea[tableKey];
@@ -99955,7 +100669,7 @@ function applyChartDataTable(plotArea, dataTable, localName28, resolveColor2) {
99955
100669
  }
99956
100670
  }
99957
100671
  if (dataTable.spPr) {
99958
- const spPrKey = findKey17(table, "spPr", localName28);
100672
+ const spPrKey = findKey18(table, "spPr", localName28);
99959
100673
  const spPr = writeChartShapeProps(
99960
100674
  spPrKey ? table[spPrKey] : void 0,
99961
100675
  dataTable.spPr,
@@ -99965,13 +100679,13 @@ function applyChartDataTable(plotArea, dataTable, localName28, resolveColor2) {
99965
100679
  setOrdered4(table, "spPr", spPr, TABLE_ORDER, localName28);
99966
100680
  }
99967
100681
  if (dataTable.txPr) {
99968
- const txPrKey = findKey17(table, "txPr", localName28);
100682
+ const txPrKey = findKey18(table, "txPr", localName28);
99969
100683
  const authoredDefRPr = resolveTxPrDefRPr(txPrKey ? table[txPrKey] : void 0, {
99970
100684
  getChildByLocalName: (parent, name) => {
99971
100685
  if (!parent) {
99972
100686
  return void 0;
99973
100687
  }
99974
- const key2 = findKey17(parent, name, localName28);
100688
+ const key2 = findKey18(parent, name, localName28);
99975
100689
  return key2 ? parent[key2] : void 0;
99976
100690
  }
99977
100691
  });
@@ -100031,7 +100745,7 @@ var init_chart_data_table = __esm({
100031
100745
  });
100032
100746
 
100033
100747
  // src/pptx/core/utils/chart-errbars-serializer.ts
100034
- function findKey18(obj, local, getLocalName2) {
100748
+ function findKey19(obj, local, getLocalName2) {
100035
100749
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
100036
100750
  }
100037
100751
  function ensureArray14(v) {
@@ -100074,7 +100788,7 @@ function buildErrBars(existing, e, getLocalName2, resolveColor2) {
100074
100788
  if (e.noEndCap !== void 0) {
100075
100789
  node["c:noEndCap"] = { "@_val": e.noEndCap ? "1" : "0" };
100076
100790
  } else if (existing) {
100077
- const noEndCapKey = findKey18(existing, "noEndCap", getLocalName2);
100791
+ const noEndCapKey = findKey19(existing, "noEndCap", getLocalName2);
100078
100792
  if (noEndCapKey) {
100079
100793
  node["c:noEndCap"] = existing[noEndCapKey];
100080
100794
  }
@@ -100089,7 +100803,7 @@ function buildErrBars(existing, e, getLocalName2, resolveColor2) {
100089
100803
  } else if (e.val !== void 0) {
100090
100804
  node["c:val"] = { "@_val": String(e.val) };
100091
100805
  }
100092
- const spPrKey = existing ? findKey18(existing, "spPr", getLocalName2) : void 0;
100806
+ const spPrKey = existing ? findKey19(existing, "spPr", getLocalName2) : void 0;
100093
100807
  const existingSpPr = spPrKey ? existing?.[spPrKey] : void 0;
100094
100808
  if (e.color || e.width !== void 0 || e.dashStyle) {
100095
100809
  node["c:spPr"] = buildSpPr(existingSpPr, e, getLocalName2, resolveColor2);
@@ -100097,7 +100811,7 @@ function buildErrBars(existing, e, getLocalName2, resolveColor2) {
100097
100811
  node["c:spPr"] = existingSpPr;
100098
100812
  }
100099
100813
  if (existing) {
100100
- const extKey = findKey18(existing, "extLst", getLocalName2);
100814
+ const extKey = findKey19(existing, "extLst", getLocalName2);
100101
100815
  if (extKey) {
100102
100816
  node["c:extLst"] = existing[extKey];
100103
100817
  }
@@ -100105,7 +100819,7 @@ function buildErrBars(existing, e, getLocalName2, resolveColor2) {
100105
100819
  return node;
100106
100820
  }
100107
100821
  function applySeriesErrBarsToXml(seriesNode, errBars, getLocalName2, resolveColor2) {
100108
- const existingKey = findKey18(seriesNode, "errBars", getLocalName2);
100822
+ const existingKey = findKey19(seriesNode, "errBars", getLocalName2);
100109
100823
  const existingNodes = existingKey ? ensureArray14(seriesNode[existingKey]) : [];
100110
100824
  const built = errBars.map(
100111
100825
  (e, i) => buildErrBars(existingNodes[i], e, getLocalName2, resolveColor2)
@@ -100139,7 +100853,7 @@ var init_chart_errbars_serializer = __esm({
100139
100853
  });
100140
100854
 
100141
100855
  // src/pptx/core/utils/chart-series-datalabel-build.ts
100142
- function findKey19(obj, local, getLocalName2) {
100856
+ function findKey20(obj, local, getLocalName2) {
100143
100857
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
100144
100858
  }
100145
100859
  function boolVal2(on) {
@@ -100188,7 +100902,7 @@ function buildDLbl(existing, label, getLocalName2, resolveColor2) {
100188
100902
  node["c:delete"] = { "@_val": "0" };
100189
100903
  }
100190
100904
  if (existing && label.layout === void 0) {
100191
- const layoutKey = findKey19(existing, "layout", getLocalName2);
100905
+ const layoutKey = findKey20(existing, "layout", getLocalName2);
100192
100906
  if (layoutKey) {
100193
100907
  node[layoutKey] = existing[layoutKey];
100194
100908
  }
@@ -100207,7 +100921,7 @@ function buildDLbl(existing, label, getLocalName2, resolveColor2) {
100207
100921
  }
100208
100922
  };
100209
100923
  } else if (existing) {
100210
- const txKey = findKey19(existing, "tx", getLocalName2);
100924
+ const txKey = findKey20(existing, "tx", getLocalName2);
100211
100925
  if (txKey) {
100212
100926
  node[txKey] = existing[txKey];
100213
100927
  }
@@ -100223,7 +100937,7 @@ function buildDLbl(existing, label, getLocalName2, resolveColor2) {
100223
100937
  if (local === "txPr" && label.txPr !== void 0) {
100224
100938
  continue;
100225
100939
  }
100226
- const k = findKey19(existing, local, getLocalName2);
100940
+ const k = findKey20(existing, local, getLocalName2);
100227
100941
  if (k) {
100228
100942
  node[k] = existing[k];
100229
100943
  }
@@ -100235,15 +100949,15 @@ function buildDLbl(existing, label, getLocalName2, resolveColor2) {
100235
100949
  }
100236
100950
  if (label.spPr !== void 0) {
100237
100951
  replaced.add("spPr");
100238
- const existingSpPr = existing ? existing[findKey19(existing, "spPr", getLocalName2) ?? ""] : void 0;
100952
+ const existingSpPr = existing ? existing[findKey20(existing, "spPr", getLocalName2) ?? ""] : void 0;
100239
100953
  node["c:spPr"] = writeChartShapeProps(existingSpPr, label.spPr, getLocalName2, resolveColor2);
100240
100954
  }
100241
100955
  if (label.txPr !== void 0) {
100242
100956
  replaced.add("txPr");
100243
- const existingTxPr = existing ? existing[findKey19(existing, "txPr", getLocalName2) ?? ""] : void 0;
100244
- const paragraph = existingTxPr ? existingTxPr[findKey19(existingTxPr, "p", getLocalName2) ?? ""] : void 0;
100245
- const pPr = paragraph ? paragraph[findKey19(paragraph, "pPr", getLocalName2) ?? ""] : void 0;
100246
- const authoredDefRPr = pPr ? pPr[findKey19(pPr, "defRPr", getLocalName2) ?? ""] : void 0;
100957
+ const existingTxPr = existing ? existing[findKey20(existing, "txPr", getLocalName2) ?? ""] : void 0;
100958
+ const paragraph = existingTxPr ? existingTxPr[findKey20(existingTxPr, "p", getLocalName2) ?? ""] : void 0;
100959
+ const pPr = paragraph ? paragraph[findKey20(paragraph, "pPr", getLocalName2) ?? ""] : void 0;
100960
+ const authoredDefRPr = pPr ? pPr[findKey20(pPr, "defRPr", getLocalName2) ?? ""] : void 0;
100247
100961
  const txPr = buildDefRPrTextProperties(label.txPr, authoredDefRPr, resolveColor2);
100248
100962
  if (txPr) {
100249
100963
  node["c:txPr"] = txPr;
@@ -100313,17 +101027,17 @@ var init_chart_series_datalabel_build = __esm({
100313
101027
 
100314
101028
  // src/pptx/core/utils/chart-series-datalabel-serializer.ts
100315
101029
  function applySeriesDataLabelsToXml(seriesNode, dataLabels, getLocalName2, resolveColor2) {
100316
- const dLblsKey = findKey19(seriesNode, "dLbls", getLocalName2);
101030
+ const dLblsKey = findKey20(seriesNode, "dLbls", getLocalName2);
100317
101031
  const labels = dataLabels ?? [];
100318
101032
  const existingByIdx = /* @__PURE__ */ new Map();
100319
101033
  let groupChildren = [];
100320
101034
  if (dLblsKey) {
100321
101035
  const dLbls = seriesNode[dLblsKey];
100322
- const dLblKey = findKey19(dLbls, "dLbl", getLocalName2);
101036
+ const dLblKey = findKey20(dLbls, "dLbl", getLocalName2);
100323
101037
  if (dLblKey) {
100324
101038
  const nodes = Array.isArray(dLbls[dLblKey]) ? dLbls[dLblKey] : [dLbls[dLblKey]];
100325
101039
  for (const node of nodes) {
100326
- const idxKey = findKey19(node, "idx", getLocalName2);
101040
+ const idxKey = findKey20(node, "idx", getLocalName2);
100327
101041
  const idxNode = idxKey ? node[idxKey] : void 0;
100328
101042
  const idx = idxNode ? Number.parseInt(String(idxNode["@_val"]), 10) : NaN;
100329
101043
  if (Number.isFinite(idx)) {
@@ -100412,7 +101126,7 @@ var init_chart_space_metadata = __esm({
100412
101126
  });
100413
101127
 
100414
101128
  // src/pptx/core/utils/chart-trendline-serializer.ts
100415
- function findKey20(obj, local, getLocalName2) {
101129
+ function findKey21(obj, local, getLocalName2) {
100416
101130
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
100417
101131
  }
100418
101132
  function ensureArray15(v) {
@@ -100451,14 +101165,14 @@ function buildSpPr2(existing, t, getLocalName2, resolveColor2) {
100451
101165
  function buildTrendline(existing, t, getLocalName2, resolveColor2) {
100452
101166
  validateTrendline(t);
100453
101167
  const node = {};
100454
- const existingNameKey = existing ? findKey20(existing, "name", getLocalName2) : void 0;
101168
+ const existingNameKey = existing ? findKey21(existing, "name", getLocalName2) : void 0;
100455
101169
  if (t.name !== void 0) {
100456
101170
  node["c:name"] = t.name;
100457
101171
  } else if (existing && existingNameKey) {
100458
101172
  node["c:name"] = existing[existingNameKey];
100459
101173
  }
100460
101174
  const spPr = buildSpPr2(
100461
- existing ? existing[findKey20(existing, "spPr", getLocalName2) ?? ""] : void 0,
101175
+ existing ? existing[findKey21(existing, "spPr", getLocalName2) ?? ""] : void 0,
100462
101176
  t,
100463
101177
  getLocalName2,
100464
101178
  resolveColor2
@@ -100488,7 +101202,7 @@ function buildTrendline(existing, t, getLocalName2, resolveColor2) {
100488
101202
  if (t.displayEq !== void 0) {
100489
101203
  node["c:dispEq"] = { "@_val": t.displayEq ? "1" : "0" };
100490
101204
  }
100491
- const lblKey = existing ? findKey20(existing, "trendlineLbl", getLocalName2) : void 0;
101205
+ const lblKey = existing ? findKey21(existing, "trendlineLbl", getLocalName2) : void 0;
100492
101206
  if (t.label) {
100493
101207
  node["c:trendlineLbl"] = buildTrendlineLabel(
100494
101208
  lblKey ? existing?.[lblKey] : void 0,
@@ -100499,7 +101213,7 @@ function buildTrendline(existing, t, getLocalName2, resolveColor2) {
100499
101213
  node["c:trendlineLbl"] = existing[lblKey];
100500
101214
  }
100501
101215
  if (existing) {
100502
- const extKey = findKey20(existing, "extLst", getLocalName2);
101216
+ const extKey = findKey21(existing, "extLst", getLocalName2);
100503
101217
  if (extKey) {
100504
101218
  node["c:extLst"] = existing[extKey];
100505
101219
  }
@@ -100507,7 +101221,7 @@ function buildTrendline(existing, t, getLocalName2, resolveColor2) {
100507
101221
  return node;
100508
101222
  }
100509
101223
  function applySeriesTrendlinesToXml(seriesNode, trendlines, getLocalName2, resolveColor2) {
100510
- const existingKey = findKey20(seriesNode, "trendline", getLocalName2);
101224
+ const existingKey = findKey21(seriesNode, "trendline", getLocalName2);
100511
101225
  const existingNodes = existingKey ? ensureArray15(seriesNode[existingKey]) : [];
100512
101226
  const built = trendlines.map(
100513
101227
  (t, i) => buildTrendline(existingNodes[i], t, getLocalName2, resolveColor2)
@@ -100550,11 +101264,292 @@ var init_chart_trendline_serializer = __esm({
100550
101264
  }
100551
101265
  });
100552
101266
 
101267
+ // src/pptx/core/utils/chart-area-format.ts
101268
+ function findKey22(obj, local, getLocalName2) {
101269
+ return Object.keys(obj).find((key2) => getLocalName2(key2) === local);
101270
+ }
101271
+ function asObject(value) {
101272
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
101273
+ }
101274
+ function parsePaint(node, getLocalName2, resolveColor2) {
101275
+ if (!node) {
101276
+ return void 0;
101277
+ }
101278
+ if (findKey22(node, "noFill", getLocalName2) !== void 0) {
101279
+ return "none";
101280
+ }
101281
+ const solid = asObject(node[findKey22(node, "solidFill", getLocalName2) ?? ""]);
101282
+ return solid ? resolveColor2(solid) : void 0;
101283
+ }
101284
+ function parseChartAreaFormat(owner, getLocalName2, resolveColor2, parseGradient) {
101285
+ const spPr = owner ? asObject(owner[findKey22(owner, "spPr", getLocalName2) ?? ""]) : void 0;
101286
+ if (!spPr) {
101287
+ return {};
101288
+ }
101289
+ const format = {};
101290
+ const fill = parsePaint(spPr, getLocalName2, resolveColor2);
101291
+ if (fill !== void 0) {
101292
+ format.fill = fill;
101293
+ }
101294
+ const gradient = parseGradient?.(spPr);
101295
+ if (gradient) {
101296
+ format.gradient = gradient;
101297
+ }
101298
+ const ln = asObject(spPr[findKey22(spPr, "ln", getLocalName2) ?? ""]);
101299
+ const border = parsePaint(ln, getLocalName2, resolveColor2);
101300
+ if (border !== void 0) {
101301
+ format.border = border;
101302
+ }
101303
+ return format;
101304
+ }
101305
+ function paintXml(paint) {
101306
+ return paint === "none" ? { "a:noFill": {} } : { "a:solidFill": { "a:srgbClr": { "@_val": chartColorHex(paint) } } };
101307
+ }
101308
+ function buildChartAreaSpPr(format) {
101309
+ const spPr = {};
101310
+ if (format.gradient) {
101311
+ spPr["a:gradFill"] = buildChartGradFillXml(format.gradient);
101312
+ } else if (format.fill !== void 0) {
101313
+ Object.assign(spPr, paintXml(format.fill));
101314
+ }
101315
+ if (format.border !== void 0) {
101316
+ spPr["a:ln"] = paintXml(format.border);
101317
+ }
101318
+ return Object.keys(spPr).length > 0 ? spPr : void 0;
101319
+ }
101320
+ function samePaint(a, b) {
101321
+ if (a === void 0 || b === void 0 || a === "none" || b === "none") {
101322
+ return a === b;
101323
+ }
101324
+ return colorsEqual(a, b);
101325
+ }
101326
+ function sameFill(model, authored) {
101327
+ if (model.gradient || authored.gradient) {
101328
+ return Boolean(
101329
+ model.gradient && authored.gradient && chartGradientsEqual(model.gradient, authored.gradient)
101330
+ );
101331
+ }
101332
+ return samePaint(model.fill, authored.fill);
101333
+ }
101334
+ function setPaint(node, entry, choices, after, getLocalName2) {
101335
+ const entries = Object.entries(node).filter(([key2]) => !choices.has(getLocalName2(key2)));
101336
+ if (entry) {
101337
+ const at2 = entries.findIndex(([key2]) => after.has(getLocalName2(key2)));
101338
+ entries.splice(at2 === -1 ? entries.length : at2, 0, entry);
101339
+ }
101340
+ for (const key2 of Object.keys(node)) {
101341
+ delete node[key2];
101342
+ }
101343
+ for (const [key2, value] of entries) {
101344
+ node[key2] = value;
101345
+ }
101346
+ }
101347
+ function paintEntry(paint, authored, getLocalName2, resolveColor2) {
101348
+ if (paint === void 0) {
101349
+ return void 0;
101350
+ }
101351
+ if (paint === "none") {
101352
+ return ["a:noFill", {}];
101353
+ }
101354
+ const solid = asObject(authored[findKey22(authored, "solidFill", getLocalName2) ?? ""]);
101355
+ return ["a:solidFill", chartColorChoiceValue(solid, paint, resolveColor2)];
101356
+ }
101357
+ function applyChartAreaFormatToXml(owner, format, getLocalName2, options) {
101358
+ const authored = parseChartAreaFormat(
101359
+ owner,
101360
+ getLocalName2,
101361
+ options.resolveColor,
101362
+ options.parseGradient
101363
+ );
101364
+ const fillChanged = !sameFill(format, authored);
101365
+ const borderChanged = !samePaint(format.border, authored.border);
101366
+ if (!fillChanged && !borderChanged) {
101367
+ return false;
101368
+ }
101369
+ let spPr = asObject(owner[findKey22(owner, "spPr", getLocalName2) ?? ""]);
101370
+ if (!spPr) {
101371
+ spPr = {};
101372
+ options.insertSpPr(owner, spPr);
101373
+ }
101374
+ if (fillChanged) {
101375
+ if (format.gradient) {
101376
+ applyChartGradientToSpPr(spPr, format.gradient, getLocalName2, options);
101377
+ } else {
101378
+ const entry = paintEntry(format.fill, spPr, getLocalName2, options.resolveColor);
101379
+ setPaint(spPr, entry, FILL_CHOICE2, /* @__PURE__ */ new Set(["ln", ...AFTER_LN]), getLocalName2);
101380
+ }
101381
+ }
101382
+ if (borderChanged) {
101383
+ const lnKey = findKey22(spPr, "ln", getLocalName2);
101384
+ const ln = asObject(lnKey ? spPr[lnKey] : void 0) ?? {};
101385
+ const entry = paintEntry(format.border, ln, getLocalName2, options.resolveColor);
101386
+ setPaint(
101387
+ ln,
101388
+ entry,
101389
+ LN_FILL_CHOICE,
101390
+ /* @__PURE__ */ new Set(["prstDash", "custDash", "round", "bevel", "miter", "headEnd", "tailEnd", "extLst"]),
101391
+ getLocalName2
101392
+ );
101393
+ if (Object.keys(ln).length === 0) {
101394
+ if (lnKey) {
101395
+ delete spPr[lnKey];
101396
+ }
101397
+ } else if (!lnKey) {
101398
+ setPaint(spPr, ["a:ln", ln], /* @__PURE__ */ new Set(), AFTER_LN, getLocalName2);
101399
+ }
101400
+ }
101401
+ if (Object.keys(spPr).length === 0) {
101402
+ const spPrKey = findKey22(owner, "spPr", getLocalName2);
101403
+ if (spPrKey) {
101404
+ delete owner[spPrKey];
101405
+ }
101406
+ }
101407
+ return true;
101408
+ }
101409
+ var FILL_CHOICE2, AFTER_LN, LN_FILL_CHOICE;
101410
+ var init_chart_area_format = __esm({
101411
+ "src/pptx/core/utils/chart-area-format.ts"() {
101412
+ init_chart_color_choice();
101413
+ init_chart_gradient_fill_writer();
101414
+ init_chart_gradient_fill_xml();
101415
+ init_color_xml_preservation();
101416
+ FILL_CHOICE2 = /* @__PURE__ */ new Set(["noFill", "solidFill", "gradFill", "blipFill", "pattFill", "grpFill"]);
101417
+ AFTER_LN = /* @__PURE__ */ new Set(["effectLst", "effectDag", "scene3d", "sp3d", "extLst"]);
101418
+ LN_FILL_CHOICE = /* @__PURE__ */ new Set(["noFill", "solidFill", "gradFill", "pattFill"]);
101419
+ }
101420
+ });
101421
+
101422
+ // src/pptx/core/utils/chart-space-format.ts
101423
+ function findKey23(obj, local, getLocalName2) {
101424
+ return Object.keys(obj).find((key2) => getLocalName2(key2) === local);
101425
+ }
101426
+ function insertBefore(node, key2, value, after, getLocalName2) {
101427
+ const entries = Object.entries(node);
101428
+ const at2 = entries.findIndex(
101429
+ ([candidate]) => !candidate.startsWith("@_") && after.has(getLocalName2(candidate))
101430
+ );
101431
+ entries.splice(at2 === -1 ? entries.length : at2, 0, [key2, value]);
101432
+ for (const candidate of Object.keys(node)) {
101433
+ delete node[candidate];
101434
+ }
101435
+ for (const [candidate, child27] of entries) {
101436
+ node[candidate] = child27;
101437
+ }
101438
+ }
101439
+ function chartAreaFormatOf(chartData) {
101440
+ const style = chartData.style;
101441
+ return {
101442
+ ...style?.chartAreaFill !== void 0 ? { fill: style.chartAreaFill } : {},
101443
+ ...style?.chartAreaGradient ? { gradient: style.chartAreaGradient } : {},
101444
+ ...style?.chartAreaBorder !== void 0 ? { border: style.chartAreaBorder } : {}
101445
+ };
101446
+ }
101447
+ function plotAreaFormatOf(chartData) {
101448
+ const style = chartData.style;
101449
+ return {
101450
+ ...style?.plotAreaFill !== void 0 ? { fill: style.plotAreaFill } : {},
101451
+ ...style?.plotAreaGradient ? { gradient: style.plotAreaGradient } : {},
101452
+ ...style?.plotAreaBorder !== void 0 ? { border: style.plotAreaBorder } : {}
101453
+ };
101454
+ }
101455
+ function applyGeneratedChartSpaceFormat(tree, chartData) {
101456
+ const chartSpace = tree["c:chartSpace"];
101457
+ if (!chartSpace) {
101458
+ return;
101459
+ }
101460
+ const localName28 = (key2) => key2.replace(/^.*:/u, "");
101461
+ const plotArea = chartSpace["c:chart"]?.["c:plotArea"];
101462
+ const plotSpPr = buildChartAreaSpPr(plotAreaFormatOf(chartData));
101463
+ if (plotArea && plotSpPr) {
101464
+ insertBefore(plotArea, "c:spPr", plotSpPr, /* @__PURE__ */ new Set(["extLst"]), localName28);
101465
+ }
101466
+ const chartSpPr = buildChartAreaSpPr(chartAreaFormatOf(chartData));
101467
+ if (chartSpPr) {
101468
+ insertBefore(chartSpace, "c:spPr", chartSpPr, AFTER_CHART_SPACE_SP_PR, localName28);
101469
+ }
101470
+ if (chartData.roundedCorners !== void 0) {
101471
+ insertBefore(
101472
+ chartSpace,
101473
+ "c:roundedCorners",
101474
+ { "@_val": chartData.roundedCorners ? "1" : "0" },
101475
+ AFTER_ROUNDED_CORNERS,
101476
+ localName28
101477
+ );
101478
+ }
101479
+ }
101480
+ function authoredBool(node) {
101481
+ if (node === void 0) {
101482
+ return void 0;
101483
+ }
101484
+ const val = node && typeof node === "object" ? node["@_val"] : void 0;
101485
+ if (val === void 0 || val === null || val === "") {
101486
+ return true;
101487
+ }
101488
+ return !(val === "0" || val === "false");
101489
+ }
101490
+ function applyChartSpaceFormatToXml(chartSpace, plotArea, chartData, getLocalName2, options) {
101491
+ let changed = false;
101492
+ const roundedKey = findKey23(chartSpace, "roundedCorners", getLocalName2);
101493
+ const authoredRounded = roundedKey ? authoredBool(chartSpace[roundedKey]) : void 0;
101494
+ if (chartData.roundedCorners === void 0) {
101495
+ if (roundedKey) {
101496
+ delete chartSpace[roundedKey];
101497
+ changed = true;
101498
+ }
101499
+ } else if (chartData.roundedCorners !== authoredRounded) {
101500
+ const node = { "@_val": chartData.roundedCorners ? "1" : "0" };
101501
+ if (roundedKey) {
101502
+ chartSpace[roundedKey] = node;
101503
+ } else {
101504
+ insertBefore(chartSpace, "c:roundedCorners", node, AFTER_ROUNDED_CORNERS, getLocalName2);
101505
+ }
101506
+ changed = true;
101507
+ }
101508
+ changed = applyChartAreaFormatToXml(chartSpace, chartAreaFormatOf(chartData), getLocalName2, {
101509
+ ...options,
101510
+ insertSpPr: (owner, spPr) => insertBefore(owner, "c:spPr", spPr, AFTER_CHART_SPACE_SP_PR, getLocalName2)
101511
+ }) || changed;
101512
+ if (plotArea) {
101513
+ changed = applyChartAreaFormatToXml(plotArea, plotAreaFormatOf(chartData), getLocalName2, {
101514
+ ...options,
101515
+ insertSpPr: (owner, spPr) => insertBefore(owner, "c:spPr", spPr, /* @__PURE__ */ new Set(["extLst"]), getLocalName2)
101516
+ }) || changed;
101517
+ }
101518
+ return changed;
101519
+ }
101520
+ var AFTER_ROUNDED_CORNERS, AFTER_CHART_SPACE_SP_PR;
101521
+ var init_chart_space_format = __esm({
101522
+ "src/pptx/core/utils/chart-space-format.ts"() {
101523
+ init_chart_area_format();
101524
+ AFTER_ROUNDED_CORNERS = /* @__PURE__ */ new Set([
101525
+ "AlternateContent",
101526
+ "style",
101527
+ "clrMapOvr",
101528
+ "pivotSource",
101529
+ "protection",
101530
+ "chart",
101531
+ "spPr",
101532
+ "txPr",
101533
+ "externalData",
101534
+ "printSettings",
101535
+ "userShapes",
101536
+ "extLst"
101537
+ ]);
101538
+ AFTER_CHART_SPACE_SP_PR = /* @__PURE__ */ new Set([
101539
+ "txPr",
101540
+ "externalData",
101541
+ "printSettings",
101542
+ "userShapes",
101543
+ "extLst"
101544
+ ]);
101545
+ }
101546
+ });
101547
+
100553
101548
  // src/pptx/core/utils/chart-axis-gridlines-serializer.ts
100554
- function findKey21(obj, local, getLocalName2) {
101549
+ function findKey24(obj, local, getLocalName2) {
100555
101550
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
100556
101551
  }
100557
- function insertBefore(axisNode, newKey, value, afterSet, getLocalName2) {
101552
+ function insertBefore2(axisNode, newKey, value, afterSet, getLocalName2) {
100558
101553
  const keys = Object.keys(axisNode);
100559
101554
  const beforeIdx = keys.findIndex((k) => afterSet.has(getLocalName2(k)));
100560
101555
  const entries = keys.map((k) => [k, axisNode[k]]);
@@ -100571,7 +101566,7 @@ function applyOne(axisNode, local, key2, flag, afterSet, getLocalName2) {
100571
101566
  if (flag === void 0) {
100572
101567
  return;
100573
101568
  }
100574
- const existingKey = findKey21(axisNode, local, getLocalName2);
101569
+ const existingKey = findKey24(axisNode, local, getLocalName2);
100575
101570
  if (!flag) {
100576
101571
  if (existingKey) {
100577
101572
  delete axisNode[existingKey];
@@ -100579,7 +101574,7 @@ function applyOne(axisNode, local, key2, flag, afterSet, getLocalName2) {
100579
101574
  return;
100580
101575
  }
100581
101576
  if (!existingKey) {
100582
- insertBefore(axisNode, key2, {}, afterSet, getLocalName2);
101577
+ insertBefore2(axisNode, key2, {}, afterSet, getLocalName2);
100583
101578
  }
100584
101579
  }
100585
101580
  function applyChartAxisGridlinesToXml(axisNode, opts, getLocalName2, resolveColor2) {
@@ -100619,14 +101614,14 @@ function hex(color2) {
100619
101614
  }
100620
101615
  function buildGridlineSpPr(existing, style, getLocalName2, resolveColor2) {
100621
101616
  const spPr = existing ? { ...existing } : {};
100622
- const lnKey = findKey21(spPr, "ln", getLocalName2) ?? "a:ln";
101617
+ const lnKey = findKey24(spPr, "ln", getLocalName2) ?? "a:ln";
100623
101618
  const ln = { ...spPr[lnKey] ?? {} };
100624
101619
  if (style.strokeWidth !== void 0) {
100625
101620
  ln["@_w"] = String(Math.round(style.strokeWidth * 12700));
100626
101621
  }
100627
101622
  if (style.strokeColor) {
100628
- const fillKey = findKey21(ln, "solidFill", getLocalName2) ?? "a:solidFill";
100629
- const noFillKey = findKey21(ln, "noFill", getLocalName2);
101623
+ const fillKey = findKey24(ln, "solidFill", getLocalName2) ?? "a:solidFill";
101624
+ const noFillKey = findKey24(ln, "noFill", getLocalName2);
100630
101625
  if (noFillKey) {
100631
101626
  delete ln[noFillKey];
100632
101627
  }
@@ -100638,7 +101633,7 @@ function buildGridlineSpPr(existing, style, getLocalName2, resolveColor2) {
100638
101633
  );
100639
101634
  }
100640
101635
  if (style.strokeDashStyle) {
100641
- const dashKey = findKey21(ln, "prstDash", getLocalName2) ?? "a:prstDash";
101636
+ const dashKey = findKey24(ln, "prstDash", getLocalName2) ?? "a:prstDash";
100642
101637
  ln[dashKey] = { "@_val": style.strokeDashStyle };
100643
101638
  }
100644
101639
  spPr[lnKey] = ln;
@@ -100648,12 +101643,12 @@ function applyGridlineStyle(axisNode, local, style, getLocalName2, resolveColor2
100648
101643
  if (!style) {
100649
101644
  return;
100650
101645
  }
100651
- const gridKey = findKey21(axisNode, local, getLocalName2);
101646
+ const gridKey = findKey24(axisNode, local, getLocalName2);
100652
101647
  if (!gridKey) {
100653
101648
  return;
100654
101649
  }
100655
101650
  const grid = { ...axisNode[gridKey] ?? {} };
100656
- const spPrKey = findKey21(grid, "spPr", getLocalName2) ?? "c:spPr";
101651
+ const spPrKey = findKey24(grid, "spPr", getLocalName2) ?? "c:spPr";
100657
101652
  grid[spPrKey] = buildGridlineSpPr(
100658
101653
  grid[spPrKey],
100659
101654
  style,
@@ -100693,7 +101688,7 @@ function buildGeneratedChartAxis(axId, crossId, pos2, formatting) {
100693
101688
  const axis = {
100694
101689
  "c:axId": { "@_val": String(axId) },
100695
101690
  "c:scaling": { "c:orientation": { "@_val": "minMax" } },
100696
- "c:delete": { "@_val": "0" },
101691
+ "c:delete": { "@_val": formatting?.deleted ? "1" : "0" },
100697
101692
  "c:axPos": { "@_val": pos2 },
100698
101693
  "c:crossAx": { "@_val": String(crossId) }
100699
101694
  };
@@ -100852,7 +101847,7 @@ function buildSeries(family, s, index, categories, dateCategories) {
100852
101847
  function axisFormatting(chartData, type, id, index = 0) {
100853
101848
  return chartData.axes?.find((axis) => axis.axisId === id) ?? chartData.axes?.filter((axis) => axis.axisType === type)[index];
100854
101849
  }
100855
- function buildChartTypeContainer(chartData, family) {
101850
+ function buildChartTypeContainer(chartData, family, containerLocal) {
100856
101851
  const container2 = {};
100857
101852
  if (family === "bar") {
100858
101853
  container2["c:barDir"] = { "@_val": chartData.barDirection === "bar" ? "bar" : "col" };
@@ -100886,9 +101881,6 @@ function buildChartTypeContainer(chartData, family) {
100886
101881
  if (family === "line" && chartData.upDownBars !== void 0) {
100887
101882
  applyChartUpDownBars(container2, chartData.upDownBars, (key2) => key2.replace(/^.*:/u, ""));
100888
101883
  }
100889
- if (family === "bar" || family === "ofPie") {
100890
- container2["c:gapWidth"] = { "@_val": "150" };
100891
- }
100892
101884
  if (family === "bar" && chartData.chartType === "bar3D" && chartData.barShape) {
100893
101885
  container2["c:shape"] = { "@_val": chartData.barShape };
100894
101886
  }
@@ -100897,14 +101889,13 @@ function buildChartTypeContainer(chartData, family) {
100897
101889
  }
100898
101890
  if (family === "bar" || family === "line" || family === "area" || family === "radar" || family === "scatter" || family === "bubble" || family === "stock" || family === "surface") {
100899
101891
  container2["c:axId"] = [{ "@_val": String(CAT_AX_ID) }, { "@_val": String(VAL_AX_ID) }];
100900
- } else if (family === "doughnut") {
100901
- container2["c:holeSize"] = { "@_val": "50" };
100902
101892
  }
101893
+ applyGeneratedChartGroupOptions(container2, containerLocal, chartData);
100903
101894
  return container2;
100904
101895
  }
100905
101896
  function buildPlotArea(chartData, tag, family) {
100906
101897
  const plotArea = { "c:layout": {} };
100907
- plotArea[tag] = buildChartTypeContainer(chartData, family);
101898
+ plotArea[tag] = buildChartTypeContainer(chartData, family, tag.replace(/^.*:/u, ""));
100908
101899
  if (chartData.style) {
100909
101900
  applyChartDataLabelsToXml(plotArea, chartData.style, (key2) => key2.replace(/^.*:/u, ""));
100910
101901
  }
@@ -100981,6 +101972,7 @@ function buildChartSpaceXml(chartData) {
100981
101972
  }
100982
101973
  };
100983
101974
  applyGeneratedChartSpaceMetadata(result, chartData);
101975
+ applyGeneratedChartSpaceFormat(result, chartData);
100984
101976
  return result;
100985
101977
  }
100986
101978
  var NS_C2, NS_A2, NS_R2, CAT_AX_ID, VAL_AX_ID, SCATTER_LIKE;
@@ -100996,6 +101988,8 @@ var init_chart_xml_generator = __esm({
100996
101988
  init_chart_series_datalabel_serializer();
100997
101989
  init_chart_space_metadata();
100998
101990
  init_chart_trendline_serializer();
101991
+ init_chart_group_options();
101992
+ init_chart_space_format();
100999
101993
  init_chart_up_down_bars();
101000
101994
  init_chart_xml_axis_generator();
101001
101995
  init_chart_xml_container_map();
@@ -101343,14 +102337,14 @@ function isCustomXmlRelationship(value) {
101343
102337
  return String(value ?? "").endsWith("/relationships/customXml");
101344
102338
  }
101345
102339
  function placeCustomerDataList(container2, list2, location) {
101346
- const insertBefore3 = location === "presentation" ? /* @__PURE__ */ new Set(["p:kinsoku", "p:defaultTextStyle", "p:modifyVerifier", "p:extLst"]) : /* @__PURE__ */ new Set(["p:controls", "p:extLst"]);
102340
+ const insertBefore4 = location === "presentation" ? /* @__PURE__ */ new Set(["p:kinsoku", "p:defaultTextStyle", "p:modifyVerifier", "p:extLst"]) : /* @__PURE__ */ new Set(["p:controls", "p:extLst"]);
101347
102341
  const rebuilt = {};
101348
102342
  let inserted = false;
101349
102343
  for (const [key2, value] of Object.entries(container2)) {
101350
102344
  if (key2 === "p:custDataLst") {
101351
102345
  continue;
101352
102346
  }
101353
- if (!inserted && insertBefore3.has(key2)) {
102347
+ if (!inserted && insertBefore4.has(key2)) {
101354
102348
  rebuilt["p:custDataLst"] = list2;
101355
102349
  inserted = true;
101356
102350
  }
@@ -101438,14 +102432,14 @@ function resolveTagsContainer(data) {
101438
102432
  }
101439
102433
  return void 0;
101440
102434
  }
101441
- function placeAtKey(container2, key2, value, insertBefore3) {
102435
+ function placeAtKey(container2, key2, value, insertBefore4) {
101442
102436
  const rebuilt = {};
101443
102437
  let inserted = false;
101444
102438
  for (const [childKey3, childValue] of Object.entries(container2)) {
101445
102439
  if (childKey3 === key2) {
101446
102440
  continue;
101447
102441
  }
101448
- if (!inserted && insertBefore3.has(childKey3)) {
102442
+ if (!inserted && insertBefore4.has(childKey3)) {
101449
102443
  rebuilt[key2] = value;
101450
102444
  inserted = true;
101451
102445
  }
@@ -101469,10 +102463,10 @@ async function upsertTagsOwningElement(zip, codec, sourcePartPath, relationshipI
101469
102463
  if (!resolved) {
101470
102464
  return;
101471
102465
  }
101472
- const { container: container2, insertBefore: insertBefore3 } = resolved;
102466
+ const { container: container2, insertBefore: insertBefore4 } = resolved;
101473
102467
  const list2 = { ...container2["p:custDataLst"] ?? {} };
101474
102468
  list2["p:tags"] = { "@_r:id": relationshipId2 };
101475
- placeAtKey(container2, "p:custDataLst", list2, insertBefore3);
102469
+ placeAtKey(container2, "p:custDataLst", list2, insertBefore4);
101476
102470
  zip.file(sourcePartPath, codec.build(data));
101477
102471
  }
101478
102472
  async function removeTagsOwningElement(zip, codec, sourcePartPath) {
@@ -101740,6 +102734,49 @@ var init_tag_package = __esm({
101740
102734
  }
101741
102735
  });
101742
102736
 
102737
+ // src/pptx/core/utils/chart-axis-deleted.ts
102738
+ function authoredDeleted(node) {
102739
+ if (node === void 0) {
102740
+ return false;
102741
+ }
102742
+ const val = node && typeof node === "object" ? node["@_val"] : void 0;
102743
+ if (val === void 0 || val === null || val === "") {
102744
+ return true;
102745
+ }
102746
+ return !(val === "0" || val === "false");
102747
+ }
102748
+ function applyChartAxisDeletedToXml(axisNode, deleted, getLocalName2) {
102749
+ if (deleted === void 0) {
102750
+ return false;
102751
+ }
102752
+ const key2 = Object.keys(axisNode).find((candidate) => getLocalName2(candidate) === "delete");
102753
+ if (authoredDeleted(key2 ? axisNode[key2] : void 0) === deleted) {
102754
+ return false;
102755
+ }
102756
+ const node = { "@_val": deleted ? "1" : "0" };
102757
+ if (key2) {
102758
+ axisNode[key2] = node;
102759
+ return true;
102760
+ }
102761
+ const entries = Object.entries(axisNode);
102762
+ const at2 = entries.findIndex(([candidate]) => {
102763
+ const local = getLocalName2(candidate);
102764
+ return local !== "axId" && local !== "scaling" && !candidate.startsWith("@_");
102765
+ });
102766
+ entries.splice(at2 === -1 ? entries.length : at2, 0, ["c:delete", node]);
102767
+ for (const candidate of Object.keys(axisNode)) {
102768
+ delete axisNode[candidate];
102769
+ }
102770
+ for (const [candidate, value] of entries) {
102771
+ axisNode[candidate] = value;
102772
+ }
102773
+ return true;
102774
+ }
102775
+ var init_chart_axis_deleted = __esm({
102776
+ "src/pptx/core/utils/chart-axis-deleted.ts"() {
102777
+ }
102778
+ });
102779
+
101743
102780
  // src/pptx/core/utils/chart-axis-title-serializer.ts
101744
102781
  function firstTextRun(paragraph, getLocalName2) {
101745
102782
  for (const [key2, value] of Object.entries(paragraph)) {
@@ -101747,7 +102784,7 @@ function firstTextRun(paragraph, getLocalName2) {
101747
102784
  continue;
101748
102785
  }
101749
102786
  for (const run of Array.isArray(value) ? value : [value]) {
101750
- if (run && typeof run === "object" && !Array.isArray(run) && findKey8(run, "t", getLocalName2)) {
102787
+ if (run && typeof run === "object" && !Array.isArray(run) && findKey9(run, "t", getLocalName2)) {
101751
102788
  return [key2, run];
101752
102789
  }
101753
102790
  }
@@ -101755,7 +102792,7 @@ function firstTextRun(paragraph, getLocalName2) {
101755
102792
  return void 0;
101756
102793
  }
101757
102794
  function setTitleText(title, text2, getLocalName2) {
101758
- const txKey = findKey8(title, "tx", getLocalName2) ?? "c:tx";
102795
+ const txKey = findKey9(title, "tx", getLocalName2) ?? "c:tx";
101759
102796
  const tx = title[txKey];
101760
102797
  const texts = [];
101761
102798
  if (tx && typeof tx === "object") {
@@ -101764,7 +102801,7 @@ function setTitleText(title, text2, getLocalName2) {
101764
102801
  if (texts.join("") === text2) {
101765
102802
  return;
101766
102803
  }
101767
- const richKey = tx && typeof tx === "object" ? findKey8(tx, "rich", getLocalName2) : void 0;
102804
+ const richKey = tx && typeof tx === "object" ? findKey9(tx, "rich", getLocalName2) : void 0;
101768
102805
  const rich = richKey ? tx[richKey] : void 0;
101769
102806
  if (!rich || typeof rich !== "object" || Array.isArray(rich)) {
101770
102807
  const textNode = buildTitle(text2)["c:tx"];
@@ -101775,7 +102812,7 @@ function setTitleText(title, text2, getLocalName2) {
101775
102812
  }
101776
102813
  return;
101777
102814
  }
101778
- const pKey = findKey8(rich, "p", getLocalName2) ?? "a:p";
102815
+ const pKey = findKey9(rich, "p", getLocalName2) ?? "a:p";
101779
102816
  const value = rich[pKey];
101780
102817
  const paragraphs = (Array.isArray(value) ? value : [value]).filter(
101781
102818
  (entry) => Boolean(entry) && typeof entry === "object" && !Array.isArray(entry)
@@ -101784,9 +102821,9 @@ function setTitleText(title, text2, getLocalName2) {
101784
102821
  const carrier = firstTextRun(paragraph, getLocalName2);
101785
102822
  const original = carrier?.[1] ?? {};
101786
102823
  const runKey = carrier ? carrier[0].replace(/[^:]+$/u, "r") : "a:r";
101787
- const rPrKey = findKey8(original, "rPr", getLocalName2);
102824
+ const rPrKey = findKey9(original, "rPr", getLocalName2);
101788
102825
  const run = carrier && getLocalName2(carrier[0]) === "r" ? { ...original } : rPrKey ? { [rPrKey]: original[rPrKey] } : {};
101789
- const textKey = findKey8(original, "t", getLocalName2) ?? "a:t";
102826
+ const textKey = findKey9(original, "t", getLocalName2) ?? "a:t";
101790
102827
  const oldText = original[textKey];
101791
102828
  const attributes = oldText && typeof oldText === "object" && !Array.isArray(oldText) ? oldText : void 0;
101792
102829
  run[textKey] = attributes ? { ...attributes, "#text": text2 } : text2;
@@ -101826,7 +102863,7 @@ function applyChartAxisTitleToXml(axisNode, titleText, getLocalName2) {
101826
102863
  if (titleText === void 0) {
101827
102864
  return;
101828
102865
  }
101829
- const titleKey = findKey8(axisNode, "title", getLocalName2);
102866
+ const titleKey = findKey9(axisNode, "title", getLocalName2);
101830
102867
  if (titleText === "") {
101831
102868
  if (titleKey) {
101832
102869
  delete axisNode[titleKey];
@@ -101866,27 +102903,27 @@ function applyChartAxisTitleStyleToXml(axisNode, style, getLocalName2, resolveCo
101866
102903
  if (!hasAny) {
101867
102904
  return;
101868
102905
  }
101869
- const titleKey = findKey8(axisNode, "title", getLocalName2);
102906
+ const titleKey = findKey9(axisNode, "title", getLocalName2);
101870
102907
  if (!titleKey) {
101871
102908
  return;
101872
102909
  }
101873
102910
  const title = { ...axisNode[titleKey] ?? {} };
101874
- const txPrKey = findKey8(title, "txPr", getLocalName2) ?? "c:txPr";
102911
+ const txPrKey = findKey9(title, "txPr", getLocalName2) ?? "c:txPr";
101875
102912
  const txPr = { ...title[txPrKey] ?? {} };
101876
- if (!txPr[findKey8(txPr, "bodyPr", getLocalName2) ?? "a:bodyPr"]) {
102913
+ if (!txPr[findKey9(txPr, "bodyPr", getLocalName2) ?? "a:bodyPr"]) {
101877
102914
  txPr["a:bodyPr"] = {};
101878
102915
  }
101879
- if (!txPr[findKey8(txPr, "lstStyle", getLocalName2) ?? "a:lstStyle"]) {
102916
+ if (!txPr[findKey9(txPr, "lstStyle", getLocalName2) ?? "a:lstStyle"]) {
101880
102917
  txPr["a:lstStyle"] = {};
101881
102918
  }
101882
- const pKey = findKey8(txPr, "p", getLocalName2) ?? "a:p";
102919
+ const pKey = findKey9(txPr, "p", getLocalName2) ?? "a:p";
101883
102920
  const existingP = txPr[pKey];
101884
102921
  const para = {
101885
102922
  ...(Array.isArray(existingP) ? existingP[0] : existingP) ?? {}
101886
102923
  };
101887
- const pPrKey = findKey8(para, "pPr", getLocalName2) ?? "a:pPr";
102924
+ const pPrKey = findKey9(para, "pPr", getLocalName2) ?? "a:pPr";
101888
102925
  const pPr = { ...para[pPrKey] ?? {} };
101889
- const defRPrKey = findKey8(pPr, "defRPr", getLocalName2) ?? "a:defRPr";
102926
+ const defRPrKey = findKey9(pPr, "defRPr", getLocalName2) ?? "a:defRPr";
101890
102927
  const existingDefRPr = pPr[defRPrKey] ?? {};
101891
102928
  pPr[defRPrKey] = { ...existingDefRPr, ...buildDefRPr(style, existingDefRPr, resolveColor2) };
101892
102929
  para[pPrKey] = pPr;
@@ -101978,140 +103015,8 @@ var init_chart_color_map_override = __esm({
101978
103015
  }
101979
103016
  });
101980
103017
 
101981
- // src/pptx/core/utils/chart-container-schema.ts
101982
- function normalizeChartGroupingValue(containerLocal, value) {
101983
- const isBar = containerLocal === "barChart" || containerLocal === "bar3DChart";
101984
- return !isBar && value === "clustered" ? "standard" : value;
101985
- }
101986
- function normalizeGroupingNode(containerLocal, node) {
101987
- const value = node["@_val"];
101988
- if (value !== void 0) {
101989
- node["@_val"] = normalizeChartGroupingValue(containerLocal, value);
101990
- }
101991
- }
101992
- function normalizeChartContainerChildren(container2, containerLocal, getLocalName2) {
101993
- if (!isKnownChartContainer(containerLocal)) {
101994
- return;
101995
- }
101996
- for (const key2 of Object.keys(container2)) {
101997
- if (key2.startsWith("@_") || key2 === "#text") {
101998
- continue;
101999
- }
102000
- const local = getLocalName2(key2);
102001
- if (!chartContainerAllows(containerLocal, local)) {
102002
- delete container2[key2];
102003
- continue;
102004
- }
102005
- if (local === "grouping") {
102006
- const node = container2[key2];
102007
- if (node && typeof node === "object" && !Array.isArray(node)) {
102008
- normalizeGroupingNode(containerLocal, node);
102009
- }
102010
- }
102011
- }
102012
- const required = REQUIRED_LEADING_CHILD[containerLocal];
102013
- if (required) {
102014
- const present = Object.keys(container2).some((k) => getLocalName2(k) === required.local);
102015
- if (!present) {
102016
- container2[`c:${required.local}`] = { "@_val": required.val };
102017
- }
102018
- }
102019
- }
102020
- function orderChartContainerChildren(container2, containerLocal, getLocalName2) {
102021
- const order = CHART_CONTAINER_CHILD_ORDER[containerLocal];
102022
- if (!order) {
102023
- return;
102024
- }
102025
- const keys = Object.keys(container2).filter((k) => !k.startsWith("@_") && k !== "#text");
102026
- if (keys.some((k) => !order.includes(getLocalName2(k)))) {
102027
- return;
102028
- }
102029
- const sorted = [...keys].sort(
102030
- (a, b) => order.indexOf(getLocalName2(a)) - order.indexOf(getLocalName2(b))
102031
- );
102032
- if (sorted.every((k, i) => k === keys[i])) {
102033
- return;
102034
- }
102035
- const saved = sorted.map((k) => [k, container2[k]]);
102036
- for (const k of keys) {
102037
- delete container2[k];
102038
- }
102039
- for (const [k, v] of saved) {
102040
- container2[k] = v;
102041
- }
102042
- }
102043
- function renameXmlKeyInPlace(obj, oldKey, newKey) {
102044
- if (oldKey === newKey || !(oldKey in obj)) {
102045
- return;
102046
- }
102047
- const entries = Object.keys(obj).map((k) => [k === oldKey ? newKey : k, obj[k]]);
102048
- for (const k of Object.keys(obj)) {
102049
- delete obj[k];
102050
- }
102051
- for (const [k, v] of entries) {
102052
- obj[k] = v;
102053
- }
102054
- }
102055
- function referencedAxisIds(plotArea, getLocalName2) {
102056
- const ids = /* @__PURE__ */ new Set();
102057
- for (const key2 of Object.keys(plotArea)) {
102058
- if (!getLocalName2(key2).endsWith("Chart")) {
102059
- continue;
102060
- }
102061
- for (const container2 of toArray2(plotArea[key2])) {
102062
- for (const childKey3 of Object.keys(container2)) {
102063
- if (getLocalName2(childKey3) !== "axId") {
102064
- continue;
102065
- }
102066
- for (const axId of toArray2(container2[childKey3])) {
102067
- const val = axId["@_val"];
102068
- if (val !== void 0) {
102069
- ids.add(String(val));
102070
- }
102071
- }
102072
- }
102073
- }
102074
- }
102075
- return ids;
102076
- }
102077
- function toArray2(value) {
102078
- if (Array.isArray(value)) {
102079
- return value.filter((v) => typeof v === "object" && v !== null);
102080
- }
102081
- return typeof value === "object" && value !== null ? [value] : [];
102082
- }
102083
- function reconcileChartPlotAreaAxes(plotArea, getLocalName2) {
102084
- const referenced = referencedAxisIds(plotArea, getLocalName2);
102085
- let removed = 0;
102086
- for (const key2 of Object.keys(plotArea)) {
102087
- const local = getLocalName2(key2);
102088
- if (!AXIS_LOCAL_NAMES.includes(local)) {
102089
- continue;
102090
- }
102091
- const axes = toArray2(plotArea[key2]);
102092
- const kept = axes.filter((axis) => {
102093
- const axIdKey = Object.keys(axis).find((k) => getLocalName2(k) === "axId");
102094
- const val = axIdKey ? toArray2(axis[axIdKey])[0]?.["@_val"] : void 0;
102095
- return val !== void 0 && referenced.has(String(val));
102096
- });
102097
- removed += axes.length - kept.length;
102098
- if (kept.length === 0) {
102099
- delete plotArea[key2];
102100
- } else if (kept.length !== axes.length) {
102101
- plotArea[key2] = kept.length === 1 ? kept[0] : kept;
102102
- }
102103
- }
102104
- return removed;
102105
- }
102106
- var init_chart_container_schema = __esm({
102107
- "src/pptx/core/utils/chart-container-schema.ts"() {
102108
- init_chart_container_content_model();
102109
- init_chart_container_content_model();
102110
- }
102111
- });
102112
-
102113
103018
  // src/pptx/core/utils/chart-combo-serializer.ts
102114
- function findKey22(obj, local, getLocalName2) {
103019
+ function findKey25(obj, local, getLocalName2) {
102115
103020
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
102116
103021
  }
102117
103022
  function nonSeriesEntries(container2, getLocalName2) {
@@ -102143,14 +103048,14 @@ function consolidateComboContainersInXml(plotArea, getLocalName2) {
102143
103048
  if (!primary) {
102144
103049
  return { primaryKey, containerChildren };
102145
103050
  }
102146
- const serKey = findKey22(primary, "ser", getLocalName2) ?? "c:ser";
103051
+ const serKey = findKey25(primary, "ser", getLocalName2) ?? "c:ser";
102147
103052
  const allSeries = [];
102148
103053
  for (const key2 of containerKeys) {
102149
103054
  const container2 = plotArea[key2];
102150
103055
  if (!container2) {
102151
103056
  continue;
102152
103057
  }
102153
- const containerSerKey = findKey22(container2, "ser", getLocalName2);
103058
+ const containerSerKey = findKey25(container2, "ser", getLocalName2);
102154
103059
  if (containerSerKey) {
102155
103060
  allSeries.push(...ensureArray18(container2[containerSerKey]));
102156
103061
  }
@@ -102178,7 +103083,7 @@ function applyComboSeriesTypesToXml(plotArea, originalKey, series, chartLevelTyp
102178
103083
  if (!original) {
102179
103084
  return false;
102180
103085
  }
102181
- const serKey = findKey22(original, "ser", getLocalName2) ?? "c:ser";
103086
+ const serKey = findKey25(original, "ser", getLocalName2) ?? "c:ser";
102182
103087
  const serNodes = ensureArray18(original[serKey]);
102183
103088
  if (serNodes.length !== series.length) {
102184
103089
  return false;
@@ -102235,7 +103140,7 @@ function applyGroupAxisReferences(container2, series, axes, getLocalName2) {
102235
103140
  if (valueAxisId === void 0 || categoryAxisId === void 0) {
102236
103141
  return;
102237
103142
  }
102238
- const key2 = findKey22(container2, "axId", getLocalName2) ?? "c:axId";
103143
+ const key2 = findKey25(container2, "axId", getLocalName2) ?? "c:axId";
102239
103144
  container2[key2] = [{ "@_val": String(categoryAxisId) }, { "@_val": String(valueAxisId) }];
102240
103145
  }
102241
103146
  var init_chart_combo_serializer = __esm({
@@ -102245,7 +103150,7 @@ var init_chart_combo_serializer = __esm({
102245
103150
  });
102246
103151
 
102247
103152
  // src/pptx/core/utils/chart-filtered-series-writer.ts
102248
- function findKey23(obj, local, getLocalName2) {
103153
+ function findKey26(obj, local, getLocalName2) {
102249
103154
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
102250
103155
  }
102251
103156
  function points3(values) {
@@ -102303,9 +103208,9 @@ function filteredSeriesUnchanged(container2, filteredSeries, xmlLookup) {
102303
103208
  });
102304
103209
  }
102305
103210
  function applyFilteredSeriesToXml(container2, filteredSeries, categories, containerLocalName, getLocalName2) {
102306
- const extLstKey = findKey23(container2, "extLst", getLocalName2) ?? "c:extLst";
103211
+ const extLstKey = findKey26(container2, "extLst", getLocalName2) ?? "c:extLst";
102307
103212
  const extLst = { ...container2[extLstKey] ?? {} };
102308
- const extKey = findKey23(extLst, "ext", getLocalName2);
103213
+ const extKey = findKey26(extLst, "ext", getLocalName2);
102309
103214
  const exts = extKey ? Array.isArray(extLst[extKey]) ? [...extLst[extKey]] : [extLst[extKey]] : [];
102310
103215
  const otherExts = exts.filter((ext) => ext["@_uri"] !== CHART_FILTERED_SERIES_EXT_URI);
102311
103216
  const ownExt = {
@@ -102519,11 +103424,11 @@ var init_chart_legend_serializer = __esm({
102519
103424
  });
102520
103425
 
102521
103426
  // src/pptx/core/utils/chart-line-style-serializer.ts
102522
- function findKey24(node, name, localName28) {
103427
+ function findKey27(node, name, localName28) {
102523
103428
  return Object.keys(node).find((key2) => localName28(key2) === name);
102524
103429
  }
102525
103430
  function setOrdered5(node, name, value, localName28) {
102526
- const key2 = findKey24(node, name, localName28);
103431
+ const key2 = findKey27(node, name, localName28);
102527
103432
  if (key2) {
102528
103433
  node[key2] = value;
102529
103434
  return;
@@ -102548,7 +103453,7 @@ function applyChartLineStyle(chartContainer, elementName, style, localName28, re
102548
103453
  if (style === void 0) {
102549
103454
  return;
102550
103455
  }
102551
- const key2 = findKey24(chartContainer, elementName, localName28);
103456
+ const key2 = findKey27(chartContainer, elementName, localName28);
102552
103457
  if (style === null) {
102553
103458
  if (key2) {
102554
103459
  delete chartContainer[key2];
@@ -102559,7 +103464,7 @@ function applyChartLineStyle(chartContainer, elementName, style, localName28, re
102559
103464
  const node = { ...existing };
102560
103465
  const hasLineProps = style.color || style.width !== void 0 || style.dashStyle;
102561
103466
  if (hasLineProps) {
102562
- const spPrKey = findKey24(node, "spPr", localName28) ?? "c:spPr";
103467
+ const spPrKey = findKey27(node, "spPr", localName28) ?? "c:spPr";
102563
103468
  node[spPrKey] = writeChartShapeProps(
102564
103469
  node[spPrKey],
102565
103470
  { strokeColor: style.color, strokeWidth: style.width, strokeDashStyle: style.dashStyle },
@@ -102593,7 +103498,7 @@ var init_chart_line_style_serializer = __esm({
102593
103498
  });
102594
103499
 
102595
103500
  // src/pptx/core/utils/chart-series-color-serializer.ts
102596
- function findKey25(obj, local, getLocalName2) {
103501
+ function findKey28(obj, local, getLocalName2) {
102597
103502
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
102598
103503
  }
102599
103504
  function insertBeforeLn(obj, key2, value, getLocalName2) {
@@ -102623,14 +103528,14 @@ function insertFirst(obj, key2, value) {
102623
103528
  function writeSeriesColorToSpPr(spPr, hex3, isLineFamily, getLocalName2, resolveColor2) {
102624
103529
  const normalizedHex = hex3.replace(/^#/u, "");
102625
103530
  if (isLineFamily) {
102626
- const lnKey = findKey25(spPr, "ln", getLocalName2) ?? "a:ln";
103531
+ const lnKey = findKey28(spPr, "ln", getLocalName2) ?? "a:ln";
102627
103532
  const ln = spPr[lnKey] ?? {};
102628
103533
  const hadLn = Boolean(spPr[lnKey]);
102629
- const noFillKey = findKey25(ln, "noFill", getLocalName2);
103534
+ const noFillKey = findKey28(ln, "noFill", getLocalName2);
102630
103535
  if (noFillKey) {
102631
103536
  delete ln[noFillKey];
102632
103537
  }
102633
- const lnFillKey = findKey25(ln, "solidFill", getLocalName2) ?? "a:solidFill";
103538
+ const lnFillKey = findKey28(ln, "solidFill", getLocalName2) ?? "a:solidFill";
102634
103539
  const authoredFill2 = ln[lnFillKey];
102635
103540
  const fillNode2 = serializeColorChoice(
102636
103541
  authoredFill2,
@@ -102647,7 +103552,7 @@ function writeSeriesColorToSpPr(spPr, hex3, isLineFamily, getLocalName2, resolve
102647
103552
  }
102648
103553
  return;
102649
103554
  }
102650
- const fillKey = findKey25(spPr, "solidFill", getLocalName2) ?? "a:solidFill";
103555
+ const fillKey = findKey28(spPr, "solidFill", getLocalName2) ?? "a:solidFill";
102651
103556
  const authoredFill = spPr[fillKey];
102652
103557
  const fillNode = serializeColorChoice(
102653
103558
  authoredFill,
@@ -102655,7 +103560,7 @@ function writeSeriesColorToSpPr(spPr, hex3, isLineFamily, getLocalName2, resolve
102655
103560
  normalizedHex
102656
103561
  );
102657
103562
  if (authoredFill) {
102658
- const noFillKey = findKey25(spPr, "noFill", getLocalName2);
103563
+ const noFillKey = findKey28(spPr, "noFill", getLocalName2);
102659
103564
  if (noFillKey) {
102660
103565
  delete spPr[noFillKey];
102661
103566
  }
@@ -102670,7 +103575,7 @@ function writeSeriesColorToSpPr(spPr, hex3, isLineFamily, getLocalName2, resolve
102670
103575
  }
102671
103576
  }
102672
103577
  function ensureSeriesSpPr(seriesNode, getLocalName2) {
102673
- const existingKey = findKey25(seriesNode, "spPr", getLocalName2);
103578
+ const existingKey = findKey28(seriesNode, "spPr", getLocalName2);
102674
103579
  if (existingKey) {
102675
103580
  return seriesNode[existingKey];
102676
103581
  }
@@ -102690,7 +103595,7 @@ function applySeriesGradientToXml(seriesNode, gradient, getLocalName2, options =
102690
103595
  if (options.lineDrawn) {
102691
103596
  return false;
102692
103597
  }
102693
- const spPrKey = findKey25(seriesNode, "spPr", getLocalName2);
103598
+ const spPrKey = findKey28(seriesNode, "spPr", getLocalName2);
102694
103599
  if (!spPrKey && !gradient) {
102695
103600
  return false;
102696
103601
  }
@@ -102726,11 +103631,11 @@ var init_chart_series_color_serializer = __esm({
102726
103631
  });
102727
103632
 
102728
103633
  // src/pptx/core/utils/chart-subtype-serializer.ts
102729
- function findKey26(obj, local, getLocalName2) {
103634
+ function findKey29(obj, local, getLocalName2) {
102730
103635
  return Object.keys(obj).find((k) => getLocalName2(k) === local);
102731
103636
  }
102732
103637
  function upsertValChild(parent, localName28, value, getLocalName2) {
102733
- const existingKey = findKey26(parent, localName28, getLocalName2);
103638
+ const existingKey = findKey29(parent, localName28, getLocalName2);
102734
103639
  if (value === void 0) {
102735
103640
  if (existingKey) {
102736
103641
  delete parent[existingKey];
@@ -102770,7 +103675,7 @@ function applySurfaceWireframeToXml(chartTypeContainer, containerLocalName, wire
102770
103675
  orderChartContainerChildren(chartTypeContainer, containerLocalName, getLocalName2);
102771
103676
  }
102772
103677
  function applySeriesBar3DShapeToXml(seriesNode, shape, getLocalName2) {
102773
- const existingKey = findKey26(seriesNode, "shape", getLocalName2);
103678
+ const existingKey = findKey29(seriesNode, "shape", getLocalName2);
102774
103679
  if (shape === void 0) {
102775
103680
  if (existingKey) {
102776
103681
  delete seriesNode[existingKey];
@@ -102915,7 +103820,7 @@ var init_chart_title_run_alignment = __esm({
102915
103820
  // src/pptx/core/utils/chart-title-serializer.ts
102916
103821
  function applyChartTitleToXml(chartRoot, model, getLocalName2, options = { prefix: "c" }) {
102917
103822
  const { prefix } = options;
102918
- const existingKey = findKey8(chartRoot, "title", getLocalName2);
103823
+ const existingKey = findKey9(chartRoot, "title", getLocalName2);
102919
103824
  const remove = model.hasTitle === false || model.title === "" && model.hasTitle !== true;
102920
103825
  if (remove) {
102921
103826
  if (existingKey) {
@@ -102953,14 +103858,14 @@ function applyChartTitleToXml(chartRoot, model, getLocalName2, options = { prefi
102953
103858
  insertAt2(chartRoot, 0, `${prefix}:title`, titleNode);
102954
103859
  }
102955
103860
  } else if (runs) {
102956
- const txKey = findKey8(titleNode, "tx", getLocalName2);
103861
+ const txKey = findKey9(titleNode, "tx", getLocalName2);
102957
103862
  if (txKey) {
102958
103863
  titleNode[txKey] = buildTitleTextFromRuns(prefix, runs);
102959
103864
  } else {
102960
103865
  insertAt2(titleNode, 0, `${prefix}:tx`, buildTitleTextFromRuns(prefix, runs));
102961
103866
  }
102962
103867
  } else if (model.title !== void 0 && !replaceFirstText(titleNode, model.title, getLocalName2)) {
102963
- const txKey = findKey8(titleNode, "tx", getLocalName2);
103868
+ const txKey = findKey9(titleNode, "tx", getLocalName2);
102964
103869
  if (txKey) {
102965
103870
  titleNode[txKey] = buildTitleText(prefix, model.title);
102966
103871
  } else {
@@ -102981,7 +103886,7 @@ var init_chart_title_serializer = __esm({
102981
103886
  });
102982
103887
 
102983
103888
  // src/pptx/core/utils/chart-title-style-serializer.ts
102984
- function findKey27(node, localName28, getLocalName2) {
103889
+ function findKey30(node, localName28, getLocalName2) {
102985
103890
  return Object.keys(node).find((key2) => getLocalName2(key2) === localName28);
102986
103891
  }
102987
103892
  function setChildOrdered(node, key2, existingKey, value, laterNames, getLocalName2) {
@@ -103024,9 +103929,9 @@ function asArray3(value) {
103024
103929
  return value && typeof value === "object" ? [value] : [];
103025
103930
  }
103026
103931
  function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
103027
- const txKey = findKey27(title, "tx", getLocalName2);
103932
+ const txKey = findKey30(title, "tx", getLocalName2);
103028
103933
  const tx = txKey ? title[txKey] : void 0;
103029
- const richKey = tx ? findKey27(tx, "rich", getLocalName2) : void 0;
103934
+ const richKey = tx ? findKey30(tx, "rich", getLocalName2) : void 0;
103030
103935
  const rich = richKey && tx ? tx[richKey] : void 0;
103031
103936
  if (!tx || !rich || !txKey || !richKey) {
103032
103937
  return void 0;
@@ -103035,22 +103940,22 @@ function applyRichTitleFont(title, style, getLocalName2, resolveColor2) {
103035
103940
  if (!hasFont) {
103036
103941
  return txKey;
103037
103942
  }
103038
- const pKey = findKey27(rich, "p", getLocalName2) ?? "a:p";
103943
+ const pKey = findKey30(rich, "p", getLocalName2) ?? "a:p";
103039
103944
  const paragraphs = asArray3(rich[pKey]).map((para) => {
103040
103945
  const next = { ...para };
103041
- const pPrKey = findKey27(next, "pPr", getLocalName2) ?? "a:pPr";
103946
+ const pPrKey = findKey30(next, "pPr", getLocalName2) ?? "a:pPr";
103042
103947
  const pPr = { ...next[pPrKey] ?? {} };
103043
- const defRPrKey = findKey27(pPr, "defRPr", getLocalName2) ?? "a:defRPr";
103948
+ const defRPrKey = findKey30(pPr, "defRPr", getLocalName2) ?? "a:defRPr";
103044
103949
  const existingDefRPr = pPr[defRPrKey] ?? {};
103045
103950
  pPr[defRPrKey] = {
103046
103951
  ...existingDefRPr,
103047
103952
  ...buildTitleDefRPr(style, existingDefRPr, resolveColor2)
103048
103953
  };
103049
103954
  next[pPrKey] = pPr;
103050
- const rKey = findKey27(next, "r", getLocalName2);
103955
+ const rKey = findKey30(next, "r", getLocalName2);
103051
103956
  if (rKey) {
103052
103957
  const runs = asArray3(next[rKey]).map((run) => {
103053
- const rPrKey = findKey27(run, "rPr", getLocalName2) ?? "a:rPr";
103958
+ const rPrKey = findKey30(run, "rPr", getLocalName2) ?? "a:rPr";
103054
103959
  const existingRPr = run[rPrKey] ?? {};
103055
103960
  const nextRun = { ...run };
103056
103961
  nextRun[rPrKey] = { ...existingRPr, ...buildTitleDefRPr(style, existingRPr, resolveColor2) };
@@ -103073,13 +103978,13 @@ function applyChartTitleStyleToXml(chartRoot, style, getLocalName2, options = {
103073
103978
  return;
103074
103979
  }
103075
103980
  const { prefix } = options;
103076
- const titleKey = findKey27(chartRoot, "title", getLocalName2);
103981
+ const titleKey = findKey30(chartRoot, "title", getLocalName2);
103077
103982
  if (!titleKey) {
103078
103983
  return;
103079
103984
  }
103080
103985
  const title = { ...chartRoot[titleKey] ?? {} };
103081
103986
  if (style.spPr !== void 0) {
103082
- const spPrKey = findKey27(title, "spPr", getLocalName2);
103987
+ const spPrKey = findKey30(title, "spPr", getLocalName2);
103083
103988
  if (style.spPr === null) {
103084
103989
  if (spPrKey) {
103085
103990
  delete title[spPrKey];
@@ -103096,23 +104001,23 @@ function applyChartTitleStyleToXml(chartRoot, style, getLocalName2, options = {
103096
104001
  }
103097
104002
  const richKey = applyRichTitleFont(title, style, getLocalName2, resolveColor2);
103098
104003
  if (hasFont && richKey === void 0) {
103099
- const existingTxPrKey = findKey27(title, "txPr", getLocalName2);
104004
+ const existingTxPrKey = findKey30(title, "txPr", getLocalName2);
103100
104005
  const txPrKey = existingTxPrKey ?? `${prefix}:txPr`;
103101
104006
  const txPr = { ...title[txPrKey] ?? {} };
103102
- if (!txPr[findKey27(txPr, "bodyPr", getLocalName2) ?? "a:bodyPr"]) {
104007
+ if (!txPr[findKey30(txPr, "bodyPr", getLocalName2) ?? "a:bodyPr"]) {
103103
104008
  txPr["a:bodyPr"] = {};
103104
104009
  }
103105
- if (!txPr[findKey27(txPr, "lstStyle", getLocalName2) ?? "a:lstStyle"]) {
104010
+ if (!txPr[findKey30(txPr, "lstStyle", getLocalName2) ?? "a:lstStyle"]) {
103106
104011
  txPr["a:lstStyle"] = {};
103107
104012
  }
103108
- const pKey = findKey27(txPr, "p", getLocalName2) ?? "a:p";
104013
+ const pKey = findKey30(txPr, "p", getLocalName2) ?? "a:p";
103109
104014
  const existingP = txPr[pKey];
103110
104015
  const para = {
103111
104016
  ...(Array.isArray(existingP) ? existingP[0] : existingP) ?? {}
103112
104017
  };
103113
- const pPrKey = findKey27(para, "pPr", getLocalName2) ?? "a:pPr";
104018
+ const pPrKey = findKey30(para, "pPr", getLocalName2) ?? "a:pPr";
103114
104019
  const pPr = { ...para[pPrKey] ?? {} };
103115
- const defRPrKey = findKey27(pPr, "defRPr", getLocalName2) ?? "a:defRPr";
104020
+ const defRPrKey = findKey30(pPr, "defRPr", getLocalName2) ?? "a:defRPr";
103116
104021
  const existingDefRPr = pPr[defRPrKey] ?? {};
103117
104022
  pPr[defRPrKey] = {
103118
104023
  ...existingDefRPr,
@@ -103262,7 +104167,7 @@ var init_chart_xlsx_writer = __esm({
103262
104167
  });
103263
104168
 
103264
104169
  // src/pptx/core/core/runtime/chart-cx-update-data.ts
103265
- function findKey28(node, localName28, getLocalName2) {
104170
+ function findKey31(node, localName28, getLocalName2) {
103266
104171
  return Object.keys(node).find((key2) => getLocalName2(key2) === localName28);
103267
104172
  }
103268
104173
  function asArray4(value) {
@@ -103277,8 +104182,8 @@ function dimensionType(node) {
103277
104182
  return String(node["@_type"] ?? "");
103278
104183
  }
103279
104184
  function replaceLevels(target, source, getLocalName2) {
103280
- const targetKey = findKey28(target, "lvl", getLocalName2) ?? "cx:lvl";
103281
- const sourceKey = findKey28(source, "lvl", getLocalName2);
104185
+ const targetKey = findKey31(target, "lvl", getLocalName2) ?? "cx:lvl";
104186
+ const sourceKey = findKey31(source, "lvl", getLocalName2);
103282
104187
  const oldLevels = asArray4(target[targetKey]);
103283
104188
  const newLevels = asArray4(sourceKey ? source[sourceKey] : void 0).map((level2, index) => {
103284
104189
  const old = oldLevels[index];
@@ -103297,8 +104202,8 @@ function replaceLevels(target, source, getLocalName2) {
103297
104202
  }
103298
104203
  function replaceChartExDataDimensions(target, fresh, getLocalName2) {
103299
104204
  for (const kind of ["strDim", "numDim"]) {
103300
- const targetKey = findKey28(target, kind, getLocalName2) ?? `cx:${kind}`;
103301
- const freshKey = findKey28(fresh, kind, getLocalName2);
104205
+ const targetKey = findKey31(target, kind, getLocalName2) ?? `cx:${kind}`;
104206
+ const freshKey = findKey31(fresh, kind, getLocalName2);
103302
104207
  const existing = asArray4(target[targetKey]);
103303
104208
  const incoming = asArray4(freshKey ? fresh[freshKey] : void 0);
103304
104209
  for (const dimension of incoming) {
@@ -103327,14 +104232,14 @@ var init_chart_cx_update_data = __esm({
103327
104232
  });
103328
104233
 
103329
104234
  // src/pptx/core/core/runtime/chart-cx-update-series.ts
103330
- function findKey29(node, localName28, getLocalName2) {
104235
+ function findKey32(node, localName28, getLocalName2) {
103331
104236
  return Object.keys(node).find((key2) => getLocalName2(key2) === localName28);
103332
104237
  }
103333
104238
  function child24(node, localName28, getLocalName2) {
103334
104239
  if (!node) {
103335
104240
  return void 0;
103336
104241
  }
103337
- const key2 = findKey29(node, localName28, getLocalName2);
104242
+ const key2 = findKey32(node, localName28, getLocalName2);
103338
104243
  const value = key2 ? node[key2] : void 0;
103339
104244
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
103340
104245
  }
@@ -103346,7 +104251,7 @@ function asArray5(value) {
103346
104251
  (entry) => Boolean(entry) && typeof entry === "object"
103347
104252
  );
103348
104253
  }
103349
- function insertBefore2(parent, key2, value, before, getLocalName2) {
104254
+ function insertBefore3(parent, key2, value, before, getLocalName2) {
103350
104255
  const entries = Object.keys(parent).map((k) => [k, parent[k]]);
103351
104256
  let index = entries.findIndex(([k]) => !k.startsWith("@_") && before.includes(getLocalName2(k)));
103352
104257
  if (index === -1) {
@@ -103364,15 +104269,15 @@ function applySeriesName(node, name, getLocalName2) {
103364
104269
  const tx = child24(node, "tx", getLocalName2);
103365
104270
  const txData = child24(tx, "txData", getLocalName2);
103366
104271
  if (tx && txData) {
103367
- const vKey = findKey29(txData, "v", getLocalName2) ?? "cx:v";
104272
+ const vKey = findKey32(txData, "v", getLocalName2) ?? "cx:v";
103368
104273
  txData[vKey] = name;
103369
104274
  return;
103370
104275
  }
103371
- const txKey = findKey29(node, "tx", getLocalName2);
104276
+ const txKey = findKey32(node, "tx", getLocalName2);
103372
104277
  if (txKey) {
103373
104278
  delete node[txKey];
103374
104279
  }
103375
- insertBefore2(node, "cx:tx", { "cx:txData": { "cx:v": name } }, AFTER_TX, getLocalName2);
104280
+ insertBefore3(node, "cx:tx", { "cx:txData": { "cx:v": name } }, AFTER_TX, getLocalName2);
103376
104281
  }
103377
104282
  function currentSeriesColor(node, getLocalName2) {
103378
104283
  const srgb = child24(
@@ -103394,7 +104299,7 @@ function applySeriesColor(node, series, getLocalName2) {
103394
104299
  }
103395
104300
  const spPr = child24(node, "spPr", getLocalName2);
103396
104301
  if (!spPr) {
103397
- insertBefore2(node, "cx:spPr", fill, AFTER_TX.slice(1), getLocalName2);
104302
+ insertBefore3(node, "cx:spPr", fill, AFTER_TX.slice(1), getLocalName2);
103398
104303
  return;
103399
104304
  }
103400
104305
  for (const key2 of Object.keys(spPr)) {
@@ -103402,13 +104307,13 @@ function applySeriesColor(node, series, getLocalName2) {
103402
104307
  delete spPr[key2];
103403
104308
  }
103404
104309
  }
103405
- insertBefore2(spPr, "a:solidFill", fill["a:solidFill"], AFTER_FILL2, getLocalName2);
104310
+ insertBefore3(spPr, "a:solidFill", fill["a:solidFill"], AFTER_FILL2, getLocalName2);
103406
104311
  }
103407
104312
  function applySeriesDataLabels(node, hasDataLabels, getLocalName2) {
103408
104313
  if (hasDataLabels === void 0) {
103409
104314
  return;
103410
104315
  }
103411
- const key2 = findKey29(node, "dataLabels", getLocalName2);
104316
+ const key2 = findKey32(node, "dataLabels", getLocalName2);
103412
104317
  if (!hasDataLabels) {
103413
104318
  if (key2) {
103414
104319
  delete node[key2];
@@ -103416,7 +104321,7 @@ function applySeriesDataLabels(node, hasDataLabels, getLocalName2) {
103416
104321
  return;
103417
104322
  }
103418
104323
  if (!key2) {
103419
- insertBefore2(
104324
+ insertBefore3(
103420
104325
  node,
103421
104326
  "cx:dataLabels",
103422
104327
  buildChartExDataLabels(),
@@ -103447,7 +104352,7 @@ function bindSeriesData(node, dataNodes, chartData, series, getLocalName2) {
103447
104352
  );
103448
104353
  return;
103449
104354
  }
103450
- const inlineKey = findKey29(node, "data", getLocalName2);
104355
+ const inlineKey = findKey32(node, "data", getLocalName2);
103451
104356
  if (inlineKey && !dataIdNode) {
103452
104357
  const inline = node[inlineKey];
103453
104358
  if (inline && typeof inline === "object" && !Array.isArray(inline)) {
@@ -103464,7 +104369,7 @@ function bindSeriesData(node, dataNodes, chartData, series, getLocalName2) {
103464
104369
  if (dataIdNode) {
103465
104370
  dataIdNode["@_val"] = String(id);
103466
104371
  } else {
103467
- insertBefore2(
104372
+ insertBefore3(
103468
104373
  node,
103469
104374
  "cx:dataId",
103470
104375
  { "@_val": String(id) },
@@ -103500,7 +104405,7 @@ function applyLegend(chartRoot, chartData, getLocalName2) {
103500
104405
  if (!style || style.hasLegend === void 0) {
103501
104406
  return;
103502
104407
  }
103503
- const key2 = findKey29(chartRoot, "legend", getLocalName2);
104408
+ const key2 = findKey32(chartRoot, "legend", getLocalName2);
103504
104409
  if (!style.hasLegend) {
103505
104410
  if (key2) {
103506
104411
  delete chartRoot[key2];
@@ -103518,7 +104423,7 @@ function applyLegend(chartRoot, chartData, getLocalName2) {
103518
104423
  delete chartRoot[key2];
103519
104424
  }
103520
104425
  const legend = buildChartExLegend(style.legendPosition);
103521
- insertBefore2(chartRoot, "cx:legend", legend, ["extLst"], getLocalName2);
104426
+ insertBefore3(chartRoot, "cx:legend", legend, ["extLst"], getLocalName2);
103522
104427
  }
103523
104428
  function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
103524
104429
  const region = child24(
@@ -103526,7 +104431,7 @@ function chartExLayoutChanged(chartSpace, chartData, getLocalName2) {
103526
104431
  "plotAreaRegion",
103527
104432
  getLocalName2
103528
104433
  );
103529
- const seriesKey = region ? findKey29(region, "series", getLocalName2) : void 0;
104434
+ const seriesKey = region ? findKey32(region, "series", getLocalName2) : void 0;
103530
104435
  const first = region && seriesKey ? asArray5(region[seriesKey])[0] : void 0;
103531
104436
  const existing = String(first?.["@_layoutId"] ?? "").toLowerCase();
103532
104437
  const series = chartData.series[0];
@@ -103542,11 +104447,11 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
103542
104447
  if (!chartRoot || !region) {
103543
104448
  return false;
103544
104449
  }
103545
- const chartDataKey = findKey29(chartSpace, "chartData", getLocalName2);
104450
+ const chartDataKey = findKey32(chartSpace, "chartData", getLocalName2);
103546
104451
  const chartDataNode = (chartDataKey ? chartSpace[chartDataKey] : void 0) ?? {};
103547
- const dataKey = findKey29(chartDataNode, "data", getLocalName2) ?? "cx:data";
104452
+ const dataKey = findKey32(chartDataNode, "data", getLocalName2) ?? "cx:data";
103548
104453
  const dataNodes = asArray5(chartDataNode[dataKey]);
103549
- const seriesKey = findKey29(region, "series", getLocalName2) ?? "cx:series";
104454
+ const seriesKey = findKey32(region, "series", getLocalName2) ?? "cx:series";
103550
104455
  const existing = asArray5(region[seriesKey]);
103551
104456
  const updated = [];
103552
104457
  chartData.series.forEach((series, index) => {
@@ -103575,7 +104480,7 @@ function applyChartExUpdate(chartSpace, chartData, getLocalName2) {
103575
104480
  region[seriesKey] = updated.length === 1 ? updated[0] : updated;
103576
104481
  chartDataNode[dataKey] = survivingData.length === 1 ? survivingData[0] : survivingData;
103577
104482
  if (!chartDataKey) {
103578
- insertBefore2(chartSpace, "cx:chartData", chartDataNode, ["chart"], getLocalName2);
104483
+ insertBefore3(chartSpace, "cx:chartData", chartDataNode, ["chart"], getLocalName2);
103579
104484
  }
103580
104485
  applyChartTitleToXml(
103581
104486
  chartRoot,
@@ -105939,7 +106844,7 @@ var init_master_color_map = __esm({
105939
106844
 
105940
106845
  // src/pptx/core/services/native-animation-theme-colors.ts
105941
106846
  function resolveToken2(value, resolveThemeColor) {
105942
- if (!value || HEX_COLOR2.test(value)) {
106847
+ if (!value || HEX_COLOR3.test(value)) {
105943
106848
  return value;
105944
106849
  }
105945
106850
  return resolveThemeColor(value) ?? value;
@@ -105963,10 +106868,10 @@ function resolveNativeAnimationThemeColors(animations, resolveThemeColor) {
105963
106868
  } : animation
105964
106869
  );
105965
106870
  }
105966
- var HEX_COLOR2;
106871
+ var HEX_COLOR3;
105967
106872
  var init_native_animation_theme_colors = __esm({
105968
106873
  "src/pptx/core/services/native-animation-theme-colors.ts"() {
105969
- HEX_COLOR2 = /^#?[0-9a-f]{6}$/iu;
106874
+ HEX_COLOR3 = /^#?[0-9a-f]{6}$/iu;
105970
106875
  }
105971
106876
  });
105972
106877
 
@@ -109695,6 +110600,7 @@ var init_PptxHandlerRuntimeSlideMasters = __esm({
109695
110600
  var PptxHandlerRuntime10;
109696
110601
  var init_PptxHandlerRuntimePresentationProps = __esm({
109697
110602
  "src/pptx/core/core/runtime/PptxHandlerRuntimePresentationProps.ts"() {
110603
+ init_chart_area_format();
109698
110604
  init_chart_data_label_parser();
109699
110605
  init_chart_data_labels_visibility();
109700
110606
  init_chart_def_rpr_style();
@@ -109793,27 +110699,18 @@ var init_PptxHandlerRuntimePresentationProps = __esm({
109793
110699
  }
109794
110700
  }
109795
110701
  /**
109796
- * Resolve the `c:spPr` fill of a chart container (`c:chartSpace` or
109797
- * `c:plotArea`) to a colour string, or the literal `'none'` for
109798
- * `<a:noFill/>`. Returns `undefined` when the container declares no fill at
109799
- * all, which leaves the choice to the renderer.
109800
- *
109801
- * `<a:noFill/>` parses to the empty STRING, so presence - not truthiness -
109802
- * has to decide.
110702
+ * Resolve the `c:spPr` fill and border of a chart container
110703
+ * (`c:chartSpace` or `c:plotArea`) to a colour string, or the literal
110704
+ * `'none'` for `<a:noFill/>`; `undefined` when the container declares
110705
+ * nothing, which leaves the choice to the renderer. The save path reads it
110706
+ * back with the same function (`chart-area-format.ts`).
109803
110707
  */
109804
- parseChartContainerFill(container2) {
109805
- const shapeProperties = this.xmlLookupService.getChildByLocalName(container2, "spPr");
109806
- if (!shapeProperties) {
109807
- return void 0;
109808
- }
109809
- const hasNoFill = Object.keys(shapeProperties).some(
109810
- (key2) => this.compatibilityService.getXmlLocalName(key2) === "noFill"
110708
+ parseChartContainerFormat(container2) {
110709
+ return parseChartAreaFormat(
110710
+ container2,
110711
+ (key2) => this.compatibilityService.getXmlLocalName(key2),
110712
+ (node) => this.parseColor(node)
109811
110713
  );
109812
- if (hasNoFill) {
109813
- return "none";
109814
- }
109815
- const solidFill3 = this.xmlLookupService.getChildByLocalName(shapeProperties, "solidFill");
109816
- return solidFill3 ? this.parseColor(solidFill3) : void 0;
109817
110714
  }
109818
110715
  /**
109819
110716
  * Extract chart style metadata from chart XML.
@@ -109829,9 +110726,13 @@ var init_PptxHandlerRuntimePresentationProps = __esm({
109829
110726
  style.styleId = parseInt(String(styleNode["@_val"]));
109830
110727
  hasStyle = true;
109831
110728
  }
109832
- const chartAreaFill = this.parseChartContainerFill(chartSpace);
109833
- if (chartAreaFill) {
109834
- style.chartAreaFill = chartAreaFill;
110729
+ const chartArea = this.parseChartContainerFormat(chartSpace);
110730
+ if (chartArea.fill) {
110731
+ style.chartAreaFill = chartArea.fill;
110732
+ hasStyle = true;
110733
+ }
110734
+ if (chartArea.border) {
110735
+ style.chartAreaBorder = chartArea.border;
109835
110736
  hasStyle = true;
109836
110737
  }
109837
110738
  const chartAreaGradient = parseChartGradientFill(
@@ -109899,9 +110800,13 @@ var init_PptxHandlerRuntimePresentationProps = __esm({
109899
110800
  if (plotAreaGradient) {
109900
110801
  style.plotAreaGradient = plotAreaGradient;
109901
110802
  }
109902
- const plotAreaFill = this.parseChartContainerFill(plotArea);
109903
- if (plotAreaFill) {
109904
- style.plotAreaFill = plotAreaFill;
110803
+ const plotAreaFormat = this.parseChartContainerFormat(plotArea);
110804
+ if (plotAreaFormat.fill) {
110805
+ style.plotAreaFill = plotAreaFormat.fill;
110806
+ hasStyle = true;
110807
+ }
110808
+ if (plotAreaFormat.border) {
110809
+ style.plotAreaBorder = plotAreaFormat.border;
109905
110810
  hasStyle = true;
109906
110811
  }
109907
110812
  const valAx = this.xmlLookupService.getChildByLocalName(plotArea, "valAx");
@@ -115162,7 +116067,10 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
115162
116067
  init_chart_axis_dispunits_serializer();
115163
116068
  init_chart_axis_gridlines_serializer();
115164
116069
  init_chart_axis_label_formatting();
116070
+ init_chart_axis_deleted();
115165
116071
  init_chart_axis_scaling();
116072
+ init_chart_group_options();
116073
+ init_chart_space_format();
115166
116074
  init_chart_axis_title_serializer();
115167
116075
  init_chart_band_fmts();
115168
116076
  init_chart_bubble_options();
@@ -115416,6 +116324,15 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
115416
116324
  } else if (groupingKey) {
115417
116325
  delete chartTypeContainer[groupingKey];
115418
116326
  }
116327
+ const singleContainer = (consolidation?.containerChildren.size ?? 1) <= 1;
116328
+ if (singleContainer && chartData.chartType !== "combo") {
116329
+ applyChartGroupOptionsToXml(
116330
+ chartTypeContainer,
116331
+ containerLocalName,
116332
+ chartData,
116333
+ (key2) => this.compatibilityService.getXmlLocalName(key2)
116334
+ );
116335
+ }
115419
116336
  const seriesNodes = this.xmlLookupService.getChildrenArrayByLocalName(
115420
116337
  chartTypeContainer,
115421
116338
  "ser"
@@ -115820,6 +116737,11 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
115820
116737
  if (!matchingAxis) {
115821
116738
  continue;
115822
116739
  }
116740
+ applyChartAxisDeletedToXml(
116741
+ axisNode,
116742
+ matchingAxis.deleted,
116743
+ (key2) => this.compatibilityService.getXmlLocalName(key2)
116744
+ );
115823
116745
  const scalingNode = this.xmlLookupService.getChildByLocalName(axisNode, "scaling");
115824
116746
  if (scalingNode) {
115825
116747
  applyChartAxisScaling(
@@ -115895,6 +116817,18 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
115895
116817
  }
115896
116818
  }
115897
116819
  }
116820
+ if (chartSpace) {
116821
+ applyChartSpaceFormatToXml(
116822
+ chartSpace,
116823
+ plotArea,
116824
+ chartData,
116825
+ (key2) => this.compatibilityService.getXmlLocalName(key2),
116826
+ {
116827
+ ...this.chartGradientWriteOptions(false),
116828
+ resolveColor: (node) => this.parseColor(node)
116829
+ }
116830
+ );
116831
+ }
115898
116832
  for (const key2 of Object.keys(plotArea)) {
115899
116833
  const local = this.compatibilityService.getXmlLocalName(key2);
115900
116834
  if (!local.endsWith("Chart")) {
@@ -116328,7 +117262,7 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
116328
117262
  });
116329
117263
 
116330
117264
  // src/pptx/core/core/runtime/smartart-definition-builder.ts
116331
- function findKey30(node, name, localName28) {
117265
+ function findKey33(node, name, localName28) {
116332
117266
  return Object.keys(node).find((key2) => localName28(key2) === name);
116333
117267
  }
116334
117268
  function prefixFor(node) {
@@ -116347,7 +117281,7 @@ function setChildren(node, name, values, localName28) {
116347
117281
  if (values === void 0) {
116348
117282
  return false;
116349
117283
  }
116350
- const existing = findKey30(node, name, localName28);
117284
+ const existing = findKey33(node, name, localName28);
116351
117285
  if (values.length === 0) {
116352
117286
  if (existing) {
116353
117287
  delete node[existing];
@@ -116374,7 +117308,7 @@ function applySmartArtDefinitionMetadata(node, metadata, localName28) {
116374
117308
  changed = setChildren(node, "title", textNodes(metadata.titles), localName28) || changed;
116375
117309
  changed = setChildren(node, "desc", textNodes(metadata.descriptions), localName28) || changed;
116376
117310
  if (metadata.categories !== void 0) {
116377
- const key2 = findKey30(node, "catLst", localName28);
117311
+ const key2 = findKey33(node, "catLst", localName28);
116378
117312
  if (metadata.categories.length === 0) {
116379
117313
  if (key2) {
116380
117314
  delete node[key2];
@@ -116398,7 +117332,7 @@ function applySmartArtDefinitionMetadata(node, metadata, localName28) {
116398
117332
  return changed;
116399
117333
  }
116400
117334
  function ensureLabels(node, localName28) {
116401
- const key2 = findKey30(node, "styleLbl", localName28) ?? `${prefixFor(node)}styleLbl`;
117335
+ const key2 = findKey33(node, "styleLbl", localName28) ?? `${prefixFor(node)}styleLbl`;
116402
117336
  return { key: key2, labels: objects(node[key2]) };
116403
117337
  }
116404
117338
  function applySmartArtQuickStyleLabels(node, labels, localName28) {
@@ -116413,7 +117347,7 @@ function applySmartArtQuickStyleLabels(node, labels, localName28) {
116413
117347
  return true;
116414
117348
  }
116415
117349
  function applyColorList(label, name, metadata, localName28) {
116416
- const key2 = findKey30(label, name, localName28) ?? `${prefixFor(label)}${name}`;
117350
+ const key2 = findKey33(label, name, localName28) ?? `${prefixFor(label)}${name}`;
116417
117351
  const list2 = objects(label[key2])[0] ?? {};
116418
117352
  if (metadata.method !== void 0) {
116419
117353
  list2["@_meth"] = metadata.method;
@@ -116456,17 +117390,17 @@ var init_smartart_definition_builder = __esm({
116456
117390
  });
116457
117391
 
116458
117392
  // src/pptx/core/core/runtime/smartart-colors-builder.ts
116459
- function asObject(value) {
117393
+ function asObject2(value) {
116460
117394
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
116461
117395
  }
116462
117396
  function toArray4(value) {
116463
117397
  if (Array.isArray(value)) {
116464
- return value.filter((entry) => Boolean(asObject(entry)));
117398
+ return value.filter((entry) => Boolean(asObject2(entry)));
116465
117399
  }
116466
- const obj = asObject(value);
117400
+ const obj = asObject2(value);
116467
117401
  return obj ? [obj] : [];
116468
117402
  }
116469
- function findKey31(obj, name, getLocalName2) {
117403
+ function findKey34(obj, name, getLocalName2) {
116470
117404
  return Object.keys(obj).find((k) => getLocalName2(k) === name);
116471
117405
  }
116472
117406
  function hex2(value) {
@@ -116481,13 +117415,13 @@ function applyColorToList(list2, value, getLocalName2, resolveColor2) {
116481
117415
  }
116482
117416
  const existing = list2[colorKey];
116483
117417
  if (resolveColor2) {
116484
- const authored = asObject(Array.isArray(existing) ? existing[0] : existing);
117418
+ const authored = asObject2(Array.isArray(existing) ? existing[0] : existing);
116485
117419
  const authoredHex = authored ? resolveColor2({ [colorKey]: authored }) : void 0;
116486
117420
  if (authoredHex && colorsEqual(authoredHex, value)) {
116487
117421
  return;
116488
117422
  }
116489
117423
  }
116490
- const rest = Array.isArray(existing) ? existing.slice(1).filter((entry) => Boolean(asObject(entry))) : [];
117424
+ const rest = Array.isArray(existing) ? existing.slice(1).filter((entry) => Boolean(asObject2(entry))) : [];
116491
117425
  if (colorKey !== "a:srgbClr") {
116492
117426
  delete list2[colorKey];
116493
117427
  }
@@ -116502,7 +117436,7 @@ function applyColorListValues(list2, values, getLocalName2, resolveColor2) {
116502
117436
  const existing = Array.isArray(existingRaw) ? existingRaw : existingRaw ? [existingRaw] : [];
116503
117437
  if (resolveColor2 && colorKey && existing.length === values.length) {
116504
117438
  const unchanged2 = existing.every((entryRaw, index) => {
116505
- const entry = asObject(entryRaw);
117439
+ const entry = asObject2(entryRaw);
116506
117440
  const authoredHex = entry ? resolveColor2({ [colorKey]: entry }) : void 0;
116507
117441
  return authoredHex !== void 0 && colorsEqual(authoredHex, values[index]);
116508
117442
  });
@@ -116525,16 +117459,16 @@ function applyRoleColors(labels, roleColors, getLocalName2, resolveColor2) {
116525
117459
  if (!role) {
116526
117460
  continue;
116527
117461
  }
116528
- const fillKey = findKey31(label, "fillClrLst", getLocalName2);
117462
+ const fillKey = findKey34(label, "fillClrLst", getLocalName2);
116529
117463
  if (fillKey) {
116530
- const list2 = asObject(label[fillKey]);
117464
+ const list2 = asObject2(label[fillKey]);
116531
117465
  if (list2 && applyColorListValues(list2, role.fill, getLocalName2, resolveColor2)) {
116532
117466
  mutated = true;
116533
117467
  }
116534
117468
  }
116535
- const lineKey = findKey31(label, "linClrLst", getLocalName2);
117469
+ const lineKey = findKey34(label, "linClrLst", getLocalName2);
116536
117470
  if (lineKey) {
116537
- const list2 = asObject(label[lineKey]);
117471
+ const list2 = asObject2(label[lineKey]);
116538
117472
  if (list2 && applyColorListValues(list2, role.line, getLocalName2, resolveColor2)) {
116539
117473
  mutated = true;
116540
117474
  }
@@ -116549,7 +117483,7 @@ function applySmartArtColorTransform(colorsDef, transform2, getLocalName2, resol
116549
117483
  let mutated = false;
116550
117484
  mutated = applySmartArtDefinitionMetadata(colorsDef, transform2, getLocalName2) || mutated;
116551
117485
  mutated = applySmartArtColorStyleLabels(colorsDef, transform2.labels, getLocalName2) || mutated;
116552
- const styleLblKey = findKey31(colorsDef, "styleLbl", getLocalName2);
117486
+ const styleLblKey = findKey34(colorsDef, "styleLbl", getLocalName2);
116553
117487
  if (!styleLblKey) {
116554
117488
  return mutated;
116555
117489
  }
@@ -116563,19 +117497,19 @@ function applySmartArtColorTransform(colorsDef, transform2, getLocalName2, resol
116563
117497
  let fillIndex = 0;
116564
117498
  let lineIndex = 0;
116565
117499
  for (const label of labels) {
116566
- const fillKey = findKey31(label, "fillClrLst", getLocalName2);
117500
+ const fillKey = findKey34(label, "fillClrLst", getLocalName2);
116567
117501
  if (fillKey) {
116568
117502
  const value = transform2.fillColors[fillIndex++];
116569
- const list2 = asObject(label[fillKey]);
117503
+ const list2 = asObject2(label[fillKey]);
116570
117504
  if (list2 && value) {
116571
117505
  applyColorToList(list2, value, getLocalName2, resolveColor2);
116572
117506
  mutated = true;
116573
117507
  }
116574
117508
  }
116575
- const lineKey = findKey31(label, "linClrLst", getLocalName2);
117509
+ const lineKey = findKey34(label, "linClrLst", getLocalName2);
116576
117510
  if (lineKey) {
116577
117511
  const value = transform2.lineColors[lineIndex++];
116578
- const list2 = asObject(label[lineKey]);
117512
+ const list2 = asObject2(label[lineKey]);
116579
117513
  if (list2 && value) {
116580
117514
  applyColorToList(list2, value, getLocalName2, resolveColor2);
116581
117515
  mutated = true;
@@ -116832,40 +117766,40 @@ var init_smartart_quick_style_builder = __esm({
116832
117766
  });
116833
117767
 
116834
117768
  // src/pptx/core/core/runtime/smartart-save-chrome.ts
116835
- function asObject2(value) {
117769
+ function asObject3(value) {
116836
117770
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
116837
117771
  }
116838
117772
  function applySmartArtChrome(dataModel, chrome, getLocalName2) {
116839
117773
  if (!chrome || !chrome.backgroundColor && !chrome.backgroundFillXml && !chrome.outlineColor && (chrome.outlineWidth === null || chrome.outlineWidth === void 0)) {
116840
117774
  return;
116841
117775
  }
116842
- const findKey32 = (obj, name) => Object.keys(obj).find((k) => getLocalName2(k) === name);
117776
+ const findKey35 = (obj, name) => Object.keys(obj).find((k) => getLocalName2(k) === name);
116843
117777
  if (chrome.backgroundFillXml) {
116844
- const bgKey = findKey32(dataModel, "bg") ?? "dgm:bg";
116845
- const bg = asObject2(dataModel[bgKey]);
116846
- const fillKey = findKey32(bg, chrome.backgroundFillXml.localName) ?? `a:${chrome.backgroundFillXml.localName}`;
117778
+ const bgKey = findKey35(dataModel, "bg") ?? "dgm:bg";
117779
+ const bg = asObject3(dataModel[bgKey]);
117780
+ const fillKey = findKey35(bg, chrome.backgroundFillXml.localName) ?? `a:${chrome.backgroundFillXml.localName}`;
116847
117781
  bg[fillKey] = chrome.backgroundFillXml.xml;
116848
117782
  dataModel[bgKey] = bg;
116849
117783
  } else if (chrome.backgroundColor) {
116850
117784
  const hex3 = chrome.backgroundColor.replace("#", "");
116851
- const bgKey = findKey32(dataModel, "bg") ?? "dgm:bg";
116852
- const bg = asObject2(dataModel[bgKey]);
116853
- const fillKey = findKey32(bg, "solidFill") ?? "a:solidFill";
117785
+ const bgKey = findKey35(dataModel, "bg") ?? "dgm:bg";
117786
+ const bg = asObject3(dataModel[bgKey]);
117787
+ const fillKey = findKey35(bg, "solidFill") ?? "a:solidFill";
116854
117788
  bg[fillKey] = { "a:srgbClr": { "@_val": hex3 } };
116855
117789
  dataModel[bgKey] = bg;
116856
117790
  }
116857
117791
  const hasOutlineWidth = chrome.outlineWidth !== null && chrome.outlineWidth !== void 0;
116858
117792
  if (chrome.outlineColor || hasOutlineWidth) {
116859
- const wholeKey = findKey32(dataModel, "whole") ?? "dgm:whole";
116860
- const whole = asObject2(dataModel[wholeKey]);
116861
- const lnKey = findKey32(whole, "ln") ?? "a:ln";
116862
- const ln = asObject2(whole[lnKey]);
117793
+ const wholeKey = findKey35(dataModel, "whole") ?? "dgm:whole";
117794
+ const whole = asObject3(dataModel[wholeKey]);
117795
+ const lnKey = findKey35(whole, "ln") ?? "a:ln";
117796
+ const ln = asObject3(whole[lnKey]);
116863
117797
  if (hasOutlineWidth) {
116864
117798
  ln["@_w"] = String(Math.round(chrome.outlineWidth * 12700));
116865
117799
  }
116866
117800
  if (chrome.outlineColor) {
116867
117801
  const hex3 = chrome.outlineColor.replace("#", "");
116868
- const fillKey = findKey32(ln, "solidFill") ?? "a:solidFill";
117802
+ const fillKey = findKey35(ln, "solidFill") ?? "a:solidFill";
116869
117803
  ln[fillKey] = { "a:srgbClr": { "@_val": hex3 } };
116870
117804
  }
116871
117805
  whole[lnKey] = ln;
@@ -135208,6 +136142,7 @@ var init_PptxHandlerRuntimeChartColorStyle = __esm({
135208
136142
  var SCATTER_STYLES, PptxHandlerRuntime94;
135209
136143
  var init_PptxHandlerRuntimeChartParsing = __esm({
135210
136144
  "src/pptx/core/core/runtime/PptxHandlerRuntimeChartParsing.ts"() {
136145
+ init_units2();
135211
136146
  init_chart_advanced_parser();
135212
136147
  init_chart_axis_parser();
135213
136148
  init_chart_band_fmts();
@@ -135790,6 +136725,10 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
135790
136725
  const lineNoFill = seriesLine ? Object.keys(seriesLine).some(
135791
136726
  (key2) => this.compatibilityService.getXmlLocalName(key2) === "noFill"
135792
136727
  ) : false;
136728
+ const lineWidthEmu = Number(seriesLine?.["@_w"]);
136729
+ const lineWidth = Number.isFinite(lineWidthEmu) && lineWidthEmu > 0 ? lineWidthEmu / EMU_PER_POINT : void 0;
136730
+ const lineDashRaw = this.xmlLookupService.getChildByLocalName(seriesLine, "prstDash")?.["@_val"];
136731
+ const lineDashStyle = typeof lineDashRaw === "string" && lineDashRaw.length > 0 ? lineDashRaw : void 0;
135793
136732
  const smoothNode = this.xmlLookupService.getChildByLocalName(seriesNode, "smooth");
135794
136733
  const smooth = smoothNode ? !(smoothNode["@_val"] === "0" || smoothNode["@_val"] === "false") : void 0;
135795
136734
  const invertNode = this.xmlLookupService.getChildByLocalName(seriesNode, "invertIfNegative");
@@ -135808,6 +136747,8 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
135808
136747
  ...bubbleSizes.length > 0 ? { bubbleSizes } : {},
135809
136748
  ...dataLabelOptions && Object.keys(dataLabelOptions).length > 0 ? { dataLabelOptions } : {},
135810
136749
  ...lineNoFill ? { lineNoFill } : {},
136750
+ ...lineWidth !== void 0 ? { lineWidth } : {},
136751
+ ...lineDashStyle ? { lineDashStyle } : {},
135811
136752
  ...seriesNumberFormat ? { numberFormat: seriesNumberFormat } : {},
135812
136753
  color: seriesColor2,
135813
136754
  ...this.colorStyleCodec ? seriesGradientFill(seriesShapeProperties, this.xmlLookupService, this.colorStyleCodec) : {},
@@ -142238,293 +143179,11 @@ function applyTemplate(data, templateData) {
142238
143179
  }
142239
143180
  }
142240
143181
 
142241
- // src/pptx/core/builders/sdk/chart-operations.ts
142242
- function ensureChartData(element) {
142243
- if (!element.chartData) {
142244
- throw new Error(
142245
- "Chart element has no chartData. Cannot perform chart operations on an uninitialised chart."
142246
- );
142247
- }
142248
- }
142249
- function validateSeriesIndex(element, seriesIndex) {
142250
- ensureChartData(element);
142251
- if (seriesIndex < 0 || seriesIndex >= element.chartData.series.length) {
142252
- throw new RangeError(
142253
- `Series index ${seriesIndex} is out of range. Chart has ${element.chartData.series.length} series (indices 0\u2013${element.chartData.series.length - 1}).`
142254
- );
142255
- }
142256
- }
142257
- function setChartType(element, newType) {
142258
- ensureChartData(element);
142259
- element.chartData.chartType = newType;
142260
- }
142261
- function addChartSeries(element, series) {
142262
- ensureChartData(element);
142263
- element.chartData.series.push({
142264
- name: series.name,
142265
- values: series.values,
142266
- color: series.color
142267
- });
142268
- }
142269
- function removeChartSeries(element, seriesIndex) {
142270
- validateSeriesIndex(element, seriesIndex);
142271
- element.chartData.series.splice(seriesIndex, 1);
142272
- }
142273
- function setChartCategories(element, categories) {
142274
- ensureChartData(element);
142275
- element.chartData.categories = categories;
142276
- }
142277
- function updateChartSeriesValues(element, seriesIndex, values) {
142278
- validateSeriesIndex(element, seriesIndex);
142279
- element.chartData.series[seriesIndex].values = values;
142280
- }
142281
- function setChartTitle(element, title) {
142282
- ensureChartData(element);
142283
- element.chartData.title = title;
142284
- }
142285
- function setChartGrouping(element, grouping) {
142286
- ensureChartData(element);
142287
- element.chartData.grouping = grouping;
142288
- }
142289
- function setChartLegend(element, options) {
142290
- ensureChartData(element);
142291
- const style = element.chartData.style ??= {};
142292
- if (options.show !== void 0) {
142293
- style.hasLegend = options.show;
142294
- }
142295
- if (options.position !== void 0) {
142296
- style.legendPosition = options.position;
142297
- if (style.hasLegend === void 0) {
142298
- style.hasLegend = true;
142299
- }
142300
- }
142301
- }
142302
- function setChartDataLabels(element, edit) {
142303
- ensureChartData(element);
142304
- const style = element.chartData.style ??= {};
142305
- if (edit.show !== void 0) {
142306
- style.hasDataLabels = edit.show;
142307
- const labels = style.dataLabels;
142308
- const anyContent = labels?.showValue === true || labels?.showCategory === true || labels?.showSeriesName === true || labels?.showPercent === true || labels?.showBubbleSize === true;
142309
- if (edit.show && labels !== void 0 && !anyContent && edit.showValue === void 0) {
142310
- labels.showValue = true;
142311
- }
142312
- }
142313
- const contentKeys = [
142314
- "showValue",
142315
- "showCategory",
142316
- "showSeriesName",
142317
- "showPercent",
142318
- "showLegendKey"
142319
- ];
142320
- const hasContentEdit = contentKeys.some((k) => edit[k] !== void 0) || edit.position !== void 0;
142321
- if (hasContentEdit) {
142322
- const opts = style.dataLabels ??= {};
142323
- for (const k of contentKeys) {
142324
- if (edit[k] !== void 0) {
142325
- opts[k] = edit[k];
142326
- }
142327
- }
142328
- if (edit.position !== void 0) {
142329
- opts.position = edit.position || void 0;
142330
- }
142331
- if (style.hasDataLabels === void 0) {
142332
- style.hasDataLabels = true;
142333
- }
142334
- }
142335
- }
142336
- function setChartSeriesTrendline(element, seriesIndex, trendline) {
142337
- validateSeriesIndex(element, seriesIndex);
142338
- element.chartData.series[seriesIndex].trendlines = trendline ? [trendline] : [];
142339
- }
142340
- function setChartSeriesErrorBars(element, seriesIndex, errBars) {
142341
- validateSeriesIndex(element, seriesIndex);
142342
- element.chartData.series[seriesIndex].errBars = errBars ? [errBars] : [];
142343
- }
142344
- function setChartAxis(element, axisType, edit) {
142345
- ensureChartData(element);
142346
- const axes = element.chartData.axes ??= [];
142347
- let axis = axes.find((a) => a.axisType === axisType);
142348
- if (!axis) {
142349
- axis = { axisType };
142350
- axes.push(axis);
142351
- }
142352
- if (edit.min !== void 0) {
142353
- axis.min = edit.min ?? void 0;
142354
- }
142355
- if (edit.max !== void 0) {
142356
- axis.max = edit.max ?? void 0;
142357
- }
142358
- if (edit.majorUnit !== void 0) {
142359
- axis.majorUnit = edit.majorUnit ?? void 0;
142360
- }
142361
- if (edit.minorUnit !== void 0) {
142362
- axis.minorUnit = edit.minorUnit ?? void 0;
142363
- }
142364
- if (edit.orientation !== void 0) {
142365
- axis.orientation = edit.orientation ?? void 0;
142366
- }
142367
- if (edit.numberFormat !== void 0) {
142368
- axis.numFmt = edit.numberFormat ? { formatCode: edit.numberFormat, sourceLinked: false } : void 0;
142369
- }
142370
- if (edit.tickLabelPosition !== void 0) {
142371
- axis.tickLblPos = edit.tickLabelPosition;
142372
- }
142373
- if (edit.title !== void 0) {
142374
- axis.titleText = edit.title ?? "";
142375
- }
142376
- if (edit.majorGridlines !== void 0) {
142377
- axis.majorGridlines = edit.majorGridlines;
142378
- }
142379
- if (edit.minorGridlines !== void 0) {
142380
- axis.minorGridlines = edit.minorGridlines;
142381
- }
142382
- if (edit.displayUnits !== void 0) {
142383
- axis.displayUnits = edit.displayUnits ?? void 0;
142384
- }
142385
- if (edit.displayUnitsValue !== void 0) {
142386
- axis.displayUnitsValue = edit.displayUnitsValue ?? void 0;
142387
- }
142388
- if (edit.displayUnitsLabel !== void 0) {
142389
- axis.displayUnitsLabel = edit.displayUnitsLabel;
142390
- }
142391
- }
142392
- function setChartSeriesMarker(element, seriesIndex, marker) {
142393
- validateSeriesIndex(element, seriesIndex);
142394
- const series = element.chartData.series[seriesIndex];
142395
- if (marker === null) {
142396
- series.marker = void 0;
142397
- return;
142398
- }
142399
- const existing = series.marker;
142400
- if ("symbol" in marker && "spPr" in marker) {
142401
- series.marker = marker;
142402
- return;
142403
- }
142404
- const patch = marker;
142405
- const next = {
142406
- symbol: patch.symbol ?? existing?.symbol ?? "circle",
142407
- size: patch.size ?? existing?.size,
142408
- spPr: existing?.spPr ? { ...existing.spPr } : void 0
142409
- };
142410
- if (patch.fillColor !== void 0) {
142411
- next.spPr = { ...next.spPr ?? {}, fillColor: patch.fillColor };
142412
- }
142413
- series.marker = next;
142414
- }
142415
- function ensureDataPoint(series, pointIndex) {
142416
- const points4 = series.dataPoints ??= [];
142417
- let dp = points4.find((p) => p.idx === pointIndex);
142418
- if (!dp) {
142419
- dp = { idx: pointIndex };
142420
- points4.push(dp);
142421
- points4.sort((a, b) => a.idx - b.idx);
142422
- }
142423
- return dp;
142424
- }
142425
- function setChartDataPointExplosion(element, seriesIndex, pointIndex, explosion) {
142426
- validateSeriesIndex(element, seriesIndex);
142427
- const series = element.chartData.series[seriesIndex];
142428
- if (explosion === null) {
142429
- const dp2 = series.dataPoints?.find((p) => p.idx === pointIndex);
142430
- if (dp2) {
142431
- dp2.explosion = void 0;
142432
- removeEmptyDataPoint(series, pointIndex);
142433
- }
142434
- return;
142435
- }
142436
- const dp = ensureDataPoint(series, pointIndex);
142437
- dp.explosion = explosion;
142438
- }
142439
- function setChartDataPointMarker(element, seriesIndex, pointIndex, marker) {
142440
- validateSeriesIndex(element, seriesIndex);
142441
- const series = element.chartData.series[seriesIndex];
142442
- if (marker === null) {
142443
- const dp2 = series.dataPoints?.find((p) => p.idx === pointIndex);
142444
- if (dp2) {
142445
- dp2.marker = void 0;
142446
- removeEmptyDataPoint(series, pointIndex);
142447
- }
142448
- return;
142449
- }
142450
- const dp = ensureDataPoint(series, pointIndex);
142451
- const existing = dp.marker;
142452
- const next = {
142453
- symbol: marker.symbol ?? existing?.symbol ?? "circle",
142454
- size: marker.size ?? existing?.size,
142455
- spPr: existing?.spPr ? { ...existing.spPr } : void 0
142456
- };
142457
- if (marker.fillColor !== void 0) {
142458
- next.spPr = { ...next.spPr ?? {}, fillColor: marker.fillColor };
142459
- }
142460
- dp.marker = next;
142461
- }
142462
- function applyLabelEdit(label, edit) {
142463
- if (edit.showValue !== void 0) {
142464
- label.showVal = edit.showValue;
142465
- }
142466
- if (edit.showCategory !== void 0) {
142467
- label.showCatName = edit.showCategory;
142468
- }
142469
- if (edit.showSeriesName !== void 0) {
142470
- label.showSerName = edit.showSeriesName;
142471
- }
142472
- if (edit.showPercent !== void 0) {
142473
- label.showPercent = edit.showPercent;
142474
- }
142475
- if (edit.showLegendKey !== void 0) {
142476
- label.showLegendKey = edit.showLegendKey;
142477
- }
142478
- if (edit.position !== void 0) {
142479
- label.position = edit.position;
142480
- }
142481
- if (edit.text !== void 0) {
142482
- label.text = edit.text === "" ? void 0 : edit.text;
142483
- }
142484
- if (edit.spPr !== void 0) {
142485
- label.spPr = edit.spPr === null ? void 0 : { ...label.spPr ?? {}, ...edit.spPr };
142486
- }
142487
- if (edit.txPr !== void 0) {
142488
- label.txPr = edit.txPr === null ? void 0 : { ...label.txPr ?? {}, ...edit.txPr };
142489
- }
142490
- }
142491
- function setChartDataPointLabel(element, seriesIndex, pointIndex, edit) {
142492
- validateSeriesIndex(element, seriesIndex);
142493
- const series = element.chartData.series[seriesIndex];
142494
- if (edit === null) {
142495
- if (!series.dataLabels) {
142496
- return;
142497
- }
142498
- series.dataLabels = series.dataLabels.filter((l) => l.idx !== pointIndex);
142499
- if (series.dataLabels.length === 0) {
142500
- series.dataLabels = void 0;
142501
- }
142502
- return;
142503
- }
142504
- const labels = series.dataLabels ??= [];
142505
- let label = labels.find((l) => l.idx === pointIndex);
142506
- if (!label) {
142507
- label = { idx: pointIndex };
142508
- labels.push(label);
142509
- labels.sort((a, b) => a.idx - b.idx);
142510
- }
142511
- applyLabelEdit(label, edit);
142512
- }
142513
- function removeEmptyDataPoint(series, pointIndex) {
142514
- if (!series.dataPoints) {
142515
- return;
142516
- }
142517
- const dp = series.dataPoints.find((p) => p.idx === pointIndex);
142518
- if (!dp) {
142519
- return;
142520
- }
142521
- const empty = dp.spPr === void 0 && dp.gradientFill === void 0 && dp.explosion === void 0 && dp.invertIfNegative === void 0 && dp.bubble3D === void 0 && dp.marker === void 0;
142522
- if (empty) {
142523
- series.dataPoints = series.dataPoints.filter((p) => p.idx !== pointIndex);
142524
- }
142525
- }
143182
+ // src/pptx/core/builders/sdk/index.ts
143183
+ init_chart_operations();
142526
143184
 
142527
143185
  // src/pptx/core/builders/sdk/chart-formatting-operations.ts
143186
+ init_chart_operations();
142528
143187
  function setChartDataPointStyle(element, seriesIndex, pointIndex, style) {
142529
143188
  validateSeriesIndex(element, seriesIndex);
142530
143189
  const series = element.chartData.series[seriesIndex];
@@ -142807,6 +143466,53 @@ var ChartBuilder = class _ChartBuilder {
142807
143466
  this._input.grouping = mode;
142808
143467
  return this;
142809
143468
  }
143469
+ // -- Spacing, geometry and areas (validated by build()) -----------------
143470
+ /** Gap between bar clusters, % of bar width (`c:gapWidth`, 0..500). Bar, bar3D, ofPie. */
143471
+ gapWidth(percent) {
143472
+ this._input.gapWidth = percent;
143473
+ return this;
143474
+ }
143475
+ /** Overlap of bars within a cluster, % (`c:overlap`, -100..100). 2-D bar only. */
143476
+ overlap(percent) {
143477
+ this._input.overlap = percent;
143478
+ return this;
143479
+ }
143480
+ /** Angle of the first slice, degrees clockwise from 12 o'clock (`c:firstSliceAng`, 0..360). */
143481
+ firstSliceAngle(degrees) {
143482
+ this._input.firstSliceAngle = degrees;
143483
+ return this;
143484
+ }
143485
+ /** Doughnut hole size, % of the diameter (`c:holeSize`, 1..90). */
143486
+ holeSize(percent) {
143487
+ this._input.holeSize = percent;
143488
+ return this;
143489
+ }
143490
+ /**
143491
+ * Chart-area fill, border and rounded corners.
143492
+ *
143493
+ * @example
143494
+ * ```ts
143495
+ * builder.chartArea({ fill: "none", border: "none", roundedCorners: false });
143496
+ * ```
143497
+ */
143498
+ chartArea(format) {
143499
+ this._input.chartArea = format;
143500
+ return this;
143501
+ }
143502
+ /** Plot-area fill and border. */
143503
+ plotArea(format) {
143504
+ this._input.plotArea = format;
143505
+ return this;
143506
+ }
143507
+ /**
143508
+ * Edit an axis, e.g. `.axis("catAx", { visible: false })` to hide it.
143509
+ * Merges with earlier edits of the same axis.
143510
+ */
143511
+ axis(axisType, edit) {
143512
+ const axes = this._input.axes ??= {};
143513
+ axes[axisType] = { ...axes[axisType], ...edit };
143514
+ return this;
143515
+ }
142810
143516
  // -- Build --------------------------------------------------------------
142811
143517
  /**
142812
143518
  * Build the final {@link ChartPptxElement}.
@@ -143933,6 +144639,9 @@ function cssColorSafe(value) {
143933
144639
  }
143934
144640
  return void 0;
143935
144641
  }
144642
+ function cssBorderPx(width) {
144643
+ return Math.max(1, Math.round(width));
144644
+ }
143936
144645
  function cssFontFamilySafe(value) {
143937
144646
  if (typeof value !== "string") {
143938
144647
  return void 0;
@@ -144060,19 +144769,19 @@ ${htmlRows.join("\n")}
144060
144769
  const edges = [];
144061
144770
  const topColor = cssColorSafe(style.borderTopColor);
144062
144771
  if (style.borderTopWidth && topColor) {
144063
- edges.push(`border-top:${Math.round(style.borderTopWidth)}px solid ${topColor}`);
144772
+ edges.push(`border-top:${cssBorderPx(style.borderTopWidth)}px solid ${topColor}`);
144064
144773
  }
144065
144774
  const bottomColor = cssColorSafe(style.borderBottomColor);
144066
144775
  if (style.borderBottomWidth && bottomColor) {
144067
- edges.push(`border-bottom:${Math.round(style.borderBottomWidth)}px solid ${bottomColor}`);
144776
+ edges.push(`border-bottom:${cssBorderPx(style.borderBottomWidth)}px solid ${bottomColor}`);
144068
144777
  }
144069
144778
  const leftColor = cssColorSafe(style.borderLeftColor);
144070
144779
  if (style.borderLeftWidth && leftColor) {
144071
- edges.push(`border-left:${Math.round(style.borderLeftWidth)}px solid ${leftColor}`);
144780
+ edges.push(`border-left:${cssBorderPx(style.borderLeftWidth)}px solid ${leftColor}`);
144072
144781
  }
144073
144782
  const rightColor = cssColorSafe(style.borderRightColor);
144074
144783
  if (style.borderRightWidth && rightColor) {
144075
- edges.push(`border-right:${Math.round(style.borderRightWidth)}px solid ${rightColor}`);
144784
+ edges.push(`border-right:${cssBorderPx(style.borderRightWidth)}px solid ${rightColor}`);
144076
144785
  }
144077
144786
  const fallback = cssColorSafe(style.borderColor);
144078
144787
  if (edges.length === 0 && fallback) {
@@ -144092,7 +144801,7 @@ ${htmlRows.join("\n")}
144092
144801
  if (t === 0 && r === 0 && b === 0 && l === 0) {
144093
144802
  return "";
144094
144803
  }
144095
- return `padding:${t}px ${r}px ${b}px ${l}px`;
144804
+ return `padding:${Math.round(t)}px ${Math.round(r)}px ${Math.round(b)}px ${Math.round(l)}px`;
144096
144805
  }
144097
144806
  /**
144098
144807
  * Renders cell content as HTML spans preserving per-run styling