@shbernal/ts-pptx 3.0.0 → 3.2.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 (74) hide show
  1. package/README.md +60 -0
  2. package/dist/{autopage-MxulehqQ.js → autopage-QQyfRtoK.js} +3 -3
  3. package/dist/{autopage-MxulehqQ.js.map → autopage-QQyfRtoK.js.map} +1 -1
  4. package/dist/browser.d.ts +5 -5
  5. package/dist/browser.d.ts.map +1 -1
  6. package/dist/browser.js +5 -5
  7. package/dist/{diagnostics-BqBTmA3a.d.ts → diagnostics-Chjz_4_Q.d.ts} +7 -7
  8. package/dist/{diagnostics-BqBTmA3a.d.ts.map → diagnostics-Chjz_4_Q.d.ts.map} +1 -1
  9. package/dist/{enums-oLLeaSW3.d.ts → enums-CoXnxiCI.d.ts} +5 -5
  10. package/dist/{enums-oLLeaSW3.d.ts.map → enums-CoXnxiCI.d.ts.map} +1 -1
  11. package/dist/{errors-BENA-Xuw.d.ts → errors-BVLCFr-t.d.ts} +25 -3
  12. package/dist/errors-BVLCFr-t.d.ts.map +1 -0
  13. package/dist/{errors-DGE9zh3U.js → errors-Bvln0H-7.js} +21 -2
  14. package/dist/errors-Bvln0H-7.js.map +1 -0
  15. package/dist/{fit-DGSwMMNs.js → fit-DhMbQG5O.js} +0 -0
  16. package/dist/fit-DhMbQG5O.js.map +1 -0
  17. package/dist/{html-dom--J-Xuucf.js → html-dom-DajBuobe.js} +5 -5
  18. package/dist/html-dom-DajBuobe.js.map +1 -0
  19. package/dist/html.d.ts +3 -3
  20. package/dist/html.js +2 -2
  21. package/dist/index.d.ts +5 -5
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +5 -5
  24. package/dist/inspect.d.ts +1 -1
  25. package/dist/inspect.js +4 -4
  26. package/dist/math.d.ts +1 -1
  27. package/dist/math.d.ts.map +1 -1
  28. package/dist/math.js +98 -2
  29. package/dist/math.js.map +1 -1
  30. package/dist/measure.d.ts +3 -3
  31. package/dist/measure.js +2 -2
  32. package/dist/node.d.ts +5 -5
  33. package/dist/node.d.ts.map +1 -1
  34. package/dist/node.js +4 -4
  35. package/dist/package-CaOLXSNi.d.ts.map +1 -1
  36. package/dist/{pres-2WsBGimU.d.ts → pres-C-EU3SkN.d.ts} +3 -3
  37. package/dist/{pres-2WsBGimU.d.ts.map → pres-C-EU3SkN.d.ts.map} +1 -1
  38. package/dist/{presentation-DAcOfzsP.js → presentation-CxnUVhK9.js} +103 -27
  39. package/dist/presentation-CxnUVhK9.js.map +1 -0
  40. package/dist/{presentation-CTVPpiwP.d.ts → presentation-Osx1cDdJ.d.ts} +161 -46
  41. package/dist/presentation-Osx1cDdJ.d.ts.map +1 -0
  42. package/dist/{presentation-types-BVw0EknS.d.ts → presentation-types-Dj4riuDs.d.ts} +2 -2
  43. package/dist/{presentation-types-BVw0EknS.d.ts.map → presentation-types-Dj4riuDs.d.ts.map} +1 -1
  44. package/dist/read.d.ts +5 -5
  45. package/dist/read.js +3 -3
  46. package/dist/script.d.ts +32 -4
  47. package/dist/script.d.ts.map +1 -1
  48. package/dist/script.js +0 -0
  49. package/dist/script.js.map +1 -1
  50. package/dist/{shapes-BWifcHDV.js → shapes-DoJBPrwN.js} +104 -65
  51. package/dist/shapes-DoJBPrwN.js.map +1 -0
  52. package/dist/{slide-YuSCGa45.d.ts → slide-BTfn1Pyp.d.ts} +99 -16
  53. package/dist/slide-BTfn1Pyp.d.ts.map +1 -0
  54. package/dist/{st-enums-CgadEyPM.js → st-enums-evQG2A7Z.js} +2 -2
  55. package/dist/{st-enums-CgadEyPM.js.map → st-enums-evQG2A7Z.js.map} +1 -1
  56. package/dist/{text-120VFSDm.js → text-C4P9MNdf.js} +168 -85
  57. package/dist/text-C4P9MNdf.js.map +1 -0
  58. package/dist/{units-B-JUKwCS.js → units-C7QM1KgH.js} +2 -2
  59. package/dist/{units-B-JUKwCS.js.map → units-C7QM1KgH.js.map} +1 -1
  60. package/dist/{units-internal-CiFWZWk4.js → units-internal-CR8s8YQa.js} +3 -3
  61. package/dist/{units-internal-CiFWZWk4.js.map → units-internal-CR8s8YQa.js.map} +1 -1
  62. package/dist/zip.d.ts +2 -2
  63. package/dist/zip.js +1 -1
  64. package/package.json +18 -17
  65. package/skills/ts-pptx-upstream/SKILL.md +340 -0
  66. package/dist/errors-BENA-Xuw.d.ts.map +0 -1
  67. package/dist/errors-DGE9zh3U.js.map +0 -1
  68. package/dist/fit-DGSwMMNs.js.map +0 -1
  69. package/dist/html-dom--J-Xuucf.js.map +0 -1
  70. package/dist/presentation-CTVPpiwP.d.ts.map +0 -1
  71. package/dist/presentation-DAcOfzsP.js.map +0 -1
  72. package/dist/shapes-BWifcHDV.js.map +0 -1
  73. package/dist/slide-YuSCGa45.d.ts.map +0 -1
  74. package/dist/text-120VFSDm.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { n as warn } from "./diagnostics-DYQC7xLV.js";
2
- import { n as InvalidOptionError } from "./errors-DGE9zh3U.js";
2
+ import { n as InvalidOptionError } from "./errors-Bvln0H-7.js";
3
3
  //#region src/units.ts
4
4
  /**
5
5
  * Public unit conversion helpers and standard PowerPoint slide-layout constants.
@@ -141,4 +141,4 @@ function assertPositiveFiniteNumber(value, name) {
141
141
  //#endregion
142
142
  export { pointsToEmu as _, FIXED_PCT_PER_PERCENT as a, POINTS_PER_INCH as c, emuToInches as d, emuToPixels as f, pixelsToEmu as g, percentToEmu as h, EMU_PER_POINT as i, STANDARD_LAYOUTS as l, inchesToEmu as m, DEFAULT_PX_PER_INCH as n, HUNDREDTHS_PER_POINT as o, emuToPoints as p, EMU_PER_INCH as r, PERCENT_SCALE as s, ANGLE_UNITS_PER_DEGREE as t, coordToEmu as u, ptToHundredths as v };
143
143
 
144
- //# sourceMappingURL=units-B-JUKwCS.js.map
144
+ //# sourceMappingURL=units-C7QM1KgH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"units-B-JUKwCS.js","names":[],"sources":["../src/units.ts"],"sourcesContent":["import { warn } from './diagnostics.js'\nimport { InvalidOptionError } from './errors.js'\n/**\n * Public unit conversion helpers and standard PowerPoint slide-layout constants.\n */\n\nexport const EMU_PER_INCH = 914400\nexport const EMU_PER_POINT = 12700\nexport const POINTS_PER_INCH = 72\n\n/**\n * DrawingML angle unit. `ST_Angle` (`rot`, shadow `dir`, gradient `ang`, …) is measured in\n * sixtieths-of-a-thousandth of a degree, i.e. 60000 units per degree. Multiply a value in\n * degrees by this to get the OOXML integer.\n */\nexport const ANGLE_UNITS_PER_DEGREE = 60000\n\n/**\n * DrawingML fixed-point percentage scale. `ST_Percentage` / `ST_PositiveFixedPercentage` and\n * related types (`<a:alpha>`, `<a:spcPct>`, shape adjustment guides, `<p:tav tm>`, …) encode\n * 100% as the integer 100000. Multiply a 0-1 fraction by this to get the OOXML value.\n */\nexport const PERCENT_SCALE = 100000\n\n/**\n * Scale for a percentage supplied as 0-100 (rather than a 0-1 fraction) into the same\n * fixed-point percentage integer as {@link PERCENT_SCALE} (1% = 1000 units, i.e. thousandths\n * of a percent). Use for inputs documented as percents: transparency/alpha, image crop insets,\n * gradient stops, bullet size, connector adjust, etc.\n */\nexport const FIXED_PCT_PER_PERCENT = PERCENT_SCALE / 100\n\n/**\n * DrawingML text measures font size (`sz`), character spacing (`spc`) and point line/paragraph\n * spacing (`<a:spcPts val>`) in hundredths of a point. Multiply a value in points by this to get\n * the OOXML integer.\n */\nexport const HUNDREDTHS_PER_POINT = 100\n\n/**\n * Convert a value in points to hundredths of a point (rounded), the integer unit DrawingML uses\n * for `sz`, `spc`, and `<a:spcPts val>`. See {@link HUNDREDTHS_PER_POINT}.\n */\nexport function ptToHundredths(pt: number): number {\n\treturn Math.round(pt * HUNDREDTHS_PER_POINT)\n}\n\n/**\n * English Metric Units — the integer unit OOXML serializes geometry in (914400 per inch).\n *\n * Branded so a value that has already been resolved to EMU cannot be silently fed back into a\n * unit converter: {@link coordToEmu} only accepts a user `Coord`, so passing an `Emu` into it is\n * a compile-time error. This replaces the old runtime \"a number ≥ 100 must already be EMU\"\n * magnitude guess, which silently mis-rendered values near the threshold.\n */\nexport type Emu = number & { readonly __unit: 'emu' }\n\n/** A bare number larger than this (in inches) is almost certainly a mistake — likely a raw EMU\n * value passed where inches are expected. We interpret it as inches (the documented contract) but\n * warn, pointing at the explicit `\"<n>emu\"` form. ~1000in is far beyond any real slide. */\nconst IMPLAUSIBLE_INCHES = 1000\n\n/** Default pixel density for the `\"<n>px\"` coordinate unit: CSS reference pixels, also the\n * density ts-pptx assumes when reading an image header's pixel dimensions. */\nexport const DEFAULT_PX_PER_INCH = 96\n\nexport type StandardLayoutName = 'LAYOUT_4x3' | 'LAYOUT_16x9' | 'LAYOUT_16x10' | 'LAYOUT_WIDE'\n\nexport interface StandardLayout {\n\t/** ts-pptx layout key used with `pptx.layout`. */\n\treadonly layout: StandardLayoutName\n\t/** PresentationML slide-size preset name, or `custom` for PowerPoint widescreen. */\n\treadonly name: string\n\t/** Slide width in inches — inches is ts-pptx's default coordinate unit, so this is the value to use for `addText`/`addShape` math. */\n\treadonly widthIn: number\n\t/** Slide height in inches. */\n\treadonly heightIn: number\n\t/** Slide width in English Metric Units. */\n\treadonly widthEmu: number\n\t/** Slide height in English Metric Units. */\n\treadonly heightEmu: number\n}\n\nexport function inchesToEmu(inches: number): Emu {\n\tassertFiniteNumber(inches, 'inches')\n\treturn Math.round(inches * EMU_PER_INCH) as Emu\n}\n\nexport function pointsToEmu(points: number): Emu {\n\tassertFiniteNumber(points, 'points')\n\treturn Math.round(points * EMU_PER_POINT) as Emu\n}\n\nexport function pixelsToEmu(pixels: number, dpi: number): Emu {\n\tassertFiniteNumber(pixels, 'pixels')\n\tassertPositiveFiniteNumber(dpi, 'dpi')\n\treturn inchesToEmu(pixels / dpi)\n}\n\n/**\n * Resolve a percentage of an axis length to EMU.\n * @param percent - percentage value (e.g. `50` for 50%)\n * @param axisEmu - the axis length in EMU (slide width for x/w, height for y/h)\n */\nexport function percentToEmu(percent: number, axisEmu: number): Emu {\n\tassertFiniteNumber(percent, 'percent')\n\tassertFiniteNumber(axisEmu, 'axisEmu')\n\treturn Math.round((percent / 100) * axisEmu) as Emu\n}\n\n/**\n * The single user-coordinate → EMU boundary. Convert each user-supplied coordinate exactly once.\n *\n * Accepts (see {@link Coord}):\n * - a bare `number` → **always inches** (the documented unit); no magnitude guessing\n * - `\"<n>%\"` → percentage of `axisEmu`\n * - `\"<n>in\"` / `\"<n>pt\"` / `\"<n>px\"` / `\"<n>emu\"` → explicit units (the escape hatch for non-inch\n * values). `px` is resolved at {@link DEFAULT_PX_PER_INCH} (96), for authoring against a known\n * web/source canvas size.\n *\n * Throws on non-finite or unparseable input rather than silently emitting a degenerate 0-size.\n * @param value - user coordinate\n * @param axisEmu - axis length in EMU, used only to resolve percentages\n */\nexport function coordToEmu(value: number | string, axisEmu: number): Emu {\n\tif (typeof value === 'number') {\n\t\tassertFiniteNumber(value, 'coordinate')\n\t\tif (Math.abs(value) > IMPLAUSIBLE_INCHES) {\n\t\t\twarn(\n\t\t\t\t'coord/bare-number-is-inches',\n\t\t\t\t`coordinate ${value} interpreted as ${value} inches. A bare number is always inches; ` +\n\t\t\t\t\t`if you meant EMU, pass it as a string like \"${Math.round(value)}emu\".`\n\t\t\t)\n\t\t}\n\t\treturn inchesToEmu(value)\n\t}\n\n\tconst match = /^\\s*(-?\\d*\\.?\\d+)\\s*(%|in|pt|px|emu)\\s*$/.exec(value)\n\tif (!match) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'coord/invalid-format',\n\t\t\t`Invalid coordinate \"${value}\". Expected a number (inches) or a string like \"50%\", \"5in\", \"72pt\", \"96px\", or \"914400emu\".`\n\t\t)\n\t}\n\tconst n = Number(match[1])\n\tswitch (match[2]) {\n\t\tcase '%':\n\t\t\treturn percentToEmu(n, axisEmu)\n\t\tcase 'in':\n\t\t\treturn inchesToEmu(n)\n\t\tcase 'pt':\n\t\t\treturn pointsToEmu(n)\n\t\tcase 'px':\n\t\t\treturn pixelsToEmu(n, DEFAULT_PX_PER_INCH)\n\t\tdefault: // 'emu'\n\t\t\tassertFiniteNumber(n, 'coordinate')\n\t\t\treturn Math.round(n) as Emu\n\t}\n}\n\nexport function emuToInches(emu: number): number {\n\tassertFiniteNumber(emu, 'emu')\n\treturn emu / EMU_PER_INCH\n}\n\nexport function emuToPoints(emu: number): number {\n\tassertFiniteNumber(emu, 'emu')\n\treturn emu / EMU_PER_POINT\n}\n\nexport function emuToPixels(emu: number, dpi: number): number {\n\tassertFiniteNumber(emu, 'emu')\n\tassertPositiveFiniteNumber(dpi, 'dpi')\n\treturn Math.round(emuToInches(emu) * dpi)\n}\n\nfunction standardLayout(layout: StandardLayoutName, name: string, widthIn: number, heightIn: number): StandardLayout {\n\treturn Object.freeze({\n\t\tlayout,\n\t\tname,\n\t\twidthIn,\n\t\theightIn,\n\t\twidthEmu: inchesToEmu(widthIn),\n\t\theightEmu: inchesToEmu(heightIn),\n\t})\n}\n\nexport const STANDARD_LAYOUTS: Readonly<Record<StandardLayoutName, StandardLayout>> = Object.freeze({\n\tLAYOUT_4x3: standardLayout('LAYOUT_4x3', 'screen4x3', 10, 7.5),\n\tLAYOUT_16x9: standardLayout('LAYOUT_16x9', 'screen16x9', 10, 5.625),\n\tLAYOUT_16x10: standardLayout('LAYOUT_16x10', 'screen16x10', 10, 6.25),\n\tLAYOUT_WIDE: standardLayout('LAYOUT_WIDE', 'custom', 40 / 3, 7.5),\n})\n\nfunction assertFiniteNumber(value: number, name: string): void {\n\tif (!Number.isFinite(value)) throw new InvalidOptionError('coord/non-finite', `${name} must be a finite number`)\n}\n\nfunction assertPositiveFiniteNumber(value: number, name: string): void {\n\tassertFiniteNumber(value, name)\n\tif (value <= 0) throw new InvalidOptionError('coord/not-positive', `${name} must be greater than 0`)\n}\n"],"mappings":";;;;;;AAMA,MAAa,eAAe;AAC5B,MAAa,gBAAgB;AAC7B,MAAa,kBAAkB;;;;;;AAO/B,MAAa,yBAAyB;;;;;;AAOtC,MAAa,gB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,GAAA,EAAsB;EAC1C;GACC,mBAAmB,GAAG,YAAY;GAClC,OAAO,KAAK,MAAM,CAAC;CACrB;AACD;AAEA,SAAgB,YAAY,KAAqB;CAChD,mBAAmB,KAAK,KAAK;CAC7B,OAAO,MAAM;AACd;AAEA,SAAgB,YAAY,KAAqB;CAChD,mBAAmB,KAAK,KAAK;CAC7B,OAAO,MAAM;AACd;AAEA,SAAgB,YAAY,KAAa,KAAqB;CAC7D,mBAAmB,KAAK,KAAK;CAC7B,2BAA2B,KAAK,KAAK;CACrC,OAAO,KAAK,MAAM,YAAY,GAAG,IAAI,GAAG;AACzC;AAEA,SAAS,eAAe,QAA4B,MAAc,SAAiB,UAAkC;CACpH,OAAO,OAAO,OAAO;EACpB;EACA;EACA;EACA;EACA,UAAU,YAAY,OAAO;EAC7B,WAAW,YAAY,QAAQ;CAChC,CAAC;AACF;AAEA,MAAa,mBAAyE,OAAO,OAAO;CACnG,YAAY,eAAe,cAAc,aAAa,IAAI,GAAG;CAC7D,aAAa,eAAe,eAAe,cAAc,IAAI,KAAK;CAClE,cAAc,eAAe,gBAAgB,eAAe,IAAI,IAAI;CACpE,aAAa,eAAe,eAAe,UAAU,KAAK,GAAG,GAAG;AACjE,CAAC;AAED,SAAS,mBAAmB,OAAe,MAAoB;CAC9D,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,MAAM,IAAI,mBAAmB,oBAAoB,GAAG,KAAK,yBAAyB;AAChH;AAEA,SAAS,2BAA2B,OAAe,MAAoB;CACtE,mBAAmB,OAAO,IAAI;CAC9B,IAAI,SAAS,GAAG,MAAM,IAAI,mBAAmB,sBAAsB,GAAG,KAAK,wBAAwB;AACpG"}
1
+ {"version":3,"file":"units-C7QM1KgH.js","names":[],"sources":["../src/units.ts"],"sourcesContent":["import { warn } from './diagnostics.js'\nimport { InvalidOptionError } from './errors.js'\n/**\n * Public unit conversion helpers and standard PowerPoint slide-layout constants.\n */\n\nexport const EMU_PER_INCH = 914400\nexport const EMU_PER_POINT = 12700\nexport const POINTS_PER_INCH = 72\n\n/**\n * DrawingML angle unit. `ST_Angle` (`rot`, shadow `dir`, gradient `ang`, …) is measured in\n * sixtieths-of-a-thousandth of a degree, i.e. 60000 units per degree. Multiply a value in\n * degrees by this to get the OOXML integer.\n */\nexport const ANGLE_UNITS_PER_DEGREE = 60000\n\n/**\n * DrawingML fixed-point percentage scale. `ST_Percentage` / `ST_PositiveFixedPercentage` and\n * related types (`<a:alpha>`, `<a:spcPct>`, shape adjustment guides, `<p:tav tm>`, …) encode\n * 100% as the integer 100000. Multiply a 0-1 fraction by this to get the OOXML value.\n */\nexport const PERCENT_SCALE = 100000\n\n/**\n * Scale for a percentage supplied as 0-100 (rather than a 0-1 fraction) into the same\n * fixed-point percentage integer as {@link PERCENT_SCALE} (1% = 1000 units, i.e. thousandths\n * of a percent). Use for inputs documented as percents: transparency/alpha, image crop insets,\n * gradient stops, bullet size, connector adjust, etc.\n */\nexport const FIXED_PCT_PER_PERCENT = PERCENT_SCALE / 100\n\n/**\n * DrawingML text measures font size (`sz`), character spacing (`spc`) and point line/paragraph\n * spacing (`<a:spcPts val>`) in hundredths of a point. Multiply a value in points by this to get\n * the OOXML integer.\n */\nexport const HUNDREDTHS_PER_POINT = 100\n\n/**\n * Convert a value in points to hundredths of a point (rounded), the integer unit DrawingML uses\n * for `sz`, `spc`, and `<a:spcPts val>`. See {@link HUNDREDTHS_PER_POINT}.\n */\nexport function ptToHundredths(pt: number): number {\n\treturn Math.round(pt * HUNDREDTHS_PER_POINT)\n}\n\n/**\n * English Metric Units — the integer unit OOXML serializes geometry in (914400 per inch).\n *\n * Branded so a value that has already been resolved to EMU cannot be silently fed back into a\n * unit converter: {@link coordToEmu} only accepts a user `Coord`, so passing an `Emu` into it is\n * a compile-time error. This replaces the old runtime \"a number ≥ 100 must already be EMU\"\n * magnitude guess, which silently mis-rendered values near the threshold.\n */\nexport type Emu = number & { readonly __unit: 'emu' }\n\n/** A bare number larger than this (in inches) is almost certainly a mistake — likely a raw EMU\n * value passed where inches are expected. We interpret it as inches (the documented contract) but\n * warn, pointing at the explicit `\"<n>emu\"` form. ~1000in is far beyond any real slide. */\nconst IMPLAUSIBLE_INCHES = 1000\n\n/** Default pixel density for the `\"<n>px\"` coordinate unit: CSS reference pixels, also the\n * density ts-pptx assumes when reading an image header's pixel dimensions. */\nexport const DEFAULT_PX_PER_INCH = 96\n\nexport type StandardLayoutName = 'LAYOUT_4x3' | 'LAYOUT_16x9' | 'LAYOUT_16x10' | 'LAYOUT_WIDE'\n\nexport interface StandardLayout {\n\t/** ts-pptx layout key used with `pptx.layout`. */\n\treadonly layout: StandardLayoutName\n\t/** PresentationML slide-size preset name, or `custom` for PowerPoint widescreen. */\n\treadonly name: string\n\t/** Slide width in inches — inches is ts-pptx's default coordinate unit, so this is the value to use for `addText`/`addShape` math. */\n\treadonly widthIn: number\n\t/** Slide height in inches. */\n\treadonly heightIn: number\n\t/** Slide width in English Metric Units. */\n\treadonly widthEmu: number\n\t/** Slide height in English Metric Units. */\n\treadonly heightEmu: number\n}\n\nexport function inchesToEmu(inches: number): Emu {\n\tassertFiniteNumber(inches, 'inches')\n\treturn Math.round(inches * EMU_PER_INCH) as Emu\n}\n\nexport function pointsToEmu(points: number): Emu {\n\tassertFiniteNumber(points, 'points')\n\treturn Math.round(points * EMU_PER_POINT) as Emu\n}\n\nexport function pixelsToEmu(pixels: number, dpi: number): Emu {\n\tassertFiniteNumber(pixels, 'pixels')\n\tassertPositiveFiniteNumber(dpi, 'dpi')\n\treturn inchesToEmu(pixels / dpi)\n}\n\n/**\n * Resolve a percentage of an axis length to EMU.\n * @param percent - percentage value (e.g. `50` for 50%)\n * @param axisEmu - the axis length in EMU (slide width for x/w, height for y/h)\n */\nexport function percentToEmu(percent: number, axisEmu: number): Emu {\n\tassertFiniteNumber(percent, 'percent')\n\tassertFiniteNumber(axisEmu, 'axisEmu')\n\treturn Math.round((percent / 100) * axisEmu) as Emu\n}\n\n/**\n * The single user-coordinate → EMU boundary. Convert each user-supplied coordinate exactly once.\n *\n * Accepts (see {@link Coord}):\n * - a bare `number` → **always inches** (the documented unit); no magnitude guessing\n * - `\"<n>%\"` → percentage of `axisEmu`\n * - `\"<n>in\"` / `\"<n>pt\"` / `\"<n>px\"` / `\"<n>emu\"` → explicit units (the escape hatch for non-inch\n * values). `px` is resolved at {@link DEFAULT_PX_PER_INCH} (96), for authoring against a known\n * web/source canvas size.\n *\n * Throws on non-finite or unparseable input rather than silently emitting a degenerate 0-size.\n * @param value - user coordinate\n * @param axisEmu - axis length in EMU, used only to resolve percentages\n */\nexport function coordToEmu(value: number | string, axisEmu: number): Emu {\n\tif (typeof value === 'number') {\n\t\tassertFiniteNumber(value, 'coordinate')\n\t\tif (Math.abs(value) > IMPLAUSIBLE_INCHES) {\n\t\t\twarn(\n\t\t\t\t'coord/bare-number-is-inches',\n\t\t\t\t`coordinate ${value} interpreted as ${value} inches. A bare number is always inches; ` +\n\t\t\t\t\t`if you meant EMU, pass it as a string like \"${Math.round(value)}emu\".`\n\t\t\t)\n\t\t}\n\t\treturn inchesToEmu(value)\n\t}\n\n\tconst match = /^\\s*(-?\\d*\\.?\\d+)\\s*(%|in|pt|px|emu)\\s*$/.exec(value)\n\tif (!match) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'coord/invalid-format',\n\t\t\t`Invalid coordinate \"${value}\". Expected a number (inches) or a string like \"50%\", \"5in\", \"72pt\", \"96px\", or \"914400emu\".`\n\t\t)\n\t}\n\tconst n = Number(match[1])\n\tswitch (match[2]) {\n\t\tcase '%':\n\t\t\treturn percentToEmu(n, axisEmu)\n\t\tcase 'in':\n\t\t\treturn inchesToEmu(n)\n\t\tcase 'pt':\n\t\t\treturn pointsToEmu(n)\n\t\tcase 'px':\n\t\t\treturn pixelsToEmu(n, DEFAULT_PX_PER_INCH)\n\t\tdefault: // 'emu'\n\t\t\tassertFiniteNumber(n, 'coordinate')\n\t\t\treturn Math.round(n) as Emu\n\t}\n}\n\nexport function emuToInches(emu: number): number {\n\tassertFiniteNumber(emu, 'emu')\n\treturn emu / EMU_PER_INCH\n}\n\nexport function emuToPoints(emu: number): number {\n\tassertFiniteNumber(emu, 'emu')\n\treturn emu / EMU_PER_POINT\n}\n\nexport function emuToPixels(emu: number, dpi: number): number {\n\tassertFiniteNumber(emu, 'emu')\n\tassertPositiveFiniteNumber(dpi, 'dpi')\n\treturn Math.round(emuToInches(emu) * dpi)\n}\n\nfunction standardLayout(layout: StandardLayoutName, name: string, widthIn: number, heightIn: number): StandardLayout {\n\treturn Object.freeze({\n\t\tlayout,\n\t\tname,\n\t\twidthIn,\n\t\theightIn,\n\t\twidthEmu: inchesToEmu(widthIn),\n\t\theightEmu: inchesToEmu(heightIn),\n\t})\n}\n\nexport const STANDARD_LAYOUTS: Readonly<Record<StandardLayoutName, StandardLayout>> = Object.freeze({\n\tLAYOUT_4x3: standardLayout('LAYOUT_4x3', 'screen4x3', 10, 7.5),\n\tLAYOUT_16x9: standardLayout('LAYOUT_16x9', 'screen16x9', 10, 5.625),\n\tLAYOUT_16x10: standardLayout('LAYOUT_16x10', 'screen16x10', 10, 6.25),\n\tLAYOUT_WIDE: standardLayout('LAYOUT_WIDE', 'custom', 40 / 3, 7.5),\n})\n\nfunction assertFiniteNumber(value: number, name: string): void {\n\tif (!Number.isFinite(value)) throw new InvalidOptionError('coord/non-finite', `${name} must be a finite number`)\n}\n\nfunction assertPositiveFiniteNumber(value: number, name: string): void {\n\tassertFiniteNumber(value, name)\n\tif (value <= 0) throw new InvalidOptionError('coord/not-positive', `${name} must be greater than 0`)\n}\n"],"mappings":";;;;;;AAMA,MAAa,eAAe;AAC5B,MAAa,gBAAgB;AAC7B,MAAa,kBAAkB;;;;;;AAO/B,MAAa,yBAAyB;;;;;;AAOtC,MAAa,gBAAgB;;;;;;;AAQ7B,MAAa,wBAAwB,gBAAgB;;;;;;AAOrD,MAAa,uBAAuB;;;;;AAMpC,SAAgB,eAAe,IAAoB;CAClD,OAAO,KAAK,MAAM,KAA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K,KAAK;CAC7B,OAAO,MAAM;AACd;AAEA,SAAgB,YAAY,KAAqB;CAChD,mBAAmB,KAAK,KAAK;CAC7B,OAAO,MAAM;AACd;AAEA,SAAgB,YAAY,KAAa,KAAqB;CAC7D,mBAAmB,KAAK,KAAK;CAC7B,2BAA2B,KAAK,KAAK;CACrC,OAAO,KAAK,MAAM,YAAY,GAAG,IAAI,GAAG;AACzC;AAEA,SAAS,eAAe,QAA4B,MAAc,SAAiB,UAAkC;CACpH,OAAO,OAAO,OAAO;EACpB;EACA;EACA;EACA;EACA,UAAU,YAAY,OAAO;EAC7B,WAAW,YAAY,QAAQ;CAChC,CAAC;AACF;AAEA,MAAa,mBAAyE,OAAO,OAAO;CACnG,YAAY,eAAe,cAAc,aAAa,IAAI,GAAG;CAC7D,aAAa,eAAe,eAAe,cAAc,IAAI,KAAK;CAClE,cAAc,eAAe,gBAAgB,eAAe,IAAI,IAAI;CACpE,aAAa,eAAe,eAAe,UAAU,KAAK,GAAG,GAAG;AACjE,CAAC;AAED,SAAS,mBAAmB,OAAe,MAAoB;CAC9D,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,MAAM,IAAI,mBAAmB,oBAAoB,GAAG,KAAK,yBAAyB;AAChH;AAEA,SAAS,2BAA2B,OAAe,MAAoB;CACtE,mBAAmB,OAAO,IAAI;CAC9B,IAAI,SAAS,GAAG,MAAM,IAAI,mBAAmB,sBAAsB,GAAG,KAAK,wBAAwB;AACpG"}
@@ -1,6 +1,6 @@
1
1
  import { n as warn, r as warnOnce } from "./diagnostics-DYQC7xLV.js";
2
- import { n as InvalidOptionError } from "./errors-DGE9zh3U.js";
3
- import { a as FIXED_PCT_PER_PERCENT, i as EMU_PER_POINT, m as inchesToEmu, r as EMU_PER_INCH, s as PERCENT_SCALE, t as ANGLE_UNITS_PER_DEGREE, u as coordToEmu } from "./units-B-JUKwCS.js";
2
+ import { n as InvalidOptionError } from "./errors-Bvln0H-7.js";
3
+ import { a as FIXED_PCT_PER_PERCENT, i as EMU_PER_POINT, m as inchesToEmu, r as EMU_PER_INCH, s as PERCENT_SCALE, t as ANGLE_UNITS_PER_DEGREE, u as coordToEmu } from "./units-C7QM1KgH.js";
4
4
  //#region src/enums.ts
5
5
  let TextAnchor = /* @__PURE__ */ function(TextAnchor) {
6
6
  TextAnchor["b"] = "b";
@@ -721,4 +721,4 @@ function convertArcAngle(d, attr) {
721
721
  //#endregion
722
722
  export { connectorPresetFor as $, IMG_PLAYBTN as A, AlignV as B, DEF_PRES_LAYOUT_NAME as C, DEF_TEXT_GLOW as D, DEF_SLIDE_MARGIN_IN as E, PIECHART_COLORS as F, PlaceholderType as G, CONNECTOR_PRESETS as H, REGEX_HEX_COLOR as I, SlideObjectType as J, SchemeColor as K, SLDNUMFLDID as L, LAYOUT_IDX_SERIES_BASE as M, LETTERS as N, DEF_TEXT_SHADOW as O, LINEH_MODIFIER as P, asChartType as Q, XML_DECL as R, DEF_PRES_LAYOUT as S, DEF_SHAPE_SHADOW as T, ChartType as U, BulletType as V, OutputType as W, TextAnchor as X, TableStyle as Y, VALID_SHAPE_PRESETS as Z, DEF_CELL_BORDER as _, lineWidthToEmu as a, DEF_CHART_GRIDLINE as b, resolveTableColWidthsEmu as c, AXIS_ID_CATEGORY_PRIMARY as d, isChartExType as et, AXIS_ID_CATEGORY_SECONDARY as f, BARCHART_COLORS as g, AXIS_ID_VALUE_SECONDARY as h, inch2Emu as i, IMG_SVG_PLACEHOLDER as j, IMG_BROKEN as k, transparencyToAlpha as l, AXIS_ID_VALUE_PRIMARY as m, convertRotationDegrees as n, marginToEmu as o, AXIS_ID_SERIES_PRIMARY as p, ShapeType as q, getSmartParseNumber as r, opacityToAlpha as s, convertArcAngle as t, valToPts as u, DEF_CELL_MARGIN_IN as v, DEF_SHAPE_LINE_COLOR as w, DEF_FONT_COLOR as x, DEF_CHART_BORDER as y, AlignH as z };
723
723
 
724
- //# sourceMappingURL=units-internal-CiFWZWk4.js.map
724
+ //# sourceMappingURL=units-internal-CR8s8YQa.js.map