@pixerate/editor 0.256.0 → 0.258.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 (124) hide show
  1. package/dist/agent/index.cjs +40 -38
  2. package/dist/agent/index.js +9 -7
  3. package/dist/animation/index.cjs +4 -2
  4. package/dist/animation/index.js +4 -2
  5. package/dist/animation-editor/index.cjs +63 -61
  6. package/dist/animation-editor/index.js +7 -5
  7. package/dist/brushes/colour.d.cts +11 -0
  8. package/dist/brushes/colour.d.ts +11 -0
  9. package/dist/brushes/index.cjs +51 -30
  10. package/dist/brushes/index.d.cts +1 -0
  11. package/dist/brushes/index.d.ts +1 -0
  12. package/dist/brushes/index.js +25 -4
  13. package/dist/brushes/resolve.d.cts +2 -0
  14. package/dist/brushes/resolve.d.ts +2 -0
  15. package/dist/brushes/schema.d.cts +1 -0
  16. package/dist/brushes/schema.d.ts +1 -0
  17. package/dist/brushes/tools.d.cts +7 -0
  18. package/dist/brushes/tools.d.ts +7 -0
  19. package/dist/brushes/types.d.cts +10 -2
  20. package/dist/brushes/types.d.ts +10 -2
  21. package/dist/brushes/ui.d.cts +14 -3
  22. package/dist/brushes/ui.d.ts +14 -3
  23. package/dist/{brushstrokeRender-HCOQUSWW.js → brushstrokeRender-JI4W6F2G.js} +2 -2
  24. package/dist/{brushstrokeRender-ZZOXI5O5.cjs → brushstrokeRender-MQ6PSDM5.cjs} +11 -11
  25. package/dist/canvas/index.cjs +20 -18
  26. package/dist/canvas/index.js +7 -5
  27. package/dist/chart/index.cjs +159 -157
  28. package/dist/chart/index.js +9 -7
  29. package/dist/{chunk-7272D3K2.js → chunk-2EUW2XZX.js} +27 -276
  30. package/dist/{chunk-L6Y7TSQ4.js → chunk-2VJ6OVJV.js} +1 -1
  31. package/dist/{chunk-6ZZKRH7R.js → chunk-47V3WXDG.js} +2 -2
  32. package/dist/{chunk-H7ET2ISK.cjs → chunk-4IMD2TLY.cjs} +52 -52
  33. package/dist/{chunk-VUKUTT2W.js → chunk-4M4E3N6X.js} +1 -1
  34. package/dist/{chunk-TBAVCLEQ.cjs → chunk-5Q5MLXAD.cjs} +23 -23
  35. package/dist/{chunk-MONXNVZK.js → chunk-6I23ZCGK.js} +5 -3
  36. package/dist/{chunk-GOBOCZZI.js → chunk-6NQPKNUZ.js} +1 -1
  37. package/dist/{chunk-WYGSR3IJ.js → chunk-AORZ5M5C.js} +1 -1
  38. package/dist/chunk-AVTPZO4Z.cjs +142 -0
  39. package/dist/{chunk-WKMUBATU.js → chunk-C2WEIEUB.js} +1 -1
  40. package/dist/{chunk-P3K2JCJA.js → chunk-D5BXSOSU.js} +3 -3
  41. package/dist/chunk-E2V5DA3W.js +36 -0
  42. package/dist/{chunk-WZOGDKCQ.js → chunk-F7CPSRLN.js} +0 -133
  43. package/dist/chunk-FJBQTZS4.js +17 -0
  44. package/dist/{chunk-SOSBOS5T.cjs → chunk-G23BTQA5.cjs} +22 -22
  45. package/dist/{chunk-EUIDTZNQ.cjs → chunk-I3Y2Q3PM.cjs} +59 -308
  46. package/dist/{chunk-YHUMGBZD.js → chunk-ICTPLVSR.js} +22 -4
  47. package/dist/{chunk-LRNUZKWV.cjs → chunk-IPUTIUGQ.cjs} +1 -1
  48. package/dist/{chunk-6GRUVGKU.js → chunk-ITURMC2M.js} +3 -3
  49. package/dist/{chunk-HYWRU5VX.js → chunk-IXQZHCOF.js} +1 -1
  50. package/dist/chunk-J5UQHWVL.js +142 -0
  51. package/dist/{chunk-YBAPT7NL.js → chunk-JC2SHA4A.js} +1 -23
  52. package/dist/chunk-LRTR4ASZ.cjs +17 -0
  53. package/dist/{chunk-HUAISCUX.cjs → chunk-M2HG5DJ2.cjs} +18 -18
  54. package/dist/{chunk-N76AMOKE.cjs → chunk-MDLEGVEN.cjs} +42 -42
  55. package/dist/chunk-MEGSQUQO.cjs +36 -0
  56. package/dist/chunk-MLLTWAXH.cjs +276 -0
  57. package/dist/{chunk-RHPSE2YR.js → chunk-MQ6MGIQM.js} +2 -2
  58. package/dist/{chunk-PGPFWC35.cjs → chunk-MQGQTKVW.cjs} +51 -33
  59. package/dist/{chunk-5YWWQ36H.cjs → chunk-O3ZVZSNJ.cjs} +9 -9
  60. package/dist/{chunk-GCTUOTCW.cjs → chunk-P3PZ63M3.cjs} +35 -35
  61. package/dist/{chunk-WRZ6C4TU.cjs → chunk-P6WYDBTH.cjs} +4 -4
  62. package/dist/{chunk-CJ6TBL2N.cjs → chunk-RHEMMGCN.cjs} +16 -16
  63. package/dist/{chunk-HIMGBZAM.cjs → chunk-RSIKDWOP.cjs} +201 -38
  64. package/dist/{chunk-SABJMH6M.cjs → chunk-RVGP2XLF.cjs} +2 -135
  65. package/dist/{chunk-JVRLGV3C.js → chunk-SMTUQWGY.js} +184 -21
  66. package/dist/{chunk-DMTEQ6SH.js → chunk-SSFMWJDK.js} +4 -4
  67. package/dist/{chunk-TFF2GTGN.cjs → chunk-SXQHWXEL.cjs} +2 -24
  68. package/dist/{chunk-IWEVV63O.cjs → chunk-UEYLANO3.cjs} +18 -16
  69. package/dist/chunk-VR6OGHU5.js +276 -0
  70. package/dist/{chunk-AF23QK5F.js → chunk-YQ4PQTBB.js} +1 -1
  71. package/dist/{chunk-B7V34GIH.cjs → chunk-YSGW7VV4.cjs} +88 -88
  72. package/dist/{chunk-3NS5C7FB.cjs → chunk-YYBW6DF2.cjs} +76 -76
  73. package/dist/{chunk-UFEDHACQ.js → chunk-Z7BX4TWO.js} +2 -2
  74. package/dist/{chunk-RUONPPMC.cjs → chunk-ZSE25IZA.cjs} +8 -8
  75. package/dist/color/index.cjs +7 -3
  76. package/dist/color/index.js +18 -14
  77. package/dist/export/index.cjs +8 -6
  78. package/dist/export/index.js +7 -5
  79. package/dist/extensions/index.cjs +11 -9
  80. package/dist/extensions/index.js +10 -8
  81. package/dist/gradient/index.cjs +33 -31
  82. package/dist/gradient/index.js +5 -3
  83. package/dist/image-editor/brush-presets.d.cts +4 -1
  84. package/dist/image-editor/brush-presets.d.ts +4 -1
  85. package/dist/image-editor/controller.d.cts +10 -5
  86. package/dist/image-editor/controller.d.ts +10 -5
  87. package/dist/image-editor/index.cjs +1090 -1073
  88. package/dist/image-editor/index.js +37 -20
  89. package/dist/index.cjs +17 -15
  90. package/dist/index.js +11 -9
  91. package/dist/paint-editor/brushes.d.cts +18 -1
  92. package/dist/paint-editor/brushes.d.ts +18 -1
  93. package/dist/paint-editor/collaboration.d.cts +38 -0
  94. package/dist/paint-editor/collaboration.d.ts +38 -0
  95. package/dist/paint-editor/controller.d.cts +60 -0
  96. package/dist/paint-editor/controller.d.ts +60 -0
  97. package/dist/paint-editor/engine.d.cts +7 -0
  98. package/dist/paint-editor/engine.d.ts +7 -0
  99. package/dist/paint-editor/index.cjs +1564 -1324
  100. package/dist/paint-editor/index.js +1198 -958
  101. package/dist/paint-editor/mark-settings.d.cts +1 -1
  102. package/dist/paint-editor/mark-settings.d.ts +1 -1
  103. package/dist/paint-editor/procedural.d.cts +4 -2
  104. package/dist/paint-editor/procedural.d.ts +4 -2
  105. package/dist/paint-editor/stamp-tip.d.cts +45 -0
  106. package/dist/paint-editor/stamp-tip.d.ts +45 -0
  107. package/dist/paint-editor/stroke.d.cts +4 -0
  108. package/dist/paint-editor/stroke.d.ts +4 -0
  109. package/dist/stickers/index.cjs +4 -2
  110. package/dist/stickers/index.js +6 -4
  111. package/dist/typography/index.cjs +3 -2
  112. package/dist/typography/index.js +2 -1
  113. package/dist/vector/index.cjs +971 -969
  114. package/dist/vector/index.js +8 -6
  115. package/dist/video-editor/index.cjs +4 -2
  116. package/dist/video-editor/index.js +4 -2
  117. package/package.json +1 -1
  118. package/skills/pixerate-brushes/SKILL.md +21 -11
  119. package/skills/pixerate-brushes-design/SKILL.md +6 -2
  120. package/skills/pixerate-brushes-design/evals/canvas-chalk.json +8 -8
  121. package/skills/pixerate-canvas/SKILL.md +3 -2
  122. package/skills/pixerate-image-editor/SKILL.md +1 -1
  123. package/skills/pixerate-paint-editor/SKILL.md +5 -1
  124. package/skills/pixerate-vector/SKILL.md +1 -1
@@ -74,7 +74,7 @@ function profileAlongPolyline(points, values, count = 32) {
74
74
  var round3 = (v) => Math.round(v * 1e3) / 1e3;
75
75
  var loading = null;
76
76
  function loadCanvasBrushstrokeRenderer() {
77
- loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-ZZOXI5O5.cjs"))).catch((error) => {
77
+ loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-MQ6PSDM5.cjs"))).catch((error) => {
78
78
  loading = null;
79
79
  throw error;
80
80
  });
@@ -5,14 +5,14 @@ import {
5
5
  chartToMermaid,
6
6
  describeChart,
7
7
  layoutSparkline
8
- } from "./chunk-RHPSE2YR.js";
8
+ } from "./chunk-MQ6MGIQM.js";
9
9
  import {
10
10
  layoutChart
11
- } from "./chunk-WKMUBATU.js";
11
+ } from "./chunk-C2WEIEUB.js";
12
12
  import {
13
13
  DEFAULT_CHART_THEME,
14
14
  normalizeChartSpec
15
- } from "./chunk-6ZZKRH7R.js";
15
+ } from "./chunk-47V3WXDG.js";
16
16
  import {
17
17
  plainTextToSlice
18
18
  } from "./chunk-2INPJDNY.js";
@@ -18,7 +18,7 @@ import {
18
18
  unionBounds,
19
19
  vectorGradientPoints,
20
20
  widthProfileAt
21
- } from "./chunk-AF23QK5F.js";
21
+ } from "./chunk-YQ4PQTBB.js";
22
22
  import {
23
23
  segmentLength,
24
24
  segmentParamAtLength,
@@ -0,0 +1,142 @@
1
+ import {
2
+ MAX_STICKER_PAGE,
3
+ closestStickerRefs,
4
+ parseStickerRef,
5
+ stickerIdFor,
6
+ stickerRefOf
7
+ } from "./chunk-APX63ILU.js";
8
+ import {
9
+ StickerError
10
+ } from "./chunk-SZTI6EER.js";
11
+
12
+ // src/stickers/tools.ts
13
+ var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
14
+ var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
15
+ function stickerForAgent(provider, s) {
16
+ const { id, thumbnail: _thumbnail, ...rest } = s;
17
+ return { ref: stickerRefOf(provider, id), ...rest };
18
+ }
19
+ async function knownRefs(provider, cap = 500) {
20
+ const refs = [];
21
+ let after;
22
+ while (refs.length < cap) {
23
+ const page = await provider.list({ limit: MAX_STICKER_PAGE, ...after ? { after } : {} });
24
+ refs.push(...page.items.map((s) => stickerRefOf(provider, s.id)));
25
+ if (!page.next || !page.items.length) break;
26
+ after = page.next;
27
+ }
28
+ return refs;
29
+ }
30
+ async function describeStickerRef(provider, ref) {
31
+ parseStickerRef(ref);
32
+ const id = stickerIdFor(provider, ref);
33
+ const found = id === null ? void 0 : await provider.describe(id);
34
+ if (found) return found;
35
+ const near = closestStickerRefs(ref, await knownRefs(provider));
36
+ const owner = parseStickerRef(ref).provider;
37
+ const where = id === null && !provider.namespaced ? ` The sticker library is "${provider.id}", not "${owner}".` : "";
38
+ throw new StickerError("unknown_sticker", `No sticker "${ref}".${where} Closest: ${near.join(", ") || "none"}; find_stickers lists them.`);
39
+ }
40
+ function createStickerTools(options) {
41
+ const find = {
42
+ name: "find_stickers",
43
+ title: "Find stickers",
44
+ description: "Searches the sticker library (the editor's own stamps unless the host plugged in its own): words in the name, tags, category or description, filtered by category, tags and commercial licence, a small page at a time. Returns each sticker's ref (provider:id, for the tools that spray or place stickers), name, category, tags, natural width and height, formats, whether it is tintable (recoloured to the paint colour) and its licence, plus total and next (pass as after for the next page) and the categories. Changes nothing.",
45
+ inputSchema: {
46
+ type: "object",
47
+ properties: {
48
+ query: { type: "string", maxLength: 200, description: "Words to match (default: list everything)." },
49
+ category: { type: "string", description: "Only this category (the result lists them)." },
50
+ tags: { type: "array", maxItems: 10, items: { type: "string", description: "A tag." }, description: "Only stickers with every one of these tags." },
51
+ commercial: { type: "boolean", description: "true: only stickers whose licence allows commercial use." },
52
+ limit: { type: "integer", minimum: 1, maximum: MAX_STICKER_PAGE, description: "Page size (default 24)." },
53
+ after: { type: "string", description: "next from the previous page." }
54
+ },
55
+ additionalProperties: false
56
+ },
57
+ annotations: { title: "Find stickers", ...READ },
58
+ handler: async ({ query, category, tags, commercial, limit, after }) => {
59
+ const p = options.provider();
60
+ const categories = await p.categories?.() ?? null;
61
+ if (category !== void 0 && categories && !categories.some((c) => c.id === category)) {
62
+ throw new StickerError("invalid_argument", `No category "${category}" in "${p.name}"; categories: ${categories.map((c) => c.id).join(", ")}.`);
63
+ }
64
+ const o = { ...category !== void 0 ? { category } : {}, ...tags ? { tags } : {}, ...commercial ? { licence: { commercial: true } } : {}, ...limit !== void 0 ? { limit } : {}, ...after !== void 0 ? { after } : {} };
65
+ const q = typeof query === "string" ? query.trim() : "";
66
+ if (q && !p.capabilities.supportsSearch) throw new StickerError("invalid_argument", `"${p.name}" can't search; leave query out and filter by category instead.`);
67
+ const page = q ? await p.search(q, o) : await p.list(o);
68
+ return { provider: p.id, items: page.items.map((s) => stickerForAgent(p, s)), total: page.total, ...page.next ? { next: page.next } : {}, ...categories ? { categories } : {} };
69
+ }
70
+ };
71
+ const describe = {
72
+ name: "describe_sticker",
73
+ title: "Describe a sticker",
74
+ description: "Everything about one sticker by ref (from find_stickers): name, category, tags, natural size, formats, tintable, licence (with any attribution it asks for), dominant colours, variants and its outline as SVG path data (silhouette). An unknown ref is refused with the closest refs. Changes nothing.",
75
+ inputSchema: { type: "object", properties: { ref: { type: "string", description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." } }, required: ["ref"], additionalProperties: false },
76
+ annotations: { title: "Describe a sticker", ...READ },
77
+ handler: async ({ ref }) => {
78
+ const p = options.provider();
79
+ const d = await describeStickerRef(p, ref);
80
+ const { thumbnail: _thumbnail, id, ...rest } = d;
81
+ return { ref: stickerRefOf(p, id), ...rest };
82
+ }
83
+ };
84
+ return options.insert ? [find, describe, createInsertStickerTool(options.provider, options.insert)] : [find, describe];
85
+ }
86
+ async function loadForHost(provider, ref, d, host, colour, size) {
87
+ const id = stickerIdFor(provider, ref);
88
+ const format = d.formats.includes(host.format) ? host.format : d.formats[0] ?? host.format;
89
+ return provider.load(id, { format, ...format === "png" ? { size: Math.max(8, Math.min(provider.capabilities.maxSize ?? 1024, Math.round(size))) } : {}, ...colour && d.tintable ? { colour } : {} });
90
+ }
91
+ async function insertSticker(provider, host, options) {
92
+ const d = await describeStickerRef(provider, options.ref);
93
+ if (options.color !== void 0 && !d.tintable) throw new StickerError("invalid_argument", `"${options.ref}" is not tintable (its art has its own colours); leave color out, or pick a tintable sticker (find_stickers lists tintable).`);
94
+ if (options.width !== void 0 && !(options.width > 0)) throw new StickerError("invalid_argument", `width must be a positive size, got ${options.width}.`);
95
+ const w = options.width ?? d.width;
96
+ const h = w * d.height / d.width;
97
+ const centre = host.defaultCentre();
98
+ const asset = await loadForHost(provider, options.ref, d, host, options.color, Math.max(w, h));
99
+ const ref = stickerRefOf(provider, d.id);
100
+ const made = await host.insert({ ref, description: d, asset, x: options.x ?? centre.x, y: options.y ?? centre.y, width: w, height: h, ...options.color ? { colour: options.color.toLowerCase() } : {} });
101
+ return { ...made, ref, width: w, height: h, licence: d.licence };
102
+ }
103
+ function createInsertStickerTool(provider, host) {
104
+ return {
105
+ name: "insert_sticker",
106
+ title: "Insert a sticker",
107
+ description: `Puts one sticker from the sticker library (ref from find_stickers) into the document as a new ${host.noun}, centred at x, y and width wide (its natural aspect kept; default its natural size), tinted to color when the sticker is tintable. Its art is loaded first; an unknown ref is refused with the closest ones. One undo step. Returns the new ${host.noun}'s id (for the editor's own tools, such as effects on it), the ref and its licence (credit any attribution it asks for).`,
108
+ inputSchema: {
109
+ type: "object",
110
+ properties: {
111
+ ref: { type: "string", minLength: 1, description: "Sticker ref provider:id from find_stickers (e.g. editor:star)." },
112
+ x: { type: "number", description: "Centre x in document units (default the middle of the view or document)." },
113
+ y: { type: "number", description: "Centre y in document units (default the middle of the view or document)." },
114
+ width: { type: "number", exclusiveMinimum: 0, maximum: 1e4, description: "Width in document units (default the natural width); the height follows the aspect." },
115
+ color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", description: "Tint #rrggbb for tintable stickers (default the sticker's own colour); refused for stickers that are not tintable." }
116
+ },
117
+ required: ["ref"],
118
+ additionalProperties: false
119
+ },
120
+ annotations: { title: "Insert a sticker", ...WRITE },
121
+ handler: ({ ref, x, y, width, color }) => insertSticker(provider(), host, { ref, x, y, width, color })
122
+ };
123
+ }
124
+ function createStickerToolProvider(options) {
125
+ return {
126
+ id: options.id ?? "stickers",
127
+ namespace: options.namespace,
128
+ title: "Stickers",
129
+ description: "Find and describe stickers from the sticker library, by ref (provider:id), for the editors that spray or place them.",
130
+ skill: "pixerate-stickers",
131
+ tools: createStickerTools(options)
132
+ };
133
+ }
134
+
135
+ export {
136
+ stickerForAgent,
137
+ describeStickerRef,
138
+ createStickerTools,
139
+ insertSticker,
140
+ createInsertStickerTool,
141
+ createStickerToolProvider
142
+ };
@@ -1,6 +1,4 @@
1
1
  import {
2
- contrastLevel,
3
- contrastRatio,
4
2
  linearSrgbToDisplayP3,
5
3
  linearToSrgb,
6
4
  oklabToOklch,
@@ -123,31 +121,11 @@ function normalizeColor(input) {
123
121
  return parsed ? formatHex(parsed) : null;
124
122
  }
125
123
 
126
- // src/color/suggest.ts
127
- function suggestAccessibleForeground(foreground, background, options = {}) {
128
- const large = options.large ?? false;
129
- const lch = oklabToOklch(rgbToOklab(foreground));
130
- const asHex = (l) => parseColor(formatHex(toSrgbGamut(oklabToRgb(oklchToOklab({ ...lch, l })))));
131
- for (let d = 0.01; d <= 1; d += 0.01) {
132
- const downCand = asHex(Math.max(0, lch.l - d));
133
- const upCand = asHex(Math.min(1, lch.l + d));
134
- const downRatio = contrastRatio(downCand, background);
135
- const upRatio = contrastRatio(upCand, background);
136
- const downPass = contrastLevel(downRatio, { large }) !== "fail";
137
- const upPass = contrastLevel(upRatio, { large }) !== "fail";
138
- if (downPass && upPass) return formatHex(downRatio >= upRatio ? downCand : upCand);
139
- if (downPass) return formatHex(downCand);
140
- if (upPass) return formatHex(upCand);
141
- }
142
- return void 0;
143
- }
144
-
145
124
  export {
146
125
  inSrgbGamut,
147
126
  deltaEOK,
148
127
  toSrgbGamut,
149
128
  formatHex,
150
129
  formatColor,
151
- normalizeColor,
152
- suggestAccessibleForeground
130
+ normalizeColor
153
131
  };
@@ -0,0 +1,17 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
4
+
5
+
6
+
7
+ var _chunkMLLTWAXHcjs = require('./chunk-MLLTWAXH.cjs');
8
+
9
+ // src/brushes/colour.ts
10
+ function brushColourHex(value, scheme) {
11
+ const css = typeof value === "string" || _chunkMLLTWAXHcjs.isDualColor.call(void 0, value) ? _chunkMLLTWAXHcjs.resolveColor.call(void 0, value, scheme) : null;
12
+ return css ? _nullishCoalesce(_optionalChain([_chunkA2IS7EHEcjs.parseCssColor.call(void 0, css), 'optionalAccess', _ => _.hex, 'access', _2 => _2.toLowerCase, 'call', _3 => _3()]), () => ( null)) : null;
13
+ }
14
+
15
+
16
+
17
+ exports.brushColourHex = brushColourHex;
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkWRZ6C4TUcjs = require('./chunk-WRZ6C4TU.cjs');
11
+ var _chunkP6WYDBTHcjs = require('./chunk-P6WYDBTH.cjs');
12
12
 
13
13
  // src/chart/ooxml.ts
14
14
  var CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
@@ -111,11 +111,11 @@ function chartFromOoxml(xml, options = {}) {
111
111
  try {
112
112
  doc = new (parser(options))().parseFromString(xml, "application/xml");
113
113
  } catch (error) {
114
- return { spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, {}).spec, issues: [{ path: "", message: `The chart XML could not be read: ${error.message}` }], unsupported, lossless: false };
114
+ return { spec: _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, {}).spec, issues: [{ path: "", message: `The chart XML could not be read: ${error.message}` }], unsupported, lossless: false };
115
115
  }
116
116
  const root = doc.documentElement;
117
117
  if (!root || root.localName !== "chartSpace" || doc.getElementsByTagName("parsererror").length) {
118
- return { spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, {}).spec, issues: [{ path: "", message: "This is not a chart part: expected a c:chartSpace (or cx:chartSpace) root element." }], unsupported, lossless: false };
118
+ return { spec: _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, {}).spec, issues: [{ path: "", message: "This is not a chart part: expected a c:chartSpace (or cx:chartSpace) root element." }], unsupported, lossless: false };
119
119
  }
120
120
  if (_optionalChain([root, 'access', _14 => _14.namespaceURI, 'optionalAccess', _15 => _15.includes, 'call', _16 => _16("chartex")]) || kid(root, "chartData")) return readChartex(root, issues, unsupported);
121
121
  const chart = kid(root, "chart");
@@ -280,7 +280,7 @@ function chartFromOoxml(xml, options = {}) {
280
280
  }
281
281
  if (!types.length) {
282
282
  issues.push({ path: "plotArea", message: unsupported.length ? `The chart type is not supported: ${unsupported.join(", ")}.` : "The chart has no plot groups." });
283
- return { spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, input).spec, issues, unsupported, lossless: false };
283
+ return { spec: _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, input).spec, issues, unsupported, lossless: false };
284
284
  }
285
285
  const first = types[0];
286
286
  const combo = types.some((t) => t !== first);
@@ -290,14 +290,14 @@ function chartFromOoxml(xml, options = {}) {
290
290
  if (!combo) {
291
291
  for (const s of series) if (s.axis) issues.push({ path: "series", message: `"${s.name}" is on a second value axis.` });
292
292
  }
293
- if (types.some((t) => !_chunkWRZ6C4TUcjs.isCartesianChart.call(void 0, t)) && combo) unsupported.push("a pie or radar mixed with other chart types");
293
+ if (types.some((t) => !_chunkP6WYDBTHcjs.isCartesianChart.call(void 0, t)) && combo) unsupported.push("a pie or radar mixed with other chart types");
294
294
  input.series = series;
295
295
  input.categories = categories.length ? categories : Array.from({ length: Math.max(0, ...series.map((s) => s.values.length)) }, (_, i) => `${i + 1}`);
296
296
  input.stacking = stacking;
297
297
  input.orientation = orientation;
298
298
  input.dataLabels = dataLabels;
299
299
  input.points = points || first !== "line";
300
- if (bool(val(groups[0], "varyColors")) && !combo && _chunkWRZ6C4TUcjs.isCartesianChart.call(void 0, first) && series.length === 1) input.varyColors = true;
300
+ if (bool(val(groups[0], "varyColors")) && !combo && _chunkP6WYDBTHcjs.isCartesianChart.call(void 0, first) && series.length === 1) input.varyColors = true;
301
301
  const readAxis = (a, fallback) => {
302
302
  const axis = { ...fallback, format: {} };
303
303
  if (!a) return axis;
@@ -324,12 +324,12 @@ function chartFromOoxml(xml, options = {}) {
324
324
  };
325
325
  const xy = first === "scatter" || first === "bubble";
326
326
  const catAxis = _nullishCoalesce(_nullishCoalesce(kid(plot, "catAx"), () => ( kid(plot, "dateAx"))), () => ( (xy ? valAxes.find((a) => !vertical(a)) : void 0)));
327
- input.xAxis = readAxis(catAxis, _chunkWRZ6C4TUcjs.defaultChartAxis.call(void 0, false));
327
+ input.xAxis = readAxis(catAxis, _chunkP6WYDBTHcjs.defaultChartAxis.call(void 0, false));
328
328
  if (kid(plot, "dateAx")) input.xAxis.kind = "date";
329
- input.yAxis = readAxis(_nullishCoalesce(_nullishCoalesce(primaryAxis, () => ( valAxes.find(vertical))), () => ( valAxes[0])), _chunkWRZ6C4TUcjs.defaultChartAxis.call(void 0, true));
329
+ input.yAxis = readAxis(_nullishCoalesce(_nullishCoalesce(primaryAxis, () => ( valAxes.find(vertical))), () => ( valAxes[0])), _chunkP6WYDBTHcjs.defaultChartAxis.call(void 0, true));
330
330
  const secondaryAxis = valAxes.find((a) => a !== primaryAxis && (xy ? vertical(a) && a !== primaryAxis : true) && a !== catAxis);
331
- if (series.some((s) => s.axis === "secondary") && secondaryAxis) input.yAxis2 = readAxis(secondaryAxis, _chunkWRZ6C4TUcjs.defaultChartAxis.call(void 0, false));
332
- const { spec, issues: specIssues } = _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, input);
331
+ if (series.some((s) => s.axis === "secondary") && secondaryAxis) input.yAxis2 = readAxis(secondaryAxis, _chunkP6WYDBTHcjs.defaultChartAxis.call(void 0, false));
332
+ const { spec, issues: specIssues } = _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, input);
333
333
  issues.push(...specIssues);
334
334
  const uniq = [...new Set(unsupported)];
335
335
  return { spec, issues, unsupported: uniq, lossless: uniq.length === 0 && specIssues.length === 0 };
@@ -382,7 +382,7 @@ function readChartex(root, issues, unsupported) {
382
382
  const type = layouts[layout];
383
383
  if (!type) {
384
384
  issues.push({ path: "plotArea", message: `The chart layout "${layout || "unknown"}" is not supported.` });
385
- return { spec: _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, {}).spec, issues, unsupported: [layout || "unknown chartex layout"], lossless: false };
385
+ return { spec: _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, {}).spec, issues, unsupported: [layout || "unknown chartex layout"], lossless: false };
386
386
  }
387
387
  if (layout === "paretoLine") unsupported.push("pareto line");
388
388
  const series = [];
@@ -409,18 +409,18 @@ function readChartex(root, issues, unsupported) {
409
409
  const first = data.get(_nullishCoalesce(_optionalChain([kid, 'call', _35 => _35(seriesEls[0], "dataId"), 'optionalAccess', _36 => _36.getAttribute, 'call', _37 => _37("val")]), () => ( "0")));
410
410
  if ((type === "treemap" || type === "sunburst") && _optionalChain([first, 'optionalAccess', _38 => _38.paths])) {
411
411
  const treeIssues = [];
412
- input.tree = _chunkWRZ6C4TUcjs.chartTreeFromRows.call(void 0, first.paths.map((path2, i) => ({ path: path2, value: _nullishCoalesce(first.values[i], () => ( 0)) })), treeIssues);
412
+ input.tree = _chunkP6WYDBTHcjs.chartTreeFromRows.call(void 0, first.paths.map((path2, i) => ({ path: path2, value: _nullishCoalesce(first.values[i], () => ( 0)) })), treeIssues);
413
413
  for (const t of treeIssues) issues.push({ path: "chartData", message: t.message });
414
414
  }
415
- const { spec, issues: specIssues } = _chunkWRZ6C4TUcjs.normalizeChartSpec.call(void 0, input);
415
+ const { spec, issues: specIssues } = _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, input);
416
416
  issues.push(...specIssues);
417
417
  return { spec, issues, unsupported, lossless: unsupported.length === 0 && specIssues.length === 0 };
418
418
  }
419
419
  var esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
420
420
  var hex = (color) => {
421
421
  if (!color) return null;
422
- const rgb = _chunkWRZ6C4TUcjs.parseChartColor.call(void 0, color);
423
- return rgb ? _chunkWRZ6C4TUcjs.chartRgbToHex.call(void 0, rgb).slice(1).toUpperCase() : null;
422
+ const rgb = _chunkP6WYDBTHcjs.parseChartColor.call(void 0, color);
423
+ return rgb ? _chunkP6WYDBTHcjs.chartRgbToHex.call(void 0, rgb).slice(1).toUpperCase() : null;
424
424
  };
425
425
  var fillXml = (color, line = false) => {
426
426
  const h = hex(color);
@@ -464,7 +464,7 @@ function errBarsXml(bars, dir) {
464
464
  var MARKER_OUT = { circle: "circle", square: "square", diamond: "diamond", triangle: "triangle", cross: "x", none: "none" };
465
465
  function chartToOoxml(spec) {
466
466
  const issues = [];
467
- const family = _chunkWRZ6C4TUcjs.chartFamily.call(void 0, spec);
467
+ const family = _chunkP6WYDBTHcjs.chartFamily.call(void 0, spec);
468
468
  let type = spec.type;
469
469
  if (family === "waterfall" || family === "histogram" || family === "box" || family === "funnel") {
470
470
  issues.push(`${spec.type} charts are written as bar charts: DrawingML has no ${spec.type} type (Office 2016 stores it as chartex).`);
@@ -512,7 +512,7 @@ function chartToOoxml(spec) {
512
512
  const ids = { cat: 500000001, val: 500000002, cat2: 500000003, val2: 500000004 };
513
513
  const xy = family === "xy" || type === "scatter" || type === "bubble";
514
514
  const pieLike = type === "pie" || type === "donut";
515
- const typed = (s) => pieLike || type === "radar" ? type : type === "bubble" ? "bubble" : xy ? "scatter" : _chunkWRZ6C4TUcjs.chartSeriesType.call(void 0, { type }, s);
515
+ const typed = (s) => pieLike || type === "radar" ? type : type === "bubble" ? "bubble" : xy ? "scatter" : _chunkP6WYDBTHcjs.chartSeriesType.call(void 0, { type }, s);
516
516
  const groups = [];
517
517
  visible.forEach((s) => {
518
518
  const kind = typed(s);
@@ -575,7 +575,7 @@ function chartToOoxml(spec) {
575
575
  return `<c:ser>${parts.join("")}</c:ser>`;
576
576
  };
577
577
  const dLbls = `<c:dLbls><c:showLegendKey val="0"/><c:showVal val="${spec.dataLabels ? 1 : 0}"/><c:showCatName val="0"/><c:showSerName val="0"/><c:showPercent val="0"/><c:showBubbleSize val="0"/></c:dLbls>`;
578
- const vary = _chunkWRZ6C4TUcjs.chartVariesColors.call(void 0, spec) ? 1 : 0;
578
+ const vary = _chunkP6WYDBTHcjs.chartVariesColors.call(void 0, spec) ? 1 : 0;
579
579
  const groupXml = groups.map((g) => {
580
580
  const axes2 = g.secondary ? `<c:axId val="${ids.cat2}"/><c:axId val="${ids.val2}"/>` : `<c:axId val="${ids.cat}"/><c:axId val="${ids.val}"/>`;
581
581
  const sers = g.series.map(({ s, index }) => serXml(g.kind, s, index)).join("");